SE 212: Logic and Computation. se212 Nancy Day

Size: px
Start display at page:

Download "SE 212: Logic and Computation. se212 Nancy Day"

Transcription

1 E 212, Fall 2018, University of Waterloo, Module 2, Page 1 SE 212: Logic and Computation Module 2: Propositional Logic se212 se212@uwaterloo.ca Nancy Day

2 E 212, Fall 2018, University of Waterloo, Module 2, Page 2 Topics in Module 2 1. Elements of a logic 2. Propositional Logic: Syntax 3. Propositional Logic: Semantics 4. Propositional Logic: Proof Theory

3 E 212, Fall 2018, University of Waterloo, Module 2, Page 3 Elements of a Logic A logic consists of: 1. syntax 2. semantics 3. proof theory (often multiple proof theories)

4 SE 212, Fall 2018, University of Waterloo, Module 2, Page 4 Syntax and Semantics syntax: define well-formed formula (wff) semantics: define = (pronounced entails or valid or semantic entailment ) = P means the formula P is valid (always true ), where P is a wff in the logic P 1, P 2,..., P n = Q means from the premises P 1, P 2,..., P n, we may conclude Q, where P 1, P 2,..., P n and Q are all wff Note: As a convention in these slides, upper case letters are used to represent any formula and lower case letters are used to represent a symbol in the syntax.

5 SE 212, Fall 2018, University of Waterloo, Module 2, Page 5 Proof Theories (Deductive Systems) proof theories: define (pronounced proves ) P 1, P 2,..., P n Q is called a sequent. P 1, P 2,..., P n Q means that from P 1, P 2,..., P n we can prove Q using a proof theory. There may be multiple proof theories for the same logic. For some logics, no algorithm exists that always terminates for any sequent.

6 E 212, Fall 2018, University of Waterloo, Module 2, Page 6 Proof Theory Proof theories are methods that perform mechanical manipulations on strings of symbols. A proof theory doesn t make use of the meanings of sentences, it just manipulates them as strings of characters. Proof theories are based on pattern matching. For a given proof theory, there may be multiple ways to prove a formula.

7 SE 212, Fall 2018, University of Waterloo, Module 2, Page 7 Soundness and Completeness The semantics and proof theories ( = and ) are related by the concepts of soundness and completeness. Definition. A proof theory is sound if P 1, P 2,..., P n Q (proof) then P 1, P 2,..., P n = Q (valid). Definition. A proof theory is complete if P 1, P 2,..., P n (valid) then P 1, P 2,..., P n Q (proof). = Q

8 E 212, Fall 2018, University of Waterloo, Module 2, Page 8 Topics in Module 2 1. Elements of a logic (syntax, semantics, proof theories) 2. Propositional Logic: Syntax 3. Propositional Logic: Semantics 4. Propositional Logic: Proof Theory

9 SE 212, Fall 2018, University of Waterloo, Module 2, Page 9 Propositional Logic Invented by George Boole ( ). An Investigation of the Laws of Thought on which are founded The Mathematical Theories of Logic and Probabilities. Image scanned from Makers of Mathematics by Stuart Hollingdale, Penguin Books, 1994.

10 E 212, Fall 2018, University of Waterloo, Module 2, Page 10 Boole The design of the following treatise is to investigate the fundamental laws of those operations of the mind by which reasoning is performed; to give expression to them in the language of a Calculus, and upon this foundation to establish the science of Logic and construct its method... George Boole An Investigation of the Laws of Thought..., Propositional logic is also called sentential logic, i.e., the logic of sentences. It is also called propositional calculus, sentential calculus or Boolean logic.

11 SE 212, Fall 2018, University of Waterloo, Module 2, Page 11 Propositional Logic 1. syntax (well-formed formulas) Proposition symbols Propositional connectives Syntax and well-formed formulas Precedence, associativity of connectives Formalizing natural language Ambiguities in English 2. semantics (truth tables) 3. proof theories transformational proof (sideways proof) natural deduction (forward proof) semantic tableaux (backward proof)

12 E 212, Fall 2018, University of Waterloo, Module 2, Page 12 Propositional Logic: Syntax A formula in propositional logic consists of the following symbols: 1. two constant symbols: true and false 2. proposition symbols (Usually we just use lower case letters for proposition symbols.) 3. propositional connectives (,,,, ) 4. brackets

13 SE 212, Fall 2018, University of Waterloo, Module 2, Page 13 Propositional Connectives Definition. The propositional (logical) connectives (operators) are: Symbol Informal Meaning george negation (not)! conjunction (and, both) & disjunction (or, at least one of) implication (implies, conditional, if... then ) => equivalent (biconditional, if and only if) <=> Other texts may use different symbols for these operations.

14 SE 212, Fall 2018, University of Waterloo, Module 2, Page 14 Propositional Logic: Syntax Definition. The well-formed formulas (wff) of propositional logic are those obtained by the following construction rules: 1. The proposition symbols, and the constants, true and false, are formulas. These are called prime propositions. 2. If P and Q are formulas, then each of the following are formulas: ( P) (P Q) (P Q) (P Q) (P Q) These are compound propositions. No other expressions are formulas. These rules show how a formula is constructed from its subformulas. From now on, when we say formula, we mean well-formed formula.

15 E 212, Fall 2018, University of Waterloo, Module 2, Page 15 Brackets and Precedence Brackets around the outermost formula are usually omitted. Brackets can be omitted using the following rules of precedence of operators: highest lowest

16 E 212, Fall 2018, University of Waterloo, Module 2, Page 16 Associativity All binary logical connectives are right associative. Examples a b c means a (b c) a b c means a (b c)

17 E 212, Fall 2018, University of Waterloo, Module 2, Page 17 Terminology For P Q, P and Q are conjuncts. For P Q, P and Q are disjuncts. In implication, as in P Q: P is the premise or antecedent or hypothesis Q is the consequent or conclusion The contrapositive of P Q is Q P.

18 SE 212, Fall 2018, University of Waterloo, Module 2, Page 18 Formalizing Natural Language Definition. Proposition symbols represent declarative sentences, i.e., sentences that are true or false. Examples: It is snowing outside = 3. The value of program variable a is 42. Sentences that are interrogative (questions), or imperative (commands) are not propositions. (e.g., Is it snowing? is not a proposition).

19 E 212, Fall 2018, University of Waterloo, Module 2, Page 19 Using Symbols Logic is concerned with the structure of arguments and in particular with the structure of valid arguments. Therefore, we encode sentences in symbols to create a more compact and clearer representation of the argument. DO NOT use T, F, t, or f in any font as proposition symbols because it is confusing!

20 SE 212, Fall 2018, University of Waterloo, Module 2, Page 20 Example of Using Symbols Example: If the train arrives late and there are no taxis at the station, then John is late for his meeting. John is not late for his meeting. The train did arrive late. Therefore, there are taxis at the station. Letter p q r Declarative Sentence the train is late there are taxis at the station John is late for his meeting Argument: If p and not q then r. Not r. p. q

21 SE 212, Fall 2018, University of Waterloo, Module 2, Page 21 Prime and Compound Propositions Example: The snow is red. This example can be represented as a prime proposition because it is atomic (indecomposable). The sentence does not contain any connectives so we can use one proposition symbol to represent it. Example: The snow is red and the grass is green. This example would be represented as a compound proposition because it contains multiple prime propositions joined by the connective and.

22 SE 212, Fall 2018, University of Waterloo, Module 2, Page 22 Formalizing Natural Language Heuristic: Pick the smallest statements without logical connectives ( and, or, if... then, etc.), about which you can answer the question Is it true or false?. Using proposition symbols to represent these sentences, connect them with the relevant propositional connectives. Our goal is to formalize all the details found in an English sentence while matching the form of the sentence as closely as possible so we can see the correspondence. As closely as possible means matching the order of the conjuncts, etc.

23 SE 212, Fall 2018, University of Waterloo, Module 2, Page 23 Formalizing Natural Language From p. 16 of the Nissanke text: Connective Possible interpretations in English P not P, P does not hold, it is not the case that P, P is false P Q P and Q, P but Q, not only P but Q, P while Q, P despite Q, P yet Q, P although Q P Q P or Q, P or Q or both, P and/or Q, P unless Q P Q if P then Q, Q if P, P only if Q, Q when P, P is sufficient for Q, Q is necessary for P, P implies Q P Q P if and only if Q (P iff Q), P is necessary and sufficient for Q, P exactly if Q, P is equivalent to Q We will be using these rules in formalizing English statements. There is a summary page on the course web page with this information.

24 SE 212, Fall 2018, University of Waterloo, Module 2, Page 24 Examples Connective Possible interpretations in English P not P, P does not hold, it is not the case that P, P is false P Q P and Q, P but Q, not only P but Q, P while Q, P despite Q, P yet Q, P although Q P Q P or Q, P or Q or both, P and/or Q, P unless Q P Q if P then Q, Q if P, P only if Q, Q when P, P is sufficient for Q, Q is necessary for P, P implies Q P Q P if and only if Q (P iff Q), P is necessary and sufficient for Q, P exactly if Q, P is equivalent to Q 1. It is cold but not snowing. 2. It is neither snowing nor cold. 3. It is cold if it is snowing. 4. It is snowing only if it is cold. 5. If a request occurs then it will be acknowledged or the process does not make progress.

25 SE 212, Fall 2018, University of Waterloo, Module 2, Page 25 Ask george 1 #u nday 2 #a 01 3 #q 01a 4 5 % It is cold but not snowing. 6 7 # check PROP 8 9 c &!s % where 12 % c means " it is cold " 13 % s means " it is snowing " george checks the syntax of your formula!

26 SE 212, Fall 2018, University of Waterloo, Module 2, Page 26 Translating Logic into English (o n) ( o m) Symbol o n m Meaning he is in the office we will tell him the news we will leave him a message If he is in the office then we will tell him the news, or if he is not in the office then we will leave him a message.

27 SE 212, Fall 2018, University of Waterloo, Module 2, Page 27 Example If the train arrives late and there are no taxis at the station, then John is late for his meeting. John is not late for his meeting. The train did arrive late. Therefore, there are taxis at the station. Letter p q r English the train is late there are taxis at the station John is late for his meeting If p and not q then r. Not r. p. q p q r, r, p = q

28 E 212, Fall 2018, University of Waterloo, Module 2, Page 28 Ambiguity in English An ambiguous sentence can have more than one distinct meaning. We ve given ourselves fixed rules for how to formalize sentences in logic, but English sentences can be ambiguous. Example from Suzanne Stevenson s (U of T) lecture on natural language understanding at U Waterloo fall, 2001: Mi kmaq can fish for a week.

29 SE 212, Fall 2018, University of Waterloo, Module 2, Page 29 Ambiguity: Conjunction The use of the logical connectives sometimes doesn t exactly match their meaning in English. In English, there is a difference in meaning between: The driver hit the cyclist and drove on. and The driver drove on and hit the cyclist. The connective and used in logic is commutative, i.e. P Q is equivalent to Q P.

