Propositional Logic Introduction and Syntax Alice Gao Lecture 2 CS 245 Logic and Computation Fall 2019 Alice Gao 1 / 30
Outline Learning goals Propositions and Connectives Propositional Language Revisiting the learning goals CS 245 Logic and Computation Fall 2019 Alice Gao 2 / 30
Learning goals By the end of the lecture, you should be able to compound proposition. well-formed. well-formed formula by adding parentheses according to the precedence rules. CS 245 Logic and Computation Fall 2019 Alice Gao 3 / 30 ▶ Determine whether an English sentence is a proposition. ▶ Determine whether an English sentence is a simple or ▶ Determine whether a propositional formula is atomic and/or ▶ Draw the parse tree of a well-formed propositional formula. ▶ Given a propositional formula with no parentheses, make it a
Outline Learning goals Propositions and Connectives Propositional Language Revisiting the learning goals CS 245 Logic and Computation Fall 2019 Alice Gao 4 / 30
Propositions A proposition is a statement that is either true or false. Meaningless statements, commands, and questions are not propositions. CS 245 Logic and Computation Fall 2019 Alice Gao 5 / 30
CQ on proposition CS 245 Logic and Computation Fall 2019 Alice Gao 6 / 30
Examples of propositions the sum of two prime numbers. CS 245 Logic and Computation Fall 2019 Alice Gao 7 / 30 ▶ The sum of 3 and 5 is 8. ▶ The sum of 3 and 5 is 35. ▶ Goldbach’s conjecture: Every even number greater than 2 is
CS 245 Logic and Computation Examples of non-propositions Fall 2019 Alice Gao 8 / 30 ▶ Question: Where shall we go to eat? ▶ Command: Please pass the salt. ▶ Sentence fragment: The dogs in the park ▶ Non-sensical: Green ideas sleep furiously. ▶ Paradox: This sentence is false.
Compound and simple propositions connectives. The commonly used logical connectives are “not”, “and”, “or”, “if, then”, and “ifg”. divided. CS 245 Logic and Computation Fall 2019 Alice Gao 9 / 30 ▶ A compound proposition is formed by means of logical ▶ A simple proposition is not compound and cannot be further
Interpreting a compound proposition To interpret a compound proposition, we need to understand the meanings of the connectives. Let 𝐵 and 𝐶 be arbitrary propositions. CS 245 Logic and Computation Fall 2019 Alice Gao 10 / 30 We will use 1 and 0 to denote true and false respectively.
Negation “Not A” is true if and only if A is false. 𝐵 not 𝐵 1 0 0 1 CS 245 Logic and Computation Fall 2019 Alice Gao 11 / 30
Conjunction 0 Alice Gao Fall 2019 CS 245 Logic and Computation 0 0 0 0 1 0 “A and B” is true if and only if both A and B are true. 0 1 1 1 1 𝐵 and 𝐶 𝐶 𝐵 12 / 30
Disjunction 𝐵 Alice Gao Fall 2019 CS 245 Logic and Computation In mathematics, the inclusive sense of “or” is commonly used. “Or” may be interpreted in two ways 0 0 0 1 1 0 1 0 1 1 1 1 𝐵 or 𝐶 𝐶 13 / 30 ▶ The inclusive sense of “A or B or both” ▶ The exclusive sense of “A or B but not both”
Implication 1 Alice Gao Fall 2019 CS 245 Logic and Computation Whenever A is false, “if A then B” is vacuously true. true and B is false. The only circumstance in which “if A then B” is false is when A is 1 0 0 1 𝐵 0 0 0 1 1 1 1 if 𝐵 then 𝐶 𝐶 14 / 30
Equivalence 0 Alice Gao Fall 2019 CS 245 Logic and Computation 1 0 0 0 1 0 ”A ifg B” is the same as ”if A then B, and if B then A”. 0 1 1 1 1 𝐵 ifg 𝐶 𝐶 𝐵 ifg is pronounced as if and only if. 15 / 30
CQ on compound or simple propositions CS 245 Logic and Computation Fall 2019 Alice Gao 16 / 30
Remarks on connectives The arity of a connective: proposition. two propositions. Is a connective symmetric? two propositions does not afgect the truth value of the compound proposition. have difgerent truth values. CS 245 Logic and Computation Fall 2019 Alice Gao 17 / 30 ▶ The negation is a unary connective. It only applies to one ▶ All other connectives are binary connectives. They apply to ▶ And, Or, and Equivalence are symmetric. The order of the ▶ Implication is not symmetric. If A then B, and if B then A
Outline Learning goals Propositions and Connectives Propositional Language Revisiting the learning goals CS 245 Logic and Computation Fall 2019 Alice Gao 18 / 30
Propositional language 𝑀 𝑞 (inclusive) disjunction Alice Gao Fall 2019 CS 245 Logic and Computation equivalence ifg (equivalent to) ↔ implication if, then (imply) → or ∨ conjunction and ∧ negation not ¬ Oral reading of logical connectives 19 / 30 The propositional language 𝑀 𝑞 consists of three classes of symbols: ▶ Proposition symbols: 𝑞 , 𝑟 , 𝑠 , … . ▶ Connective symbols: ¬ , ∧ , ∨ , → , ↔ . ▶ Punctuation symbols: ( and ) .
Expressions of 𝑀 𝑞 𝑞∧ → 𝑟 and ¬(𝑞 ∧ 𝑟) . symbols in it. length and have the same symbols in the same order. CS 245 Logic and Computation Fall 2019 Alice Gao 20 / 30 ▶ expressions are fjnite strings of symbols. Examples: 𝑞 , 𝑞𝑟 , (𝑠) , ▶ The length of an expression is the number of occurrences of ▶ empty expression: an expression of length 0 , denoted by 𝜇 . ▶ two expressions 𝑣 and 𝑤 are equal if they are of the same ▶ an expression is read from left to right.
Expression terminologies this order. Note that 𝜇𝑣 = 𝑣𝜇 = 𝑣 . expressions. segment (prefjx) of 𝑣 . Similarly, 𝑥 is a terminal segment (suffjx) of 𝑣 . CS 245 Logic and Computation Fall 2019 Alice Gao 21 / 30 ▶ 𝑣𝑤 denotes the result of concatenating two expressions 𝑣 , 𝑤 in ▶ 𝑤 is a segment of 𝑣 if 𝑣 = 𝑥 1 𝑤𝑥 2 where 𝑣, 𝑤, 𝑥 1 , 𝑥 2 are 𝑤 is a proper segment of 𝑣 if 𝑤 is non-empty and 𝑤 ≠ 𝑣 . If 𝑣 = 𝑤𝑥 , where 𝑣, 𝑤, 𝑥 are expressions, then 𝑤 is an initial
Atomic formulas Defjnition ( 𝐵𝑢𝑝𝑛(𝑀 𝑞 ) ) proposition symbol only. CS 245 Logic and Computation Fall 2019 Alice Gao 22 / 30 𝐵𝑢𝑝𝑛(𝑀 𝑞 ) is the set of expressions of 𝑀 𝑞 consisting of a
Well-formed propositional formulas Defjnition ( 𝐺𝑝𝑠𝑛(𝑀 𝑞 ) ) being so follows from (1) - (3): 1. 𝐵𝑢𝑝𝑛(𝑀 𝑞 ) ⊆ 𝐺𝑝𝑠𝑛(𝑀 𝑞 ) . 2. If 𝐵 ∈ 𝐺𝑝𝑠𝑛(𝑀 𝑞 ) , then (¬𝐵) ∈ 𝐺𝑝𝑠𝑛(𝑀 𝑞 ) . 3. If 𝐵, 𝐶 ∈ 𝐺𝑝𝑠𝑛(𝑀 𝑞 ) , then (𝐵 ∗ 𝐶) ∈ 𝐺𝑝𝑠𝑛(𝑀 𝑞 ) where ∗ is one of the four binary connectives. Note that 𝐺𝑝𝑠𝑛(𝑀 𝑞 ) is the minimum set that satisfjes the three conditions above. CS 245 Logic and Computation Fall 2019 Alice Gao 23 / 30 An expression of 𝑀 𝑞 is a member of 𝐺𝑝𝑠𝑛(𝑀 𝑞 ) if and only if its
CQ on the fjrst symbol in a well-formed formula CS 245 Logic and Computation Fall 2019 Alice Gao 24 / 30
CQ on well-formed propositional formulas CS 245 Logic and Computation Fall 2019 Alice Gao 25 / 30
Example: Generating Formulas The following expression is a formula. ((𝑞 ∨ 𝑟) → ((¬𝑞) ↔ (𝑟 ∧ 𝑠))) How is it generated using the defjnition of well-formed propositional CS 245 Logic and Computation Fall 2019 Alice Gao 26 / 30 formulas? One can use parse trees to analyze formulas.
Example: Parse Tree (𝑟 ∧ 𝑠) Alice Gao Fall 2019 CS 245 Logic and Computation 𝑞 𝑠 𝑟 (¬𝑞) Draw the parse tree for the following formula. ((¬𝑞) ↔ (𝑟 ∧ 𝑠)) 𝑟 𝑞 (𝑞 ∨ 𝑟) ((𝑞 ∨ 𝑟) → ((¬𝑞) ↔ (𝑟 ∧ 𝑠))) Parse tree: ((𝑞 ∨ 𝑟) → ((¬𝑞) ↔ (𝑟 ∧ 𝑠))) 27 / 30
Exercise: Parse Trees Draw the parse tree for the following formula. (((¬𝑞) ∧ 𝑟) → (𝑞 ∧ (𝑟 ∨ (¬𝑠))) CS 245 Logic and Computation Fall 2019 Alice Gao 28 / 30
Precedence rules: for humans Consider the following sequence of connectives: ¬, ∧, ∨, →, ↔ Each connective on the left has priority over those on the right. Examples: Add back the brackets based on the precedence rules. CS 245 Logic and Computation Fall 2019 Alice Gao 29 / 30 ▶ ¬𝑞 ∨ 𝑟 ▶ 𝑞 ∧ 𝑟 ∨ 𝑠 ▶ 𝑞 → 𝑟 ↔ 𝑞 ▶ ¬𝑞 → 𝑞 ∧ ¬𝑟 ∨ 𝑠 ↔ 𝑟
Revisiting the learning goals By the end of the lecture, you should be able to compound proposition. well-formed. well-formed formula by adding parentheses according to the precedence rules. CS 245 Logic and Computation Fall 2019 Alice Gao 30 / 30 ▶ Determine whether an English sentence is a proposition. ▶ Determine whether an English sentence is a simple or ▶ Determine whether a propositional formula is atomic and/or ▶ Draw the parse tree of a well-formed propositional formula. ▶ Given a propositional formula with no parentheses, make it a
Recommend
More recommend