["parent(x,y)<=father(x,y)","parent(x,y)<=mother(x,y)","ancestor(x,y)<=parent(x,y)","ancestor(x,z)<=ancestor(x,y)&parent(y,z)","father(John,Johnson)","mother(Mary,Johnson)","father(George,John)","father(John,Jake)",""] addRule:parent(x,y)<=father(x,y){} addRule:parent(x,y)<=mother(x,y){} addRule:ancestor(x,y)<=parent(x,y){} addRule:ancestor(x,z)<=ancestor(x,y)&parent(y,z){} addFact:father(John,Johnson) addFact:mother(Mary,Johnson) addFact:father(George,John) addFact:father(John,Jake) =====facts======== father(John,Johnson) mother(Mary,Johnson) father(George,John) father(John,Jake) ========rules======= parent(x,y)<=father(x,y){} parent(x,y)<=mother(x,y){} ancestor(x,y)<=parent(x,y){} ancestor(x,z)<=ancestor(x,y)&parent(y,z){} ======forwardChaining============ addFact:parent(John,Johnson) parent(x,y)<=father(x,y){};father(John,Johnson)={"x":"John","y":"Johnson"} addFact:parent(Mary,Johnson) parent(x,y)<=mother(x,y){};mother(Mary,Johnson)={"x":"Mary","y":"Johnson"} addFact:parent(George,John) parent(x,y)<=father(x,y){};father(George,John)={"x":"George","y":"John"} addFact:parent(John,Jake) parent(x,y)<=father(x,y){};father(John,Jake)={"x":"John","y":"Jake"} addFact:ancestor(John,Johnson) ancestor(x,y)<=parent(x,y){};parent(John,Johnson)={"x":"John","y":"Johnson"} addRule:ancestor(x,z)<=ancestor(x,y)&parent(y,z){"y":"John","z":"Johnson"} ancestor(x,z)<=ancestor(x,y)&parent(y,z){};parent(John,Johnson)={"y":"John","z":"Johnson"} addFact:ancestor(Mary,Johnson) ancestor(x,y)<=parent(x,y){};parent(Mary,Johnson)={"x":"Mary","y":"Johnson"} addRule:ancestor(x,z)<=ancestor(x,y)&parent(y,z){"y":"Mary","z":"Johnson"} ancestor(x,z)<=ancestor(x,y)&parent(y,z){};parent(Mary,Johnson)={"y":"Mary","z":"Johnson"} addFact:ancestor(George,John) ancestor(x,y)<=parent(x,y){};parent(George,John)={"x":"George","y":"John"} addRule:ancestor(x,z)<=ancestor(x,y)&parent(y,z){"y":"George","z":"John"} ancestor(x,z)<=ancestor(x,y)&parent(y,z){};parent(George,John)={"y":"George","z":"John"} addFact:ancestor(John,Jake) ancestor(x,y)<=parent(x,y){};parent(John,Jake)={"x":"John","y":"Jake"} addRule:ancestor(x,z)<=ancestor(x,y)&parent(y,z){"y":"John","z":"Jake"} ancestor(x,z)<=ancestor(x,y)&parent(y,z){};parent(John,Jake)={"y":"John","z":"Jake"} addRule:ancestor(x,z)<=ancestor(x,y)&parent(y,z){"x":"John","y":"Johnson"} ancestor(x,z)<=ancestor(x,y)&parent(y,z){};ancestor(John,Johnson)={"x":"John","y":"Johnson"} addRule:ancestor(x,z)<=ancestor(x,y)&parent(y,z){"x":"Mary","y":"Johnson"} ancestor(x,z)<=ancestor(x,y)&parent(y,z){};ancestor(Mary,Johnson)={"x":"Mary","y":"Johnson"} addRule:ancestor(x,z)<=ancestor(x,y)&parent(y,z){"x":"George","y":"John"} ancestor(x,z)<=ancestor(x,y)&parent(y,z){};ancestor(George,John)={"x":"George","y":"John"} addFact:ancestor(George,Johnson) ancestor(x,z)<=ancestor(x,y)&parent(y,z){"y":"John","z":"Johnson"};ancestor(George,John)={"y":"John","z":"Johnson","x":"George"} addFact:ancestor(George,Jake) ancestor(x,z)<=ancestor(x,y)&parent(y,z){"y":"John","z":"Jake"};ancestor(George,John)={"y":"John","z":"Jake","x":"George"} addRule:ancestor(x,z)<=ancestor(x,y)&parent(y,z){"x":"John","y":"Jake"} ancestor(x,z)<=ancestor(x,y)&parent(y,z){};ancestor(John,Jake)={"x":"John","y":"Jake"} addRule:ancestor(x,z)<=ancestor(x,y)&parent(y,z){"x":"George","y":"Johnson"} ancestor(x,z)<=ancestor(x,y)&parent(y,z){};ancestor(George,Johnson)={"x":"George","y":"Johnson"} addRule:ancestor(x,z)<=ancestor(x,y)&parent(y,z){"x":"George","y":"Jake"} ancestor(x,z)<=ancestor(x,y)&parent(y,z){};ancestor(George,Jake)={"x":"George","y":"Jake"} ======forwardChaining============ =====facts======== father(John,Johnson) mother(Mary,Johnson) father(George,John) father(John,Jake) parent(John,Johnson) parent(Mary,Johnson) parent(George,John) parent(John,Jake) ancestor(John,Johnson) ancestor(Mary,Johnson) ancestor(George,John) ancestor(John,Jake) ancestor(George,Johnson) ancestor(George,Jake) ========rules======= parent(x,y)<=father(x,y){} parent(x,y)<=mother(x,y){} ancestor(x,y)<=parent(x,y){} ancestor(x,z)<=ancestor(x,y)&parent(y,z){} ancestor(x,z)<=ancestor(x,y)&parent(y,z){"y":"John","z":"Johnson"} ancestor(x,z)<=ancestor(x,y)&parent(y,z){"y":"Mary","z":"Johnson"} ancestor(x,z)<=ancestor(x,y)&parent(y,z){"y":"George","z":"John"} ancestor(x,z)<=ancestor(x,y)&parent(y,z){"y":"John","z":"Jake"} ancestor(x,z)<=ancestor(x,y)&parent(y,z){"x":"John","y":"Johnson"} ancestor(x,z)<=ancestor(x,y)&parent(y,z){"x":"Mary","y":"Johnson"} ancestor(x,z)<=ancestor(x,y)&parent(y,z){"x":"George","y":"John"} ancestor(x,z)<=ancestor(x,y)&parent(y,z){"x":"John","y":"Jake"} ancestor(x,z)<=ancestor(x,y)&parent(y,z){"x":"George","y":"Johnson"} ancestor(x,z)<=ancestor(x,y)&parent(y,z){"x":"George","y":"Jake"}