I am developing a group theory prover. Right now, I am interested in proving if H and K, are subgroups, then H intersects K is a subgroup. I base my proof in constructing an relation (==H) such that
h (==H) g if and only if hg^{-1} belongs to H. Proving this is an equivalence relation (reflexive, symmetric, transitive) is equivalent to proving that H is a subgroup.
I have done this following code and when I try to prove H intersect K is a subgroup, I get failure. I am new in Prolog so maybe I get something basic wrong. In the mathematical proof it is not required to say the explicit form of the equivalence relation, hence I have omitted it.
In the program I denote hg and kg as H and K. H intersect K is hkg.
inside(X,H) :- equals(H,X,e).
equals(hkg,e,e).
equals(hkg,x,e).
equals(hkg,y,e).
equals(hkg,z,e).
equals(hkg,X,Y) :- equals(hg,X,Y),equals(kg,X,Y).
reflexive(H) :- forall(inside(X,H),equals(H,X,X)).
symmetric(H) :- forall(equals(H,X,Y),equals(H,Y,X)).
transitive(H) :- forall(equals(H,X,Y),equals(H,Y,Z),equals(H,X,Z)).
subgroup(H) :- reflexive(H),symmetric(H),transitive(H).
subgroup(hg).
subgroup(kg).
For now, it fails the reflexivity test (first test). Could you please show me what is wrong with this program? If you need more clarifications, feel free to ask.