30 SE 212, Fall 2018, University of Waterloo, Module 2, Page 30 Ambiguity: Disjunction Disjunction, P Q, means at least one of P or Q is true. Both disjuncts could be true. P Q is different from exclusive or, where exactly one disjunct is true. Exclusive or means (P Q) (P Q). Examples: 1. You may take Thursday or Friday off. 2. The error is in the main program or the sensor data.

31 E 212, Fall 2018, University of Waterloo, Module 2, Page 31 Ambiguity: Unless Example: It rains unless I take an umbrella.

32 SE 212, Fall 2018, University of Waterloo, Module 2, Page 32 Ambiguity: Implication We have to be careful of the meaning of implication: Example: If an animal moos then it is a cow. m c Watch out for the false implies anything problem!

33 SE 212, Fall 2018, University of Waterloo, Module 2, Page 33 Ambiguity: Implication ( ) vs Equivalence ( ) Example: If you do not behave then I will take the toy away. Implicitly, the child may keep the toy if they behave.

34 E 212, Fall 2018, University of Waterloo, Module 2, Page 34 Ambiguity Because a sentence in natural language is often open to multiple interpretations, logic helps us clarify the meanings of descriptions. To describe computer systems and check that they are correct we need precise and unambiguous descriptions. In formalizing sentences for assignments and exams, we will use Nissanke s rules from slide 23.

35 E 212, Fall 2018, University of Waterloo, Module 2, Page 35 Propositional Logic: Syntax Summary Proposition symbols Propositional connectives Syntax and well-formed formulas Precedence and associativity of connectives Formalizing natural language Ambiguities in English

36 E 212, Fall 2018, University of Waterloo, Module 2, Page 36 Topics in Module 2 1. Elements of a logic (syntax, semantics, proof theories) 2. Propositional Logic: Syntax 3. Propositional Logic: Semantics ( = ) Boolean valuations Truth tables Satisfiability, tautologies, contradictions, contingent formulas Logical implication ( = ) Logical equivalence ( ) Consistency 4. Propositional Logic: Proof Theory

37 E 212, Fall 2018, University of Waterloo, Module 2, Page 37 Semantics Semantics means meaning. Semantics relate two worlds. Semantics provide an interpretation (mapping) of expressions in one world in terms of values in another world. Semantics are often a function from expressions in one world to expressions in another world. Proof theories transform the well-formed formulas in ways that respect the semantics of the logic.

38 SE 212, Fall 2018, University of Waterloo, Module 2, Page 38 Semantics of Propositional Logic We ve described the syntax for propositional logic, which is the domain of the semantic function. Classical logic is two-valued. The two possible truth values are T, and F, which are two distinct values. T F denotes the property of a formula being True denotes the property of a formula being False These are NOT part of the syntax of propositional logic. The range of the semantic function for propositional logic is the set of truth values: Tr = {T, F}

39 SE 212, Fall 2018, University of Waterloo, Module 2, Page 39 Boolean Valuations Definition. A Boolean valuation is a function from the set of formulas in propositional logic to the set Tr. The semantics of propositional logic are described using Boolean valuations. A Boolean valuation is also called a model or an interpretation. Given a formula p q, we write [p q] to mean the meaning of the formula in a certain Boolean valuation. The [] is a function mapping syntax to its value.

40 SE 212, Fall 2018, University of Waterloo, Module 2, Page 40 Semantics of Propositional Logic There are functions on these truth values that correspond to the meaning of the propositional connectives: NOT is a function that takes a truth value and returns a truth value, and is the meaning of. AND, OR, IMP, IFF are functions that take two truth values and return a truth value and correspond to,,, respectively. p T F NOT p F T p q p AND q p OR q p IMP q p IFF q T T T T T T T F F T F F F T F T T F F F F F T T

41 SE 212, Fall 2018, University of Waterloo, Module 2, Page 41 Boolean Valuations In all Boolean valuations: 1. [false] = F, [true] = T 2. [ P] = NOT ([P]) 3. For the connectives: [P Q] = [P] AND [Q] [P Q] = [P] OR [Q] [P Q] = [P] IMP [Q] [P Q] = [P] IFF [Q] The truth value associated with the formula is uniquely determined by the truth values associated with the proposition symbols. When describing a Boolean valuation, we only need to describe the association of truth values with the proposition symbols.

42 E 212, Fall 2018, University of Waterloo, Module 2, Page 42 Example Show the truth value associated with the formula (p q) r in the Boolean valuation where, [p] = T [q] = F [r] = F [(p q) r] = [p q] AND [r] = ([p] IMP [q]) AND [r] = (T IMP F) AND F = F AND F = F

43 SE 212, Fall 2018, University of Waterloo, Module 2, Page 43 Example (p q) r What is the meaning of the formula in the following different Boolean valuation? [p] = F [q] = F [r] = T

44 E 212, Fall 2018, University of Waterloo, Module 2, Page 44 Truth Tables We use truth tables to describe the meaning of a formula in all Boolean valuations. Definition. A truth table has: A row for each possible Boolean valuation (i.e., an assignment of truth values to the proposition symbols in the formula). Each cell contains the truth value for the subformula given by the Boolean valuation of that row.

45 SE 212, Fall 2018, University of Waterloo, Module 2, Page 45 Example What is the truth table for: (p q)? p q q p q (p q) syntax T T F F T T F T T F one Boolean valuation F T F F T F F T F T In the truth table, there are columns for each proposition symbol and many of the subformulas. The order of the rows in the truth table doesn t matter (although we recommend that you choose a systematic order).

46 SE 212, Fall 2018, University of Waterloo, Module 2, Page 46 Ask george Here s how to make an ASCII soln to a Boolean valuation question: 1 #u nday 2 #a 01 3 #q #check NONE 6 7 For the Boolean v a l u a t i o n [ p ] = F, [ q ] = F, [ r ] = T 8 9 [ ( p => q ) & r ) ] 10 = ( [ p ] IMP [ q ] ) AND [ r ] 11 = (F IMP F) AND T 12 = T george does not do any correctness checks.

47 SE 212, Fall 2018, University of Waterloo, Module 2, Page 47 Ask george Here s how to make an ASCII soln to a truth table question: 1 #u nday 2 #a 01 3 #q #check NONE 6 7 p q r p => q ( p => q ) & r 8 F F F T F 9 F F T T T 10 F T F T F 11 e t c. george does not do any correctness checks.

48 SE 212, Fall 2018, University of Waterloo, Module 2, Page 48 Satisfiability Definition. A formula P is satisfiable if there is a Boolean valuation such that [P] = T. We sometimes say that the formula has a satisfying assignment to mean that it is satisfiable. A formula is satisfiable if its truth table has some T s in the last column. Example: p q q p q (p q) T T F F T T F T T F F T F F T F F T F T Therefore (p q) is satisfiable.

49 SE 212, Fall 2018, University of Waterloo, Module 2, Page 49 Tautologies Definition. A propositional formula P is a tautology (or valid) if [P] = T for all Boolean valuations. A tautology is a formula that is T for all truth values of the proposition symbols used in the formula. The last column of the truth table for a tautology contains all T s. Example: p p p p T F T F T T

50 SE 212, Fall 2018, University of Waterloo, Module 2, Page 50 Tautologies and Semantics Definition. When a formula Q is a tautology, we write: = Q Therefore, based on the truth table on the previous slide, we can write: = p p

51 SE 212, Fall 2018, University of Waterloo, Module 2, Page 51 Logical Implication Definition. A formula P logically implies a formula Q if and only if for all Boolean valuations, if [P] = T then [Q] = T. P = Q P = Q iff = P Q Note: the text uses the symbol for logical implication. We will use =, which is more commonly used for describing logics.

52 SE 212, Fall 2018, University of Waterloo, Module 2, Page 52 Logical Implication We can generalize this to talk about P 1, P 2,..., P n = Q Definition. A set of formulas P 1, P 2,..., P n logically imply a formula Q if and only if for all Boolean valuations, if [P 1 ] = T and [P 2 ] = T,...,[P n ] = T then [Q] = T. P 1, P 2,..., P n = Q This is also called a valid argument. This is equivalent to saying P 1 P 2... P n and also = P 1 P 2... P n Q = Q

53 SE 212, Fall 2018, University of Waterloo, Module 2, Page 53 Contradiction Definition. A propositional formula A is a contradiction (or falsehood) if [A] = F for all Boolean valuations. The last column of a truth table for a contradiction contains all F s. Example: p p p p T F F F T F

54 SE 212, Fall 2018, University of Waterloo, Module 2, Page 54 Contingent Definition. A contingent formula is one that is neither a tautology nor a contradiction. A contingent formula has a mixture of T s and F s in the column representing the formula in the truth table.

55 E 212, Fall 2018, University of Waterloo, Module 2, Page 55 Truth Tables We can use truth tables to determine if a formula is satisfiable, a tautology, a contradiction, or a contingent formula.

56 E 212, Fall 2018, University of Waterloo, Module 2, Page 56 Relationships among Concepts 1. If a formula is contingent, 2. If a formula is satisfiable, 3. A formula is not satisfiable iff 4. A formula P is a tautology iff P

57 E 212, Fall 2018, University of Waterloo, Module 2, Page 57 Logical Equivalence Definition. Two formulas, P and Q, are logically equivalent if and only if in all Boolean valuations, [P] = [Q]. P Q P Q iff = P Q is called material equivalence (name of syntactic symbol) is called logical equivalence (name of semantic symbol).

58 SE 212, Fall 2018, University of Waterloo, Module 2, Page 58 Example of Logical Equivalence p q q p p q p q q p T T T T T F T T F T T T F F F F

59 E 212, Fall 2018, University of Waterloo, Module 2, Page 59 Consistency Example: 1. If it s snowing out then I have my jacket on. 2. If I have my jacket on then I m not cold. 3. It s snowing out. 4. I m cold. Can this collection of sentences all be true at the same time?

60 SE 212, Fall 2018, University of Waterloo, Module 2, Page 60 Consistency Definition. A collection of formulas is consistent if there is a Boolean valuation in which all the formulas are T.

61 E 212, Fall 2018, University of Waterloo, Module 2, Page 61 Checking Consistency To check that a set of formulas is consistent, we check that the conjunction of the formulas is satisfiable, or equivalently: there is a Boolean valuation that maps each formula in the set to T, or there is a Boolean valuation that maps the conjunction of the formulas to T, or the conjunction of the formulas is not a contradiction.

62 E 212, Fall 2018, University of Waterloo, Module 2, Page 62 Example of Checking Consistency 1. Sales of houses fall off if interest rates rise. 2. Auctioneers are not happy if sales of houses fall off. 3. Interest rates are rising. 4. Auctioneers are happy.

63 SE 212, Fall 2018, University of Waterloo, Module 2, Page 63 Example of Checking Consistency Does the following have a satisfying assignment? (r s) (s h) r h S3 S4 S1 S2 s r h h r s s h (r s) (s h) r h F F F T T T F F F T F T T F F T F T F T F F T T F F T F T F F T T T F T F T F T F F T T F T T T F T T T F T F F

64 E 212, Fall 2018, University of Waterloo, Module 2, Page 64 Consistency If the set of formulas in the premise of an implication are not consistent, they can be used to prove a contradiction, i.e., p, p = q q or p, p = false This is called the false implies anything problem, meaning that nothing is proven about a system if there are inconsistent premises. Often our premises describe the environment in which a system executes. We need to ensure that these premises are consistent, i.e., that the environment we describe could possibly exist.

