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 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279
|
% --------------------------------------------------------------------- %
% Copyright (c) Jim Grundy 1992 %
% All rights reserved %
% %
% Jim Grundy, hereafter referred to as `the Author', retains the %
% copyright and all other legal rights to the Software contained in %
% this file, hereafter referred to as `the Software'. %
% %
% The Software is made available free of charge on an `as is' basis. %
% No guarantee, either express or implied, of maintenance, reliability, %
% merchantability or suitability for any purpose is made by the Author. %
% %
% The user is granted the right to make personal or internal use %
% of the Software provided that both: %
% 1. The Software is not used for commercial gain. %
% 2. The user shall not hold the Author liable for any consequences %
% arising from use of the Software. %
% %
% The user is granted the right to further distribute the Software %
% provided that both: %
% 1. The Software and this statement of rights is not modified. %
% 2. The Software does not form part or the whole of a system %
% distributed for commercial gain. %
% %
% The user is granted the right to modify the Software for personal or %
% internal use provided that all of the following conditions are %
% observed: %
% 1. The user does not distribute the modified software. %
% 2. The modified software is not used for commercial gain. %
% 3. The Author retains all rights to the modified software. %
% %
% Anyone seeking a licence to use this software for commercial purposes %
% is invited to contact the Author. %
% --------------------------------------------------------------------- %
%============================================================================%
% CONTENTS: window infernce rules preserving equality %
%============================================================================%
%$Id: eq_close.ml,v 3.1 1993/12/07 14:15:19 jg Exp $%
begin_section eq_close;;
let CONJ1_THM =
prove
(
"!A B C. (B ==> (C = A)) ==> ((C /\ B) = (A /\ B))"
,
(REPEAT GEN_TAC) THEN
BOOL_CASES_TAC "A:bool" THEN
BOOL_CASES_TAC "B:bool" THEN
REWRITE_TAC []
);;
% (B |- C = A) %
% -------------------------- CONJ1_CLOSE "A /\ B" %
% (|- (C /\ B) = (A /\ B)) %
let CONJ1_CLOSE tm th =
let (a,b) = dest_conj tm in
let c = rand (rator (concl th)) in
MP (SPECL [a; b; c] CONJ1_THM) (DISCH b th) ;;
let CONJ2_THM =
prove
(
"!A B C. (A ==> (C = B)) ==> ((A /\ C) = (A /\ B))"
,
(REPEAT GEN_TAC) THEN
BOOL_CASES_TAC "A:bool" THEN
BOOL_CASES_TAC "B:bool" THEN
REWRITE_TAC []
);;
% (A |- C = B) %
% -------------------------- CONJ2_CLOSE "A /\ B" %
% (|- (A /\ C) = (A /\ B)) %
let CONJ2_CLOSE tm th =
let (a,b) = dest_conj tm in
let c = rand (rator (concl th)) in
MP (SPECL [a; b; c] CONJ2_THM) (DISCH a th) ;;
let IMP1_THM =
prove
(
"!A B C. (~B ==> (C = A)) ==> ((C ==> B) = (A ==> B))"
,
(REPEAT GEN_TAC) THEN
BOOL_CASES_TAC "A:bool" THEN
BOOL_CASES_TAC "B:bool" THEN
REWRITE_TAC []
) ;;
% (~B |- C = A) %
% ---------------------------- IMP1_CLOSE "A ==> B" %
% (|- (C ==> B) = (A ==> B)) %
let IMP1_CLOSE tm th =
let (a,b) = dest_imp tm in
let c = (rand (rator (concl th))) in
MP (SPECL [a; b; c] IMP1_THM) (DISCH (mk_neg b) th) ;;
let IMP2_THM =
prove
(
"!A B C. (A ==> (C = B)) ==> ((A ==> C) = (A ==> B))"
,
(REPEAT GEN_TAC) THEN
BOOL_CASES_TAC "A:bool" THEN
BOOL_CASES_TAC "B:bool" THEN
REWRITE_TAC []
) ;;
% (A |- C = B) %
% ---------------------------- IMP2_CLOSE "A ==> B" %
% (|- (A ==> C) = (A ==> B)) %
let IMP2_CLOSE tm th =
let (a,b) = dest_imp tm in
let c = (rand (rator (concl th))) in
MP (SPECL [a; b; c] IMP2_THM) (DISCH a th) ;;
let PMI1_THM =
prove
(
"!A B C. (B ==> (C = A)) ==> ((C <== B) = (A <== B))"
,
(REPEAT GEN_TAC) THEN
(PURE_REWRITE_TAC [PMI_DEF]) THEN
BOOL_CASES_TAC "A:bool" THEN
BOOL_CASES_TAC "B:bool" THEN
REWRITE_TAC []
) ;;
% (B |- C = A) %
% ---------------------------- PMI1_CLOSE "A <== B" %
% (|- (C <== B) = (A <== B)) %
let PMI1_CLOSE tm th =
let (a,b) = dest_pmi tm in
let c = (rand (rator (concl th))) in
MP (SPECL [a; b; c] PMI1_THM) (DISCH b th) ;;
let PMI2_THM =
prove
(
"!A B C. (~A ==> (C = B)) ==> ((A <== C) = (A <== B))"
,
(REPEAT GEN_TAC) THEN
(PURE_REWRITE_TAC [PMI_DEF]) THEN
BOOL_CASES_TAC "A:bool" THEN
BOOL_CASES_TAC "B:bool" THEN
REWRITE_TAC []
) ;;
% (~A |- C = B) %
% ---------------------------- PMI2_CLOSE "A <== B" %
% (|- (A <== C) = (A <== B)) %
let PMI2_CLOSE tm th =
let (a,b) = dest_pmi tm in
let c = (rand (rator (concl th))) in
MP (SPECL [a; b; c] PMI2_THM) (DISCH (mk_neg a) th) ;;
let DISJ1_THM =
prove
(
"!A B C. (~B ==> (C = A)) ==> ((C \/ B) = (A \/ B))"
,
(REPEAT GEN_TAC) THEN
BOOL_CASES_TAC "A:bool" THEN
BOOL_CASES_TAC "B:bool" THEN
REWRITE_TAC []
) ;;
% (~B |- C = A) %
% -------------------------- DISJ1_CLOSE "A \/ B" %
% (|- (C \/ B) = (A \/ B)) %
let DISJ1_CLOSE tm th =
let (a,b) = dest_disj tm in
let c = (rand (rator (concl th))) in
MP (SPECL [a; b; c] DISJ1_THM) (DISCH (mk_neg b) th) ;;
let DISJ2_THM =
prove
(
"!A B C. (~A ==> (C = B)) ==> ((A \/ C) = (A \/ B))"
,
(REPEAT GEN_TAC) THEN
BOOL_CASES_TAC "A:bool" THEN
BOOL_CASES_TAC "B:bool" THEN
REWRITE_TAC []
) ;;
% (~A |- C = B) %
% --------------------------- DISJ2_CLOSE "A \/ B" %
% (|- (A \/ C) = (A \/ B)) %
let DISJ2_CLOSE tm th =
let (a,b) = dest_disj tm in
let c = (rand (rator (concl th))) in
MP (SPECL [a; b; c] DISJ2_THM) (DISCH (mk_neg a) th) ;;
% Put all those rules in the data base. %
store_rule
(
[RATOR; RAND],
is_conj,
K (K equiv_tm),
K (K equiv_tm),
(\tm.\tl. (SMASH (ASSUME (rand tm))) @ tl),
K [],
CONJ1_CLOSE
);;
store_rule
(
[RAND],
is_conj,
K (K equiv_tm),
K (K equiv_tm),
(\tm.\tl. (SMASH (ASSUME (rand (rator tm)))) @ tl),
K [],
CONJ2_CLOSE
);;
store_rule
(
[RATOR; RAND],
is_trueimp,
K (K equiv_tm),
K (K equiv_tm),
(\tm.\tl. (SMASH (ASSUME (mk_neg (rand tm)))) @ tl),
K [],
IMP1_CLOSE
);;
store_rule
(
[RAND],
is_trueimp,
K (K equiv_tm),
K (K equiv_tm),
(\tm.\tl. (SMASH (ASSUME (rand (rator tm)))) @ tl),
K [],
IMP2_CLOSE
);;
store_rule
(
[RATOR; RAND],
is_pmi,
K (K equiv_tm),
K (K equiv_tm),
(\tm.\tl. (SMASH (ASSUME (rand tm))) @ tl),
K [],
PMI1_CLOSE
);;
store_rule
(
[RAND],
is_pmi,
K (K equiv_tm),
K (K equiv_tm),
(\tm.\tl. (SMASH (ASSUME (mk_neg (rand (rator tm))))) @ tl),
K [],
PMI2_CLOSE
);;
store_rule
(
[RATOR; RAND],
is_disj,
K (K equiv_tm),
K (K equiv_tm),
(\tm.\tl. (SMASH (ASSUME (mk_neg (rand tm)))) @ tl),
K [],
DISJ1_CLOSE
);;
store_rule
(
[RAND],
is_disj,
K (K equiv_tm),
K (K equiv_tm),
(\tm.\tl. (SMASH (ASSUME (mk_neg (rand (rator tm))))) @ tl),
K [],
DISJ2_CLOSE
);;
end_section eq_close.ml
|