Survey

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Survey

Document related concepts

Modal logic wikipedia , lookup

Mathematical proof wikipedia , lookup

Intuitionistic logic wikipedia , lookup

Rubik's Cube wikipedia , lookup

Propositional calculus wikipedia , lookup

Boolean satisfiability problem wikipedia , lookup

Laws of Form wikipedia , lookup

Propositional formula wikipedia , lookup

Natural deduction wikipedia , lookup

Transcript

CS1502 Formal Methods in Computer Science Lecture Notes 3 Consequence Rules Boolean Connectives Symmetry of Identity 1) a=b 2) a=a = Introduction 3) b=a = Elimination 1, 2 Example Informal Proof Prove: If a is smaller than b and c is identical to b then c is larger than a. Since we are given that a is smaller than b, it follows that b must be larger than a. Moreover, since c is identical to b, it follows that c must be larger than a. QED Consequence Rules There are three consequence “rules” in Fitch – Tautological Consequence (Taut Con) – First-order Consequence (FO Con) – Analytic Consequence (Ana Con) Cons rules are proof seekers that work behind the scenes. Success is indicated by the beloved blue check mark . Failure is indicated by the infamous red X. Taut Con Weakest of the three Cons “rules” Attempts to prove if the current step follows from the cited statements by virtue of the truth-functional connectives. E.g., p ^ q can be replaced by p v q. FO Con More powerful than Taut Con but weaker than Ana Con Attempts to prove if the current step follows from the cited steps by virtue of the truth-functional connectives, the quantifiers, and the identity predicate. E.g., a=b ^ b=c can be replaced by a=c. Ana Con Most powerful Cons “rule” Attempts to prove if the current step follows from the cited steps by virtue of the truth-functional connectives, the quantifiers, the identity predicate and the meanings predicates of Tarski’s World. E.g., Cube(a) v Tet(a) v Dodec(a) is true under Ana Con Example Formal Proof 1) 2) Larger(a,b) c=b Prove: c is smaller than a 3) Smaller(b,a) Ana Con 1 4) c=c = Introduction 5) b=c = Elim 2, 4 6) Smaller(c,a) = Elim 5, 3 Explicit Proof of an Ana Con Step Proof performed by the system, behind the scenes Showing Non-consequence To show Q is not a consequence of premises P1, P2, …, Pn, create a world where the premises are all true and the conclusion Q is false. Invalid Argument 1. SameRow(b,c) 2. SameRow(a,d) 3. SameRow(d,f) 4. LeftOf(a,b) 5. LeftOf(f,c) Boolean Connectives Negation Conjunction Disjunction It is not the case that And, but, moreover Or These are truth-functional connectives Negation P T P F F T Negation Facts One translation of P is It is not the case that P. (a = b) is equivalent to a b P is equivalent to P P P P T F T F T F The Game Used to understand the truth value of a complex sentence Strategy: Given a sentence of the form P that you believe to be True (False) implies P is False (True) implies P is True (False) implies P is False (True) Assessment is incorrect Conjunction and Disjunction P Q PQ PQ T T T T T F F T F T F T F F F F Game Revisited If you believe P Q is true you will be asked to select the disjunct that is true. If you believe P Q is false Tarski’s World will attempt to find a disjunct that is true. If you believe P Q is true Tarski’s World will attempt to find a conjunct that is false. If you believe P Q is false you will be asked to select a conjunct that is false. Game Example In lecture Translation Both A and B Either A or B Neither A nor B AB AB (A B) Both c and e are cubes. Cube(c) Cube(e) Either c or e is a cube. Cube(c) Cube(e) Neither c nor e is a cube. (Cube(c) Cube(e)) Translation John entered the car and drove to his home Entered ^ Drove(john,car(john),house(john)) – OK? No – the truth functional connectives connect sentences, not predicates Entered(john,car(john)) ^ Drove(john,house(john)) – This is OK English sentences often convey more information than their straightforward logical meanings, e.g., temporal order in “John entered the car and drove home” That’s OK: in this class, you can just give the straightforward translation into logic Translation I will vote for Smith or I will vote for Jones Straightforward literal translation: Vote(I,smith) v Vote(I,jones) Logic “or” is inclusive or. But “or” in our English sentence is exclusive or – I’ll vote for one of them but not both We can define exclusive or using ^ and v: P xor Q equiv: (P ^ ~Q) v (Q ^ ~P) (Vote(I,smith) ^ ~Vote(I,jones)) v (Vote(I,jones) ^ ~Vote(I,smith)) Unless the text says otherwise, assume inclusive “or” (even when it says “Either A or B”) Avoid Ambiguity (A A B) B CC Both either A or B and C A (B C) Either A or both B and C (A AB B)CC Either both A and B or C A (B C) Both A and either B or C Either both Max is at home and Claire is tall or Carl is happy. [Home(Max) Tall(Claire)] Happy(Carl) Avoid Ambiguity Let’s look at that example again; Either both Max is at home and Claire is tall or Carl is happy [Home(max) ^ Tall(claire)] v Happy(carl) Home(max) ^ (Tall(claire) v Happy(carl)) Translation: Both Max is at home and either Claire is tall or Carl is happy. Equivalences Two FOL sentences P and Q mean the same thing (are logically equivalent, written P Q) iff they have the same truth value in all situations. If two sentences are logically equivalent, you can substitute one for the other. Identity Laws: P ^ T P; P v F P Domination Laws: P v T T; P ^ F F Idempotent Laws: P v P P; P ^ P P Double Negation: ~~P P Commutative Laws: P v Q Q v P; P ^ Q Q ^ P Associative Laws: (P v Q) v R P v (Q v R) (P ^ Q) ^ R P ^ (Q ^ R) Distributive Laws: P v (Q ^ R) (P v Q) ^ (P v R) P ^ (Q v R) (P ^ Q) v (P ^ R) DeMorgan’s Laws: ~(P ^ Q) ~P v ~Q ~(P v Q) ~P ^ ~Q