65 SE 212, Fall 2018, University of Waterloo, Module 2, Page 65 Truth Tables We can use truth tables to find out whether a formula is a tautology, etc. Truth tables describe the truth value of the formula for every combination of truth values for its proposition letters. # prop. symbols # rows in truth table For n proposition symbols in a formula, we need a truth table with 2 n rows.

66 SE 212, Fall 2018, University of Waterloo, Module 2, Page 66 Proof Theories Using truth tables to check whether a formula is a tautology can be tedious since the size of the truth table grows exponentially with the number of proposition symbols. A proof theory for propositional logic is another way of determining whether a formula is a tautology. As long as the proof theory is sound, we can use the proof theory in place of truth tables to determine tautologies (and valid arguments).

67 E 212, Fall 2018, University of Waterloo, Module 2, Page 67 Propositional Logic: Semantics Summary: Boolean valuations Truth tables Satisfiability, tautologies, contradictions, contingent formulas Logical implication Logical equivalence Consistency

68 SE 212, Fall 2018, University of Waterloo, Module 2, Page 68 Topics in Module 2 1. Elements of a logic (syntax, semantics, proof theories) 2. Propositional Logic: Syntax 3. Propositional Logic: Semantics (, = ) 4. Propositional Logic: Proof Theory (, ) 4.1 Transformational Proof 4.2 Natural Deduction 4.3 Semantic Tableaux

69 Proof Theories for Propositional Logic There are many proof theories for propositional logic. Some match the human reasoning process. Others are better suited to automation by computers. Examples of proof theories are: Transformational proofs (sideways proof, statement algebra, ) Natural Deduction (forward proof, ) Semantic Tableaux (backward proof, ) Hilbert Systems (axiom systems) Resolution DPLL (Davis Putnam Logeman Loveland) Binary Decision Diagrams Each is... based on different insights into the processes by which one recognizes that a formula expresses a logical truth. (M. Fitting, First-Order Logic and Automated Theorem Proving, p. 77) E 212, Fall 2018, University of Waterloo, Module 2, Page 69

70 E 212, Fall 2018, University of Waterloo, Module 2, Page 70 Topics in Transformational Proof Transformational Proof ( ) Proving equivalence of formulas Logical laws Rules of thumb Relationship between transformational proof and semantics Applications Simplifying conditionals in programming Conjunctive normal form (CNF) and disjunctive normal form (DNF)

71 SE 212, Fall 2018, University of Waterloo, Module 2, Page 71 Review: Equivalence of Formulas ( ) Two formulas, P and Q, are logically equivalent (P Q) iff For all boolean valuations [P] = [Q]. The last columns of their truth tables are identical. = P Q. What method do we currently know to check if two formulas are equivalent? Build their truth table and check if they have identical last columns. Recall that the size of truth tables grows exponentially in the number of prime propositions in the formula. Is there a better way? Perhaps one that allows us to re-use previously known results about what formulas are equivalent?

72 SE 212, Fall 2018, University of Waterloo, Module 2, Page 72 Algebra Recall in standard algebra, symbols are used to represent numbers. Algebraic laws are used to manipulate expressions. For example, the following are algebraic laws: 1. (X + Y ) Z = X + (Y Z) 2. Y Y = 0 3. X + 0 = X Using these rules, we can prove: ((a 2) + (b + c)) (b + c) = (a 2) ((a 2) + (b + c)) (b + c) = (a 2) + ((b + c) (b + c)) by Rule 1 = (a 2) + 0 by Rule 2 = (a 2) by Rule 3

73 SE 212, Fall 2018, University of Waterloo, Module 2, Page 73 Transformational Proofs Now we re going to do the same kind of algebraic manipulation of formulas in propositional logic. Quick example: ((c d) (b a)) (b a) false Sample laws: assoc: (P Q) R P (Q R) contr: P P false simp1: P false false ((c d) (b a)) (b a) (c d) ((b a) (b a)) by assoc (c d) false by contr false by simp1

74 SE 212, Fall 2018, University of Waterloo, Module 2, Page 74 Transformational Proof Definition. Transformational proof is a means of determining that two well-formed formulas of propositional logic, P and Q, are logically equivalent by the (repeated) exchange of subformulas of P for logically equivalent subformulas that results in P being transformed into Q. Each step must follow a logical law. The logical laws are expressed using the symbol. Equivalences that we can derive using transformational proof are expressed using the symbol.

75 E 212, Fall 2018, University of Waterloo, Module 2, Page 75 Logical Laws There is a summary page for transformational proof on the course web page. In proofs, please use the short form name that is at the top of the box on the summary page as your justification. Note: Some logical laws can be derived from other logical laws.

76 SE 212, Fall 2018, University of Waterloo, Module 2, Page 76 Transformational Proof Rules comm P Q Q P P Q Q P P Q Q P P (Q R) (P Q) R P (Q R) (P Q) R assoc lem P P true (P Q) P Q (P Q) P Q dm contr P P false P (Q R) (P Q) (P R) P (Q R) (P Q) (P R) distr impl P Q P Q P Q Q P contrapos idemp P P P P P P P Q (P Q) (Q P) equiv neg ( P) P P true P simp1 P true true P false false P false P This slide includes a few instances of every proof rule. See your summary page for more instances of the proof rules.

77 SE 212, Fall 2018, University of Waterloo, Module 2, Page 77 Transformational Proof Rules comm P Q Q P P Q Q P P Q Q P P (Q R) (P Q) R P (Q R) (P Q) R assoc lem P P true (P Q) P Q (P Q) P Q dm contr P P false P (Q R) (P Q) (P R) P (Q R) (P Q) (P R) distr impl P Q P Q P Q Q P contrapos idemp P P P P P P P Q (P Q) (Q P) equiv neg ( P) P P true P simp1 P true true P (P Q) P P false false P (P Q) P simp2 P false P This slide includes a few instances of every proof rule. See your summary page for more instances of the proof rules.

78 Ask george 1 #u nday 2 #a 01 3 #q # check TP 6 7 p & (!(! q &!p) p) <-> p 8 9 1) p & (!(! q &!p) p) 10 2) p & ((!! q!!p) p) by dm 11 3) p & ((q p) p) by neg * ) p & (q (p p)) by assoc 13 5) p & (q p) by idemp 14 6) p by simp2 george checks the syntax of your formulas, the rule names, and the format of your proof! SE 212, Fall 2018, University of Waterloo, Module 2, Page 78

79 E 212, Fall 2018, University of Waterloo, Module 2, Page 79 Transformational Proofs Two rules are used implicitly in transformational proofs: 1. Rule of substitution: substituting an equivalent formula for a subformula. 2. Rule of transitivity: If P Q and Q R, then P R. This rule is what connects the steps of the proof.

80 E 212, Fall 2018, University of Waterloo, Module 2, Page 80 Rules of Thumb There are multiple ways to do transformational proofs using different logical laws or applying the logical laws in a different order. Here are some rules of thumb: 1. Eliminate implication and equivalence using the law of implication, the law of equivalence and the contrapositive law backwards. 2. Simplify as soon as you can (simp 1, simp 2, idempotence, negation, law of contradiction, law of excluded middle). 3. Sometimes use the various kinds of simplification backwards to prepare for using distributivity.

81 SE 212, Fall 2018, University of Waterloo, Module 2, Page 81 Proofs Notes: 1. Apply only one rule per line of your proof. 2. You may apply the same rule to different subformulas in a single proof step and then list the number of times applied (e.g., neg * 2 ) 3. You may apply simplifications, and distributions over multiple conjuncts or disjuncts in a single step. For example, a (b c d) (a b) (a c) (a d) 4. You may use associativity and commutativity of and implicitly (i.e., you don t have to show these steps).

82 SE 212, Fall 2018, University of Waterloo, Module 2, Page 82 Transformational Proofs and Semantics How do (semantics based on truth tables) and (transformational proof theory) relate? Transformational proof ( ) satisfies the following: 1. If P Q can be proved, then P Q (soundness) 2. If P Q, then P Q can be proved (completeness) Thus, the transformational proof is sound and complete for propositional logic. Therefore, we can use transformational proof to show the logical equivalence of two formulas.

83 E 212, Fall 2018, University of Waterloo, Module 2, Page 83 Logical Equivalence Now we have two ways to check if two formulas in propositional logic are logically equivalent: (P Q) Build their truth table and check if they have identical last columns Show P Q, and using the soundness of the transformational proof, conclude P Q. (often less tedious than the truth tables) Note that P and Q may be compound formulas.

84 SE 212, Fall 2018, University of Waterloo, Module 2, Page 84 Propositional Logic: Transformational Proof ( ) Summary: Proving equivalence of formulas Logical laws Rules of thumb Relationship between transformational proof and semantics Applications Simplifying conditionals in programming CNF and DNF

85 E 212, Fall 2018, University of Waterloo, Module 2, Page 84 Application: Simplifying Conditionals if (i OR NOT o) { if (NOT (o AND q) ) { C1 } else { if (o AND NOT q) { C2 } else { C3 } } } else { C4 } i o q Action T T T C3 T T F C1 T F T C1 T F F C1 F T T C4 F T F C4 F F T C1 F F F C1

86 SE 212, Fall 2018, University of Waterloo, Module 2, Page 85 Reachable Code How can we show a part of the code (e.g., C3) isn t dead code? C3 is executed when (i o) (o q) (o q) Provide a satisfying assignment for this expression.

87 E 212, Fall 2018, University of Waterloo, Module 2, Page 86 Simplifying Conditionals C4 is executed when (i o). We can make this condition a little simpler using transformational proof: (i o) i o dm i o neg

88 SE 212, Fall 2018, University of Waterloo, Module 2, Page 87 Simplified Code if (i AND o AND q) { C3 } else { if (NOT(i) AND o) { C4 } else { C1 } }

89 SE 212, Fall 2018, University of Waterloo, Module 2, Page 88 Normal Forms Definition. A literal is a proposition symbol or the negation of a proposition symbol. Definition. A formula is in conjunctive normal form (CNF) if it is a conjunction of clauses, where a clause is a disjunction of literals or a single literal. Definition. A formula is in disjunctive normal form (DNF) if it is a disjunction of clauses, where a clause is a conjunction of literals or a single literal. Every formula can be converted to an equivalent formula in CNF and DNF. The formulas true and false are in both CNF and DNF. The normal form of a formula is NOT unique.

90 E 212, Fall 2018, University of Waterloo, Module 2, Page 89 Converting Formulas to CNF 1. Remove all and using impl and equiv laws. 2. If the formula in question contains any negated compound subformulas, either remove the negation by using the negation law or use DM to push the negation in. 3. Once a formula with no negated compound subformulas is found, use the following distributivity laws: A (B C) (A B) (A C) (A B) C (A C) (B C) 4. Simplify so there are no repeated literals in a clause, and no clause contains true or false and no two clauses with the same set of literals.

