1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
% -----------------------------------------------------------------------------
% (C) Altran Praxis Limited
% -----------------------------------------------------------------------------
%
% The SPARK toolset is free software; you can redistribute it and/or modify it
% under terms of the GNU General Public License as published by the Free
% Software Foundation; either version 3, or (at your option) any later
% version. The SPARK toolset is distributed in the hope that it will be
% useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
% Public License for more details. You should have received a copy of the GNU
% General Public License distributed with the SPARK toolset; see file
% COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy of
% the license.
%
% =============================================================================
/*** SIMPLIFY -- top-level checker command ***/
simplify :-
movenots ;
split_hyps ;
split_concs ;
do_implication ;
equivalence.
simplify :- !.
/*** MOVENOTS - move nots as far into expressions as possible ***/
movenots:-
retractall(hn(_)),
assertz(hn(1)),
repeat,
hn(N),
(
gethyp(N,H),
negin(H,H1),
assertz(hyp(N,H1)),
(
H1=H
;
H1\=H,
assertz(logfact(newhyp, hyp(N,H1))),
new_hyp_message(N, H1) /* CFR018 */
)
;
hn(N)
),
M is N+1,
retract(hn(N)),
assertz(hn(M)),
bigger_than_all_hyps(M),
!,
fail.
bigger_than_all_hyps(M) :-
hyp(N,_),
N>=M,
!,
fail.
bigger_than_all_hyps(_) :- !.
/*** GETHYP(N,H) - instantiates H to the Nth hypothesis & retracts it ***/
gethyp(N,H) :-
hyp(N,H),
retract(hyp(N,H)), !.
/*** SPLIT_HYPS - split conjunction hypotheses into two or more hypotheses ***/
split_hyps :-
retract(hyp(_N,A and B)),
add_new_hyp(A,1),
add_new_hyp(B,1),
!,
split_hyps.
/*** SPLIT_CONCS - split conjunction conclusions into separate conclusions ***/
split_concs :-
retract(conc(_N,A and B)),
add_new_conc(A,1),
add_new_conc(B,1),
!,
split_concs.
/*** DO_IMPLICATION - given "A" and "A -> B", add "B" as a hypothesis; given
"not B" and "A -> B", add "not A" as a hypothesis ***/
/*** ADDED 4/3/85 -- needs improvement for generality ***/
do_implication :-
hyp(_,A -> B),
hyp(_,A),
add_new_hyp(B,1),
fail.
do_implication :-
hyp(_,A -> B),
hyp(_,(not B)),
negin((not A),C),
add_new_hyp(C,1),
fail.
/*** EQUIVALENCE - given "A" and "A <-> B" or "B <-> A", add "B";
given "not A" and "A <-> B" or "B <-> A", add "not B" ***/
equivalence :-
hyp(_,A <-> B),
hyp(_,A),
add_new_hyp(B,1),
fail.
equivalence :-
hyp(_,A <-> B),
hyp(_,B),
add_new_hyp(A,1),
fail.
equivalence :-
hyp(_,A <-> B),
hyp(_,not(A)),
negin(not(B),C),
add_new_hyp(C,1),
fail.
equivalence :-
hyp(_,A <-> B),
hyp(_,not(B)),
negin(not(A),C),
add_new_hyp(C,1),
fail.
%###############################################################################
%END-OF-FILE
|