Semantics of Predicate Calculus For the propositional calculus

  • Slides: 23
Download presentation
Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment

Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of a formula. We could then evaluate whether or not the entire formula was true or false. In predicate calculus, we must consider the domain that is under discussion and this makes life more difficult.

Example of Domain For example, consider the formula: ∃ x ∀ y less. Than.

Example of Domain For example, consider the formula: ∃ x ∀ y less. Than. Or. Equal(x, y) (there is an element less than or equal to all others) If the domain is the natural numbers, the formula is true (take x to be 0). If the domain is the reals, the formulas is false – there is no minimal element.

Interpretations Any interpretation for predicate calculus must include the domain of discourse, or universe,

Interpretations Any interpretation for predicate calculus must include the domain of discourse, or universe, D. That is, a non-empty set which contains the elements that the formulas will speak about. In propositional calculus we had to map each proposition symbol to a value, true or false. Since predicate symbols have arguments, we must map each to a Boolean function of the same number of arguments.

Mapping Predicates A predicate symbol applied to terms, maps those terms into the values

Mapping Predicates A predicate symbol applied to terms, maps those terms into the values true or false. The interpretation for a predicate symbol must be a Boolean function that maps the same number of elements of D to true or false, i. e. , a function from Dn to {true, false}.

Example For example, if D is ℜ (the reals), the predicate symbol less. Than

Example For example, if D is ℜ (the reals), the predicate symbol less. Than could be mapped into the Boolean function ≤ which maps two reals to true of false. If D is “the set of people in the world” then the predicate symbol loves could be mapped into the Boolean function loves(x, y) which is true when person x loves person y.

Constants and Function symbols Similarly, function symbols must be interpreted. A function symbol maps

Constants and Function symbols Similarly, function symbols must be interpreted. A function symbol maps a list of terms into another term. Since terms stand for objects in the domain of discourse, each function symbol must be mapped to a real-life function that maps a list of n elements of D into an element of D, that is, a function from Dn to D. A constant is just an 0 -ary function, so each constant must be mapped to an element of D.

Interpretations In summary, an interpretation has three parts: A domain of discourse, D, which

Interpretations In summary, an interpretation has three parts: A domain of discourse, D, which is a non-empty set Each n-ary function symbol must be mapped to a real-life function from Dn to D. Constants are mapped to elements of D Each n-ary predicate symbol is mapped to a Boolean function from Dn to {true, false}. The constants T and F are mapped to true and false, respectively.

Example ∃ x ∀ y less. Than. Or. Equal(x, y) could have the following

Example ∃ x ∀ y less. Than. Or. Equal(x, y) could have the following interpretation: D is the set of natural numbers less. Than. Or. Equals is the Boolean function ≤ There are no function symbols or constants to interpret. Given this interpretation, the formula is true.

Important Note Function and predicate symbols are just that – symbols. Despite mnemonic names,

Important Note Function and predicate symbols are just that – symbols. Despite mnemonic names, they have no inherent meaning. We could just have well given an interpretation where less. Than. Or. Equals was interpreted as ≥, or as the first argument divided by the second has no remainder. All are possible interpretations. The truth value of the formula depends on the interpretation given.

Another Example Consider the formula: ∀ x P(x) ^ E(x) -> x = 2.

Another Example Consider the formula: ∀ x P(x) ^ E(x) -> x = 2. The truth value of this formula depends on the interpretation. If the interpretation is that the domain is the integers, P(x) means that x is prime, E(x) means that x is even, and = is equality, the formula is true. But if the interpretation is the same, but E(x) means that x > 0, the formula is false.

Evaluating Formulas It's straightforward to evaluate a formula in predicate calculus if not for

Evaluating Formulas It's straightforward to evaluate a formula in predicate calculus if not for those pesky quantifiers: Replace constants by the corresponding elements in D (given the interpretation) Replace function symbols by their corresponding functions Replace predicate symbols by their corresponding Boolean functions Then recursively evaluate the result.

Example Consider the formula: P(a) ^ E(a) -> x = 2, where the domain

Example Consider the formula: P(a) ^ E(a) -> x = 2, where the domain is the integers, a is 3, P means prime, E means even, and = is equality. Then the formula is transformed to prime(3) ^ even(3) -> 3 = 2, which evaluates to true. If a was 2, the formula still evaluates to true.

Evaluation with Variables are meant to stand for a range of values. To evaluate

Evaluation with Variables are meant to stand for a range of values. To evaluate an expression (either a formula or term) which contains variables, we must know the element the variable represents at the moment. For this reason, we need to keep track of the current value of each variable used by what is called a binding list, symbol table, or variable assignment. Think of a symbol table in a program being executed and you won't go wrong.

Evaluation with a Binding List To evaluate an expression with quantified variables, we assume

Evaluation with a Binding List To evaluate an expression with quantified variables, we assume that we have an interpretation and a binding list (initially empty). The binding list records the current value of each variable, i. e. , which element of the domain the variable maps to. We can now evaluate each expression recursively.

Evaluation with a Binding List Constant: Get its value from the interpretation. Variable: Look

Evaluation with a Binding List Constant: Get its value from the interpretation. Variable: Look up its current value in the binding list. Function term: Recursively evaluate the arguments, replace the function symbol by the corresponding function from the interpretation, and apply to args. Predicate term: Recursively evaluate the arguments, replace the predicate symbol by the corresponding function from the interpretation and apply to args.

Evaluation (cont'd) Complex predicate: Recursively evaluate the arguments and use the truth table for

Evaluation (cont'd) Complex predicate: Recursively evaluate the arguments and use the truth table for the operator. Quantified expression: To evaluate ∀ x P(x), for each element d in the domain D, add x -> d to the binding list and recursively evaluate P(x). If binding x to every element yields true, the formula is true. If not, the formula is false. For ∃ x P(x), add x -> d to the binding list for each d. If any of those assignments yields false, the formula is false.

Example ∃ x ∀ y less. Than. Or. Equal(x, y) where D is the

Example ∃ x ∀ y less. Than. Or. Equal(x, y) where D is the natural numbers, less. Than. Or. Equal is the Boolean function ≤. The main operation is the quantifier ∃ so we bind x to 0 and recursively evaluate the expression ∀ y less. Than. Or. Equal(x, y), then bind x to 1 and evaluate the expression, then bind x to 2, and evaluate the expression. If any binding yields true, the formula is true, else the formula is false.

Example (cont'd) Binding list: (x -> 0). Evaluate ∀ y less. Than. Or. Equal(x,

Example (cont'd) Binding list: (x -> 0). Evaluate ∀ y less. Than. Or. Equal(x, y). Since the main operation is ∀, we bind y to 0, and evaluate less. Than. Or. Equal(x, y), and then bind y to 1 and evaluate the formula, then y to 2, and evaluate, and so on. If all bindings yield true, the formula is true. If any yield false, the formula is false.

Example (cont'd) Binding list: (x -> 0, y ->0) Evaluate less. Than. Or. Equal(x,

Example (cont'd) Binding list: (x -> 0, y ->0) Evaluate less. Than. Or. Equal(x, y). Recursively evaluate the arguments: x and y are variables, so we look them up in the binding list. x becomes 0 as does y. The meaning of less. Than. Or. Equal is given by the interpretation. It is the Boolean function ≤. Thus we apply ≤ to (0, 0), that is, ask is 0 ≤ 0? It is, so the formula is true.

Example (cont'd) Binding list: (x -> 0, y -> 1) Evaluate: less. Than. Or.

Example (cont'd) Binding list: (x -> 0, y -> 1) Evaluate: less. Than. Or. Equal(x, y). Using the binding list to give the values of x and y, and the interpretation to get the meaning of less. Than. Or. Equals, this is 0 ≤ 1, which is true. Binding list: (x -> 0, y -> 2) Evaluate: less. Than. Or. Equal(x, y) This is also true, as is the result of binding y to any d.

Example (cont'd) So, the result of evaluating the expression ∀ y less. Than. Or.

Example (cont'd) So, the result of evaluating the expression ∀ y less. Than. Or. Equal(x, y) with the binding list (x -> 0) is true, since binding y to any value d of D yields true. Since the main operator was ∃ x, that's all we need. Binding x to one value of d (0), yields a true formula, so the whole expression is true. Note that binding x to 1, yields false (since ~ (1 ≤ 0), but that doesn't matter. As long as binding x to one d makes the formula true, the whole expression is true.

Another Example Consider the formula: ∀ x ∀ y ∃ z (less. Than(x, y)

Another Example Consider the formula: ∀ x ∀ y ∃ z (less. Than(x, y) -> less. Than(x, z) ^ less. Than(z, y)). Give one interpretation that makes this formula true and one that makes it false. Evaluate the formula given one of those interpretations.

Satisfiability and Validity If a formula has no free variables, than an interpretation (or

Satisfiability and Validity If a formula has no free variables, than an interpretation (or model) satisfies the formula if the formula evaluates to true given the interpretation and the (initially) empty binding list. A formula is satisfiable if there is at least one interpretation that satisfies it. A formula is valid if all interpretations satisfy it. A formula is unsatisfiable if no interpretations satisfy it.