0

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.

Cezar98
  • 123
  • 5
  • These 2 recursive calls `... :- equals(hg,X,Y),equals(kg,X,Y).` are going to fail, since no fact 'labelled' with `hg` or `kg` exists. I don't understand enough of your notation to suggest a better approach, sorry. – CapelliC Apr 06 '20 at 09:29
  • Indeed, when I trace it, it fails equals(hg,x,x) call. Doesn't ':-' mean "if and only if" in this case? If so, then why the program doesn't attempt proving equals(hg,x,x) and just gives up because it hasn't seen that relation? – Cezar98 Apr 06 '20 at 09:39
  • If this were my problem I would use [Coq](https://coq.inria.fr/). See: [Library Coq.Classes.Equivalence](https://coq.inria.fr/library/Coq.Classes.Equivalence.html) – Guy Coder Apr 06 '20 at 10:42
  • As far as I can see, Coq is a proof assistant that checks if your proof is correct. It doesn't generate your proof. My interest is in generating proofs of subgroups using an equivalence relation. I just plug in an equivalence relation (equals) and the program should generate the proof for me if it is correct. – Cezar98 Apr 06 '20 at 11:12
  • @Cezar98 AFAIK, Coq helps you to interactively build the proof, by taking away the tedious detail work. It is also very different from Prolog, being based on the Calculus of Construction, about which I know not much apart that is based on type hierarchies from Martin-Löf Type Theory (i.e. it takes the other approach from Zermelo-Fränkel set theory to set up mathematics). No, that's really not for me. Maybe in another life. – David Tonhofer Apr 06 '20 at 11:51
  • And is there a Prolog version rather than a Scheme/Racket version of [The Little Prover?](https://mitpress.mit.edu/books/little-prover), which about proving theorem about your software. If not, why not! – David Tonhofer Apr 06 '20 at 11:52

1 Answers1

1

Prolog is not all that good for theorem proving. The way it calls the predicates in the logic program is based on resolution theorem proving (and thus restricted to Horn clauses), but that doesn't mean that the language allows you to model theorem proving problems & techniques particularly well. In particular because Prolog works on goals p(X,Y) for which it tries to find tuples (x,y) that make these goals TRUE as defined by the logic program, rather than work on sentences S that are rewritten according to some deduction approach (Natural Deduction, Sequent Calculus) for some Logic (Classical, Intuitionistic etc.) until the final S' obtains. Note in particular how there are not quantifiers anywhere in sight, because no-one writes the S that may need it. This doesn't mean one cannot build a theorem prover on Prolog, but there is some way to go for that.

In this case for

reflexive(H) :- forall(inside(X,H),equals(H,X,X)).

you are already in trouble, because Prolog-proving reflexive(hg) means

Actually go and find any X such that inside(X,hg)

inside(X,hg) :- equals(hg,X,e).

Actually go and find any X such that equals(hg,X,e)

because I need to make sure inside(X,hg) (and the statement ∀X: equals(hg,X,e) => inside(X,hg) will allow me to do that)

... and there are none in this logic program.

Reflexivity should be vacuously true

?- reflexive(hg).
true.

Nice, but useless.

Community
  • 1
  • 1
David Tonhofer
  • 14,559
  • 5
  • 55
  • 51