91 E 212, Fall 2018, University of Waterloo, Module 2, Page 90 Converting Formulas to DNF Here is a method for converting a propositional logic formula to DNF. It is very similar to the method for converting to CNF except that different distributive laws are used: 1. Remove all and using impland equivlaws. 2. If the formula in question contains any negated compound subformulas, either remove the negation by using the neglaw or use dmto push the negations in. 3. Once a formula with no negated compound subformulas is found, use the following distributivity laws: a (b c) (a b) (a c) (a b) c (a c) (b c) 4. Simplify until there are no repeated literals and no clause contains true or false and no two clauses contain the same literals.

92 SE 212, Fall 2018, University of Waterloo, Module 2, Page 91 Propositional Logic: Transformational Proof ( ) Summary: Proving equivalence of formulas Logical laws Rules of thumb Relationship between transformational proof and semantics Applications Simplifying conditionals in programming CNF and DNF

93 E 212, Fall 2018, University of Waterloo, Module 2, Page 92 Topics in Module 2 1. Elements of a logic (syntax, semantics, proof theories) 2. Propositional Logic: Syntax 3. Propositional Logic: Semantics ( = ) 4. Propositional Logic: Proof Theory 4.1 Transformational Proof 4.2 Natural Deduction Valid Arguments (logical implication) Invalid Arguments Proving validity: natural deduction proof rules 4.3 Semantic Tableaux

94 Arguments Definition. An argument is a collection of formulas, one of which, referred to as the conclusion, is justified by the others, referred to as the premises. Premises: 1. If the train arrives late and there are no taxis at the station, then John is late for his meeting. (p q r) 2. John is not late for his meeting. ( r) 3. The train did arrive late. (p) Conclusion: There were taxis at the station. (q) p q r, r, p = q where: p = the train is late q = there are taxis at the station r = John is late for his meeting SE 212, Fall 2018, University of Waterloo, Module 2, Page 93

95 E 212, Fall 2018, University of Waterloo, Module 2, Page 94 Kinds of Arguments Definition. If the conclusion of an argument is wholly justified by the premises, the argument is said to be deductive. Definition. Inductive arguments conclude more general new knowledge from a small number of particular facts or observations. We will only be studying deductive arguments. Later in the course we will look at mathematical induction.

96 SE 212, Fall 2018, University of Waterloo, Module 2, Page 95 Review: Valid Arguments (Logical Implication) Definition. An argument is a valid argument if in all Boolean valuations where the premises have the value T, the conclusion has the truth value T. P 1, P 2,..., P n = C P 1, P 2,..., P n are premises. C is the conclusion. An argument is valid if and only if the conjunction of the premises logically imply the conclusion. = P means formula P is a tautology. We can also say P is valid to mean P is a tautology.

97 SE 212, Fall 2018, University of Waterloo, Module 2, Page 96 Review: Consistency of Premises An argument is valid if in the Boolean valuations where the premises are T, then the conclusion is T. What if there is no Boolean valuation in which the premises are all true? We haven t really proven much! Thus, it is important to know there is a way to satisfy the premises. In other words, we should check the consistency of the premises. (You do not have to check the consistency of the premises on an assignment or exam unless specifically asked.)

98 SE 212, Fall 2018, University of Waterloo, Module 2, Page 97 Review: Invalid Arguments Definition. An argument is invalid if and only if there is at least one Boolean valuation in which the premises are T, but the conclusion is F. How do we show an argument is invalid? Find a counterexample: a Boolean valuation where the premises are T and the conclusion is F. If asked to demonstrate that the Boolean valuation shows the argument is invalid: Method #1 Work out the meaning of the premises and the conclusion in the Boolean valuation. Method #2 Show one row of the truth table where the premises are T and the conclusion is F.

99 E 212, Fall 2018, University of Waterloo, Module 2, Page 98 Natural Deduction Natural deduction is a deductive system for showing the validity of an argument in propositional logic. Natural deduction is a collection of rules, called inference rules, each of which allows us to infer new formulas from given formulas. Natural deduction is a form of forward proof. Starting from the premises, we use the inference rules to deduce new formulas that logically follow from the premises. Using the formulas we have proven and the premises, we use the rules to deduce more formulas. We continue this process until we have deduced the conclusion. P 1, P 2,..., P n Q

100 SE 212, Fall 2018, University of Waterloo, Module 2, Page 99 Natural Deduction Gerhard Gentzen ( ). Natural deduction was introduced in his paper Investigations into Logical Deduction, Src: history/mathematicians/gentzen.html

101 SE 212, Fall 2018, University of Waterloo, Module 2, Page 100 Inference Rules Definition. An inference rule is a primitive valid argument form. Each inference rule enables the elimination or the introduction of a logical connective. Most inference rules have names that consist of: 1. a logical connective, 2. a letter: i indicates that the rule introduces the connective e indicates that the rule eliminates the connective Examples: and i, imp e

102 E 212, Fall 2018, University of Waterloo, Module 2, Page 101 Rules for Conjunction and-introduction P Q P Q and i and-elimination P Q and e P P Q Q and e Above the line are the premises of the rule. Below the line is the conclusion. To the right of the line is the name of the rule. P and Q are any formulas. The order of the formula above the line does not matter. These premises must appear in the proof on a step prior to this step.

103 SE 212, Fall 2018, University of Waterloo, Module 2, Page 102 Using the Conjunction Rules Prove a b, c b c 1) a b premise 2) c premise 3) b by and e on 1 4) b c by and i on 2,3

104 SE 212, Fall 2018, University of Waterloo, Module 2, Page 103 Ask george 1 #u nday 2 #a 01 3 #q # check ND 6 7 a & b & c, s & w - b & c & s 8 9 1) a & b & c premise 10 2) s & w premise 11 3) b & c by and_ e on ) s by and_ e on ) b & c & s by and_ i on 3,4 george checks the syntax of your formula, the form of the proof, and it check your proof steps!!

105 E 212, Fall 2018, University of Waterloo, Module 2, Page 104 Proofs in Natural Deduction We present proofs in a linear format using line labels. First, we list each of the premises on a line with the word premise beside them. To use an inference rule, formulas matching the premises of the rule must appear on existing lines of the proof. If they do, then we can add the formula matching the conclusion to the proof. The rule must apply to the whole formula on the line (meaning the pattern is matched by the entire formula), not a subpart of the formula. (This is different from transformational proof where the context of the formula didn t matter.)

106 E 212, Fall 2018, University of Waterloo, Module 2, Page 105 Proofs in Natural Deduction For each step, we list the inference rule and the line labels of the previously deduced formulas that are used to deduce the new formula. Similar to the logical laws of transformational proofs, these are rule schemas, meaning that each symbol in the statement of the inference rule can stand for an arbitrarily complex formula. There is a summary page on the inference rules for natural deduction available from the course web page.

107 SE 212, Fall 2018, University of Waterloo, Module 2, Page 106 Summary of Natural Deduction Rules INTRODUCTION ELIMINATION INTRODUCTION ELIMINATION P Q P Q and i P Q P and e P P Q or i P Q P Q P P not not i P P imp e not not e P Q Q P P Q iff i P P Q not e P Q P Q iff e

108 SE 212, Fall 2018, University of Waterloo, Module 2, Page 107 Subproofs Some natural deduction rules use subordinate proofs (subproofs). In a subproof, we start by choosing a formula that we assume is true within the subproof. Then we see what we can prove based on that assumption and any previously deduced formulas. Three proof rules use this approach: Conditional proof (imp i) Indirect proof/proof by contradiction (raa) Case analysis (cases) Every subproof must be closed with one of these rules before you are finished the proof.

109 General Form of Subproofs. x) P by rule on... x+1) sub proof opening R {. x+y) Q by rule A on... } x+y+1) conclusion by rule B on x+1 x+y. There can be nested subproofs. rule B must be one of the inference rules: imp i, raa or cases. Once the indented part is completed, the subproof is said to be closed. Lines x+1 through x+y are NOT available for use with inference rules after line x+y+1. SE 212, Fall 2018, University of Waterloo, Module 2, Page 108

110 SE 212, Fall 2018, University of Waterloo, Module 2, Page 109 Subproofs Subproofs are enclosed within {... } and indented, with the opening line of the subproof stating the assumption made in that subproof. The first line after the indented part shows what we are able to conclude from the subproof. The formulas active at a stage in the proof are those that do NOT occur in a closed subproof. We can only use active formulas to derive new formulas meaning we can only use a formula in the proof if it occurs prior to this line in the proof and it doesn t occur within a closed subproof. We have to close all subproofs to complete the proof.

111 E 212, Fall 2018, University of Waterloo, Module 2, Page 110 Rule: Conditional Proof Implies Introduction (Deduction Thm) assume R {... Q } imp i R Q In the conclusion of this proof rule, we discharge the assumption by creating an implication whose antecedent is the assumption of the subproof, and whose conclusion is the last line of the subproof. The conclusion is outside the scope of the subproof because it explicitly states the dependency on the assumption.

112 SE 212, Fall 2018, University of Waterloo, Module 2, Page 111 Summary of Natural Deduction Rules INTRODUCTION ELIMINATION INTRODUCTION ELIMINATION P Q P Q and i P Q P and e P P Q or i assume R {... Q } R Q imp i P Q P Q P P not not i P P imp e not not e P Q Q P P Q iff i P P Q not e P Q P Q iff e

113 SE 212, Fall 2018, University of Waterloo, Module 2, Page 112 Ask george 1 #check ND 2 3 ( c => d ) =>((! c =>! b ) =>(b => d ) ) 4 5 1) assume c=>d { 6 2) assume! c =>!b { 7 3) assume b { 8 4)!! c by imp e on 2,3 9 5) c by n o t n o t e on ) d by imp e on 1, 5 11 } 12 7) b => d by i m p i on } 14 8) (! c =>! b ) =>(b => d ) by i m p i on } 16 9) ( c =>d ) =>((! c =>!b ) =>(b =>d ) ) by i m p i on 1 8

114 E 212, Fall 2018, University of Waterloo, Module 2, Page 113 george : Magic (Incremental Development of ND Proofs) george has a magic rule that allows you to conclude anything and continue making progress on your proof. 1 1) assume c=>d { 2 2) assume! c =>!b { 3 3) assume b { 4 6) d by magic 5 } 6 7) b => d by i m p i on } 8 8) (! c =>! b ) =>(b => d ) by i m p i on } 10 9) ( c =>d ) =>((! c =>!b ) =>(b =>d ) ) by i m p i on 1 8 A proof with magic in it is NOT a correct proof but it can be marked for part marks. george will note Warning: magic rule has been used. (The magic rule only works in natural deduction.)

115 SE 212, Fall 2018, University of Waterloo, Module 2, Page 114 Rule: Indirect Proof (Not-introduction, Proof by Contradiction, Reductio ad absurdum) disprove R {... false } raa R disprove R {... false } raa R

116 SE 212, Fall 2018, University of Waterloo, Module 2, Page 115 Summary of Natural Deduction Rules INTRODUCTION ELIMINATION INTRODUCTION ELIMINATION P Q P Q and i P Q P and e P P Q or i assume R {... Q } R Q imp i P Q P Q P P not not i P P imp e not not e disprove R {... false } raa R P Q Q P iff i P Q P P Q not e P Q P Q iff e

