You are on page 1of 9

Ulics Daniel

Logic Assignment

a) ¬(¬p v q) v (r → ¬s)  (p ∧ ¬q) v (¬r v ¬s)  (p v ¬r v ¬s) ∧ (¬q v ¬r v ¬s)


b) (¬p → q) → (q → ¬r)  ¬(¬p → q) v (q → ¬r)  ¬(p v q) v (¬q v ¬r)  (¬p ∧ ¬q) v (¬q v ¬r)
 (¬p v ¬q v ¬r) ∧ (¬q v ¬q v ¬r)  (¬p v ¬q v ¬r) ∧ (¬q v ¬r)

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).

different(x, y) -> different(y, x).

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).

right(x, y) <-> rightneighbour(x, y) | (exists z (right(x, z) & right(z, y))).

black(x) | blue(x) | green(x) | red(x) | white(x).

black(x) & black(y) -> -different(x, y).


blue(x) & blue(y) -> -different(x, y).
green(x) & green(y) -> -different(x, y).
red(x) & red(y) -> -different(x, y).
white(x) & white(y) -> -different(x, y).

Damon(x) | Kyle(x) | Melvin(x) | Reginald(x) | Willie(x).

Damon(x) & Damon(y) -> -different(x, y).


Kyle(x) & Kyle(y) -> -different(x, y).
Melvin(x) & Melvin(y) -> -different(x, y).
Reginald(x) & Reginald(y) -> -different(x, y).
Willie(x) & Willie(y) -> -different(x, y).

american(x) | german(x) | french(x) | italian(x) | korean(x).

american(x) & american(y) -> -different(x, y).


german(x) & german(y) -> -different(x, y).
french(x) & french(y) -> -different(x, y).
italian(x) & italian(y) -> -different(x, y).
korean(x) & korean(y) -> -different(x, y).

airbag(x) | engine(x) | radiator(x) | suspension(x) | transmission(x).


airbag(x) & airbag(y) -> -different(x, y).
engine(x) & engine(y) -> -different(x, y).
radiator(x) & radiator(y) -> -different(x, y).
suspension(x) & suspension(y) -> -different(x, y).
transmission(x) & transmission(y) -> -different(x, y).

crossover(x) | hatchback(x) | pickup(x) | sedan(x) | suv(x).

crossover(x) & crossover(y) -> -different(x, y).


hatchback(x) & hatchback(y) -> -different(x, y).
pickup(x) & pickup(y) -> -different(x, y).
sedan(x) & sedan(y) -> -different(x, y).
suv(x) & suv(y) -> -different(x, y).

mileage20(x) | mileage30(x) | mileage40(x) | mileage50(x) | mileage60(x).

mileage20(x) & mileage20(y) -> -different(x, y).


mileage30(x) & mileage30(y) -> -different(x, y).
mileage40(x) & mileage40(y) -> -different(x, y).
mileage50(x) & mileage50(y) -> -different(x, y).
mileage60(x) & mileage60(y) -> -different(x, y).

transmission(x) & radiator(y) -> rightneighbour(x, y).

radiator(b).

german(x) & mileage50(y) -> rightneighbour(y, x).

mileage20(a) | mileage20(e).
hatchback(x) <-> mileage20(x).

korean(x) & mileage40(y) -> rightneighbour(y, x).

white(x) & crossover(y) -> next(x, y).

mileage60(x) <-> engine(x).

suv(x) & Melvin(y) & pickup(z) -> right(y, x) & right(x, z).

green(x) & transmission(y) -> rightneighbour(y, x).

white(a) | white(e).

italian(d).

suspension(a) | suspension(e).

Melvin(x) & french(y) -> rightneighbour(x, y).

Willie(e).

Kyle(x) & red(y) -> rightneighbour(x, y).

blue(x) & black(y) -> right(y, x).

Melvin(x) & mileage50(y) -> next(x, y).

mileage20(x) & mileage40(y) -> rightneighbour(y, x).


airbag(x) & green(y) -> right(y, x).

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))).

Rezultat prover9 pentru goal path(a,c):

5
different(x, y) -> different(y, x).
different(Ork, Bog).
male(x) | female(x).
venusian(x) | martian(x).

venusian(Ork) & male(Ork) -> martian(Bog) & female(Bog).


venusian(Ork) & female(Ork) -> venusian(Bog) & male(Bog).
martian(Ork) & male(Ork) -> venusian(Bog) & male(Bog).
martian(Ork) & female(Ork) -> martian(Bog) & female(Bog).
venusian(Bog) & male(Bog) -> venusian(Ork) & male(Ork).
venusian(Bog) & female(Bog) -> martian(Ork) & female(Ork).
martian(Bog) & male(Bog) -> martian(Ork) & female(Ork).
martian(Bog) & female(Bog) -> venusian(Ork) & male(Ork).

male(x) & male(y) -> -different(x ,y).


female(x) & female(y) -> -different(x, y).
venusian(x) & venusian(y) -> -different(x, y).
martian(x) & martian(y) -> -different(x, y).

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).

male(x) & male(y) -> -different(x ,y).


female(x) & female(y) -> -different(x, y).
martian(x) & venusian(y) -> different(x, y).

male(p1) & venusian(p1) -> venusian(p2) & female(p2).


male(p1) & martian(p1) -> martian(p2) & female(p2).
female(p1) & venusian(p1) -> martian(p1) & martian(p2).
female(p1) & martian(p1) -> venusian(p2) & female(p2).

female(p2) & venusian(p2) -> venusian(p1) & male(p1).


female(p2) & martian(p2) -> martian(p1) & male(p1).
male(p2) & venusian(p2) -> female(p2).
male(p2) & martian(p2) -> venusian(p1).

Conform maze4 cuplul nu poate fi de origine mixtă.

You might also like