Logic as a Tool Chapter 3: Understanding First-order Logic 3.4 - - PowerPoint PPT Presentation

logic as a tool chapter 3 understanding first order logic
SMART_READER_LITE
LIVE PREVIEW

Logic as a Tool Chapter 3: Understanding First-order Logic 3.4 - - PowerPoint PPT Presentation

Logic as a Tool Chapter 3: Understanding First-order Logic 3.4 Truth, validity, logical consequence and equivalence in first-order logic Valentin Goranko Stockholm University December 2020 Goranko Truth of sentences in structures Goranko


slide-1
SLIDE 1

Goranko

Logic as a Tool Chapter 3: Understanding First-order Logic 3.4 Truth, validity, logical consequence and equivalence in first-order logic

Valentin Goranko Stockholm University December 2020

slide-2
SLIDE 2

Goranko

Truth of sentences in structures

slide-3
SLIDE 3

Goranko

Truth of sentences in structures. Models and countermodels.

A sentence is a formula with no free variables. Hence, the truth of a sentence in a given structure does not depend on the variable assignment. Therefore, for a structure S and sentence A we can simply write S | = A if S, v | = A for any/every variable assignment v. We then say that S is a model of A and that A is true in S, or that A is satisfied by S. Otherwise we write S | = A and say that S is a counter-model for A.

slide-4
SLIDE 4

Goranko

Truth of first-order sentences: more examples

  • H

?

| = ∀x∀y(C(x, y) ∨ ¬C(y, x)).

  • H

?

| = ∀x∃y(C(x, y) ∨ C(y, x)).

  • H

?

| = ∀x∃y(C(x, y) ∨ C(y, x)).

  • H

?

| = ∃x∀y(C(x, y) → C(y, x)).

  • H

?

| = ∀x∀y∀z(C(x, y) ∧ C(y, x) → C(z, z)).

  • H

?

| = ∃x(Drinks(x) → ∀xDrinks(x)).

  • H |

= ∀x∀y(∃z(x = m(z) ∧ y = m(z)) → x = y). (Is this sentence only true for the standard interpretation of m?)

  • N

?

| = (∀x(∀y(y < x → P(y)) → P(x)) → ∀xP(x)), where P is any (uninterpreted) unary predicate. True or false? What does this sentence say about N? Is it true in Z, too?

slide-5
SLIDE 5

Goranko

Satisfiability, validity, and logical consequence

slide-6
SLIDE 6

Goranko

Satisfiability and validity of sentences

A sentence A is:

  • satisfiable if S |

= A for some structure S;

  • (logically) valid, denoted |

= A, if S | = A for every structure S;

  • falsifiable, if it is not logically valid, i.e. if it has a counter-model.
slide-7
SLIDE 7

Goranko

Satisfiability and validity of any first-order formulae

A first-order formula A is:

  • A is satisfiable if S, v |

= A for some structure S and some variable assignment v in S.

  • (logically) valid, denoted |

= A, if S, v | = A for every structure S and every variable assignment v in S.

  • falsifiable, if it is not logically valid.

Let A = A(x1, . . . , xn) be any first-order formula all free variables in which are amongst x1, . . . , xn. The sentence ∃x1 . . . ∃xnA(x1, . . . , xn) is a existential closure of A; the sentence ∀x1 . . . ∀xnA(x1, . . . , xn) is a universal closure of A. Claim:

  • A(x1, . . . , xn) is satisfiable iff ∃x1 . . . ∃xnA(x1, . . . , xn) is satisfiable.
  • |

= A(x1, . . . , xn) iff | = ∀x1 . . . ∀xnA(x1, . . . , xn).

slide-8
SLIDE 8

Goranko

Satisfiability and validity of formulae: examples

  • The formula P(x) is satisfiable,

because its existential closure ∃xP(x) is satisfiable.

  • However, P(x) is not valid,

because its universal closure ∀xP(x) is not valid.

  • The formula P(x) ∨ ¬P(x) is valid,

because ∀x(P(x) ∨ ¬P(x)) is valid.

  • The formula P(x) ∧ ¬P(x) is not satisfiable,

because its existential closure ∃x(P(x) ∧ ¬P(x)) is not satisfiable.

slide-9
SLIDE 9

Goranko

First-order instances of propositional formulae

