/* Learning memb/2 with non-ground background knowledge */ /* Due to implementation reasons lists are not allowed as predicate agruments. However at a deeper level this is ok */ background([memb/2,components/3]). propositional([]). /* Examples of the target predicate */ memb(a(1),a([1,2,3])). memb(a(3),a([1,2,3])). memb(a(3),a([2,3])). memb(a(1),a([1,2])). memb(a(1),a([1,3])). memb(a(1),a([1])). memb(a(1),a([1,2,3])). memb(a(2),a([1,2,3])). memb(a(3),a([1,3])). memb(a(3),a([3])). memb(a(2),a([2,3])). /* Background knowledge for 3-element ordered lists */ components(a([Head|Tail]),a(Head),a(Tail)) :- sublist([Head|Tail],[1,2,3]). sublist([H|T],[H|V]) :- sublist(T,V). sublist(T,[_|V]) :- !, sublist(T,V). sublist([],_).