1/* * module 
    2% ===================================================================
    3% File 'mud_builtin.pl'
    4% Purpose: Emulation of OpenCyc for SWI-Prolog
    5% Maintainer: Douglas Miles
    6% Contact: $Author: dmiles $@users.sourceforge.net ;
    7% Version: 'interface' 1.0.0
    8% Revision: $Revision: 1.9 $
    9% Revised At: $Date: 2002/06/27 14:13:20 $
   10% ===================================================================
   11% File used as storage place for all predicates which change as
   12% the world is run.
   13%
   14% props(Obj,height(ObjHt)) == holds(height,Obj,ObjHt) == rdf(Obj,height,ObjHt) == height(Obj,ObjHt)
   15% padd(Obj,height(ObjHt)) == padd(height,Obj,ObjHt,...) == moo(QueryForm)
   16% kretract[all](Obj,height(ObjHt)) == kretract[all](Obj,height,ObjHt) == pretract[all](height,Obj,ObjHt) == del[all](QueryForm)
   17% keraseall(AnyTerm).
   18%
   19%
   20% Dec 13, 2035
   21% Douglas Miles
   22*/
   23:- multifile(baseKB:agent_action_queue/3).   24:- dynamic(baseKB:agent_action_queue/3).   25
   26:- thread_local(t_l:disable_px/0).   27:- retractall(t_l:disable_px).   28
   29:- must(\+ t_l:disable_px).   30
   31
   32/*
   33:- dynamic   lmcache:session_io/4, lmcache:session_agent/2, lmcache:agent_session/2,   telnet_fmt_shown/3,   agent_action_queue/3).
   34:- dynamic lmcache:session_io/4, lmcache:session_agent/2, lmcache:agent_session/2,   telnet_fmt_shown/3,   agent_action_queue/3).
   35
   36*/
   37%:- nop('$set_source_module'( baseKB)).
   38:- set_prolog_flag(runtime_speed, 0).   39:- set_prolog_flag(runtime_safety, 2).   40:- set_prolog_flag(runtime_debug, 2).   41:- set_prolog_flag(unsafe_speedups, false).   42
   43:- set_prolog_flag(expect_pfc_file,always).   44
   45
   46listing_break(G):- cwc, listing(G),break.
   47
   48:- dynamic(baseKB:agent_call_command/2).   49:- import(baseKB:agent_call_command/2).   50
   51% :- mpred_core:import(baseKB:ttExpressionType/1).
   52
   53
   54:- assert_until_eof(infSupertypeName).   55:- call_on_eof(dmsg(infSupertypeName)).   56
   57:- include(prologmud(mud_header)).   58
   59
   60% :- gripe_time(60,user:ensure_loaded(library(logicmoo_user))).
   61
   62% :- set_defaultAssertMt(baseKB).
   63:- expects_dialect(pfc).   64
   65
   66:- expects_dialect(swi).   67
   68:- kb_global(baseKB:(  irc_event_hooks/3)).   69:- kb_global(baseKB:(  deliver_event_hooks/2)).   70:- kb_global(baseKB:   irc_user_plays/3).   71
   72:- kb_global(baseKB:   mudDescription/2).   73:- kb_global(baseKB:   term_specifier_text/2).   74:- kb_global(baseKB:   type_action_info/3).   75:- kb_global(baseKB:   update_charge/2).   76:- kb_global(baseKB:   update_stats/2).   77:- kb_global(baseKB:   use_usable/4).   78:- kb_global(baseKB:   text_actverb/2).   79:- kb_global(baseKB:   vtActionTemplate/1).   80% :- kb_global(baseKB:   mud_test/0).
   81:- kb_global(baseKB:  mud_test/1).   82:- kb_global(baseKB:  mud_test/2).   83:- kb_global(baseKB:  mud_test_local/0).   84:- kb_global(baseKB:  mud_test_local/1).   85:- kb_global(baseKB:  mud_test_local/2).   86:- kb_global(baseKB:   world_agent_plan/3).   87:- kb_global(baseKB:   action_info/2).   88:- kb_global(baseKB:   action_rules/4).   89:- kb_global(baseKB:   action_verb_useable/5).   90:- kb_global(baseKB:   agent_command/2).   91:- kb_global(baseKB:   agent_command_fallback/2).   92:- kb_global(baseKB:   agent_text_command/4).   93:- kb_global(baseKB:   check_permanence/4).   94
   95:- expects_dialect(pfc).   96
   97
   98:-op(0,fx,  ('disabled')).   99:-op(0,fx,  ('enabled')).  100:-op(0,fy,  ('disabled')).  101:-op(0,fy,  ('enabled')).  102% :- '@'(ensure_loaded(library(bugger)),user).
  103
  104:- multifile(user_db:grant_openid_server/2).  105:- dynamic(user_db:grant_openid_server/2).  106
  107:- kb_shared('$was_imported_kb_content$'/2).  108:- discontiguous('$was_imported_kb_content$'/2).  109:- kb_shared(  disabled/1).  110:- discontiguous(  disabled/1).  111:- kb_shared(  enabled/1).  112:- discontiguous(  enabled/1).  113:- kb_shared(was_enabled/1).  114:- discontiguous(  was_enabled/1).  115:- kb_shared(listing_mpred_hook/1).  116
  117:- kb_shared(genls/2).  118:- kb_shared(  isa/2).  119
  120:- style_check((-(singleton))).  121
  122/*
  123:-op(1190,fx,  (disabled)).
  124:-op(1190,fx,  (enabled)).
  125:-op(1190,fy,  (disabled)).
  126:-op(1190,fy,  (enabled)).
  127:-op(1120,fx,  (export)).
  128*/
  129
  130
  131:- set_prolog_flag(double_quotes, atom).  132:- set_prolog_flag(double_quotes, string). 
  133:- set_prolog_flag(generate_debug_info, true).  134
  135% these do not get defined!?
  136% :- kb_shared( user_db:assert_user/2, user_db:grant_openid_server/2, user_db:retractall_grant_openid_server/2, user_db:retractall_user/2, user_db:assert_grant_openid_server/2).
  137
  138% :- kb_shared(mpred_online:semweb_startup/0).
  139% :- break.
  140:- kb_shared(  tChannel/1).  141
  142
  143:- kb_shared( pfcManageHybrids/0).  144:- kb_shared(   defnSufficient/2).  145% :- kb_shared(   lmcache:loaded_external_kbs/1).
  146%:- kb_shared( t_l:infMustArgIsa/0).
  147:- thread_local(t_l:repl_to_string/2).  148:- thread_local(t_l:repl_writer/2).  149:- thread_local(t_l:into_form_code/0).  150% :- thread_local t_l:current_local_why/2).
  151% :- break.
  152:- kb_shared(   loading_module_h/1).  153:- kb_shared(   registered_module_type/2).  154:- kb_shared(   must_compile_special_clause_file/1).  155
  156% HOOKS
  157:- kb_shared(   decl_coerce/3).  158:- kb_shared(   listen_to_ops/2).  159:- kb_shared(   deduce_facts/2).  160:- kb_shared(   default_type_props/3).  161:- kb_shared(   fact_always_true/1).  162:- kb_shared(   fact_is_false/2).  163:- kb_shared(   fact_maybe_deduced/1).  164:- kb_shared(   never_assert_u/2).  165:- kb_shared(   impl_coerce_hook/3).  166
  167:- kb_shared(   create_random_fact/1).  168% :- kb_shared(   local_term_anglify/2).
  169% :- kb_shared(   term_anglify_last/2).
  170% :- kb_shared(   term_anglify_np/3).
  171% :- kb_shared(   term_anglify_np_last/3).
  172
  173% :- kb_shared(   hooked_random_instance/3).
  174
  175:- kb_shared(   now_unused/1).  176:- kb_shared(   provide_mpred_read_attributes/3).  177:- kb_shared(   provide_mpred_setup/4).  178:- kb_shared(   provide_mpred_clauses/3).  179:- kb_shared(   provide_mpred_op/2).  180:- kb_shared(   provide_mpred_write_attributes/2).  181
  182% DYN HOOKS
  183% :- kb_shared(   is_never_type/1).
  184
  185% DYN FOR CODE
  186:- dynamic(lmcache:after_mpred_load/0).  187:- thread_local(use_cyc_database/0).  188:- kb_shared( use_cyc_database/0).  189
  190:- kb_shared(   fact_is_false/2).  191% :- kb_shared(kbp_t_list_prehook/2).
  192
  193
  194% DYN KB
  195:- kb_shared(   only_if_pttp/0).  196:- kb_shared(   use_kif/2).  197% :- kb_shared(   is_mpred_prop/2).
  198%:- kb_shared(   hasInstance_dyn/2).
  199%:- kb_shared(   arity/2).
  200/*
  201%:- kb_shared(   mpred_prop/3).
  202:- kb_shared(   '<=>'/2).
  203% :- kb_shared(   ruleForward/2).
  204:- kb_shared(   ruleRewrite/2).
  205% :- kb_shared(   ruleBackward/2).
  206
  207% :-must((  mpred_prop(t,_,prologHybrid))).
  208
  209*/
  210
  211:- kb_global(baseKB:   term_specifier_text/2).  212:- kb_global(baseKB:   update_charge/2).  213:- kb_global(baseKB:   update_stats/2).  214:- kb_global(baseKB:   use_usable/4).  215:- kb_global(baseKB:   text_actverb/2).  216:- kb_global(baseKB:   vtActionTemplate/1).  217:- kb_global(baseKB:  mud_test/0).  218:- kb_global(baseKB:  mud_test/1).  219:- kb_global(baseKB:  mud_test/2).  220:- kb_global(baseKB:  mud_test_local/0).  221:- kb_global(baseKB:  mud_test_local/1).  222:- kb_global(baseKB:  mud_test_local/2).  223:- kb_global(baseKB:   world_agent_plan/3).  224:- kb_global(baseKB:   action_info/2).  225:- kb_global(baseKB:   action_rules/4).  226:- kb_global(baseKB:   action_verb_useable/5).  227:- kb_global(baseKB:   agent_command/2).  228:- kb_global(baseKB:   agent_text_command/4).  229:- kb_global(baseKB:   check_permanence/4).  230
  231
  232% predicateConventionMt(baseKB:agent_call_command,baseKB).
  233
  234% :- ensure_loaded('logicmoo/pfc/autoexec.pfc').
  235
  236% isa(iPerson99,tPerson).
  237
  238:- op(500,fx,'~').  239:- op(1050,xfx,('=>')).  240:- op(1050,xfx,'<==>').  241:- op(1050,xfx,('<-')).  242:- op(1100,fx,('==>')).  243:- op(1150,xfx,('::::')).  244
  245:- dynamic(baseKB:mudTermAnglify/2).  246:- discontiguous(baseKB:mudTermAnglify/2).  247
  248tWorld(iWorld7).
  249
  250/*
  251:- rtrace.
  252:- trace.
  253*/
  254ttExpressionType(ftProlog).
  255
  256% 
  257
  258% ~tSet(ftChangeQuantity).
  259
  260%:-  rtrace((trace,ain(ttExpressionType(ftChangeQuantity)))).
  261%:- break.
  262
  263% :- mpred_post1(ttExpressionType(ftChangeQuantity)).
  264
  265ttExpressionType(ftChangeQuantity).
  266:- assert((ftChangeQuantity(X):- compound(X),arg(X,1,Q),quotedIsa(Q,ftNumber))).  267
  268
  269% ==> neg(arity(mudAreaConnected,1)).
  270
  271%ruleRewrite(isa(isInstFn(Sub),Super),genls(Sub,Super)):-ground(Sub:Super),!.
  272
  273:- dynamic(tItem/1).  274:- dynamic(ttAgentType/1).  275
  276
  277
  278:- dynamic(disjointWith/2).  279/*
  280disjointWith(A,B):- A=B,!,fail.
  281disjointWith(A,B):- disjointWithT(A,B).
  282disjointWith(A,B):- disjointWithT(AS,BS),transitive_subclass_or_same(A,AS),transitive_subclass_or_same(B,BS).
  283disjointWith(A,B):- once((type_isa(A,AT),type_isa(B,BT))),AT \= BT.
  284*/
  285
  286disjointWith(Sub, Super) ==> disjointWith( Super, Sub).
  287disjointWith(tObj,tRegion).
  288disjointWith(ttSpatialType,ttAbstractType).
  289
  290
  291rtBinaryPredicate(arity).
  292
  293%rtBinaryPredicate(Pred) ==> arity(Pred,2),tPred(Pred).
  294%arity(Pred,2),tPred(Pred) ==> rtBinaryPredicate(Pred).
  295
  296% () <==> rtBinaryPredicate(Pred).
  297prologHybrid(relationMostInstance(rtBinaryPredicate,tCol,vtValue)).
  298%relationMostInstance(BP,_,_)==>(rtBinaryPredicate(BP),rtBinaryPredicate(BP)).
  299prologHybrid(relationAllInstance(rtBinaryPredicate,tCol,vtValue)).
  300relationAllInstance(BP,_,_)==>rtBinaryPredicate(BP).
  301
  302
  303% (isa(Inst,Type), tCol(Inst)) ==> isa(Type,ttTypeType).
  304% (isa(TypeType,ttTypeType) , isa(Inst,TypeType), genls(SubInst,Inst)) ==> isa(SubInst,TypeType).
  305
  306(sometimesSlow, ttExpressionType(FT),{compound(FT)})==>meta_argtypes(FT).
  307
  308tCol(vtDirection).
  309
  310 % mdefault(genls(tPartofObj,tItem)).
  311
  312tCol(tCol).
  313
  314:- must(ain(tCol(tAgent))).  315
  316
  317% defined more correctly below dividesBetween(S,C1,C2) ==> (disjointWith(C1,C2) , genls(C1,S) ,genls(C2,S)).
  318% dividesBetween(S,C1,C2) ==> (disjointWith(C1,C2) , genls(C1,S) ,genls(C2,S)).
  319% disjointWith(tItem,tPathway).
  320%:-export(repl_to_string(tAgent,ftTerm)).
  321%:-export(repl_writer(tAgent,ftTerm)).
  322%:-export(repl_writer/2).
  323%prologHybrid(typeProps(tCol,ftVoprop)).
  324dividesBetween(tHominid,tMale,tFemale).
  325dividesBetween(tAgent,tHumanControlled,tNpcAgent).
  326dividesBetween(tObj,tItem,tAgent).
  327dividesBetween(tItem,tMassfull,tMassless).
  328disjointdividesBetween(tObj,tMassfull,tMassless).
  329dividesBetween(tSpatialThing,tObj,tRegion).
  330dividesBetween(tTemporalThing,tObj,tRegion).
  331formatted_resultIsa(ftDiceFn(ftInt,ftInt,ftInt),ftInt).
  332% disjointWith(P1,P2) ==> ((neg(isa(C,P1))) <==> isa(C,P2)).
  333
  334% isa(Col1, ttObjectType) ==> neg(isa(Col1, ttExpressionType)).
  335
  336
  337
  338
  339rtArgsVerbatum(functorIsMacro).
  340% tCol(ArgsIsa):-mpred_is_trigger(ArgsIsa).
  341% tCol(ArgsIsa):-ttRelationType(ArgsIsa).
  342% TODO decide if OK
  343%(mpred_prop(_,_,meta_argtypes(ArgTypes)),{is_declarations(ArgTypes)}) ==> meta_argtypes(ArgTypes).
  344
  345tSet(COL)==>tCol(COL).
  346ttExpressionType(COL)==>tCol(COL).
  347
  348
  349tCol(functorIsMacro).
  350tCol(tCol).
  351tCol(tFunction).
  352tCol(tPred).
  353tCol(tRelation).
  354tCol(ttExpressionType).
  355tCol(ttSpatialType).
  356tCol(vtActionTemplate).
  357tSet(tCol).
  358tSet(tContainer).
  359tSet(tFunction).
  360tSet(tPred).
  361tSet(tRegion).
  362tSet(tRelation).
  363ttTypeType(ttExpressionType).
  364ttTypeType(ttSpatialType).
  365
  366ftSpec(vtActionTemplate).
  367
  368isa(tRegion,ttSpatialType).
  369isa(tRelation,ttAbstractType).
  370
  371% genlPreds(genls,equals).
  372% genls(A, B):- tCol(A),{A=B}.
  373
  374% must(Goal):- Goal. % (quietly((visible(+all),visible(+unify),visible(+exception),leash(-all),leash(+exception))),(trace,Goal),leash(+all)).
  375
  376% :- gutracer.
  377
  378
  379tCol(tFly).
  380
  381prologHybrid(localityOfObject(tObj,tSpatialThing)).
  382
  383
  384persistInMudIsa(tItem).
  385persistInMudIsa(tAgent).
  386persistInMudIsa(tRegion).
  387
  388sometimesHack(genls).
  389
  390~tPathway(apathFn(iOfficeRoom7, vNorth)).
  391
  392tPathway(PATH):- cwc, PATH=@=apathFn(iOfficeRoom7, vNorth),trace_or_throw(error(tPathway(PATH))).
  393
  394
  395(sometimesSlow, tCol(Col), {isa_from_morphology(Col,Type)}) ==> isa(Col,Type).
  396
  397(sometimesSlow, tInstance(Inst), {isa_from_morphology(Inst,Type)}) ==> isa(Inst,Type).
  398
  399% HOW TO MAKE THIS FAST? isa(Inst,Type) <= {isa_from_morphology(Inst,Type)}.
  400
  401%((disjointWith(P1,P2) , genls(C1,P1), {dif:dif(C1,P1)}) ==>    disjointWith(C1,P2)).
  402% (disjointWith(C1,P2) <- (genls(C1,P1), {dif:dif(C1,P1)}, disjointWith(P1,P2))).
  403
  404% :- rtrace.
  405completelyAssertedCollection(Complete)==> {must( baseKB: ( \+ ttExpressionType(Complete)))}.
  406
  407
  408==> tSourceCode(iSourceCode7,comment("PrologMUD Server code")).
  409==> tSourceData(iSourceData8,comment("PrologMUD WorldState Data")).
  410
  411
  412%isLoadedType(tSourceCode) ==> (tPred(Toy),arity(Toy,A)/ ( \+ current_predicate(Toy/A)) ==> dynamic(Toy/A)).
  413%isLoadedType(tSourceCode) ==> (functorDeclares(Toy),prologArity(Toy,A)/( \+ current_predicate(Toy/A)) ==> dynamic(Toy/A)).
  414
  415
  416% functorDeclares(Toy),tFunction(Toy),arity(Toy,A),{A2 is A + 1}==>prologArity(Toy,A2).
  417
  418tCol(completelyAssertedCollection).
  419rtArgsVerbatum(completeIsaAsserted).
  420tSpatialThing(I)==>completeIsaAsserted(I).
  421genls(completelyAssertedCollection,tCol).
  422completelyAssertedCollection(tItem).
  423completelyAssertedCollection(tRegion).
  424completelyAssertedCollection(tObj).
  425% :-must.
  426completelyAssertedCollection(tAgent).
  427completelyAssertedCollection(tCarryAble).
  428completelyAssertedCollection(vtVerb).
  429% :-rnotrace.
  430
  431
  432ttTypeType(completeIsaAssertedType).
  433
  434completeIsaAssertedType(Col) ==> (isa(I,Col) ==> completeIsaAsserted(I)).
  435completeIsaAssertedType(tAgent).
  436completeIsaAssertedType(tCarryAble).
  437completeIsaAssertedType(tObj).
  438
  439tCol(ttTypeByAction).
  440:-must(ain(tCol(ttTypeByAction))).  441:- nortrace.  442
  443
  444
  445genls(ttTypeByAction,completelyAssertedCollection).
  446
  447% dividesBetween(tItem,tPathway).
  448dividesBetween(tItem,tMassfull,tMassless).
  449dividesBetween(tSpatialThing,tObj,tRegion).
  450dividesBetween(tObj,tItem,tAgent).
  451dividesBetween(tObj,tMassfull,tMassless).
  452dividesBetween(tAgent,tHumanControlled,tNpcAgent).
  453
  454((sometimesBuggy,genls(A,B)/ground(genls(A,B)))==>{call((call((trace,(must(ain(tCol(A))),must(ain(tCol(B))))))))}).
  455
  456((sometimesBuggy,dividesBetween(S,C1,C2),{ground(S:C1:C2)}) ==> ((disjointWith(C1,C2) , genls(C1,S) ,genls(C2,S)))).
  457
  458% slow... ttObjectType(Col1) ==> ~ttExpressionType(Col1).
  459
  460neg(isa(I,Super)) :- {ground(isa(I,Super))}, (isa(I,Sub), disjointWith(Sub, Super)).
  461% disjointWith(P1,P2) ==> {\+(isa(P1,rtAvoidForwardChain)),\+(isa(P2,rtAvoidForwardChain))},(neg(isa(C,P1)) <==> isa(C,P2)).
  462
  463
  464tCol(ttSpatialType).
  465
  466
  467% ===================================================================
  468% MUD TMS - Type checker system / Never Assert / Retraction checks
  469% ===================================================================
  470/*
  471never_assert_u(mudAtLoc(iArea1025, _),isa(iArea1025,tRegion)).
  472never_assert_u(localityOfObject(iArea1025, iOfficeRoom7),isa(iArea1025,tRegion)).
  473never_assert_u(localityOfObject(R,_),isa(R,tRegion)):- isa(R,tRegion).
  474never_assert_u(mudFacing(R,_),isa(R,tRegion)):- isa(R,tRegion).
  475never_assert_u(mudAtLoc(R,_),isa(R,tRegion)):- isa(R,tRegion).
  476
  477%deduce_facts_forward(localityOfObject(_,Region),isa(Region,tSpatialThing)).
  478deduce_facts_forward(localityOfObject(Obj,_),isa(Obj,tObj)).
  479fix_argIsa(F,N,vtDirection(Val),vtDirection):-ain(mpred_prop(F,_,relationMostInstance(N,Val))),!.
  480
  481*/
  482
  483typeCheckDecl(vtActionTemplate(ArgTypes),is_declarations(ArgTypes)).
  484
  485% Representations
  486vtActionTemplate(ArgTypes)/is_declarations(ArgTypes) ==> meta_argtypes(ArgTypes).
  487
  488((meta_argtypes(ArgTypes)/get_functor(ArgTypes,F)),vtVerb(F))==>vtActionTemplate(ArgTypes).
  489
  490
  491
  492argIsa(aDirectionsFn,2,ftListFn(vtDirection)).
  493argIsa(apathFn,1,tRegion).
  494argIsa(apathFn,2,vtDirection).
  495argIsa(localityOfObject,1,tObj).
  496argIsa(localityOfObject,2,tSpatialThing).
  497argIsa(mudColor,1,tObj).
  498argIsa(mudColor,2,vtColor).
  499argIsa(mudFacing,1,tObj).
  500argIsa(mudFacing,2,vtDirection).
  501argIsa(mudMemory,2,ftTerm).
  502
  503tCol(vtVerb).
  504
  505
  506
  507tCol(tChannel).
  508tSet(tItem).
  509tCol(vtVerb).
  510
  511% prologIsFlag(tAgent(ftID),[tSet]).
  512% prologDynamic(createableSubclassType/2).
  513% alt_forms1(none_AR,localityOfObject(P,R),mudAtLoc(P,L)):-ground(localityOfObject(P,R)),call_u(mudAtLoc(P,L)),nonvar(L),once(locationToRegion(L,R)).
  514% alt_forms1(none_AR,mudAtLoc(P,L),localityOfObject(P,R)):-ground(mudAtLoc(P,L)),once(locationToRegion(L,R)),nonvar(R).
  515% argsIsa(mudFacing,ftTerm).
  516% we need a way to call this: maxCapacity
  517% we need a way to call this: typeMaxCapacity
  518%:- compile_predicates([isa/2]).
  519%prologHybrid(repl_to_string(tAgent,term),[prologSingleValued,relationMostInstance(tAgent,default_repl_obj_to_string)]).
  520% prologHybrid(repl_writer(tAgent,term),[prologSingleValued,relationMostInstance(tAgent,default_repl_writer)]).
  521%:- forall(ttRelationType(F),dynamic(F/1)).
  522%:- foreach(retract(isa(I,C)),assert_hasInstance(C,I)).
  523%isa(AT,ttAgentType):- genls(AT,tAgentGeneric).
  524%genls(AT,tAgentGeneric):- isa(AT,ttAgentType).
  525%subFormat(ftTextType,ftText).
  526%prologIsFlag(tItem(ftID)).
  527%prologIsFlag(tRegion(ftID),[tSet]).
  528%prologIsFlag(tRegion(ftID),tCol).
  529prologIsFlag(tThinking(tAgent)).
  530
  531==> prologHybrid(isEach(mudLastCmdSuccess/3,mudLastCommand/2,mudNamed/2, mudSpd/2,mudStr/2,typeGrid/3)).
  532
  533singleValuedHybrid(F)==>(singleValued(F),prologHybrid(F)).
  534
  535:- dynamic(isa/2).  536:- dynamic(mudDescription/2).  537:- dynamic((tItem/1, tRegion/1, instVerbOverride/3,mudNamed/2, determinerString/2, mudKeyword/2 ,descriptionHere/2, mudToHitArmorClass0/2, tThinking/1, tDeleted/1, mudWeight/2, mudPermanence/3, act_term/2, mudAgentTurnnum/2, mudAtLoc/2, mudEnergy/2, mudHealth/2, mudDescription/2, mudFacing/2, mudCmdFailure/2, mudSpd/2, typeGrid/3, mudHeight/2, mudMemory/2, pathName/3, mudPossess/2, mudScore/2, mudStm/2, mudStr/2, wearsClothing/2)).  538:- dynamic((mudArmorLevel/2, mudLevelOf/2, mudToHitArmorClass0/2, mudBareHandDamage/2,
  539   chargeCapacity/2, mudEnergy/2, tCol/1, tAgent/1, tItem/1, tRegion/1, instVerbOverride/3,
  540   mudNamed/2, determinerString/2, mudKeyword/2 ,descriptionHere/2, tThinking/1, mudWeight/2,
  541   mudPermanence/3, act_term/2, mudAgentTurnnum/2, mudAtLoc/2, mudEnergy/2, mudHealth/2,
  542   mudDescription/2, mudFacing/2, failure/2, gridValue/4, mudHeight/2, mudMemory/2, isa/2, pathName/3, mudPossess/2, mudScore/2, mudStm/2, mudStr/2, mudWearing/2)).  543
  544
  545
  546==> prologMultiValued(mudDescription(ftTerm,ftString),[prologOrdered,prologHybrid]).
  547prologMultiValued(mudDescription(ftTerm,ftText), [predProxyAssert(add_description),predProxyRetract(remove_description),predProxyQuery(query_description)],prologHybrid).
  548==> prologMultiValued(mudDescription(ftTerm,ftText),[predProxyAssert(add_description),prologHybrid]).
  549==> prologMultiValued(mudKeyword(ftTerm,ftString),prologHybrid).
  550prologMultiValued(mudMemory(tAgent,ftTerm),prologHybrid).
  551prologMultiValued(mudNamed(ftTerm,ftTerm),prologHybrid).
  552prologMultiValued(mudPossess(tObj,tObj),prologHybrid).
  553prologMultiValued(nameString(ftTerm,ftString),prologHybrid).
  554prologMultiValued(pathDirLeadsTo(tRegion,vtDirection,tRegion),prologHybrid).
  555prologMultiValued(pathName(tRegion,vtDirection,ftString),prologHybrid).
  556prologMultiValued(genls(tCol,tCol),prologHybrid).
  557==> prologSingleValued(typeGrid(tCol,ftInt,ftListFn(ftString)),prologHybrid).
  558
  559prologMultiValued(typeGrid(tCol,ftInt,ftListFn(ftString)),prologHybrid).
  560
  561prologMultiValued(verbAsWell(ftTerm,ftAction,ftAction),prologHybrid).
  562
  563prologNegByFailure(mudNeedsLook(tObj,ftBoolean),prologHybrid).
  564prologNegByFailure(tAgent(ftID),prologHybrid).
  565prologNegByFailure(tCol(ftID),prologHybrid).
  566prologNegByFailure(tCol(ftID),prologHybrid).
  567prologNegByFailure(tItem(ftID),prologHybrid).
  568prologNegByFailure(tRegion(ftID),prologHybrid).
  569prologNegByFailure(tThinking(tAgent),prologHybrid).
  570pathName(Region,Dir,Text)==>mudDescription(apathFn(Region,Dir),Text).
  571
  572
  573==> prologSingleValued(chargeCapacity(tChargeAble,ftInt),prologHybrid).
  574prologSingleValued(location_center(tRegion,xyzFn(tRegion,ftInt,ftInt,ftInt)),prologHybrid).
  575==> prologSingleValued(mudAgentTurnnum(tAgent,ftInt),[relationMostInstance(tAgent,0)],prologHybrid).
  576% :- listing( prologSingleValued ).
  577
  578
  579singleValuedHybrid(mudArmor(tObj,ftInt)).
  580singleValuedHybrid(mudArmorLevel(tWearAble,ftInt)).
  581:- mpred_notrace_exec.  582
  583singleValuedHybrid(mudAtLoc(tObj,xyzFn(tRegion,ftInt,ftInt,ftInt))).
  584singleValuedHybrid(mudAttack(tObj,ftInt)).
  585singleValuedHybrid(mudBareHandDamage(tAgent,ftInt)).
  586% singleValuedHybrid(mudBareHandDamage(tAgent,ftDiceFn)).
  587
  588
  589% prologSingleValued(mudEnergy(tChargeAble,ftInt(90)),prologHybrid).
  590singleValuedHybrid(mudEnergy(tChargeAble,ftInt)).
  591==> prologSingleValued(mudEnergy(tObj,ftInt),[relationMostInstance(tAgent,90),relationMostInstance(tChargeAble,130)],prologHybrid).
  592==> prologSingleValued(mudHygiene(tObj,ftInt),[relationMostInstance(tObj,90)],prologHybrid).
  593
  594:- mpred_notrace_exec.  595:- ain(==>((prologSingleValued(mudFacing(tObj,vtDirection),[relationMostInstance(tObj,vNorth)],prologHybrid)))).  596
  597
  598singleValuedHybrid(mudPermanence(tItem,vtVerb,vtPerminance)).
  599singleValuedHybrid(mudHealth(tObj,ftInt)).
  600singleValuedHybrid(mudHeight(tObj,ftInt)).
  601singleValuedHybrid(mudHeight(tSpatialThing,ftInt)).
  602singleValuedHybrid(mudID(tObj,ftID)).
  603singleValuedHybrid(mudLevelOf(tCarryAble,ftInt)).
  604singleValuedHybrid(mudWeight(tObj,ftInt)).
  605
  606singleValuedHybrid(mudMaxHitPoints(tAgent,ftInt),[prologHybrid],prologHybrid).
  607singleValuedHybrid(mudLastCommand(tAgent,ftAction)).
  608==> prologSingleValued(mudNonHunger(tAgent,ftInt),[relationMostInstance(tAgent,90)],prologHybrid).
  609==> prologSingleValued(mudMoveDist(tAgent,ftInt),[relationMostInstance(tAgent,1)]).
  610==> prologSingleValued(mudNeedsLook(tAgent,ftBoolean),relationMostInstance(tAgent,vFalse),prologHybrid).
  611singleValuedHybrid(mudScore(tAgent,ftInt)).
  612singleValuedHybrid(mudSpd(tAgent,ftInt)).
  613singleValuedHybrid(mudStm(tAgent,ftInt)).
  614singleValuedHybrid(mudStr(tAgent,ftInt)).
  615singleValuedHybrid(mudToHitArmorClass0(tAgent,ftInt)).
  616% prologSingleValued(spawn_rate(isPropFn(genls(tObj)),ftInt)).
  617
  618==> prologSingleValued(spawn_rate(tCol,ftInt)).
  619==> prologSingleValued(stat_total(tAgent,ftInt)).
  620
  621resultIsa(apathFn,tPathway).
  622% '<==>'(isa(Whom,tNpcAgent),whenAnd(isa(Whom,tAgent),naf(isa(Whom,tHumanControlled)))).
  623'<==>'(mudDescription(apathFn(Region,Dir),Text),pathName(Region,Dir,Text)).
  624'<==>'(nameString(apathFn(Region,Dir),Text),pathName(Region,Dir,Text)).
  625
  626
  627rtDeduceArgTypes(pathDirLeadsTo).
  628rtDeduceArgTypes(F)/current_predicate(F,P),argIsa(F,N,T)/arg(N,P,E),{call(P)}==>isa(E,T).
  629
  630vtValue(Val)/(atom(Val),i_name_lc(Val,KW))==>mudKeyword(Val,KW).
  631
  632ttPredAndValueType(Str)/
  633  (i_name('mud',Str,Pred),
  634  i_name('vt',Str,VT)) ==> 
  635    (rtRolePredicate(Pred),
  636     ttValueType(VT),
  637      mudKeyword(VT,Str),mudKeyword(Pred,Str),
  638      argIsa(Pred,2,VT),
  639      argIsa(Pred,1,tTemporalThing)).
  640
  641%:- mpred_trace_exec.
  642ttPredAndValueType("size").
  643ttPredAndValueType("texture").
  644ttPredAndValueType("color").
  645:- mpred_notrace_exec.  646ttPredAndValueType("shape").
  647ttPredAndValueType("material").
  648
  649
  650%relationMostInstance(arg1Isa,rtRolePredicate,tTemporalThing).
  651%relationMostInstance(arg2QuotedIsa,rtRolePredicate,ftTerm).
  652
  653% mudKeyword(W,R) <= {atom(W),i_name_lc(W,R)}.
  654
  655ttValueType(vtSize).
  656ttValueType(vtTexture).
  657ttValueType(vtColor).
  658
  659ttValueType(VT)==>tInferInstanceFromArgType(VT).
  660
  661prologHybrid(typeHasGlyph(tCol,ftString)).
  662prologHybrid(mudMaxHitPoints(tAgent,ftInt)).
  663prologHybrid(mudStowing(tAgent,tItem)).
  664% :- break.
  665
  666prologHybrid(text_actverb(ftText,vtVerb)).
  667:- sanity(((argIsa(text_actverb,1,C);argQuotedIsa(text_actverb,1,C)))).  668
  669:-dynamic((latitude/2, mudMoveDist/2, longitude/2)).  670prologHybrid(typeHasGlyph,2).
  671prologHybrid(mudActAffect/3).
  672prologHybrid(mudAtLoc,2).
  673prologHybrid(mudColor/2).
  674prologHybrid(mudHealth,2).
  675prologHybrid(mudMaterial/2).
  676prologHybrid(mudNeedsLook,2).
  677:- kb_global(baseKB:mudNeedsLook/2).  678prologHybrid(mudNeedsLook/2,[completeExtentAsserted]).
  679prologHybrid(mudShape/2).
  680prologHybrid(mudSize/2).
  681prologHybrid(mudTexture/2).
  682prologHybrid(pathDirLeadsTo/3).
  683prologDynamic(mudMoveDist/2).
  684:- dynamic(mudMoveDist/2).  685meta_argtypes(mudMoveDist(tAgent,ftInt)).
  686% ==> prologSingleValued(mudMoveDist,[predicateConventionMt(abox),query(call),relationMostInstance(tAgent,1)]).
  687prologDynamic(stat_total/2).
  688
  689:- dynamic(vtBasicDir/1).  690
  691tCol(vtBasicDir).
  692:- must(ain(tCol(vtBasicDirPlusUpDown))).  693% :- break.
  694tCol(vtDirection).
  695tCol(vtVerb).
  696:- dynamic(stat_total/2).  697:- dynamic(spawn_rate/2).  698tCol(mobMonster).
  699%prologDynamic(action_info(vtActionTemplate,ftText)).
  700prologDynamic(agent_command(tAgent,ftAction)).
  701:- ain(prologSideEffects(agent_command(tAgent,ftAction))).  702%prologBuiltin(member(ftTerm,ftTerm)).
  703prologDynamic(mud_test(ftTerm,ftCallable)).
  704prologDynamic(use_action_templates(ftTerm)).
  705
  706
  707prologHybrid(typeHasGlyph(tCol,ftString)).
  708prologHybrid(mudColor(tSpatialThing,vtColor)).
  709prologHybrid(mudKnowing(tAgent,ftAssertion)).
  710==> prologHybrid(mudLabelTypeProps(ftString,tCol,ftVoprop)).
  711prologHybrid(mudListPrice(tItem,ftNumber)).
  712:-dynamic(mudOpaqueness/2).  713prologHybrid(mudOpaqueness(ftTerm,ftPercent)).
  714prologHybrid(mudPossess(tAgent,tObj)).
  715prologHybrid(mudShape(tSpatialThing,vtShape)).
  716prologHybrid(mudSize(tSpatialThing,vtSize)).
  717prologHybrid(mudTextSame(ftText,ftText)).
  718prologHybrid(mudTexture(tSpatialThing,vtTexture)).
  719meta_argtypes(aDirectionsFn(ftTerm,ftListFn(ftTerm))).
  720
  721==>prologListValued(mudGetPrecepts(tAgent,ftListFn(tSpatialThing))). % [predicateConventionMt(abox)].
  722
  723prologListValued(mudNearBody(tAgent,ftListFn(tSpatialThing)),[]).
  724prologListValued(mudNearReach(tAgent,ftListFn(tSpatialThing))). % [predicateConventionMt(abox)].
  725prologMultiValued(action_rules(tAgent,vtVerb,ftListFn(ftVar),ftVoprop)).
  726prologMultiValued(mudLastCmdSuccess(tAgent,ftAction,ftBoolean)).
  727prologMultiValued(descriptionHere(ftTerm,ftString)).
  728prologMultiValued(descriptionHere(ftTerm,ftString),prologOrdered).
  729prologMultiValued(determinerString(ftTerm,ftString)).
  730prologMultiValued(typeHasGlyph(ftTerm,ftString)).
  731prologMultiValued(gridValue(tRegion,ftInt,ftInt,tObj)).
  732prologMultiValued(instVerbOverride(ftTerm,ftAction,ftAction)).
  733:- mpred_notrace_exec.  734prologMultiValued(isa(ftTerm,tCol)).
  735prologMultiValued(mudActAffect(ftTerm,ftTerm,ftTerm)).
  736prologMultiValued(mudActAffect(tItem,vtVerb,ftTerm(ftVoprop))).
  737prologMultiValued(mudCmdFailure(tAgent,ftAction)).
  738
  739
  740==> tPred(isEach(tAgent/1, mudEnergy/2,mudHealth/2, mudAtLoc/2, failure/2, typeGrid/3, gridValue/4, isa/2, tItem/1, mudMemory/2, pathName/3, mudPossess/2, tRegion/1, mudScore/2, mudStm/2, mudFacing/2, localityOfObject/2, tThinking/1, mudWearing/2, mudFacing/2, mudHeight/2, act_term/2, nameString/2, mudDescription/2, pathDirLeadsTo/3, mudAgentTurnnum/2)).
  741prologHybrid(mudToHitArmorClass0 / 2).
  742prologHybrid(mudAtLoc/2).
  743prologBuiltin((baseKB:agent_command/2)).
  744==> prologHybrid(isEach(argIsa/3, formatted_resultIsa/2, typeHasGlyph/2, inRegion/2, 
  745  mudContains/2, isa/2, mudLabelTypeProps/3, mudMemory/2, mudPossess/2, mudStowing/2, 
  746  genls/2, mudToHitArmorClass0/2, pddlSomethingIsa/2, resultIsa/2,  
  747  completeExtentAsserted/1, subFormat/2, tCol/1, tRegion/1, completelyAssertedCollection/1, 
  748  ttExpressionType/1, typeProps/2)).
  749
  750==> prologHybrid(isEach(tItem/1, tRegion/1, instVerbOverride/3,mudNamed/2, determinerString/2, mudKeyword/2 ,descriptionHere/2, mudToHitArmorClass0/2, tThinking/1, tDeleted/1, mudWeight/2, mudPermanence/3, act_term/2, mudAgentTurnnum/2, mudAtLoc/2, mudEnergy/2, mudHealth/2, mudDescription/2, mudFacing/2, mudCmdFailure/2, mudSpd/2, typeGrid/3, mudHeight/2, mudMemory/2, isa/2, pathName/3, mudPossess/2, mudScore/2, mudStm/2, mudStr/2, wearsClothing/2)).
  751==> prologHybrid(isEach( mudArmorLevel/2, mudLevelOf/2, mudToHitArmorClass0/2, mudBareHandDamage/2, chargeCapacity/2, mudEnergy/2, tCol/1, tAgent/1, tItem/1, tRegion/1, instVerbOverride/3,mudNamed/2, determinerString/2, mudKeyword/2 ,descriptionHere/2, tThinking/1, mudWeight/2, mudPermanence/3, act_term/2, mudAgentTurnnum/2, mudAtLoc/2, mudEnergy/2, mudHealth/2, mudDescription/2, mudFacing/2, failure/2, gridValue/4, mudHeight/2, mudMemory/2, isa/2, pathName/3, mudPossess/2, mudScore/2, mudStm/2, mudStr/2, mudWearing/2)).
  752
  753% :-must(fully_expand(clause(asert,test),prologHybrid(typeHasGlyph,2),(arity(typeHasGlyph, 2), prologHybrid(typeHasGlyph), tPred(typeHasGlyph)))).
  754
  755arity(typeHasGlyph,2).
  756arity(mudTermAnglify,2).
  757arity(mudMaxHitPoints,2).
  758
  759
  760prologHybrid(instVerbOverride(ftTerm,ftAction,ftAction)).
  761%isa(localityOfObject,prologHybrid). 
  762%isa(mudActAffect, prologMultiValued).
  763%isa(mudMaxHitPoints,prologHybrid).
  764isa(vtDirection,ttValueType).
  765
  766prologMultiValued(agent_text_command(tAgent,ftText,tAgent,ftAction)).
  767
  768formatted_resultIsa(apathFn(tRegion,vtDirection),tPathway).
  769
  770prologBuiltin(is_vtActionTemplate/1).
  771
  772is_vtActionTemplate(C):-nonvar(C),get_functor(C,F),!,atom_concat(act,_,F).
  773
  774defnSufficient(ftAction,is_vtActionTemplate).
  775defnSufficient(ftAction,vtVerb).
  776defnSufficient(ftTerm,vtValue).
  777
  778:- use_module(library(logicmoo_plarkc)).  779
  780:- install_constant_renamer_until_eof.  781:- set_prolog_flag(do_renames_sumo,never).  782
  783genls('FemaleAnimal',tAgent).
  784genls('MaleAnimal',tAgent).
  785==>genls(isEach('PortableObject','ProtectiveAttire','SomethingToWear'),tCarryAble).
  786==>genls(isEach('ProtectiveAttire','SomethingToWear'),tWearAble).
  787==>genls(isEach(tRegion,tAgent),tChannel).
  788
  789genls(tAgent,tObj).
  790genls(tAgent,tSpatialThing).
  791genls(tItem,tObj).
  792genls(tItem,tSpatialThing).
  793genls(tObj,tSpatialThing).
  794genls(tPred,tRelation).
  795genls(tRegion,tSpatialThing).
  796genls(ttObjectType,tCol).
  797genls(ttSpatialType,tCol).
  798genls(tFunction,tRelation).
  799tPred(meta_argtypes).
  800meta_argtypes(aDirectionsFn(ftTerm,ftListFn(ftTerm))).
  801meta_argtypes(apathFn(tRegion,vtDirection)).
  802meta_argtypes(xyzFn(tRegion,ftInt,ftInt,ftInt)).
  803
  804% :- set_prolog_flag(assert_attvars,true).
  805
  806genls(ttTypeByAction,tCol).
  807
  808% :-locally(set_prolog_flag(assert_attvars,true),ain(((ttTypeByAction(X) ==> tCol(X))))).
  809
  810% (isa(Inst,Type),isa(Type,ttTypeByAction)) ==> isa(Inst,tHasAction).
  811
  812ttTypeByAction(C),isa(I,C),{\+ is_in_world(I)} ==> \+ isa(I,C).
  813
  814/*
  815% Produces actEat(String):- current_agent(Agent),baseKB:agent_call_command(Agent,actEat(String)).
  816((vtActionTemplate(Compound)/(compound(Compound), 
  817    \+ current_predicate(_,Compound),
  818    arg(1,Compound,TC),
  819    functor(Compound,F,A),
  820    functor(Skel,F,A),
  821    arg(1,Compound,String)))
  822  ==> 
  823   ( (Skel 
  824       :- 
  825       current_agent(Agent),baseKB:agent_call_command(Agent,Skel)),
  826    {nop((asserta_if_new((baseKB:agent_call_command(Agent,Skel) 
  827       :- agent_coerce_for(mudPossess,TC,Agent,String,Obj),!,
  828          baseKB:agent_call_command(Agent,Skel)))))})).
  829*/
  830
  831
  832genls(tAgent,tObj).
  833genls(tAgent,tSpatialThing).
  834genls(tItem,tObj).
  835genls(tItem,tSpatialThing).
  836genls(tObj,tSpatialThing).
  837genls(tPred,tRelation).
  838genls(tRegion,tSpatialThing).
  839genls(tFunction,tRelation).
  840
  841genls(tCarryAble,tItem).
  842genls(tChargeAble,tItem).
  843genls(tContolDevice,tChargeAble).
  844
  845genls(tDoor,tFurniture).
  846 % mdefault(genls(tDoor,tItem)).
  847genls(tDrinkAble,tItem).
  848genls(tEatAble,tItem).
  849genls(tFurniture,tObj).
  850genls(tFurniture,tPartofObj).
  851genls(tHumanControlled,tAgent).
  852genls(mobMonster,tAgentGeneric).
  853genls(tNpcAgent,tAgent).
  854genls(tPathway,tDoor).
  855genls(tUseAble,tItem).
  856genls(tWearAble,tItem).
  857genls(vtBasicDir,vtBasicDirPlusUpDown).
  858genls(vtBasicDirPlusUpDown,vtDirection).
  859genls(vtDirection,vtValue).
  860
  861:- kb_shared(vtPosture/1).  862
  863tCol(vtPosture).
  864genls(vtPosture,vtVerb).
  865
  866
  867action_to_able(actSearch,tSearchAble).
  868action_to_able(actOperate,tOperateAble).
  869action_to_able(actObserve,tObserveAble).
  870(action_to_able(ACT,ABLE)==> ((argIsa(ACT,1,Type),isa(Type,ttObjectType))==> genls(Type,ABLE))).
  871  
  872
  873genlInverse(mudContains,mudInsideOf).
  874
  875
  876arity(mudInsideOf,2).
  877
  878vtBasicDir(vEast).
  879vtBasicDir(vNorth).
  880vtBasicDir(vSouth).
  881vtBasicDir(vWest).
  882vtBasicDirPlusUpDown(vDown).
  883vtBasicDirPlusUpDown(vUp).
  884%localityOfObject(Above,HasSurface):- mudLocOnSurface(Above,HasSurface).
  885%localityOfObject(Clothes,Agent):- mudSubPart(Agent,Clothes).
  886%localityOfObject(Inner,Container):- mudInsideOf(Inner,Container).
  887%localityOfObject(Inner,Outer):- only_if_pttp, localityOfObject(Inner,Container),localityOfObject(Container,Outer).
  888nameString(apathFn(Region,Dir),Text):- pathName(Region,Dir,Text).
  889meta_argtypes(mudMaterial(tSpatialThing,vtMaterial)).
  890meta_argtypes(mudTexture(tSpatialThing,vtTexture)).
  891meta_argtypes(mudWearing(tAgent,tWearAble)).
  892meta_argtypes(pathName(tRegion,vtDirection,ftString)).
  893meta_argtypes(resultIsa(tFunction,tCol)).
  894meta_argtypes(wasSuccess(tAgent,vtActionTemplate,ftBoolean)).
  895meta_argtypes(type_action_info(tCol,vtActionTemplate,ftText)).
  896%NEXT TODO predTypeMax(mudEnergy,tObj,130).
  897%NEXT TODO predTypeMax(mudHealth,tObj,500).
  898
  899tCol(ttAgentType).
  900
  901prologHybrid(pathDirLeadsTo(tRegion,vtDirection,tRegion)).
  902
  903
  904
  905
  906==> prologHybrid(mudAreaConnected(tRegion,tRegion),rtSymmetricBinaryPredicate).
  907rtArgsVerbatum(mudAreaConnected).
  908
  909rtSymmetricBinaryPredicate(mudAreaConnected).
  910
  911% :- sanity((listing(mudAreaConnected/2),!)),!.
  912
  913ttAgentType(mobMonster).
  914% instTypeProps(apathFn(Region,_Dir),tPathway,[localityOfObject(Region)]).
  915
  916
  917==> ftSpec(vtActionTemplate).
  918
  919disjointWith(tObj,tRegion).
  920disjointWith(tRegion,tObj).
  921
  922
  923ttTemporalType(tAgent).
  924ttTemporalType(tItem).
  925ttTemporalType(tObj).
  926ttTemporalType(tRegion).
  927
  928tCol(tChannel).
  929tChannel(A):- tAgent(A).
  930tChannel(A):- tRegion(A).
  931tChannel(iGossupChannel).
  932%ttTypeFacet(tChannel).
  933:-ain_expanded(isa(tObj,ttTemporalType)).  934:-ain_expanded(isa(tRegion,ttTemporalType)).  935
  936% cycAssert(A,B):- trace_or_throw(cycAssert(A,B)).
  937%:- install_constant_renamer_until_eof.
  938%:- set_prolog_flag_until_eof(do_renames,term_expansion).
  939
  940% genls('SetOrCollection',tCol).
  941genls(ttSetOrCollection, tCol).
  942% genls('Collection',tCol).
  943
  944meta_argtypes(verb_affordance(vtVerb,tTemporalThing,rtStatPred,ftChangeQuantity,ftChangeQuantity)).
  945
  946prologHybrid(dividesBetween(tCol,tCol,tCol)).
  947
  948% defined more correctly below dividesBetween(S,C1,C2) ==> (disjointWith(C1,C2) , genls(C1,S) ,genls(C2,S)).
  949
  950dividesBetween(tAgentGeneric,tAgent,tNonCorporialAgent).
  951dividesBetween(tAgent,tMale,tFemale).
  952dividesBetween(tAgent,tNpcAgent,tHumanControlled).
  953dividesBetween(tItem,tMassfull,tMassless).
  954dividesBetween(tObj,tItem,tAgent).
  955dividesBetween(tObj,tMassfull,tMassless).
  956dividesBetween(tSpatialThing,tObj,tRegion).
  957dividesBetween(tTemporalThing,tObj,tRegion).
  958formatted_resultIsa(ftDiceFn(ftInt,ftInt,ftInt),ftInt).
  959
  960isa(iDungeonMaster,tNonCorporialAgent).
  961
  962genls(tNonCorporialAgent,tMassless).
  963
  964isa(tRegion,ttTemporalType).
  965
  966completelyAssertedCollection(tNonCorporialAgent).
  967completelyAssertedCollection(tAgentGeneric).
  968completelyAssertedCollection(tItem).
  969completelyAssertedCollection(tRegion).
  970completelyAssertedCollection(tObj).
  971completelyAssertedCollection(tAgent).
  972completelyAssertedCollection(tCarryAble).
  973completelyAssertedCollection(vtVerb).
  974genls(ttTypeByAction,completelyAssertedCollection).
  975
  976arity(mudAreaConnected,2).
  977
  978
  979% ensure_some_pathBetween(R1,R2):- cwc,must((ain(pathDirLeadsTo(R1,aRelatedFn(vtDirection,R1,R2),R2)),ain(pathDirLeadsTo(R2,aRelatedFn(vtDirection,R2,R1),R1)))),!.
  980
  981% mudAreaConnected(R1,R2)/ground(mudAreaConnected(R1,R2)) ==> isa(R1,tRegion),isa(R2,tRegion),mudAreaConnected(R2,R1).
  982
  983(mudAreaConnected(R1,R2)/
  984 (ground(mudAreaConnected(R1,R2)),
  985   \+ pathDirLeadsTo(R1,_,R2),
  986  {sys_random_path_dir(Dir)},reverse_dir(Dir,Rev),\+ pathDirLeadsTo(R1,Dir,_NotR2), 
  987   \+ pathDirLeadsTo(R2,Rev,_NotR1))) ==>
  988  pathDirLeadsTo(R1,Dir,R2).
  989  
  990
  991% pathDirLeadsTo(R1,Dir,_)==>tPathway(apathFnPLD(R1,Dir)).
  992
  993% Is PathFn a total reifable function or a  partual unreifiable ?
  994rtPartialFunction(apathFn).
  995rtReifiableFunction(apathFn).
  996
  997pathDirLeadsTo(R1,Dir,R2)/reverse_dir(Dir,Rev) ==> pathDirLeadsTo(R2,Rev,R1).
  998pathDirLeadsTo(R1,_,R2) ==> mudAreaConnected(R1,R2).
  999
 1000singleValuedInArg(pathDirLeadsTo,2).
 1001
 1002
 1003% ==================================================
 1004% Classes of things
 1005% ==================================================
 1006
 1007
 1008genls(tAgent,tObj).
 1009genls(tItem,tObj).
 1010genls(tClothing, tWashAble).
 1011genls(tClothing, tWearAble).
 1012genls(tFood,tEatAble).
 1013genls(tFood, tItem).
 1014genls(tClothing, tItem).
 1015
 1016genls( tCarryAble, tItem).
 1017genls( tCarryAble, tDropAble).
 1018
 1019/*
 1020
 1021tCol(genlsInheritable).
 1022:-dynamic(genlsInheritable/1).
 1023
 1024genlsInheritable(tCol).
 1025genlsInheritable(ttRelationType).
 1026:-must(ain((genls(ttTypeType,genlsInheritable)))).
 1027
 1028:- dynamic(nearestIsa/2).
 1029(genls(C,SC)/ground(genls(C,SC)),nearestIsa(SC,W),\+ genlsInheritable(W) )==>isa(C,W).
 1030
 1031*/
 1032
 1033% throw(sane_transitivity (genls( tCarryAble, tThrowAble))).
 1034% genls( tCarryAble, tCarryAble).
 1035
 1036genls(tPortableDevice,tCarryAble).
 1037
 1038prologIsFlag(spatialInRegion/1).
 1039
 1040:-do_gc. 1041
 1042genls(tClothing, tFoldAble).
 1043genls(tClothing, tWearAble).
 1044
 1045genls(tLiquidContainer, tDrinkAble).
 1046genls(tLiquidContainer, tCarryAble).
 1047
 1048
 1049genls(tFoldAble, tCarryAble).
 1050% genls(tThrowAble, tCarryAble).
 1051genls(tPortableDevice,tCarryAble).
 1052genls(tPortableDevice,tPhysicalDevice).
 1053genls(tPhysicalDevice,tUseAble).
 1054genls(tWearAble, tCarryAble).
 1055genls(tFood,tCarryAble).
 1056genls(tCarryAble,tObj).
 1057genls(tPartofObj,tNotTakAble).
 1058genls(tBodyPart,tPartofObj).
 1059genls(tSpatialThing,tLookAble).
 1060genls(tFurnature,tOntoAble).
 1061genls(tFurnature,tItem).
 1062
 1063genls(tPartofFurnature,tPartofObj).
 1064
 1065
 1066
 1067
 1068
 1069
 1070%(isa(I,Sub), disjointWith(Sub, Super)) ==> neg(isa(I,Super)).
 1071
 1072
 1073 % mdefault(genls(tPartofObj,tItem)).
 1074
 1075
 1076(sometimesBuggy,dividesBetween(S,C1,C2)/ground(v(S,C1,C2))) ==> (disjointWith(C1,C2) , genls(C1,S) ,genls(C2,S)).
 1077
 1078% disjointWith(P1,P2) ==> (not(isa(C,P1)) <==> isa(C,P2)).
 1079
 1080
 1081isa(tRegion,ttSpatialType).
 1082isa(tRelation,ttAbstractType).
 1083==>typeProps(tTorso,[mudColor(isLikeFn(mudColor,tSkin)),mudShape(vUnique)]).
 1084==>typeProps(tSkin,[mudColor(vUnique),mudShape(vUnique)]).
 1085
 1086%Empty Location
 1087% You *have* to use 0 as the id of the empty location. (no way!)
 1088mudLabelTypeProps("--",tRegion,[]).
 1089
 1090%NEXT TODO predTypeMax(mudEnergy,tAgent,120).
 1091
 1092typeProps(tAgent,[predInstMax(mudHealth,500)]).
 1093%genls('Indoors-IsolatedFromOutside',tRegion).
 1094genls(tIndoorsIsolatedFromOutside, tRegion).
 1095% genls('SpaceInAHOC',tRegion).
 1096genls(tPlaceLikeSpaceInAHOC,tRegion).
 1097
 1098:- if( \+ current_prolog_flag(address_bits, 32)). 1099%:- before_boot(set_prolog_stack_gb(16)).
 1100:- endif. 1101
 1102
 1103% TOO SLOW 
 1104typeProps(tAgent,[mudMoveDist(1)]).
 1105% isRandom(vtBasicDir)
 1106typeProps(tAgent,[predInstMax(mudHealth,500), predInstMax(mudEnergy,200), mudHealth(90), 
 1107  % mudEnergy(90),  
 1108  mudFacing(vNorth), mudAgentTurnnum(0), mudScore(1)]).
 1109% typeProps(tAgent,mudLastCommand(actStand)).
 1110% typeProps(tAgent,mudNeedsLook(vFalse)).
 1111
 1112typeProps(tFood,[mudHeight(0)]).
 1113
 1114
 1115% TOO STICKY ==>
 1116typeProps(tItem,mudEnergy(140)).
 1117
 1118% I am developing a Conflict learning system that works for full FOL .. it works to produces conflict duce_tru horn clauses(HC) heads (as well as normally what is derived from HCs) of cource if i tried to ground the Conflists it produce exponeticals so what i do is enure all conflicts can be found by backchaining at a depth of three 
 1119typeProps(C,Ps)==> (isa(I,C)==>props(I,Ps)).
 1120
 1121% typeProps(tAgent,[mudMemory(aDirectionsFn([vNorth,vSouth,vEast,vWest,vNE,vNW,vSE,vSW,vUp,vDown]))]).
 1122
 1123%typeProps(tItem,mudListPrice(0)).
 1124typeProps(tObj,mudOpaqueness(100)).
 1125typeProps(tRegion,mudOpaqueness(1)).
 1126% CRAZY typeProps(tSpatialThing,mudHeight(1)).
 1127
 1128% :-end_module_type(dynamic).
 1129
 1130
 1131pass3==> (mudLabelTypeProps(Lbl,Type,Props)/ground(typeHasGlyph(Type,Lbl))==> (typeHasGlyph(Type,Lbl) , typeProps(Type,Props))).
 1132
 1133ps3:- cwc, with_mpred_trace_exec(ain(pass3)).
 1134
 1135% Vacuum World example objects........
 1136mudLabelTypeProps("wl",tWall,[mudHeight(3),mudWeight(4)]).
 1137
 1138%TOO SLOW isa(I,SC)<=isa(I,C),genls(C,SC).
 1139
 1140wearsClothing(A,I)==>tAgent(A),tClothing(I).
 1141
 1142
 1143% The verb to relate (he relates, they relate, he related, it is related, he is relating) implies the universal relation.
 1144rtBinaryPred(mudUniversallyRelated).
 1145
 1146synonomousExternalContext(conceptuallyRelated,iInform7System,mudUniversallyRelated).
 1147
 1148% The verb to incorporate (he incorporates, they incorporate, he incorporated, it is incorporated, he is incorporating) implies the incorporation relation. The verb to be part of implies the reversed incorporation relation.
 1149tSpatialTanability(mudIncorporationRelation).
 1150% The verb to provide (he provides, they provide, he provided, it is provided, he is providing) implies the provision relation.
 1151tSpatialTanability(mudProducesRelation).  % CreationEvent
 1152tSpatialTanability(mudSupportedBy).  % mudSupportedBy is not cycSupportedBy
 1153tSpatialTanability(mudEnclosedBy). % contains-Underspecified 
 1154
 1155meta_argtypes(inPermeates(tSolidTangibleThinh, tLiquidTangibleThing)).
 1156
 1157tSpatialTanability(P)==>argsIsa(P,tTangible).
 1158/*
 1159wearsClothing(A,I) ==> (isa(I,IType),
 1160   wornOnTypeType(IType,BType),
 1161    hasBodyPart(A,BPart),
 1162    isa(BPart,BType),
 1163      wornOn(I,BPart)).
 1164wornOn(I,BPart),hasBodypart(A,BPart) ==> wearsClothing(A,I).
 1165wornOn(I,BPart),isa(BPart,BType),isa(I,IType) ==> wornOnTypeType(IType,BType).
 1166*/
 1167
 1168
 1169
 1170genls(tBread, tFood).
 1171
 1172==>
 1173 typeProps(tCrackers,
 1174  [mudColor(vTan),tBread,
 1175   mudShape(isEach(vCircular,vFlat)),
 1176   mudSize(vSmall),
 1177   mudTexture(isEach(vDry,vCoarse))]).
 1178
 1179nonvar_must_be(V,G):- (var(V);G),!.
 1180
 1181% TODO SPEED THIS UP 
 1182% mudKeyword(I,Str)<= {(nonvar(I);nonvar(Str)), nonvar_must_be(I,\+tCol(I)), nonvar_must_be(Str,string(Str))}, isa(I,Type),mudKeyword(Type,Str).
 1183
 1184pfc_slow((mudKeyword(Type,Str),tCol(Type),isa(I,Type)/(atom(I),ftID(I)) ==> mudKeyword(I,Str))).
 1185
 1186
 1187baseKB:action_info(C,_)==>vtActionTemplate(C).
 1188
 1189completelyAssertedCollection(cachedPredicate).
 1190
 1191rtArgsVerbatum(cachedPredicate).
 1192
 1193ttRelationType(cachedPredicate).
 1194cachedPredicate(P)/predicate_to_goal(P,Goal)==>{forall(call_u(Goal),ain(Goal))}.
 1195
 1196cachedPredicate(vtActionTemplate(_)).
 1197
 1198
 1199/*
 1200
 1201% from inform7
 1202prologHybrid(mudRelating(ftID,ftID)).
 1203prologHybrid(mudProviding(ftID,ftID)).
 1204prologHybrid(mudSupportsSpatially(ftID,ftID)).
 1205prologHybrid(mudIncorporates(ftID,ftID)).
 1206prologHybrid(mudEncloses(ftID,ftID)).
 1207prologHybrid(mudContainment(ftID,ftID)).
 1208
 1209An object has a text called printed name.
 1210An object has a text called printed plural name.
 1211An object has a text called an indefinite article.
 1212An object can be plural-named or singular-named. An object is usually singular-named.
 1213An object can be proper-named or improper-named. An object is usually improper-named.
 1214
 1215A room can be privately-named or publically-named. A room is usually publically-named.
 1216A room can be lighted or dark. A room is usually lighted.
 1217A room can be visited or unvisited. A room is usually unvisited.
 1218A room has a text called description.
 1219
 1220Y [can] be C1 or C2.  
 1221Y is [usually] C2.
 1222
 1223A thing can be lit or unlit. A thing is usually unlit.
 1224A thing can be edible or inedible. A thing is usually inedible.
 1225A thing can be fixed in place or portable. A thing is usually portable.
 1226A thing can be scenery.
 1227A thing can be wearable.
 1228A thing can be pushable between rooms.
 1229
 1230The north is a direction.
 1231The northeast is a direction.
 1232The northwest is a direction.
 1233The south is a direction.
 1234The southeast is a direction.
 1235The southwest is a direction.
 1236The east is a direction.
 1237A/sr1 - SR1 - Physical World Model S30 14
 1238The west is a direction.
 1239The up is a direction.
 1240The down is a direction.
 1241The inside is a direction.
 1242The outside is a direction.
 1243The north has opposite south. Understand "n" as north.
 1244The northeast has opposite southwest. Understand "ne" as northeast.
 1245The northwest has opposite southeast. Understand "nw" as northwest.
 1246The south has opposite north. Understand "s" as south.
 1247The southeast has opposite northwest. Understand "se" as southeast.
 1248The southwest has opposite northeast. Understand "sw" as southwest.
 1249The east has opposite west. Understand "e" as east.
 1250The west has opposite east. Understand "w" as west.
 1251Up has opposite down. Understand "u" as up.
 1252Down has opposite up. Understand "d" as down.
 1253Inside has opposite outside. Understand "in" as inside.
 1254Outside has opposite inside. Understand "out" as outside.
 1255The inside object translates into I6 as "in_obj".
 1256The outside object translates into I6 as "out_obj".
 1257The verb to be above implies the mapping up relation.
 1258The verb to be mapped above implies the mapping up relation.
 1259The verb to be below implies the mapping down relation.
 1260The verb to be mapped below implies the mapping down relatio
 1261
 1262A door has an object called other side.
 1263The other side property translates into I6 as "door_to".
 1264Leading-through relates one room (called the other side) to various doors.
 1265The verb to be through implies the leading-through relation.
 1266S33. Containers and supporters. The carrying capacity property is the exception to the remarks above
 1267about the qualitative nature of the world model: here for the first and only time we have a value which can
 1268be meaningfully compared.
 1269Section SR1/6 - Containers
 1270The specification of container is "Represents something into which portable
 1271things can be put, such as a teachest or a handbag. Something with a really
 1272large immobile interior, such as the Albert Hall, had better be a room
 1273instead."
 1274A container can be enterable.
 1275A container can be opaque or transparent. A container is usually opaque.
 1276A container has a number called carrying capacity.
 1277The carrying capacity of a container is usually 100.
 1278Include (- has container, -) when defining a container
 1279
 1280The specification of supporter is "Represents a surface on which things can be
 1281placed, such as a table."
 1282A supporter can be enterable.
 1283A supporter has a number called carrying capacity.
 1284The carrying capacity of a supporter is usually 100.
 1285A supporter is usually fixed in place.
 1286Include (-
 1287has transparent supporter
 1288-) when defining a supporter
 1289
 1290A door can be open or closed. A door is usually closed.
 1291A door can be openable or unopenable. A door is usually openable.
 1292A container can be open or closed. A container is usually open.
 1293A container can be openable or unopenable. A container is usually unopenable.
 1294
 1295Before rules is a rulebook. [20]
 1296Instead rules is a rulebook. [21]
 1297Check rules is a rulebook. [22]
 1298Carry out rules is a rulebook. [23]
 1299After rules is a rulebook. [24]
 1300Report rules is a rulebook. [25]
 1301
 1302Action-processing rules is a rulebook. [10]
 1303The action-processing rulebook has a person called the actor.
 1304Setting action variables is a rulebook. [11]
 1305The specific action-processing rules is a rulebook. [12]
 1306The specific action-processing rulebook has a truth state called action in world.
 1307The specific action-processing rulebook has a truth state called action keeping silent.
 1308The specific action-processing rulebook has a rulebook called specific check rulebook.
 1309The specific action-processing rulebook has a rulebook called specific carry out rulebook.
 1310The specific action-processing rulebook has a rulebook called specific report rulebook.
 1311The specific action-processing rulebook has a truth state called within the player''s sight.
 1312The player''s action awareness rules is a rulebook. [13]
 1313S16. The rules on accessibility and visibility, which control whether an action is physically possible, have
 1314named outcomes as a taste of syntactic sugar.
 1315Accessibility rules is a rulebook. [14]
 1316Reaching inside rules is an object-based rulebook. [15]
 1317Reaching inside rules have outcomes allow access (success) and deny access (failure).
 1318Reaching outside rules is an object-based rulebook. [16]
 1319Reaching outside rules have outcomes allow access (success) and deny access (failure).
 1320Visibility rules is a rulebook. [17]
 1321Visibility rules have outcomes there is sufficient light (failure) and there is
 1322insufficient light (success).
 1323S17. Two rulebooks govern the processing of asking other people to carry out actions:
 1324Persuasion rules is a rulebook. [18]
 1325Persuasion rules have outcomes persuasion succeeds (success) and persuasion fails (failure).
 1326Unsuccessful attempt by is a rulebook. [19]
 1327
 1328*/
 1329
 1330
 1331:- dynamic(baseKB:mudNeedsLook/2). 1332:- export(baseKB:mudNeedsLook/2). 1333:- pfc_lib:import(baseKB:mudNeedsLook/2). 1334
 1335
 1336prologBuiltin(onEachLoad/0).
 1337rtArgsVerbatum(onEachLoad).
 1338rtArgsVerbatum(must).
 1339
 1340ttRelationType(rtStatPred).
 1341
 1342prologHybrid(normalAgentGoal(rtStatPred,ftTerm)).
 1343
 1344((rtRolePredicate(Pred)==>
 1345  ((relationMostInstance(Pred,Type,Value))==>
 1346    ((isa(X,Type))==>mdefault(t(Pred,X,Value)))))).
 1347
 1348
 1349:- ain((relationMostInstance(Pred,Type,Value))==>
 1350 ((isa(X,Type))==>mdefault(t(Pred,X,Value)))).
 1351
 1352
 1353(rtStatPred(Pred)/must(atom(Pred))==>(
 1354    arity(Pred,2),
 1355    rtRolePredicate(Pred),
 1356    singleValuedInArg(Pred,2),
 1357    rtBinaryPredicate(Pred))).
 1358
 1359(((normalAgentGoal(Pred,N)/must(atom(Pred)) ==>
 1360 ({kb_shared(Pred/2),
 1361   AT=..[Pred,tAgent,ftPercent]},
 1362   rtStatPred(Pred),
 1363   meta_argtypes(AT),
 1364   relationMostInstance(Pred,tAgent,N))))).
 1365
 1366normalAgentGoal(mudEnergy,140).
 1367normalAgentGoal(mudHealth,90).
 1368normalAgentGoal(mudHygiene,90).
 1369
 1370normalAgentGoal(mudNonHunger,90).
 1371normalAgentGoal(mudBladderEmpty,90).
 1372normalAgentGoal(mudSecureRoom,90).
 1373normalAgentGoal(mudFun,90).
 1374normalAgentGoal(mudNonLonelinessSocial,90).
 1375normalAgentGoal(mudSadToHappy,90).
 1376normalAgentGoal(mudComfort,90).
 1377
 1378% TO SLOW typeProps(tAgent,[mudStr(2),mudHeight(2),mudStm(2),mudSpd(2)]).
 1379
 1380%normalAgentGoal(Pred,Val)==>  (tAgent(A)==>agentGoals(A,Pred,((t(Pred,A,V),V>=Val)))).
 1381%agentGoals(A,About,State)/State ==> \+ agentTODO(A,actImprove(About)).
 1382
 1383prologHybrid(on_command_show(tAgent,vtActionTemplate,ftTerm)).
 1384prologHybrid(agentTODO(tAgent,vtActionTemplate)).
 1385prologHybrid(agentGOAL(tAgent,ftAssertable)).
 1386
 1387normalAgentGoal(Pred,Val) ==>  ( t(Pred,A,V)/(V<Val) ==> agentTODO(A,actImprove(Pred))).
 1388normalAgentGoal(Pred,Val) ==>  ( t(Pred,A,V)/(V<Val) ==> agentGOAL(A,t(Pred,A,Val))).
 1389
 1390:-ain((normalAgentGoal(Pred,Val) ==>  ( t(Pred,A,V)/(V<Val) ==> agentGOAL(A,t(Pred,A,Val))))).
 1391% :-mpred_fwd((normalAgentGoal(Pred,Val) ==>  ( t(Pred,A,V)/(V<Val) ==> agentGOAL(A,t(Pred,A,Val))))).
 1392normalAgentGoal(Pred,Val)==>  (tAgent(A)==>mdefault(t(Pred,A,Val))).
 1393
 1394
 1395genls(tRoom,tRegion).
 1396
 1397tAgent(iExplorer7).
 1398
 1399mud_listing(M):- cwc, xlisting((M,-completely_expanded,-'$spft',-'$nt',-'$pt',- (==>))).
 1400
 1401% :- mud_listing(iExplorer7).
 1402
 1403==> onQueueEmpty(must(mudFun(iExplorer7,_W))).
 1404
 1405vtActionTemplate(actImprove(rtStatPred)).
 1406
 1407%:- listing(vtActionTemplate/1).
 1408
 1409% check to make sure the canonicalizer left the compound..
 1410==> onQueueEmpty(sanity(clause(baseKB:vtActionTemplate(actImprove(rtStatPred)),true))).
 1411% instead of replacing with..
 1412==> onQueueEmpty(sanity( \+ clause(baseKB:vtActionTemplate(actImprove),true))).
 1413
 1414
 1415 
 1416/*
 1417
 1418% :- set_prolog_flag(dialect_pfc,cwc).
 1419:- notrace(kif_to_boxlog(((parent('$VAR'('G'),'$VAR'('P')) & parent('$VAR'('P'),'$VAR'('C'))) => grandparent('$VAR'('G'),'$VAR'('C'))),O)),dmsg(O).
 1420
 1421 the CycL language extends Prolog''s first order logic capabilities with some higher order logics.  
 1422 It also extrends prolog to show proofs.. one issue is the CycL language never signed up for cuts or other execution  orders.    
 1423 PrologMUD extends the CycL language to allow preset program flow (unless a predicate is declared to not honor order of execution 
 1424  (this is usually best!)).  PrologMUD  implements a new design of the cyc canonicalizer..   
 1425
 1426 usually in Cyc the rules "(implies (and Axy Byz) (and Cwxyz Dwx))" are converted to DNF (Correct me if I am wrong.. 
 1427 since i have heard it uses ConjuntiveNormalForm as well) ... the DNF generates Clausal forms..  The forms choosen 
 1428
 1429
 1430
 1431?-  kif_to_boxlog(((parent('$VAR'('G'),'$VAR'('P')) & parent('$VAR'('P'),'$VAR'('C'))) => grandparent('$VAR'('G'),'$VAR'('C'))),O),dmsg(O).
 1432
 1433O = [ (-parent(G, P):- -grandparent(G, C), parent(P, C)), 
 1434      (-parent(P, C):- -grandparent(G, C), parent(G, P)), 
 1435      (grandparent(G, C):-parent(G, P), parent(P, C))].
 1436
 1437
 1438?- kif_to_boxlog( (grandparent('$VAR'('G'),'$VAR'('C')) => exists('$VAR'('P'), (parent('$VAR'('G'),'$VAR'('P')) & parent('$VAR'('P'),'$VAR'('C'))))),O).
 1439
 1440    (-grandparent(G, C):- mudEquals(P, skUnkArg2OfParentArg1OfFn(KB, C, G)), (-parent(G, P) ; -parent(P, C))),   % You have proven G is not the grandparent of C when you have proven tha G has no children or that C has no parents
 1441    (-mudEquals(P, skUnkArg2OfParentArg1OfFn(KB, C, G)):- grandparent(G, C), (-parent(G, P) ; -parent(P, C))), 
 1442    (parent(G, P):-grandparent(G, C), mudEquals(P, skUnkArg2OfParentArg1OfFn(KB, C, G))), % if you prove G is grandparent of P somehow, you will have proved that G is parent to  parentOf P
 1443    (parent(P, C):-grandparent(G, C), mudEquals(P, skUnkArg2OfParentArg1OfFn(KB, C, G))),
 1444    (mudEquals(P, skUnkArg2OfParentArg1OfFn(KB, C, G)):- grandparent(G, C),  \+ (parent(G, P) , parent(P, C)))]  % We failed to find a true P
 1445
 1446
 1447O = [ 
 1448      (-grandparent(G, P):- -parent(G, _P) ; -parent(_P, P)),    
 1449      parent(G, P):- grandparent(G, C), parent(P,C),   % if you prove G is grandparent of P somehow, you will have proved that G is parent to  parentOf P
 1450      parent(P, C):- grandparent(G, C), parent(G,P))].   % if you prove G is grandparent of P somehow, you will have proved that G is parent to  parentOf P
 1451
 1452*/
 1453
 1454/*
 1455
 1456(((meta_argtypes(Types)/
 1457 (functor(Types,F,A), A >1, functor(Matcher,F,A),arity(F,A)))
 1458  ==> 
 1459    ((Matcher ==> {between(1,A,N),arg(N,Matcher,I),arg(N,Types,T),ground(I:T)},\+ttExpressionType(T),isa(I,T),{dmsg(isa(I,T))})))).
 1460
 1461((argQuotedIsa(Pred, _, 'CycLSentence') ==> 'SententialOperator'(Pred))).
 1462
 1463*/
 1464
 1465 % :- set_prolog_flag(dialect_pfc,cwc).
 1466
 1467
 1468% :- time(must(ain_expanded(prologSingleValued(mudFacing666(tObj,vtDirection),[relationMostInstance(tObj,vNorth)],prologHybrid)))).
 1469
 1470% :- profile((ain_expanded(prologSingleValued(mudFacing666(tObj,vtDirection),[relationMostInstance(tObj,vNorth)],prologHybrid)))).