/* Inductive Logic Programming in Picat v3. This is a port of the program minihyper.pl + examples in I. Bratko, "Prolog Programming for Artificial Intelligence", 4th edn., Pearson Education / Addison-Wesley 2012 Page 495ff (Figure 21.4) The module minihyper_v3 is defined in See http://hakank.org/picat/minihyper_v3.pi Output: """ MaxD = 0 MaxD = 1 MaxD = 2 MaxD = 3 MaxD = 4 [[has_daughter(_a58),parent(_a58,_ae8),female(_ae8)] / [_a58,_ae8]] """ [[has_daughter(A),parent(A,B),female(B)] / [A,B]] This Picat model was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import minihyper_v3. main => go. go ?=> induce(H), println(H), fail, nl. go => true. % Default parameter settings max_proof_length( 6). % Max. proof length, counting calls to 'non-prolog' pred. max_clause_length( 3). % Max. number of literals in a clause % hakank: This is the input data for the problem % Fig 21.1 % Figure 21.1 A definition of the problem of learning predicate has_daughter. % Learning from family relations % Background knowledge backliteral( parent(X,Y), [X,Y]). % A background literal with vars. [X,Y] backliteral( male(X), [X]). backliteral( female(X), [X]). prolog_predicate( parent(_,_)). % Goal parent(_,_) executed directly by Prolog prolog_predicate( male(_)). prolog_predicate( female(_)). parent( pam, bob). parent( tom, bob). parent( tom, liz). parent( bob, ann). parent( bob, pat). parent( pat, jim). parent( pat, eve). female( pam). female( liz). female( ann). female( pat). female( eve). male( tom). male( bob). male( jim). % Positive examples ex( has_daughter(tom)). % Tom has a daughter ex( has_daughter(bob)). ex( has_daughter(pat)). % Negative examples nex( has_daughter(pam)). % Pam doen't have a daughter nex( has_daughter(jim)). start_hyp( [ [has_daughter(X)] / [X] ] ). % Starting hypothesis % hakank: Another a little more complex example from page 500 with