Any uniform substitution of first-order formulae for the propositional variables in a propositional formula A produces a first-order formula, called a first-order instance of A. Example: take the propositional formula A = (p ∧ ¬q) → (q ∨ p). The uniform substitution of (5 < x) for p and ∃y(x = y2) for q in A results in the first-order instance ((5 < x) ∧ ¬∃y(x = y2)) → (∃y(x = y2) ∨ (5 < x)).

slide-10
SLIDE 10

Goranko

Satisfiability and validity of first-order instances

  • If a propositional formula A is valid (tautology),

then every first-order instance of A is valid. Thus, for instance, | = ¬¬(x > 0) → (x > 0) and | = Q(x, y) ∨ ¬Q(x, y). What about vice versa? Yes. Why?

  • Likewise, a propositional formula A is satisfiable

if and only if some first-order instance of A is satisfiable. Why?

slide-11
SLIDE 11

Goranko

Logical consequence in first order logic

We fix an arbitrary first-order language L. Given a set of L-formulae Γ, an L-structure S, and a variable assignment v in S, we write S, v | = Γ to say that S, v | = A for every A ∈ Γ. A formula A follows logically from a set of formulae Γ, denoted Γ | = A, if for every structure S and a variable assignment v : VAR →S: S, v | = Γ implies S, v | = A. Note that ∅ | = A iff | = A. Why?

slide-12
SLIDE 12

Goranko

Logical consequence: examples

  • If A1, . . . , An, B are prop. formulae such that A1, . . . , An |

= B, and A′

1, . . . , A′ n, B′ are first-order instances of A1, . . . , An, B obtained by

the same substitution, then A′

1, . . . , A′ n |

= B′. For example: ∃xA, ∃xA → ∀yB | = ∀yB.

  • ∀xP(x), ∀x(P(x) → Q(x)) |

= ∀xQ(x). NB: this is not an instance of a propositional logical consequence.

  • ∃xP(x) ∧ ∃xQ(x) |

= ∃x(P(x) ∧ Q(x)). Indeed, the structure N ′ obtained from N where P(x) is interpreted as ‘x is even’ and Q(x) is interpreted as ‘x is odd’ is a counter-model: N ′ | = ∃xP(x) ∧ ∃xQ(x), while N ′ | = ∃x(P(x) ∧ Q(x)).

slide-13
SLIDE 13

Goranko

Logical consequence: some basic properties

Logical equivalence in first-order logic satisfies all basic properties of propositional logical consequence. In particular, the following are equivalent:

  • 1. A1, . . . , An |

= B.

  • 2. A1 ∧ · · · ∧ An |

= B.

  • 3. |

= A1 ∧ · · · ∧ An → B.

  • 4. |

= A1 → (A2 → · · · (An → B) . . .). Furthermore, for any first-order formula A and a term t that is free for substitution for x in A:

  • 1. ∀xA |

= A[t/x].

  • 2. A[t/x] |

= ∃xA.

slide-14
SLIDE 14

Goranko

First-order logical consequence: more basic properties

  • 1. If A1, . . . , An |

= B then ∀xA1, . . . , ∀xAn | = ∀xB.

  • 2. If A1, . . . , An |

= B and x does not occur free in A1, . . . , An then A1, . . . , An | = ∀xB.

  • 3. If A1, . . . , An |

= B and A1, . . . , An are sentences, then A1, . . . , An | = ∀xB, and hence A1, . . . , An | = B, where B is any universal closure of B.

  • 4. If A1, . . . , An |

= B[c/x], where c is a constant symbol not occurring in A1, . . . , An, B, then A1, . . . , An | = ∀xB(x).

  • 5. If A1, . . . , An, A[c/x] |

= B, where c is a constant symbol not occurring in A1, . . . , An, A, or B, then A1, . . . , An, ∃xA | = B.

slide-15
SLIDE 15

Goranko

Equality in first-order logic

slide-16
SLIDE 16

Goranko

Equality in first-order logic

The equality symbol =, sometimes also called identity, is a special binary relational symbol, always meant to be interpreted as the identity of

  • bjects in the domain of discourse.

The equality is very useful to specify constraints on the size of the model:

  • 1. The sentence

λn = ∃x1 · · · ∃xn(

  • 1≤i=j≤n

¬xi = xj) states that the domain has at least n elements.

  • 2. The sentence µn = ¬λn+1 or, equivalently,

