Predicate Logic: Syntax Alice Gao Lecture 12 CS 245 Logic and Computation Fall 2019 1 / 28
Outline Learning goals Symbols Terms Formulas Parse Trees Revisiting the learning goals CS 245 Logic and Computation Fall 2019 2 / 28
Learning goals By the end of this lecture, you should be able to induction. CS 245 Logic and Computation Fall 2019 3 / 28 ▶ Defjne the set of terms inductively. ▶ Defjne the set of formulas inductively. ▶ Determine whether a variable in a formula is free or bound. ▶ Prove properties of terms and formulas by structural ▶ Draw the parse tree of a formula.
The Language of Predicate Logic returns an object of the domain. returns true or false. They describe properties of objects or relationships between objects. statement true? CS 245 Logic and Computation Fall 2019 4 / 28 ▶ Domain: a non-empty set of objects. ▶ Individuals: concrete objects in the domain. ▶ Variables: placeholders for concrete objects in the domain. ▶ Functions: takes objects in the domain as arguments and ▶ Relations: takes objects in the domain as arguments and ▶ Quantifjers: for how many objects in the domain is the
Outline Learning goals Symbols Terms Formulas Parse Trees Revisiting the learning goals CS 245 Logic and Computation Fall 2019 5 / 28
Predicate Language 𝑀 Eight classes of symbols: A special equality symbol ≈ CS 245 Logic and Computation Fall 2019 6 / 28 ▶ Individual symbols: 𝑏, 𝑐, 𝑑 . ▶ Relation symbols: 𝐺, 𝐻, 𝐼 . ▶ Function symbols: 𝑔, , ℎ . ▶ Free variable symbols: 𝑣, 𝑤, 𝑥 . ▶ Bound variable symbols: 𝑦, 𝑧, 𝑨 . ▶ Connective symbols: ¬ , ∧ , ∨ , → , ↔ . ▶ Quantifjer symbol: ∀ , ∃ . ▶ Punctuation symbols: ‘(’, ‘)’, and ‘,’
Free and Bound Variables In a formula ∀𝑦 𝐵(𝑦) or ∃𝑦 𝐵(𝑦) , the scope of a quantifjer is the formula 𝐵(𝑦) . A quantifjer binds its variable within its scope. An occurrence of a variable in a formula variable. CS 245 Logic and Computation Fall 2019 7 / 28 ▶ is bound if it lies in the scope of some quantifjer of the same ▶ is free, otherwise.
Outline Learning goals Symbols Terms Formulas Parse Trees Revisiting the learning goals CS 245 Logic and Computation Fall 2019 8 / 28
Two Kinds of Expressions Two kinds of expressions: CS 245 Logic and Computation Fall 2019 9 / 28 ▶ A term refers to an object in the domain. ▶ A formula evaluates to 1 or 0 .
Terms The set of terms Term (𝑀) is defjned below: 1. An individual symbol 𝑏 standing alone is a term. 2. A free variable symbol 𝑣 standing alone is a term. then 𝑔(𝑢 1 , … , 𝑢 𝑜 ) is a term. 4. Nothing else is a term. CS 245 Logic and Computation Fall 2019 10 / 28 3. If 𝑢 1 , … , 𝑢 𝑜 are terms and 𝑔 is an 𝑜 -ary function symbol,
Examples of Terms Terms: A term with no free variable symbols is called a closed term. Which one(s) of the above are closed terms? CS 245 Logic and Computation Fall 2019 11 / 28 ▶ 𝑏, 𝑐, 𝑑 , 𝑣, 𝑤, 𝑥 ▶ 𝑔(𝑐) , (𝑏, 𝑔(𝑐)) , (𝑣, 𝑐) , 𝑔((𝑔(𝑣), 𝑐))
CQ: Which expressions are terms? Which of the following expressions is a term? If there are multiple correct answers, choose your favourite one. (A) 𝑥 (B) (𝑏, 𝑣) (C) 𝐺(𝑔(𝑣, 𝑤), 𝑏) (D) 𝑔(𝑣, (𝑤, 𝑥), 𝑏) (E) (𝑣, 𝑔(𝑤, 𝑥), 𝑏) Individual symbols: 𝑏 Relation symbols: 𝐺 is a binary relation symbol. Function symbols: 𝑔 is a binary function symbol and is a 3-ary function symbol. Free variable symbols: 𝑣, 𝑤, 𝑥 . CS 245 Logic and Computation Fall 2019 12 / 28
Defjning the set of terms inductively The set of terms can be inductively defjned as follows: CS 245 Logic and Computation Fall 2019 13 / 28 ▶ The domain set 𝑌 : ▶ The core set 𝐷 : ▶ The set of operations 𝑄 :
Structural induction on terms Theorem: Every term has a property 𝑄 . Proof by structural induction: CS 245 Logic and Computation Fall 2019 14 / 28 ▶ Base cases: ▶ Inductive cases:
Outline Learning goals Symbols Terms Formulas Parse Trees Revisiting the learning goals CS 245 Logic and Computation Fall 2019 15 / 28
Atomic Formulas The set of atomic formulas Atom (𝑀) is defjned below: terms, then 𝐺(𝑢 1 , … , 𝑢 𝑜 ) is an atomic formula. CS 245 Logic and Computation Fall 2019 16 / 28 ▶ If 𝐺 is an n-ary relation symbol and 𝑢 1 , … , 𝑢 𝑜 ( 𝑜 ≥ 1 ) are ▶ If 𝑢 1 , 𝑢 2 are terms, then ≈ (𝑢 1 , 𝑢 2 ) is an atomic formula. ▶ Nothing else is an atomic formula.
Examples of Atomic Formulas Terms: Atomic formulas: CS 245 Logic and Computation Fall 2019 17 / 28 ▶ 𝑏, 𝑐, 𝑑 , 𝑣, 𝑤, 𝑥 ▶ 𝑔(𝑐) , (𝑏, 𝑔(𝑐)) , (𝑣, 𝑐) , 𝑔((𝑔(𝑣), 𝑐)) ▶ 𝐺(𝑏, 𝑣, 𝑔(𝑐), 𝑔(𝑥), (𝑤, 𝑔(𝑏))) ▶ ≈ (𝑐, 𝑥)
Well-Formed Formulas The set of well-formed formulas Form (𝑀) is defjned below: 1. An atomic formula is a well-formed formula. 2. If 𝐵 is a well-formed formula, then (¬𝐵) is a well-formed formula. 3. If 𝐵 and 𝐶 are well-formed formulas and ⋆ is one of ∧ , ∨ , → , and ↔ , then (𝐵 ⋆ 𝐶) is a well-formed formula. 4. If 𝐵(𝑣) is a well-formed formula and 𝑦 does not occur in 𝐵(𝑣) , then ∀𝑦 𝐵(𝑦) and ∃𝑦 𝐵(𝑦) are well-formed formulas. 5. Nothing else is a well-formed formula. CS 245 Logic and Computation Fall 2019 18 / 28
Explaining Case 4 of Formulas If 𝐵(𝑣) is a well-formed formula and 𝑦 does not occur in 𝐵(𝑣) , formula. We want to quantify 𝑣 . variable, e.g. 𝑦 . We need to make sure that our choice of the bound variable symbol does not already occur in 𝐵(𝑣) . CS 245 Logic and Computation Fall 2019 19 / 28 then ∀𝑦 𝐵(𝑦) and ∃𝑦 𝐵(𝑦) are well-formed formulas. ▶ 𝐵(𝑣) is a well-formed formula where 𝑣 is a free variable in the ▶ In order to do so, we need to choose a symbol for a bound
Examples for Case 4 Start with 𝐻(𝑣) and 𝐼(𝑤) separately. We can quantify 𝑣 by Fall 2019 CS 245 Logic and Computation two formulas using ∨ , we get ∃𝑦𝐻(𝑦) ∨ ∀𝑦𝐼(𝑦) . does not appear in 𝐼(𝑤) . We get ∀𝑦𝐼(𝑦) . Connecting the ∃𝑦𝐻(𝑦) . We can quantify 𝑤 by replacing it with 𝑦 since 𝑦 replacing it with 𝑦 since 𝑦 does not appear in 𝐻(𝑣) ). We get 20 / 28 for us to generate ∃𝑧∀𝑧𝐺(𝑧, 𝑧) . will need to choose a bound variable symbol that is not 𝑧 Start with ∀𝑧𝐺(𝑧, 𝑧) . If we want to add the ∃ quantifjer, we get ∀𝑧𝐺(𝑧, 𝑧) . Start with 𝐺(𝑣, 𝑣) . If we quantify 𝑣 by replacing it with 𝑧 , we ▶ We are allowed to generate the formula ∀𝑧𝐺(𝑧, 𝑧) . ▶ We are not allowed to generate the formula ∃𝑧∀𝑧𝐺(𝑧, 𝑧) . because 𝑧 already appears in ∀𝑧 𝐺(𝑧, 𝑧) . So, there is no way ▶ We are allowed to generate the formula ∃𝑦𝐻(𝑦) ∨ ∀𝑦𝐼(𝑦) .
Examples of Formulas Well-Formed Formulas: A formula with no free variable symbols is called a closed formula or a sentence. Which formulas above are closed formulas? CS 245 Logic and Computation Fall 2019 21 / 28 ▶ 𝐺(𝑏, 𝑐) , ∀𝑧 𝐺(𝑏, 𝑧) , ∃𝑦∀𝑧 𝐺(𝑦, 𝑧) ▶ 𝐺(𝑣, 𝑤) , ∃𝑧 𝐺(𝑣, 𝑧)
Determine whether a formula is well-formed Which of the following is a well-formed formula? (A) 𝑔(𝑣) → 𝐺(𝑣, 𝑤) (B) ∀𝑦 𝐺(𝑛, 𝑔(𝑦)) (C) 𝐺(𝑣, 𝑤) → 𝐻(𝐻(𝑣)) (D) 𝐻(𝑛, 𝑔(𝑛)) (E) 𝐺(𝑛, 𝑔(𝐻(𝑣, 𝑤))) Individual symbols: 𝑛 . Free Variable Symbols: 𝑣, 𝑤 . Bound Variable symbols: 𝑦 . Relation symbols: 𝐺 and 𝐻 are binary relation symbols. Function symbols: 𝑔 is a unary function. CS 245 Logic and Computation Fall 2019 22 / 28
Defjning the set of formulas inductively The set of formulas can be inductively defjned as follows: CS 245 Logic and Computation Fall 2019 23 / 28 ▶ The domain set 𝑌 : ▶ The core set 𝐷 : ▶ The set of operations 𝑄 :
Structural induction on formulas Theorem: Every formula has a property 𝑄 . Proof by structural induction: CS 245 Logic and Computation Fall 2019 24 / 28 ▶ Base cases: ▶ Inductive cases:
Comparing the Defjnitions of Well-Formed Formulas Let’s compare the set of predicate formulas to the set of propositional formulas. Questions to think about: CS 245 Logic and Computation Fall 2019 25 / 28 ▶ Which parts of the two defjnitions are the same? ▶ Which parts of the two defjnitions are difgerent?
Outline Learning goals Symbols Terms Formulas Parse Trees Revisiting the learning goals CS 245 Logic and Computation Fall 2019 26 / 28
Parse Trees of Predicate Formulas (namely the formula which is its scope). Example: ∀𝑦(𝐺(𝑐) → ∃𝑧(∀𝑨 𝐻(𝑧, 𝑨) ∨ 𝐼(𝑔(𝑣), 𝑦, 𝑧))) CS 245 Logic and Computation Fall 2019 27 / 28 ▶ The leaves are atomic formulas. ▶ Every quantifjer has exactly one child
Recommend
More recommend