22:- module( yadlr, [check_membership/5, check_types/5, check_members/5,
   23		   yadlr_concept/2, yadlr_relation/2, yadlr_instance/2,
   24		   yadlr_assert/3, yadlr_init/1,
   25		   set_debug_msgs/1, set_depth_limit/1,
   26		   set_proof_tree_log/1, unset_proof_tree_log/0] ).
   33possible_combination( resolution, alg_lukasiewicz ).
   34possible_combination( settheor,   alg_lukasiewicz ).
   35
   36:- user:use_inference_engine( Engine ), atom( Engine ),
   37	user:use_algebra( Alg ), atom( Alg ),
   38	possible_combination( Engine, Alg ),
   39	use_module(Engine).
   46check_membership( KB, Instance, Concept, Degree, Restr ) :-
   47        % atom(KB),
   48	yadlr_concept_name( KB, Concept ),
   49	yadlr_instance_name( KB, Instance ),
   50	T =.. [Concept,Instance],
   51	prove( KB, (T), Degree, [], Restr ),
   52	!.
   53
   54check_types_rec( _, _, [], [], [], [] ).
   55check_types_rec( KB, Instance, [Degree|DRest], [H|Rest], [H|Concepts], [ExtraRestr|ExtraRestrRest] ) :-
   56	check_membership( KB, Instance, H, Degree, ExtraRestr ),
   57	!,
   58	check_types_rec( KB, Instance, DRest, Rest, Concepts, ExtraRestrRest ).
   59check_types_rec( KB, Instance, Degrees, [_|Rest], Concepts, ExtraRestr ) :-
   60	check_types_rec( KB, Instance, Degrees, Rest, Concepts, ExtraRestr ).
   61
   62check_types( KB, Instance, Degrees, Concepts, Restr ) :-
   63	findall( C, yadlr_retrieve_concept(KB, C), CList ),
   64	check_types_rec( KB, Instance, Degrees, CList, Concepts, Restr ).
   65	
   66check_members_rec( _, _, [], [], [], [] ).
   67check_members_rec( KB, Concept, [Degree|DRest], [H|Rest], [H|Instances], [Restr|RestrRest] ) :-
   68	check_membership( KB, H, Concept, Degree, Restr ),
   69	!,
   70	check_members_rec( KB, Concept, DRest, Rest, Instances, RestrRest ).
   71check_members_rec( KB, Concept, Degrees, [_|Rest], Instances, Restr ) :-
   72	check_members_rec( KB, Concept, Degrees, Rest, Instances, Restr ).
   73
   74check_members( KB, Concept, Degree, Instances, Restr ) :-
   75	findall( I, yadlr_retrieve_instance(KB, I), IList ),
   76	check_members_rec( KB, Concept, Degree, IList, Instances, Restr ).
   77
   78	%use_depth( Depth ),
   79	%depth_bound_call( prove_clauses(KB,Clauses,Open), Depth ).
   80
   81calleverybody( [] ).
   82calleverybody( [T|Rest] ) :-
   83	nonvar( T ),
   84	call( T ),
   85	calleverybody( Rest )