Logic as a Tool Chapter 3: Understanding First-order Logic 3.3 Basic grammar and use of first-order languages Valentin Goranko Stockholm University October 2016 Goranko
Translation from natural languages to first-order logic: examples in the structure of real numbers R There is a real number greater than 2 and less than 3. ” ∃ x ( x > 2 ∧ x < 3 ) . There is an integer greater than 2 and less than 3. ” ∃ x ( I ( x ) ∧ x > 2 ∧ x < 3 ) . where I ( x ) is interpreted as ‘ x is an integer . There is no real number the square of which equals − 1 . ” How about ∃ x ( ¬ x 2 = − 1)? No! The sentence actually says “ It is not true that there is a real number the square of which equals − 1 . ” The correct translation is ¬∃ x ( x 2 = − 1) . Goranko
Translation from natural languages to first-order logic: examples in the structure of humans H Translate to first-order logic “ Every man loves a woman. ” ∀ x ∃ y L( x , y )? No! This means ‘Everybody loves somebody.’. We must restrict the quantification of x to men, and of y respectively to women. For that purpose we transform the sentence to: “For every human, if he is a man, then there is a human who is a woman and the man loves that woman.” Now the translation into L H is immediate: ∀ x (M( x ) → ∃ y (W( y ) ∧ L( x , y ))) . Now, translate “ Every mother has a child whom she loves. ” ∀ x ( ∃ y ( x = m( y )) → ∃ z (C( z , x ) ∧ L( x , z ))) . Goranko
Restricted quantification To quantify only over those elements of the domain that satisfy a given (definable) property P , we use restricted quantification. • For existential restricted quantification we use the template: ∃ x ( P ( x ) ∧ . . . ) • For universal restricted quantification we use the template: ∀ x ( P ( x ) → . . . ) For instance: ∃ x ( x > 0 ∧ x 2 + x < 5 ) interpreted in R , says that there exists a real number x which is positive and which satisfies x 2 + x < 5. Likewise, ∀ x ( x > 0 → x 2 + x < 5 ) interpreted in R says that all real numbers x which are positive satisfy x 2 + x < 5. Goranko
Free and bound variables intuitively Two essentially different ways in which we use individual variables in first-order formulae: 1. Free variables: used to denote unknown or unspecified objects , as in ( 5 < x ) ∨ ( x 2 + x − 2 = 0 ). 2. Bound variables: used to quantify , as in ∃ x (( 5 < x ) ∨ ( x 2 + x − 2 = 0 )) and ∀ x (( 5 < x ) ∨ ( x 2 + x − 2 = 0 )). Goranko
Scope of a quantifier. Bound and free occurrences of variables. Scope of (an occurrence of) a quantifier Q in a given formula A is the unique subformula QxB beginning with that occurrence of the quantifier Q in A . Some examples of scopes of quantifiers: ∀ x (( x > 5 ) → ∀ y ( y < 5 → ( y < x ∧ ∃ x ( x < 3 )))) . ∀ x (( x > 5 ) → ∀ y ( y < 5 → ( y < x ∧ ∃ x ( x < 3 )))) . ∀ x (( x > 5 ) → ∀ y ( y < 5 → ( y < x ∧ ∃ x ( x < 3 )))) . An occurrence of the quantifier Q followed by a variable x in a formula A is said to bind the variable x in A . An occurrence of a variable x in a formula A is bound if it is in the scope of an occurrence of a quantifier Q binding x in A . Otherwise, that occurrence of x is free in A . Goranko
Which quantifiers binds which occurrences of variables? A bound occurrence of a variable x in a given formula A is bound by the innermost occurrence of a quantifier Qx in A , in the scope of which it occurs. For example, the first occurrence of ∀ in the following formula binds the first 3 occurrences of x : ∀ x (( x > 5 ) → ∀ y ( y < 5 → ( y < x ∧ ∃ x ( x < 3 )))) , whereas the occurrence of ∃ binds the last 2 occurrences of x : ∀ x (( x > 5 ) → ∀ y ( y < 5 → ( y < x ∧ ∃ x ( x < 3 )))) . Goranko
Bound and free variables in a formula A variable x is bound in the formula A if it has at least one bound occurrence in A . Then x is said to be a bound variable of A . A variable x is free in the formula A if it has at least one free occurrence in A . Then x is said to be a free variable of A . For instance, in the formula A = ( x > 5 ) → ∀ y ( y < 5 → ( y < x ∧ ∃ x ( x < 3 ))) . the first two occurrences of x are free, while all other occurrences of variables are bound. Thus, the only free variable in A is x , while both x and y are bound in A . Note that the same variable can be both free and bound in the same formula , e.g. x in the formula x > 0 ∧ ∃ x ( 5 < x ). Goranko
Open and closed formulae NB: The truth of a formula A in a given structure S only depends on the assignment of values to the free variables occurring in A . That is, if FV ( A ) is the set of free variables in A and v 1 , v 2 are variable assignments in S such that v 1 | FV ( A ) = v 2 | FV ( A ) , then S , v 1 | = A iff S , v 2 | = A . An open formula is a formula with no bound variables, i.e. not containing any occurrences of quantifiers. A closed formula, or a sentence is a formula with no free variables. Thus, the truth of a sentence in a structure does not depend on the variable assignment. Goranko
Using bound and free variables in a formula Free variables have their own values in a given formula (determined by a variable assignment), while bound variables only play a dummy role and can be replaced (with care!) by one another. ∃ x ( 5 < x ∧ x 2 + x − 2 = 0 ) For instance, the sentence ∃ y ( 5 < y ∧ y 2 + y − 2 = 0 ), means exactly the same as in the sense that both formulae always have the same truth value. ∀ x ( 5 < x ∨ x 2 + x − 2 = 0 ) Likewise, means the same as ∀ y ( 5 < y ∨ y 2 + y − 2 = 0 ). On the other hand, the meaning of 5 < x ∧ x 2 + x − 2 = 0 is essentially different from the meaning of 5 < y ∧ y 2 + y − 2 = 0 . Both formulae state the same, but about different individuals. Goranko
Reusing variables as free and bound in a formula The same variable can occur both free and bound in a formula: x > 5 → ∀ x ( 2 x > x ) . However, the free occurrence of x has nothing to do with the bound occurrences of x : x > 5 → ∀ x ( 2 x > x ) . Thus, the formula above has the same meaning as x > 5 → ∀ y ( 2 y > y ) , but not the same meaning as y > 5 → ∀ x ( 2 x > x ) . Goranko
Binding a variable by different quantifiers in a formula Different occurrences of the same variable can be bound by different quantifiers: ∃ x ( x > 5 ) ∨ ∀ x ( 2 x > x ) . Again, the occurrences of x , bound by the first quantifier, have nothing to do with those bound by the second one. For instance, the two x ’s claimed to exist in the formula ∃ x ( x > 5 ) ∧ ∃ x ( x < 3 ) . need not (and, in fact, cannot) be the same. Thus, the formula above has the same meaning as each of ∃ y ( y > 5 ) ∧ ∃ x ( x < 3 ) , ∃ x ( x > 5 ) ∧ ∃ z ( z < 3 ) , ∃ y ( y > 5 ) ∧ ∃ z ( z < 3 ). Goranko
Nested bindings of a variable in a formula Different bindings of the same variable can be nested, e.g.: ∀ x ( x > 5 → ∃ x ( x < 3 )) . Again, the occurrences of x in the subformula ∃ x ( x < 3 ) are bound by ∃ and not related to the first two occurrences of x , bound by ∀ : ∀ x ( x > 5 → ∃ x ( x < 3 )) . Thus, the formula above has the same meaning as each of ∀ x ( x > 5 → ∃ y ( y < 3 )) , ∀ z ( z > 5 → ∃ x ( x < 3 )) , ∀ z ( z > 5 → ∃ y ( y < 3 )). Goranko
Renaming of a bound variable in a formula Using the same variable for different purposes in a formula can be confusing, and is often unwanted, so we may want to eliminate it. Renaming of the variable x in a formula A is the substitution of all occurrences of x bound by the same occurrence of a quantifier in A with another variable, not occurring in A . E.g., a possible renaming of ( x > 5 ) ∧ ∀ x ( x > 5 → ¬∃ x ( x < y )) ( x > 5 ) ∧ ∀ x ( x > 5 → ¬∃ z ( z < y )) is the formula However, neither of the following formulae is a correct renaming: ( z > 5 ) ∧ ∀ x (( x > 5 ) → ¬∃ x ( x < y )) , ( x > 5 ) ∧ ∀ z (( z > 5 ) → ¬∃ z ( z < y )) , ( x > 5 ) ∧ ∀ x ( x > 5 → ¬∃ y ( y < y )) . Claim: The result of renaming a variable in a formula A always has the same truth value as A . Goranko
Clean formulae A formula A is clean if no variable occurs both free and bound in A and every two occurrences of quantifiers bind different variables. Thus, ∃ x ( x > 5 ) ∧ ∃ y ( y < z ) is clean, while ∃ x ( x > 5 ) ∧ ∃ y ( y < x ) and ∃ x ( x > 5 ) ∧ ∃ x ( y < x ) are not. Claim: Every formula can be transformed into a clean formula by means of several consecutive renamings of variables. E.g., ( x > 5 ) ∧ ∀ x (( x > 5 ) → ¬∃ x ( x < y )) can be transformed into a clean formula as follows: ( x > 5 ) ∧ ∀ x 1 (( x 1 > 5 ) → ¬∃ x ( x < y )) , ( x > 5 ) ∧ ∀ x 1 (( x 1 > 5 ) → ¬∃ x 2 ( x 2 < y )) . Goranko
Recommend
More recommend