Docsity

Syntax of Predicate Logic: Understanding Terms, Formulas, and Substitution, Summaries of Logic

Partial preview of the text

Download Syntax of Predicate Logic: Understanding Terms, Formulas, and Substitution and more Summaries Logic in PDF only on Docsity!

Syntax of Predicate Logic

Syntax of Predicate Logic 1/

The Language of Predicate Logic

  • Domain: a non-empty set of objects
  • (^) Constants: concrete objects in the domain
  • Variables: placeholders for concrete objects in the domain
  • (^) Functions: takes objects in the domain as arguments and returns an object of the domain.
  • Predicates: takes objects in the domain as arguments and returns true or false. They describe properties of objects or relationships between objects.
  • (^) Quantifiers: for how many objects in the domain is the statement true?

Syntax of Predicate Logic 2/

Functions

Using functions allows us to avoid ugly/inelegant predicate logic formulas.

Try translating the following sentence with and without functions.

“Andy and Paul have the same maternal grandmother.”

Syntax of Predicate Logic 4/

The Language of Predicate Logic

The seven kinds of symbols:

  1. Constant symbols. Usually 𝑐, 𝑑, 𝑐 1 , 𝑐 2 , … , 𝑑 1 , 𝑑 2 …
  2. Variables. Usually 𝑥, 𝑦, 𝑧, … 𝑥 1 , 𝑥 2 , … , 𝑦 1 , 𝑦 2 …
  3. Function symbols. Usually 𝑓, 𝑔, ℎ, … 𝑓 1 , 𝑓 2 , … , 𝑔 1 , 𝑔 2 , …
  4. Predicate symbols. 𝑃 , 𝑄, …𝑃 1 , 𝑃 2 , …, 𝑄 1 , 𝑄 2 , …
  5. Connectives: ¬, ∧, ∨, →, and ↔
  6. Quantifiers: ∀ and ∃
  7. Punctuation: ‘(’, ‘)’, and ‘,’

Function symbols and predicate symbols have an assigned arity —the number of arguments required. For example,

  • (^) 𝑓(1): 𝑓 is a unary function.
  • 𝑃 (2): 𝑃 is a binary predicate.

Syntax of Predicate Logic Symbols 5/

Terms

Each term refers to an object of the domain.

We define the set of terms inductively as follows.

  1. Each constant symbol is an atomic term.
  2. Each variable is an atomic term.
  3. 𝑓(𝑡 1 , … , 𝑡𝑛) is a term if 𝑡 1 , … , 𝑡𝑛 are terms and 𝑓 is an 𝑛-ary function symbol. (If 𝑓 is a binary function symbol, then we may write (𝑡 1 𝑓 𝑡 2 ) instead of 𝑓(𝑡 1 , 𝑡 2 ).)
  4. Nothing else is a term.

Syntax of Predicate Logic Terms and Formulas 7/

Which expressions are terms?

A term refers to an object of the domain.

Which of the following expressions is a term?

a. 𝑔(𝑑, 𝑑)

b. 𝑃 (𝑓(𝑥, 𝑦), 𝑑)

c. 𝑓(𝑥, 𝑔(𝑦, 𝑧), 𝑑)

d. 𝑔(𝑥, 𝑓(𝑦, 𝑧), 𝑑)

Let 𝑑 be a constant symbol. Let 𝑃 be a predicate symbol with 2 arguments. Let 𝑓 be a function symbol with 2 arguments and 𝑔 be a function symbol with 3 arguments. Let 𝑥, 𝑦, and 𝑧 be variable symbols.

Syntax of Predicate Logic Terms and Formulas 8/

Well-Formed Predicate Logic Formulas

We define the set of well-formed formulas of predicate logic inductively as follows.

  1. 𝑃 (𝑡 1 , … , 𝑡𝑛) is an atomic formula if 𝑃 is an 𝑛-ary predicate symbol and each 𝑡𝑖 is a term (1 ≤ 𝑖 ≤ 𝑛).
  2. (¬𝛼) is a formula if 𝛼 is a formula.
  3. (𝛼 ⋆ 𝛽) is a formula if 𝛼 and 𝛽 are formulas and ⋆ is a binary connective symbol.
  4. Each of (∀𝑥 𝛼) and (∃𝑥 𝛼) is a formula if 𝛼 is a formula and 𝑥 is a variable.
  5. Nothing else is a formula.

Syntax of Predicate Logic Terms and Formulas 10/

Determine whether a formula is well-formed

𝑚 is a constant and 𝑥 and 𝑦 are variables. 𝑃 (2)^ and 𝑄(2)^ are binary predicates. 𝑓(1)^ is a unary function.

Which of the following is a well-formed predicate logic formula?

a. (𝑓(𝑥) → 𝑃 (𝑥, 𝑦))

b. ∀𝑦 𝑃 (𝑚, 𝑓(𝑦))

c. 𝑃 (𝑥, 𝑦) → 𝑄(𝑄(𝑥))

d. 𝑄(𝑚, 𝑓(𝑚))

e. 𝑃 (𝑚, 𝑓(𝑄(𝑥, 𝑦)))

Syntax of Predicate Logic Terms and Formulas 11/

Comparing the Definitions of WFFs

Let’s compare and contrast the definitions of WFFs for propositional and predicate logic.

  • Which parts of the two definitions are the same?
  • (^) The definition of WFF for propositional logic says that a propositional variable is an atomic WFF. Is this still the case for predicate logic?
  • (^) What is new in the definition of WFF for predicate logic compared to the definition of WFF for propositional logic?
  • (^) If we were to prove that every WFF for predicate logic has a property P by structural induction , what does the proof look like? What are the base case(s) and what are the cases in the induction step?

Syntax of Predicate Logic Terms and Formulas 13/

Parse Trees of Predicate Logic Formulas

New elements in the parse tree:

  • Quantifiers ∀𝑥 and ∃𝑦 has one subtree, similar to the unary connective negation.
  • A predicate 𝑃 (𝑡 1 , 𝑡 2 , … , 𝑡𝑛) has a node labelled 𝑃 with a sub-tree for each of the terms 𝑡 1 , 𝑡 2 , … , 𝑡𝑛.
  • A function 𝑓(𝑡 1 , 𝑡 2 , … , 𝑡𝑛) has a node labelled 𝑓 with a sub-tree for each of the terms 𝑡 1 , 𝑡 2 , … , 𝑡𝑛.

Example 1: (∀𝑥 (𝑃 (𝑥) ∧ 𝑄(𝑥))) → (¬(𝑃 (𝑓(𝑥, 𝑦)) ∨ 𝑄(𝑦)))

Example 2: (∀𝑥 ((𝑃 (𝑥) ∧ 𝑄(𝑥)) → (¬(𝑃 (𝑓(𝑥, 𝑦)) ∨ 𝑄(𝑦)))))

Syntax of Predicate Logic Terms and Formulas 14/

Free and Bound Variables

In a formula (∀𝑥 𝛼) or (∃𝑥 𝛼), the scope of a quantifier is the formula 𝛼. A quantifier binds its variable within its scope.

An occurrence of a variable in a formula is bound if it lies in the scope of some quantifier of the same variable. Otherwise the occurrence of this variable is free.

  • If a variable occurs multiple times, we need to consider each occurrence of the variable separately.
  • (^) The variable symbol immediately after ∃ or ∀ is neither free nor bound.

A formula with no free variables is called a closed formula or sentence.

Syntax of Predicate Logic Free and Bound Variables 16/

Determine whether a variable is free or bound

Determine whether a variable is free or bound using a parse tree.

  1. Draw the parse tree for the formula.
  2. Choose the leaf node for an occurrence of a variable.
  3. Walk up the tree. Stop as soon as we encounter a quantifier for this variable or we reach the root of the tree.
  4. If we encountered a quantifier for the variable , this occurrence of the variable is bound.
  5. If we reached the root of the tree which is not a quantifier for the variable , this occurrence of the variable is free.

Example 1: (∀𝑥 (𝑃 (𝑥) ∧ 𝑄(𝑥))) → (¬(𝑃 (𝑓(𝑥, 𝑦)) ∨ 𝑄(𝑦)))

Example 2: (∀𝑥 ((𝑃 (𝑥) ∧ 𝑄(𝑥)) → (¬(𝑃 (𝑓(𝑥, 𝑦)) ∨ 𝑄(𝑦)))))

Syntax of Predicate Logic Free and Bound Variables 17/

Substitution

Intuitively, 𝛼[𝑡/𝑥] answers the question,

“What happens to 𝛼 if 𝑥 has the value specified by term 𝑡?”

For a variable 𝑥, a term 𝑡, and a formula 𝛼, 𝛼[𝑡/𝑥] denotes the resulting formula by replacing each free occurrence of 𝑥 in 𝛼 with 𝑡. In other words, substitution does NOT affect bound occurrences of the variable.

Syntax of Predicate Logic Substitution 19/

Examles of Substitution

Examples.

  • If 𝛼 is the formula 𝐸(𝑓(𝑥)), then 𝛼[(𝑦 + 𝑦)/𝑥] is 𝐸(𝑓(𝑦 + 𝑦)).
  • (^) 𝛼[𝑓(𝑥)/𝑥] is 𝐸(𝑓(𝑓(𝑥))).
  • 𝐸(𝑓(𝑥 + 𝑦))[𝑦/𝑥] is 𝐸(𝑓(𝑦 + 𝑦)).
  • If 𝛽 is (∀𝑥 (𝐸(𝑓(𝑥)) ∧ 𝑆(𝑥, 𝑦))), then 𝛽[𝑔(𝑥, 𝑦)/𝑥] is 𝛽, because 𝛽 has no free occurrence of 𝑥.

Syntax of Predicate Logic Substitution 20/