Created
April 7, 2018 02:03
-
-
Save cmungall/67e9b6e58d747d784759d0ddff0dee53 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fact(is_a(a,b)). | |
| fact(is_a(b,c)). | |
| rule((is_aT(A,B) :- is_a(A,B))). | |
| rule((is_aT(A,B) :- is_a(A,Z),is_aT(Z,B))). | |
| prove(Goal,[Goal]) :- | |
| fact(Goal). | |
| prove(Goal, [Rule|Steps]) :- | |
| Rule = rule( (Goal :- Body) ), | |
| Rule, | |
| prove(Body, Steps). | |
| prove((A,B), Steps) :- | |
| prove(A,Steps1), | |
| prove(B,Steps2), | |
| % append is ugly - should really return a proof tree not list | |
| append(Steps1,Steps2,Steps). | |
| prove((G;_), Steps) :- | |
| prove(G,Steps). | |
| prove((_;G), Steps) :- | |
| prove(G,Steps). | |
| t :- | |
| prove(is_aT(a,c),Steps), | |
| writeln(proof=Steps). | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To test: