```    1/* Simple illustration of the use of Aleph for
2       abductive learning
3 To run do the following:
4       a. induce
5 You should see Aleph first trying to learn the best rule
6 it can for grandparent. It will then generate an abductive
7 explanation for the examples in the form of ground facts for
8 parent/2. These are then generalised to find the rules for
9 parent/2.
10*/
```

?- `induce(Program)`. */

```   15:- use_module(library(aleph)).   16:- if(current_predicate(use_rendering/1)).   17:- use_rendering(prolog).   18:- endif.   19:- aleph.   20:- modeh(*,grandparent(+person,-person)).   21:- modeh(*,parent(+person,-person)).   22
23:- modeb(*,mother(+person,-person)).   24:- modeb(*,father(+person,-person)).   25:- modeb(*,parent(+person,-person)).   26:- aleph_set(abduce,true).   27:- abducible(parent/2).   28
29:- determination(grandparent/2,father/2).   30:- determination(grandparent/2,parent/2).   31:- determination(grandparent/2,mother/2).   32
33:-dynamic grandparent/2.   34:-begin_bg.   35person(bob).
37person(mum(bob)).
41person(mum(mum(bob))).
42
43person(jo).
45person(mum(jo)).
49person(mum(mum(jo))).
50
51person(peter).
53person(mum(peter)).
57person(mum(mum(peter))).
58
59person(jane).
61person(mum(jane)).
65person(mum(mum(jane))).
66
68	person(X).
69mother(mum(X),X):-
70	person(X).
71
72
73% The correct rule for grandparent/2. This will
74% not work because Aleph is missing the definition for
75% parent/2 (see below).
76grandparent(X,Z):-
77	person(X),
78	person(Y),
79	X \= Y,
80	parent(X,Y),
81	person(Z),
82	Y \= Z,
83	parent(Y,Z).
84
85% The rules for parent/2 that we would like Aleph to discover
86% parent(X,Y):- father(X,Y).
87% parent(X,Y):- mother(X,Y).
93grandparent(mum(mum(bob)),bob).
97grandparent(mum(mum(jo)),jo).
101grandparent(mum(mum(peter)),peter).
105grandparent(mum(mum(jane)),jane).
106:-end_in_pos.  107:-begin_in_neg.  108grandparent(bob,bob).
110grandparent(bob,mum(bob)).
114grandparent(bob,mum(mum(bob))).
115grandparent(bob,jo).
117grandparent(bob,mum(jo)).
121grandparent(bob,mum(mum(jo))).
122grandparent(bob,peter).
124grandparent(bob,mum(peter)).
128grandparent(bob,mum(mum(peter))).
129grandparent(bob,jane).
131grandparent(bob,mum(jane)).
135grandparent(bob,mum(mum(jane))).
164grandparent(mum(bob),bob).
166grandparent(mum(bob),mum(bob)).
170grandparent(mum(bob),mum(mum(bob))).
171grandparent(mum(bob),jo).
173grandparent(mum(bob),mum(jo)).
177grandparent(mum(bob),mum(mum(jo))).
178grandparent(mum(bob),peter).
180grandparent(mum(bob),mum(peter)).
184grandparent(mum(bob),mum(mum(peter))).
185grandparent(mum(bob),jane).
187grandparent(mum(bob),mum(jane)).
191grandparent(mum(bob),mum(mum(jane))).
274grandparent(mum(mum(bob)),mum(bob)).
278grandparent(mum(mum(bob)),mum(mum(bob))).
279grandparent(mum(mum(bob)),jo).
281grandparent(mum(mum(bob)),mum(jo)).
285grandparent(mum(mum(bob)),mum(mum(jo))).
286grandparent(mum(mum(bob)),peter).
288grandparent(mum(mum(bob)),mum(peter)).
292grandparent(mum(mum(bob)),mum(mum(peter))).
293grandparent(mum(mum(bob)),jane).
295grandparent(mum(mum(bob)),mum(jane)).
299grandparent(mum(mum(bob)),mum(mum(jane))).
300grandparent(jo,bob).
302grandparent(jo,mum(bob)).
306grandparent(jo,mum(mum(bob))).
307grandparent(jo,jo).
309grandparent(jo,mum(jo)).
313grandparent(jo,mum(mum(jo))).
314grandparent(jo,peter).
316grandparent(jo,mum(peter)).
320grandparent(jo,mum(mum(peter))).
321grandparent(jo,jane).
323grandparent(jo,mum(jane)).
327grandparent(jo,mum(mum(jane))).
356grandparent(mum(jo),bob).
358grandparent(mum(jo),mum(bob)).
362grandparent(mum(jo),mum(mum(bob))).
363grandparent(mum(jo),jo).
365grandparent(mum(jo),mum(jo)).
369grandparent(mum(jo),mum(mum(jo))).
370grandparent(mum(jo),peter).
372grandparent(mum(jo),mum(peter)).
376grandparent(mum(jo),mum(mum(peter))).
377grandparent(mum(jo),jane).
379grandparent(mum(jo),mum(jane)).
383grandparent(mum(jo),mum(mum(jane))).
465grandparent(mum(mum(jo)),bob).
467grandparent(mum(mum(jo)),mum(bob)).
471grandparent(mum(mum(jo)),mum(mum(bob))).
473grandparent(mum(mum(jo)),mum(jo)).
477grandparent(mum(mum(jo)),mum(mum(jo))).
478grandparent(mum(mum(jo)),peter).
480grandparent(mum(mum(jo)),mum(peter)).
484grandparent(mum(mum(jo)),mum(mum(peter))).
485grandparent(mum(mum(jo)),jane).
487grandparent(mum(mum(jo)),mum(jane)).
491grandparent(mum(mum(jo)),mum(mum(jane))).
492grandparent(peter,bob).
494grandparent(peter,mum(bob)).
498grandparent(peter,mum(mum(bob))).
499grandparent(peter,jo).
501grandparent(peter,mum(jo)).
505grandparent(peter,mum(mum(jo))).
506grandparent(peter,peter).
508grandparent(peter,mum(peter)).
512grandparent(peter,mum(mum(peter))).
513grandparent(peter,jane).
515grandparent(peter,mum(jane)).
519grandparent(peter,mum(mum(jane))).
548grandparent(mum(peter),bob).
550grandparent(mum(peter),mum(bob)).
554grandparent(mum(peter),mum(mum(bob))).
555grandparent(mum(peter),jo).
557grandparent(mum(peter),mum(jo)).
561grandparent(mum(peter),mum(mum(jo))).
562grandparent(mum(peter),peter).
564grandparent(mum(peter),mum(peter)).
568grandparent(mum(peter),mum(mum(peter))).
569grandparent(mum(peter),jane).
571grandparent(mum(peter),mum(jane)).
575grandparent(mum(peter),mum(mum(jane))).
657grandparent(mum(mum(peter)),bob).
659grandparent(mum(mum(peter)),mum(bob)).
663grandparent(mum(mum(peter)),mum(mum(bob))).
664grandparent(mum(mum(peter)),jo).
666grandparent(mum(mum(peter)),mum(jo)).
670grandparent(mum(mum(peter)),mum(mum(jo))).
672grandparent(mum(mum(peter)),mum(peter)).
676grandparent(mum(mum(peter)),mum(mum(peter))).
677grandparent(mum(mum(peter)),jane).
679grandparent(mum(mum(peter)),mum(jane)).
683grandparent(mum(mum(peter)),mum(mum(jane))).
684grandparent(jane,bob).
686grandparent(jane,mum(bob)).
690grandparent(jane,mum(mum(bob))).
691grandparent(jane,jo).
693grandparent(jane,mum(jo)).
697grandparent(jane,mum(mum(jo))).
698grandparent(jane,peter).
700grandparent(jane,mum(peter)).
704grandparent(jane,mum(mum(peter))).
705grandparent(jane,jane).
707grandparent(jane,mum(jane)).
711grandparent(jane,mum(mum(jane))).
740grandparent(mum(jane),bob).
742grandparent(mum(jane),mum(bob)).
746grandparent(mum(jane),mum(mum(bob))).
747grandparent(mum(jane),jo).
749grandparent(mum(jane),mum(jo)).
753grandparent(mum(jane),mum(mum(jo))).
754grandparent(mum(jane),peter).
756grandparent(mum(jane),mum(peter)).
760grandparent(mum(jane),mum(mum(peter))).
761grandparent(mum(jane),jane).
763grandparent(mum(jane),mum(jane)).
767grandparent(mum(jane),mum(mum(jane))).
849grandparent(mum(mum(jane)),bob).
851grandparent(mum(mum(jane)),mum(bob)).
855grandparent(mum(mum(jane)),mum(mum(bob))).
856grandparent(mum(mum(jane)),jo).
858grandparent(mum(mum(jane)),mum(jo)).
862grandparent(mum(mum(jane)),mum(mum(jo))).
863grandparent(mum(mum(jane)),peter).