truth, deduction, computation; lecture 5

31
Truth, Deduction, Computation Lecture 5 Boolean Logic Vlad Patryshev SCU 2013

Upload: vlad-patryshev

Post on 01-Nov-2014

212 views

Category:

Education


3 download

DESCRIPTION

Lecture 5 of my logic course at Santa Clara University Boolean logic

TRANSCRIPT

Page 1: Truth, deduction, computation;  lecture 5

Truth, Deduction, ComputationLecture 5Boolean Logic

Vlad PatryshevSCU2013

Page 2: Truth, deduction, computation;  lecture 5

Earlier we had…

<atomic formula> ::= <predicate>(<arguments>)<arguments> ::= <term>|<arguments>,<term>

Now let’s build formulas out of atomic formulas!

Page 3: Truth, deduction, computation;  lecture 5

Negation

● not(a)● !a● ~a● a● ¬a

P ¬P

TRUE FALSE

FALSE TRUE

¬¬¬Cube(c) is the same as ¬Cube(c)¬¬Cube(c) is the same as Cube(c)?

Notation:a ≠ b means ¬(a = b)

(Chapter 3)

Page 4: Truth, deduction, computation;  lecture 5

Negation

● not(a)● !a● ~a● a● ¬a

P ¬P

TRUE FALSE

FALSE TRUE

¬¬¬Cube(c) is the same as ¬Cube(c)¬¬Cube(c) is the same as Cube(c)? ...it depends...

Notation:a ≠ b means ¬(a = b)

Well...

Page 5: Truth, deduction, computation;  lecture 5

Negation Rules

● If P is a sentence, so is ¬P

● A sentence that is either atomic

or a negation of atomic is called

literal

Page 6: Truth, deduction, computation;  lecture 5

Conjunction

● a and b● a ∧ b● a & b● a && b

Well...

P Q P ∧ Q

TRUE TRUE TRUE

TRUE FALSE FALSE

FALSE TRUE FALSE

FALSE FALSE FALSEExamples:

● Tet(f) ∧ Small(f)● ¬(Tet(f) ∧ ¬Large(f)● if (1 < a && a < 1) alert(“ouch”)

Page 7: Truth, deduction, computation;  lecture 5

Disjunction

● a or b● a v b● a | b● a || b

Well...

P Q P v Q

TRUE TRUE TRUE

TRUE FALSE TRUE

FALSE TRUE TRUE

FALSE FALSE TRUEExamples:

● Tet(f) v Small(f)● ¬(Tet(f) v ¬Large(f)● if (0 < a || a < 0) alert(“good”)● Dead(AshwathamaTheHuman) or Dead(AshwathamaTheElephant)

Page 8: Truth, deduction, computation;  lecture 5

Conjunction and Disjunction Rules

● If P and Q are sentences, so is P∧Q

● If P and Q are sentences, so is PvQ

Page 9: Truth, deduction, computation;  lecture 5

Need Parentheses

● Home(max) v Home(claire) ∧ Happy(carl)

● ¬ Home(max) v ¬ Home(claire) ∧ Happy(carl)

Avoid Ambiguity (remember Yudhisthira)

Page 10: Truth, deduction, computation;  lecture 5

Associativity Rules (or are they laws?)

● ((P ∧ Q) ∧ R) <=> (P ∧ (Q ∧ R))

● ((P v Q) v R) <=> (P v (Q v R))

Actually… we have two monoids!

Page 11: Truth, deduction, computation;  lecture 5

Commutativity Rules

● P ∧ Q <=> Q ∧ P

● P v Q <=> Q v P

We have two commutative monoids!

Page 12: Truth, deduction, computation;  lecture 5

Idempotence Rules

● P ∧ P <=> P

● P v P <=> P

We have two commutative idempotent monoids!

(we are closer to sets than we thought)

Page 13: Truth, deduction, computation;  lecture 5

Logical Formulas, formally

<formula> ::= <atomic formula>

<formula> ::= ¬<formula>

<formula> ::= (<formula>)

<formula> ::= <formula>v<formula>

<formula> ::= <formula>∧<formula>

Page 14: Truth, deduction, computation;  lecture 5

Some More Laws

● Double Negation: ¬¬P ⇔ P

● DeMorgan: ¬(P ∧ Q) ⇔ ¬P v ¬Q● DeMorgan: ¬(P v Q) ⇔ ¬P ∧ ¬Q

Page 15: Truth, deduction, computation;  lecture 5

Philosophy on Page 94

“it is necessarily the case that S” - what’s the difference with just S?

If a formula depends on entities, it’s called “Truth-functional”

And if it is always (constant) true, it can be considered as “not truth-functional”... see next

(Chapter 4)

Page 16: Truth, deduction, computation;  lecture 5

More definitions

Logical Truth - “logically necessary sentences” -

consequences that follow from an empty list of premises

Logical Possibility - “logically possible sentences” -

sentences which negation cannot be proven for a given

collection of entities and rules (example in Tarsky World)

Tautology (from Greek ταυτολογία) is a formula which is

true in every possible interpretation. [wikipedia] That is, it

will be true, whatever the argument entities.

Page 17: Truth, deduction, computation;  lecture 5

Truth Tables

S = ..A1..A

2...A

n.. e.g. ¬(¬A

1vA

3)∧A

2

Is S a tautology?

A1

A2

A3 S

T T T FT T F FT F T F............

Referencecolumns

Page 18: Truth, deduction, computation;  lecture 5

Truth Tables, example

Page 19: Truth, deduction, computation;  lecture 5

Big Picture by Example

Tet(a)v¬Tet(a)

a = a ∧ b = b

Small(a) v Medium(a) v Large(a)

Cube(a) ∧ Larger(a,b)

Specific for Tarski’s World

Logical Necessities (can be proved)

Tautologies(actually we don’t need no Tets here:)

TT-possible

Page 20: Truth, deduction, computation;  lecture 5

Equivalence of sentences

Two sentences are...

Tautologically equivalent if they take the same values in truth tables.

E.g. ¬(A∧B) and ¬A v ¬B

Logically equivalent if each can be deduced from another.

E.g. a=b and b=a

Page 21: Truth, deduction, computation;  lecture 5

Example from the book

if (!((A || B) && !C) println(“completely satisfied”)if ((!A && !B) || C) println(“absolutely satisfied”)

Page 22: Truth, deduction, computation;  lecture 5

Consequence of sentences

Remember lecture 5?

A is a tautological consequence of B if in the truth table every time B is true, A is true.

E.g. A∧B yields AvB

A is a logical consequence of B if we can build a proof

E.g. a=b∧с=b yields c=a

Page 23: Truth, deduction, computation;  lecture 5

Try 4.24

Page 24: Truth, deduction, computation;  lecture 5

Try 4.24

Never mind, FITCH has Taut Con

Page 25: Truth, deduction, computation;  lecture 5

Remember the Laws?

● Double Negation: ¬¬P ⇔ P

● DeMorgan: ¬(P ∧ Q) ⇔ ¬P v ¬Q● DeMorgan: ¬(P v Q) ⇔ ¬P ∧ ¬Q

Page 26: Truth, deduction, computation;  lecture 5

Pushing Negation Around

Will use the lawsE.g.

¬(Cube(a) ∧ ¬¬Small(a))

¬(Cube(a) ∧ Small(a))

¬Cube(a) v ¬Small(a)

Hmm… wait… who said it is legal?!...

Page 27: Truth, deduction, computation;  lecture 5

We use Substitution!

P ⇔ Q

S(P) - contains P somewhere insidethenS(P) ⇔ S(Q)

Kind of obvious for tautological equivalence, but… We’ll get back to it later

Page 28: Truth, deduction, computation;  lecture 5

Normalization. Step 1. Negation

NNF, Negation Normal Form

all negations by atomic formulas. (remember “literal”?)

E.g. ¬¬¬(¬A v ¬(B∧C) v D) ⇔

¬(¬A v ¬(B∧C) v D) ⇔

A ∧ (B∧C) ∧ ¬D)

Page 29: Truth, deduction, computation;  lecture 5

Remember, we have...

● associativity● commutativity● idempotence

Together with de Morgan laws, they do miracles

We can simplify expressions.

Page 30: Truth, deduction, computation;  lecture 5

Simplifying Logical Sentence

(A v B) ∧ C ∧ (¬(¬B ∧ ¬A) v B) ⇔

(A v B) ∧ C ∧ ((¬¬B v ¬¬A) v B) ⇔

(A v B) ∧ C ∧ ((B v A) v B) ⇔

(A v B) ∧ C ∧ (B v A v B) ⇔

(A v B) ∧ C ∧ (A v B v B) ⇔

(A v B) ∧ C ∧ (A v B) ⇔

(A v B) ∧ (A v B) ∧ C ⇔

(A v B) ∧ C

Page 31: Truth, deduction, computation;  lecture 5

That’s it for today