Logic programming

xyx => y not x or y
TTT T
TFF F
FTT T
FFT T

Predicate logic

horse(blue).

parent(blue,charlie).

mammal(X) :- horse(X).

mammal(X) :- horse(Y),offspring(X,Y).

offspring(X,Y):-parent(Y,X).

ancestor(X,Y):-parent(X,Y).

ancestor(X,Y):-ancestor(X,Z),parent(Z,Y).