Exercises For Predicate Logic
Exercises For Predicate Logic
Exercise 1.1.
Transform the following sentences from natural language into predicate formulas. Explain the syntactic
elements used in the predicate formulas: variables, constants, functions symbols, predicate symbols.
1. If x is an integer divisible by 10, it can be decomposed in two factors such that one is divisible by 2
and the other one is divisible by 5, and x can be written as a sum of 2 even numbers.
2. In a plane if a line x intersects a line y, then all the lines parallel to x intersects y.
3. In a plane there are lines parallel to a constant line d and there are lines perpendicular to d .
4. Every positive number can be written as a product of two positive numbers and as a product of two
negative numbers.
5. If x and y are positive prime numbers, x y , x 2 and y 2 , their sum and difference are even
numbers and their product is an odd number.
6. For every positive integer x , if x is a square of an integer, then there exists an integer y such that
( y 1) * ( y 1) x 1 .
7. For every positive integer x , if x is not a prime, then there exists a prime y such that y divides x
and y is smaller than x .
8. The sum of two even numbers is an even number and their product is divisible by 4.
Exercise 1.2. Transform the following statements from natural language into predicate formulas choosing
the appropriate constants, function symbols and predicate symbols:
1. Every student who makes good grades is brilliant or studies.
2. Some of Johns colleagues like to draw and some like to dance.
3. CS students like either algebra or logic, all of them like Java but only Bill likes history.
4. All Marys relatives live in Cluj-Napoca, only her cousin John lives in Bucharest.
5. Anyone who owns a rabbit hates anything that chases any rabbit.
6. All birds have wings but only penguins do not fly.
7. Santa has some reindeer with a red nose, then every child loves Santa.
8. Every investor who bought something that falls is not happy.
9. Anyone who has any cats will not have any mice.
10. Caterpillars and snails are much smaller than birds, which are much smaller than foxes, which in turn are
much smaller than wolves.
11. Caterpillars and snails like to eat some plants.
12. Every animal either likes to eat all plants or all animals much smaller than itself that like to eat some
plants.
Exercise 1.3. Using the definition of deduction in predicate logic prove:
1. (y )( P ( y ) Q ( y )), (z ) P ( z ) | (x )Q ( x )
2. (y )(z )( P ( y ) Q ( z )) | (x )( P ( x ) Q ( x )) ;
3. (y ) P ( y ) (z )Q ( z ) | (x )( P ( x ) Q ( x)) ;
4. (y )( P ( y ) Q ( y )), (z ) P ( z ) | (x )Q ( x ) ;
5. (y ) P ( y ) | (x )(Q ( x) P ( x )) ;
6. (y ) P ( y ) | (x )(Q ( x ) P ( x )) ;
7. (y )(z )( P ( y ) Q ( z )) | ( P ( a ) Q ( a ))
8. (y ) P ( y ) | (x ) P ( x ) ;
Exercise 1.4. Using the given interpretations evaluate the following formulas:
1. U (x ) A( x ) (x ) B ( x ) (x )( A( x ) B ( x ))
Interpretation
I D, m , where:
2.
m( A) : D {T , F }, m( A)( x ) : x d ;
m( B ) : D {T , F }, m( B )( x) : x || d ;
U (x)( P ( x ) Q ( x)) (x) P ( x) Q (12)
Interpretation
3.
I D, m where:
I D, m , where:
I D, m , where:
Area(y);
I D, m , where:
6. U ((x ) A( x ) (x ) B ( x )) (x )( A( x ) B ( x ))
Interpretation
7.
I D, m , where:
I D, m , where:
Exercise 1.6.
Choose an arbitrary interpretation for the formula U and prove that it is a model of U .
1. U (x )( A( x ) B ( x )) ((x) A( x ) (x ) B ( x )) ;
2. U (x)( A( x ) B ( x)) ((x ) A( x) (x) B ( x)) ;
3. U (x )( A( x ) B ( x )) ((x ) A( x ) (x ) B ( x)) ;
4. U (x)( A( x) B ( x)) ((x ) A( x) (x) B ( x )) ;
5. U ((x) A( x ) (x ) B( x)) (x )( A( x) B ( x )) ;
6. U (x )( A( x) B ( x)) ((x ) A( x ) (x ) B ( x)) ;
7. U (x)( A( x) B( x)) ((x) A( x) (x) B ( x)) ;
8. U (x)( A( x) B( x)) ((x) A( x) (x) B( x)) .
Remark: All the formulas from Exercise 1.6. are tautologies.
Exercise 1.7. Transform the following formulas into prenex, Skolem and clausal normal forms.
1. (x ) ((y ) p ( y ) (y )(q ( y ) r ( x ))) ;
2. (x ) ((y ) p ( y ) (y )(q ( y ) r ( x ))) ;
3. (x) ((y ) p ( y ) (y )(q ( y ) r ( x))) ;
4. (x ) ((y ) p ( y ) (y )(q ( y ) r ( x ))) ;
5. (x ) ((y ) p ( y ) (y )( q ( y ) r ( x ))) ;
6. (x) ((y ) p ( y ) (y )( q ( y ) r ( x))) ;
7. (x ) ((y ) p ( y ) (y )(q ( y ) r ( x ))) ;
8. (x ) ((y ) p ( y ) (y )(q ( y ) r ( x ))) .
Exercise 1.8. Transform the following formulas into prenex, Skolem and clausal normal forms.
1. (x)(y )((z ) p ( z ) (u )(q ( x, u ) (z ) q ( y , z ))) ;
2. (x )(y )((z ) p ( z ) (u )( q ( x, u ) (z ) q ( y , z ))) ;
3. (x )(y )((z ) p ( z ) (u )( q ( x, u ) (z ) q ( y , z ))) ;
4. (x )(y )((z ) p ( z ) (u )( q ( x, u ) (z ) q ( y , z ))) ;
5. (x)(y )((z ) p ( z ) (u )(q ( x, u ) (z ) q ( y , z ))) ;
6. (x )(y )((z ) p ( z ) (u )( q ( x, u ) (z ) q ( y , z ))) ;
7. (x )(y )((z ) p ( z ) (u )( q ( x, u ) (z ) q ( y , z ))) ;
8. (x )(y )((z ) p ( z ) (u )(q ( x, u ) (z ) q ( y , z ))) .
Exercise 1.9. Are the atoms from the following pairs unifiable? If yes, find the their most general unifier.
1. P ( a, x, g ( g ( y ))) and P ( y , f ( z ), f ( z )) ;
P ( x, g ( f ( a )), f ( x )) and P ( f ( y ), z , y ) ;
P ( a, x, g ( g ( y ))) and P ( z , h( z , u ), g (u ), z ) ;
2. P ( a, x, f ( g ( y ))) and P ( y , f ( z ), f ( z )) ;
P ( x, g ( f ( a )), f (b)) and P ( f ( y ), z , z ) ;
P ( a, x, f ( g ( y ))) and P ( z , h( z , u ), f (b), z ) ;
3. P ( a, f ( x ), g ( h( y ))) and P ( y , f ( z ), g ( z )) ;
P ( x, g ( f ( a )), h( x, y )) and P ( f ( z ), g ( z ), y ) ;
P ( g ( y ), x, f ( g ( y ))) and P ( z , h( z , u ), f (u )) ;
4. P ( a, g ( x), f ( g ( y ))) and P ( y , z , f ( z )) ;
P (b, g ( f ( a )), z ) and P ( f ( y ), z , g ( y )) ;
P ( a, h( x, b), f ( g ( y ))) and P ( z , h( z , u ), f (u )) ;
5. P ( a, x, g ( f ( y ))) and P ( f ( z ), z , g ( x )) ;
P ( a, x, g ( f ( y ))) and P ( x, y , g ( f (b))) ;
P ( a, h( x, u ), g ( f ( z ))) and P ( y , h( y , f ( z )), g ( x)) ;
6. P ( a, y , g ( f ( z ))) and P ( z , f ( z ), x ) ;
P ( y , f ( x ), z ) and P ( y , f ( y ), f ( y )) ;
7.
8.
P ( h ( x, y ), x, y ) and P ( h( y , x ), f ( z ), z ) ;
P ( a, x, g ( f ( y ))) and P ( f ( y ), z , x ) ;
P ( x, a, g (b)) and P ( f ( y ), f ( y ), g ( x )) ;
P ( h( x, a ), f ( z ), z ) and P ( h( f ( y ), x ), f ( x ), a ) ;
P ( a, x, g ( f ( y ))) and P ( f ( y ), f ( z ), g ( z )) ;
P ( x, g ( f ( a )), x ) and P ( f ( y ), z , h( y , f ( y ))) ;
P ( a, h( x, u ), f ( g ( y ))) and P ( z , h ( z , u ), g (u )) .