Professional Documents
Culture Documents
Logic Assignment
2
a) ∃ x Computer(x) ∧ (∀ y Student(y) → ¬Foloseste(y, x))
b) (∀ x Student(x) → ¬Nepromovat(x,AlgebraLiniara)) ∧ (∃ x Student(x) ∧ Nepromovat(x,
AnalizaMatematica))
3
different(a, b).
different(a, c).
different(a, d).
different(a, e).
different(b, c).
different(b, d).
different(b, e).
different(c, d).
different(c, e).
different(d, e).
rightneighbour(a, b).
rightneighbour(b, c).
rightneighbour(c, d).
rightneighbour(d, e).
-rightneighbour(a, a).
-rightneighbour(a, c).
-rightneighbour(a, d).
-rightneighbour(a, e).
-rightneighbour(b, a).
-rightneighbour(b, b).
-rightneighbour(b, d).
-rightneighbour(b, e).
-rightneighbour(c, a).
-rightneighbour(c, b).
-rightneighbour(c, c).
-rightneighbour(c, e).
-rightneighbour(d, a).
-rightneighbour(d, b).
-rightneighbour(d, c).
-rightneighbour(d, d).
-rightneighbour(e, a).
-rightneighbour(e, b).
-rightneighbour(e, c).
-rightneighbour(e, d).
-rightneighbour(e, e).
next(x, y) <-> rightneighbour(x, y) | rightneighbour(y, x).
radiator(b).
mileage20(a) | mileage20(e).
hatchback(x) <-> mileage20(x).
suv(x) & Melvin(y) & pickup(z) -> right(y, x) & right(x, z).
white(a) | white(e).
italian(d).
suspension(a) | suspension(e).
Willie(e).
Kyle(x) & suv(y) & Damon(z) -> right(y, x) & right(x, z).
Rezultate:
Mașina 1: white, Reginald, american, transmission, suv, 50000
Mașina 2: green, Melvin, german, radiator, crossover, 30000
Mașina 3: black, Kyle, French, engine, sedan, 60000
Mașina 4: red, Damon, italian, airbag, pickup, 40000
Mașina 5: blue, Willie, korean, suspension, hatchback, 20000
4
edge(a,b).
edge(b,c).
edge(c,d).
edge(d,e).
path(x,y) <-> edge(x,y) | (exists z (path(x,z) & path(z,y))).
5
different(x, y) -> different(y, x).
different(Ork, Bog).
male(x) | female(x).
venusian(x) | martian(x).
Conform maze4 există o singură soluție, și anume Bog să fie marțian de sex feminin și Ork să fie
venusian de sex masculin.
6
different(x, y) -> different(y, x).
different(p1, p2).
male(x) | female(x).
venusian(x) | martian(x).