propositional logic discrete structures (cs 173) madhusudan parthasarathy, university of illinois...

25
Propositional Logic Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois School of Athens Fresco by Raphael Wikimedia Commons

Upload: joshua-crofton

Post on 15-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Propositional Logic

Discrete Structures (CS 173)Madhusudan Parthasarathy, University of Illinois

School of AthensFresco by RaphaelWikimedia Commons

Mathematical logic (symbolic logic)

Study of inference using abstract rules that does not assume any particular knowledge of things or of properties.E.g.: All men are mortal

Socrates is a manInference: Socrates is mortal.

E.g. All pigs are boisterousAlfred is a pig.

Inference: Alfred is boisterous

All snarks are frabjousYeti is a snark.Inference: Yeti is frabjous

Key idea: Inference is independent of the subjects (men, pigs, snarks) and properties (mortality, boisterousness, frabjousness).

Inference follows simply from language!

All p’s are q. h is a p. Inference: h is q.

Inference: q(h)

But inference rules needn’t hold in natural language! … quirks of English

Sam and Sally are programmers. Inference: Sam is a programmer

Sam and Sally are together. Inference: Sam is together!

So we need a formal language…. logic!

x

Propositional logicA proposition is a statement that is either true or false.

Examples:• Socrates is a man• This car is purple• 43 is prime

Non-examples:• Trucks• Hello• Trkjkjugirtu

Propositional logicPropositional logic talks about Boolean combinations of propositions and inferences we can make about them.

E.g., If it is raining, then it is cloudy. It is not cloudy. Inference: It is not raining.

Abstraction: p: it is raining q: it is cloudy

Inference:

Propositional logicPropositions: p, q, r, s, ….Constants: T, FOperators (boolean):

bi-implication; iff

Syntax: Any formula that combines propositions and constants using these operators

Propositional logic: Semantics

A formula f, in general, doesn’t have a “truth” value associated to it.

Model: M - Assigns truth/falsehood to each proposition

Any formula f evaluates to true/false in such a model.

Implication can be non-intuitive

says “if p is true then q is true”

If the model sets p to true, and q to true, then evaluates to true.If the model sets p to true, and q to false, then evaluates to false.If the model sets p to false and q to true, then evaluates to true. If the model sets p to false and q to false, then evaluates to true! (vacuosly)

Implication

So is really the same as

“If p then q” is same as “either p is false or q is true”

TautologyA formula is a tautology if it evaluates to true in every model.

E.g. If model sets p to true, then formula is true. If model sets p to false, then formula is true.

E.g., (

Why?

“Do you like this or not?” --- “Yes”

Non-example:

Equivalence

Formulas f and g are equivalent () if in every model M, either both f and g evaluate to true in M or both evaluate to false in M.

E.g.,

Some important equivalences• •

De Morgan’s laws

Some important equivalences

Distributive laws:

Commutativity• • Associativity• •

Contrapositive, converse, negationProposition: “If the sky is green, then I’m a monkey’s uncle.”

• Converse– If I’m a monkey’s uncle, then the sky is green.

• Contrapositive– If I’m not a monkey’s uncle, then the sky is not green.

• Negation– The sky is green, but I am not a monkey’s uncle.

Contrapositive, converse, negationProposition: “If the sky is green, then I’m a monkey’s uncle.”

• Converse– If I’m a monkey’s uncle, then the sky is green.

• Contrapositive– If I’m not a monkey’s uncle, then the sky is not green.

• Negation– The sky is green, but I am not a monkey’s uncle.

More manipulation examplesShow that these are tautologies:

Logistics• If you’re not registered yet and

– Sign sheet at end of class (again)– Sign up for moodle and piazza– Keep on top of homeworks

• only mini-homework for next week• will be released by Friday

• No discussion sections this week

See you next week!• Tuesday

– More logic• Predicate logic• Quantifiers• Binding and scope

– Direct proofs

• Thursday– More proof practice and strategies