4d94446c25
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1416 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
3531 lines
67 KiB
Prolog
3531 lines
67 KiB
Prolog
/* Generated by CHR bootstrap compiler
|
|
From: guard_entailment.chr
|
|
Date: [84,104,117,32,79,99,116,32,50,55,32,49,54,58,51,54,58,49,52,32,50,48,48,53,10]
|
|
|
|
DO NOT EDIT. EDIT THE CHR FILE INSTEAD
|
|
*/
|
|
|
|
:-module(guard_entailment,[entails_guard/2,simplify_guards/5]).
|
|
:-use_module(chr_runtime).
|
|
:-style_check((-singleton)).
|
|
:-style_check((-discontiguous)).
|
|
:-use_module(library(lists)).
|
|
:-use_module(hprolog).
|
|
:-use_module(builtins).
|
|
entails_guard(A,B) :-
|
|
copy_term_nat((A,B),(C,D)),
|
|
term_variables(C,E),
|
|
variables(E),
|
|
entails_guard2(C),
|
|
!,
|
|
test(D),
|
|
!,
|
|
cleanup.
|
|
entails_guard2([]).
|
|
entails_guard2([A|B]) :-
|
|
known(A),
|
|
entails_guard2(B).
|
|
simplify_guards(A,B,C,D,E) :-
|
|
copy_term_nat((A,C),(F,G)),
|
|
term_variables(F,H),
|
|
variables(H),
|
|
entails_guard2(F),
|
|
!,
|
|
simplify(G,I),
|
|
simplified(C,I,D,B,E),
|
|
!,
|
|
cleanup.
|
|
simplified([],[],[],A,A).
|
|
simplified([A|B],[keep|C],[A|D],E,F) :-
|
|
simplified(B,C,D,E,F).
|
|
simplified([_|_],[fail|_],fail,A,A).
|
|
simplified([A|B],[true|C],[D|E],F,G) :-
|
|
builtins:binds_b(A,H),
|
|
term_variables(B,I),
|
|
intersect_eq(H,I,J),
|
|
!,
|
|
( J=[] ->
|
|
term_variables(F,K),
|
|
intersect_eq(H,K,L),
|
|
!,
|
|
( L=[] ->
|
|
D=true,
|
|
G=M
|
|
;
|
|
D=true,
|
|
G=(A,M)
|
|
)
|
|
;
|
|
D=A,
|
|
G=M
|
|
),
|
|
simplified(B,C,E,F,M).
|
|
simplify([],[]).
|
|
simplify([A|B],[C|D]) :-
|
|
( \+try(true,A) ->
|
|
C=true
|
|
;
|
|
builtins:negate_b(A,E),
|
|
( \+try(true,E) ->
|
|
C=fail
|
|
;
|
|
C=keep
|
|
)
|
|
),
|
|
known(A),
|
|
simplify(B,D).
|
|
try(A,B) :-
|
|
( known(A) ->
|
|
true
|
|
;
|
|
format(' ERROR: entailment checker: this is not supposed to happen.
|
|
',[])
|
|
),
|
|
( test(B) ->
|
|
fail
|
|
;
|
|
true
|
|
).
|
|
lookup([],[],_,_) :-
|
|
fail.
|
|
lookup([A|B],[C|D],E,F) :-
|
|
( E==A ->
|
|
F=C
|
|
;
|
|
lookup(B,D,E,F)
|
|
).
|
|
add_args_unif([],[],true).
|
|
add_args_unif([A|B],[C|D],(A=C,E)) :-
|
|
add_args_unif(B,D,E).
|
|
add_args_nunif([],[],fail).
|
|
add_args_nunif([A|B],[C|D],(A\=C;E)) :-
|
|
add_args_nunif(B,D,E).
|
|
add_args_nmatch([],[],fail).
|
|
add_args_nmatch([A|B],[C|D],(A\==C;E)) :-
|
|
add_args_nmatch(B,D,E).
|
|
all_unique_vars(A,B) :-
|
|
all_unique_vars(A,B,[]).
|
|
all_unique_vars([],_,_).
|
|
all_unique_vars([A|B],C,D) :-
|
|
var(A),
|
|
\+memberchk_eq(A,C),
|
|
\+memberchk_eq(A,D),
|
|
all_unique_vars(B,[A|D]).
|
|
:-use_module(chr(chr_runtime)).
|
|
:-use_module(chr(chr_hashtable_store)).
|
|
:-use_module(library('clp/clp_events')).
|
|
'attach_known/1'([],_).
|
|
'attach_known/1'([A|B],C) :-
|
|
( get_attr(A,guard_entailment,H) ->
|
|
H=v(F,D,E),
|
|
( F/\1=:=1 ->
|
|
put_attr(A,guard_entailment,v(F,[C|D],E))
|
|
;
|
|
G is F\/1,
|
|
put_attr(A,guard_entailment,v(G,[C],E))
|
|
)
|
|
;
|
|
put_attr(A,guard_entailment,v(1,[C],[]))
|
|
),
|
|
true,
|
|
'attach_known/1'(B,C).
|
|
'detach_known/1'([],_).
|
|
'detach_known/1'([A|B],C) :-
|
|
( get_attr(A,guard_entailment,I) ->
|
|
I=v(F,D,E),
|
|
( F/\1=:=1 ->
|
|
'chr sbag_del_element'(D,C,H),
|
|
( H==[] ->
|
|
G is F/\ -2,
|
|
( G==0 ->
|
|
del_attr(A,guard_entailment)
|
|
;
|
|
put_attr(A,guard_entailment,v(G,[],E))
|
|
)
|
|
;
|
|
put_attr(A,guard_entailment,v(F,H,E))
|
|
)
|
|
;
|
|
true
|
|
)
|
|
;
|
|
true
|
|
),
|
|
'detach_known/1'(B,C).
|
|
'attach_variables/1'([],_).
|
|
'attach_variables/1'([A|B],C) :-
|
|
( get_attr(A,guard_entailment,H) ->
|
|
H=v(F,D,E),
|
|
( F/\2=:=2 ->
|
|
put_attr(A,guard_entailment,v(F,D,[C|E]))
|
|
;
|
|
G is F\/2,
|
|
put_attr(A,guard_entailment,v(G,D,[C]))
|
|
)
|
|
;
|
|
put_attr(A,guard_entailment,v(2,[],[C]))
|
|
),
|
|
true,
|
|
'attach_variables/1'(B,C).
|
|
'detach_variables/1'([],_).
|
|
'detach_variables/1'([A|B],C) :-
|
|
( get_attr(A,guard_entailment,I) ->
|
|
I=v(F,D,E),
|
|
( F/\2=:=2 ->
|
|
'chr sbag_del_element'(E,C,H),
|
|
( H==[] ->
|
|
G is F/\ -3,
|
|
( G==0 ->
|
|
del_attr(A,guard_entailment)
|
|
;
|
|
put_attr(A,guard_entailment,v(G,D,[]))
|
|
)
|
|
;
|
|
put_attr(A,guard_entailment,v(F,D,H))
|
|
)
|
|
;
|
|
true
|
|
)
|
|
;
|
|
true
|
|
),
|
|
'detach_variables/1'(B,C).
|
|
'$indexed_variables'(B,A) :-
|
|
B=known(_),
|
|
term_variables(B,A).
|
|
'$indexed_variables'(B,A) :-
|
|
B=variables(_),
|
|
term_variables(B,A).
|
|
attach_increment([],_).
|
|
attach_increment([G|H],v(C,A,B)) :-
|
|
'chr not_locked'(G),
|
|
( get_attr(G,guard_entailment,N) ->
|
|
N=v(F,D,E),
|
|
sort(D,I),
|
|
'chr merge_attributes'(A,I,J),
|
|
sort(E,K),
|
|
'chr merge_attributes'(B,K,L),
|
|
M is C\/F,
|
|
put_attr(G,guard_entailment,v(M,J,L))
|
|
;
|
|
put_attr(G,guard_entailment,v(C,A,B))
|
|
),
|
|
attach_increment(H,v(C,A,B)).
|
|
attr_unify_hook(v(C,A,B),N) :-
|
|
sort(A,G),
|
|
sort(B,H),
|
|
( var(N) ->
|
|
( get_attr(N,guard_entailment,O) ->
|
|
O=v(F,D,E),
|
|
sort(D,I),
|
|
'chr merge_attributes'(G,I,J),
|
|
sort(E,K),
|
|
'chr merge_attributes'(H,K,L),
|
|
M is C\/F,
|
|
put_attr(N,guard_entailment,v(M,J,L)),
|
|
'chr run_suspensions_loop'([J,L])
|
|
;
|
|
put_attr(N,guard_entailment,v(C,G,H)),
|
|
'chr run_suspensions_loop'([G,H])
|
|
)
|
|
;
|
|
( compound(N) ->
|
|
term_variables(N,P),
|
|
attach_increment(P,v(C,G,H))
|
|
;
|
|
true
|
|
),
|
|
'chr run_suspensions_loop'([G,H])
|
|
).
|
|
activate_constraint(A,B,C,D) :-
|
|
arg(2,C,E),
|
|
E=mutable(F),
|
|
'chr update_mutable'(active,E),
|
|
( nonvar(D) ->
|
|
true
|
|
;
|
|
arg(4,C,G),
|
|
G=mutable(H),
|
|
D is H+1,
|
|
'chr update_mutable'(D,G)
|
|
),
|
|
( compound(F) ->
|
|
term_variables(F,B),
|
|
'chr none_locked'(B),
|
|
A=yes
|
|
;
|
|
( F==removed ->
|
|
chr_indexed_variables(C,B),
|
|
A=yes
|
|
)
|
|
;
|
|
B=[],
|
|
A=no
|
|
).
|
|
remove_constraint_internal(A,B,C) :-
|
|
arg(2,A,D),
|
|
D=mutable(E),
|
|
'chr update_mutable'(removed,D),
|
|
( compound(E) ->
|
|
B=[],
|
|
C=no
|
|
;
|
|
( E==removed ->
|
|
B=[],
|
|
C=no
|
|
)
|
|
;
|
|
C=yes,
|
|
chr_indexed_variables(A,B)
|
|
).
|
|
allocate_constraint(A,B,C,D) :-
|
|
B=..[suspension,E,F,A,G,H,C|D],
|
|
G=mutable(0),
|
|
'chr empty_history'(I),
|
|
H=mutable(I),
|
|
chr_indexed_variables(B,J),
|
|
F=mutable(passive(J)),
|
|
'chr gen_id'(E).
|
|
insert_constraint_internal(yes,A,B,C,D,E) :-
|
|
B=..[suspension,F,G,C,H,I,D|E],
|
|
chr_indexed_variables(B,A),
|
|
'chr none_locked'(A),
|
|
G=mutable(active),
|
|
H=mutable(0),
|
|
I=mutable(J),
|
|
'chr empty_history'(J),
|
|
'chr gen_id'(F).
|
|
chr_indexed_variables(A,C) :-
|
|
A=..[_,_,_,_,_,_,B|_],
|
|
'$indexed_variables'(B,C).
|
|
'$insert_in_store_known/1'(A) :-
|
|
true,
|
|
'chr global_term_ref_1'(F),
|
|
( get_attr(F,guard_entailment,G) ->
|
|
G=v(D,B,C),
|
|
( D/\1=:=1 ->
|
|
put_attr(F,guard_entailment,v(D,[A|B],C))
|
|
;
|
|
E is D\/1,
|
|
put_attr(F,guard_entailment,v(E,[A],C))
|
|
)
|
|
;
|
|
put_attr(F,guard_entailment,v(1,[A],[]))
|
|
).
|
|
'$delete_from_store_known/1'(A) :-
|
|
true,
|
|
'chr global_term_ref_1'(G),
|
|
( get_attr(G,guard_entailment,H) ->
|
|
H=v(D,B,C),
|
|
( D/\1=:=1 ->
|
|
'chr sbag_del_element'(B,A,F),
|
|
( F==[] ->
|
|
E is D/\ -2,
|
|
( E==0 ->
|
|
del_attr(G,guard_entailment)
|
|
;
|
|
put_attr(G,guard_entailment,v(E,[],C))
|
|
)
|
|
;
|
|
put_attr(G,guard_entailment,v(D,F,C))
|
|
)
|
|
;
|
|
true
|
|
)
|
|
;
|
|
true
|
|
).
|
|
'$insert_in_store_variables/1'(A) :-
|
|
true,
|
|
'chr global_term_ref_1'(F),
|
|
( get_attr(F,guard_entailment,G) ->
|
|
G=v(D,B,C),
|
|
( D/\2=:=2 ->
|
|
put_attr(F,guard_entailment,v(D,B,[A|C]))
|
|
;
|
|
E is D\/2,
|
|
put_attr(F,guard_entailment,v(E,B,[A]))
|
|
)
|
|
;
|
|
put_attr(F,guard_entailment,v(2,[],[A]))
|
|
).
|
|
'$delete_from_store_variables/1'(A) :-
|
|
true,
|
|
'chr global_term_ref_1'(G),
|
|
( get_attr(G,guard_entailment,H) ->
|
|
H=v(D,B,C),
|
|
( D/\2=:=2 ->
|
|
'chr sbag_del_element'(C,A,F),
|
|
( F==[] ->
|
|
E is D/\ -3,
|
|
( E==0 ->
|
|
del_attr(G,guard_entailment)
|
|
;
|
|
put_attr(G,guard_entailment,v(E,B,[]))
|
|
)
|
|
;
|
|
put_attr(G,guard_entailment,v(D,B,F))
|
|
)
|
|
;
|
|
true
|
|
)
|
|
;
|
|
true
|
|
).
|
|
'$enumerate_suspensions'(A) :-
|
|
(
|
|
'chr global_term_ref_1'(B),
|
|
get_attr(B,guard_entailment,C),
|
|
arg(2,C,D),
|
|
'chr sbag_member'(A,D)
|
|
;
|
|
'chr global_term_ref_1'(E),
|
|
get_attr(E,guard_entailment,F),
|
|
arg(3,F,G),
|
|
'chr sbag_member'(A,G)
|
|
).
|
|
known(A) :-
|
|
'known/1__0'(A,_).
|
|
'known/1__0'(A,B) :-
|
|
'chr via_1'(A,E),
|
|
get_attr(E,guard_entailment,F),
|
|
F=v(H,G,_),
|
|
H/\1=:=1,
|
|
'chr sbag_member'(C,G),
|
|
C=suspension(_,mutable(active),_,_,_,_,D),
|
|
D==A,
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,I,J),
|
|
( J==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(I,B)
|
|
;
|
|
true
|
|
)
|
|
).
|
|
'known/1__0'(A,B) :-
|
|
nonvar(A),
|
|
A=(C>D),
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,E,F),
|
|
( F==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(E,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(D<C).
|
|
'known/1__0'(A,B) :-
|
|
nonvar(A),
|
|
A=(C>=D),
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,E,F),
|
|
( F==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(E,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(D=<C).
|
|
'known/1__0'(A,B) :-
|
|
nonvar(A),
|
|
A=(C<D),
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,E,F),
|
|
( F==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(E,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(C=<D),
|
|
known(C=\=D).
|
|
'known/1__0'(A,B) :-
|
|
nonvar(A),
|
|
A=(C is D),
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,E,F),
|
|
( F==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(E,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(C=:=D).
|
|
'known/1__0'(A,B) :-
|
|
nonvar(A),
|
|
A=(C==D),
|
|
( var(B) ->
|
|
allocate_constraint(guard_entailment:'known/1__0'(A,B),B,known(A),[A])
|
|
;
|
|
true
|
|
),
|
|
'chr novel_production'(B,21),
|
|
number(C),
|
|
!,
|
|
'chr extend_history'(B,21),
|
|
activate_constraint(F,E,B,G),
|
|
( F==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(E,B)
|
|
;
|
|
true
|
|
),
|
|
known(C=:=D),
|
|
( B=suspension(_,mutable(active),_,mutable(G),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__1'(A,B)
|
|
;
|
|
true
|
|
).
|
|
'known/1__0'(A,B) :-
|
|
( var(B) ->
|
|
allocate_constraint(guard_entailment:'known/1__0'(A,B),B,known(A),[A])
|
|
;
|
|
true
|
|
),
|
|
'known/1__1'(A,B).
|
|
'known/1__1'(A,B) :-
|
|
nonvar(A),
|
|
A=(C==D),
|
|
'chr novel_production'(B,22),
|
|
number(D),
|
|
!,
|
|
'chr extend_history'(B,22),
|
|
activate_constraint(F,E,B,G),
|
|
( F==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(E,B)
|
|
;
|
|
true
|
|
),
|
|
known(C=:=D),
|
|
( B=suspension(_,mutable(active),_,mutable(G),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__2'(A,B)
|
|
;
|
|
true
|
|
).
|
|
'known/1__1'(A,B) :-
|
|
'known/1__2'(A,B).
|
|
'known/1__2'(A,B) :-
|
|
nonvar(A),
|
|
A=(C\==D),
|
|
'chr novel_production'(B,23),
|
|
number(C),
|
|
!,
|
|
'chr extend_history'(B,23),
|
|
activate_constraint(F,E,B,G),
|
|
( F==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(E,B)
|
|
;
|
|
true
|
|
),
|
|
known(C=\=D),
|
|
( B=suspension(_,mutable(active),_,mutable(G),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__3'(A,B)
|
|
;
|
|
true
|
|
).
|
|
'known/1__2'(A,B) :-
|
|
'known/1__3'(A,B).
|
|
'known/1__3'(A,B) :-
|
|
nonvar(A),
|
|
A=(C\==D),
|
|
'chr novel_production'(B,24),
|
|
number(D),
|
|
!,
|
|
'chr extend_history'(B,24),
|
|
activate_constraint(F,E,B,G),
|
|
( F==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(E,B)
|
|
;
|
|
true
|
|
),
|
|
known(C=\=D),
|
|
( B=suspension(_,mutable(active),_,mutable(G),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__4'(A,B)
|
|
;
|
|
true
|
|
).
|
|
'known/1__3'(A,B) :-
|
|
'known/1__4'(A,B).
|
|
'known/1__4'(_,A) :-
|
|
'chr global_term_ref_1'(D),
|
|
get_attr(D,guard_entailment,E),
|
|
E=v(G,F,_),
|
|
G/\1=:=1,
|
|
'chr sbag_member'(B,F),
|
|
B=suspension(_,mutable(active),_,_,_,_,C),
|
|
C==fail,
|
|
!,
|
|
( var(A) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(A,H,I),
|
|
( I==yes ->
|
|
'$delete_from_store_known/1'(A),
|
|
'detach_known/1'(H,A)
|
|
;
|
|
true
|
|
)
|
|
).
|
|
'known/1__4'(A,B) :-
|
|
A==fail,
|
|
'chr global_term_ref_1'(C),
|
|
get_attr(C,guard_entailment,D),
|
|
D=v(F,E,_),
|
|
F/\1=:=1,
|
|
!,
|
|
'known/1__4__0'(E,A,B).
|
|
'known/1__4__0'([],A,B) :-
|
|
'known/1__5'(A,B).
|
|
'known/1__4__0'([C|D],A,B) :-
|
|
( C=suspension(_,mutable(active),_,_,_,_,_) ->
|
|
remove_constraint_internal(C,E,F),
|
|
( F==yes ->
|
|
'$delete_from_store_known/1'(C),
|
|
'detach_known/1'(E,C)
|
|
;
|
|
true
|
|
),
|
|
'known/1__4__0'(D,A,B)
|
|
;
|
|
'known/1__4__0'(D,A,B)
|
|
).
|
|
'known/1__4'(A,B) :-
|
|
'known/1__5'(A,B).
|
|
'known/1__5'(A,B) :-
|
|
nonvar(A),
|
|
A=(C,D),
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,E,F),
|
|
( F==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(E,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(C),
|
|
known(D).
|
|
'known/1__5'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=:=D),
|
|
D==C,
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,E,F),
|
|
( F==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(E,B)
|
|
;
|
|
true
|
|
)
|
|
).
|
|
'known/1__5'(A,B) :-
|
|
nonvar(A),
|
|
A=(C==D),
|
|
D==C,
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,E,F),
|
|
( F==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(E,B)
|
|
;
|
|
true
|
|
)
|
|
).
|
|
'known/1__5'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=<D),
|
|
D==C,
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,E,F),
|
|
( F==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(E,B)
|
|
;
|
|
true
|
|
)
|
|
).
|
|
'known/1__5'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=D),
|
|
D==C,
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,E,F),
|
|
( F==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(E,B)
|
|
;
|
|
true
|
|
)
|
|
).
|
|
'known/1__5'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=D),
|
|
var(C),
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,E,F),
|
|
( F==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(E,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
C=D.
|
|
'known/1__5'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=D),
|
|
var(D),
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,E,F),
|
|
( F==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(E,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
C=D.
|
|
'known/1__5'(A,B) :-
|
|
nonvar(A),
|
|
A=(C\=D),
|
|
var(D),
|
|
var(C),
|
|
'chr lock'(C),
|
|
'chr lock'(D),
|
|
C=D,
|
|
chr_runtime:unlock(C),
|
|
chr_runtime:unlock(D),
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,E,F),
|
|
( F==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(E,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(fail).
|
|
'known/1__5'(A,B) :-
|
|
nonvar(A),
|
|
A=(C\=D),
|
|
ground(D),
|
|
ground(C),
|
|
'chr lock'(C),
|
|
'chr lock'(D),
|
|
C=D,
|
|
chr_runtime:unlock(C),
|
|
chr_runtime:unlock(D),
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,E,F),
|
|
( F==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(E,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(fail).
|
|
'known/1__5'(A,B) :-
|
|
nonvar(A),
|
|
A=functor(C,D,E),
|
|
ground(E),
|
|
ground(D),
|
|
var(C),
|
|
'chr global_term_ref_1'(H),
|
|
get_attr(H,guard_entailment,I),
|
|
I=v(K,_,J),
|
|
K/\2=:=2,
|
|
'chr sbag_member'(F,J),
|
|
F=suspension(_,mutable(active),_,_,_,_,G),
|
|
!,
|
|
remove_constraint_internal(F,N,O),
|
|
( O==yes ->
|
|
'$delete_from_store_variables/1'(F),
|
|
'detach_variables/1'(N,F)
|
|
;
|
|
true
|
|
),
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,P,Q),
|
|
( Q==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(P,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
functor(C,D,E),
|
|
C=..[_|L],
|
|
append(L,G,M),
|
|
variables(M).
|
|
'known/1__5'(A,B) :-
|
|
nonvar(A),
|
|
A=functor(C,D,E),
|
|
nonvar(C),
|
|
'chr lock'(C),
|
|
'chr lock'(D),
|
|
'chr lock'(E),
|
|
\+functor(C,D,E),
|
|
chr_runtime:unlock(C),
|
|
chr_runtime:unlock(D),
|
|
chr_runtime:unlock(E),
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,F,G),
|
|
( G==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(F,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(fail).
|
|
'known/1__5'(A,B) :-
|
|
nonvar(A),
|
|
A=(\+C),
|
|
nonvar(C),
|
|
C=functor(D,E,F),
|
|
nonvar(D),
|
|
'chr lock'(D),
|
|
'chr lock'(E),
|
|
'chr lock'(F),
|
|
functor(D,E,F),
|
|
chr_runtime:unlock(D),
|
|
chr_runtime:unlock(E),
|
|
chr_runtime:unlock(F),
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,G,H),
|
|
( H==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(G,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(fail).
|
|
'known/1__5'(A,B) :-
|
|
nonvar(A),
|
|
A=functor(C,D,E),
|
|
nonvar(E),
|
|
nonvar(D),
|
|
'chr via_1'(C,H),
|
|
get_attr(H,guard_entailment,I),
|
|
I=v(K,J,_),
|
|
K/\1=:=1,
|
|
'chr sbag_member'(F,J),
|
|
F=suspension(_,mutable(active),_,_,_,_,G),
|
|
nonvar(G),
|
|
G=functor(L,M,N),
|
|
L==C,
|
|
nonvar(N),
|
|
nonvar(M),
|
|
!,
|
|
remove_constraint_internal(F,O,P),
|
|
( P==yes ->
|
|
'$delete_from_store_known/1'(F),
|
|
'detach_known/1'(O,F)
|
|
;
|
|
true
|
|
),
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,Q,R),
|
|
( R==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(Q,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(fail).
|
|
'known/1__5'(A,B) :-
|
|
nonvar(A),
|
|
A=(C\=D),
|
|
D==C,
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,E,F),
|
|
( F==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(E,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(fail).
|
|
'known/1__5'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=D),
|
|
'chr lock'(C),
|
|
functor(C,E,F),
|
|
chr_runtime:unlock(C),
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,G,H),
|
|
( H==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(G,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
( functor(D,E,F),
|
|
C=D ->
|
|
true
|
|
;
|
|
known(fail)
|
|
).
|
|
'known/1__5'(A,B) :-
|
|
nonvar(A),
|
|
A=(C\=D),
|
|
nonvar(D),
|
|
var(C),
|
|
'chr lock'(D),
|
|
functor(D,E,F),
|
|
F>0,
|
|
chr_runtime:unlock(D),
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,L,M),
|
|
( M==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(L,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
length(G,F),
|
|
D=..[E|H],
|
|
I=..[E|G],
|
|
add_args_nunif(H,G,J),
|
|
K=(\+functor(C,E,F);C=I,J),
|
|
known(K).
|
|
'known/1__5'(A,B) :-
|
|
nonvar(A),
|
|
A=(C\=D),
|
|
nonvar(D),
|
|
nonvar(C),
|
|
'chr lock'(C),
|
|
functor(C,E,F),
|
|
chr_runtime:unlock(C),
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,J,K),
|
|
( K==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(J,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
( functor(D,E,F) ->
|
|
C=..[E|G],
|
|
D=..[E|H],
|
|
add_args_nunif(G,H,I),
|
|
known(I)
|
|
;
|
|
true
|
|
).
|
|
'known/1__5'(A,B) :-
|
|
nonvar(A),
|
|
A=(C\=D),
|
|
'chr novel_production'(B,43),
|
|
!,
|
|
'chr extend_history'(B,43),
|
|
activate_constraint(F,E,B,G),
|
|
( F==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(E,B)
|
|
;
|
|
true
|
|
),
|
|
known(D\=C),
|
|
( B=suspension(_,mutable(active),_,mutable(G),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__6'(A,B)
|
|
;
|
|
true
|
|
).
|
|
'known/1__5'(A,B) :-
|
|
'known/1__6'(A,B).
|
|
'known/1__6'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=<D),
|
|
number(D),
|
|
number(C),
|
|
C>D,
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,E,F),
|
|
( F==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(E,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(fail).
|
|
'known/1__6'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=<D),
|
|
number(D),
|
|
'chr via_1'(C,G),
|
|
get_attr(G,guard_entailment,H),
|
|
H=v(J,I,_),
|
|
J/\1=:=1,
|
|
'chr sbag_member'(E,I),
|
|
E=suspension(_,mutable(active),_,_,_,_,F),
|
|
nonvar(F),
|
|
F=(K=<L),
|
|
K==C,
|
|
number(L),
|
|
L=<D,
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,M,N),
|
|
( N==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(M,B)
|
|
;
|
|
true
|
|
)
|
|
).
|
|
'known/1__6'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=<D),
|
|
'chr via_1'(C,E),
|
|
get_attr(E,guard_entailment,F),
|
|
F=v(H,G,_),
|
|
H/\1=:=1,
|
|
!,
|
|
'known/1__6__0'(G,A,B,C,D).
|
|
'known/1__6__0'([],A,B,_,_) :-
|
|
'known/1__7'(A,B).
|
|
'known/1__6__0'([F|I],A,B,C,D) :-
|
|
( F=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=(G=<H),
|
|
G==C,
|
|
number(H),
|
|
number(D),
|
|
D=<H ->
|
|
remove_constraint_internal(F,J,K),
|
|
( K==yes ->
|
|
'$delete_from_store_known/1'(F),
|
|
'detach_known/1'(J,F)
|
|
;
|
|
true
|
|
),
|
|
'known/1__6__0'(I,A,B,C,D)
|
|
;
|
|
'known/1__6__0'(I,A,B,C,D)
|
|
).
|
|
'known/1__6'(A,B) :-
|
|
'known/1__7'(A,B).
|
|
'known/1__7'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=<D),
|
|
number(C),
|
|
'chr via_1'(D,G),
|
|
get_attr(G,guard_entailment,H),
|
|
H=v(J,I,_),
|
|
J/\1=:=1,
|
|
'chr sbag_member'(E,I),
|
|
E=suspension(_,mutable(active),_,_,_,_,F),
|
|
nonvar(F),
|
|
F=(K=<L),
|
|
L==D,
|
|
number(K),
|
|
C=<K,
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,M,N),
|
|
( N==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(M,B)
|
|
;
|
|
true
|
|
)
|
|
).
|
|
'known/1__7'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=<D),
|
|
'chr via_1'(D,E),
|
|
get_attr(E,guard_entailment,F),
|
|
F=v(H,G,_),
|
|
H/\1=:=1,
|
|
!,
|
|
'known/1__7__0'(G,A,B,C,D).
|
|
'known/1__7__0'([],A,B,_,_) :-
|
|
'known/1__8'(A,B).
|
|
'known/1__7__0'([F|I],A,B,C,D) :-
|
|
( F=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=(G=<H),
|
|
H==D,
|
|
number(C),
|
|
number(G),
|
|
G=<C ->
|
|
remove_constraint_internal(F,J,K),
|
|
( K==yes ->
|
|
'$delete_from_store_known/1'(F),
|
|
'detach_known/1'(J,F)
|
|
;
|
|
true
|
|
),
|
|
'known/1__7__0'(I,A,B,C,D)
|
|
;
|
|
'known/1__7__0'(I,A,B,C,D)
|
|
).
|
|
'known/1__7'(A,B) :-
|
|
'known/1__8'(A,B).
|
|
'known/1__8'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=<D),
|
|
'chr via_2'(D,C,G),
|
|
get_attr(G,guard_entailment,H),
|
|
H=v(J,I,_),
|
|
J/\1=:=1,
|
|
'chr sbag_member'(E,I),
|
|
E=suspension(_,mutable(active),_,_,_,_,F),
|
|
nonvar(F),
|
|
F=(K=<L),
|
|
K==D,
|
|
L==C,
|
|
!,
|
|
remove_constraint_internal(E,M,N),
|
|
( N==yes ->
|
|
'$delete_from_store_known/1'(E),
|
|
'detach_known/1'(M,E)
|
|
;
|
|
true
|
|
),
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,O,P),
|
|
( P==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(O,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(C=:=D).
|
|
'known/1__8'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=<D),
|
|
'chr via_1'(D,E),
|
|
get_attr(E,guard_entailment,F),
|
|
F=v(H,G,_),
|
|
H/\1=:=1,
|
|
!,
|
|
'known/1__8__0'(G,A,B,C,D).
|
|
'known/1__8__0'([],A,B,_,_) :-
|
|
'known/1__9'(A,B).
|
|
'known/1__8__0'([F|G],A,B,C,D) :-
|
|
( F=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=(H=<I),
|
|
H==D,
|
|
M=t(48,B,F),
|
|
'chr novel_production'(B,M),
|
|
'chr novel_production'(F,M) ->
|
|
'chr extend_history'(B,M),
|
|
activate_constraint(K,J,B,L),
|
|
( K==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(J,B)
|
|
;
|
|
true
|
|
),
|
|
known(C=<I),
|
|
( B=suspension(_,mutable(active),_,mutable(L),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__8__0'(G,A,B,C,D)
|
|
;
|
|
true
|
|
)
|
|
;
|
|
'known/1__8__0'(G,A,B,C,D)
|
|
).
|
|
'known/1__8'(A,B) :-
|
|
'known/1__9'(A,B).
|
|
'known/1__9'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=<D),
|
|
'chr via_1'(C,E),
|
|
get_attr(E,guard_entailment,F),
|
|
F=v(H,G,_),
|
|
H/\1=:=1,
|
|
!,
|
|
'known/1__9__0'(G,A,B,C,D).
|
|
'known/1__9__0'([],A,B,_,_) :-
|
|
'known/1__10'(A,B).
|
|
'known/1__9__0'([F|G],A,B,C,D) :-
|
|
( F=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=(H=<I),
|
|
I==C,
|
|
M=t(48,F,B),
|
|
'chr novel_production'(F,M),
|
|
'chr novel_production'(B,M) ->
|
|
'chr extend_history'(B,M),
|
|
activate_constraint(K,J,B,L),
|
|
( K==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(J,B)
|
|
;
|
|
true
|
|
),
|
|
known(H=<D),
|
|
( B=suspension(_,mutable(active),_,mutable(L),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__9__0'(G,A,B,C,D)
|
|
;
|
|
true
|
|
)
|
|
;
|
|
'known/1__9__0'(G,A,B,C,D)
|
|
).
|
|
'known/1__9'(A,B) :-
|
|
'known/1__10'(A,B).
|
|
'known/1__10'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=<D),
|
|
'chr via_1'(D,E),
|
|
get_attr(E,guard_entailment,F),
|
|
F=v(H,G,_),
|
|
H/\1=:=1,
|
|
!,
|
|
'known/1__10__0'(G,A,B,C,D).
|
|
'known/1__10__0'([],A,B,_,_) :-
|
|
'known/1__11'(A,B).
|
|
'known/1__10__0'([F|M],A,B,C,D) :-
|
|
( F=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=(G=\=H),
|
|
G==D,
|
|
'chr via_2'(D,H,I),
|
|
get_attr(I,guard_entailment,J),
|
|
J=v(L,K,_),
|
|
L/\1=:=1 ->
|
|
'known/1__10__1'(K,H,F,M,A,B,C,D)
|
|
;
|
|
'known/1__10__0'(M,A,B,C,D)
|
|
).
|
|
'known/1__10__1'([],_,_,E,A,B,C,D) :-
|
|
'known/1__10__0'(E,A,B,C,D).
|
|
'known/1__10__1'([I|P],F,A,G,B,C,D,E) :-
|
|
( I=suspension(_,mutable(active),_,_,_,_,H),
|
|
nonvar(H),
|
|
H=(J=<K),
|
|
J==E,
|
|
K==F,
|
|
'chr via_2'(D,E,L),
|
|
get_attr(L,guard_entailment,M),
|
|
M=v(O,N,_),
|
|
O/\1=:=1 ->
|
|
'known/1__10__2'(N,I,P,F,A,G,B,C,D,E)
|
|
;
|
|
'known/1__10__1'(P,F,A,G,B,C,D,E)
|
|
).
|
|
'known/1__10__2'([],_,H,F,E,G,A,B,C,D) :-
|
|
'known/1__10__1'(H,F,E,G,A,B,C,D).
|
|
'known/1__10__2'([K|L],A,I,G,B,H,C,D,E,F) :-
|
|
( K=suspension(_,mutable(active),_,_,_,_,J),
|
|
K\==B,
|
|
nonvar(J),
|
|
J=(M=\=N),
|
|
M==E,
|
|
N==F,
|
|
R=t(49,D,K,A,B),
|
|
'chr novel_production'(D,R),
|
|
'chr novel_production'(K,R),
|
|
'chr novel_production'(A,R),
|
|
'chr novel_production'(B,R) ->
|
|
'chr extend_history'(D,R),
|
|
activate_constraint(P,O,D,Q),
|
|
( P==yes ->
|
|
'$insert_in_store_known/1'(D),
|
|
'attach_known/1'(O,D)
|
|
;
|
|
true
|
|
),
|
|
known(E=\=G),
|
|
( D=suspension(_,mutable(active),_,mutable(Q),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__10__2'(L,A,I,G,B,H,C,D,E,F)
|
|
;
|
|
true
|
|
)
|
|
;
|
|
'known/1__10__2'(L,A,I,G,B,H,C,D,E,F)
|
|
).
|
|
'known/1__10'(A,B) :-
|
|
'known/1__11'(A,B).
|
|
'known/1__11'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=\=D),
|
|
'chr via_1'(D,E),
|
|
get_attr(E,guard_entailment,F),
|
|
F=v(H,G,_),
|
|
H/\1=:=1,
|
|
!,
|
|
'known/1__11__0'(G,A,B,C,D).
|
|
'known/1__11__0'([],A,B,_,_) :-
|
|
'known/1__12'(A,B).
|
|
'known/1__11__0'([F|M],A,B,C,D) :-
|
|
( F=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=(G=\=H),
|
|
G==D,
|
|
'chr via_2'(D,H,I),
|
|
get_attr(I,guard_entailment,J),
|
|
J=v(L,K,_),
|
|
L/\1=:=1 ->
|
|
'known/1__11__1'(K,H,F,M,A,B,C,D)
|
|
;
|
|
'known/1__11__0'(M,A,B,C,D)
|
|
).
|
|
'known/1__11__1'([],_,_,E,A,B,C,D) :-
|
|
'known/1__11__0'(E,A,B,C,D).
|
|
'known/1__11__1'([I|P],F,A,G,B,C,D,E) :-
|
|
( I=suspension(_,mutable(active),_,_,_,_,H),
|
|
nonvar(H),
|
|
H=(J=<K),
|
|
J==E,
|
|
K==F,
|
|
'chr via_2'(D,E,L),
|
|
get_attr(L,guard_entailment,M),
|
|
M=v(O,N,_),
|
|
O/\1=:=1 ->
|
|
'known/1__11__2'(N,I,P,F,A,G,B,C,D,E)
|
|
;
|
|
'known/1__11__1'(P,F,A,G,B,C,D,E)
|
|
).
|
|
'known/1__11__2'([],_,H,F,E,G,A,B,C,D) :-
|
|
'known/1__11__1'(H,F,E,G,A,B,C,D).
|
|
'known/1__11__2'([K|L],A,I,G,B,H,C,D,E,F) :-
|
|
( K=suspension(_,mutable(active),_,_,_,_,J),
|
|
K\==A,
|
|
nonvar(J),
|
|
J=(M=<N),
|
|
M==E,
|
|
N==F,
|
|
R=t(49,K,D,A,B),
|
|
'chr novel_production'(K,R),
|
|
'chr novel_production'(D,R),
|
|
'chr novel_production'(A,R),
|
|
'chr novel_production'(B,R) ->
|
|
'chr extend_history'(D,R),
|
|
activate_constraint(P,O,D,Q),
|
|
( P==yes ->
|
|
'$insert_in_store_known/1'(D),
|
|
'attach_known/1'(O,D)
|
|
;
|
|
true
|
|
),
|
|
known(E=\=G),
|
|
( D=suspension(_,mutable(active),_,mutable(Q),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__11__2'(L,A,I,G,B,H,C,D,E,F)
|
|
;
|
|
true
|
|
)
|
|
;
|
|
'known/1__11__2'(L,A,I,G,B,H,C,D,E,F)
|
|
).
|
|
'known/1__11'(A,B) :-
|
|
'known/1__12'(A,B).
|
|
'known/1__12'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=<D),
|
|
'chr via_1'(C,E),
|
|
get_attr(E,guard_entailment,F),
|
|
F=v(H,G,_),
|
|
H/\1=:=1,
|
|
!,
|
|
'known/1__12__0'(G,A,B,C,D).
|
|
'known/1__12__0'([],A,B,_,_) :-
|
|
'known/1__13'(A,B).
|
|
'known/1__12__0'([F|M],A,B,C,D) :-
|
|
( F=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=(G=<H),
|
|
H==C,
|
|
'chr via_2'(C,D,I),
|
|
get_attr(I,guard_entailment,J),
|
|
J=v(L,K,_),
|
|
L/\1=:=1 ->
|
|
'known/1__12__1'(K,G,F,M,A,B,C,D)
|
|
;
|
|
'known/1__12__0'(M,A,B,C,D)
|
|
).
|
|
'known/1__12__1'([],_,_,E,A,B,C,D) :-
|
|
'known/1__12__0'(E,A,B,C,D).
|
|
'known/1__12__1'([I|P],F,A,G,B,C,D,E) :-
|
|
( I=suspension(_,mutable(active),_,_,_,_,H),
|
|
nonvar(H),
|
|
H=(J=\=K),
|
|
J==D,
|
|
K==E,
|
|
'chr via_2'(F,D,L),
|
|
get_attr(L,guard_entailment,M),
|
|
M=v(O,N,_),
|
|
O/\1=:=1 ->
|
|
'known/1__12__2'(N,I,P,F,A,G,B,C,D,E)
|
|
;
|
|
'known/1__12__1'(P,F,A,G,B,C,D,E)
|
|
).
|
|
'known/1__12__2'([],_,H,F,E,G,A,B,C,D) :-
|
|
'known/1__12__1'(H,F,E,G,A,B,C,D).
|
|
'known/1__12__2'([K|L],A,I,G,B,H,C,D,E,F) :-
|
|
( K=suspension(_,mutable(active),_,_,_,_,J),
|
|
K\==A,
|
|
nonvar(J),
|
|
J=(M=\=N),
|
|
M==G,
|
|
N==E,
|
|
R=t(49,B,K,D,A),
|
|
'chr novel_production'(B,R),
|
|
'chr novel_production'(K,R),
|
|
'chr novel_production'(D,R),
|
|
'chr novel_production'(A,R) ->
|
|
'chr extend_history'(D,R),
|
|
activate_constraint(P,O,D,Q),
|
|
( P==yes ->
|
|
'$insert_in_store_known/1'(D),
|
|
'attach_known/1'(O,D)
|
|
;
|
|
true
|
|
),
|
|
known(G=\=F),
|
|
( D=suspension(_,mutable(active),_,mutable(Q),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__12__2'(L,A,I,G,B,H,C,D,E,F)
|
|
;
|
|
true
|
|
)
|
|
;
|
|
'known/1__12__2'(L,A,I,G,B,H,C,D,E,F)
|
|
).
|
|
'known/1__12'(A,B) :-
|
|
'known/1__13'(A,B).
|
|
'known/1__13'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=\=D),
|
|
'chr via_1'(C,E),
|
|
get_attr(E,guard_entailment,F),
|
|
F=v(H,G,_),
|
|
H/\1=:=1,
|
|
!,
|
|
'known/1__13__0'(G,A,B,C,D).
|
|
'known/1__13__0'([],A,B,_,_) :-
|
|
'known/1__14'(A,B).
|
|
'known/1__13__0'([F|M],A,B,C,D) :-
|
|
( F=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=(G=<H),
|
|
H==C,
|
|
'chr via_2'(C,D,I),
|
|
get_attr(I,guard_entailment,J),
|
|
J=v(L,K,_),
|
|
L/\1=:=1 ->
|
|
'known/1__13__1'(K,G,F,M,A,B,C,D)
|
|
;
|
|
'known/1__13__0'(M,A,B,C,D)
|
|
).
|
|
'known/1__13__1'([],_,_,E,A,B,C,D) :-
|
|
'known/1__13__0'(E,A,B,C,D).
|
|
'known/1__13__1'([I|P],F,A,G,B,C,D,E) :-
|
|
( I=suspension(_,mutable(active),_,_,_,_,H),
|
|
I\==A,
|
|
nonvar(H),
|
|
H=(J=<K),
|
|
J==D,
|
|
K==E,
|
|
'chr via_2'(F,D,L),
|
|
get_attr(L,guard_entailment,M),
|
|
M=v(O,N,_),
|
|
O/\1=:=1 ->
|
|
'known/1__13__2'(N,I,P,F,A,G,B,C,D,E)
|
|
;
|
|
'known/1__13__1'(P,F,A,G,B,C,D,E)
|
|
).
|
|
'known/1__13__2'([],_,H,F,E,G,A,B,C,D) :-
|
|
'known/1__13__1'(H,F,E,G,A,B,C,D).
|
|
'known/1__13__2'([K|L],A,I,G,B,H,C,D,E,F) :-
|
|
( K=suspension(_,mutable(active),_,_,_,_,J),
|
|
nonvar(J),
|
|
J=(M=\=N),
|
|
M==G,
|
|
N==E,
|
|
R=t(49,B,K,A,D),
|
|
'chr novel_production'(B,R),
|
|
'chr novel_production'(K,R),
|
|
'chr novel_production'(A,R),
|
|
'chr novel_production'(D,R) ->
|
|
'chr extend_history'(D,R),
|
|
activate_constraint(P,O,D,Q),
|
|
( P==yes ->
|
|
'$insert_in_store_known/1'(D),
|
|
'attach_known/1'(O,D)
|
|
;
|
|
true
|
|
),
|
|
known(G=\=F),
|
|
( D=suspension(_,mutable(active),_,mutable(Q),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__13__2'(L,A,I,G,B,H,C,D,E,F)
|
|
;
|
|
true
|
|
)
|
|
;
|
|
'known/1__13__2'(L,A,I,G,B,H,C,D,E,F)
|
|
).
|
|
'known/1__13'(A,B) :-
|
|
'known/1__14'(A,B).
|
|
'known/1__14'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=:=D),
|
|
number(D),
|
|
number(C),
|
|
C=\=D,
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,E,F),
|
|
( F==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(E,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(fail).
|
|
'known/1__14'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=\=D),
|
|
number(D),
|
|
number(C),
|
|
C=:=D,
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,E,F),
|
|
( F==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(E,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(fail).
|
|
'known/1__14'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=\=D),
|
|
D==C,
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,E,F),
|
|
( F==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(E,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(fail).
|
|
'known/1__14'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=:=D),
|
|
'chr via_2'(C,D,G),
|
|
get_attr(G,guard_entailment,H),
|
|
H=v(J,I,_),
|
|
J/\1=:=1,
|
|
'chr sbag_member'(E,I),
|
|
E=suspension(_,mutable(active),_,_,_,_,F),
|
|
nonvar(F),
|
|
F=(K=\=L),
|
|
K==C,
|
|
L==D,
|
|
!,
|
|
remove_constraint_internal(E,M,N),
|
|
( N==yes ->
|
|
'$delete_from_store_known/1'(E),
|
|
'detach_known/1'(M,E)
|
|
;
|
|
true
|
|
),
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,O,P),
|
|
( P==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(O,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(fail).
|
|
'known/1__14'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=\=D),
|
|
'chr via_2'(C,D,G),
|
|
get_attr(G,guard_entailment,H),
|
|
H=v(J,I,_),
|
|
J/\1=:=1,
|
|
'chr sbag_member'(E,I),
|
|
E=suspension(_,mutable(active),_,_,_,_,F),
|
|
nonvar(F),
|
|
F=(K=:=L),
|
|
K==C,
|
|
L==D,
|
|
!,
|
|
remove_constraint_internal(E,M,N),
|
|
( N==yes ->
|
|
'$delete_from_store_known/1'(E),
|
|
'detach_known/1'(M,E)
|
|
;
|
|
true
|
|
),
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,O,P),
|
|
( P==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(O,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(fail).
|
|
'known/1__14'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=:=D),
|
|
'chr via_1'(D,E),
|
|
get_attr(E,guard_entailment,F),
|
|
F=v(H,G,_),
|
|
H/\1=:=1,
|
|
!,
|
|
'known/1__14__0'(G,A,B,C,D).
|
|
'known/1__14__0'([],A,B,_,_) :-
|
|
'known/1__15'(A,B).
|
|
'known/1__14__0'([F|G],A,B,C,D) :-
|
|
( F=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=(H=:=I),
|
|
H==D,
|
|
M=t(54,B,F),
|
|
'chr novel_production'(B,M),
|
|
'chr novel_production'(F,M),
|
|
C\==I ->
|
|
'chr extend_history'(B,M),
|
|
activate_constraint(K,J,B,L),
|
|
( K==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(J,B)
|
|
;
|
|
true
|
|
),
|
|
known(C=:=I),
|
|
( B=suspension(_,mutable(active),_,mutable(L),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__14__0'(G,A,B,C,D)
|
|
;
|
|
true
|
|
)
|
|
;
|
|
'known/1__14__0'(G,A,B,C,D)
|
|
).
|
|
'known/1__14'(A,B) :-
|
|
'known/1__15'(A,B).
|
|
'known/1__15'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=:=D),
|
|
'chr via_1'(C,E),
|
|
get_attr(E,guard_entailment,F),
|
|
F=v(H,G,_),
|
|
H/\1=:=1,
|
|
!,
|
|
'known/1__15__0'(G,A,B,C,D).
|
|
'known/1__15__0'([],A,B,_,_) :-
|
|
'known/1__16'(A,B).
|
|
'known/1__15__0'([F|G],A,B,C,D) :-
|
|
( F=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=(H=:=I),
|
|
I==C,
|
|
M=t(54,F,B),
|
|
'chr novel_production'(F,M),
|
|
'chr novel_production'(B,M),
|
|
H\==D ->
|
|
'chr extend_history'(B,M),
|
|
activate_constraint(K,J,B,L),
|
|
( K==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(J,B)
|
|
;
|
|
true
|
|
),
|
|
known(H=:=D),
|
|
( B=suspension(_,mutable(active),_,mutable(L),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__15__0'(G,A,B,C,D)
|
|
;
|
|
true
|
|
)
|
|
;
|
|
'known/1__15__0'(G,A,B,C,D)
|
|
).
|
|
'known/1__15'(A,B) :-
|
|
'known/1__16'(A,B).
|
|
'known/1__16'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=:=D),
|
|
'chr novel_production'(B,55),
|
|
!,
|
|
'chr extend_history'(B,55),
|
|
activate_constraint(F,E,B,G),
|
|
( F==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(E,B)
|
|
;
|
|
true
|
|
),
|
|
known(D=:=C),
|
|
( B=suspension(_,mutable(active),_,mutable(G),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__17'(A,B)
|
|
;
|
|
true
|
|
).
|
|
'known/1__16'(A,B) :-
|
|
'known/1__17'(A,B).
|
|
'known/1__17'(A,B) :-
|
|
nonvar(A),
|
|
A=(C=\=D),
|
|
'chr novel_production'(B,56),
|
|
!,
|
|
'chr extend_history'(B,56),
|
|
activate_constraint(F,E,B,G),
|
|
( F==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(E,B)
|
|
;
|
|
true
|
|
),
|
|
known(D=\=C),
|
|
( B=suspension(_,mutable(active),_,mutable(G),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__18'(A,B)
|
|
;
|
|
true
|
|
).
|
|
'known/1__17'(A,B) :-
|
|
'known/1__18'(A,B).
|
|
'known/1__18'(A,B) :-
|
|
nonvar(A),
|
|
A=number(C),
|
|
nonvar(C),
|
|
\+number(C),
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,D,E),
|
|
( E==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(D,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(fail).
|
|
'known/1__18'(A,B) :-
|
|
nonvar(A),
|
|
A=float(C),
|
|
nonvar(C),
|
|
\+float(C),
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,D,E),
|
|
( E==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(D,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(fail).
|
|
'known/1__18'(A,B) :-
|
|
nonvar(A),
|
|
A=integer(C),
|
|
nonvar(C),
|
|
\+integer(C),
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,D,E),
|
|
( E==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(D,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(fail).
|
|
'known/1__18'(A,B) :-
|
|
nonvar(A),
|
|
A=integer(C),
|
|
'chr novel_production'(B,60),
|
|
!,
|
|
'chr extend_history'(B,60),
|
|
activate_constraint(E,D,B,F),
|
|
( E==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(D,B)
|
|
;
|
|
true
|
|
),
|
|
known(number(C)),
|
|
( B=suspension(_,mutable(active),_,mutable(F),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__19'(A,B)
|
|
;
|
|
true
|
|
).
|
|
'known/1__18'(A,B) :-
|
|
'known/1__19'(A,B).
|
|
'known/1__19'(A,B) :-
|
|
nonvar(A),
|
|
A=float(C),
|
|
'chr novel_production'(B,61),
|
|
!,
|
|
'chr extend_history'(B,61),
|
|
activate_constraint(E,D,B,F),
|
|
( E==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(D,B)
|
|
;
|
|
true
|
|
),
|
|
known(number(C)),
|
|
( B=suspension(_,mutable(active),_,mutable(F),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__20'(A,B)
|
|
;
|
|
true
|
|
).
|
|
'known/1__19'(A,B) :-
|
|
'known/1__20'(A,B).
|
|
'known/1__20'(A,B) :-
|
|
'chr via_1'(A,E),
|
|
get_attr(E,guard_entailment,F),
|
|
F=v(H,G,_),
|
|
H/\1=:=1,
|
|
'chr sbag_member'(C,G),
|
|
C=suspension(_,mutable(active),_,_,_,_,D),
|
|
nonvar(D),
|
|
D=(\+I),
|
|
I==A,
|
|
!,
|
|
remove_constraint_internal(C,J,K),
|
|
( K==yes ->
|
|
'$delete_from_store_known/1'(C),
|
|
'detach_known/1'(J,C)
|
|
;
|
|
true
|
|
),
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,L,M),
|
|
( M==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(L,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(fail).
|
|
'known/1__20'(A,B) :-
|
|
nonvar(A),
|
|
A=(\+C),
|
|
'chr via_1'(C,F),
|
|
get_attr(F,guard_entailment,G),
|
|
G=v(I,H,_),
|
|
I/\1=:=1,
|
|
'chr sbag_member'(D,H),
|
|
D=suspension(_,mutable(active),_,_,_,_,E),
|
|
E==C,
|
|
!,
|
|
remove_constraint_internal(D,J,K),
|
|
( K==yes ->
|
|
'$delete_from_store_known/1'(D),
|
|
'detach_known/1'(J,D)
|
|
;
|
|
true
|
|
),
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,L,M),
|
|
( M==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(L,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(fail).
|
|
'known/1__20'(A,B) :-
|
|
nonvar(A),
|
|
A=(C\==D),
|
|
'chr via_2'(C,D,G),
|
|
get_attr(G,guard_entailment,H),
|
|
H=v(J,I,_),
|
|
J/\1=:=1,
|
|
'chr sbag_member'(E,I),
|
|
E=suspension(_,mutable(active),_,_,_,_,F),
|
|
nonvar(F),
|
|
F=(K==L),
|
|
K==C,
|
|
L==D,
|
|
!,
|
|
remove_constraint_internal(E,M,N),
|
|
( N==yes ->
|
|
'$delete_from_store_known/1'(E),
|
|
'detach_known/1'(M,E)
|
|
;
|
|
true
|
|
),
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,O,P),
|
|
( P==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(O,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(fail).
|
|
'known/1__20'(A,B) :-
|
|
nonvar(A),
|
|
A=(C==D),
|
|
'chr via_2'(C,D,G),
|
|
get_attr(G,guard_entailment,H),
|
|
H=v(J,I,_),
|
|
J/\1=:=1,
|
|
'chr sbag_member'(E,I),
|
|
E=suspension(_,mutable(active),_,_,_,_,F),
|
|
nonvar(F),
|
|
F=(K\==L),
|
|
K==C,
|
|
L==D,
|
|
!,
|
|
remove_constraint_internal(E,M,N),
|
|
( N==yes ->
|
|
'$delete_from_store_known/1'(E),
|
|
'detach_known/1'(M,E)
|
|
;
|
|
true
|
|
),
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,O,P),
|
|
( P==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(O,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(fail).
|
|
'known/1__20'(A,B) :-
|
|
nonvar(A),
|
|
A=(C==D),
|
|
'chr via_1'(D,E),
|
|
get_attr(E,guard_entailment,F),
|
|
F=v(H,G,_),
|
|
H/\1=:=1,
|
|
!,
|
|
'known/1__20__0'(G,A,B,C,D).
|
|
'known/1__20__0'([],A,B,_,_) :-
|
|
'known/1__21'(A,B).
|
|
'known/1__20__0'([F|G],A,B,C,D) :-
|
|
( F=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=(H==I),
|
|
H==D,
|
|
M=t(64,B,F),
|
|
'chr novel_production'(B,M),
|
|
'chr novel_production'(F,M) ->
|
|
'chr extend_history'(B,M),
|
|
activate_constraint(K,J,B,L),
|
|
( K==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(J,B)
|
|
;
|
|
true
|
|
),
|
|
known(C==I),
|
|
( B=suspension(_,mutable(active),_,mutable(L),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__20__0'(G,A,B,C,D)
|
|
;
|
|
true
|
|
)
|
|
;
|
|
'known/1__20__0'(G,A,B,C,D)
|
|
).
|
|
'known/1__20'(A,B) :-
|
|
'known/1__21'(A,B).
|
|
'known/1__21'(A,B) :-
|
|
nonvar(A),
|
|
A=(C==D),
|
|
'chr via_1'(C,E),
|
|
get_attr(E,guard_entailment,F),
|
|
F=v(H,G,_),
|
|
H/\1=:=1,
|
|
!,
|
|
'known/1__21__0'(G,A,B,C,D).
|
|
'known/1__21__0'([],A,B,_,_) :-
|
|
'known/1__22'(A,B).
|
|
'known/1__21__0'([F|G],A,B,C,D) :-
|
|
( F=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=(H==I),
|
|
I==C,
|
|
M=t(64,F,B),
|
|
'chr novel_production'(F,M),
|
|
'chr novel_production'(B,M) ->
|
|
'chr extend_history'(B,M),
|
|
activate_constraint(K,J,B,L),
|
|
( K==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(J,B)
|
|
;
|
|
true
|
|
),
|
|
known(H==D),
|
|
( B=suspension(_,mutable(active),_,mutable(L),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__21__0'(G,A,B,C,D)
|
|
;
|
|
true
|
|
)
|
|
;
|
|
'known/1__21__0'(G,A,B,C,D)
|
|
).
|
|
'known/1__21'(A,B) :-
|
|
'known/1__22'(A,B).
|
|
'known/1__22'(A,B) :-
|
|
nonvar(A),
|
|
A=(C==D),
|
|
'chr via_1'(D,E),
|
|
get_attr(E,guard_entailment,F),
|
|
F=v(H,G,_),
|
|
H/\1=:=1,
|
|
!,
|
|
'known/1__22__0'(G,A,B,C,D).
|
|
'known/1__22__0'([],A,B,_,_) :-
|
|
'known/1__23'(A,B).
|
|
'known/1__22__0'([F|G],A,B,C,D) :-
|
|
( F=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=(H\==I),
|
|
H==D,
|
|
M=t(65,B,F),
|
|
'chr novel_production'(B,M),
|
|
'chr novel_production'(F,M) ->
|
|
'chr extend_history'(B,M),
|
|
activate_constraint(K,J,B,L),
|
|
( K==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(J,B)
|
|
;
|
|
true
|
|
),
|
|
known(C\==I),
|
|
( B=suspension(_,mutable(active),_,mutable(L),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__22__0'(G,A,B,C,D)
|
|
;
|
|
true
|
|
)
|
|
;
|
|
'known/1__22__0'(G,A,B,C,D)
|
|
).
|
|
'known/1__22'(A,B) :-
|
|
'known/1__23'(A,B).
|
|
'known/1__23'(A,B) :-
|
|
nonvar(A),
|
|
A=(C\==D),
|
|
'chr via_1'(C,E),
|
|
get_attr(E,guard_entailment,F),
|
|
F=v(H,G,_),
|
|
H/\1=:=1,
|
|
!,
|
|
'known/1__23__0'(G,A,B,C,D).
|
|
'known/1__23__0'([],A,B,_,_) :-
|
|
'known/1__24'(A,B).
|
|
'known/1__23__0'([F|G],A,B,C,D) :-
|
|
( F=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=(H==I),
|
|
I==C,
|
|
M=t(65,F,B),
|
|
'chr novel_production'(F,M),
|
|
'chr novel_production'(B,M) ->
|
|
'chr extend_history'(B,M),
|
|
activate_constraint(K,J,B,L),
|
|
( K==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(J,B)
|
|
;
|
|
true
|
|
),
|
|
known(H\==D),
|
|
( B=suspension(_,mutable(active),_,mutable(L),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__23__0'(G,A,B,C,D)
|
|
;
|
|
true
|
|
)
|
|
;
|
|
'known/1__23__0'(G,A,B,C,D)
|
|
).
|
|
'known/1__23'(A,B) :-
|
|
'known/1__24'(A,B).
|
|
'known/1__24'(A,B) :-
|
|
nonvar(A),
|
|
A=(C==D),
|
|
'chr novel_production'(B,66),
|
|
!,
|
|
'chr extend_history'(B,66),
|
|
activate_constraint(F,E,B,G),
|
|
( F==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(E,B)
|
|
;
|
|
true
|
|
),
|
|
known(D==C),
|
|
( B=suspension(_,mutable(active),_,mutable(G),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__25'(A,B)
|
|
;
|
|
true
|
|
).
|
|
'known/1__24'(A,B) :-
|
|
'known/1__25'(A,B).
|
|
'known/1__25'(A,B) :-
|
|
nonvar(A),
|
|
A=(C\==D),
|
|
'chr novel_production'(B,67),
|
|
!,
|
|
'chr extend_history'(B,67),
|
|
activate_constraint(F,E,B,G),
|
|
( F==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(E,B)
|
|
;
|
|
true
|
|
),
|
|
known(D\==C),
|
|
( B=suspension(_,mutable(active),_,mutable(G),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__26'(A,B)
|
|
;
|
|
true
|
|
).
|
|
'known/1__25'(A,B) :-
|
|
'known/1__26'(A,B).
|
|
'known/1__26'(A,B) :-
|
|
nonvar(A),
|
|
A=(C\==D),
|
|
D==C,
|
|
'chr novel_production'(B,68),
|
|
!,
|
|
'chr extend_history'(B,68),
|
|
activate_constraint(F,E,B,G),
|
|
( F==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(E,B)
|
|
;
|
|
true
|
|
),
|
|
known(fail),
|
|
( B=suspension(_,mutable(active),_,mutable(G),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__27'(A,B)
|
|
;
|
|
true
|
|
).
|
|
'known/1__26'(A,B) :-
|
|
'known/1__27'(A,B).
|
|
'known/1__27'(A,B) :-
|
|
nonvar(A),
|
|
A=(C\==D),
|
|
nonvar(D),
|
|
nonvar(C),
|
|
'chr lock'(C),
|
|
functor(C,E,F),
|
|
chr_runtime:unlock(C),
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,J,K),
|
|
( K==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(J,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
( functor(D,E,F) ->
|
|
C=..[E|G],
|
|
D=..[E|H],
|
|
add_args_nmatch(G,H,I),
|
|
known(I)
|
|
;
|
|
true
|
|
).
|
|
'known/1__27'(A,B) :-
|
|
nonvar(A),
|
|
A=(C==D),
|
|
'chr novel_production'(B,70),
|
|
!,
|
|
'chr extend_history'(B,70),
|
|
activate_constraint(F,E,B,G),
|
|
( F==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(E,B)
|
|
;
|
|
true
|
|
),
|
|
known(C=D),
|
|
( B=suspension(_,mutable(active),_,mutable(G),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__28'(A,B)
|
|
;
|
|
true
|
|
).
|
|
'known/1__27'(A,B) :-
|
|
'known/1__28'(A,B).
|
|
'known/1__28'(A,B) :-
|
|
nonvar(A),
|
|
A=ground(C),
|
|
'chr novel_production'(B,71),
|
|
!,
|
|
'chr extend_history'(B,71),
|
|
activate_constraint(E,D,B,F),
|
|
( E==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(D,B)
|
|
;
|
|
true
|
|
),
|
|
known(nonvar(C)),
|
|
( B=suspension(_,mutable(active),_,mutable(F),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__29'(A,B)
|
|
;
|
|
true
|
|
).
|
|
'known/1__28'(A,B) :-
|
|
'known/1__29'(A,B).
|
|
'known/1__29'(A,B) :-
|
|
nonvar(A),
|
|
A=compound(C),
|
|
'chr novel_production'(B,72),
|
|
!,
|
|
'chr extend_history'(B,72),
|
|
activate_constraint(E,D,B,F),
|
|
( E==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(D,B)
|
|
;
|
|
true
|
|
),
|
|
known(nonvar(C)),
|
|
( B=suspension(_,mutable(active),_,mutable(F),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__30'(A,B)
|
|
;
|
|
true
|
|
).
|
|
'known/1__29'(A,B) :-
|
|
'known/1__30'(A,B).
|
|
'known/1__30'(A,B) :-
|
|
nonvar(A),
|
|
A=atomic(C),
|
|
'chr novel_production'(B,73),
|
|
!,
|
|
'chr extend_history'(B,73),
|
|
activate_constraint(E,D,B,F),
|
|
( E==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(D,B)
|
|
;
|
|
true
|
|
),
|
|
known(nonvar(C)),
|
|
( B=suspension(_,mutable(active),_,mutable(F),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__31'(A,B)
|
|
;
|
|
true
|
|
).
|
|
'known/1__30'(A,B) :-
|
|
'known/1__31'(A,B).
|
|
'known/1__31'(A,B) :-
|
|
nonvar(A),
|
|
A=number(C),
|
|
'chr novel_production'(B,74),
|
|
!,
|
|
'chr extend_history'(B,74),
|
|
activate_constraint(E,D,B,F),
|
|
( E==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(D,B)
|
|
;
|
|
true
|
|
),
|
|
known(nonvar(C)),
|
|
( B=suspension(_,mutable(active),_,mutable(F),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__32'(A,B)
|
|
;
|
|
true
|
|
).
|
|
'known/1__31'(A,B) :-
|
|
'known/1__32'(A,B).
|
|
'known/1__32'(A,B) :-
|
|
nonvar(A),
|
|
A=atom(C),
|
|
'chr novel_production'(B,75),
|
|
!,
|
|
'chr extend_history'(B,75),
|
|
activate_constraint(E,D,B,F),
|
|
( E==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(D,B)
|
|
;
|
|
true
|
|
),
|
|
known(nonvar(C)),
|
|
( B=suspension(_,mutable(active),_,mutable(F),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__33'(A,B)
|
|
;
|
|
true
|
|
).
|
|
'known/1__32'(A,B) :-
|
|
'known/1__33'(A,B).
|
|
'known/1__33'(A,B) :-
|
|
nonvar(A),
|
|
A=var(C),
|
|
'chr via_1'(C,F),
|
|
get_attr(F,guard_entailment,G),
|
|
G=v(I,H,_),
|
|
I/\1=:=1,
|
|
'chr sbag_member'(D,H),
|
|
D=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=nonvar(J),
|
|
J==C,
|
|
!,
|
|
remove_constraint_internal(D,K,L),
|
|
( L==yes ->
|
|
'$delete_from_store_known/1'(D),
|
|
'detach_known/1'(K,D)
|
|
;
|
|
true
|
|
),
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,M,N),
|
|
( N==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(M,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(fail).
|
|
'known/1__33'(A,B) :-
|
|
nonvar(A),
|
|
A=nonvar(C),
|
|
'chr via_1'(C,F),
|
|
get_attr(F,guard_entailment,G),
|
|
G=v(I,H,_),
|
|
I/\1=:=1,
|
|
'chr sbag_member'(D,H),
|
|
D=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=var(J),
|
|
J==C,
|
|
!,
|
|
remove_constraint_internal(D,K,L),
|
|
( L==yes ->
|
|
'$delete_from_store_known/1'(D),
|
|
'detach_known/1'(K,D)
|
|
;
|
|
true
|
|
),
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,M,N),
|
|
( N==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(M,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(fail).
|
|
'known/1__33'(A,B) :-
|
|
nonvar(A),
|
|
A=(C;D),
|
|
nonvar(C),
|
|
C=(\+E),
|
|
'chr via_1'(E,H),
|
|
get_attr(H,guard_entailment,I),
|
|
I=v(K,J,_),
|
|
K/\1=:=1,
|
|
'chr sbag_member'(F,J),
|
|
F=suspension(_,mutable(active),_,_,_,_,G),
|
|
G==E,
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,L,M),
|
|
( M==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(L,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(D).
|
|
'known/1__33'(A,B) :-
|
|
'chr via_1'(A,C),
|
|
get_attr(C,guard_entailment,D),
|
|
D=v(F,E,_),
|
|
F/\1=:=1,
|
|
!,
|
|
'known/1__33__0'(E,A,B).
|
|
'known/1__33__0'([],A,B) :-
|
|
'known/1__34'(A,B).
|
|
'known/1__33__0'([D|H],A,B) :-
|
|
( D=suspension(_,mutable(active),_,_,_,_,C),
|
|
nonvar(C),
|
|
C=(E;F),
|
|
nonvar(E),
|
|
E=(\+G),
|
|
G==A ->
|
|
remove_constraint_internal(D,I,J),
|
|
( J==yes ->
|
|
'$delete_from_store_known/1'(D),
|
|
'detach_known/1'(I,D)
|
|
;
|
|
true
|
|
),
|
|
activate_constraint(L,K,B,M),
|
|
( L==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(K,B)
|
|
;
|
|
true
|
|
),
|
|
known(F),
|
|
( B=suspension(_,mutable(active),_,mutable(M),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__33__0'(H,A,B)
|
|
;
|
|
true
|
|
)
|
|
;
|
|
'known/1__33__0'(H,A,B)
|
|
).
|
|
'known/1__33'(A,B) :-
|
|
'known/1__34'(A,B).
|
|
'known/1__34'(A,B) :-
|
|
nonvar(A),
|
|
A=(C;D),
|
|
nonvar(C),
|
|
C=(E,_),
|
|
nonvar(E),
|
|
E=(\+F),
|
|
'chr via_1'(F,I),
|
|
get_attr(I,guard_entailment,J),
|
|
J=v(L,K,_),
|
|
L/\1=:=1,
|
|
'chr sbag_member'(G,K),
|
|
G=suspension(_,mutable(active),_,_,_,_,H),
|
|
H==F,
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,M,N),
|
|
( N==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(M,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(D).
|
|
'known/1__34'(A,B) :-
|
|
'chr via_1'(A,C),
|
|
get_attr(C,guard_entailment,D),
|
|
D=v(F,E,_),
|
|
F/\1=:=1,
|
|
!,
|
|
'known/1__34__0'(E,A,B).
|
|
'known/1__34__0'([],A,B) :-
|
|
'known/1__35'(A,B).
|
|
'known/1__34__0'([D|I],A,B) :-
|
|
( D=suspension(_,mutable(active),_,_,_,_,C),
|
|
nonvar(C),
|
|
C=(E;F),
|
|
nonvar(E),
|
|
E=(G,_),
|
|
nonvar(G),
|
|
G=(\+H),
|
|
H==A ->
|
|
remove_constraint_internal(D,J,K),
|
|
( K==yes ->
|
|
'$delete_from_store_known/1'(D),
|
|
'detach_known/1'(J,D)
|
|
;
|
|
true
|
|
),
|
|
activate_constraint(M,L,B,N),
|
|
( M==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(L,B)
|
|
;
|
|
true
|
|
),
|
|
known(F),
|
|
( B=suspension(_,mutable(active),_,mutable(N),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__34__0'(I,A,B)
|
|
;
|
|
true
|
|
)
|
|
;
|
|
'known/1__34__0'(I,A,B)
|
|
).
|
|
'known/1__34'(A,B) :-
|
|
'known/1__35'(A,B).
|
|
'known/1__35'(A,B) :-
|
|
nonvar(A),
|
|
A=(C;D),
|
|
'chr via_1'(C,G),
|
|
get_attr(G,guard_entailment,H),
|
|
H=v(J,I,_),
|
|
J/\1=:=1,
|
|
'chr sbag_member'(E,I),
|
|
E=suspension(_,mutable(active),_,_,_,_,F),
|
|
nonvar(F),
|
|
F=(\+K),
|
|
K==C,
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,L,M),
|
|
( M==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(L,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(D).
|
|
'known/1__35'(A,B) :-
|
|
nonvar(A),
|
|
A=(\+C),
|
|
'chr via_1'(C,D),
|
|
get_attr(D,guard_entailment,E),
|
|
E=v(G,F,_),
|
|
G/\1=:=1,
|
|
!,
|
|
'known/1__35__0'(F,A,B,C).
|
|
'known/1__35__0'([],A,B,_) :-
|
|
'known/1__36'(A,B).
|
|
'known/1__35__0'([E|H],A,B,C) :-
|
|
( E=suspension(_,mutable(active),_,_,_,_,D),
|
|
nonvar(D),
|
|
D=(F;G),
|
|
F==C ->
|
|
remove_constraint_internal(E,I,J),
|
|
( J==yes ->
|
|
'$delete_from_store_known/1'(E),
|
|
'detach_known/1'(I,E)
|
|
;
|
|
true
|
|
),
|
|
activate_constraint(L,K,B,M),
|
|
( L==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(K,B)
|
|
;
|
|
true
|
|
),
|
|
known(G),
|
|
( B=suspension(_,mutable(active),_,mutable(M),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__35__0'(H,A,B,C)
|
|
;
|
|
true
|
|
)
|
|
;
|
|
'known/1__35__0'(H,A,B,C)
|
|
).
|
|
'known/1__35'(A,B) :-
|
|
'known/1__36'(A,B).
|
|
'known/1__36'(A,B) :-
|
|
nonvar(A),
|
|
A=(C;D),
|
|
nonvar(C),
|
|
C=(E,_),
|
|
'chr via_1'(E,H),
|
|
get_attr(H,guard_entailment,I),
|
|
I=v(K,J,_),
|
|
K/\1=:=1,
|
|
'chr sbag_member'(F,J),
|
|
F=suspension(_,mutable(active),_,_,_,_,G),
|
|
nonvar(G),
|
|
G=(\+L),
|
|
L==E,
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,M,N),
|
|
( N==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(M,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(D).
|
|
'known/1__36'(A,B) :-
|
|
nonvar(A),
|
|
A=(\+C),
|
|
'chr via_1'(C,D),
|
|
get_attr(D,guard_entailment,E),
|
|
E=v(G,F,_),
|
|
G/\1=:=1,
|
|
!,
|
|
'known/1__36__0'(F,A,B,C).
|
|
'known/1__36__0'([],A,B,_) :-
|
|
'known/1__37'(A,B).
|
|
'known/1__36__0'([E|I],A,B,C) :-
|
|
( E=suspension(_,mutable(active),_,_,_,_,D),
|
|
nonvar(D),
|
|
D=(F;G),
|
|
nonvar(F),
|
|
F=(H,_),
|
|
H==C ->
|
|
remove_constraint_internal(E,J,K),
|
|
( K==yes ->
|
|
'$delete_from_store_known/1'(E),
|
|
'detach_known/1'(J,E)
|
|
;
|
|
true
|
|
),
|
|
activate_constraint(M,L,B,N),
|
|
( M==yes ->
|
|
'$insert_in_store_known/1'(B),
|
|
'attach_known/1'(L,B)
|
|
;
|
|
true
|
|
),
|
|
known(G),
|
|
( B=suspension(_,mutable(active),_,mutable(N),_,_,_) ->
|
|
'chr update_mutable'(inactive,mutable(active)),
|
|
'known/1__36__0'(I,A,B,C)
|
|
;
|
|
true
|
|
)
|
|
;
|
|
'known/1__36__0'(I,A,B,C)
|
|
).
|
|
'known/1__36'(A,B) :-
|
|
'known/1__37'(A,B).
|
|
'known/1__37'(A,B) :-
|
|
nonvar(A),
|
|
A=(C;D),
|
|
C==fail,
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,E,F),
|
|
( F==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(E,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(D).
|
|
'known/1__37'(A,B) :-
|
|
nonvar(A),
|
|
A=(C;D),
|
|
D==fail,
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,E,F),
|
|
( F==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(E,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(C).
|
|
'known/1__37'(A,B) :-
|
|
nonvar(A),
|
|
A=(C;_),
|
|
nonvar(C),
|
|
C=(\+D),
|
|
nonvar(D),
|
|
D=functor(E,_,_),
|
|
'chr via_1'(E,H),
|
|
get_attr(H,guard_entailment,I),
|
|
I=v(K,J,_),
|
|
K/\1=:=1,
|
|
'chr sbag_member'(F,J),
|
|
F=suspension(_,mutable(active),_,_,_,_,G),
|
|
nonvar(G),
|
|
G=functor(L,_,_),
|
|
L==E,
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,M,N),
|
|
( N==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(M,B)
|
|
;
|
|
true
|
|
)
|
|
).
|
|
'known/1__37'(A,B) :-
|
|
nonvar(A),
|
|
A=functor(C,_,_),
|
|
'chr via_1'(C,D),
|
|
get_attr(D,guard_entailment,E),
|
|
E=v(G,F,_),
|
|
G/\1=:=1,
|
|
!,
|
|
'known/1__37__0'(F,A,B,C).
|
|
'known/1__37__0'([],A,B,_) :-
|
|
'known/1__38'(A,B).
|
|
'known/1__37__0'([E|I],A,B,C) :-
|
|
( E=suspension(_,mutable(active),_,_,_,_,D),
|
|
nonvar(D),
|
|
D=(F;_),
|
|
nonvar(F),
|
|
F=(\+G),
|
|
nonvar(G),
|
|
G=functor(H,_,_),
|
|
H==C ->
|
|
remove_constraint_internal(E,J,K),
|
|
( K==yes ->
|
|
'$delete_from_store_known/1'(E),
|
|
'detach_known/1'(J,E)
|
|
;
|
|
true
|
|
),
|
|
'known/1__37__0'(I,A,B,C)
|
|
;
|
|
'known/1__37__0'(I,A,B,C)
|
|
).
|
|
'known/1__37'(A,B) :-
|
|
'known/1__38'(A,B).
|
|
'known/1__38'(A,B) :-
|
|
nonvar(A),
|
|
A=(C;D),
|
|
nonvar(C),
|
|
C=(\+E),
|
|
nonvar(E),
|
|
E=functor(F,G,H),
|
|
nonvar(F),
|
|
'chr lock'(F),
|
|
'chr lock'(G),
|
|
'chr lock'(H),
|
|
functor(F,G,H),
|
|
chr_runtime:unlock(F),
|
|
chr_runtime:unlock(G),
|
|
chr_runtime:unlock(H),
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,I,J),
|
|
( J==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(I,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
known(D).
|
|
'known/1__38'(A,B) :-
|
|
nonvar(A),
|
|
A=(C;_),
|
|
nonvar(C),
|
|
C=(\+D),
|
|
nonvar(D),
|
|
D=functor(E,_,_),
|
|
nonvar(E),
|
|
!,
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,F,G),
|
|
( G==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(F,B)
|
|
;
|
|
true
|
|
)
|
|
).
|
|
'known/1__38'(_,A) :-
|
|
activate_constraint(C,B,A,_),
|
|
( C==yes ->
|
|
'$insert_in_store_known/1'(A),
|
|
'attach_known/1'(B,A)
|
|
;
|
|
true
|
|
).
|
|
test(_) :-
|
|
'chr global_term_ref_1'(C),
|
|
get_attr(C,guard_entailment,D),
|
|
D=v(F,E,_),
|
|
F/\1=:=1,
|
|
'chr sbag_member'(A,E),
|
|
A=suspension(_,mutable(active),_,_,_,_,B),
|
|
B==fail,
|
|
!.
|
|
test(A) :-
|
|
'chr via_1'(A,D),
|
|
get_attr(D,guard_entailment,E),
|
|
E=v(G,F,_),
|
|
G/\1=:=1,
|
|
'chr sbag_member'(B,F),
|
|
B=suspension(_,mutable(active),_,_,_,_,C),
|
|
C==A,
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B\==C),
|
|
nonvar(B),
|
|
!,
|
|
test(C\==B).
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B\==C),
|
|
nonvar(C),
|
|
'chr lock'(C),
|
|
functor(C,D,E),
|
|
chr_runtime:unlock(C),
|
|
!,
|
|
C=..[_|F],
|
|
length(G,E),
|
|
H=..[D|G],
|
|
add_args_nmatch(G,F,I),
|
|
J=(\+functor(B,D,E);functor(B,D,E),B=H,I),
|
|
test(J).
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B=<C),
|
|
'chr via_2'(B,C,F),
|
|
get_attr(F,guard_entailment,G),
|
|
G=v(I,H,_),
|
|
I/\1=:=1,
|
|
'chr sbag_member'(D,H),
|
|
D=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=(J=:=K),
|
|
J==B,
|
|
K==C,
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B=<C),
|
|
number(C),
|
|
'chr via_1'(B,F),
|
|
get_attr(F,guard_entailment,G),
|
|
G=v(I,H,_),
|
|
I/\1=:=1,
|
|
'chr sbag_member'(D,H),
|
|
D=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=(J=:=K),
|
|
J==B,
|
|
number(K),
|
|
K=<C,
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B=<C),
|
|
number(B),
|
|
'chr via_1'(C,F),
|
|
get_attr(F,guard_entailment,G),
|
|
G=v(I,H,_),
|
|
I/\1=:=1,
|
|
'chr sbag_member'(D,H),
|
|
D=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=(J=:=K),
|
|
J==C,
|
|
number(K),
|
|
B=<K,
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B=<C),
|
|
number(C),
|
|
'chr via_1'(B,F),
|
|
get_attr(F,guard_entailment,G),
|
|
G=v(I,H,_),
|
|
I/\1=:=1,
|
|
'chr sbag_member'(D,H),
|
|
D=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=(J=<K),
|
|
J==B,
|
|
number(K),
|
|
K=<C,
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B=<C),
|
|
number(B),
|
|
'chr via_1'(C,F),
|
|
get_attr(F,guard_entailment,G),
|
|
G=v(I,H,_),
|
|
I/\1=:=1,
|
|
'chr sbag_member'(D,H),
|
|
D=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=(J=<K),
|
|
K==C,
|
|
number(J),
|
|
B=<J,
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B=\=C),
|
|
number(C),
|
|
'chr via_1'(B,F),
|
|
get_attr(F,guard_entailment,G),
|
|
G=v(I,H,_),
|
|
I/\1=:=1,
|
|
'chr sbag_member'(D,H),
|
|
D=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=(J=<K),
|
|
J==B,
|
|
number(K),
|
|
C>K,
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B=\=C),
|
|
number(C),
|
|
'chr via_1'(B,F),
|
|
get_attr(F,guard_entailment,G),
|
|
G=v(I,H,_),
|
|
I/\1=:=1,
|
|
'chr sbag_member'(D,H),
|
|
D=suspension(_,mutable(active),_,_,_,_,E),
|
|
nonvar(E),
|
|
E=(J=<K),
|
|
K==B,
|
|
number(J),
|
|
C<J,
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B>C),
|
|
!,
|
|
test(C<B).
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B>=C),
|
|
!,
|
|
test(C=<B).
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B<C),
|
|
!,
|
|
test((B=<C,B=\=C)).
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B is C),
|
|
!,
|
|
test(B=:=C).
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B;C),
|
|
B==fail,
|
|
!,
|
|
test(C).
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B;C),
|
|
C==fail,
|
|
!,
|
|
test(B).
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B=C),
|
|
'chr lock'(B),
|
|
'chr lock'(C),
|
|
B=C,
|
|
chr_runtime:unlock(B),
|
|
chr_runtime:unlock(C),
|
|
!,
|
|
B=C.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B=C),
|
|
ground(C),
|
|
ground(B),
|
|
!,
|
|
B=C.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B=C),
|
|
var(C),
|
|
nonvar(B),
|
|
!,
|
|
test(C=B).
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B=C),
|
|
nonvar(C),
|
|
var(B),
|
|
'chr global_term_ref_1'(F),
|
|
get_attr(F,guard_entailment,G),
|
|
G=v(I,_,H),
|
|
I/\2=:=2,
|
|
'chr sbag_member'(D,H),
|
|
D=suspension(_,mutable(active),_,_,_,_,E),
|
|
'chr lock'(C),
|
|
'chr lock'(E),
|
|
functor(C,J,K),
|
|
K>0,
|
|
C=..[J|L],
|
|
\+all_unique_vars(L,E),
|
|
chr_runtime:unlock(C),
|
|
chr_runtime:unlock(E),
|
|
!,
|
|
M=(functor(B,J,K),B=C),
|
|
test(M).
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B=C),
|
|
nonvar(C),
|
|
var(B),
|
|
'chr lock'(C),
|
|
functor(C,D,E),
|
|
C=..[D|_],
|
|
chr_runtime:unlock(C),
|
|
!,
|
|
F=functor(B,D,E),
|
|
test(F).
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B=C),
|
|
nonvar(B),
|
|
'chr lock'(C),
|
|
functor(C,D,E),
|
|
C=..[D|F],
|
|
chr_runtime:unlock(C),
|
|
!,
|
|
functor(B,D,E),
|
|
B=..[D|G],
|
|
add_args_unif(G,F,H),
|
|
test(H).
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B=C),
|
|
'chr global_term_ref_1'(F),
|
|
get_attr(F,guard_entailment,G),
|
|
G=v(I,_,H),
|
|
I/\2=:=2,
|
|
'chr sbag_member'(D,H),
|
|
D=suspension(_,mutable(active),_,_,_,_,E),
|
|
'chr lock'(C),
|
|
'chr lock'(E),
|
|
'chr lock'(B),
|
|
\+ (memberchk_eq(C,E),memberchk_eq(B,E)),
|
|
chr_runtime:unlock(C),
|
|
chr_runtime:unlock(E),
|
|
chr_runtime:unlock(B),
|
|
!,
|
|
B=C.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=functor(B,C,D),
|
|
ground(D),
|
|
ground(C),
|
|
var(B),
|
|
'chr global_term_ref_1'(G),
|
|
get_attr(G,guard_entailment,H),
|
|
H=v(J,_,I),
|
|
J/\2=:=2,
|
|
'chr sbag_member'(E,I),
|
|
E=suspension(_,mutable(active),_,_,_,_,F),
|
|
'chr lock'(B),
|
|
'chr lock'(F),
|
|
\+memberchk_eq(B,F),
|
|
chr_runtime:unlock(B),
|
|
chr_runtime:unlock(F),
|
|
!,
|
|
functor(B,C,D).
|
|
test(A) :-
|
|
A==true,
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B==C),
|
|
B==C,
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B=:=C),
|
|
B==C,
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B=<C),
|
|
B==C,
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B=<C),
|
|
ground(C),
|
|
ground(B),
|
|
B=<C,
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B=<C),
|
|
ground(C),
|
|
ground(B),
|
|
!,
|
|
fail.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B=:=C),
|
|
ground(C),
|
|
ground(B),
|
|
B=:=C,
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B=:=C),
|
|
ground(C),
|
|
ground(B),
|
|
!,
|
|
fail.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B=\=C),
|
|
ground(C),
|
|
ground(B),
|
|
B=\=C,
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B=\=C),
|
|
ground(C),
|
|
ground(B),
|
|
!,
|
|
fail.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=functor(B,C,D),
|
|
nonvar(B),
|
|
'chr lock'(B),
|
|
'chr lock'(C),
|
|
'chr lock'(D),
|
|
functor(B,C,D),
|
|
chr_runtime:unlock(B),
|
|
chr_runtime:unlock(C),
|
|
chr_runtime:unlock(D),
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=functor(B,_,_),
|
|
nonvar(B),
|
|
!,
|
|
fail.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=ground(B),
|
|
ground(B),
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=number(B),
|
|
number(B),
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=float(B),
|
|
float(B),
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=integer(B),
|
|
integer(B),
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=number(B),
|
|
nonvar(B),
|
|
!,
|
|
fail.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=float(B),
|
|
nonvar(B),
|
|
!,
|
|
fail.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=integer(B),
|
|
nonvar(B),
|
|
!,
|
|
fail.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(\+B),
|
|
nonvar(B),
|
|
B=functor(C,D,E),
|
|
nonvar(C),
|
|
'chr lock'(C),
|
|
'chr lock'(D),
|
|
'chr lock'(E),
|
|
functor(C,D,E),
|
|
chr_runtime:unlock(C),
|
|
chr_runtime:unlock(D),
|
|
chr_runtime:unlock(E),
|
|
!,
|
|
fail.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(\+B),
|
|
nonvar(B),
|
|
B=functor(C,_,_),
|
|
nonvar(C),
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(\+B),
|
|
nonvar(B),
|
|
B=ground(C),
|
|
ground(C),
|
|
!,
|
|
fail.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(\+B),
|
|
nonvar(B),
|
|
B=number(C),
|
|
number(C),
|
|
!,
|
|
fail.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(\+B),
|
|
nonvar(B),
|
|
B=float(C),
|
|
float(C),
|
|
!,
|
|
fail.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(\+B),
|
|
nonvar(B),
|
|
B=integer(C),
|
|
integer(C),
|
|
!,
|
|
fail.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(\+B),
|
|
nonvar(B),
|
|
B=number(C),
|
|
nonvar(C),
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(\+B),
|
|
nonvar(B),
|
|
B=float(C),
|
|
nonvar(C),
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(\+B),
|
|
nonvar(B),
|
|
B=integer(C),
|
|
nonvar(C),
|
|
!.
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B,C),
|
|
!,
|
|
test(B),
|
|
known(B),
|
|
test(C).
|
|
test(A) :-
|
|
nonvar(A),
|
|
A=(B;C),
|
|
!,
|
|
negate_b(B,D),
|
|
negate_b(C,E),
|
|
(
|
|
known(E),
|
|
test(B)
|
|
;
|
|
known(D),
|
|
test(C)
|
|
).
|
|
test(A) :-
|
|
'chr global_term_ref_1'(D),
|
|
get_attr(D,guard_entailment,E),
|
|
E=v(G,F,_),
|
|
G/\1=:=1,
|
|
'chr sbag_member'(B,F),
|
|
B=suspension(_,mutable(active),_,_,_,_,C),
|
|
nonvar(C),
|
|
C=(H;I),
|
|
!,
|
|
remove_constraint_internal(B,K,L),
|
|
( L==yes ->
|
|
'$delete_from_store_known/1'(B),
|
|
'detach_known/1'(K,B)
|
|
;
|
|
true
|
|
),
|
|
\+try(H,A),
|
|
!,
|
|
negate_b(H,J),
|
|
known(J),
|
|
\+try(I,A).
|
|
test(_) :-
|
|
fail.
|
|
cleanup :-
|
|
'chr global_term_ref_1'(A),
|
|
get_attr(A,guard_entailment,B),
|
|
B=v(D,C,_),
|
|
D/\1=:=1,
|
|
!,
|
|
'cleanup/0__0__0'(C).
|
|
'cleanup/0__0__0'([]) :-
|
|
'cleanup/0__1'.
|
|
'cleanup/0__0__0'([A|B]) :-
|
|
( A=suspension(_,mutable(active),_,_,_,_,_) ->
|
|
remove_constraint_internal(A,C,D),
|
|
( D==yes ->
|
|
'$delete_from_store_known/1'(A),
|
|
'detach_known/1'(C,A)
|
|
;
|
|
true
|
|
),
|
|
'cleanup/0__0__0'(B)
|
|
;
|
|
'cleanup/0__0__0'(B)
|
|
).
|
|
cleanup :-
|
|
'cleanup/0__1'.
|
|
'cleanup/0__1' :-
|
|
'chr global_term_ref_1'(A),
|
|
get_attr(A,guard_entailment,B),
|
|
B=v(D,_,C),
|
|
D/\2=:=2,
|
|
!,
|
|
'cleanup/0__1__0'(C).
|
|
'cleanup/0__1__0'([]) :-
|
|
'cleanup/0__2'.
|
|
'cleanup/0__1__0'([A|B]) :-
|
|
( A=suspension(_,mutable(active),_,_,_,_,_) ->
|
|
remove_constraint_internal(A,C,D),
|
|
( D==yes ->
|
|
'$delete_from_store_variables/1'(A),
|
|
'detach_variables/1'(C,A)
|
|
;
|
|
true
|
|
),
|
|
'cleanup/0__1__0'(B)
|
|
;
|
|
'cleanup/0__1__0'(B)
|
|
).
|
|
'cleanup/0__1' :-
|
|
'cleanup/0__2'.
|
|
'cleanup/0__2'.
|
|
variables(A) :-
|
|
'variables/1__0'(A,_).
|
|
'variables/1__0'(A,B) :-
|
|
'chr global_term_ref_1'(E),
|
|
get_attr(E,guard_entailment,F),
|
|
F=v(H,G,_),
|
|
H/\1=:=1,
|
|
'chr sbag_member'(C,G),
|
|
C=suspension(_,mutable(active),_,_,_,_,D),
|
|
nonvar(D),
|
|
D=functor(I,J,K),
|
|
ground(K),
|
|
ground(J),
|
|
var(I),
|
|
!,
|
|
remove_constraint_internal(C,N,O),
|
|
( O==yes ->
|
|
'$delete_from_store_known/1'(C),
|
|
'detach_known/1'(N,C)
|
|
;
|
|
true
|
|
),
|
|
( var(B) ->
|
|
true
|
|
;
|
|
remove_constraint_internal(B,P,Q),
|
|
( Q==yes ->
|
|
'$delete_from_store_variables/1'(B),
|
|
'detach_variables/1'(P,B)
|
|
;
|
|
true
|
|
)
|
|
),
|
|
functor(I,J,K),
|
|
I=..[_|L],
|
|
append(L,A,M),
|
|
variables(M).
|
|
'variables/1__0'(A,B) :-
|
|
( var(B) ->
|
|
insert_constraint_internal(D,C,B,guard_entailment:'variables/1__0'(A,B),variables(A),[A])
|
|
;
|
|
activate_constraint(D,C,B,_)
|
|
),
|
|
( D==yes ->
|
|
'$insert_in_store_variables/1'(B),
|
|
'attach_variables/1'(C,B)
|
|
;
|
|
true
|
|
).
|
|
:-multifile chr:'$chr_module'/1.
|
|
chr:'$chr_module'(guard_entailment).
|