semantics of predicate calculus for the propositional calculus, an interpretation was simply an...

23
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.

Upload: ethelbert-dixon

Post on 08-Jan-2018

232 views

Category:

Documents


1 download

DESCRIPTION

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.

TRANSCRIPT

Page 1: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

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.

Page 2: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

Example of Domain

For example, consider the formula:

∃ x ∀ y lessThanOrEqual(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.

Page 3: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

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.

Page 4: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

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}.

Page 5: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

Example

For example, if D is ℜ (the reals), the predicate symbol lessThan 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.

Page 6: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

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.

Page 7: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

Interpretations

In summary, an interpretation has three parts:A domain of discourse, D, which is a non-empty setEach 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.

Page 8: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

Example

∃ x ∀ y lessThanOrEqual(x,y) could have the following interpretation:

D is the set of natural numberslessThanOrEquals is the Boolean function ≤There are no function symbols or constants to

interpret.Given this interpretation, the formula is true.

Page 9: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

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 lessThanOrEquals 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.

Page 10: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

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.

Page 11: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

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.

Page 12: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

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.

Page 13: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

Evaluation with Variables

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.

Page 14: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

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.

Page 15: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

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.

Page 16: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

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.

Page 17: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

Example

∃ x ∀ y lessThanOrEqual(x,y) where D is the natural numbers, lessThanOrEqual is the Boolean function ≤. The main operation is the quantifier ∃ so we bind x to 0 and recursively evaluate the expression ∀ y lessThanOrEqual(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.

Page 18: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

Example (cont'd)

Binding list: (x -> 0). Evaluate ∀ y lessThanOrEqual(x,y).Since the main operation is ∀,we bind y to 0, and

evaluate lessThanOrEqual(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.

Page 19: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

Example (cont'd)

Binding list: (x -> 0, y ->0)Evaluate lessThanOrEqual(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 lessThanOrEqual 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.

Page 20: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

Example (cont'd)

Binding list: (x -> 0, y -> 1)Evaluate: lessThanOrEqual(x,y).Using the binding list to give the values of x and y,

and the interpretation to get the meaning of lessThanOrEquals, this is 0 ≤ 1, which is true.

Binding list: (x -> 0, y -> 2)Evaluate: lessThanOrEqual(x,y)This is also true, as is the result of binding y to any d.

Page 21: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

Example (cont'd)

So, the result of evaluating the expression ∀ y lessThanOrEqual(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.

Page 22: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

Another Example

Consider the formula:

∀ x ∀ y ∃ z (lessThan(x,y) -> lessThan(x,z) ^ lessThan(z,y)).Give one interpretation that makes this formula true

and one that makes it false. Evaluate the formula given one of those interpretations.

Page 23: Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of

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.