Math 51/COEN 19 Dr. Linnell. Who am I? Who are you? What’s your major? Year? Do you have any...

Preview:

DESCRIPTION

Who are you? What’s your major? Year? Do you have any programming experience? Something else about yourself

Citation preview

Math 51/COEN 19

Dr. Linnell

Who am I?

Who are you?

• What’s your major? Year?• Do you have any programming experience?• Something else about yourself

Logic is the basis of:

• Circuits• Programming• Mathematical proof• Good decision making

Predicate

• A statement that is either true of false• Are these predicates or not?– Joe Biden hates taking out the trash.– Did you take out the trash?– Take out the trash!– Taking out the trash is fun!– Don’t make me make you take out the trash.

Predicate or not?

• 2+4=6• 2+2=5• 3+x=4• x+y=z• 8<6

Predicate or not?

• 2+4=6• 2+2=5• 3+x=4• x+y=z• 8<6

• Mathematical sense of =• We don’t assume variables have values

NegationEnglish Logic Programming Logic name

not ! negation

• Negation of “Joe Biden loves Prince”

• Negation of the negation?

ConjunctionEnglish Logic Programming Logic name

and && Conjunction

• Conjunction of “Joe Biden loves Prince”, “Joe Biden hates Kanye West”

Disjunction

• Disjunction of “Joe Biden loves Prince”, “Joe Biden hates Kanye West”

English Logic Programming Logic name

or || Disjunction

Exclusive orEnglish Logic Programming Logic name

or Exclusive or

• xor of “Joe Biden loves Prince”, “Joe Biden hates Kanye West”

Implication

• Implication of “Joe took out the trash”, “Joe can have cake”

English Logic Programming Logic name

if p then qq if pq unless not p

Implication, conditional

Double ImplicationEnglish Logic Programming Logic name

p if and only if qif p then q

if() {}(kind of)

Bidirectional implication

English Logic Programming Logic name

not ! negation

and && Conjunction

or || Disjunction

or Exclusive or

if-then implication

If and only if if() {} (kind of)

Bidirectional implication

Commonly seen conditionals

• p ->q• Converse

• Contrapositive

• Inverse