117 E 212, Fall 2018, University of Waterloo, Module 2, Page 116 Example Premises: 1. If the train arrives late and there are no taxis at the station, then John is late for his meeting. (p q r) 2. John is not late for his meeting. ( r) 3. The train did arrive late. (p) Conclusion: There were taxis at the station. (q) p q r, r, p = q where: p means the train is late q means there are taxis at the station r means John is late for his meeting

118 E 212, Fall 2018, University of Waterloo, Module 2, Page 117 Case Analysis: Example I get peanut butter or I get jam. If I get peanut butter then I make a sandwich. If I get jam then I make a sandwich. Therefore, I make a sandwich.

119 SE 212, Fall 2018, University of Waterloo, Module 2, Page 118 Rule: Case Analysis P R case P {. Q } case R {. Q } Q cases

120 Summary of Natural Deduction Rules INTRODUCTION ELIMINATION INTRODUCTION ELIMINATION P Q P Q assume R {... Q } R Q and i imp i P Q P P Q P Q P P not not i P P and e imp e not not e SE 212, Fall 2018, University of Waterloo, Module 2, Page 119 P P Q or i disprove R {... false } raa R P Q Q P iff i P Q P R case P {... Q } case R {... Q } Q P P Q cases not e P Q P Q iff e

121 E 212, Fall 2018, University of Waterloo, Module 2, Page 120 Derived Rules Disjunctive Syllogism P Q P Q or e P Q Q P or e

122 SE 212, Fall 2018, University of Waterloo, Module 2, Page 121 Derived Rules Law of the Excluded Middle P P lem

123 Summary of Natural Deduction Rules INTRODUCTION ELIMINATION INTRODUCTION ELIMINATION P Q P Q assume R {... Q } R Q and i imp i P Q P P Q P Q P P not not i P P and e imp e not not e SE 212, Fall 2018, University of Waterloo, Module 2, Page 122 P P Q or i P P lem disprove R {... false } raa R P Q Q P iff i P Q P R case P {... Q } case R {... Q } Q P P Q cases not e P Q P Q iff e

124 SE 212, Fall 2018, University of Waterloo, Module 2, Page 123 Setting subgoals In doing forward proof, we have to guess at will be useful steps toward the conclusion. We can think of these stepping stones as subgoals. Here are some useful strategies: To prove A B A B A B A A Possible subgoals Both A and B Either A or B assume A then prove B (conditional proof) A B for some B A and derive a contradiction (indirect proof)

125 SE 212, Fall 2018, University of Waterloo, Module 2, Page 124 Form of Proofs You can apply and e to a formula with multiple conjuncts to deduce one of those conjuncts in a single step. You can apply cases over multiple disjuncts in a single step. You can apply and i to introduce multiple conjuncts in a single step (not yet implemented in George).

126 SE 212, Fall 2018, University of Waterloo, Module 2, Page 125 Soundness and Completeness of Natural Deduction Natural deduction for propositional logic is sound and complete. Soundness: if P 1, P 2,..., P n Q then P 1, P 2,..., P n = Q Natural deduction proves only valid arguments. Completeness: if P 1, P 2,..., P n = Q then P 1, P 2,..., P n Q Natural deduction can be used to prove all valid arguments.

127 SE 212, Fall 2018, University of Waterloo, Module 2, Page 126 Summary of Natural Deduction Valid arguments Invalid arguments Consistency of premises Inference rules Subproofs Conditional proof (imp i) Indirect proof (proof by contradiction) (raa) Case analysis (cases) Use the summary page of natural deduction rules!

128 E 212, Fall 2018, University of Waterloo, Module 2, Page 127 Topics in Module 2 1. Elements of a logic (syntax, semantics, proof theories) 2. Propositional Logic: Syntax 3. Propositional Logic: Semantics ( = ) 4. Propositional Logic: Proof Theory 4.1 Transformational Proof 4.2 Natural Deduction 4.3 Semantic Tableaux General form of tableaux Using a tableau to show a set of formulas is inconsistent Tableau expansion rules Heuristic for tableau expansion Using a tableau to show an argument is valid Soundness and completeness

129 E 212, Fall 2018, University of Waterloo, Module 2, Page 128 Text Reference For semantic tableaux, we are using Ch. 2 from Kelly (see the course pack). Kelly uses different symbols for implication and equivalence: Kelly Nissanke Also Kelly uses mutually consistent where we have used consistent when talking about a set of formulas.

130 SE 212, Fall 2018, University of Waterloo, Module 2, Page 129 General Form of Tableaux A semantic tableau is a tree representing all ways the conjunction of the formulas at the root of the tree can be true. rule # 1 formula 2 formula rule # 3 smaller formula 4 smaller formula.. 5 smaller formula CLOSED #, # 6 smaller formula CLOSED #, #

131 SE 212, Fall 2018, University of Waterloo, Module 2, Page 130 Semantic Tableaux Semantic tableaux was invented by E.W. Beth and J. Hintikka (1965). In each step in a semantic tableau proof, we either: Use a semantic tableau rule to expand one compound formula and add new formula(s) to that branch. The rules are based on the outermost propositional connective used in the compound formula (pattern match to the entire formula). Close a branch because it contains contradictory formulas. A branch is a path from the root to the leaf. If all branches of the tree contains contradictory formulas (i.e., every branch is closed), then the formulas at the root of the tree are inconsistent (i.e., there is no Boolean valuation in which the conjunction of the formulas at the root is true).

132 SE 212, Fall 2018, University of Waterloo, Module 2, Page 131 Rules for Conjunction Rule 1 and nb p q p q not and br p Rule 6 (p q) q

133 E 212, Fall 2018, University of Waterloo, Module 2, Page 132 Semantic Tableaux A branch is closed if P and P both appear on the path from the root of the tree to the leaf of the branch (i.e., there is a contradiction on the branch). P could be a compound formula. The conjunction of the formulas on a closed branch is a contradiction. We will label all the formulas in the tableau, and list these along with rule names to justify the expansion of the tableau. (The order that formulas get assigned numbers doesn t matter, as long as each formula has a unique number.) The line labels of the formulas listed with a CLOSED line contradict each other.

134 E 212, Fall 2018, University of Waterloo, Module 2, Page 133 Tableau Expansion Rules There are rules for: each of the binary logical connectives the negation of a formula with each binary logical connective double negation The rules must be applied to the outermost logical connective in the formula (as was true with natural deduction rules). There is a summary sheet available on the course web page with the semantic tableau expansion rules.

135 Summary of Semantic Tableaux Rules POSITIVE and nb P Q P Q NEGATIVE (P Q) not and br P Q P Q (P Q) or br P Q not or nb P Q P Q imp br P Q P Q iff br P Q P Q SE 212, Fall 2018, University of Waterloo, Module 2, Page 134 not imp nb not not nb not iff br P Q (P Q) P P P Q (P Q) P Q

136 SE 212, Fall 2018, University of Waterloo, Module 2, Page 135 Heuristic Heuristic: Apply the non-branching rules first. Usually this will result in shorter proofs.

137 Ask george 1 # check ST 2 3 b & c, d,!( c & d) - false 4 5 1) b & c 6 2) d 7 3)!(c & d) 8 by not_and_br on 3 9 { 10 4)!c 11 by and_nb on 1 12 { % it is optional to put curly braces around 13 % the result of a non - branching step. 14 6) b 15 7) c 16 closed on 4,7 17 } 18 } % more to follow george checks the syntax of your formulas, the rule names, the format of your proof, and that the rules have been correctly applied. SE 212, Fall 2018, University of Waterloo, Module 2, Page 136

138 SE 212, Fall 2018, University of Waterloo, Module 2, Page 137 Valid Arguments We re trying to prove: P 1, P 2,..., P n Q Can we use semantic tableaux to do this? For an argument to be invalid, there has to be a Boolean valuation in which the premises are T and the conclusion is F there has to be a Boolean valuation in which the premises are T and the negation of the conclusion is T P 1, P 2,..., P n, Q is a consistent set of formulas

139 E 212, Fall 2018, University of Waterloo, Module 2, Page 138 Valid Arguments To show an argument is valid, we use a semantic tableau to show that P 1, P 2,..., P n, Q is an inconsistent set of formulas: we put the premises and the negation of the conclusion at the root of a tableau. If we can close all the branches of the tableau, then this set of formulas is inconsistent. This means the argument is valid and we can write: P 1, P 2,..., P n Q

140 SE 212, Fall 2018, University of Waterloo, Module 2, Page 139 Proving Valid Arguments Using Semantic Tableaux 1 premise 2 premise 3 negation of conclusion rule # 4 smaller formula rule #. 5 smaller formula CLOSED #, #. 6 smaller formula CLOSED #, #

141 E 212, Fall 2018, University of Waterloo, Module 2, Page 140 Proving Valid Arguments Using Semantic Tableaux Semantic tableau is based on the idea of proof by contradiction. It is a refutation-based system.

142 Summary of Semantic Tableaux Rules POSITIVE and nb P Q P Q NEGATIVE (P Q) not and br P Q P Q (P Q) or br P Q not or nb P Q P Q imp br P Q P Q iff br P Q P Q SE 212, Fall 2018, University of Waterloo, Module 2, Page 141 not imp nb not not nb not iff br P Q (P Q) P P P Q (P Q) P Q

143 E 212, Fall 2018, University of Waterloo, Module 2, Page 142 Form of Proof A semantic tableaux rule only applies to one formula (i.e., one line of the tree) and must apply to the outermost propositional connective of that formula. Closing a tableau requires two formulas that contradict each other (i.e., two lines of the proof). They must be on the same branch in the tableau. Branching captures disjunction: there are multiple ways to make the formula true. The rules for and (both positive and negative) can be applied to a formula with more than two conjuncts or disjuncts in a single step. You can expand the branches in any order. It s fine if the left and right branches are swapped.

144 SE 212, Fall 2018, University of Waterloo, Module 2, Page 143 Ask george 1 # check ST 2 3 p &!q => r,!r, p - q 4 5 1) p &!q => r 6 2)!r 7 3) p 8 4)!q 9 by imp_br on 1 10 { 11 5)!(p &!q) 12 by not_and_br on 5 13 { 14 7)!p 15 closed on 3,7 16 } 17 { 18 8)!!q 19 closed on 4,8 20 } 21 } 22 % etc

145 SE 212, Fall 2018, University of Waterloo, Module 2, Page 144 George: Incremental Development of ST Proofs George will check a ST proof even if a branch is left opened. It will give the feedback Almost Pass... Warning: branch is open. 1 # check ST 2 3 h => s, r=>!s, h -!r 4 5 1) h => s 6 2) r=>!s 7 3) h 8 4)!!r 9 by imp_br on 2 10 { 11 5)!r 12 closed on 4,5 13 } 14 { 15 6)!s 16 }

146 E 212, Fall 2018, University of Waterloo, Module 2, Page 145 Differences from Kelly Text To show an argument is invalid, provide a Boolean valuation in which the premises are T and the conclusion is F. To show a set of formulas is consistent, provide a Boolean valuation in which all the formulas are T. (This is unlike the Kelly text, which uses an unclosed tableau to say a set of formulas is consistent.)

