أخر الاخبار

Represent the predicate calculus

  Represent the predicate calculus


Ex: Represent the following English sentences using predicate calculus:

 1- For every action, there is an equal and opposite reaction.

sol// ∀X action(X)->∀Y reaction(Y, X) ^ equal (magnitude(X), magnitude(Y)) ^ opposite (direction(X), direction(Y))

 2- Everyone loves someone who loves everyone.

sol// ∀x ∀y ∀z (loves(X, Y) -> loves(Z, X)) 

3- We all live in a yellow submarine

 sol//Ex ∀y( submarine(X) ^ yellow(X) ^ among-us (Y) --> live_in (Y, X))


Ex/Represent the following English paragarphes using predicate calculus:

a-"All people that are not poor and are smart are happy. Those people that read are not stupid. John can read and is wealthy. Happy people have exciting lives."

sol//

∀X (¬ poor (X) Λ smart (X) ⇒ happy (X))

 ∀Y (read (Y) ⇒ smart (Y))

 read (john) Λ ¬ poor (john) 

∀Z (happy (Z) ⇒ exciting (Z))


b-"Animals can outrun any animals that they eat. Carnivores eat other animals. If x can outrun y and y can outrun z, than x can outrun z. Lions eat zebras. Zebras can outran dogs. Dogs are Carnivores."

sol//

∀X ∀Y(eat(X,Y)⇒outrun(X,Y)) 

∀X∀Y(carnivores(X)⇒eat(X,Y))

 ∀X∀Y∀Z(outrun(X,Y) Λ outrun(Y, Z)⇒ outrun(X,Z))

 eat(lion, zebra) 

outrun(zebra, dog) 

carnivores(dog)


Ex//Represent the following English sentences using predicate calculus.

sol//

a) All purple mushrooms are poisonous.

sol// ∀X (mushroom(X) Λ purple(X) ⇒ poisonous(X))

 b) No purple mushroom is poisonous. 

sol//∀X (mushroom(X) Λ purple(X) ⇒ ¬ poisonous(X))

 c) All mushrooms are either purple or poisonous. 

sol//∀X (mushroom(X) ⇒( purple(X) ν poisonous(X)))

 d) All mushrooms are either purple or poisonous but not both. 

sol//∀X (mushroom(X) ⇒( purple(X) Λ ¬ poisonous(X)) ν (¬purple(X) ν poisonous(X))) 

e) All purple mushrooms except one are poisonous. 

sol//ƎX (purple(X) Λ mushroom(X) Λ ¬ poisonous(X)) Λ (∀Y(purple(Y) Λ mushroom(Y) Λ ¬equal(X,Y)) ⇒poisonous(Y)) 

f) There are exactly two purple mushrooms. 

sol//ƎX ƎY (purple(X) Λ mushroom(X) Λ purple(Y) Λ mushroom(Y) Λ ¬equal(X,Y) Λ (∀Z( mushroom(Z) Λ purple(Z) ) ⇒(equal(Z, X) ν equal(Z, Y)) 

g) Not all students take both history and biology. 

sol//¬∀X (student(X) ⇒ [takes(X, history) ^ takes(X, biology)])

 h) No person likes a smart vegetarian.

sol// ∀X ∀Y (person(X) ^ vegetarian(Y) ^ smart(Y) ⇒ ¬likes(x, y)) 

i)There is a woman who likes all men who are not vegetarians. 

sol//ƎX woman(X) ^ (∀Y man(Y) ^ ¬vegetarian(Y) ⇒ likes(X, Y)) 

j) The best score in history was better than the best score in biology. 

sol//∀X ∀Y (best_score(history, X) ^ best_score(biology, Y) ) ⇒ better(X ,Y))

k) Every person who dislikes all vegetarians is smart. 

sol//∀X (person(X) ^ ∀Y [vegetarian(Y) ⇒ ¬likes(X, Y)]) ⇒ smart(X) 

l) There is a barber who shaves all men in town who do not shave themselves. 

sol//ƎX barber(X) ^ (∀Y townman(Y) ^ ¬shaves(Y, Y) ) ⇒ shaves(X, Y)) 

m) No person likes a professor unless the professor is smart. 

sol//∀X ∀Y [person(X) ^ professor(Y)] ⇒ [likes(X, Y) ) ⇒ smart(y)] 

n) Only one student failed both history and biology. 

sol//ƎX student(X) ^ (∀Y student(Y) ⇒ equal(X,Y)) ^ failed(X, history) ^ failed(X, biology) 

o) Politicians can fool some of the people all the time, and they can fool all of the people some of the time, but they cannot fool all of the people all of the time. 

sol//∀X politician(X) ⇒ {[ƎY people(Y) ^ (∀T time(T) ⇒ fool(X, Y, T))] ^ [ƎT time(T) ^ (∀Y people(Y) ⇒ fool(X, Y, T))] ^ ¬ [∀Y ∀T people(Y) ^ time(T) ⇒ fool(X, Y, T)]}

تعليقات



حجم الخط
+
16
-
تباعد السطور
+
2
-