=============================================================== Lect 4 - October 6, 2008 - ECS 20 - Fall 2008 - Phil Rogaway =============================================================== Today: o Finish sentential logic o First-Order Logic Announcements: o I think I might feel a quiz coming on me.... o No scribe today. I'll put my own notes up. This has limitations ..... the notes may not precisely correspond to what I say in class. (But I'll edit them so that the correspondence isn't _that_ far off.) ------------------- 1. Validity (truth) ------------------- Definition: ----------- 1. alpha is a TAUTOLOGY if t(alpha) = 1 for ALL t.a. t: |= alpha 2. alpha is a CONTRADICTION if t(alpha) = 0 for ALL t.a. t: |= \neg alpha 3. alpha is a SATISFIABLE if t(alpha) = 1 for SOME t.a. t: 4. alpha and beta are EQUIVALENT if t(alpha) = t(beta) for all t.a. t alpha |= =| beta Prop: There is an algorithm (=a precisely-describable procedure, mechanism, recipe) that, given a WFF of sentential logic, decides - if it is a tautology. - if it is a contradiction - if it is a satisfiable. - if if the formula is equivalent to some second provided formula Proof: "Truth-table algorithm" Discuss the (in)efficiency of the truth-table algorithm. REMARKABLE CLAIM: no efficient means are known for any of these problems.... Example of a tautological formula: |= (P->Q) or (Q->P) ? Example of a satisfiable and an unsatisfiable formula: ... ----------------- 2. Various "laws" ----------------- Vellman: p. 21, 23, 47, 49 "basic laws" Associative: P and (Q and R) |= =| (P and Q) and R //Mention the similarities to arithmetic P or (Q or R) |= =| (P or Q) or R //laws with or corresponding to addition //and and corresponding to multiplication Commutative: P and Q |= =| Q and P P or Q |= =| Q or P Distributive: P and (Q or R) |= =| (P and Q) or (P and R) P or (Q and R) |= =| (P or Q) and (P or R) DeMorgan's: not (P and Q) |= =| not P or not Q EMPHASIZE not (P or Q) |= =| not P and not Q EMPHASIZE Idempotent: P and P |= =| P P or P |= =| P Absorption: P or (P and Q) |= =| P P and (P or Q) |= =| P Double negation: not not P |= =| P Tautology P and 1 |= =| P P or 1 |= =| 1 not 1 |= =| 0 Contradiction P and 0 |= =| 0 P or 0 |= =| P not 0 |= =| 1 Contradiction P->Q |= =| not P or Q P->Q |= =| not(P and not Q) Contraposition P -> Q |= =| not Q -> not P EMPHASIZE ----------------- 3. Derivations ----------------- One of the reasons to have axioms like those above is to develop a notion of "what is provable". The idea is to create a "logical system" having three components: - formal syntax - formal semantics (truth-assignment notion) - derivation system To formalize any proof system would require us to write down a lot of details, so I will won't do it, just give an example. Basically, a "formal proof" is going to be a list of WFFs where each WFF in the list is either: - an assumption, or - an axiom (it appear on a list like that just given), - it follows from a previous set of lines in the proof by one of a number of enumerated rules. Example: |- (PQ)(P v R -> S)(SQ -> T) -> T 1. PQ assumption 2. P v R -> S assumption 3. SQ -> T assumption 4. P "conjunction elimination" (P & Q => P) applied to (1) 5. Q "conjunction elimination" (P & Q => Q) applied to (1) 6. P v R "disjunction introduction" (P v R -> P) applied to (5) 7. S modus ponens (A->B A gives B) applied to (2) and (6) 8. SQ "conjunction introduction" (S, Q => SQ) applied to (7) and (5) 9. T modus ponens applied to (3) and (8) therefore |- (PQ)(P v R -> S)(SQ->T) -> T //The given statement is provable Once you have a formalized derivation system spelled out, we define |- phi can derive (prove) phi (from the emptyset -- no assumptions) Gamma |- phi can derive phi from Gamma We call |- the "syntactic turnstyle operator" SOUNDNESS: Gamma |- phi implies Gamma |= phi (usually "easy") COMPLETENESS Gamma |= phi implies Gamma |- phi (usually "hard") -------------- 4. Compactness -------------- Theorem: Let Gamma be a set of WFFs. Suppose that every finite subset of Gamma is satisfiable. Then Gamma is satisfiable. (contrapositive: Let Gamma be a set of WFFs. If Gamma is unsatisfiable then some finite subset of gamma is also unsatisfiable) Don't prove -- want to use this in a computer-science example. Application: TILING: Can you tile the (upper quadrant of the) plane with tiles of specified types (adjacent edges of the same color) Make an example where the plane is and is not tileable. Indicate that, in ecs120, common to prove that the TILING decision question is un-tileable. But not our interest here. We are interested in whether the tilability of the plane for a given set of tile types is FALSIFIABLE -- is there a (finitary) proof of untilability? There will be if the following is true: If the plane is untilable, it is already untilable on some finite subset of the plane, [1..n] x [1..n] Not an obvious claim at all -- a priori possible that plane is untilable even though every finitary [1..n] x [1..n] is tileable. To prove, Introduce a variable P_{i,j}^{k}: there is a tile of type k at position i,j Write a boolean formula to capture - One and only one tile per quadrant - Adjoining tiles are of compatible types. Now: connect it to compactness theorem. We, given the tile types, there is a corresponding set Gamma of WFFs such that Gamma is satisfiable iff every the plane can be tiled with tiles of the given types. (When we say Gamma where Gamma is a set of formulas we mean that there exists a t.a. satisfying every element of Gamma.) By the compactness theorem, if Gamma is unsatisfiable (can't tile the whole plane) some finite subset Gamma' of Gamma is unsatisfiable. Letting n be the largest index that appears in a variable appearing in Gamma', we know that the subset of the plane [1..n] x [1..n] is already untilable. So tiling IS falsifiable: when there's no tiling, you can prove this. (In the language you will learn in ecs120, TILING is "co-r.e.") ------------------------------------------- 5. Adding quantifiers -- First order logic ------------------------------------------- "All apples are bad" (\forall x) (A(x) -> B(x)) // universe of discourse? "Some apples are bad" (\exists x) (A(x) and B(x)) // universe of discourse? "BILLY has beat up every other boy at the Davis elementry school" (\all x) ((Student(x) and Boy(x) and (x != BILLY) -> HasBeatenUp(BILLY, x)) // universe of discourse? *Universe of discourse* = what quantifiers range over Always important to know the universe of discourse; it's implicit or explicit in any discussion of logical formulas involving quantifiers.