µn = ∀x1 · · · ∀xn+1(

  • 1≤i=j≤n+1

xi = xj) states that the domain has at most n elements.

  • 3. The sentence σn = λn ∧ µn states that the domain has exactly n

elements. Proof: exercises.

slide-17
SLIDE 17

Goranko

Using equality for counting

The sentences λn, µn, σn are easily relativised for every formula A(x) containing (possibly amongst others) the free variable x to the subset of the domain consisting of the elements satisfying A. For instance:

  • “At least two students scored distinction in the exam”

can be formalised in the domain of all humans as ∃x1∃x2(Student(x1) ∧ Student(x2) ∧ ¬x1 = x2 ∧ Dist(x1) ∧ Dist(x2))

  • “Exactly two students scored distinction in the exam”

can likewise be formalised as: ∃x1∃x2(Student(x1) ∧ Student(x2) ∧ x1 = x2 ∧ Dist(x1) ∧ Dist(x2))∧ ∀y((Student(y) ∧ y = x1 ∧ y = x2) → ¬Dist(y)) (where = stands for ¬ =)

slide-18
SLIDE 18

Goranko

Using equality to express uniqueness, functionality, etc.

  • 1. For any formula A(x) (which may also contain other free variables),

the formula ∃!xA(x) := (A(x) ∧ ∀y(A(y) → x = y)) states that there is a unique element in the domain of discourse satisfying A, for the current values of the parameters ¯ z.

  • 2. Thus, the sentence ∀x∃!yR(x, y) in the language with = and a

binary relational symbol R states that the relation R is functional, i.e. every element of the domain is R-related to a unique element.

  • 3. The sentence ∀x∀y(f (x) = f (y) → x = y)) in the language with =

and a unary functional symbol f states that the function f is injective, that is (read by contraposition), assigns different values to different arguments.

slide-19
SLIDE 19

Goranko

Using equality in first-order logic: more examples

Sometimes the equality is implicit in natural language expressions, such as

  • “Everyone, except possibly John, understood the joke.”.

It becomes explicit and readily translatable (exercise) to FOL when rephrased as “Everyone, who is not (equal to) John, understood the joke.”

  • Likewise, “Only John and Mary enjoyed the party.”

can be rephrased as “John and Mary enjoyed the party and everyone who is not (equal to) John and not (equal to) Mary, did not enjoy the party”. Exercise: Formalise these in FOL with equality.

slide-20
SLIDE 20

Goranko

Axioms for the equality

Proposition

The following sentences, in an arbitrary first-order language L are logically valid: (Eq1) x = x (Eq2) x = y → y = x (Eq3) x = y ∧ y = z → x = z. (Eqf ) x1 = y1 ∧ ... ∧ xn = yn → f (x1, ..., xn) = f (y1, ..., yn) for n-ary functional symbol f in L. (Eqr) x1 = y1 ∧ ... ∧ xn = yn → (p(x1, ..., xn) → p(y1, ..., yn)) for n-ary predicate symbol p in L. These axioms, however, cannot guarantee that the interpretation

  • f the binary relational symbol = satisfying them is equality,

but only that it is a congruence in the given structure.

slide-21
SLIDE 21

Goranko

Equivalent replacement of equals

The following theorem states an important generalisation of the properties of the equality on the previous slide, saying that equal terms can be equivalently replaced for each other in any formula.

Theorem (Equivalent replacement)

For any formula A(x) and any terms s and t that are free for x in A, the following holds: | = s = t → (A[s/x] ↔ A[t/x]).

slide-22
SLIDE 22

Goranko

Logical equivalence in first-order logic

slide-23
SLIDE 23

Goranko

Logical equivalence in first order logic

Formulae A and B are logically equivalent, denoted A ≡ B, iff A | = B and B | = A. Equivalently, A ≡ B iff | = A ↔ B. For example, any first-order instance of a pair of equivalent propositional formulae is a pair of logically equivalent formulae. Some basic properties of logical equivalence:

  • 1. A ≡ A
  • 2. If A ≡ B then B ≡ A.
  • 3. If A ≡ B and B ≡ C then A ≡ C.
  • 4. If A ≡ B then ¬A ≡ ¬B, ∀xA ≡ ∀xB, and ∃xA ≡ ∃xB.
  • 5. If A1 ≡ B1 and A2 ≡ B2 then A1 ◦ A2 ≡ B1 ◦ B2 where ◦ is any of