147 SE 212, Fall 2018, University of Waterloo, Module 2, Page 146 Soundness and Completeness of Semantic Tableaux Semantic tableaux for propositional logic is sound and complete. Soundness: if P 1, P 2,..., P n Q then P 1, P 2,..., P n = Q Semantic tableaux proves only valid arguments. Completeness: if P 1, P 2,..., P n = Q then P 1, P 2,..., P n Q Semantic tableaux can be used to prove all valid arguments.

148 E 212, Fall 2018, University of Waterloo, Module 2, Page 147 Summary of Semantic Tableaux General form of tableaux Using a tableau to show a set of formulas is inconsistent Tableau expansion rules Heuristic for tableau expansion Using a tableau to show an argument is valid Soundness and completeness

149 E 212, Fall 2018, University of Waterloo, Module 2, Page 148 Topics in Module 2 1. Elements of a logic 2. Propositional Logic: Syntax 3. Propositional Logic: Semantics 4. Propositional Logic: Proof Theory 5. Big Example!!

150 Canadian Automated Air Traffic Control System (CAATS) SE 212, Fall 2018, University of Waterloo, Module 2, Page 149

151 CAATS SE 212, Fall 2018, University of Waterloo, Module 2, Page 150

152 E 212, Fall 2018, University of Waterloo, Module 2, Page 151 CAATS 1991(?) million square miles of controlled airspace approximately $500 million cost (?) safety standards: MIL-STD-882B, IEEE St.d 1228, IEC customer: NavCanada developer: Raytheon Systems Canada, Richmond, BC Sources: (search for CAATS)

153 North Atlantic (NAT) Region SE 212, Fall 2018, University of Waterloo, Module 2, Page 152

154 SE 212, Fall 2018, University of Waterloo, Module 2, Page 153 Specification (Published by Transport Canada)

155 Kinds of Separation SE 212, Fall 2018, University of Waterloo, Module 2, Page 154

156 SE 212, Fall 2018, University of Waterloo, Module 2, Page 155

Natural Deduction. Formal Methods in Verification of Computer Systems Jeremy Johnson

Natural Deduction. Formal Methods in Verification of Computer Systems Jeremy Johnson Natural Deduction Formal Methods in Verification of Computer Systems Jeremy Johnson Outline 1. An example 1. Validity by truth table 2. Validity by proof 2. What s a proof 1. Proof checker 3. Rules of

More information

02 Propositional Logic

02 Propositional Logic SE 2F03 Fall 2005 02 Propositional Logic Instructor: W. M. Farmer Revised: 25 September 2005 1 What is Propositional Logic? Propositional logic is the study of the truth or falsehood of propositions or

More information

Computation and Logic Definitions

Computation and Logic Definitions Computation and Logic Definitions True and False Also called Boolean truth values, True and False represent the two values or states an atom can assume. We can use any two distinct objects to represent

More information

Propositional Logic. Spring Propositional Logic Spring / 32

Propositional Logic. Spring Propositional Logic Spring / 32 Propositional Logic Spring 2016 Propositional Logic Spring 2016 1 / 32 Introduction Learning Outcomes for this Presentation Learning Outcomes... At the conclusion of this session, we will Define the elements

More information

Truth-Functional Logic

Truth-Functional Logic Truth-Functional Logic Syntax Every atomic sentence (A, B, C, ) is a sentence and are sentences With ϕ a sentence, the negation ϕ is a sentence With ϕ and ψ sentences, the conjunction ϕ ψ is a sentence

More information

CSC Discrete Math I, Spring Propositional Logic

CSC Discrete Math I, Spring Propositional Logic CSC 125 - Discrete Math I, Spring 2017 Propositional Logic Propositions A proposition is a declarative sentence that is either true or false Propositional Variables A propositional variable (p, q, r, s,...)

More information

Warm-Up Problem. Is the following true or false? 1/35

Warm-Up Problem. Is the following true or false? 1/35 Warm-Up Problem Is the following true or false? 1/35 Propositional Logic: Resolution Carmen Bruni Lecture 6 Based on work by J Buss, A Gao, L Kari, A Lubiw, B Bonakdarpour, D Maftuleac, C Roberts, R Trefler,

More information

Propositional Logic: Part II - Syntax & Proofs 0-0

Propositional Logic: Part II - Syntax & Proofs 0-0 Propositional Logic: Part II - Syntax & Proofs 0-0 Outline Syntax of Propositional Formulas Motivating Proofs Syntactic Entailment and Proofs Proof Rules for Natural Deduction Axioms, theories and theorems

More information

cis32-ai lecture # 18 mon-3-apr-2006

cis32-ai lecture # 18 mon-3-apr-2006 cis32-ai lecture # 18 mon-3-apr-2006 today s topics: propositional logic cis32-spring2006-sklar-lec18 1 Introduction Weak (search-based) problem-solving does not scale to real problems. To succeed, problem

More information

PL: Truth Trees. Handout Truth Trees: The Setup

PL: Truth Trees. Handout Truth Trees: The Setup Handout 4 PL: Truth Trees Truth tables provide a mechanical method for determining whether a proposition, set of propositions, or argument has a particular logical property. For example, we can show that

More information

3 Propositional Logic

3 Propositional Logic 3 Propositional Logic 3.1 Syntax 3.2 Semantics 3.3 Equivalence and Normal Forms 3.4 Proof Procedures 3.5 Properties Propositional Logic (25th October 2007) 1 3.1 Syntax Definition 3.0 An alphabet Σ consists

More information

Natural Deduction for Propositional Logic

Natural Deduction for Propositional Logic Natural Deduction for Propositional Logic Bow-Yaw Wang Institute of Information Science Academia Sinica, Taiwan September 10, 2018 Bow-Yaw Wang (Academia Sinica) Natural Deduction for Propositional Logic

More information

15414/614 Optional Lecture 1: Propositional Logic

15414/614 Optional Lecture 1: Propositional Logic 15414/614 Optional Lecture 1: Propositional Logic Qinsi Wang Logic is the study of information encoded in the form of logical sentences. We use the language of Logic to state observations, to define concepts,

More information

AI Principles, Semester 2, Week 2, Lecture 5 Propositional Logic and Predicate Logic

AI Principles, Semester 2, Week 2, Lecture 5 Propositional Logic and Predicate Logic AI Principles, Semester 2, Week 2, Lecture 5 Propositional Logic and Predicate Logic Propositional logic Logical connectives Rules for wffs Truth tables for the connectives Using Truth Tables to evaluate

More information

Propositional Logic Review

Propositional Logic Review Propositional Logic Review UC Berkeley, Philosophy 142, Spring 2016 John MacFarlane The task of describing a logical system comes in three parts: Grammar Describing what counts as a formula Semantics Defining

More information

Lecture 2. Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits. Reading (Epp s textbook)

Lecture 2. Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits. Reading (Epp s textbook) Lecture 2 Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits Reading (Epp s textbook) 2.1-2.4 1 Logic Logic is a system based on statements. A statement (or

More information

7. Propositional Logic. Wolfram Burgard and Bernhard Nebel

7. Propositional Logic. Wolfram Burgard and Bernhard Nebel Foundations of AI 7. Propositional Logic Rational Thinking, Logic, Resolution Wolfram Burgard and Bernhard Nebel Contents Agents that think rationally The wumpus world Propositional logic: syntax and semantics

More information

Topic 1: Propositional logic

Topic 1: Propositional logic Topic 1: Propositional logic Guy McCusker 1 1 University of Bath Logic! This lecture is about the simplest kind of mathematical logic: propositional calculus. We discuss propositions, which are statements

More information

1 Propositional Logic

1 Propositional Logic 1 Propositional Logic Required reading: Foundations of Computation. Sections 1.1 and 1.2. 1. Introduction to Logic a. Logical consequences. If you know all humans are mortal, and you know that you are

More information

Announcements. CS243: Discrete Structures. Propositional Logic II. Review. Operator Precedence. Operator Precedence, cont. Operator Precedence Example

Announcements. CS243: Discrete Structures. Propositional Logic II. Review. Operator Precedence. Operator Precedence, cont. Operator Precedence Example Announcements CS243: Discrete Structures Propositional Logic II Işıl Dillig First homework assignment out today! Due in one week, i.e., before lecture next Tuesday 09/11 Weilin s Tuesday office hours are

More information

Introduction to Artificial Intelligence. Logical Agents

Introduction to Artificial Intelligence. Logical Agents Introduction to Artificial Intelligence Logical Agents (Logic, Deduction, Knowledge Representation) Bernhard Beckert UNIVERSITÄT KOBLENZ-LANDAU Winter Term 2004/2005 B. Beckert: KI für IM p.1 Outline Knowledge-based

More information

Logic: Propositional Logic (Part I)

Logic: Propositional Logic (Part I) Logic: Propositional Logic (Part I) Alessandro Artale Free University of Bozen-Bolzano Faculty of Computer Science http://www.inf.unibz.it/ artale Descrete Mathematics and Logic BSc course Thanks to Prof.

More information

Deductive Systems. Lecture - 3

Deductive Systems. Lecture - 3 Deductive Systems Lecture - 3 Axiomatic System Axiomatic System (AS) for PL AS is based on the set of only three axioms and one rule of deduction. It is minimal in structure but as powerful as the truth

More information

Propositional Logic: Methods of Proof (Part II)

Propositional Logic: Methods of Proof (Part II) Propositional Logic: Methods of Proof (Part II) You will be expected to know Basic definitions Inference, derive, sound, complete Conjunctive Normal Form (CNF) Convert a Boolean formula to CNF Do a short

More information

Announcements. CS311H: Discrete Mathematics. Propositional Logic II. Inverse of an Implication. Converse of a Implication

Announcements. CS311H: Discrete Mathematics. Propositional Logic II. Inverse of an Implication. Converse of a Implication Announcements CS311H: Discrete Mathematics Propositional Logic II Instructor: Işıl Dillig First homework assignment out today! Due in one week, i.e., before lecture next Wed 09/13 Remember: Due before

More information

1.1 Statements and Compound Statements

1.1 Statements and Compound Statements Chapter 1 Propositional Logic 1.1 Statements and Compound Statements A statement or proposition is an assertion which is either true or false, though you may not know which. That is, a statement is something

More information

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

COMP219: Artificial Intelligence. Lecture 19: Logic for KR COMP219: Artificial Intelligence Lecture 19: Logic for KR 1 Overview Last time Expert Systems and Ontologies Today Logic as a knowledge representation scheme Propositional Logic Syntax Semantics Proof

More information

Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5)

Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5) B.Y. Choueiry 1 Instructor s notes #12 Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5) Introduction to Artificial Intelligence CSCE 476-876, Fall 2018 URL: www.cse.unl.edu/ choueiry/f18-476-876

More information

Foundations of Artificial Intelligence

Foundations of Artificial Intelligence Foundations of Artificial Intelligence 7. Propositional Logic Rational Thinking, Logic, Resolution Wolfram Burgard, Maren Bennewitz, and Marco Ragni Albert-Ludwigs-Universität Freiburg Contents 1 Agents

More information

Foundations of Artificial Intelligence

