Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Object > Basic Laws of A...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 338 of 365
Post > Topic >>

Basic Laws of Algebra / dbd Example

by "Neo" <neo55592@[EMAIL PROTECTED] > Jan 16, 2007 at 09:02 AM

The following basic laws of algebra can be found in many text books:

Commutative:  A and B = B and A
                      A or B = B or A
Associative:    A and (B and C) = (A and B) and C
                     A or (B or C) = (A or B) or C
Idempotent:    A and A = A
                     A or A = A
Absorbtive:    (A and B) or B = B
                    (A or B) and B = B

....where A, B and C can be sets of anything.

Dbd example below shows the above with following data:

A has john, mary and apple.
B has john, mary and orange.
C has mary, apple and orange.

And each thing in A, B and C has different classifications and
attributes. See script below for details.

(new 'gender)
(new 'build)
(new 'color)
(new 'flavor)
(new 'like 'verb)

(new 'apple 'fruit)
(set+ apple color 'red)

(new 'orange 'fruit)
(set+ orange flavor 'tart)
(set+ orange color 'orange)

(new 'mary 'person 'student)
(set+ mary build 'tall)
(set+ mary build 'thin)
(set  mary like orange)
(set  mary like apple)

(new 'john 'person 'engineer)
(set+ john gender 'male)
(set  john like mary)

(new 'A 'group)
(new 'B 'group)
(new 'C 'group)

(set A has john)
(set A has mary)
(set A has apple)

(set B has john)
(set B has mary)
(set B has orange)

(set C has mary)
(set C has apple)
(set C has orange)


(; **************************************)
(; Verify COMMUTATIVE: (= (& A B)
                                          (& B A))       )
(; Gets john and mary)
(= (& (get A has *) (get B has *))
    (& (get B has *) (get A has *)))

(; Verify COMMUTATIVE: (= (| A B)
                                          (| B A))       )
(; Gets john, mary, apple,
           john, mary, orange)
(= (| (get A has *) (get B has *))
    (| (get B has *) (get A has *)))

(; **************************************)
(; Demo ASSOCIATIVE: (= (& A (& B C))
                                        (& (& A B) C))   )
(; Gets mary)
(= (& (get A has *) (& (get B has *) (get C has *)))
    (& (& (get A has *) (get B has *)) (get C has *)))

(; Demo ASSOCIATIVE: (= (| A (| B C))
                                        (| (| A B) C))   )
(; Gets john, mary, apple,
           john, mary, orange,
           mary, apple, orange)
(= (| (get A has *) (| (get B has *) (get C has *)))
    (| (| (get A has *) (get B has *)) (get C has *)))

(; **************************************)
(; Verify IDEMPOTENT: (= (& A A)
                                       A)              )
(; Gets john, mary, apple)
(= (& (get A has *) (get A has *))
    (get A has *))

(; Verify IDEMPOTENT: (= (| A A)
                                       A)              )
(; Gets john, mary, apple
           john, mary, apple)
(= (| (get A has *) (get A has *))
    (get A has *))

(; **************************************)
(; Verify ABSORBTIVE: (= (| (& A B) B)
                                       B)              )
(; Gets john, mary
           john, mary, orange)
(= (| (& (get A has *) (get B has *)) (get B has *))
    (get B has *))

(; Verify ABSORBTIVE: (= (& (| A B) B)
                                       B)              )
(; Gets john, mary
           john, mary, orange)
(= (& (| (get A has *) (get B has *)) (get B has *))
    (get B has *)) 

More examples at www.dbfordummies.com/example
 




 1 Posts in Topic:
Basic Laws of Algebra / dbd Example
"Neo" <neo55  2007-01-16 09:02:24 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Thu Jul 24 6:00:41 CDT 2008.