∧, ∨, → and ↔.

slide-24
SLIDE 24

Goranko

Some logical equivalences involving quantifiers

  • ¬∀xA ≡ ∃x¬A.
  • ¬∃xA ≡ ∀x¬A.
  • ∀xA ≡ ¬∃x¬A.
  • ∃xA ≡ ¬∀x¬A.
  • ∃x∃yA ≡ ∃y∃xA.
  • ∀x∀yA ≡ ∀y∀xA.

NB: ∀x∃yA ≡ ∃y∀xA. Why? For instance, “For every integer x there is an integer y such that x < y” is true, but it does not imply “There is an integer y such that for every integer x, x < y.”, which is false.

slide-25
SLIDE 25

Goranko

More logical equivalences and non-equivalences

  • ∀x(P(x) ∧ Q(x)) ≡ ∀xP(x) ∧ ∀xQ(x)
  • ∀x(P(x) ∨ Q(x)) ≡ ∀xP(x) ∨ ∀xQ(x)
  • ∀x(P(x) → Q(x)) ≡ ∀xP(x) → ∀xQ(x)
  • ∃x(P(x) ∨ Q(x)) ≡ ∃xP(x) ∨ ∃xQ(x)
  • ∃x(P(x) ∧ Q(x)) ≡ ∃xP(x) ∧ ∃xQ(x)
  • ∃x(P(x) → Q(x))

?

≡ ∃xP(x) → ∃xQ(x) (True or false?)

slide-26
SLIDE 26

Goranko

Negation normal form

slide-27
SLIDE 27

Goranko

Transforming first-order formulae to negation normal form

A FO formula is in negation normal form (NNF) if the only occurrences

  • f negation are in front of atomic formulae.

Using suitable equivalences, all negations in a first-order formula can be driven inwards, until they reach atomic formulae, thus transforming the formula to an equivalent one in NNF. That can be used e.g. to understand negated natural language sentences with complex logical structure. For example, to negate “For every car, there is a driver who, if (s)he can start it, then (s)he can stop it.” we first translate it to first-order logic: ∀x(Car(x) → ∃y(Driver(y) ∧ (Start(x, y) → Stop(x, y)))).

slide-28
SLIDE 28

Goranko

Transforming first-order formulae to NNF continued

Now negating: ¬∀x(Car(x) → ∃y(Driver(y) ∧ (Start(x, y) → Stop(x, y)))) ≡ ∃x¬(Car(x) → ∃y(Driver(y) ∧ (Start(x, y) → Stop(x, y)))) ≡ ∃x(Car(x) ∧ ¬∃y(Driver(y) ∧ (Start(x, y) → Stop(x, y)))) ≡ ∃x(Car(x) ∧ ∀y¬(Driver(y) ∧ (Start(x, y) → Stop(x, y)))) ≡ ∃x(Car(x) ∧ ∀y(¬Driver(y) ∨ ¬(Start(x, y) → Stop(x, y)))) ≡ ∃x(Car(x) ∧ ∀y(¬Driver(y) ∨ (Start(x, y) ∧ ¬Stop(x, y)))). Since ¬A ∨ B ≡ A → B, the last formula is equivalent to ∃x(Car(x) ∧ ∀y(Driver(y) → (Start(x, y) ∧ ¬Stop(x, y)))).

slide-29
SLIDE 29

Goranko

Transforming first-order formulae to NNF completed

Thus, the negation of the sentence “For every car, there is a driver who, if (s)he can start it, then (s)he can stop it.” formalized in first-order logic as ∀x(Car(x) → ∃y(Driver(y) ∧ (Start(x, y) → Stop(x, y)))) is equivalent to ∃x(Car(x) ∧ ∀y(Driver(y) → (Start(x, y) ∧ ¬Stop(x, y)))) which, translated back to natural language, reads: There is a car such that every driver can start it and cannot stop it.

slide-30
SLIDE 30

Goranko

Negating restricted quantifiers

¬∀x(P(x) → A) ≡ ∃x(P(x) ∧ ¬A) ¬∃x(P(x) ∧ A) ≡ ∀x(P(x) → ¬A), In particular, for any set X: ¬∀x ∈ X A(x) ≡ ∃x ∈ X ¬A(x) ¬∃x ∈ X A(x) ≡ ∀x ∈ X ¬A(x)