6
|
1 /*
|
|
2 Copyright (C) 2001, Shinji Kono, University of the Ryukyus
|
|
3
|
|
4 Everyone is permitted to copy and distribute verbatim copies
|
|
5 of this license, but changing it is not allowed. You can also
|
|
6 use this wording to make the terms for other programs.
|
|
7
|
|
8 send your comments to kono@ie.u-ryukyu.ac.jp
|
|
9 $Header$
|
|
10
|
|
11 Infinite satisfiability/validity checker
|
|
12
|
|
13 A set of non-empty-exit looping states represents infinite
|
|
14 interval in ITL. The loop can contains deterministic state
|
|
15 choice. This should correspond Rabin/Strreet Automaton
|
|
16 that is non-deterministic Buchi automaton.
|
|
17
|
|
18 The algorith works in depth first way.
|
|
19
|
|
20 */
|
|
21
|
|
22 :-dynamic found_infinite/0.
|
|
23
|
|
24 infinite:-
|
|
25 retract_all(found_infinite),
|
|
26 infinite(L),
|
|
27 write_infinite_seq(L).
|
|
28 infinite:-
|
|
29 found_infinite,!.
|
|
30 infinite:-
|
|
31 write('unsatisfiable in infinite interval.'),nl.
|
|
32
|
|
33 write_infinite_seq(L) :-
|
10
|
34 write('satisfiable in infinite interval:'),nl,
|
|
35 make_hist(L,L1),
|
|
36 write_ce(L1,0),nl.
|
6
|
37
|
|
38 retract_all(X) :-
|
|
39 retract(X),fail.
|
|
40 retract_all(_).
|
|
41
|
9
|
42 infinite(L) :-
|
|
43 setof(S,(links(S,1),integer(S)),Children),
|
|
44 more_only_node(1,Children,L,[],[1]).
|
6
|
45 infinite([]) :-
|
|
46 found_infinite.
|
|
47
|
|
48 more_only(S) :-
|
|
49 state(S,[empty|_],true),!,fail.
|
|
50 more_only(S) :- number(S).
|
|
51
|
9
|
52 more_only_node(S,[S1|Children],[S|L],L1,Hist) :-
|
8
|
53 more_only(S),!,
|
10
|
54 % starting false loop
|
9
|
55 more_only_loop(S1,Children,L,L1,[S|Hist],[S]).
|
8
|
56 more_only_node(_,Children,L,L1,Hist) :- % goto one depth deeper
|
|
57 more_only_node1(Children,L,L1,Hist).
|
|
58
|
9
|
59 more_only_node1([H|_],L,L1,Hist) :-
|
8
|
60 setof(S,(links(S,H),integer(S)),Children),
|
|
61 more_only_node(H,Children,L,L1,Hist).
|
|
62 more_only_node1([_|T],L,L1,Hist) :-
|
|
63 more_only_node(T,L,L1,Hist).
|
|
64
|
6
|
65
|
9
|
66 more_only_loop(S,_,L,L,_Hist,Seq) :-
|
|
67 member(S,Seq),!,
|
|
68 assert(found_infinite).
|
8
|
69 % we find the one
|
9
|
70 more_only_loop(S,_,L,L,Hist,_Seq) :-
|
8
|
71 member(S,Hist),!,
|
|
72 fail.
|
|
73 % end of this branch
|
9
|
74 more_only_loop(H,_,[H|L],L1,Hist,Seq) :-
|
8
|
75 more_only(H),!,
|
|
76 % still in the false interval
|
9
|
77 setof(S,(links(S,H),integer(S)),Children),
|
|
78 more_only_loop1(Children,L,L1,[H|Hist],[H|Seq]).
|
|
79 more_only_loop(H,[S|_],[H|L],L1,Hist,_) :-
|
|
80 % false interval ends, start new search in depth first way
|
8
|
81 setof(S,(links(S,H),integer(S)),Children),
|
|
82 % we already know S i not more_only
|
9
|
83 more_only_node1(Children,L,L1,[H|Hist]).
|
8
|
84
|
9
|
85 more_only_loop1([H|_],L,L1,Hist,Seq) :-
|
8
|
86 setof(S,(links(S,H),integer(S)),Children),
|
|
87 more_only_loop(H,Children,L,L1,Hist,Seq).
|
|
88 more_only_loop1([_|T],L,L1,Hist,Seq) :-
|
10
|
89 more_only_loop1(T,L,L1,Hist,Seq).
|
6
|
90
|
|
91 /* end */
|