1/**********************************************************************
    2 *
    3 * @(#) examples.pl 1.5@(#)
    4 *
    5 */
    6
    7example(1001) :-
    8	makeEnvironment('ex1','von HJO'),
    9	initEnvironment,
   10	defconcept(fatherAcademic,and([male,some(child,academic)])),
   11	defconcept(grandfatherAcademic,and([male,some(child,fatherAcademic)])),
   12	assert_ind(tom,tim,child),
   13	assert_ind(tim,mike,child),
   14	assert_ind(mike,male),
   15	assert_ind(mike,academic),
   16	assert_ind(tim,male),
   17	assert_ind(tom,male).
   18%%% Example  2:
   19%%% KRIS-Example
   20% setof(C,ask(elementOf(mary,C)),L)
   21% gives L = ['top',grandparent,parent,parent_with_sons_only,
   22%            parent_with_two_children,person] 
   23% in Total runtime 12.167 sec. (05.06.92)
   24example(1002) :-
   25	makeEnvironment('ex2','krisExample'),
   26	initEnvironment,
   27	defprimconcept(male),
   28	defprimconcept(female,not(male)),
   29	defconcept(males,some(sex,male)),
   30	defconcept(females,some(sex,female)),
   31	defprimconcept(person,some(sex,or([male,female]))),
   32	defconcept(parent,and([person,some(child,person)])),
   33	defconcept(mother,and([parent,some(sex,female)])),
   34	defconcept(father,and([parent,not(mother)])),
   35	defconcept(grandparent,and([parent,some(child,parent)])),
   36	defconcept(parent_with_sons_only,and([parent,all(child,some(sex,male))])),
   37	defconcept(parent_with_two_children,and([parent,atleast(2,child)])),
   38	assert_ind(tom,father),
   39	assert_ind(tom,peter,child),
   40	assert_ind(tom,harry,child),
   41	assert_ind(mary,parent_with_sons_only),
   42	assert_ind(mary,tom,child),
   43	assert_ind(mary,chris,child).
   44%%% Example  3:
   45% inconsistent([])
   46% succeeds in Total runtime 0.000 sec. (05.06.92)
   47example(1003) :-
   48	makeEnvironment('ex3','Inconsistence'),
   49	initEnvironment,
   50	defprimconcept(parent_with_one_child,atmost(1,child)),
   51	assert_ind(mary,parent_with_one_child),
   52	assert_ind(mary,tom,child),
   53	assert_ind(mary,chris,child).
   54%%% Example  4:
   55% Modal Operators
   56example(1004) :-
   57	makeEnvironment('ex4','Inconsistence'),
   58	initEnvironment,
   59	defconcept([b(believe,a1)],c1,b(want,a2,car)),
   60	defconcept([b(believe,a1)],c2,b(want,a3,car)),
   61	defprimconcept([b(believe,a1)],c1,c2),
   62	assert_ind([b(believe,a1)],audi,c1).
   63%%% Example  5:
   64% subsumes([],c1,c2).
   65% fails    in Total runtime 0.050 sec. (05.06.92)
   66% subsumes([],c2,c1).
   67% succeeds in Total runtime 0.050 sec. (05.06.92)
   68example(1005) :-
   69	makeEnvironment('ex5','Subsumption'),
   70	initEnvironment,
   71	defconcept(c1,and([all(r,a),all(and([r,q]),b)])),
   72	defconcept(c2,all(and([r,q]),and([a,b]))).
   73%%% Example  6:
   74% subsumes([],c1,c2).
   75% fails    in Total runtime 0.033 sec. (05.06.92)
   76% subsumes([],c2,c1).
   77% succeeds in Total runtime 0.033 sec. (05.06.92)
   78example(1006) :-
   79	makeEnvironment('ex6','Subsumption'),
   80	initEnvironment,
   81	defrole(r1,and([r,q])),
   82	defconcept(d0,and([a,b])),
   83	defconcept(d1,all(r,a)),
   84	defconcept(d2,all(r1,b)),
   85	defconcept(c1,and([d1,d2])),
   86	defconcept(c2,all(r1,d0)).
   87%%% Example  7:
   88example(1007) :-
   89	makeEnvironment('ex7','Subsumption'),
   90	initEnvironment,
   91	defconcept(c1,atleast(3,r)),
   92	defconcept(c2,and([all(and([r,p]),a),all(and([r,q]),not(a)),atleast(2,and([r,p])),atleast(2,and([r,q]))])).
   93%%% Example  8;
   94% ask(elementOf(tom,heterosexual))
   95% succeeds in Total runtime 0.033 sec. (05.06.92)
   96example(1008) :-
   97	makeEnvironment('ex8','Disjunction of complementary concepts'),
   98	initEnvironment,
   99	defprimconcept(male),
  100	defconcept(female,not(male)),
  101	defconcept(heterosexual,or([male,female])).
  102%%% Example  9:
  103% Variation of the KRIS-Example
  104% ask(elementOf(chris,male))
  105% succeeds in Total runtime 0.000 sec. (05.06.92)
  106example(1009) :-
  107	makeEnvironment('ex9','Variation of the KRIS example'),
  108	initEnvironment,
  109	defprimconcept(male),
  110	defprimconcept(female,not(male)),
  111	defprimconcept(person,or([male,female])),
  112	defconcept(parent,and([person,some(child,person)])),
  113	defconcept(mother,and([parent,female])),
  114	defconcept(father,and([parent,not(mother)])),
  115	defconcept(grandparent,and([parent,some(child,parent)])),
  116	defconcept(parent_with_sons_only,and([parent,all(child,male)])),
  117	defconcept(parent_with_two_children,and([parent,atleast(2,child)])),
  118	assert_ind(tom,father),
  119	assert_ind(tom,peter,child),
  120	assert_ind(tom,harry,child),
  121	assert_ind(mary,parent_with_sons_only),
  122	assert_ind(mary,tom,child),
  123	assert_ind(mary,chris,child).
  124%%% Example 10:
  125% ask(elementOf(tom,c2)) 
  126% succeeds in Total runtime 0.017 sec. (05.06.92)
  127example(10010) :-
  128	makeEnvironment('ex10','Inverse Role'),
  129	initEnvironment,
  130	defrole(r2,inverse(r1)),
  131	defconcept(c1,all(r1,c2)),
  132	defconcept(c3,some(r2,c1)),
  133	assert_ind(tom,c3).
  134%%% Example 11:
  135% inconsistent([])
  136% succeeds in Total runtime 0.034 sec. (05.06.92)
  137example(10011) :-
  138	makeEnvironment('ex11','Inconsistence'),
  139	initEnvironment,
  140	defconcept(c1,and([atleast(2,child),atmost(1,child)])),
  141	assert_ind(tom,c1).
  142%%% Example 12:
  143% subsumes([],c1,c2)
  144% succeeds in Total runtime 0.050 sec. (05.06.92)
  145% subsumes([],c2,c1)
  146% fails    in Total runtime 0.200 sec. (05.06.92)
  147example(10012) :-
  148	makeEnvironment('ex12','Subsumption'),
  149	initEnvironment,
  150	defconcept(c1,and([person,atleast(2,child)])),
  151	defconcept(c2,and([person,atleast(3,restr(child,lawyer))])).
  152%%% Example 13:
  153% subsumes([],c1,c2)
  154% succeeds in Total runtime 0.117 sec. (05.06.92)
  155example(10013) :-
  156	makeEnvironment('ex13','Subsumption'),
  157	initEnvironment,
  158	defconcept(c1,and([person,atmost(4,restr(child,doctor))])),
  159	defconcept(c2,and([person,female,atmost(3,child)])).
  160%%% Example 14:
  161% subsumes([],c1,c2)
  162% succeeds ???
  163% subsumes([],c2,c1)
  164% succeeds in Total runtime 0.250 sec. (06.06.92)
  165example(10014) :-
  166	makeEnvironment('ex14','Subsumption'),
  167	initEnvironment,
  168	defconcept(c1,atmost(0,restr(r,and([atleast(3,s1),atleast(4,s2)])))),
  169	defconcept(c2,all(restr(r,atleast(2,s1)),atmost(2,s2))).
  170%%% Example 15:
  171% subsumes([],c2,c1)
  172% succeeds in Total runtime 0.067 sec. (05.06.92)
  173example(10015) :-
  174	makeEnvironment('ex15','Subsumption'),
  175	initEnvironment,
  176	defconcept(c1,and([person,all(friend,doctor),all(restr(friend,doctor),atleast(1,speciality))])),
  177	defconcept(c2,and([person,all(friend,atleast(1,speciality))])).
  178%%% Example 16:
  179% subsumes([],c2,c1)
  180% succeeds in Total runtime 0.450 sec. (06.06.92)
  181example(10016) :-
  182	makeEnvironment('ex16','Subsumption'),
  183	initEnvironment,
  184	defconcept(c1,and([atleast(1,restr(child,lawyer)),atleast(1,restr(child,doctor))])),
  185	defconcept(c2,or([atleast(2,child),atleast(1,restr(child,and([lawyer,doctor])))])).
  186%%% Example 17:
  187% subsumes([],c2,c1)
  188% succeeds in Total runtime 0.034 sec. (05.06.92)
  189example(10017) :-
  190	makeEnvironment('ex17','Subsumption'),
  191	initEnvironment,
  192	defconcept(c1,some(and([child,friend]),doctor)),
  193	defconcept(c2,and([some(child,doctor),some(friend,doctor)])).
  194%%% Example 18:
  195% ask(elementOf(mary,c4))
  196% succeeds in Total runtime 0.117 sec. (05.06.92)
  197example(10018) :-
  198	makeEnvironment('ex18','Number restrictions'),
  199	initEnvironment,
  200	defprimconcept(female),
  201	defconcept(male,not(female)),
  202	defconcept(c3,and([atmost(4,child),atleast(2,restr(child,female))])),
  203	defconcept(c4,atmost(2,restr(child,female))),
  204	assert_ind(tom,male),
  205	assert_ind(peter,male),
  206	assert_ind(mary,peter,child),
  207	assert_ind(mary,tom,child),
  208	assert_ind(mary,c3).
  209%%% Example 19
  210% ask(elementOf(amy,female))
  211% succeeds in Total runtime 0.067 sec. (06.06.92)
  212example(10019) :-
  213	makeEnvironment('ex19','Number restrictions'),
  214	initEnvironment,
  215	defprimconcept(female),
  216	defconcept(male,not(female)),
  217	defconcept(c5,and([atmost(2,restr(child,male))])),
  218	assert_ind(tom,male),
  219	assert_ind(peter,male),
  220	assert_ind(mary,tom,child),
  221	assert_ind(mary,peter,child),
  222	assert_ind(mary,amy,child),
  223	assert_ind(mary,c5).
  224%%% Example 20
  225% inconsistent([])
  226% succeeds in Total runtime 5.167 sec. (05.06.92)
  227example(10020) :-
  228	makeEnvironment('ex20','Number restrictions'),
  229	initEnvironment,
  230	defprimconcept(female),
  231	defconcept(male,not(female)),
  232	defconcept(c5,and([atmost(2,restr(child,male)),atmost(1,restr(child,female))])),
  233	assert_ind(tom,male),
  234	assert_ind(peter,male),
  235	assert_ind(mary,tom,child),
  236	assert_ind(mary,peter,child),
  237	assert_ind(mary,amy,child),
  238	assert_ind(mary,jane,child),
  239	assert_ind(mary,c5).
  240%%% Example 21
  241% ask(elementOf(betty,female))
  242example(10021) :-
  243	makeEnvironment('ex21','Number restrictions'),
  244	initEnvironment,
  245	defprimconcept(female),
  246	defconcept(male,not(female)),
  247	defconcept(c1,and([atmost(1,restr(teacher,male)),atmost(1,restr(teacher,female))])),
  248	defconcept(c2,and([atmost(2,restr(teacher,male)),atmost(1,restr(teacher,female))])),
  249	assert_ind(tom,c1),
  250	assert_ind(sue,c1),
  251	assert_ind(david,c2),
  252	assert_ind(tom,betty,teacher),
  253	assert_ind(tom,peter,teacher),
  254	assert_ind(sue,betty,teacher),
  255	assert_ind(sue,chris,teacher),
  256	assert_ind(david,betty,teacher),
  257	assert_ind(david,chris,teacher),
  258	assert_ind(david,peter,teacher).
  259%%% Example 22
  260% ask(elementOf(amy,female))
  261% should succeeds
  262% but fails in the current implementation
  263example(10022) :-
  264	makeEnvironment('ex22','Number restrictions'),
  265	initEnvironment,
  266	defprimconcept(female),
  267	defconcept(male,not(female)),
  268	defrole(maleTeacher,restr(teacher,male)),
  269	defrole(femaleTeacher,restr(teacher,female)),
  270	defconcept(c1,and([atmost(1,maleTeacher),atmost(1,femaleTeacher)])),
  271	defconcept(c2,atmost(1,maleTeacher)),
  272	assert_ind(tom,c2),
  273	assert_ind(sue,c1),
  274	assert_ind(tom,betty,teacher),
  275	assert_ind(tom,chris,teacher),
  276	assert_ind(tom,robin,teacher),
  277	assert_ind(sue,betty,teacher),
  278	assert_ind(sue,chris,teacher).
  279%%% Example 23
  280% is a variant of example 23 with user provided names for the 
  281% restricted roles.
  282% ask(elementOf(amy,female))
  283% should succeeds
  284% but fails in the current implementation
  285example(10023) :-
  286	makeEnvironment('ex23','Number restrictions'),
  287	initEnvironment,
  288	defprimconcept(female),
  289	defconcept(male,not(female)),
  290	defprimrole(maleTeacher,teacher),
  291	defprimrole(femaleTeacher,teacher),
  292	defconcept(c1,and([atmost(1,maleTeacher),atmost(1,femaleTeacher)])),
  293	defconcept(c2,atmost(1,maleTeacher)),
  294	assert_ind(tom,c2),
  295	assert_ind(sue,c1),
  296	assert_ind(tom,betty,teacher),
  297	assert_ind(tom,chris,teacher),
  298	assert_ind(tom,robin,teacher),
  299	assert_ind(sue,betty,teacher),
  300	assert_ind(sue,chris,teacher).
  301%%% Example 24
  302% ask(elementOf(audi,c3))
  303% succeeds in Total runtime 1.634 sec. (24.06.92)
  304example(10024) :-
  305	makeEnvironment('ex24','Modal operators'),
  306	initEnvironment,	
  307	modalAxioms(kd45,believe,a1),
  308	defconcept(c1,b(believe,a1,auto)),
  309	defconcept(c3,b(believe,a1,c1)),
  310	defconcept([b(believe,a1)],c1,b(believe,a1,auto)),
  311	defconcept([b(believe,a1)],c3,b(believe,a1,c1)),
  312	assert_ind(audi,c1).
  313%%% Example 25
  314% not(ask(elementOf(audi,c3)))
  315% succeeds in Total runtime 0.033 sec. (24.06.92)
  316example(10025) :-
  317	makeEnvironment('ex25','Modal operators'),
  318	initEnvironment,	
  319	modalAxioms(kd45,believe,a1),
  320	defconcept([b(believe,a1)],c1,b(believe,a1,auto)),
  321	defconcept([b(believe,a1)],c3,b(believe,a1,c1)),
  322	assert_ind(audi,c1).
  323%%% Example 26
  324% subsumes([],c2,c1)
  325% succeeds in Total runtime 0.034 sec. (24.06.92)
  326% not(subsumes([],c1,c2))
  327% succeeds in Total runtime 1.333 sec. (24.06.92)
  328example(10026) :-
  329	makeEnvironment('ex27','Subsumption'),
  330	initEnvironment,
  331	defconcept(c1,atmost(0,r)),
  332	defconcept(c2,all(r,c5)).
  333%%% Example 27
  334% subsumes([],c2,c1) 
  335% succeeds in Total runtime 0.067 sec. (24.06.92)
  336% not(subsumes([],c1,c2))
  337% succeeds
  338example(10027) :-
  339	makeEnvironment('ex28','Subsumption'),
  340	initEnvironment,
  341	defconcept(c1,not(some(r,'top'))),
  342	defconcept(c2,all(r,c5)).
  343%%% Example 28
  344% ask(ex28,[b(believe,john)],elementOf(audi,auto),P)
  345% succeeds
  346example(10028) :-
  347	makeEnvironment('ex28','Modal operators'),
  348	initEnvironment,	
  349	modalAxioms(kd45,believe,a1),
  350	modalAxioms(kd45,believe,all),
  351	defprimconcept(auto),
  352	assert_ind([b(believe,all)],audi,auto).
  353%%% Example 29
  354% is a variant of example 23 with a more restricted definition of c1
  355% ask(elementOf(amy,female))
  356% should succeeds
  357% but fails in the current implementation
  358example(10029) :-
  359	makeEnvironment('ex29','Number restrictions'),
  360	initEnvironment,
  361	defprimconcept(female),
  362	defconcept(male,not(female)),
  363	defprimrole(teacher),
  364	defrole(maleTeacher,restr(teacher,male)),
  365	defrole(femaleTeacher,restr(teacher,female)),
  366	defconcept(c1,and([atmost(1,maleTeacher),atmost(2,femaleTeacher)])),
  367	assert_ind(tom,c1),
  368	assert_ind(sue,c1),
  369	assert_ind(tom,betty,teacher),
  370	assert_ind(tom,chris,teacher),
  371	assert_ind(tom,robin,teacher),
  372	assert_ind(sue,betty,teacher),
  373	assert_ind(sue,chris,teacher).
  374example(10030) :-
  375	makeEnvironment('ex30','Number restrictions'),
  376	initEnvironment,
  377	defprimconcept(female),
  378	defrole(maleTeacher,restr(teacher,not(female))),
  379	defrole(femaleTeacher,restr(teacher,female)),
  380	defconcept(c1,and([atmost(1,maleTeacher),atmost(1,femaleTeacher)])),
  381	defconcept(c2,atmost(1,maleTeacher)),
  382	assert_ind(tom,c2),
  383	assert_ind(sue,c1),
  384	assert_ind(tom,betty,teacher),
  385	assert_ind(tom,chris,teacher),
  386	assert_ind(tom,robin,teacher),
  387	assert_ind(sue,betty,teacher),
  388	assert_ind(sue,chris,teacher).
  389%%% Example 31
  390% First test example for defclosed
  391% ask(elementOf(tom,onlyMaleChildren))
  392% succeeds
  393example(10031) :-
  394	makeEnvironment('ex31','defclosed'),
  395	initEnvironment,
  396	defconcept(onlyMaleChildren,all(child,male)),
  397	assert_ind(tom,peter,child),
  398	assert_ind(tom,chris,child),
  399	assert_ind(tom,tim,child),
  400	assert_ind(peter,male),
  401	assert_ind(chris,male),
  402	assert_ind(tim,male),
  403	defclosed(tom,_Y,child).
  404%%% Example 32
  405% First test example for abduction
  406% abduce(elementOf(robin,male),H,E)
  407% abduce(elementOf(robin,female),H,E)
  408example(10032) :-
  409	makeEnvironment('ex32','abduction'),
  410	initEnvironment,
  411	defconcept(male,not(female)).
  412%%% Example 33
  413% Second test example for abduction
  414% abduce(elementOf(nixon,dove),H,E)
  415% abduce(elementOf(nixon,hawk),H,E)
  416% gives unexpected results!!!
  417example(10033) :-
  418	makeEnvironment('ex33','abduction'),
  419	initEnvironment,
  420	defconcept(c1,and([quaker,normalQuaker])),
  421	defconcept(c2,and([republican,normalRepublican])),
  422	defprimconcept(c1,dove),
  423	defprimconcept(c2,hawk),
  424	assert_ind(nixon,quaker),
  425	assert_ind(nixon,republican).
  426%%% Example 34
  427% The following gives an inconsistent specification of
  428% the penguin - bird problem. So
  429% inconsistent(ex34)
  430% succeeds
  431example(10034) :-
  432	makeEnvironment('ex34',abduction),
  433	initEnvironment,
  434	defprimconcept(penguin,and([bird,not(fly)])),
  435	defprimconcept(bird,fly),
  436	assert_ind(tweety,penguin),
  437	assert_ind(john,bird).
  438%%% Example 35
  439% This is a consistent specification of the penguin - bird problem.
  440% abduce(ex35,[],elementOf(john,fly),H,E).
  441% succeeds with
  442% H = [in(env(e1),rn(_7982,_7983,_7984,_7985),modal([]),normalBird,john,
  443%         hyp(_7989),ab(_7991),call(_7993),
  444%         proved(in([],normalBird,john),hyp(_7989),basedOn(_8005)))],
  445% E = proved(in([],fly,john),hyp([]),
  446%            basedOn(and([proved(in([],bird,john),hyp([]),basedOn(abox)),
  447%                         proved(in([],normalBird,john),hyp([]),
  448%     basedOn(usingAbHyp(in(env(e1),rn(_7525,_7526,_7527,_7528),modal([]),
  449%                           normalBird,john,hyp(_7532),ab(_7534),call(_7536),
  450%                           proved(in([],normalBird,john),hyp(_7532),
  451%                           basedOn(_7548))))))])))
  452% and
  453% abduce(ex35,[],elementOf(tweety,fly),H,E).
  454% fails
  455example(10035) :-
  456	makeEnvironment('ex35',abduction),
  457	initEnvironment,
  458	defprimconcept(penguin,and([bird,not(normalBird)])),
  459	defprimconcept(and([bird,normalBird]),fly),
  460	assert_ind(tweety,penguin),
  461	assert_ind(john,bird).
  462%%% Example 36
  463% Variant of example 33 giving the expected results:
  464% abduce(ex36,[],elementOf(nixon,dove),H,E).
  465% succeeds with
  466% H = [in(env(e4),rn(_8077,_8078,_8079,_8080),modal([]),
  467%         normalQuaker,nixon,hyp(_8084),ab(_8086),call(_8088),
  468%         proved(in([],normalQuaker,nixon),hyp(_8084),basedOn(_8100)))],
  469% E = proved(in([],dove,nixon),hyp([]),
  470%        basedOn(and([proved(in([],quaker,nixon),hyp([]),basedOn(abox)),
  471%                     proved(in([],normalQuaker,nixon),hyp([]),
  472%           basedOn(usingAbHyp(in(env(e4),rn(_7620,_7621,_7622,_7623),
  473%                   modal([]),normalQuaker,nixon,hyp(_7627),ab(_7629),
  474%                   call(_7631),proved(in([],normalQuaker,nixon),
  475%                   hyp(_7627),basedOn(_7643))))))]))) 
  476% and
  477% abduce(ex36,[],elementOf(nixon,hawk),H,E).
  478% succeeds with
  479% H = [in(env(e4),rn(_8077,_8078,_8079,_8080),modal([]),
  480%         normalRepublican,nixon, hyp(_8084),ab(_8086),call(_8088),
  481%         proved(in([],normalRepublican,nixon),hyp(_8084),basedOn(_8100)))],
  482% E = proved(in([],dove,nixon),hyp([]),
  483%        basedOn(and([proved(in([],republican,nixon),hyp([]),basedOn(abox)),
  484%                     proved(in([],normalRepublican,nixon),hyp([]),
  485%           basedOn(usingAbHyp(in(env(e4),rn(_7620,_7621,_7622,_7623),
  486%                   modal([]),normalRepublican,nixon,hyp(_7627),ab(_7629),
  487%                   call(_7631),proved(in([],normalRepublican,nixon),
  488%                   hyp(_7627),basedOn(_7643))))))]))) 
  489example(10036) :-
  490	makeEnvironment('ex36','abduction'),
  491	initEnvironment,
  492	defprimconcept(and([quaker,normalQuaker]),dove),
  493	defprimconcept(and([republican,normalRepublican]),hawk),
  494	assert_ind(nixon,quaker),
  495	assert_ind(nixon,republican).
  496%%% Example 37
  497example(10037) :-
  498	makeEnvironment('ex37','abduction'),
  499	initEnvironment,
  500	defprimconcept(rained_last_night,grass_is_wet),
  501	defprimconcept(sprinkler_was_on,grass_is_wet),
  502	defprimconcept(grass_is_wet,shoes_are_wet).
  503%%% Example 38
  504% ask(elementOf(ideaste,c2))
  505% should succeed
  506example(10038) :-
  507	makeEnvironment('ex38','disjunctive_information'),
  508	initEnvironment,
  509	assert_ind(ideaste,oedipus,hasChild),
  510	assert_ind(oedipus,polyneikes,hasChild),
  511	assert_ind(ideaste,polyneikes,hasChild),
  512	assert_ind(polyneikes,thersandros,hasChild),
  513	assert_ind(oedipus,fatherMurderer),
  514	assert_ind(thersandros,not(fatherMurderer)),
  515	defconcept(c1,and([fatherMurderer,some(hasChild,not(fatherMurderer))])),
  516	defconcept(c2,some(hasChild,c1)).
  517%%% Example 39
  518% ask(elementOf(lucky,female))
  519% succeeds
  520example(10039) :-
  521	makeEnvironment('ex39','negation_as_failure'),
  522	initEnvironment,
  523	defrole(parentOf,inverse(childOf)),
  524	defconcept(male,not(female)),
  525	defprimconcept(and([some(parentOf,top),naf(not(female))]),female),
  526	assert_ind(mary,lucky,childOf).
  527%%% Example 40
  528% ask(elementOf(peter,richPerson))
  529% succeeds.
  530% After
  531% assert_ind(peter,poorPerson)
  532% the query
  533% ask(elementOf(peter,richPerson))
  534% fails
  535example(10040) :-
  536	makeEnvironment('ex40','negation_as_failure'),
  537	initEnvironment,
  538	defprimconcept(and([doctor,naf(not(richPerson))]),richPerson),
  539	defconcept(poorPerson,not(richPerson)),
  540	assert_ind(peter,doctor).
  541%%% Example 41
  542% ask(elementOf(tom,richPerson))
  543% succeeds.
  544% After 
  545% assert_ind(tom,poorPerson)
  546% the query
  547% ask(elementOf(tom,richPerson))
  548% fails
  549example(10041) :-
  550	makeEnvironment('ex41','negation_as_failure'),
  551	initEnvironment,
  552	defrole(doctorParentOf,restr(inverse(childOf),doctor)),
  553	defrole(childOfDoctor,inverse(r1)),
  554	defprimconcept(and([some(doctorParentOf,top),naf(not(richPerson))]),richPerson),
  555	defconcept(poorPerson,not(richPerson)),
  556	assert_ind(chris,doctor),
  557	assert_ind(chris,tom,childOf).
  558%%% Example 42
  559% ask(elementOf(audi,fourWheels))
  560% succeeds.
  561% After
  562% assert_ind(audi,fiveWheels)
  563% the query
  564% ask(elementOf(audi,fourWheels))
  565% fails
  566example(10042) :-
  567	makeEnvironment('ex42','negation_as_failure'),
  568	initEnvironment,
  569	defconcept(fourWheels,and([atleast(4,wheels),atmost(4,wheels)])),
  570	defconcept(fiveWheels,and([atleast(5,wheels),atmost(5,wheels)])),
  571	defprimconcept(and([car,naf(not(fourWheels))]),fourWheels),
  572	assert_ind(audi,car).
  573%%% Example 43
  574example(10043) :-
  575	makeEnvironment('ex43','concrete_domains'),
  576	initEnvironment,
  577	defconcept(colors,set([b,y,r])),
  578	defconcept(blueOrYellow,set([b,y])),
  579	defconcept(red,set([r])),
  580	defconcept(blue,set([b])),
  581	defconcept(yellow,set([y])),
  582	defconcept(redOrYellow,set([r,y])),
  583	defconcept(blueOrRed,set([b,r])),
  584	defconcept(yellowOrBlue,set([y,b])).
  585%%% Example 44
  586% subsumes(c2,c1)
  587% should succeed
  588example(10044) :-
  589	makeEnvironment('ex44','concrete_domains'),
  590	initEnvironment,
  591	defconcept(c1,set([a,b])),
  592	defconcept(c2,set([a,b,c])).
  593%%% Example 45
  594example(10045) :-
  595	makeEnvironment('ex45','concrete_domains'),
  596	initEnvironment,
  597	defconcept(c1,set([a,b,c])),
  598	defconcept(c2,set([a,b])),
  599	defconcept(nc2,not(c2)).
  600%%% Example 46
  601% An insufficient specification of 
  602% The bmw is either yellow, blue, or red but not yellow. 
  603% ask(elementOf(bmw,c3))
  604% fails
  605example(10046) :-
  606	makeEnvironment('ex46','concrete_domains'),
  607	initEnvironment,
  608	defconcept(c1,some(hasCol,set([yellow,blue,red]))),
  609	defconcept(c2,some(hasCol,not(set([yellow])))),
  610	defconcept(c3,some(hasCol,set([blue,red]))),
  611	assert_ind(bmw,c1),
  612	assert_ind(bmw,c2).
  613%%% Example 47
  614% A correct specification of
  615% The bmw is either yellow, blue, or red but not yellow. 
  616% ask(elementOf(bmw,c3))
  617% succeeds
  618example(10047) :-
  619	makeEnvironment('ex47','concrete_domains'),
  620	initEnvironment,
  621	defconcept(c1,and([some(hasCol,set([yellow,blue,red])),all(hasCol,set([yellow,blue,red]))])),
  622	defconcept(c2,some(hasCol,not(set([yellow])))),
  623	defconcept(c3,some(hasCol,set([blue,red]))),
  624	assert_ind(bmw,c1),
  625	assert_ind(bmw,c2).
  626example(10048) :-
  627	makeEnvironment('ex48','concrete_concepts'),
  628	initEnvironment,
  629	defconcept(oneSpouse,and([atleast(1,spouse),atmost(1,spouse)])),
  630	assert_ind(m1,oneSpouse),
  631	defprimconcept(some(inverse(spouse),set([m1])),set([g0,g1,g2])),
  632	assert_ind(g0,oneSpouse),
  633	defprimconcept(some(inverse(spouse),set([g0])),set([m1,g1,g2])),
  634	assert_ind(g1,oneSpouse),
  635	defprimconcept(some(inverse(spouse),set([g1])),set([m1,g0,g2])),
  636	assert_ind(g2,oneSpouse),
  637	defprimconcept(some(inverse(spouse),set([g2])),set([m1,g0,g1])),
  638	defconcept(zeroSH,and([atleast(0,sh),atmost(0,sh)])),
  639	defconcept(oneSH,and([atleast(1,sh),atmost(1,sh)])),
  640	defconcept(twoSH,and([atleast(2,sh),atmost(2,sh)])),
  641	assert_ind(g0,zeroSH),
  642	assert_ind(g1,oneSH),
  643	assert_ind(g2,twoSH),
  644	defprimconcept(and([some(inverse(sh),set([m1])),set([m1])]),bot),
  645	defprimconcept(and([some(inverse(sh),set([g0])),set([g0])]),bot),
  646	defprimconcept(and([some(inverse(sh),set([g1])),set([g1])]),bot),
  647	defprimconcept(and([some(inverse(sh),set([g2])),set([g2])]),bot),
  648	defprimconcept(and([some(inverse(spouse),set([m1])),some(inverse(sh),set([m1]))]),bot),
  649	defprimconcept(and([some(inverse(spouse),set([g0])),some(inverse(sh),set([g0]))]),bot),
  650	defprimconcept(and([some(inverse(spouse),set([g1])),some(inverse(sh),set([g1]))]),bot),
  651	defprimconcept(and([some(inverse(spouse),set([g2])),some(inverse(sh),set([g2]))]),bot),
  652%	defconcept(some(sh,set([m1])),some(inverse(sh),set([m1]))),
  653%	defconcept(some(sh,set([g0])),some(inverse(sh),set([g0]))),
  654%	defconcept(some(sh,set([g1])),some(inverse(sh),set([g1]))),
  655%	defconcept(some(sh,set([g2])),some(inverse(sh),set([g2]))).
  656	defrole(sh,inverse(sh)),
  657	defrole(spouse,inverse(spouse)).
  658%%% Example 49
  659% ask(elementOf(p,c4))
  660% should fail
  661example(10049) :-
  662	makeEnvironment('ex49','defaults'),
  663	initEnvironment,
  664	defconcept(c4,and([c5,c6])),
  665	defprimconcept(and([c0,naf(not(c2))]),c5),
  666	defprimconcept(and([c0,naf(not(c3))]),c6),
  667	defconcept(c1,or([not(c2),not(c3)])),
  668	assert_ind(p,c0),
  669	assert_ind(p,c1).
  670example(10050) :-
  671	makeEnvironment('ex50','complete_or'),
  672	initEnvironment,
  673	defprimconcept(c1,c0),
  674	defprimconcept(not(c1),c0).
  675example(10051) :-
  676	makeEnvironment('ex51','functional_dependencies'),
  677	initEnvironment,
  678	def(posInfl(f,d)),
  679	def(posInfl(h,f)),
  680	def(posInfl(a,b)),
  681	def(posInfl(b,c)),
  682	def(posInfl(c,d)),
  683	def(negInfl(b,e)),
  684	def(negInfl(e,d)),
  685	def(posInfl(g,e)),
  686	def(posInfl(a,g)),
  687	def(increase(a)).
  688example(10052) :-
  689	makeEnvironment('ex52','functional_dependencies'),
  690	initEnvironment,
  691	def(increase(hasCubicCapacity)),
  692	def(negInfl(withRebate,hasPrice)),
  693	def(posInfl(hasPrice,hasOverallCost)),
  694	def(posInfl(hasCubicCapacity,hasListPrice)),
  695	def(posInfl(hasListPrice,hasPrice)),
  696	def(posInfl(hasCubicCapacity,hasFuelConsumption)),
  697	def(posInfl(hasFuelConsumption,hasOverallCost)),
  698	def(posInfl(hasCubicCapacity,hasMaxSpeed)),
  699	def(negInfl(hasCatConverter,hasMaxSpeed)),
  700	def(posInfl(hasCatConverter,hasFuelConsumption)),
  701	def(posInfl(hasCubicCapacity,hasWeight)),
  702	def(negInfl(hasWeight,hasMaxSpeed)).
  703example(10053) :-
  704	makeEnvironment('ex53','functional_dependencies'),
  705	initEnvironment,
  706	def(increase(hasCubicCapacity)),
  707	def(infl(withRebate,hasPrice,-1.0)),
  708	def(infl(hasPrice,hasOverallCost,1.0)),
  709	def(infl(hasCubicCapacity,hasListPrice,1.2)),
  710	def(infl(hasListPrice,hasPrice,1.0)),
  711	def(infl(hasCubicCapacity,hasFuelConsumption,0.8)),
  712	def(infl(hasFuelConsumption,hasOverallCost,1.0)),
  713	def(infl(hasCubicCapacity,hasHorsePower,1.0)),
  714	def(infl(hasHorsePower,hasFuelConsumption,1.0)),
  715	def(infl(hasHorsePower,hasMaxSpeed,1.0)),
  716	def(infl(hasFuelType,hasMaxSpeed,0.8)),
  717	def(infl(hasCatConverter,hasHorsePower,-0.5)),
  718	def(infl(hasCubicCapacity,hasWeight,0.5)),
  719	def(infl(hasWeight,hasHorsePower,-1.0)).
  720example(10054) :-
  721	makeEnvironment('ex54','functional_dependencies'),
  722	initEnvironment,
  723	def(negInfl(a,b)),
  724	def(posInfl(b,e)),
  725	def(posInfl(e,d)),
  726	def(negInfl(g,e)),
  727	def(negInfl(a,g)).
  728%
  729%	Apart from the notation identical to ex54.
  730%
  731example(10055) :-
  732	makeEnvironment('ex55','functional_dependencies'),
  733	initEnvironment,
  734	def(infl(a,b,1.0)),
  735	def(infl(b,e,1.0)),
  736	def(infl(e,d,1.0)),
  737	def(infl(g,e,1.0)),
  738	def(infl(a,g,-1.0)).
  739example(10056) :-
  740	makeEnvironment('ex56','functional_dependencies'),
  741	initEnvironment,
  742	def(infl(a,b,1.0)),
  743	def(infl(b,e,1.0)),
  744	def(infl(e,d,1.0)),
  745	def(infl(g,e,1.0)),
  746	def(infl(a,g,-1.0)),
  747	def(infl(f,g,0.5)),
  748	def(infl(f,h,-0.5)),
  749	def(infl(h,d,0.3)).
  750example(10057) :-
  751	makeEnvironment('ex57','functional_dependencies'),
  752	initEnvironment,
  753	def(posInfl(a,b)),
  754	def(posInfl(b,c)),
  755	def(posInfl(c,d)).
  756example(10058) :- 
  757	makeEnvironment('ex58','functional_dependencies'),
  758	initEnvironment,
  759	def(posInfl(a,b)),
  760	def(posInfl(b,c)),
  761	def(posInfl(c,d)),
  762	def(infl(e,b,-1.0)),
  763	def(infl(e,c,0.5)).
  764example(10059) :-
  765	sb_defenv('mybox','sb.lit'),
  766	sb_initenv,
  767	sb_primconcept(person),
  768	sb_primconcept(woman,[supers([person])]),
  769	sb_primconcept(man,[supers([person])]),
  770	sb_disjoint(man,woman),
  771	sb_primelemrole(child,'domain-range'(parent,person,person)),
  772	sb_defconcept(parent,[supers([person]),
  773                              nr(child,1,30,2)]),
  774	sb_defconcept(mother,[supers([parent,woman])]),
  775	sb_defconcept(father,[supers([parent,man])]),
  776	sb_defconcept(granni,[supers([grandparent,mother])]),
  777	sb_defelem(harry,[isa(parent)]),
  778	sb_defelem(mary,[isa(mother), 
  779                         irole(child, 
  780                               iname('marys-child'),
  781                               [nr(1,30,2), vr(harry)])]).
  782example(10060) :-
  783	makeEnvironment('ex60','Modal operators'),
  784	initEnvironment,	
  785	modalAxioms(kd45,believe,peter),
  786	defprimconcept([b(believe,peter)],doctor,richPerson),
  787	assert_ind([b(believe,peter)],tom,doctor).
  788%%% Example 61
  789% deduce(elementOf(tweety,fly))
  790% deduce(elementOf(tweety,nest))
  791% deduce(elementOf(tweety,not(emu)))
  792% deduce(elementOf(tweety,not(cuckoo)))
  793% succeed
  794example(10061) :-
  795	makeEnvironment('ex61','Defaults and the lottery paradox'),
  796	initEnvironment,	
  797	defprimconcept(and([bird,naf(not(fly))]), fly),
  798	defprimconcept(and([bird,naf(not(nest))]), nest),
  799	defprimconcept(emu,not(fly)),
  800	defprimconcept(cuckoo,not(nest)),
  801	assert_ind(tweety,bird).
  802%%% Example 62
  803% deduce(elementOf(tweety,bird))
  804% deduce(elementOf(tweety,fly))
  805% deduce(elementOf(tweety,nest))
  806% consistent([])
  807% succeed
  808% deduce(elementOf(tweety,not(emu)))
  809% deduce(elementOf(tweety,emu))
  810% deduce(elementOf(tweety,not(cuckoo)))
  811% deduce(elementOf(tweety,cuckoo))
  812% deduce(elementOf(tweety,not(bird)))
  813% fail
  814example(10062) :-
  815	makeEnvironment('ex62','Defaults and the lottery paradox'),
  816	initEnvironment,	
  817	defprimconcept(and([bird,naf(not(fly))]), fly),
  818	defprimconcept(and([bird,naf(not(nest))]), nest),
  819	defprimconcept(emu,not(fly)),
  820	defprimconcept(cuckoo,not(nest)),
  821	defconcept(bird,or([emu,cuckoo])),
  822	assert_ind(tweety,bird).
  823%%% Example 63
  824% deduce(elementOf(tweety,bird))
  825% deduce(elementOf(tweety,fly))
  826% deduce(elementOf(tweety,nest))
  827% deduce(elementOf(tweety,sparrow))
  828% deduce(elementOf(tweety,not(emu)))
  829% deduce(elementOf(tweety,not(cuckoo)))
  830% consistent([])
  831% succeed
  832example(10063) :-
  833	makeEnvironment('ex63','Defaults and the lottery paradox'),
  834	initEnvironment,	
  835	defprimconcept(and([bird,naf(not(fly))]), fly),
  836	defprimconcept(and([bird,naf(not(nest))]), nest),
  837	defprimconcept(emu,not(fly)),
  838	defprimconcept(cuckoo,not(nest)),
  839	defconcept(bird,or([sparrow,emu,cuckoo])),
  840	assert_ind(tweety,bird).
  841%%% Example 64
  842% deduce(elementOf(peter,leftHandUsable))
  843% deduce(elementOf(peter,rightHandUsable))
  844% deduce(elementOf(peter,oneHandUsable))
  845% succeed
  846% deduce(elementOf(peter,bothHandsUsable))
  847% deduce(elementOf(peter,not(bothHandsUsable))
  848% fail
  849example(10064) :-
  850	makeEnvironment('ex64','Defaults and the lottery paradox'),
  851	initEnvironment,	
  852	defprimconcept(naf(leftHandBroken),leftHandUsable),
  853	defprimconcept(naf(rightHandBroken),rightHandUsable),
  854	defconcept(oneHandBroken,or([leftHandBroken,rightHandBroken])),
  855	defconcept(oneHandUsable,or([leftHandUsable,rightHandUsable])),
  856	defconcept(bothHandsUsable,and([leftHandUsable,rightHandUsable])),
  857	assert_ind(peter,oneHandBroken).
  858%%% Example 65
  859% deduce(elementOf(peter,leftHandUsable))
  860% can prove leftHandUsable by default because
  861% cannot prove leftHandBroken because
  862% can prove oneHandBroken but
  863% cannot prove not(rightHandBroken) because
  864% cannot prove rightHandUsable because
  865% can prove rightHandBroken because
  866% can prove oneHandBroken and
  867% can prove not(leftHandBroken) because
  868% can prove leftHandUsable by default because
  869% cannot prove leftHandBroken because the loop check prevents
  870%                                     the application of any axiom
  871% deduce(elementOf(peter,rightHandUsable))
  872% deduce(elementOf(peter,not(bothHandsUsable))
  873% succeed
  874% deduce(elementOf(peter,bothHandsUsable))
  875% deduce(elementOf(peter,oneHandUsable))
  876% cannot prove oneHandUsable becauce
  877% (cannot prove leftHandUsable because
  878%  can prove leftHandBroken because
  879%  oneHandBroken is a fact and
  880%  (can prove not(rightHandBroken) because
  881%   can prove rightHandUsable by default because
  882%   cannot prove rightHandBroken because
  883%   can prove oneHandBroken but 
  884%   cannot prove not(leftHandBroken) because
  885%   cannot prove leftHandUsable because the loop check prevents
  886%                                       the application of any axiom))
  887% and it is also not possible possible to prove rightHandUsable
  888% for similar reasons
  889% deduce(elementOf(peter,not(oneHandUsable)))
  890% fail
  891example(10065) :-
  892	makeEnvironment('ex65','Defaults and the lottery paradox'),
  893	initEnvironment,	
  894	defprimconcept(naf(leftHandBroken),leftHandUsable),
  895	defprimconcept(naf(rightHandBroken),rightHandUsable),
  896	defconcept(oneHandBroken,or([leftHandBroken,rightHandBroken])),
  897	defconcept(oneHandUsable,or([leftHandUsable,rightHandUsable])),
  898	defconcept(bothHandsUsable,and([leftHandUsable,rightHandUsable])),
  899	defprimconcept(leftHandBroken,not(leftHandUsable)),
  900	defprimconcept(rightHandBroken,not(rightHandUsable)),
  901	assert_ind(peter,oneHandBroken).
  902%%% Example 66
  903% deduce(elementOf(peter,leftHandUsable))
  904% deduce(elementOf(peter,rightHandUsable))
  905% deduce(elementOf(peter,oneHandUsable))
  906% deduce(elementOf(peter,not(bothHandsUsable))
  907% succeed
  908% deduce(elementOf(peter,bothHandsUsable))
  909% deduce(elementOf(peter,not(oneHandUsable)))
  910% fail
  911example(10066) :-
  912	makeEnvironment('ex66','Defaults and the lottery paradox'),
  913	initEnvironment,	
  914	defprimconcept(naf(leftHandBroken),leftHandUsable),
  915	defprimconcept(naf(rightHandBroken),rightHandUsable),
  916	defconcept(oneHandBroken,or([leftHandBroken,rightHandBroken])),
  917	defconcept(oneHandUsable,or([naf(not(leftHandUsable)),naf(not(rightHandUsable))])),
  918	defconcept(bothHandsUsable,and([leftHandUsable,rightHandUsable])),
  919	defprimconcept(leftHandBroken,not(leftHandUsable)),
  920	defprimconcept(rightHandBroken,not(rightHandUsable)),
  921	assert_ind(peter,oneHandBroken).
  922%%% Example 67
  923example(10067) :-
  924	makeEnvironment('ex67','Defaults and the lottery paradox'),
  925        initEnvironment,        
  926        defprimconcept(naf(leftHandBroken),leftHandUsable),
  927        defprimconcept(naf(rightHandBroken),rightHandUsable),
  928        defprimconcept(leftHandBroken,not(leftHandUsable)),
  929        defprimconcept(rightHandBroken,not(rightHandUsable)),
  930        defconcept(oneHandUsable,or([leftHandUsable,rightHandUsable])),
  931        defconcept(oneHandBroken,or([leftHandBroken,rightHandBroken])),
  932        defconcept(bothHandsBroken,and([leftHandBroken,rightHandBroken])),
  933        assert_ind(peter,oneHandBroken),
  934        assert_ind(peter,not(bothHandsBroken)).
  935example(10068) :-
  936	makeEnvironment('ex68','Defaults and the lottery paradox'),
  937        initEnvironment,        
  938        defprimconcept(naf(bot),leftHandUsable),
  939        defprimconcept(naf(bot),rightHandUsable),
  940        defprimconcept(leftHandBroken,not(leftHandUsable)),
  941        defprimconcept(rightHandBroken,not(rightHandUsable)),
  942        defconcept(oneHandUsable,or([leftHandUsable,rightHandUsable])),
  943        defconcept(oneHandBroken,or([leftHandBroken,rightHandBroken])),
  944        defconcept(bothHandsBroken,and([leftHandBroken,rightHandBroken])),
  945        assert_ind(peter,oneHandBroken),
  946        assert_ind(peter,not(bothHandsBroken)).
  947%%% Example 69
  948% deduce(elementOf(tweety,bird))
  949% succeeds
  950% deduce(elementOf(tweety,not(bird)))
  951% deduce(elementOf(tweety,fly))
  952% deduce(elementOf(tweety,not(fly)))
  953% deduce(elementOf(tweety,nest))
  954% deduce(elementOf(tweety,not(nest)))
  955% fail
  956example(10069) :-
  957	makeEnvironment('ex69','Defaults and the lottery paradox'),
  958	initEnvironment,	
  959	defprimconcept(and([bird,naf(exception),naf(not(fly))]), fly),
  960	defprimconcept(and([bird,naf(exception),naf(not(nest))]), nest),
  961	defprimconcept(emu,exception),
  962	defprimconcept(cuckoo,exception),
  963	defconcept(bird,or([emu,cuckoo])),
  964	assert_ind(tweety,bird).
  965%%% Example 70
  966% deduce(elementOf(a,clearTop))
  967% deduce(elementOf(a,not(clearTop)))
  968% fail
  969% deduce(elementOf(b,clearTop))
  970% deduce(elementOf(b,clearTop))
  971% succeed
  972example(10070) :-
  973	makeEnvironment('ex70','Defaults and existential quantification'),
  974	initEnvironment,
  975	defconcept(blocked,some(on,top)),
  976	defprimconcept(and([block,naf(blocked)]),clearTop),
  977	assert_ind(a,block),
  978	assert_ind(b,block),
  979	assert_ind(c,block),
  980	assert_ind(a,b,on).
  981example(10071) :-
  982	makeEnvironment('ex71','PRACMA'),
  983	initEnvironment,
  984	defprimconcept(sporttyp),
  985	defprimconcept(envtyp),
  986	sb_primconcept([b(believe,pk)],carwish,[supers([car])]),
  987	sb_primelemrole([bc(want,sporttyp)],has_tyre,'domain-range'(carwish,broad_tyre,broad_tyre)),
  988	sb_primelemrole([bc(believe,sporttyp)],speed,'domain-range'('2cv',low,low)),
  989	sb_primelemrole([bc(want,envtyp)],has_part,'domain-range'(carwish,cat_conv,cat_conv)),
  990	sb_primelemrole([bc(believe,envtyp)],speed,'domain-range'('2cv',fast,fast)),
  991%	modalAxioms(kd45,believe,pk),	
  992%	modalAxioms(kd45,want,pk),	
  993	modalAxioms(kd45,believe,concept(sporttyp)),
  994	modalAxioms(kd45,want,concept(sporttyp)),
  995	modalAxioms(kd45,believe,concept(envtyp)),
  996	modalAxioms(kd45,want,concept(envtyp)).
  997example(10072) :-
  998	makeEnvironment('ex72','DEMO'),
  999	initEnvironment,
 1000	defprimconcept(sporttyp),
 1001	defprimconcept(umwelttyp),
 1002	modalAxioms([b(believe,pv)],k,want,concept(sporttyp)),
 1003	modalAxioms([b(believe,pv)],k,want,concept(umwelttyp)),
 1004	modalAxioms(kd45,believe,all),
 1005	sb_primconcept([b(believe,all)], vw, [supers([auto])]),
 1006	sb_primconcept([b(believe,all)], opel, [supers([auto])]),
 1007	assert_ind([b(believe,all)],polo,vw),
 1008	assert_ind([b(believe,all)],manta,opel),
 1009	sb_defconcept([b(believe,pv),bc(want,sporttyp)],wunsch_auto,[supers([auto,hatSpoiler])]),
 1010	% Anmerkung:
 1011        % In MOTEL ist es m"oglich, mehrere sich erg"anzende Definitionen 
 1012        % f"ur ein Konzept (hier z.B. vw) zu haben. Damit ein Konzept im
 1013        % Verlauf des Dialogs st"andig zu verfeinern. 
 1014	sb_primconcept([b(believe,pv),bc(believe,sporttyp)],vw,[supers([langsam])]),
 1015	defprimconcept([b(believe,pv),bc(believe,sporttyp)],and([auto,hatKat,naf(not(langsam))]),langsam),
 1016	sb_defconcept([b(believe,pv),bc(want,umwelttyp)],wunsch_auto,[supers([auto,hatKat])]),
 1017	sb_primconcept([b(believe,pv),bc(believe,umwelttyp)],vw,[supers([not(langsam)])]),
 1018	assert_ind([b(believe,pv)],pk,sporttyp),
 1019        % Anmerkung:
 1020	% Bei der folgenden Definition reicht es nicht zu sagen, da\3
 1021        % polo ein Auto ist oder das alle glauben, da\3 polo ein Auto ist,
 1022        % da man durchaus Sachen im want haben kann, die der Realit"at 
 1023        % widersprechen. Deshalb mu\3 pk wollen, da\3 polo ein auto ist.
 1024	assert_ind([b(believe,pv),b(want,pk)],polo,auto).
 1025        % Demo:
 1026        %
 1027        % setof(C,ask([b(believe,pk)],elementOf(polo,C)),L).
 1028        % L = [auto,langsam,top,vw,not(bot)]
 1029        % Zun"achst erbt hier der pk vom b(believe,all), den Glauben, da\3
 1030        % polo ein vw und damit ein auto ist. Vom b(believe,sporttyp) erbt 
 1031        % er, da\3 vw's langsam sind, womit auch der polo langsam ist.
 1032        % 
 1033        % setof(C,ask([b(believe,pk)],elementOf(manta,C)),L)
 1034        % L = [auto,opel,top,not(bot)]
 1035        % Da es sich bei dem manta um einen opel handelt, wird zun"achst
 1036        % nicht angenommen, da\3 der manta langsam ist.
 1037        %
 1038        % assert_ind([b(believe,pv),b(believe,pk)],manta,hatKat)
 1039        % Hiermit haben wir festgelegt, da\3 der pk glaubt, da\3 der manta
 1040        % einen Katalysator hat. Nun erbt der pk vom sporttyp aber auch
 1041        % die Regel, da\3 Autos mit Katalysatoren normalerweise langsam sind.
 1042        % Dies f"uhrt bei der Wiederholung der letzten Anfrage zu folgendem
 1043        % Ergebnis:
 1044        %
 1045        % setof(C,ask([b(believe,pk)],elementOf(manta,C)),L)
 1046        % L = [auto,hatKat,langsam,opel,top,not(bot)]
 1047        %
 1048        % Wir k"onnen neben der Deduktion auf Abduktion verwenden:
 1049        %
 1050        % abduce([b(want,pk)],H,elementOf(polo,wunsch_auto),E).
 1051        % E = proved(in(app(_A:m(want,pk),[]),wunsch_auto,polo),
 1052        %     basedOn(and([proved(in(app(_A:m(want,pk),[]),auto,polo),
 1053        %     basedOn(abox)),
 1054        %     proved(in(app(_A:m(want,pk),[]),hatSpoiler,polo),
 1055        %     basedOn(usingAbHyp(in(app(_A:m(want,pk),[]),hatSpoiler,polo))))]))),
 1056        % H = [in(app(_B:m(want,pk),[]),hatSpoiler,polo)]          
 1057        % D.h. pk will den polo als Wunschauto, wenn der polo einen Spoiler hat.
 1058        %
 1059        % Nun erhalten wir von PRACMA die Anweisungen zu einem 
 1060        % Stereotypwechsel:
 1061        %
 1062        % delete_ind(pk,sporttyp)
 1063        % assert_ind(pk,umwelttyp)
 1064        %
 1065        % Dadurch "andern sich die Anfrageergebnisse wie folgt:
 1066        %
 1067        % setof(C,ask([b(believe,pk)],elementOf(polo,C)),L).
 1068        % L = [auto,top,vw,not(bot),not(langsam)]
 1069        %
 1070        % Der polo geh"ort nun zu den nicht langsamen Autos, da umwelttypen
 1071        % genau dies glauben.
 1072        % 
 1073        % setof(C,ask([b(believe,pk)],elementOf(manta,C)),L).
 1074        % L = [auto,hatKat,opel,top,not(bot)]
 1075        % 
 1076        % Der Manta hat zwar immernoch einen Katalysator, ist aber trotzdem
 1077        % nicht langsam, da umwelttypen nicht glauben, da\3 Katalysatoren ein
 1078        % Auto langsam machen.
 1079        %
 1080        % Wir k"onnen auch in diesem Fall fragen, unter welchen Umst"anden
 1081        % pk den polo f"ur sein Wunschauto halten w"urde:
 1082        %
 1083        % abduce([b(want,pk)],H,elementOf(polo,wunsch_auto),E).
 1084        % E = proved(in(app(_A:m(want,pk),[]),wunsch_auto,polo),
 1085        %     basedOn(and([proved(in(app(_A:m(want,pk),[]),auto,polo),
 1086        %     basedOn(abox)),
 1087        %     proved(in(app(_A:m(want,pk),[]),hatKat,polo),
 1088        %     basedOn(usingAbHyp(in(app(_A:m(want,pk),[]),hatKat,polo))))]))),
 1089        % H = [in(app(_B:m(want,pk),[]),hatKat,polo)]
 1090        %
 1091        % Wie erwartet, soll das Wunschauto von pk nun einen Katalysator haben.
 1092example(10073) :-
 1093	assert_ind([b(believe,all)],polo,vw),
 1094	defprimconcept([b(believe,pv),bc(believe,sporttyp)],vw,langsam),
 1095	assert_ind([b(believe,pv)],pk,sporttyp),
 1096	modalAxioms(kd45,believe,pv),
 1097	modalAxioms([b(believe,pv)],kd45,believe,concept(sporttyp)).
 1098example(10074) :-
 1099	makeEnvironment('ex74','DEMO'),
 1100	initEnvironment,
 1101	defprimconcept(sporttyp),
 1102	defprimconcept(umwelttyp),
 1103	modalAxioms([b(believe,pv)],k,want,concept(sporttyp)),
 1104	modalAxioms([b(believe,pv)],k,want,concept(umwelttyp)),
 1105	modalAxioms(kd45,believe,all),
 1106	sb_primconcept([b(believe,all)], vw, [supers([auto])]),
 1107	sb_primconcept([b(believe,all)], opel, [supers([auto])]),
 1108	assert_ind([b(believe,all)],polo,vw),
 1109	assert_ind([b(believe,all)],manta,opel),
 1110	defprimconcept([b(believe,pv),bc(want,sporttyp)],and([auto,or([hatSpoiler,hatSchiebedach])]),wunsch_auto),
 1111	defprimconcept([b(believe,pv),bc(believe,sporttyp)],vw,langsam),
 1112	defprimconcept([b(believe,pv),bc(believe,sporttyp)],and([auto,hatKat,naf(not(langsam))]),langsam),
 1113	defconcept([b(believe,pv),bc(want,umwelttyp)],wunsch_auto,and([auto,hatKat])),
 1114	defprimconcept([b(believe,pv),bc(believe,umwelttyp)],vw,not(langsam)),
 1115	assert_ind([b(believe,pv)],pk,sporttyp),
 1116	assert_ind([b(believe,pv),b(want,pk)],polo,auto).
 1117example(10075) :-
 1118	makeEnvironment('ex75','DEMO'),
 1119	initEnvironment,
 1120	defprimconcept(racer),
 1121	defprimconcept(creeper),
 1122	modalAxioms([b(believe,ps)],k,want,concept(racer)),
 1123	modalAxioms([b(believe,ps)],k,want,concept(creeper)),
 1124	modalAxioms(kd45,believe,all),
 1125	defprimconcept([b(believe,all)], vw, car),
 1126	defprimconcept([b(believe,all)], bmw, car),
 1127	assert_ind([b(believe,all)],beetle,vw),
 1128	assert_ind([b(believe,all)],'bmw735',bmw),
 1129	defprimconcept([b(believe,ps),bc(want,racer)],and([car,or([has_spoiler,has_sliding_roof])]),dream_car),
 1130	defprimconcept([b(believe,ps),bc(believe,racer)],vw,slow),
 1131	defprimconcept([b(believe,ps),bc(believe,racer)],and([car,has_cat_conv,naf(not(slow))]),slow),
 1132	defconcept([b(believe,ps),bc(want,creeper)],dream_car,and([car,has_cat_conv])),
 1133	defprimconcept([b(believe,ps),bc(believe,creeper)],vw,not(slow)),
 1134	assert_ind([b(believe,ps)],pc,racer),
 1135	assert_ind([b(believe,ps),b(want,pc)],beetle,car).
 1136example(10076) :-
 1137	makeEnvironment('ex76','SETHEO'),
 1138	initEnvironment,
 1139	defprimconcept(racer),
 1140	defprimconcept(creeper),
 1141	modalAxioms([b(believe,ps)],k,want,concept(racer)),
 1142	modalAxioms([b(believe,ps)],k,want,concept(creeper)),
 1143	modalAxioms(kd45,believe,all),
 1144	defprimconcept([b(believe,all)], vw, car),
 1145	defprimconcept([b(believe,all)], bmw, car),
 1146	assert_ind([b(believe,all)],beetle,vw),
 1147	assert_ind([b(believe,all)],'bmw735',bmw),
 1148	defprimconcept([b(believe,ps),bc(want,racer)],and([car,or([has_spoiler,has_sliding_roof])]),dream_car),
 1149	defprimconcept([b(believe,ps),bc(believe,racer)],vw,slow),
 1150	defconcept([b(believe,ps),bc(want,creeper)],dream_car,and([car,has_cat_conv])),
 1151	defprimconcept([b(believe,ps),bc(believe,creeper)],vw,not(slow)),
 1152	assert_ind([b(believe,ps)],pc,racer),
 1153	assert_ind([b(believe,ps),b(want,pc)],beetle,car)