Foundations of Artificial Intelligence Foundations of Artificial Intelligence 7. Propositional Logic Rational Thinking, Logic, Resolution Joschka Boedecker and Wolfram Burgard and Bernhard Nebel Albert-Ludwigs-Universität Freiburg May 17, 2016

More information

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 10, 5/9/2005 University of Washington, Department of Electrical Engineering Spring 2005 Instructor: Professor Jeff A. Bilmes Logical Agents Chapter 7

More information

Propositional Logic: Methods of Proof (Part II)

Propositional Logic: Methods of Proof (Part II) Propositional Logic: Methods of Proof (Part II) This lecture topic: Propositional Logic (two lectures) Chapter 7.1-7.4 (previous lecture, Part I) Chapter 7.5 (this lecture, Part II) (optional: 7.6-7.8)

More information

Formal Verification Methods 1: Propositional Logic

Formal Verification Methods 1: Propositional Logic Formal Verification Methods 1: Propositional Logic John Harrison Intel Corporation Course overview Propositional logic A resurgence of interest Logic and circuits Normal forms The Davis-Putnam procedure

More information

Part 1: Propositional Logic

Part 1: Propositional Logic Part 1: Propositional Logic Literature (also for first-order logic) Schöning: Logik für Informatiker, Spektrum Fitting: First-Order Logic and Automated Theorem Proving, Springer 1 Last time 1.1 Syntax

More information

Manual of Logical Style

Manual of Logical Style Manual of Logical Style Dr. Holmes January 9, 2015 Contents 1 Introduction 2 2 Conjunction 3 2.1 Proving a conjunction...................... 3 2.2 Using a conjunction........................ 3 3 Implication

More information

Advanced Topics in LP and FP

Advanced Topics in LP and FP Lecture 1: Prolog and Summary of this lecture 1 Introduction to Prolog 2 3 Truth value evaluation 4 Prolog Logic programming language Introduction to Prolog Introduced in the 1970s Program = collection

More information

The statement calculus and logic

The statement calculus and logic Chapter 2 Contrariwise, continued Tweedledee, if it was so, it might be; and if it were so, it would be; but as it isn t, it ain t. That s logic. Lewis Carroll You will have encountered several languages

More information

Mathematics 114L Spring 2018 D.A. Martin. Mathematical Logic

Mathematics 114L Spring 2018 D.A. Martin. Mathematical Logic Mathematics 114L Spring 2018 D.A. Martin Mathematical Logic 1 First-Order Languages. Symbols. All first-order languages we consider will have the following symbols: (i) variables v 1, v 2, v 3,... ; (ii)

More information

Intelligent Agents. Pınar Yolum Utrecht University

Intelligent Agents. Pınar Yolum Utrecht University Intelligent Agents Pınar Yolum p.yolum@uu.nl Utrecht University Logical Agents (Based mostly on the course slides from http://aima.cs.berkeley.edu/) Outline Knowledge-based agents Wumpus world Logic in

More information

Chapter 1: The Logic of Compound Statements. January 7, 2008

Chapter 1: The Logic of Compound Statements. January 7, 2008 Chapter 1: The Logic of Compound Statements January 7, 2008 Outline 1 1.1 Logical Form and Logical Equivalence 2 1.2 Conditional Statements 3 1.3 Valid and Invalid Arguments Central notion of deductive

More information

Arguments and Proofs. 1. A set of sentences (the premises) 2. A sentence (the conclusion)

Arguments and Proofs. 1. A set of sentences (the premises) 2. A sentence (the conclusion) Arguments and Proofs For the next section of this course, we will study PROOFS. A proof can be thought of as the formal representation of a process of reasoning. Proofs are comparable to arguments, since

More information

Computational Logic. Davide Martinenghi. Spring Free University of Bozen-Bolzano. Computational Logic Davide Martinenghi (1/30)

Computational Logic. Davide Martinenghi. Spring Free University of Bozen-Bolzano. Computational Logic Davide Martinenghi (1/30) Computational Logic Davide Martinenghi Free University of Bozen-Bolzano Spring 2010 Computational Logic Davide Martinenghi (1/30) Propositional Logic - sequent calculus To overcome the problems of natural

More information

Language of Propositional Logic

Language of Propositional Logic Logic A logic has: 1. An alphabet that contains all the symbols of the language of the logic. 2. A syntax giving the rules that define the well formed expressions of the language of the logic (often called

More information

Propositional Logic Basics Propositional Equivalences Normal forms Boolean functions and digital circuits. Propositional Logic.

Propositional Logic Basics Propositional Equivalences Normal forms Boolean functions and digital circuits. Propositional Logic. Propositional Logic Winter 2012 Propositional Logic: Section 1.1 Proposition A proposition is a declarative sentence that is either true or false. Which ones of the following sentences are propositions?

More information

Logical Agents. Chapter 7

Logical Agents. Chapter 7 Logical Agents Chapter 7 Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem

More information

Propositional Calculus: Formula Simplification, Essential Laws, Normal Forms

Propositional Calculus: Formula Simplification, Essential Laws, Normal Forms P Formula Simplification, Essential Laws, Normal Forms Lila Kari University of Waterloo P Formula Simplification, Essential Laws, Normal CS245, Forms Logic and Computation 1 / 26 Propositional calculus

More information

3 The Semantics of the Propositional Calculus

3 The Semantics of the Propositional Calculus 3 The Semantics of the Propositional Calculus 1. Interpretations Formulas of the propositional calculus express statement forms. In chapter two, we gave informal descriptions of the meanings of the logical

More information

LING 106. Knowledge of Meaning Lecture 3-1 Yimei Xiang Feb 6, Propositional logic

LING 106. Knowledge of Meaning Lecture 3-1 Yimei Xiang Feb 6, Propositional logic LING 106. Knowledge of Meaning Lecture 3-1 Yimei Xiang Feb 6, 2016 Propositional logic 1 Vocabulary of propositional logic Vocabulary (1) a. Propositional letters: p, q, r, s, t, p 1, q 1,..., p 2, q 2,...

More information

The Importance of Being Formal. Martin Henz. February 5, Propositional Logic

The Importance of Being Formal. Martin Henz. February 5, Propositional Logic The Importance of Being Formal Martin Henz February 5, 2014 Propositional Logic 1 Motivation In traditional logic, terms represent sets, and therefore, propositions are limited to stating facts on sets

More information

Learning Goals of CS245 Logic and Computation

Learning Goals of CS245 Logic and Computation Learning Goals of CS245 Logic and Computation Alice Gao April 27, 2018 Contents 1 Propositional Logic 2 2 Predicate Logic 4 3 Program Verification 6 4 Undecidability 7 1 1 Propositional Logic Introduction

More information

The semantics of propositional logic

The semantics of propositional logic The semantics of propositional logic Readings: Sections 1.3 and 1.4 of Huth and Ryan. In this module, we will nail down the formal definition of a logical formula, and describe the semantics of propositional

More information

Classical Propositional Logic

Classical Propositional Logic The Language of A Henkin-style Proof for Natural Deduction January 16, 2013 The Language of A Henkin-style Proof for Natural Deduction Logic Logic is the science of inference. Given a body of information,

More information

Logical Agents. Chapter 7

Logical Agents. Chapter 7 Logical Agents Chapter 7 Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem

More information

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

COMP219: Artificial Intelligence. Lecture 19: Logic for KR COMP219: Artificial Intelligence Lecture 19: Logic for KR 1 Overview Last time Expert Systems and Ontologies Today Logic as a knowledge representation scheme Propositional Logic Syntax Semantics Proof

More information

Propositional logic. Programming and Modal Logic

Propositional logic. Programming and Modal Logic Propositional logic Programming and Modal Logic 2006-2007 4 Contents Syntax of propositional logic Semantics of propositional logic Semantic entailment Natural deduction proof system Soundness and completeness

More information

Knowledge representation DATA INFORMATION KNOWLEDGE WISDOM. Figure Relation ship between data, information knowledge and wisdom.

Knowledge representation DATA INFORMATION KNOWLEDGE WISDOM. Figure Relation ship between data, information knowledge and wisdom. Knowledge representation Introduction Knowledge is the progression that starts with data which s limited utility. Data when processed become information, information when interpreted or evaluated becomes

More information

Supplementary Logic Notes CSE 321 Winter 2009

Supplementary Logic Notes CSE 321 Winter 2009 1 Propositional Logic Supplementary Logic Notes CSE 321 Winter 2009 1.1 More efficient truth table methods The method of using truth tables to prove facts about propositional formulas can be a very tedious

More information

Formal (natural) deduction in propositional logic

Formal (natural) deduction in propositional logic Formal (natural) deduction in propositional logic Lila Kari University of Waterloo Formal (natural) deduction in propositional logic CS245, Logic and Computation 1 / 67 I know what you re thinking about,

More information

Kecerdasan Buatan M. Ali Fauzi

Kecerdasan Buatan M. Ali Fauzi Kecerdasan Buatan M. Ali Fauzi Artificial Intelligence M. Ali Fauzi Logical Agents M. Ali Fauzi In which we design agents that can form representations of the would, use a process of inference to derive

More information

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system):

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system): Logic Knowledge-based agents Inference engine Knowledge base Domain-independent algorithms Domain-specific content Knowledge base (KB) = set of sentences in a formal language Declarative approach to building

More information

THE LOGIC OF COMPOUND STATEMENTS

THE LOGIC OF COMPOUND STATEMENTS THE LOGIC OF COMPOUND STATEMENTS All dogs have four legs. All tables have four legs. Therefore, all dogs are tables LOGIC Logic is a science of the necessary laws of thought, without which no employment

More information

Propositional Language - Semantics

Propositional Language - Semantics Propositional Language - Semantics Lila Kari University of Waterloo Propositional Language - Semantics CS245, Logic and Computation 1 / 41 Syntax and semantics Syntax Semantics analyzes Form analyzes Meaning

More information

Propositional logic (revision) & semantic entailment. p. 1/34

Propositional logic (revision) & semantic entailment. p. 1/34 Propositional logic (revision) & semantic entailment p. 1/34 Reading The background reading for propositional logic is Chapter 1 of Huth/Ryan. (This will cover approximately the first three lectures.)

More information

Propositional Logic. Logic. Propositional Logic Syntax. Propositional Logic

Propositional Logic. Logic. Propositional Logic Syntax. Propositional Logic Propositional Logic Reading: Chapter 7.1, 7.3 7.5 [ased on slides from Jerry Zhu, Louis Oliphant and ndrew Moore] Logic If the rules of the world are presented formally, then a decision maker can use logical

More information

10/5/2012. Logic? What is logic? Propositional Logic. Propositional Logic (Rosen, Chapter ) Logic is a truth-preserving system of inference

10/5/2012. Logic? What is logic? Propositional Logic. Propositional Logic (Rosen, Chapter ) Logic is a truth-preserving system of inference Logic? Propositional Logic (Rosen, Chapter 1.1 1.3) TOPICS Propositional Logic Truth Tables Implication Logical Proofs 10/1/12 CS160 Fall Semester 2012 2 What is logic? Logic is a truth-preserving system

More information

COMP 2600: Formal Methods for Software Engineeing

COMP 2600: Formal Methods for Software Engineeing COMP 2600: Formal Methods for Software Engineeing Dirk Pattinson Semester 2, 2013 What do we mean by FORMAL? Oxford Dictionary in accordance with convention or etiquette or denoting a style of writing

More information

Part Two: The Basic Components of the SOFL Specification Language

Part Two: The Basic Components of the SOFL Specification Language Part Two: The Basic Components of the SOFL Specification Language SOFL logic Module Condition Data Flow Diagrams Process specification Function definition and specification Process decomposition Other

More information

Logic Overview, I. and T T T T F F F T F F F F

Logic Overview, I. and T T T T F F F T F F F F Logic Overview, I DEFINITIONS A statement (proposition) is a declarative sentence that can be assigned a truth value T or F, but not both. Statements are denoted by letters p, q, r, s,... The 5 basic logical

More information

Part 1: Propositional Logic

Part 1: Propositional Logic Part 1: Propositional Logic Literature (also for first-order logic) Schöning: Logik für Informatiker, Spektrum Fitting: First-Order Logic and Automated Theorem Proving, Springer 1 Last time 1.1 Syntax

More information

Chapter 1 Elementary Logic

Chapter 1 Elementary Logic 2017-2018 Chapter 1 Elementary Logic The study of logic is the study of the principles and methods used in distinguishing valid arguments from those that are not valid. The aim of this chapter is to help

More information

Foundations of Artificial Intelligence

Foundations of Artificial Intelligence Foundations of Artificial Intelligence 7. Propositional Logic Rational Thinking, Logic, Resolution Joschka Boedecker and Wolfram Burgard and Frank Hutter and Bernhard Nebel Albert-Ludwigs-Universität Freiburg

More information

Propositional Equivalence

Propositional Equivalence Propositional Equivalence Tautologies and contradictions A compound proposition that is always true, regardless of the truth values of the individual propositions involved, is called a tautology. Example:

More information

Propositional Logic: Deductive Proof & Natural Deduction Part 1

Propositional Logic: Deductive Proof & Natural Deduction Part 1 Propositional Logic: Deductive Proof & Natural Deduction Part 1 CS402, Spring 2016 Shin Yoo Deductive Proof In propositional logic, a valid formula is a tautology. So far, we could show the validity of

More information

Propositional natural deduction

Propositional natural deduction Propositional natural deduction COMP2600 / COMP6260 Dirk Pattinson Australian National University Semester 2, 2016 Major proof techniques 1 / 25 Three major styles of proof in logic and mathematics Model

More information

Propositional Logic: Methods of Proof. Chapter 7, Part II

Propositional Logic: Methods of Proof. Chapter 7, Part II Propositional Logic: Methods of Proof Chapter 7, Part II Inference in Formal Symbol Systems: Ontology, Representation, ti Inference Formal Symbol Systems Symbols correspond to things/ideas in the world

More information

2. The Logic of Compound Statements Summary. Aaron Tan August 2017

2. The Logic of Compound Statements Summary. Aaron Tan August 2017 2. The Logic of Compound Statements Summary Aaron Tan 21 25 August 2017 1 2. The Logic of Compound Statements 2.1 Logical Form and Logical Equivalence Statements; Compound Statements; Statement Form (Propositional

More information

Section 1.1 Propositions

Section 1.1 Propositions Set Theory & Logic Section 1.1 Propositions Fall, 2009 Section 1.1 Propositions In Chapter 1, our main goals are to prove sentences about numbers, equations or functions and to write the proofs. Definition.

More information

Propositional Logic Language

Propositional Logic Language Propositional Logic Language A logic consists of: an alphabet A, a language L, i.e., a set of formulas, and a binary relation = between a set of formulas and a formula. An alphabet A consists of a finite

More information

Logical Agents. Outline

Logical Agents. Outline Logical Agents *(Chapter 7 (Russel & Norvig, 2004)) Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability

More information

What is Logic? Introduction to Logic. Simple Statements. Which one is statement?

What is Logic? Introduction to Logic. Simple Statements. Which one is statement? What is Logic? Introduction to Logic Peter Lo Logic is the study of reasoning It is specifically concerned with whether reasoning is correct Logic is also known as Propositional Calculus CS218 Peter Lo

More information

CHAPTER 6 - THINKING ABOUT AND PRACTICING PROPOSITIONAL LOGIC

CHAPTER 6 - THINKING ABOUT AND PRACTICING PROPOSITIONAL LOGIC 1 CHAPTER 6 - THINKING ABOUT AND PRACTICING PROPOSITIONAL LOGIC Here, you ll learn: what it means for a logic system to be finished some strategies for constructing proofs Congratulations! Our system of

More information

(p == train arrives late) (q == there are taxis) (r == If p and not q, then r. Not r. p. Therefore, q. Propositional Logic

(p == train arrives late) (q == there are taxis) (r == If p and not q, then r. Not r. p. Therefore, q. Propositional Logic Propositional Logic The aim of logic in computer science is to develop languages to model the situations we encounter as computer science professionals Want to do that in such a way that we can reason

More information

Unit 1. Propositional Logic Reading do all quick-checks Propositional Logic: Ch. 2.intro, 2.2, 2.3, 2.4. Review 2.9

Unit 1. Propositional Logic Reading do all quick-checks Propositional Logic: Ch. 2.intro, 2.2, 2.3, 2.4. Review 2.9 Unit 1. Propositional Logic Reading do all quick-checks Propositional Logic: Ch. 2.intro, 2.2, 2.3, 2.4. Review 2.9 Typeset September 23, 2005 1 Statements or propositions Defn: A statement is an assertion

More information

Introduction to Metalogic

Introduction to Metalogic Philosophy 135 Spring 2008 Tony Martin Introduction to Metalogic 1 The semantics of sentential logic. The language L of sentential logic. Symbols of L: Remarks: (i) sentence letters p 0, p 1, p 2,... (ii)

More information

Section 1.2: Propositional Logic

Section 1.2: Propositional Logic Section 1.2: Propositional Logic January 17, 2017 Abstract Now we re going to use the tools of formal logic to reach logical conclusions ( prove theorems ) based on wffs formed by some given statements.

More information

Natural Deduction is a method for deriving the conclusion of valid arguments expressed in the symbolism of propositional logic.

Natural Deduction is a method for deriving the conclusion of valid arguments expressed in the symbolism of propositional logic. Natural Deduction is a method for deriving the conclusion of valid arguments expressed in the symbolism of propositional logic. The method consists of using sets of Rules of Inference (valid argument forms)

More information

Propositional logic ( ): Review from Mat 1348

Propositional logic ( ): Review from Mat 1348 CSI 2101 / Winter 2008: Discrete Structures. Propositional logic ( 1.1-1.2): Review from Mat 1348 Dr. Nejib Zaguia - Winter 2008 1 Propositional logic: Review Mathematical Logic is a tool for working with

More information

Manual of Logical Style (fresh version 2018)

Manual of Logical Style (fresh version 2018) Manual of Logical Style (fresh version 2018) Randall Holmes 9/5/2018 1 Introduction This is a fresh version of a document I have been working on with my classes at various levels for years. The idea that

More information

2/13/2012. Logic: Truth Tables. CS160 Rosen Chapter 1. Logic?

2/13/2012. Logic: Truth Tables. CS160 Rosen Chapter 1. Logic? Logic: Truth Tables CS160 Rosen Chapter 1 Logic? 1 What is logic? Logic is a truth-preserving system of inference Truth-preserving: If the initial statements are true, the inferred statements will be true

More information

1 The Foundation: Logic and Proofs

1 The Foundation: Logic and Proofs 1 The Foundation: Logic and Proofs 1.1 Propositional Logic Propositions( 명제 ) a declarative sentence that is either true or false, but not both nor neither letters denoting propositions p, q, r, s, T:

More information

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning.

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning. 3: Logic Why logic? Logic about inference or argument Start from assumptions or axioms Make deductions according to rules of reasoning Logic 3-1 Why logic? (continued) If I don t buy a lottery ticket on

More information

03 Propositional Logic II

03 Propositional Logic II Martin Henz February 12, 2014 Generated on Wednesday 12 th February, 2014, 09:49 1 Review: Syntax and Semantics of Propositional Logic 2 3 Propositional Atoms and Propositions Semantics of Formulas Validity,

More information

1 Propositional Logic

1 Propositional Logic CS 2800, Logic and Computation Propositional Logic Lectures Pete Manolios Version: 384 Spring 2011 1 Propositional Logic The study of logic was initiated by the ancient Greeks, who were concerned with

More information

n logical not (negation) n logical or (disjunction) n logical and (conjunction) n logical exclusive or n logical implication (conditional)

n logical not (negation) n logical or (disjunction) n logical and (conjunction) n logical exclusive or n logical implication (conditional) Discrete Math Review Discrete Math Review (Rosen, Chapter 1.1 1.6) TOPICS Propositional Logic Logical Operators Truth Tables Implication Logical Equivalence Inference Rules What you should know about propositional

More information

Tecniche di Verifica. Introduction to Propositional Logic

Tecniche di Verifica. Introduction to Propositional Logic Tecniche di Verifica Introduction to Propositional Logic 1 Logic A formal logic is defined by its syntax and semantics. Syntax An alphabet is a set of symbols. A finite sequence of these symbols is called

More information

Propositional Logic. Yimei Xiang 11 February format strictly follow the laws and never skip any step.

Propositional Logic. Yimei Xiang 11 February format strictly follow the laws and never skip any step. Propositional Logic Yimei Xiang yxiang@fas.harvard.edu 11 February 2014 1 Review Recursive definition Set up the basis Generate new members with rules Exclude the rest Subsets vs. proper subsets Sets of

More information

COMP219: Artificial Intelligence. Lecture 20: Propositional Reasoning

COMP219: Artificial Intelligence. Lecture 20: Propositional Reasoning COMP219: Artificial Intelligence Lecture 20: Propositional Reasoning 1 Overview Last time Logic for KR in general; Propositional Logic; Natural Deduction Today Entailment, satisfiability and validity Normal

More information

Overview. Knowledge-Based Agents. Introduction. COMP219: Artificial Intelligence. Lecture 19: Logic for KR

Overview. Knowledge-Based Agents. Introduction. COMP219: Artificial Intelligence. Lecture 19: Logic for KR COMP219: Artificial Intelligence Lecture 19: Logic for KR Last time Expert Systems and Ontologies oday Logic as a knowledge representation scheme Propositional Logic Syntax Semantics Proof theory Natural

More information

LOGIC PROPOSITIONAL REASONING

LOGIC PROPOSITIONAL REASONING LOGIC PROPOSITIONAL REASONING WS 2017/2018 (342.208) Armin Biere Martina Seidl biere@jku.at martina.seidl@jku.at Institute for Formal Models and Verification Johannes Kepler Universität Linz Version 2018.1

More information

Logical Agents: Propositional Logic. Chapter 7

Logical Agents: Propositional Logic. Chapter 7 Logical Agents: Propositional Logic Chapter 7 Outline Topics: Knowledge-based agents Example domain: The Wumpus World Logic in general models and entailment Propositional (Boolean) logic Equivalence, validity,

More information