author | wenzelm |
Mon, 15 Feb 2016 14:55:44 +0100 | |
changeset 62337 | d3996d5873dd |
parent 61128 | 8e5072cba671 |
child 65024 | 3cb801391353 |
permissions | -rw-r--r-- |
36528 | 1 |
(* Generated from Cooper.thy; DO NOT EDIT! *) |
23689
0410269099dc
replaced code generator framework for reflected cooper
haftmann
parents:
23466
diff
changeset
|
2 |
|
36798 | 3 |
structure Cooper_Procedure : sig |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
4 |
datatype inta = Int_of_integer of int |
55685 | 5 |
val integer_of_int : inta -> int |
6 |
type nat |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
7 |
val integer_of_nat : nat -> int |
61128 | 8 |
datatype numa = C of inta | Bound of nat | CN of nat * inta * numa | |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
9 |
Neg of numa | Add of numa * numa | Sub of numa * numa | Mul of inta * numa |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
10 |
datatype fm = T | F | Lt of numa | Le of numa | Gt of numa | Ge of numa | |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
11 |
Eq of numa | NEq of numa | Dvd of inta * numa | NDvd of inta * numa | |
61128 | 12 |
NOT of fm | And of fm * fm | Or of fm * fm | Imp of fm * fm | Iff of fm * fm |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
13 |
| E of fm | A of fm | Closed of nat | NClosed of nat |
36528 | 14 |
val pa : fm -> fm |
55685 | 15 |
val nat_of_integer : int -> nat |
36528 | 16 |
end = struct |
23466 | 17 |
|
55685 | 18 |
datatype inta = Int_of_integer of int; |
19 |
||
20 |
fun integer_of_int (Int_of_integer k) = k; |
|
21 |
||
22 |
fun equal_inta k l = integer_of_int k = integer_of_int l; |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
23 |
|
44930 | 24 |
type 'a equal = {equal : 'a -> 'a -> bool}; |
25 |
val equal = #equal : 'a equal -> 'a -> 'a -> bool; |
|
29787 | 26 |
|
55685 | 27 |
val equal_int = {equal = equal_inta} : inta equal; |
28 |
||
29 |
fun times_inta k l = Int_of_integer (integer_of_int k * integer_of_int l); |
|
30 |
||
31 |
type 'a times = {times : 'a -> 'a -> 'a}; |
|
32 |
val times = #times : 'a times -> 'a -> 'a -> 'a; |
|
33 |
||
34 |
type 'a dvd = {times_dvd : 'a times}; |
|
35 |
val times_dvd = #times_dvd : 'a dvd -> 'a times; |
|
36 |
||
37 |
val times_int = {times = times_inta} : inta times; |
|
38 |
||
39 |
val dvd_int = {times_dvd = times_int} : inta dvd; |
|
40 |
||
41 |
datatype num = One | Bit0 of num | Bit1 of num; |
|
42 |
||
43 |
val one_inta : inta = Int_of_integer (1 : IntInf.int); |
|
44 |
||
45 |
type 'a one = {one : 'a}; |
|
46 |
val one = #one : 'a one -> 'a; |
|
47 |
||
48 |
val one_int = {one = one_inta} : inta one; |
|
49 |
||
50 |
fun sgn_integer k = |
|
61128 | 51 |
(if k = (0 : IntInf.int) then (0 : IntInf.int) |
52 |
else (if k < (0 : IntInf.int) then (~1 : IntInf.int) |
|
53 |
else (1 : IntInf.int))); |
|
55685 | 54 |
|
61128 | 55 |
fun abs_integer k = (if k < (0 : IntInf.int) then ~ k else k); |
55685 | 56 |
|
57 |
fun apsnd f (x, y) = (x, f y); |
|
58 |
||
59 |
fun divmod_integer k l = |
|
61128 | 60 |
(if k = (0 : IntInf.int) then ((0 : IntInf.int), (0 : IntInf.int)) |
61 |
else (if l = (0 : IntInf.int) then ((0 : IntInf.int), k) |
|
55685 | 62 |
else (apsnd o (fn a => fn b => a * b) o sgn_integer) l |
63 |
(if sgn_integer k = sgn_integer l |
|
64 |
then Integer.div_mod (abs k) (abs l) |
|
65 |
else let |
|
66 |
val (r, s) = Integer.div_mod (abs k) (abs l); |
|
67 |
in |
|
61128 | 68 |
(if s = (0 : IntInf.int) then (~ r, (0 : IntInf.int)) |
55685 | 69 |
else (~ r - (1 : IntInf.int), abs_integer l - s)) |
70 |
end))); |
|
71 |
||
61128 | 72 |
fun fst (x1, x2) = x1; |
73 |
||
74 |
fun divide_integer k l = fst (divmod_integer k l); |
|
75 |
||
76 |
fun divide_inta k l = |
|
77 |
Int_of_integer (divide_integer (integer_of_int k) (integer_of_int l)); |
|
78 |
||
55685 | 79 |
fun snd (x1, x2) = x2; |
80 |
||
81 |
fun mod_integer k l = snd (divmod_integer k l); |
|
82 |
||
83 |
fun mod_int k l = |
|
84 |
Int_of_integer (mod_integer (integer_of_int k) (integer_of_int l)); |
|
85 |
||
61128 | 86 |
type 'a divide = {divide : 'a -> 'a -> 'a}; |
87 |
val divide = #divide : 'a divide -> 'a -> 'a -> 'a; |
|
55685 | 88 |
|
61128 | 89 |
type 'a diva = |
90 |
{divide_div : 'a divide, dvd_div : 'a dvd, moda : 'a -> 'a -> 'a}; |
|
91 |
val divide_div = #divide_div : 'a diva -> 'a divide; |
|
55685 | 92 |
val dvd_div = #dvd_div : 'a diva -> 'a dvd; |
93 |
val moda = #moda : 'a diva -> 'a -> 'a -> 'a; |
|
94 |
||
61128 | 95 |
val divide_int = {divide = divide_inta} : inta divide; |
96 |
||
97 |
val div_int = {divide_div = divide_int, dvd_div = dvd_int, moda = mod_int} : |
|
98 |
inta diva; |
|
55685 | 99 |
|
100 |
fun plus_inta k l = Int_of_integer (integer_of_int k + integer_of_int l); |
|
101 |
||
102 |
type 'a plus = {plus : 'a -> 'a -> 'a}; |
|
103 |
val plus = #plus : 'a plus -> 'a -> 'a -> 'a; |
|
104 |
||
105 |
val plus_int = {plus = plus_inta} : inta plus; |
|
106 |
||
61128 | 107 |
val zero_inta : inta = Int_of_integer (0 : IntInf.int); |
55685 | 108 |
|
109 |
type 'a zero = {zero : 'a}; |
|
110 |
val zero = #zero : 'a zero -> 'a; |
|
111 |
||
112 |
val zero_int = {zero = zero_inta} : inta zero; |
|
113 |
||
114 |
type 'a semigroup_add = {plus_semigroup_add : 'a plus}; |
|
115 |
val plus_semigroup_add = #plus_semigroup_add : 'a semigroup_add -> 'a plus; |
|
116 |
||
117 |
type 'a numeral = |
|
118 |
{one_numeral : 'a one, semigroup_add_numeral : 'a semigroup_add}; |
|
119 |
val one_numeral = #one_numeral : 'a numeral -> 'a one; |
|
120 |
val semigroup_add_numeral = #semigroup_add_numeral : |
|
121 |
'a numeral -> 'a semigroup_add; |
|
122 |
||
123 |
val semigroup_add_int = {plus_semigroup_add = plus_int} : inta semigroup_add; |
|
124 |
||
125 |
val numeral_int = |
|
126 |
{one_numeral = one_int, semigroup_add_numeral = semigroup_add_int} : |
|
127 |
inta numeral; |
|
128 |
||
129 |
type 'a power = {one_power : 'a one, times_power : 'a times}; |
|
130 |
val one_power = #one_power : 'a power -> 'a one; |
|
131 |
val times_power = #times_power : 'a power -> 'a times; |
|
132 |
||
133 |
val power_int = {one_power = one_int, times_power = times_int} : inta power; |
|
134 |
||
61128 | 135 |
fun minus_inta k l = Int_of_integer (integer_of_int k - integer_of_int l); |
136 |
||
137 |
type 'a minus = {minus : 'a -> 'a -> 'a}; |
|
138 |
val minus = #minus : 'a minus -> 'a -> 'a -> 'a; |
|
139 |
||
140 |
val minus_int = {minus = minus_inta} : inta minus; |
|
141 |
||
55685 | 142 |
type 'a ab_semigroup_add = {semigroup_add_ab_semigroup_add : 'a semigroup_add}; |
143 |
val semigroup_add_ab_semigroup_add = #semigroup_add_ab_semigroup_add : |
|
144 |
'a ab_semigroup_add -> 'a semigroup_add; |
|
145 |
||
146 |
type 'a monoid_add = |
|
147 |
{semigroup_add_monoid_add : 'a semigroup_add, zero_monoid_add : 'a zero}; |
|
148 |
val semigroup_add_monoid_add = #semigroup_add_monoid_add : |
|
149 |
'a monoid_add -> 'a semigroup_add; |
|
150 |
val zero_monoid_add = #zero_monoid_add : 'a monoid_add -> 'a zero; |
|
151 |
||
152 |
type 'a comm_monoid_add = |
|
153 |
{ab_semigroup_add_comm_monoid_add : 'a ab_semigroup_add, |
|
154 |
monoid_add_comm_monoid_add : 'a monoid_add}; |
|
155 |
val ab_semigroup_add_comm_monoid_add = #ab_semigroup_add_comm_monoid_add : |
|
156 |
'a comm_monoid_add -> 'a ab_semigroup_add; |
|
157 |
val monoid_add_comm_monoid_add = #monoid_add_comm_monoid_add : |
|
158 |
'a comm_monoid_add -> 'a monoid_add; |
|
159 |
||
61128 | 160 |
type 'a mult_zero = {times_mult_zero : 'a times, zero_mult_zero : 'a zero}; |
161 |
val times_mult_zero = #times_mult_zero : 'a mult_zero -> 'a times; |
|
162 |
val zero_mult_zero = #zero_mult_zero : 'a mult_zero -> 'a zero; |
|
163 |
||
164 |
type 'a semigroup_mult = {times_semigroup_mult : 'a times}; |
|
165 |
val times_semigroup_mult = #times_semigroup_mult : |
|
166 |
'a semigroup_mult -> 'a times; |
|
167 |
||
168 |
type 'a semiring = |
|
169 |
{ab_semigroup_add_semiring : 'a ab_semigroup_add, |
|
170 |
semigroup_mult_semiring : 'a semigroup_mult}; |
|
171 |
val ab_semigroup_add_semiring = #ab_semigroup_add_semiring : |
|
172 |
'a semiring -> 'a ab_semigroup_add; |
|
173 |
val semigroup_mult_semiring = #semigroup_mult_semiring : |
|
174 |
'a semiring -> 'a semigroup_mult; |
|
175 |
||
55685 | 176 |
type 'a semiring_0 = |
177 |
{comm_monoid_add_semiring_0 : 'a comm_monoid_add, |
|
178 |
mult_zero_semiring_0 : 'a mult_zero, semiring_semiring_0 : 'a semiring}; |
|
179 |
val comm_monoid_add_semiring_0 = #comm_monoid_add_semiring_0 : |
|
180 |
'a semiring_0 -> 'a comm_monoid_add; |
|
181 |
val mult_zero_semiring_0 = #mult_zero_semiring_0 : |
|
182 |
'a semiring_0 -> 'a mult_zero; |
|
183 |
val semiring_semiring_0 = #semiring_semiring_0 : 'a semiring_0 -> 'a semiring; |
|
184 |
||
61128 | 185 |
type 'a semiring_no_zero_divisors = |
186 |
{semiring_0_semiring_no_zero_divisors : 'a semiring_0}; |
|
187 |
val semiring_0_semiring_no_zero_divisors = #semiring_0_semiring_no_zero_divisors |
|
188 |
: 'a semiring_no_zero_divisors -> 'a semiring_0; |
|
55685 | 189 |
|
190 |
type 'a monoid_mult = |
|
191 |
{semigroup_mult_monoid_mult : 'a semigroup_mult, |
|
192 |
power_monoid_mult : 'a power}; |
|
193 |
val semigroup_mult_monoid_mult = #semigroup_mult_monoid_mult : |
|
194 |
'a monoid_mult -> 'a semigroup_mult; |
|
195 |
val power_monoid_mult = #power_monoid_mult : 'a monoid_mult -> 'a power; |
|
196 |
||
197 |
type 'a semiring_numeral = |
|
198 |
{monoid_mult_semiring_numeral : 'a monoid_mult, |
|
199 |
numeral_semiring_numeral : 'a numeral, |
|
200 |
semiring_semiring_numeral : 'a semiring}; |
|
201 |
val monoid_mult_semiring_numeral = #monoid_mult_semiring_numeral : |
|
202 |
'a semiring_numeral -> 'a monoid_mult; |
|
203 |
val numeral_semiring_numeral = #numeral_semiring_numeral : |
|
204 |
'a semiring_numeral -> 'a numeral; |
|
205 |
val semiring_semiring_numeral = #semiring_semiring_numeral : |
|
206 |
'a semiring_numeral -> 'a semiring; |
|
207 |
||
208 |
type 'a zero_neq_one = {one_zero_neq_one : 'a one, zero_zero_neq_one : 'a zero}; |
|
209 |
val one_zero_neq_one = #one_zero_neq_one : 'a zero_neq_one -> 'a one; |
|
210 |
val zero_zero_neq_one = #zero_zero_neq_one : 'a zero_neq_one -> 'a zero; |
|
211 |
||
212 |
type 'a semiring_1 = |
|
213 |
{semiring_numeral_semiring_1 : 'a semiring_numeral, |
|
214 |
semiring_0_semiring_1 : 'a semiring_0, |
|
215 |
zero_neq_one_semiring_1 : 'a zero_neq_one}; |
|
216 |
val semiring_numeral_semiring_1 = #semiring_numeral_semiring_1 : |
|
217 |
'a semiring_1 -> 'a semiring_numeral; |
|
218 |
val semiring_0_semiring_1 = #semiring_0_semiring_1 : |
|
219 |
'a semiring_1 -> 'a semiring_0; |
|
220 |
val zero_neq_one_semiring_1 = #zero_neq_one_semiring_1 : |
|
221 |
'a semiring_1 -> 'a zero_neq_one; |
|
222 |
||
61128 | 223 |
type 'a semiring_1_no_zero_divisors = |
224 |
{semiring_1_semiring_1_no_zero_divisors : 'a semiring_1, |
|
225 |
semiring_no_zero_divisors_semiring_1_no_zero_divisors : |
|
226 |
'a semiring_no_zero_divisors}; |
|
227 |
val semiring_1_semiring_1_no_zero_divisors = |
|
228 |
#semiring_1_semiring_1_no_zero_divisors : |
|
229 |
'a semiring_1_no_zero_divisors -> 'a semiring_1; |
|
230 |
val semiring_no_zero_divisors_semiring_1_no_zero_divisors = |
|
231 |
#semiring_no_zero_divisors_semiring_1_no_zero_divisors : |
|
232 |
'a semiring_1_no_zero_divisors -> 'a semiring_no_zero_divisors; |
|
55685 | 233 |
|
234 |
type 'a cancel_semigroup_add = |
|
235 |
{semigroup_add_cancel_semigroup_add : 'a semigroup_add}; |
|
236 |
val semigroup_add_cancel_semigroup_add = #semigroup_add_cancel_semigroup_add : |
|
237 |
'a cancel_semigroup_add -> 'a semigroup_add; |
|
238 |
||
239 |
type 'a cancel_ab_semigroup_add = |
|
240 |
{ab_semigroup_add_cancel_ab_semigroup_add : 'a ab_semigroup_add, |
|
61128 | 241 |
cancel_semigroup_add_cancel_ab_semigroup_add : 'a cancel_semigroup_add, |
242 |
minus_cancel_ab_semigroup_add : 'a minus}; |
|
55685 | 243 |
val ab_semigroup_add_cancel_ab_semigroup_add = |
244 |
#ab_semigroup_add_cancel_ab_semigroup_add : |
|
245 |
'a cancel_ab_semigroup_add -> 'a ab_semigroup_add; |
|
246 |
val cancel_semigroup_add_cancel_ab_semigroup_add = |
|
247 |
#cancel_semigroup_add_cancel_ab_semigroup_add : |
|
248 |
'a cancel_ab_semigroup_add -> 'a cancel_semigroup_add; |
|
61128 | 249 |
val minus_cancel_ab_semigroup_add = #minus_cancel_ab_semigroup_add : |
250 |
'a cancel_ab_semigroup_add -> 'a minus; |
|
55685 | 251 |
|
252 |
type 'a cancel_comm_monoid_add = |
|
253 |
{cancel_ab_semigroup_add_cancel_comm_monoid_add : 'a cancel_ab_semigroup_add, |
|
254 |
comm_monoid_add_cancel_comm_monoid_add : 'a comm_monoid_add}; |
|
255 |
val cancel_ab_semigroup_add_cancel_comm_monoid_add = |
|
256 |
#cancel_ab_semigroup_add_cancel_comm_monoid_add : |
|
257 |
'a cancel_comm_monoid_add -> 'a cancel_ab_semigroup_add; |
|
258 |
val comm_monoid_add_cancel_comm_monoid_add = |
|
259 |
#comm_monoid_add_cancel_comm_monoid_add : |
|
260 |
'a cancel_comm_monoid_add -> 'a comm_monoid_add; |
|
261 |
||
262 |
type 'a semiring_0_cancel = |
|
263 |
{cancel_comm_monoid_add_semiring_0_cancel : 'a cancel_comm_monoid_add, |
|
264 |
semiring_0_semiring_0_cancel : 'a semiring_0}; |
|
265 |
val cancel_comm_monoid_add_semiring_0_cancel = |
|
266 |
#cancel_comm_monoid_add_semiring_0_cancel : |
|
267 |
'a semiring_0_cancel -> 'a cancel_comm_monoid_add; |
|
268 |
val semiring_0_semiring_0_cancel = #semiring_0_semiring_0_cancel : |
|
269 |
'a semiring_0_cancel -> 'a semiring_0; |
|
270 |
||
61128 | 271 |
type 'a ab_semigroup_mult = |
272 |
{semigroup_mult_ab_semigroup_mult : 'a semigroup_mult}; |
|
273 |
val semigroup_mult_ab_semigroup_mult = #semigroup_mult_ab_semigroup_mult : |
|
274 |
'a ab_semigroup_mult -> 'a semigroup_mult; |
|
275 |
||
276 |
type 'a comm_semiring = |
|
277 |
{ab_semigroup_mult_comm_semiring : 'a ab_semigroup_mult, |
|
278 |
semiring_comm_semiring : 'a semiring}; |
|
279 |
val ab_semigroup_mult_comm_semiring = #ab_semigroup_mult_comm_semiring : |
|
280 |
'a comm_semiring -> 'a ab_semigroup_mult; |
|
281 |
val semiring_comm_semiring = #semiring_comm_semiring : |
|
282 |
'a comm_semiring -> 'a semiring; |
|
283 |
||
55685 | 284 |
type 'a comm_semiring_0 = |
285 |
{comm_semiring_comm_semiring_0 : 'a comm_semiring, |
|
286 |
semiring_0_comm_semiring_0 : 'a semiring_0}; |
|
287 |
val comm_semiring_comm_semiring_0 = #comm_semiring_comm_semiring_0 : |
|
288 |
'a comm_semiring_0 -> 'a comm_semiring; |
|
289 |
val semiring_0_comm_semiring_0 = #semiring_0_comm_semiring_0 : |
|
290 |
'a comm_semiring_0 -> 'a semiring_0; |
|
291 |
||
292 |
type 'a comm_semiring_0_cancel = |
|
293 |
{comm_semiring_0_comm_semiring_0_cancel : 'a comm_semiring_0, |
|
294 |
semiring_0_cancel_comm_semiring_0_cancel : 'a semiring_0_cancel}; |
|
295 |
val comm_semiring_0_comm_semiring_0_cancel = |
|
296 |
#comm_semiring_0_comm_semiring_0_cancel : |
|
297 |
'a comm_semiring_0_cancel -> 'a comm_semiring_0; |
|
298 |
val semiring_0_cancel_comm_semiring_0_cancel = |
|
299 |
#semiring_0_cancel_comm_semiring_0_cancel : |
|
300 |
'a comm_semiring_0_cancel -> 'a semiring_0_cancel; |
|
301 |
||
302 |
type 'a semiring_1_cancel = |
|
303 |
{semiring_0_cancel_semiring_1_cancel : 'a semiring_0_cancel, |
|
304 |
semiring_1_semiring_1_cancel : 'a semiring_1}; |
|
305 |
val semiring_0_cancel_semiring_1_cancel = #semiring_0_cancel_semiring_1_cancel : |
|
306 |
'a semiring_1_cancel -> 'a semiring_0_cancel; |
|
307 |
val semiring_1_semiring_1_cancel = #semiring_1_semiring_1_cancel : |
|
308 |
'a semiring_1_cancel -> 'a semiring_1; |
|
309 |
||
310 |
type 'a comm_monoid_mult = |
|
311 |
{ab_semigroup_mult_comm_monoid_mult : 'a ab_semigroup_mult, |
|
61128 | 312 |
monoid_mult_comm_monoid_mult : 'a monoid_mult, |
313 |
dvd_comm_monoid_mult : 'a dvd}; |
|
55685 | 314 |
val ab_semigroup_mult_comm_monoid_mult = #ab_semigroup_mult_comm_monoid_mult : |
315 |
'a comm_monoid_mult -> 'a ab_semigroup_mult; |
|
316 |
val monoid_mult_comm_monoid_mult = #monoid_mult_comm_monoid_mult : |
|
317 |
'a comm_monoid_mult -> 'a monoid_mult; |
|
61128 | 318 |
val dvd_comm_monoid_mult = #dvd_comm_monoid_mult : |
319 |
'a comm_monoid_mult -> 'a dvd; |
|
55685 | 320 |
|
321 |
type 'a comm_semiring_1 = |
|
322 |
{comm_monoid_mult_comm_semiring_1 : 'a comm_monoid_mult, |
|
323 |
comm_semiring_0_comm_semiring_1 : 'a comm_semiring_0, |
|
61128 | 324 |
semiring_1_comm_semiring_1 : 'a semiring_1}; |
55685 | 325 |
val comm_monoid_mult_comm_semiring_1 = #comm_monoid_mult_comm_semiring_1 : |
326 |
'a comm_semiring_1 -> 'a comm_monoid_mult; |
|
327 |
val comm_semiring_0_comm_semiring_1 = #comm_semiring_0_comm_semiring_1 : |
|
328 |
'a comm_semiring_1 -> 'a comm_semiring_0; |
|
329 |
val semiring_1_comm_semiring_1 = #semiring_1_comm_semiring_1 : |
|
330 |
'a comm_semiring_1 -> 'a semiring_1; |
|
331 |
||
332 |
type 'a comm_semiring_1_cancel = |
|
333 |
{comm_semiring_0_cancel_comm_semiring_1_cancel : 'a comm_semiring_0_cancel, |
|
334 |
comm_semiring_1_comm_semiring_1_cancel : 'a comm_semiring_1, |
|
335 |
semiring_1_cancel_comm_semiring_1_cancel : 'a semiring_1_cancel}; |
|
336 |
val comm_semiring_0_cancel_comm_semiring_1_cancel = |
|
337 |
#comm_semiring_0_cancel_comm_semiring_1_cancel : |
|
338 |
'a comm_semiring_1_cancel -> 'a comm_semiring_0_cancel; |
|
339 |
val comm_semiring_1_comm_semiring_1_cancel = |
|
340 |
#comm_semiring_1_comm_semiring_1_cancel : |
|
341 |
'a comm_semiring_1_cancel -> 'a comm_semiring_1; |
|
342 |
val semiring_1_cancel_comm_semiring_1_cancel = |
|
343 |
#semiring_1_cancel_comm_semiring_1_cancel : |
|
344 |
'a comm_semiring_1_cancel -> 'a semiring_1_cancel; |
|
345 |
||
61128 | 346 |
type 'a semidom = |
347 |
{semiring_1_no_zero_divisors_semidom : 'a semiring_1_no_zero_divisors, |
|
348 |
comm_semiring_1_cancel_semidom : 'a comm_semiring_1_cancel}; |
|
349 |
val semiring_1_no_zero_divisors_semidom = #semiring_1_no_zero_divisors_semidom : |
|
350 |
'a semidom -> 'a semiring_1_no_zero_divisors; |
|
351 |
val comm_semiring_1_cancel_semidom = #comm_semiring_1_cancel_semidom : |
|
352 |
'a semidom -> 'a comm_semiring_1_cancel; |
|
353 |
||
354 |
val ab_semigroup_add_int = {semigroup_add_ab_semigroup_add = semigroup_add_int} |
|
355 |
: inta ab_semigroup_add; |
|
356 |
||
357 |
val monoid_add_int = |
|
358 |
{semigroup_add_monoid_add = semigroup_add_int, zero_monoid_add = zero_int} : |
|
359 |
inta monoid_add; |
|
360 |
||
361 |
val comm_monoid_add_int = |
|
362 |
{ab_semigroup_add_comm_monoid_add = ab_semigroup_add_int, |
|
363 |
monoid_add_comm_monoid_add = monoid_add_int} |
|
364 |
: inta comm_monoid_add; |
|
365 |
||
366 |
val mult_zero_int = {times_mult_zero = times_int, zero_mult_zero = zero_int} : |
|
367 |
inta mult_zero; |
|
368 |
||
369 |
val semigroup_mult_int = {times_semigroup_mult = times_int} : |
|
370 |
inta semigroup_mult; |
|
371 |
||
372 |
val semiring_int = |
|
373 |
{ab_semigroup_add_semiring = ab_semigroup_add_int, |
|
374 |
semigroup_mult_semiring = semigroup_mult_int} |
|
375 |
: inta semiring; |
|
55685 | 376 |
|
61128 | 377 |
val semiring_0_int = |
378 |
{comm_monoid_add_semiring_0 = comm_monoid_add_int, |
|
379 |
mult_zero_semiring_0 = mult_zero_int, semiring_semiring_0 = semiring_int} |
|
380 |
: inta semiring_0; |
|
381 |
||
382 |
val semiring_no_zero_divisors_int = |
|
383 |
{semiring_0_semiring_no_zero_divisors = semiring_0_int} : |
|
384 |
inta semiring_no_zero_divisors; |
|
385 |
||
386 |
val monoid_mult_int = |
|
387 |
{semigroup_mult_monoid_mult = semigroup_mult_int, |
|
388 |
power_monoid_mult = power_int} |
|
389 |
: inta monoid_mult; |
|
390 |
||
391 |
val semiring_numeral_int = |
|
392 |
{monoid_mult_semiring_numeral = monoid_mult_int, |
|
393 |
numeral_semiring_numeral = numeral_int, |
|
394 |
semiring_semiring_numeral = semiring_int} |
|
395 |
: inta semiring_numeral; |
|
396 |
||
397 |
val zero_neq_one_int = |
|
398 |
{one_zero_neq_one = one_int, zero_zero_neq_one = zero_int} : |
|
399 |
inta zero_neq_one; |
|
400 |
||
401 |
val semiring_1_int = |
|
402 |
{semiring_numeral_semiring_1 = semiring_numeral_int, |
|
403 |
semiring_0_semiring_1 = semiring_0_int, |
|
404 |
zero_neq_one_semiring_1 = zero_neq_one_int} |
|
405 |
: inta semiring_1; |
|
406 |
||
407 |
val semiring_1_no_zero_divisors_int = |
|
408 |
{semiring_1_semiring_1_no_zero_divisors = semiring_1_int, |
|
409 |
semiring_no_zero_divisors_semiring_1_no_zero_divisors = |
|
410 |
semiring_no_zero_divisors_int} |
|
411 |
: inta semiring_1_no_zero_divisors; |
|
55685 | 412 |
|
413 |
val cancel_semigroup_add_int = |
|
414 |
{semigroup_add_cancel_semigroup_add = semigroup_add_int} : |
|
415 |
inta cancel_semigroup_add; |
|
416 |
||
417 |
val cancel_ab_semigroup_add_int = |
|
418 |
{ab_semigroup_add_cancel_ab_semigroup_add = ab_semigroup_add_int, |
|
61128 | 419 |
cancel_semigroup_add_cancel_ab_semigroup_add = cancel_semigroup_add_int, |
420 |
minus_cancel_ab_semigroup_add = minus_int} |
|
55685 | 421 |
: inta cancel_ab_semigroup_add; |
422 |
||
423 |
val cancel_comm_monoid_add_int = |
|
424 |
{cancel_ab_semigroup_add_cancel_comm_monoid_add = cancel_ab_semigroup_add_int, |
|
425 |
comm_monoid_add_cancel_comm_monoid_add = comm_monoid_add_int} |
|
426 |
: inta cancel_comm_monoid_add; |
|
427 |
||
428 |
val semiring_0_cancel_int = |
|
429 |
{cancel_comm_monoid_add_semiring_0_cancel = cancel_comm_monoid_add_int, |
|
430 |
semiring_0_semiring_0_cancel = semiring_0_int} |
|
431 |
: inta semiring_0_cancel; |
|
432 |
||
61128 | 433 |
val ab_semigroup_mult_int = |
434 |
{semigroup_mult_ab_semigroup_mult = semigroup_mult_int} : |
|
435 |
inta ab_semigroup_mult; |
|
436 |
||
437 |
val comm_semiring_int = |
|
438 |
{ab_semigroup_mult_comm_semiring = ab_semigroup_mult_int, |
|
439 |
semiring_comm_semiring = semiring_int} |
|
440 |
: inta comm_semiring; |
|
441 |
||
55685 | 442 |
val comm_semiring_0_int = |
443 |
{comm_semiring_comm_semiring_0 = comm_semiring_int, |
|
444 |
semiring_0_comm_semiring_0 = semiring_0_int} |
|
445 |
: inta comm_semiring_0; |
|
446 |
||
447 |
val comm_semiring_0_cancel_int = |
|
448 |
{comm_semiring_0_comm_semiring_0_cancel = comm_semiring_0_int, |
|
449 |
semiring_0_cancel_comm_semiring_0_cancel = semiring_0_cancel_int} |
|
450 |
: inta comm_semiring_0_cancel; |
|
451 |
||
452 |
val semiring_1_cancel_int = |
|
453 |
{semiring_0_cancel_semiring_1_cancel = semiring_0_cancel_int, |
|
454 |
semiring_1_semiring_1_cancel = semiring_1_int} |
|
455 |
: inta semiring_1_cancel; |
|
456 |
||
457 |
val comm_monoid_mult_int = |
|
458 |
{ab_semigroup_mult_comm_monoid_mult = ab_semigroup_mult_int, |
|
61128 | 459 |
monoid_mult_comm_monoid_mult = monoid_mult_int, |
460 |
dvd_comm_monoid_mult = dvd_int} |
|
55685 | 461 |
: inta comm_monoid_mult; |
462 |
||
463 |
val comm_semiring_1_int = |
|
464 |
{comm_monoid_mult_comm_semiring_1 = comm_monoid_mult_int, |
|
465 |
comm_semiring_0_comm_semiring_1 = comm_semiring_0_int, |
|
61128 | 466 |
semiring_1_comm_semiring_1 = semiring_1_int} |
55685 | 467 |
: inta comm_semiring_1; |
468 |
||
469 |
val comm_semiring_1_cancel_int = |
|
470 |
{comm_semiring_0_cancel_comm_semiring_1_cancel = comm_semiring_0_cancel_int, |
|
471 |
comm_semiring_1_comm_semiring_1_cancel = comm_semiring_1_int, |
|
472 |
semiring_1_cancel_comm_semiring_1_cancel = semiring_1_cancel_int} |
|
473 |
: inta comm_semiring_1_cancel; |
|
474 |
||
61128 | 475 |
val semidom_int = |
476 |
{semiring_1_no_zero_divisors_semidom = semiring_1_no_zero_divisors_int, |
|
477 |
comm_semiring_1_cancel_semidom = comm_semiring_1_cancel_int} |
|
478 |
: inta semidom; |
|
479 |
||
480 |
type 'a semiring_no_zero_divisors_cancel = |
|
481 |
{semiring_no_zero_divisors_semiring_no_zero_divisors_cancel : |
|
482 |
'a semiring_no_zero_divisors}; |
|
483 |
val semiring_no_zero_divisors_semiring_no_zero_divisors_cancel = |
|
484 |
#semiring_no_zero_divisors_semiring_no_zero_divisors_cancel : |
|
485 |
'a semiring_no_zero_divisors_cancel -> 'a semiring_no_zero_divisors; |
|
486 |
||
487 |
type 'a semidom_divide = |
|
488 |
{divide_semidom_divide : 'a divide, semidom_semidom_divide : 'a semidom, |
|
489 |
semiring_no_zero_divisors_cancel_semidom_divide : |
|
490 |
'a semiring_no_zero_divisors_cancel}; |
|
491 |
val divide_semidom_divide = #divide_semidom_divide : |
|
492 |
'a semidom_divide -> 'a divide; |
|
493 |
val semidom_semidom_divide = #semidom_semidom_divide : |
|
494 |
'a semidom_divide -> 'a semidom; |
|
495 |
val semiring_no_zero_divisors_cancel_semidom_divide = |
|
496 |
#semiring_no_zero_divisors_cancel_semidom_divide : |
|
497 |
'a semidom_divide -> 'a semiring_no_zero_divisors_cancel; |
|
498 |
||
499 |
type 'a algebraic_semidom = |
|
500 |
{semidom_divide_algebraic_semidom : 'a semidom_divide}; |
|
501 |
val semidom_divide_algebraic_semidom = #semidom_divide_algebraic_semidom : |
|
502 |
'a algebraic_semidom -> 'a semidom_divide; |
|
503 |
||
504 |
type 'a semiring_div = |
|
505 |
{div_semiring_div : 'a diva, |
|
506 |
algebraic_semidom_semiring_div : 'a algebraic_semidom}; |
|
507 |
val div_semiring_div = #div_semiring_div : 'a semiring_div -> 'a diva; |
|
508 |
val algebraic_semidom_semiring_div = #algebraic_semidom_semiring_div : |
|
509 |
'a semiring_div -> 'a algebraic_semidom; |
|
510 |
||
511 |
val semiring_no_zero_divisors_cancel_int = |
|
512 |
{semiring_no_zero_divisors_semiring_no_zero_divisors_cancel = |
|
513 |
semiring_no_zero_divisors_int} |
|
514 |
: inta semiring_no_zero_divisors_cancel; |
|
515 |
||
516 |
val semidom_divide_int = |
|
517 |
{divide_semidom_divide = divide_int, semidom_semidom_divide = semidom_int, |
|
518 |
semiring_no_zero_divisors_cancel_semidom_divide = |
|
519 |
semiring_no_zero_divisors_cancel_int} |
|
520 |
: inta semidom_divide; |
|
521 |
||
522 |
val algebraic_semidom_int = |
|
523 |
{semidom_divide_algebraic_semidom = semidom_divide_int} : |
|
524 |
inta algebraic_semidom; |
|
55685 | 525 |
|
526 |
val semiring_div_int = |
|
527 |
{div_semiring_div = div_int, |
|
61128 | 528 |
algebraic_semidom_semiring_div = algebraic_semidom_int} |
55685 | 529 |
: inta semiring_div; |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
530 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
531 |
datatype nat = Nat of int; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
532 |
|
55685 | 533 |
fun integer_of_nat (Nat x) = x; |
534 |
||
535 |
fun equal_nat m n = integer_of_nat m = integer_of_nat n; |
|
536 |
||
61128 | 537 |
datatype numa = C of inta | Bound of nat | CN of nat * inta * numa | Neg of numa |
55685 | 538 |
| Add of numa * numa | Sub of numa * numa | Mul of inta * numa; |
539 |
||
61128 | 540 |
fun equal_numa (Sub (x61, x62)) (Mul (x71, x72)) = false |
541 |
| equal_numa (Mul (x71, x72)) (Sub (x61, x62)) = false |
|
542 |
| equal_numa (Add (x51, x52)) (Mul (x71, x72)) = false |
|
543 |
| equal_numa (Mul (x71, x72)) (Add (x51, x52)) = false |
|
544 |
| equal_numa (Add (x51, x52)) (Sub (x61, x62)) = false |
|
545 |
| equal_numa (Sub (x61, x62)) (Add (x51, x52)) = false |
|
546 |
| equal_numa (Neg x4) (Mul (x71, x72)) = false |
|
547 |
| equal_numa (Mul (x71, x72)) (Neg x4) = false |
|
548 |
| equal_numa (Neg x4) (Sub (x61, x62)) = false |
|
549 |
| equal_numa (Sub (x61, x62)) (Neg x4) = false |
|
550 |
| equal_numa (Neg x4) (Add (x51, x52)) = false |
|
551 |
| equal_numa (Add (x51, x52)) (Neg x4) = false |
|
552 |
| equal_numa (CN (x31, x32, x33)) (Mul (x71, x72)) = false |
|
553 |
| equal_numa (Mul (x71, x72)) (CN (x31, x32, x33)) = false |
|
554 |
| equal_numa (CN (x31, x32, x33)) (Sub (x61, x62)) = false |
|
555 |
| equal_numa (Sub (x61, x62)) (CN (x31, x32, x33)) = false |
|
556 |
| equal_numa (CN (x31, x32, x33)) (Add (x51, x52)) = false |
|
557 |
| equal_numa (Add (x51, x52)) (CN (x31, x32, x33)) = false |
|
558 |
| equal_numa (CN (x31, x32, x33)) (Neg x4) = false |
|
559 |
| equal_numa (Neg x4) (CN (x31, x32, x33)) = false |
|
560 |
| equal_numa (Bound x2) (Mul (x71, x72)) = false |
|
561 |
| equal_numa (Mul (x71, x72)) (Bound x2) = false |
|
562 |
| equal_numa (Bound x2) (Sub (x61, x62)) = false |
|
563 |
| equal_numa (Sub (x61, x62)) (Bound x2) = false |
|
564 |
| equal_numa (Bound x2) (Add (x51, x52)) = false |
|
565 |
| equal_numa (Add (x51, x52)) (Bound x2) = false |
|
566 |
| equal_numa (Bound x2) (Neg x4) = false |
|
567 |
| equal_numa (Neg x4) (Bound x2) = false |
|
568 |
| equal_numa (Bound x2) (CN (x31, x32, x33)) = false |
|
569 |
| equal_numa (CN (x31, x32, x33)) (Bound x2) = false |
|
570 |
| equal_numa (C x1) (Mul (x71, x72)) = false |
|
571 |
| equal_numa (Mul (x71, x72)) (C x1) = false |
|
572 |
| equal_numa (C x1) (Sub (x61, x62)) = false |
|
573 |
| equal_numa (Sub (x61, x62)) (C x1) = false |
|
574 |
| equal_numa (C x1) (Add (x51, x52)) = false |
|
575 |
| equal_numa (Add (x51, x52)) (C x1) = false |
|
576 |
| equal_numa (C x1) (Neg x4) = false |
|
577 |
| equal_numa (Neg x4) (C x1) = false |
|
578 |
| equal_numa (C x1) (CN (x31, x32, x33)) = false |
|
579 |
| equal_numa (CN (x31, x32, x33)) (C x1) = false |
|
580 |
| equal_numa (C x1) (Bound x2) = false |
|
581 |
| equal_numa (Bound x2) (C x1) = false |
|
582 |
| equal_numa (Mul (x71, x72)) (Mul (y71, y72)) = |
|
583 |
equal_inta x71 y71 andalso equal_numa x72 y72 |
|
584 |
| equal_numa (Sub (x61, x62)) (Sub (y61, y62)) = |
|
585 |
equal_numa x61 y61 andalso equal_numa x62 y62 |
|
586 |
| equal_numa (Add (x51, x52)) (Add (y51, y52)) = |
|
587 |
equal_numa x51 y51 andalso equal_numa x52 y52 |
|
588 |
| equal_numa (Neg x4) (Neg y4) = equal_numa x4 y4 |
|
589 |
| equal_numa (CN (x31, x32, x33)) (CN (y31, y32, y33)) = |
|
590 |
equal_nat x31 y31 andalso (equal_inta x32 y32 andalso equal_numa x33 y33) |
|
591 |
| equal_numa (Bound x2) (Bound y2) = equal_nat x2 y2 |
|
592 |
| equal_numa (C x1) (C y1) = equal_inta x1 y1; |
|
55685 | 593 |
|
594 |
val equal_num = {equal = equal_numa} : numa equal; |
|
29787 | 595 |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
596 |
type 'a ord = {less_eq : 'a -> 'a -> bool, less : 'a -> 'a -> bool}; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
597 |
val less_eq = #less_eq : 'a ord -> 'a -> 'a -> bool; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
598 |
val less = #less : 'a ord -> 'a -> 'a -> bool; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
599 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
600 |
val ord_integer = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
601 |
{less_eq = (fn a => fn b => a <= b), less = (fn a => fn b => a < b)} : |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
602 |
int ord; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
603 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
604 |
datatype fm = T | F | Lt of numa | Le of numa | Gt of numa | Ge of numa | |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
605 |
Eq of numa | NEq of numa | Dvd of inta * numa | NDvd of inta * numa | |
61128 | 606 |
NOT of fm | And of fm * fm | Or of fm * fm | Imp of fm * fm | Iff of fm * fm | |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
607 |
E of fm | A of fm | Closed of nat | NClosed of nat; |
29787 | 608 |
|
55685 | 609 |
fun id x = (fn xa => xa) x; |
610 |
||
611 |
fun eq A_ a b = equal A_ a b; |
|
612 |
||
613 |
fun plus_nat m n = Nat (integer_of_nat m + integer_of_nat n); |
|
614 |
||
615 |
val one_nat : nat = Nat (1 : IntInf.int); |
|
616 |
||
617 |
fun suc n = plus_nat n one_nat; |
|
29787 | 618 |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
619 |
fun disjuncts (Or (p, q)) = disjuncts p @ disjuncts q |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
620 |
| disjuncts F = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
621 |
| disjuncts T = [T] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
622 |
| disjuncts (Lt v) = [Lt v] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
623 |
| disjuncts (Le v) = [Le v] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
624 |
| disjuncts (Gt v) = [Gt v] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
625 |
| disjuncts (Ge v) = [Ge v] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
626 |
| disjuncts (Eq v) = [Eq v] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
627 |
| disjuncts (NEq v) = [NEq v] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
628 |
| disjuncts (Dvd (v, va)) = [Dvd (v, va)] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
629 |
| disjuncts (NDvd (v, va)) = [NDvd (v, va)] |
61128 | 630 |
| disjuncts (NOT v) = [NOT v] |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
631 |
| disjuncts (And (v, va)) = [And (v, va)] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
632 |
| disjuncts (Imp (v, va)) = [Imp (v, va)] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
633 |
| disjuncts (Iff (v, va)) = [Iff (v, va)] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
634 |
| disjuncts (E v) = [E v] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
635 |
| disjuncts (A v) = [A v] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
636 |
| disjuncts (Closed v) = [Closed v] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
637 |
| disjuncts (NClosed v) = [NClosed v]; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
638 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
639 |
fun foldr f [] = id |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
640 |
| foldr f (x :: xs) = f x o foldr f xs; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
641 |
|
61128 | 642 |
fun equal_fm (Closed x18) (NClosed x19) = false |
643 |
| equal_fm (NClosed x19) (Closed x18) = false |
|
644 |
| equal_fm (A x17) (NClosed x19) = false |
|
645 |
| equal_fm (NClosed x19) (A x17) = false |
|
646 |
| equal_fm (A x17) (Closed x18) = false |
|
647 |
| equal_fm (Closed x18) (A x17) = false |
|
648 |
| equal_fm (E x16) (NClosed x19) = false |
|
649 |
| equal_fm (NClosed x19) (E x16) = false |
|
650 |
| equal_fm (E x16) (Closed x18) = false |
|
651 |
| equal_fm (Closed x18) (E x16) = false |
|
652 |
| equal_fm (E x16) (A x17) = false |
|
653 |
| equal_fm (A x17) (E x16) = false |
|
654 |
| equal_fm (Iff (x151, x152)) (NClosed x19) = false |
|
655 |
| equal_fm (NClosed x19) (Iff (x151, x152)) = false |
|
656 |
| equal_fm (Iff (x151, x152)) (Closed x18) = false |
|
657 |
| equal_fm (Closed x18) (Iff (x151, x152)) = false |
|
658 |
| equal_fm (Iff (x151, x152)) (A x17) = false |
|
659 |
| equal_fm (A x17) (Iff (x151, x152)) = false |
|
660 |
| equal_fm (Iff (x151, x152)) (E x16) = false |
|
661 |
| equal_fm (E x16) (Iff (x151, x152)) = false |
|
662 |
| equal_fm (Imp (x141, x142)) (NClosed x19) = false |
|
663 |
| equal_fm (NClosed x19) (Imp (x141, x142)) = false |
|
664 |
| equal_fm (Imp (x141, x142)) (Closed x18) = false |
|
665 |
| equal_fm (Closed x18) (Imp (x141, x142)) = false |
|
666 |
| equal_fm (Imp (x141, x142)) (A x17) = false |
|
667 |
| equal_fm (A x17) (Imp (x141, x142)) = false |
|
668 |
| equal_fm (Imp (x141, x142)) (E x16) = false |
|
669 |
| equal_fm (E x16) (Imp (x141, x142)) = false |
|
670 |
| equal_fm (Imp (x141, x142)) (Iff (x151, x152)) = false |
|
671 |
| equal_fm (Iff (x151, x152)) (Imp (x141, x142)) = false |
|
672 |
| equal_fm (Or (x131, x132)) (NClosed x19) = false |
|
673 |
| equal_fm (NClosed x19) (Or (x131, x132)) = false |
|
674 |
| equal_fm (Or (x131, x132)) (Closed x18) = false |
|
675 |
| equal_fm (Closed x18) (Or (x131, x132)) = false |
|
676 |
| equal_fm (Or (x131, x132)) (A x17) = false |
|
677 |
| equal_fm (A x17) (Or (x131, x132)) = false |
|
678 |
| equal_fm (Or (x131, x132)) (E x16) = false |
|
679 |
| equal_fm (E x16) (Or (x131, x132)) = false |
|
680 |
| equal_fm (Or (x131, x132)) (Iff (x151, x152)) = false |
|
681 |
| equal_fm (Iff (x151, x152)) (Or (x131, x132)) = false |
|
682 |
| equal_fm (Or (x131, x132)) (Imp (x141, x142)) = false |
|
683 |
| equal_fm (Imp (x141, x142)) (Or (x131, x132)) = false |
|
684 |
| equal_fm (And (x121, x122)) (NClosed x19) = false |
|
685 |
| equal_fm (NClosed x19) (And (x121, x122)) = false |
|
686 |
| equal_fm (And (x121, x122)) (Closed x18) = false |
|
687 |
| equal_fm (Closed x18) (And (x121, x122)) = false |
|
688 |
| equal_fm (And (x121, x122)) (A x17) = false |
|
689 |
| equal_fm (A x17) (And (x121, x122)) = false |
|
690 |
| equal_fm (And (x121, x122)) (E x16) = false |
|
691 |
| equal_fm (E x16) (And (x121, x122)) = false |
|
692 |
| equal_fm (And (x121, x122)) (Iff (x151, x152)) = false |
|
693 |
| equal_fm (Iff (x151, x152)) (And (x121, x122)) = false |
|
694 |
| equal_fm (And (x121, x122)) (Imp (x141, x142)) = false |
|
695 |
| equal_fm (Imp (x141, x142)) (And (x121, x122)) = false |
|
696 |
| equal_fm (And (x121, x122)) (Or (x131, x132)) = false |
|
697 |
| equal_fm (Or (x131, x132)) (And (x121, x122)) = false |
|
698 |
| equal_fm (NOT x11) (NClosed x19) = false |
|
699 |
| equal_fm (NClosed x19) (NOT x11) = false |
|
700 |
| equal_fm (NOT x11) (Closed x18) = false |
|
701 |
| equal_fm (Closed x18) (NOT x11) = false |
|
702 |
| equal_fm (NOT x11) (A x17) = false |
|
703 |
| equal_fm (A x17) (NOT x11) = false |
|
704 |
| equal_fm (NOT x11) (E x16) = false |
|
705 |
| equal_fm (E x16) (NOT x11) = false |
|
706 |
| equal_fm (NOT x11) (Iff (x151, x152)) = false |
|
707 |
| equal_fm (Iff (x151, x152)) (NOT x11) = false |
|
708 |
| equal_fm (NOT x11) (Imp (x141, x142)) = false |
|
709 |
| equal_fm (Imp (x141, x142)) (NOT x11) = false |
|
710 |
| equal_fm (NOT x11) (Or (x131, x132)) = false |
|
711 |
| equal_fm (Or (x131, x132)) (NOT x11) = false |
|
712 |
| equal_fm (NOT x11) (And (x121, x122)) = false |
|
713 |
| equal_fm (And (x121, x122)) (NOT x11) = false |
|
714 |
| equal_fm (NDvd (x101, x102)) (NClosed x19) = false |
|
715 |
| equal_fm (NClosed x19) (NDvd (x101, x102)) = false |
|
716 |
| equal_fm (NDvd (x101, x102)) (Closed x18) = false |
|
717 |
| equal_fm (Closed x18) (NDvd (x101, x102)) = false |
|
718 |
| equal_fm (NDvd (x101, x102)) (A x17) = false |
|
719 |
| equal_fm (A x17) (NDvd (x101, x102)) = false |
|
720 |
| equal_fm (NDvd (x101, x102)) (E x16) = false |
|
721 |
| equal_fm (E x16) (NDvd (x101, x102)) = false |
|
722 |
| equal_fm (NDvd (x101, x102)) (Iff (x151, x152)) = false |
|
723 |
| equal_fm (Iff (x151, x152)) (NDvd (x101, x102)) = false |
|
724 |
| equal_fm (NDvd (x101, x102)) (Imp (x141, x142)) = false |
|
725 |
| equal_fm (Imp (x141, x142)) (NDvd (x101, x102)) = false |
|
726 |
| equal_fm (NDvd (x101, x102)) (Or (x131, x132)) = false |
|
727 |
| equal_fm (Or (x131, x132)) (NDvd (x101, x102)) = false |
|
728 |
| equal_fm (NDvd (x101, x102)) (And (x121, x122)) = false |
|
729 |
| equal_fm (And (x121, x122)) (NDvd (x101, x102)) = false |
|
730 |
| equal_fm (NDvd (x101, x102)) (NOT x11) = false |
|
731 |
| equal_fm (NOT x11) (NDvd (x101, x102)) = false |
|
732 |
| equal_fm (Dvd (x91, x92)) (NClosed x19) = false |
|
733 |
| equal_fm (NClosed x19) (Dvd (x91, x92)) = false |
|
734 |
| equal_fm (Dvd (x91, x92)) (Closed x18) = false |
|
735 |
| equal_fm (Closed x18) (Dvd (x91, x92)) = false |
|
736 |
| equal_fm (Dvd (x91, x92)) (A x17) = false |
|
737 |
| equal_fm (A x17) (Dvd (x91, x92)) = false |
|
738 |
| equal_fm (Dvd (x91, x92)) (E x16) = false |
|
739 |
| equal_fm (E x16) (Dvd (x91, x92)) = false |
|
740 |
| equal_fm (Dvd (x91, x92)) (Iff (x151, x152)) = false |
|
741 |
| equal_fm (Iff (x151, x152)) (Dvd (x91, x92)) = false |
|
742 |
| equal_fm (Dvd (x91, x92)) (Imp (x141, x142)) = false |
|
743 |
| equal_fm (Imp (x141, x142)) (Dvd (x91, x92)) = false |
|
744 |
| equal_fm (Dvd (x91, x92)) (Or (x131, x132)) = false |
|
745 |
| equal_fm (Or (x131, x132)) (Dvd (x91, x92)) = false |
|
746 |
| equal_fm (Dvd (x91, x92)) (And (x121, x122)) = false |
|
747 |
| equal_fm (And (x121, x122)) (Dvd (x91, x92)) = false |
|
748 |
| equal_fm (Dvd (x91, x92)) (NOT x11) = false |
|
749 |
| equal_fm (NOT x11) (Dvd (x91, x92)) = false |
|
750 |
| equal_fm (Dvd (x91, x92)) (NDvd (x101, x102)) = false |
|
751 |
| equal_fm (NDvd (x101, x102)) (Dvd (x91, x92)) = false |
|
752 |
| equal_fm (NEq x8) (NClosed x19) = false |
|
753 |
| equal_fm (NClosed x19) (NEq x8) = false |
|
754 |
| equal_fm (NEq x8) (Closed x18) = false |
|
755 |
| equal_fm (Closed x18) (NEq x8) = false |
|
756 |
| equal_fm (NEq x8) (A x17) = false |
|
757 |
| equal_fm (A x17) (NEq x8) = false |
|
758 |
| equal_fm (NEq x8) (E x16) = false |
|
759 |
| equal_fm (E x16) (NEq x8) = false |
|
760 |
| equal_fm (NEq x8) (Iff (x151, x152)) = false |
|
761 |
| equal_fm (Iff (x151, x152)) (NEq x8) = false |
|
762 |
| equal_fm (NEq x8) (Imp (x141, x142)) = false |
|
763 |
| equal_fm (Imp (x141, x142)) (NEq x8) = false |
|
764 |
| equal_fm (NEq x8) (Or (x131, x132)) = false |
|
765 |
| equal_fm (Or (x131, x132)) (NEq x8) = false |
|
766 |
| equal_fm (NEq x8) (And (x121, x122)) = false |
|
767 |
| equal_fm (And (x121, x122)) (NEq x8) = false |
|
768 |
| equal_fm (NEq x8) (NOT x11) = false |
|
769 |
| equal_fm (NOT x11) (NEq x8) = false |
|
770 |
| equal_fm (NEq x8) (NDvd (x101, x102)) = false |
|
771 |
| equal_fm (NDvd (x101, x102)) (NEq x8) = false |
|
772 |
| equal_fm (NEq x8) (Dvd (x91, x92)) = false |
|
773 |
| equal_fm (Dvd (x91, x92)) (NEq x8) = false |
|
774 |
| equal_fm (Eq x7) (NClosed x19) = false |
|
775 |
| equal_fm (NClosed x19) (Eq x7) = false |
|
776 |
| equal_fm (Eq x7) (Closed x18) = false |
|
777 |
| equal_fm (Closed x18) (Eq x7) = false |
|
778 |
| equal_fm (Eq x7) (A x17) = false |
|
779 |
| equal_fm (A x17) (Eq x7) = false |
|
780 |
| equal_fm (Eq x7) (E x16) = false |
|
781 |
| equal_fm (E x16) (Eq x7) = false |
|
782 |
| equal_fm (Eq x7) (Iff (x151, x152)) = false |
|
783 |
| equal_fm (Iff (x151, x152)) (Eq x7) = false |
|
784 |
| equal_fm (Eq x7) (Imp (x141, x142)) = false |
|
785 |
| equal_fm (Imp (x141, x142)) (Eq x7) = false |
|
786 |
| equal_fm (Eq x7) (Or (x131, x132)) = false |
|
787 |
| equal_fm (Or (x131, x132)) (Eq x7) = false |
|
788 |
| equal_fm (Eq x7) (And (x121, x122)) = false |
|
789 |
| equal_fm (And (x121, x122)) (Eq x7) = false |
|
790 |
| equal_fm (Eq x7) (NOT x11) = false |
|
791 |
| equal_fm (NOT x11) (Eq x7) = false |
|
792 |
| equal_fm (Eq x7) (NDvd (x101, x102)) = false |
|
793 |
| equal_fm (NDvd (x101, x102)) (Eq x7) = false |
|
794 |
| equal_fm (Eq x7) (Dvd (x91, x92)) = false |
|
795 |
| equal_fm (Dvd (x91, x92)) (Eq x7) = false |
|
796 |
| equal_fm (Eq x7) (NEq x8) = false |
|
797 |
| equal_fm (NEq x8) (Eq x7) = false |
|
798 |
| equal_fm (Ge x6) (NClosed x19) = false |
|
799 |
| equal_fm (NClosed x19) (Ge x6) = false |
|
800 |
| equal_fm (Ge x6) (Closed x18) = false |
|
801 |
| equal_fm (Closed x18) (Ge x6) = false |
|
802 |
| equal_fm (Ge x6) (A x17) = false |
|
803 |
| equal_fm (A x17) (Ge x6) = false |
|
804 |
| equal_fm (Ge x6) (E x16) = false |
|
805 |
| equal_fm (E x16) (Ge x6) = false |
|
806 |
| equal_fm (Ge x6) (Iff (x151, x152)) = false |
|
807 |
| equal_fm (Iff (x151, x152)) (Ge x6) = false |
|
808 |
| equal_fm (Ge x6) (Imp (x141, x142)) = false |
|
809 |
| equal_fm (Imp (x141, x142)) (Ge x6) = false |
|
810 |
| equal_fm (Ge x6) (Or (x131, x132)) = false |
|
811 |
| equal_fm (Or (x131, x132)) (Ge x6) = false |
|
812 |
| equal_fm (Ge x6) (And (x121, x122)) = false |
|
813 |
| equal_fm (And (x121, x122)) (Ge x6) = false |
|
814 |
| equal_fm (Ge x6) (NOT x11) = false |
|
815 |
| equal_fm (NOT x11) (Ge x6) = false |
|
816 |
| equal_fm (Ge x6) (NDvd (x101, x102)) = false |
|
817 |
| equal_fm (NDvd (x101, x102)) (Ge x6) = false |
|
818 |
| equal_fm (Ge x6) (Dvd (x91, x92)) = false |
|
819 |
| equal_fm (Dvd (x91, x92)) (Ge x6) = false |
|
820 |
| equal_fm (Ge x6) (NEq x8) = false |
|
821 |
| equal_fm (NEq x8) (Ge x6) = false |
|
822 |
| equal_fm (Ge x6) (Eq x7) = false |
|
823 |
| equal_fm (Eq x7) (Ge x6) = false |
|
824 |
| equal_fm (Gt x5) (NClosed x19) = false |
|
825 |
| equal_fm (NClosed x19) (Gt x5) = false |
|
826 |
| equal_fm (Gt x5) (Closed x18) = false |
|
827 |
| equal_fm (Closed x18) (Gt x5) = false |
|
828 |
| equal_fm (Gt x5) (A x17) = false |
|
829 |
| equal_fm (A x17) (Gt x5) = false |
|
830 |
| equal_fm (Gt x5) (E x16) = false |
|
831 |
| equal_fm (E x16) (Gt x5) = false |
|
832 |
| equal_fm (Gt x5) (Iff (x151, x152)) = false |
|
833 |
| equal_fm (Iff (x151, x152)) (Gt x5) = false |
|
834 |
| equal_fm (Gt x5) (Imp (x141, x142)) = false |
|
835 |
| equal_fm (Imp (x141, x142)) (Gt x5) = false |
|
836 |
| equal_fm (Gt x5) (Or (x131, x132)) = false |
|
837 |
| equal_fm (Or (x131, x132)) (Gt x5) = false |
|
838 |
| equal_fm (Gt x5) (And (x121, x122)) = false |
|
839 |
| equal_fm (And (x121, x122)) (Gt x5) = false |
|
840 |
| equal_fm (Gt x5) (NOT x11) = false |
|
841 |
| equal_fm (NOT x11) (Gt x5) = false |
|
842 |
| equal_fm (Gt x5) (NDvd (x101, x102)) = false |
|
843 |
| equal_fm (NDvd (x101, x102)) (Gt x5) = false |
|
844 |
| equal_fm (Gt x5) (Dvd (x91, x92)) = false |
|
845 |
| equal_fm (Dvd (x91, x92)) (Gt x5) = false |
|
846 |
| equal_fm (Gt x5) (NEq x8) = false |
|
847 |
| equal_fm (NEq x8) (Gt x5) = false |
|
848 |
| equal_fm (Gt x5) (Eq x7) = false |
|
849 |
| equal_fm (Eq x7) (Gt x5) = false |
|
850 |
| equal_fm (Gt x5) (Ge x6) = false |
|
851 |
| equal_fm (Ge x6) (Gt x5) = false |
|
852 |
| equal_fm (Le x4) (NClosed x19) = false |
|
853 |
| equal_fm (NClosed x19) (Le x4) = false |
|
854 |
| equal_fm (Le x4) (Closed x18) = false |
|
855 |
| equal_fm (Closed x18) (Le x4) = false |
|
856 |
| equal_fm (Le x4) (A x17) = false |
|
857 |
| equal_fm (A x17) (Le x4) = false |
|
858 |
| equal_fm (Le x4) (E x16) = false |
|
859 |
| equal_fm (E x16) (Le x4) = false |
|
860 |
| equal_fm (Le x4) (Iff (x151, x152)) = false |
|
861 |
| equal_fm (Iff (x151, x152)) (Le x4) = false |
|
862 |
| equal_fm (Le x4) (Imp (x141, x142)) = false |
|
863 |
| equal_fm (Imp (x141, x142)) (Le x4) = false |
|
864 |
| equal_fm (Le x4) (Or (x131, x132)) = false |
|
865 |
| equal_fm (Or (x131, x132)) (Le x4) = false |
|
866 |
| equal_fm (Le x4) (And (x121, x122)) = false |
|
867 |
| equal_fm (And (x121, x122)) (Le x4) = false |
|
868 |
| equal_fm (Le x4) (NOT x11) = false |
|
869 |
| equal_fm (NOT x11) (Le x4) = false |
|
870 |
| equal_fm (Le x4) (NDvd (x101, x102)) = false |
|
871 |
| equal_fm (NDvd (x101, x102)) (Le x4) = false |
|
872 |
| equal_fm (Le x4) (Dvd (x91, x92)) = false |
|
873 |
| equal_fm (Dvd (x91, x92)) (Le x4) = false |
|
874 |
| equal_fm (Le x4) (NEq x8) = false |
|
875 |
| equal_fm (NEq x8) (Le x4) = false |
|
876 |
| equal_fm (Le x4) (Eq x7) = false |
|
877 |
| equal_fm (Eq x7) (Le x4) = false |
|
878 |
| equal_fm (Le x4) (Ge x6) = false |
|
879 |
| equal_fm (Ge x6) (Le x4) = false |
|
880 |
| equal_fm (Le x4) (Gt x5) = false |
|
881 |
| equal_fm (Gt x5) (Le x4) = false |
|
882 |
| equal_fm (Lt x3) (NClosed x19) = false |
|
883 |
| equal_fm (NClosed x19) (Lt x3) = false |
|
884 |
| equal_fm (Lt x3) (Closed x18) = false |
|
885 |
| equal_fm (Closed x18) (Lt x3) = false |
|
886 |
| equal_fm (Lt x3) (A x17) = false |
|
887 |
| equal_fm (A x17) (Lt x3) = false |
|
888 |
| equal_fm (Lt x3) (E x16) = false |
|
889 |
| equal_fm (E x16) (Lt x3) = false |
|
890 |
| equal_fm (Lt x3) (Iff (x151, x152)) = false |
|
891 |
| equal_fm (Iff (x151, x152)) (Lt x3) = false |
|
892 |
| equal_fm (Lt x3) (Imp (x141, x142)) = false |
|
893 |
| equal_fm (Imp (x141, x142)) (Lt x3) = false |
|
894 |
| equal_fm (Lt x3) (Or (x131, x132)) = false |
|
895 |
| equal_fm (Or (x131, x132)) (Lt x3) = false |
|
896 |
| equal_fm (Lt x3) (And (x121, x122)) = false |
|
897 |
| equal_fm (And (x121, x122)) (Lt x3) = false |
|
898 |
| equal_fm (Lt x3) (NOT x11) = false |
|
899 |
| equal_fm (NOT x11) (Lt x3) = false |
|
900 |
| equal_fm (Lt x3) (NDvd (x101, x102)) = false |
|
901 |
| equal_fm (NDvd (x101, x102)) (Lt x3) = false |
|
902 |
| equal_fm (Lt x3) (Dvd (x91, x92)) = false |
|
903 |
| equal_fm (Dvd (x91, x92)) (Lt x3) = false |
|
904 |
| equal_fm (Lt x3) (NEq x8) = false |
|
905 |
| equal_fm (NEq x8) (Lt x3) = false |
|
906 |
| equal_fm (Lt x3) (Eq x7) = false |
|
907 |
| equal_fm (Eq x7) (Lt x3) = false |
|
908 |
| equal_fm (Lt x3) (Ge x6) = false |
|
909 |
| equal_fm (Ge x6) (Lt x3) = false |
|
910 |
| equal_fm (Lt x3) (Gt x5) = false |
|
911 |
| equal_fm (Gt x5) (Lt x3) = false |
|
912 |
| equal_fm (Lt x3) (Le x4) = false |
|
913 |
| equal_fm (Le x4) (Lt x3) = false |
|
914 |
| equal_fm F (NClosed x19) = false |
|
915 |
| equal_fm (NClosed x19) F = false |
|
916 |
| equal_fm F (Closed x18) = false |
|
917 |
| equal_fm (Closed x18) F = false |
|
918 |
| equal_fm F (A x17) = false |
|
919 |
| equal_fm (A x17) F = false |
|
920 |
| equal_fm F (E x16) = false |
|
921 |
| equal_fm (E x16) F = false |
|
922 |
| equal_fm F (Iff (x151, x152)) = false |
|
923 |
| equal_fm (Iff (x151, x152)) F = false |
|
924 |
| equal_fm F (Imp (x141, x142)) = false |
|
925 |
| equal_fm (Imp (x141, x142)) F = false |
|
926 |
| equal_fm F (Or (x131, x132)) = false |
|
927 |
| equal_fm (Or (x131, x132)) F = false |
|
928 |
| equal_fm F (And (x121, x122)) = false |
|
929 |
| equal_fm (And (x121, x122)) F = false |
|
930 |
| equal_fm F (NOT x11) = false |
|
931 |
| equal_fm (NOT x11) F = false |
|
932 |
| equal_fm F (NDvd (x101, x102)) = false |
|
933 |
| equal_fm (NDvd (x101, x102)) F = false |
|
934 |
| equal_fm F (Dvd (x91, x92)) = false |
|
935 |
| equal_fm (Dvd (x91, x92)) F = false |
|
936 |
| equal_fm F (NEq x8) = false |
|
937 |
| equal_fm (NEq x8) F = false |
|
938 |
| equal_fm F (Eq x7) = false |
|
939 |
| equal_fm (Eq x7) F = false |
|
940 |
| equal_fm F (Ge x6) = false |
|
941 |
| equal_fm (Ge x6) F = false |
|
942 |
| equal_fm F (Gt x5) = false |
|
943 |
| equal_fm (Gt x5) F = false |
|
944 |
| equal_fm F (Le x4) = false |
|
945 |
| equal_fm (Le x4) F = false |
|
946 |
| equal_fm F (Lt x3) = false |
|
947 |
| equal_fm (Lt x3) F = false |
|
948 |
| equal_fm T (NClosed x19) = false |
|
949 |
| equal_fm (NClosed x19) T = false |
|
950 |
| equal_fm T (Closed x18) = false |
|
951 |
| equal_fm (Closed x18) T = false |
|
952 |
| equal_fm T (A x17) = false |
|
953 |
| equal_fm (A x17) T = false |
|
954 |
| equal_fm T (E x16) = false |
|
955 |
| equal_fm (E x16) T = false |
|
956 |
| equal_fm T (Iff (x151, x152)) = false |
|
957 |
| equal_fm (Iff (x151, x152)) T = false |
|
958 |
| equal_fm T (Imp (x141, x142)) = false |
|
959 |
| equal_fm (Imp (x141, x142)) T = false |
|
960 |
| equal_fm T (Or (x131, x132)) = false |
|
961 |
| equal_fm (Or (x131, x132)) T = false |
|
962 |
| equal_fm T (And (x121, x122)) = false |
|
963 |
| equal_fm (And (x121, x122)) T = false |
|
964 |
| equal_fm T (NOT x11) = false |
|
965 |
| equal_fm (NOT x11) T = false |
|
966 |
| equal_fm T (NDvd (x101, x102)) = false |
|
967 |
| equal_fm (NDvd (x101, x102)) T = false |
|
968 |
| equal_fm T (Dvd (x91, x92)) = false |
|
969 |
| equal_fm (Dvd (x91, x92)) T = false |
|
970 |
| equal_fm T (NEq x8) = false |
|
971 |
| equal_fm (NEq x8) T = false |
|
972 |
| equal_fm T (Eq x7) = false |
|
973 |
| equal_fm (Eq x7) T = false |
|
974 |
| equal_fm T (Ge x6) = false |
|
975 |
| equal_fm (Ge x6) T = false |
|
976 |
| equal_fm T (Gt x5) = false |
|
977 |
| equal_fm (Gt x5) T = false |
|
978 |
| equal_fm T (Le x4) = false |
|
979 |
| equal_fm (Le x4) T = false |
|
980 |
| equal_fm T (Lt x3) = false |
|
981 |
| equal_fm (Lt x3) T = false |
|
55685 | 982 |
| equal_fm T F = false |
44930 | 983 |
| equal_fm F T = false |
61128 | 984 |
| equal_fm (NClosed x19) (NClosed y19) = equal_nat x19 y19 |
985 |
| equal_fm (Closed x18) (Closed y18) = equal_nat x18 y18 |
|
986 |
| equal_fm (A x17) (A y17) = equal_fm x17 y17 |
|
987 |
| equal_fm (E x16) (E y16) = equal_fm x16 y16 |
|
988 |
| equal_fm (Iff (x151, x152)) (Iff (y151, y152)) = |
|
989 |
equal_fm x151 y151 andalso equal_fm x152 y152 |
|
990 |
| equal_fm (Imp (x141, x142)) (Imp (y141, y142)) = |
|
991 |
equal_fm x141 y141 andalso equal_fm x142 y142 |
|
992 |
| equal_fm (Or (x131, x132)) (Or (y131, y132)) = |
|
993 |
equal_fm x131 y131 andalso equal_fm x132 y132 |
|
994 |
| equal_fm (And (x121, x122)) (And (y121, y122)) = |
|
995 |
equal_fm x121 y121 andalso equal_fm x122 y122 |
|
996 |
| equal_fm (NOT x11) (NOT y11) = equal_fm x11 y11 |
|
997 |
| equal_fm (NDvd (x101, x102)) (NDvd (y101, y102)) = |
|
998 |
equal_inta x101 y101 andalso equal_numa x102 y102 |
|
999 |
| equal_fm (Dvd (x91, x92)) (Dvd (y91, y92)) = |
|
1000 |
equal_inta x91 y91 andalso equal_numa x92 y92 |
|
1001 |
| equal_fm (NEq x8) (NEq y8) = equal_numa x8 y8 |
|
1002 |
| equal_fm (Eq x7) (Eq y7) = equal_numa x7 y7 |
|
1003 |
| equal_fm (Ge x6) (Ge y6) = equal_numa x6 y6 |
|
1004 |
| equal_fm (Gt x5) (Gt y5) = equal_numa x5 y5 |
|
1005 |
| equal_fm (Le x4) (Le y4) = equal_numa x4 y4 |
|
1006 |
| equal_fm (Lt x3) (Lt y3) = equal_numa x3 y3 |
|
44930 | 1007 |
| equal_fm F F = true |
1008 |
| equal_fm T T = true; |
|
29787 | 1009 |
|
1010 |
fun djf f p q = |
|
44930 | 1011 |
(if equal_fm q T then T |
1012 |
else (if equal_fm q F then f p |
|
36528 | 1013 |
else (case f p of T => T | F => q | Lt _ => Or (f p, q) |
1014 |
| Le _ => Or (f p, q) | Gt _ => Or (f p, q) |
|
1015 |
| Ge _ => Or (f p, q) | Eq _ => Or (f p, q) |
|
1016 |
| NEq _ => Or (f p, q) | Dvd (_, _) => Or (f p, q) |
|
61128 | 1017 |
| NDvd (_, _) => Or (f p, q) | NOT _ => Or (f p, q) |
36528 | 1018 |
| And (_, _) => Or (f p, q) | Or (_, _) => Or (f p, q) |
1019 |
| Imp (_, _) => Or (f p, q) | Iff (_, _) => Or (f p, q) |
|
1020 |
| E _ => Or (f p, q) | A _ => Or (f p, q) |
|
1021 |
| Closed _ => Or (f p, q) | NClosed _ => Or (f p, q)))); |
|
29787 | 1022 |
|
1023 |
fun evaldjf f ps = foldr (djf f) ps F; |
|
1024 |
||
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1025 |
fun dj f p = evaldjf f (disjuncts p); |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1026 |
|
55685 | 1027 |
fun max A_ a b = (if less_eq A_ a b then b else a); |
1028 |
||
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1029 |
fun minus_nat m n = |
61128 | 1030 |
Nat (max ord_integer (0 : IntInf.int) (integer_of_nat m - integer_of_nat n)); |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1031 |
|
61128 | 1032 |
val zero_nat : nat = Nat (0 : IntInf.int); |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1033 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1034 |
fun minusinf (And (p, q)) = And (minusinf p, minusinf q) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1035 |
| minusinf (Or (p, q)) = Or (minusinf p, minusinf q) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1036 |
| minusinf T = T |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1037 |
| minusinf F = F |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1038 |
| minusinf (Lt (C bo)) = Lt (C bo) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1039 |
| minusinf (Lt (Bound bp)) = Lt (Bound bp) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1040 |
| minusinf (Lt (Neg bt)) = Lt (Neg bt) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1041 |
| minusinf (Lt (Add (bu, bv))) = Lt (Add (bu, bv)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1042 |
| minusinf (Lt (Sub (bw, bx))) = Lt (Sub (bw, bx)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1043 |
| minusinf (Lt (Mul (by, bz))) = Lt (Mul (by, bz)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1044 |
| minusinf (Le (C co)) = Le (C co) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1045 |
| minusinf (Le (Bound cp)) = Le (Bound cp) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1046 |
| minusinf (Le (Neg ct)) = Le (Neg ct) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1047 |
| minusinf (Le (Add (cu, cv))) = Le (Add (cu, cv)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1048 |
| minusinf (Le (Sub (cw, cx))) = Le (Sub (cw, cx)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1049 |
| minusinf (Le (Mul (cy, cz))) = Le (Mul (cy, cz)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1050 |
| minusinf (Gt (C doa)) = Gt (C doa) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1051 |
| minusinf (Gt (Bound dp)) = Gt (Bound dp) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1052 |
| minusinf (Gt (Neg dt)) = Gt (Neg dt) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1053 |
| minusinf (Gt (Add (du, dv))) = Gt (Add (du, dv)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1054 |
| minusinf (Gt (Sub (dw, dx))) = Gt (Sub (dw, dx)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1055 |
| minusinf (Gt (Mul (dy, dz))) = Gt (Mul (dy, dz)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1056 |
| minusinf (Ge (C eo)) = Ge (C eo) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1057 |
| minusinf (Ge (Bound ep)) = Ge (Bound ep) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1058 |
| minusinf (Ge (Neg et)) = Ge (Neg et) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1059 |
| minusinf (Ge (Add (eu, ev))) = Ge (Add (eu, ev)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1060 |
| minusinf (Ge (Sub (ew, ex))) = Ge (Sub (ew, ex)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1061 |
| minusinf (Ge (Mul (ey, ez))) = Ge (Mul (ey, ez)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1062 |
| minusinf (Eq (C fo)) = Eq (C fo) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1063 |
| minusinf (Eq (Bound fp)) = Eq (Bound fp) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1064 |
| minusinf (Eq (Neg ft)) = Eq (Neg ft) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1065 |
| minusinf (Eq (Add (fu, fv))) = Eq (Add (fu, fv)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1066 |
| minusinf (Eq (Sub (fw, fx))) = Eq (Sub (fw, fx)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1067 |
| minusinf (Eq (Mul (fy, fz))) = Eq (Mul (fy, fz)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1068 |
| minusinf (NEq (C go)) = NEq (C go) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1069 |
| minusinf (NEq (Bound gp)) = NEq (Bound gp) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1070 |
| minusinf (NEq (Neg gt)) = NEq (Neg gt) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1071 |
| minusinf (NEq (Add (gu, gv))) = NEq (Add (gu, gv)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1072 |
| minusinf (NEq (Sub (gw, gx))) = NEq (Sub (gw, gx)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1073 |
| minusinf (NEq (Mul (gy, gz))) = NEq (Mul (gy, gz)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1074 |
| minusinf (Dvd (aa, ab)) = Dvd (aa, ab) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1075 |
| minusinf (NDvd (ac, ad)) = NDvd (ac, ad) |
61128 | 1076 |
| minusinf (NOT ae) = NOT ae |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1077 |
| minusinf (Imp (aj, ak)) = Imp (aj, ak) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1078 |
| minusinf (Iff (al, am)) = Iff (al, am) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1079 |
| minusinf (E an) = E an |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1080 |
| minusinf (A ao) = A ao |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1081 |
| minusinf (Closed ap) = Closed ap |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1082 |
| minusinf (NClosed aq) = NClosed aq |
61128 | 1083 |
| minusinf (Lt (CN (cm, c, e))) = |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1084 |
(if equal_nat cm zero_nat then T |
61128 | 1085 |
else Lt (CN (suc (minus_nat cm one_nat), c, e))) |
1086 |
| minusinf (Le (CN (dm, c, e))) = |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1087 |
(if equal_nat dm zero_nat then T |
61128 | 1088 |
else Le (CN (suc (minus_nat dm one_nat), c, e))) |
1089 |
| minusinf (Gt (CN (em, c, e))) = |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1090 |
(if equal_nat em zero_nat then F |
61128 | 1091 |
else Gt (CN (suc (minus_nat em one_nat), c, e))) |
1092 |
| minusinf (Ge (CN (fm, c, e))) = |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1093 |
(if equal_nat fm zero_nat then F |
61128 | 1094 |
else Ge (CN (suc (minus_nat fm one_nat), c, e))) |
1095 |
| minusinf (Eq (CN (gm, c, e))) = |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1096 |
(if equal_nat gm zero_nat then F |
61128 | 1097 |
else Eq (CN (suc (minus_nat gm one_nat), c, e))) |
1098 |
| minusinf (NEq (CN (hm, c, e))) = |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1099 |
(if equal_nat hm zero_nat then T |
61128 | 1100 |
else NEq (CN (suc (minus_nat hm one_nat), c, e))); |
55685 | 1101 |
|
61128 | 1102 |
fun map f [] = [] |
1103 |
| map f (x21 :: x22) = f x21 :: map f x22; |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1104 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1105 |
fun numsubst0 t (C c) = C c |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1106 |
| numsubst0 t (Bound n) = (if equal_nat n zero_nat then t else Bound n) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1107 |
| numsubst0 t (Neg a) = Neg (numsubst0 t a) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1108 |
| numsubst0 t (Add (a, b)) = Add (numsubst0 t a, numsubst0 t b) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1109 |
| numsubst0 t (Sub (a, b)) = Sub (numsubst0 t a, numsubst0 t b) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1110 |
| numsubst0 t (Mul (i, a)) = Mul (i, numsubst0 t a) |
61128 | 1111 |
| numsubst0 t (CN (v, i, a)) = |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1112 |
(if equal_nat v zero_nat then Add (Mul (i, t), numsubst0 t a) |
61128 | 1113 |
else CN (suc (minus_nat v one_nat), i, numsubst0 t a)); |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1114 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1115 |
fun subst0 t T = T |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1116 |
| subst0 t F = F |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1117 |
| subst0 t (Lt a) = Lt (numsubst0 t a) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1118 |
| subst0 t (Le a) = Le (numsubst0 t a) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1119 |
| subst0 t (Gt a) = Gt (numsubst0 t a) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1120 |
| subst0 t (Ge a) = Ge (numsubst0 t a) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1121 |
| subst0 t (Eq a) = Eq (numsubst0 t a) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1122 |
| subst0 t (NEq a) = NEq (numsubst0 t a) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1123 |
| subst0 t (Dvd (i, a)) = Dvd (i, numsubst0 t a) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1124 |
| subst0 t (NDvd (i, a)) = NDvd (i, numsubst0 t a) |
61128 | 1125 |
| subst0 t (NOT p) = NOT (subst0 t p) |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1126 |
| subst0 t (And (p, q)) = And (subst0 t p, subst0 t q) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1127 |
| subst0 t (Or (p, q)) = Or (subst0 t p, subst0 t q) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1128 |
| subst0 t (Imp (p, q)) = Imp (subst0 t p, subst0 t q) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1129 |
| subst0 t (Iff (p, q)) = Iff (subst0 t p, subst0 t q) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1130 |
| subst0 t (Closed p) = Closed p |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1131 |
| subst0 t (NClosed p) = NClosed p; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1132 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1133 |
fun less_eq_int k l = integer_of_int k <= integer_of_int l; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1134 |
|
55685 | 1135 |
fun less_int k l = integer_of_int k < integer_of_int l; |
1136 |
||
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1137 |
fun uminus_int k = Int_of_integer (~ (integer_of_int k)); |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1138 |
|
55685 | 1139 |
fun abs_int i = (if less_int i zero_inta then uminus_int i else i); |
1140 |
||
1141 |
fun dvd (A1_, A2_) a b = |
|
1142 |
eq A2_ (moda (div_semiring_div A1_) b a) |
|
1143 |
(zero ((zero_mult_zero o mult_zero_semiring_0 o semiring_0_semiring_1 o |
|
1144 |
semiring_1_comm_semiring_1 o |
|
1145 |
comm_semiring_1_comm_semiring_1_cancel o |
|
61128 | 1146 |
comm_semiring_1_cancel_semidom o semidom_semidom_divide o |
1147 |
semidom_divide_algebraic_semidom o algebraic_semidom_semiring_div) |
|
55685 | 1148 |
A1_)); |
1149 |
||
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1150 |
fun nummul i (C j) = C (times_inta i j) |
61128 | 1151 |
| nummul i (CN (n, c, t)) = CN (n, times_inta c i, nummul i t) |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1152 |
| nummul i (Bound v) = Mul (i, Bound v) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1153 |
| nummul i (Neg v) = Mul (i, Neg v) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1154 |
| nummul i (Add (v, va)) = Mul (i, Add (v, va)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1155 |
| nummul i (Sub (v, va)) = Mul (i, Sub (v, va)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1156 |
| nummul i (Mul (v, va)) = Mul (i, Mul (v, va)); |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1157 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1158 |
fun numneg t = nummul (uminus_int (Int_of_integer (1 : IntInf.int))) t; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1159 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1160 |
fun less_eq_nat m n = integer_of_nat m <= integer_of_nat n; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1161 |
|
61128 | 1162 |
fun numadd (CN (n1, c1, r1), CN (n2, c2, r2)) = |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1163 |
(if equal_nat n1 n2 |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1164 |
then let |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1165 |
val c = plus_inta c1 c2; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1166 |
in |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1167 |
(if equal_inta c zero_inta then numadd (r1, r2) |
61128 | 1168 |
else CN (n1, c, numadd (r1, r2))) |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1169 |
end |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1170 |
else (if less_eq_nat n1 n2 |
61128 | 1171 |
then CN (n1, c1, numadd (r1, Add (Mul (c2, Bound n2), r2))) |
1172 |
else CN (n2, c2, numadd (Add (Mul (c1, Bound n1), r1), r2)))) |
|
1173 |
| numadd (CN (n1, c1, r1), C dd) = CN (n1, c1, numadd (r1, C dd)) |
|
1174 |
| numadd (CN (n1, c1, r1), Bound de) = CN (n1, c1, numadd (r1, Bound de)) |
|
1175 |
| numadd (CN (n1, c1, r1), Neg di) = CN (n1, c1, numadd (r1, Neg di)) |
|
1176 |
| numadd (CN (n1, c1, r1), Add (dj, dk)) = |
|
1177 |
CN (n1, c1, numadd (r1, Add (dj, dk))) |
|
1178 |
| numadd (CN (n1, c1, r1), Sub (dl, dm)) = |
|
1179 |
CN (n1, c1, numadd (r1, Sub (dl, dm))) |
|
1180 |
| numadd (CN (n1, c1, r1), Mul (dn, doa)) = |
|
1181 |
CN (n1, c1, numadd (r1, Mul (dn, doa))) |
|
1182 |
| numadd (C w, CN (n2, c2, r2)) = CN (n2, c2, numadd (C w, r2)) |
|
1183 |
| numadd (Bound x, CN (n2, c2, r2)) = CN (n2, c2, numadd (Bound x, r2)) |
|
1184 |
| numadd (Neg ac, CN (n2, c2, r2)) = CN (n2, c2, numadd (Neg ac, r2)) |
|
1185 |
| numadd (Add (ad, ae), CN (n2, c2, r2)) = |
|
1186 |
CN (n2, c2, numadd (Add (ad, ae), r2)) |
|
1187 |
| numadd (Sub (af, ag), CN (n2, c2, r2)) = |
|
1188 |
CN (n2, c2, numadd (Sub (af, ag), r2)) |
|
1189 |
| numadd (Mul (ah, ai), CN (n2, c2, r2)) = |
|
1190 |
CN (n2, c2, numadd (Mul (ah, ai), r2)) |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1191 |
| numadd (C b1, C b2) = C (plus_inta b1 b2) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1192 |
| numadd (C aj, Bound bi) = Add (C aj, Bound bi) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1193 |
| numadd (C aj, Neg bm) = Add (C aj, Neg bm) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1194 |
| numadd (C aj, Add (bn, bo)) = Add (C aj, Add (bn, bo)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1195 |
| numadd (C aj, Sub (bp, bq)) = Add (C aj, Sub (bp, bq)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1196 |
| numadd (C aj, Mul (br, bs)) = Add (C aj, Mul (br, bs)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1197 |
| numadd (Bound ak, C cf) = Add (Bound ak, C cf) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1198 |
| numadd (Bound ak, Bound cg) = Add (Bound ak, Bound cg) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1199 |
| numadd (Bound ak, Neg ck) = Add (Bound ak, Neg ck) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1200 |
| numadd (Bound ak, Add (cl, cm)) = Add (Bound ak, Add (cl, cm)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1201 |
| numadd (Bound ak, Sub (cn, co)) = Add (Bound ak, Sub (cn, co)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1202 |
| numadd (Bound ak, Mul (cp, cq)) = Add (Bound ak, Mul (cp, cq)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1203 |
| numadd (Neg ao, C en) = Add (Neg ao, C en) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1204 |
| numadd (Neg ao, Bound eo) = Add (Neg ao, Bound eo) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1205 |
| numadd (Neg ao, Neg et) = Add (Neg ao, Neg et) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1206 |
| numadd (Neg ao, Add (eu, ev)) = Add (Neg ao, Add (eu, ev)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1207 |
| numadd (Neg ao, Sub (ew, ex)) = Add (Neg ao, Sub (ew, ex)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1208 |
| numadd (Neg ao, Mul (ey, ez)) = Add (Neg ao, Mul (ey, ez)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1209 |
| numadd (Add (ap, aq), C fm) = Add (Add (ap, aq), C fm) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1210 |
| numadd (Add (ap, aq), Bound fna) = Add (Add (ap, aq), Bound fna) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1211 |
| numadd (Add (ap, aq), Neg fr) = Add (Add (ap, aq), Neg fr) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1212 |
| numadd (Add (ap, aq), Add (fs, ft)) = Add (Add (ap, aq), Add (fs, ft)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1213 |
| numadd (Add (ap, aq), Sub (fu, fv)) = Add (Add (ap, aq), Sub (fu, fv)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1214 |
| numadd (Add (ap, aq), Mul (fw, fx)) = Add (Add (ap, aq), Mul (fw, fx)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1215 |
| numadd (Sub (ar, asa), C gk) = Add (Sub (ar, asa), C gk) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1216 |
| numadd (Sub (ar, asa), Bound gl) = Add (Sub (ar, asa), Bound gl) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1217 |
| numadd (Sub (ar, asa), Neg gp) = Add (Sub (ar, asa), Neg gp) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1218 |
| numadd (Sub (ar, asa), Add (gq, gr)) = Add (Sub (ar, asa), Add (gq, gr)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1219 |
| numadd (Sub (ar, asa), Sub (gs, gt)) = Add (Sub (ar, asa), Sub (gs, gt)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1220 |
| numadd (Sub (ar, asa), Mul (gu, gv)) = Add (Sub (ar, asa), Mul (gu, gv)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1221 |
| numadd (Mul (at, au), C hi) = Add (Mul (at, au), C hi) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1222 |
| numadd (Mul (at, au), Bound hj) = Add (Mul (at, au), Bound hj) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1223 |
| numadd (Mul (at, au), Neg hn) = Add (Mul (at, au), Neg hn) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1224 |
| numadd (Mul (at, au), Add (ho, hp)) = Add (Mul (at, au), Add (ho, hp)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1225 |
| numadd (Mul (at, au), Sub (hq, hr)) = Add (Mul (at, au), Sub (hq, hr)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1226 |
| numadd (Mul (at, au), Mul (hs, ht)) = Add (Mul (at, au), Mul (hs, ht)); |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1227 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1228 |
fun numsub s t = (if equal_numa s t then C zero_inta else numadd (s, numneg t)); |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1229 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1230 |
fun simpnum (C j) = C j |
61128 | 1231 |
| simpnum (Bound n) = CN (n, Int_of_integer (1 : IntInf.int), C zero_inta) |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1232 |
| simpnum (Neg t) = numneg (simpnum t) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1233 |
| simpnum (Add (t, s)) = numadd (simpnum t, simpnum s) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1234 |
| simpnum (Sub (t, s)) = numsub (simpnum t) (simpnum s) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1235 |
| simpnum (Mul (i, t)) = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1236 |
(if equal_inta i zero_inta then C zero_inta else nummul i (simpnum t)) |
61128 | 1237 |
| simpnum (CN (v, va, vb)) = CN (v, va, vb); |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1238 |
|
55685 | 1239 |
fun disj p q = |
1240 |
(if equal_fm p T orelse equal_fm q T then T |
|
1241 |
else (if equal_fm p F then q else (if equal_fm q F then p else Or (p, q)))); |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1242 |
|
55685 | 1243 |
fun conj p q = |
1244 |
(if equal_fm p F orelse equal_fm q F then F |
|
1245 |
else (if equal_fm p T then q |
|
1246 |
else (if equal_fm q T then p else And (p, q)))); |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1247 |
|
61128 | 1248 |
fun nota (NOT p) = p |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1249 |
| nota T = F |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1250 |
| nota F = T |
61128 | 1251 |
| nota (Lt v) = NOT (Lt v) |
1252 |
| nota (Le v) = NOT (Le v) |
|
1253 |
| nota (Gt v) = NOT (Gt v) |
|
1254 |
| nota (Ge v) = NOT (Ge v) |
|
1255 |
| nota (Eq v) = NOT (Eq v) |
|
1256 |
| nota (NEq v) = NOT (NEq v) |
|
1257 |
| nota (Dvd (v, va)) = NOT (Dvd (v, va)) |
|
1258 |
| nota (NDvd (v, va)) = NOT (NDvd (v, va)) |
|
1259 |
| nota (And (v, va)) = NOT (And (v, va)) |
|
1260 |
| nota (Or (v, va)) = NOT (Or (v, va)) |
|
1261 |
| nota (Imp (v, va)) = NOT (Imp (v, va)) |
|
1262 |
| nota (Iff (v, va)) = NOT (Iff (v, va)) |
|
1263 |
| nota (E v) = NOT (E v) |
|
1264 |
| nota (A v) = NOT (A v) |
|
1265 |
| nota (Closed v) = NOT (Closed v) |
|
1266 |
| nota (NClosed v) = NOT (NClosed v); |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1267 |
|
55685 | 1268 |
fun imp p q = |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1269 |
(if equal_fm p F orelse equal_fm q T then T |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1270 |
else (if equal_fm p T then q |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1271 |
else (if equal_fm q F then nota p else Imp (p, q)))); |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1272 |
|
55685 | 1273 |
fun iff p q = |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1274 |
(if equal_fm p q then T |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1275 |
else (if equal_fm p (nota q) orelse equal_fm (nota p) q then F |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1276 |
else (if equal_fm p F then nota q |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1277 |
else (if equal_fm q F then nota p |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1278 |
else (if equal_fm p T then q |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1279 |
else (if equal_fm q T then p |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1280 |
else Iff (p, q))))))); |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1281 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1282 |
fun simpfm (And (p, q)) = conj (simpfm p) (simpfm q) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1283 |
| simpfm (Or (p, q)) = disj (simpfm p) (simpfm q) |
55685 | 1284 |
| simpfm (Imp (p, q)) = imp (simpfm p) (simpfm q) |
1285 |
| simpfm (Iff (p, q)) = iff (simpfm p) (simpfm q) |
|
61128 | 1286 |
| simpfm (NOT p) = nota (simpfm p) |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1287 |
| simpfm (Lt a) = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1288 |
let |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1289 |
val aa = simpnum a; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1290 |
in |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1291 |
(case aa of C v => (if less_int v zero_inta then T else F) |
61128 | 1292 |
| Bound _ => Lt aa | CN (_, _, _) => Lt aa | Neg _ => Lt aa |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1293 |
| Add (_, _) => Lt aa | Sub (_, _) => Lt aa | Mul (_, _) => Lt aa) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1294 |
end |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1295 |
| simpfm (Le a) = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1296 |
let |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1297 |
val aa = simpnum a; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1298 |
in |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1299 |
(case aa of C v => (if less_eq_int v zero_inta then T else F) |
61128 | 1300 |
| Bound _ => Le aa | CN (_, _, _) => Le aa | Neg _ => Le aa |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1301 |
| Add (_, _) => Le aa | Sub (_, _) => Le aa | Mul (_, _) => Le aa) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1302 |
end |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1303 |
| simpfm (Gt a) = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1304 |
let |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1305 |
val aa = simpnum a; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1306 |
in |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1307 |
(case aa of C v => (if less_int zero_inta v then T else F) |
61128 | 1308 |
| Bound _ => Gt aa | CN (_, _, _) => Gt aa | Neg _ => Gt aa |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1309 |
| Add (_, _) => Gt aa | Sub (_, _) => Gt aa | Mul (_, _) => Gt aa) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1310 |
end |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1311 |
| simpfm (Ge a) = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1312 |
let |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1313 |
val aa = simpnum a; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1314 |
in |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1315 |
(case aa of C v => (if less_eq_int zero_inta v then T else F) |
61128 | 1316 |
| Bound _ => Ge aa | CN (_, _, _) => Ge aa | Neg _ => Ge aa |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1317 |
| Add (_, _) => Ge aa | Sub (_, _) => Ge aa | Mul (_, _) => Ge aa) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1318 |
end |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1319 |
| simpfm (Eq a) = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1320 |
let |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1321 |
val aa = simpnum a; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1322 |
in |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1323 |
(case aa of C v => (if equal_inta v zero_inta then T else F) |
61128 | 1324 |
| Bound _ => Eq aa | CN (_, _, _) => Eq aa | Neg _ => Eq aa |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1325 |
| Add (_, _) => Eq aa | Sub (_, _) => Eq aa | Mul (_, _) => Eq aa) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1326 |
end |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1327 |
| simpfm (NEq a) = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1328 |
let |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1329 |
val aa = simpnum a; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1330 |
in |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1331 |
(case aa of C v => (if not (equal_inta v zero_inta) then T else F) |
61128 | 1332 |
| Bound _ => NEq aa | CN (_, _, _) => NEq aa | Neg _ => NEq aa |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1333 |
| Add (_, _) => NEq aa | Sub (_, _) => NEq aa | Mul (_, _) => NEq aa) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1334 |
end |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1335 |
| simpfm (Dvd (i, a)) = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1336 |
(if equal_inta i zero_inta then simpfm (Eq a) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1337 |
else (if equal_inta (abs_int i) (Int_of_integer (1 : IntInf.int)) then T |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1338 |
else let |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1339 |
val aa = simpnum a; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1340 |
in |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1341 |
(case aa |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1342 |
of C v => |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1343 |
(if dvd (semiring_div_int, equal_int) i v then T else F) |
61128 | 1344 |
| Bound _ => Dvd (i, aa) | CN (_, _, _) => Dvd (i, aa) |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1345 |
| Neg _ => Dvd (i, aa) | Add (_, _) => Dvd (i, aa) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1346 |
| Sub (_, _) => Dvd (i, aa) | Mul (_, _) => Dvd (i, aa)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1347 |
end)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1348 |
| simpfm (NDvd (i, a)) = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1349 |
(if equal_inta i zero_inta then simpfm (NEq a) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1350 |
else (if equal_inta (abs_int i) (Int_of_integer (1 : IntInf.int)) then F |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1351 |
else let |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1352 |
val aa = simpnum a; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1353 |
in |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1354 |
(case aa |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1355 |
of C v => |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1356 |
(if not (dvd (semiring_div_int, equal_int) i v) then T |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1357 |
else F) |
61128 | 1358 |
| Bound _ => NDvd (i, aa) | CN (_, _, _) => NDvd (i, aa) |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1359 |
| Neg _ => NDvd (i, aa) | Add (_, _) => NDvd (i, aa) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1360 |
| Sub (_, _) => NDvd (i, aa) | Mul (_, _) => NDvd (i, aa)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1361 |
end)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1362 |
| simpfm T = T |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1363 |
| simpfm F = F |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1364 |
| simpfm (E v) = E v |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1365 |
| simpfm (A v) = A v |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1366 |
| simpfm (Closed v) = Closed v |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1367 |
| simpfm (NClosed v) = NClosed v; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1368 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1369 |
fun gen_length n (x :: xs) = gen_length (suc n) xs |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1370 |
| gen_length n [] = n; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1371 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1372 |
fun size_list x = gen_length zero_nat x; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1373 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1374 |
fun a_beta (And (p, q)) = (fn k => And (a_beta p k, a_beta q k)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1375 |
| a_beta (Or (p, q)) = (fn k => Or (a_beta p k, a_beta q k)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1376 |
| a_beta T = (fn _ => T) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1377 |
| a_beta F = (fn _ => F) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1378 |
| a_beta (Lt (C bo)) = (fn _ => Lt (C bo)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1379 |
| a_beta (Lt (Bound bp)) = (fn _ => Lt (Bound bp)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1380 |
| a_beta (Lt (Neg bt)) = (fn _ => Lt (Neg bt)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1381 |
| a_beta (Lt (Add (bu, bv))) = (fn _ => Lt (Add (bu, bv))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1382 |
| a_beta (Lt (Sub (bw, bx))) = (fn _ => Lt (Sub (bw, bx))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1383 |
| a_beta (Lt (Mul (by, bz))) = (fn _ => Lt (Mul (by, bz))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1384 |
| a_beta (Le (C co)) = (fn _ => Le (C co)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1385 |
| a_beta (Le (Bound cp)) = (fn _ => Le (Bound cp)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1386 |
| a_beta (Le (Neg ct)) = (fn _ => Le (Neg ct)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1387 |
| a_beta (Le (Add (cu, cv))) = (fn _ => Le (Add (cu, cv))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1388 |
| a_beta (Le (Sub (cw, cx))) = (fn _ => Le (Sub (cw, cx))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1389 |
| a_beta (Le (Mul (cy, cz))) = (fn _ => Le (Mul (cy, cz))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1390 |
| a_beta (Gt (C doa)) = (fn _ => Gt (C doa)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1391 |
| a_beta (Gt (Bound dp)) = (fn _ => Gt (Bound dp)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1392 |
| a_beta (Gt (Neg dt)) = (fn _ => Gt (Neg dt)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1393 |
| a_beta (Gt (Add (du, dv))) = (fn _ => Gt (Add (du, dv))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1394 |
| a_beta (Gt (Sub (dw, dx))) = (fn _ => Gt (Sub (dw, dx))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1395 |
| a_beta (Gt (Mul (dy, dz))) = (fn _ => Gt (Mul (dy, dz))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1396 |
| a_beta (Ge (C eo)) = (fn _ => Ge (C eo)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1397 |
| a_beta (Ge (Bound ep)) = (fn _ => Ge (Bound ep)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1398 |
| a_beta (Ge (Neg et)) = (fn _ => Ge (Neg et)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1399 |
| a_beta (Ge (Add (eu, ev))) = (fn _ => Ge (Add (eu, ev))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1400 |
| a_beta (Ge (Sub (ew, ex))) = (fn _ => Ge (Sub (ew, ex))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1401 |
| a_beta (Ge (Mul (ey, ez))) = (fn _ => Ge (Mul (ey, ez))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1402 |
| a_beta (Eq (C fo)) = (fn _ => Eq (C fo)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1403 |
| a_beta (Eq (Bound fp)) = (fn _ => Eq (Bound fp)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1404 |
| a_beta (Eq (Neg ft)) = (fn _ => Eq (Neg ft)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1405 |
| a_beta (Eq (Add (fu, fv))) = (fn _ => Eq (Add (fu, fv))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1406 |
| a_beta (Eq (Sub (fw, fx))) = (fn _ => Eq (Sub (fw, fx))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1407 |
| a_beta (Eq (Mul (fy, fz))) = (fn _ => Eq (Mul (fy, fz))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1408 |
| a_beta (NEq (C go)) = (fn _ => NEq (C go)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1409 |
| a_beta (NEq (Bound gp)) = (fn _ => NEq (Bound gp)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1410 |
| a_beta (NEq (Neg gt)) = (fn _ => NEq (Neg gt)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1411 |
| a_beta (NEq (Add (gu, gv))) = (fn _ => NEq (Add (gu, gv))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1412 |
| a_beta (NEq (Sub (gw, gx))) = (fn _ => NEq (Sub (gw, gx))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1413 |
| a_beta (NEq (Mul (gy, gz))) = (fn _ => NEq (Mul (gy, gz))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1414 |
| a_beta (Dvd (aa, C ho)) = (fn _ => Dvd (aa, C ho)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1415 |
| a_beta (Dvd (aa, Bound hp)) = (fn _ => Dvd (aa, Bound hp)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1416 |
| a_beta (Dvd (aa, Neg ht)) = (fn _ => Dvd (aa, Neg ht)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1417 |
| a_beta (Dvd (aa, Add (hu, hv))) = (fn _ => Dvd (aa, Add (hu, hv))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1418 |
| a_beta (Dvd (aa, Sub (hw, hx))) = (fn _ => Dvd (aa, Sub (hw, hx))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1419 |
| a_beta (Dvd (aa, Mul (hy, hz))) = (fn _ => Dvd (aa, Mul (hy, hz))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1420 |
| a_beta (NDvd (ac, C io)) = (fn _ => NDvd (ac, C io)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1421 |
| a_beta (NDvd (ac, Bound ip)) = (fn _ => NDvd (ac, Bound ip)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1422 |
| a_beta (NDvd (ac, Neg it)) = (fn _ => NDvd (ac, Neg it)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1423 |
| a_beta (NDvd (ac, Add (iu, iv))) = (fn _ => NDvd (ac, Add (iu, iv))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1424 |
| a_beta (NDvd (ac, Sub (iw, ix))) = (fn _ => NDvd (ac, Sub (iw, ix))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1425 |
| a_beta (NDvd (ac, Mul (iy, iz))) = (fn _ => NDvd (ac, Mul (iy, iz))) |
61128 | 1426 |
| a_beta (NOT ae) = (fn _ => NOT ae) |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1427 |
| a_beta (Imp (aj, ak)) = (fn _ => Imp (aj, ak)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1428 |
| a_beta (Iff (al, am)) = (fn _ => Iff (al, am)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1429 |
| a_beta (E an) = (fn _ => E an) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1430 |
| a_beta (A ao) = (fn _ => A ao) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1431 |
| a_beta (Closed ap) = (fn _ => Closed ap) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1432 |
| a_beta (NClosed aq) = (fn _ => NClosed aq) |
61128 | 1433 |
| a_beta (Lt (CN (cm, c, e))) = |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1434 |
(if equal_nat cm zero_nat |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1435 |
then (fn k => |
61128 | 1436 |
Lt (CN (zero_nat, Int_of_integer (1 : IntInf.int), |
1437 |
Mul (divide_inta k c, e)))) |
|
1438 |
else (fn _ => Lt (CN (suc (minus_nat cm one_nat), c, e)))) |
|
1439 |
| a_beta (Le (CN (dm, c, e))) = |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1440 |
(if equal_nat dm zero_nat |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1441 |
then (fn k => |
61128 | 1442 |
Le (CN (zero_nat, Int_of_integer (1 : IntInf.int), |
1443 |
Mul (divide_inta k c, e)))) |
|
1444 |
else (fn _ => Le (CN (suc (minus_nat dm one_nat), c, e)))) |
|
1445 |
| a_beta (Gt (CN (em, c, e))) = |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1446 |
(if equal_nat em zero_nat |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1447 |
then (fn k => |
61128 | 1448 |
Gt (CN (zero_nat, Int_of_integer (1 : IntInf.int), |
1449 |
Mul (divide_inta k c, e)))) |
|
1450 |
else (fn _ => Gt (CN (suc (minus_nat em one_nat), c, e)))) |
|
1451 |
| a_beta (Ge (CN (fm, c, e))) = |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1452 |
(if equal_nat fm zero_nat |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1453 |
then (fn k => |
61128 | 1454 |
Ge (CN (zero_nat, Int_of_integer (1 : IntInf.int), |
1455 |
Mul (divide_inta k c, e)))) |
|
1456 |
else (fn _ => Ge (CN (suc (minus_nat fm one_nat), c, e)))) |
|
1457 |
| a_beta (Eq (CN (gm, c, e))) = |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1458 |
(if equal_nat gm zero_nat |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1459 |
then (fn k => |
61128 | 1460 |
Eq (CN (zero_nat, Int_of_integer (1 : IntInf.int), |
1461 |
Mul (divide_inta k c, e)))) |
|
1462 |
else (fn _ => Eq (CN (suc (minus_nat gm one_nat), c, e)))) |
|
1463 |
| a_beta (NEq (CN (hm, c, e))) = |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1464 |
(if equal_nat hm zero_nat |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1465 |
then (fn k => |
61128 | 1466 |
NEq (CN (zero_nat, Int_of_integer (1 : IntInf.int), |
1467 |
Mul (divide_inta k c, e)))) |
|
1468 |
else (fn _ => NEq (CN (suc (minus_nat hm one_nat), c, e)))) |
|
1469 |
| a_beta (Dvd (i, CN (im, c, e))) = |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1470 |
(if equal_nat im zero_nat |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1471 |
then (fn k => |
61128 | 1472 |
Dvd (times_inta (divide_inta k c) i, |
1473 |
CN (zero_nat, Int_of_integer (1 : IntInf.int), |
|
1474 |
Mul (divide_inta k c, e)))) |
|
1475 |
else (fn _ => Dvd (i, CN (suc (minus_nat im one_nat), c, e)))) |
|
1476 |
| a_beta (NDvd (i, CN (jm, c, e))) = |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1477 |
(if equal_nat jm zero_nat |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1478 |
then (fn k => |
61128 | 1479 |
NDvd (times_inta (divide_inta k c) i, |
1480 |
CN (zero_nat, Int_of_integer (1 : IntInf.int), |
|
1481 |
Mul (divide_inta k c, e)))) |
|
1482 |
else (fn _ => NDvd (i, CN (suc (minus_nat jm one_nat), c, e)))); |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1483 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1484 |
fun gcd_int k l = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1485 |
abs_int |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1486 |
(if equal_inta l zero_inta then k |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1487 |
else gcd_int l (mod_int (abs_int k) (abs_int l))); |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1488 |
|
61128 | 1489 |
fun lcm_int a b = |
1490 |
divide_inta (times_inta (abs_int a) (abs_int b)) (gcd_int a b); |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1491 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1492 |
fun delta (And (p, q)) = lcm_int (delta p) (delta q) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1493 |
| delta (Or (p, q)) = lcm_int (delta p) (delta q) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1494 |
| delta T = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1495 |
| delta F = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1496 |
| delta (Lt u) = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1497 |
| delta (Le v) = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1498 |
| delta (Gt w) = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1499 |
| delta (Ge x) = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1500 |
| delta (Eq y) = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1501 |
| delta (NEq z) = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1502 |
| delta (Dvd (aa, C bo)) = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1503 |
| delta (Dvd (aa, Bound bp)) = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1504 |
| delta (Dvd (aa, Neg bt)) = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1505 |
| delta (Dvd (aa, Add (bu, bv))) = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1506 |
| delta (Dvd (aa, Sub (bw, bx))) = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1507 |
| delta (Dvd (aa, Mul (by, bz))) = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1508 |
| delta (NDvd (ac, C co)) = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1509 |
| delta (NDvd (ac, Bound cp)) = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1510 |
| delta (NDvd (ac, Neg ct)) = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1511 |
| delta (NDvd (ac, Add (cu, cv))) = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1512 |
| delta (NDvd (ac, Sub (cw, cx))) = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1513 |
| delta (NDvd (ac, Mul (cy, cz))) = Int_of_integer (1 : IntInf.int) |
61128 | 1514 |
| delta (NOT ae) = Int_of_integer (1 : IntInf.int) |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1515 |
| delta (Imp (aj, ak)) = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1516 |
| delta (Iff (al, am)) = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1517 |
| delta (E an) = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1518 |
| delta (A ao) = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1519 |
| delta (Closed ap) = Int_of_integer (1 : IntInf.int) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1520 |
| delta (NClosed aq) = Int_of_integer (1 : IntInf.int) |
61128 | 1521 |
| delta (Dvd (i, CN (cm, c, e))) = |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1522 |
(if equal_nat cm zero_nat then i else Int_of_integer (1 : IntInf.int)) |
61128 | 1523 |
| delta (NDvd (i, CN (dm, c, e))) = |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1524 |
(if equal_nat dm zero_nat then i else Int_of_integer (1 : IntInf.int)); |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1525 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1526 |
fun alpha (And (p, q)) = alpha p @ alpha q |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1527 |
| alpha (Or (p, q)) = alpha p @ alpha q |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1528 |
| alpha T = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1529 |
| alpha F = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1530 |
| alpha (Lt (C bo)) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1531 |
| alpha (Lt (Bound bp)) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1532 |
| alpha (Lt (Neg bt)) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1533 |
| alpha (Lt (Add (bu, bv))) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1534 |
| alpha (Lt (Sub (bw, bx))) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1535 |
| alpha (Lt (Mul (by, bz))) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1536 |
| alpha (Le (C co)) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1537 |
| alpha (Le (Bound cp)) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1538 |
| alpha (Le (Neg ct)) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1539 |
| alpha (Le (Add (cu, cv))) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1540 |
| alpha (Le (Sub (cw, cx))) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1541 |
| alpha (Le (Mul (cy, cz))) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1542 |
| alpha (Gt (C doa)) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1543 |
| alpha (Gt (Bound dp)) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1544 |
| alpha (Gt (Neg dt)) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1545 |
| alpha (Gt (Add (du, dv))) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1546 |
| alpha (Gt (Sub (dw, dx))) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1547 |
| alpha (Gt (Mul (dy, dz))) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1548 |
| alpha (Ge (C eo)) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1549 |
| alpha (Ge (Bound ep)) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1550 |
| alpha (Ge (Neg et)) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1551 |
| alpha (Ge (Add (eu, ev))) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1552 |
| alpha (Ge (Sub (ew, ex))) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1553 |
| alpha (Ge (Mul (ey, ez))) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1554 |
| alpha (Eq (C fo)) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1555 |
| alpha (Eq (Bound fp)) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1556 |
| alpha (Eq (Neg ft)) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1557 |
| alpha (Eq (Add (fu, fv))) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1558 |
| alpha (Eq (Sub (fw, fx))) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1559 |
| alpha (Eq (Mul (fy, fz))) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1560 |
| alpha (NEq (C go)) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1561 |
| alpha (NEq (Bound gp)) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1562 |
| alpha (NEq (Neg gt)) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1563 |
| alpha (NEq (Add (gu, gv))) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1564 |
| alpha (NEq (Sub (gw, gx))) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1565 |
| alpha (NEq (Mul (gy, gz))) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1566 |
| alpha (Dvd (aa, ab)) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1567 |
| alpha (NDvd (ac, ad)) = [] |
61128 | 1568 |
| alpha (NOT ae) = [] |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1569 |
| alpha (Imp (aj, ak)) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1570 |
| alpha (Iff (al, am)) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1571 |
| alpha (E an) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1572 |
| alpha (A ao) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1573 |
| alpha (Closed ap) = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1574 |
| alpha (NClosed aq) = [] |
61128 | 1575 |
| alpha (Lt (CN (cm, c, e))) = (if equal_nat cm zero_nat then [e] else []) |
1576 |
| alpha (Le (CN (dm, c, e))) = |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1577 |
(if equal_nat dm zero_nat |
55685 | 1578 |
then [Add (C (uminus_int (Int_of_integer (1 : IntInf.int))), e)] else []) |
61128 | 1579 |
| alpha (Gt (CN (em, c, e))) = (if equal_nat em zero_nat then [] else []) |
1580 |
| alpha (Ge (CN (fm, c, e))) = (if equal_nat fm zero_nat then [] else []) |
|
1581 |
| alpha (Eq (CN (gm, c, e))) = |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1582 |
(if equal_nat gm zero_nat |
55685 | 1583 |
then [Add (C (uminus_int (Int_of_integer (1 : IntInf.int))), e)] else []) |
61128 | 1584 |
| alpha (NEq (CN (hm, c, e))) = (if equal_nat hm zero_nat then [e] else []); |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1585 |
|
55685 | 1586 |
fun zeta (And (p, q)) = lcm_int (zeta p) (zeta q) |
1587 |
| zeta (Or (p, q)) = lcm_int (zeta p) (zeta q) |
|
1588 |
| zeta T = Int_of_integer (1 : IntInf.int) |
|
1589 |
| zeta F = Int_of_integer (1 : IntInf.int) |
|
1590 |
| zeta (Lt (C bo)) = Int_of_integer (1 : IntInf.int) |
|
1591 |
| zeta (Lt (Bound bp)) = Int_of_integer (1 : IntInf.int) |
|
1592 |
| zeta (Lt (Neg bt)) = Int_of_integer (1 : IntInf.int) |
|
1593 |
| zeta (Lt (Add (bu, bv))) = Int_of_integer (1 : IntInf.int) |
|
1594 |
| zeta (Lt (Sub (bw, bx))) = Int_of_integer (1 : IntInf.int) |
|
1595 |
| zeta (Lt (Mul (by, bz))) = Int_of_integer (1 : IntInf.int) |
|
1596 |
| zeta (Le (C co)) = Int_of_integer (1 : IntInf.int) |
|
1597 |
| zeta (Le (Bound cp)) = Int_of_integer (1 : IntInf.int) |
|
1598 |
| zeta (Le (Neg ct)) = Int_of_integer (1 : IntInf.int) |
|
1599 |
| zeta (Le (Add (cu, cv))) = Int_of_integer (1 : IntInf.int) |
|
1600 |
| zeta (Le (Sub (cw, cx))) = Int_of_integer (1 : IntInf.int) |
|
1601 |
| zeta (Le (Mul (cy, cz))) = Int_of_integer (1 : IntInf.int) |
|
1602 |
| zeta (Gt (C doa)) = Int_of_integer (1 : IntInf.int) |
|
1603 |
| zeta (Gt (Bound dp)) = Int_of_integer (1 : IntInf.int) |
|
1604 |
| zeta (Gt (Neg dt)) = Int_of_integer (1 : IntInf.int) |
|
1605 |
| zeta (Gt (Add (du, dv))) = Int_of_integer (1 : IntInf.int) |
|
1606 |
| zeta (Gt (Sub (dw, dx))) = Int_of_integer (1 : IntInf.int) |
|
1607 |
| zeta (Gt (Mul (dy, dz))) = Int_of_integer (1 : IntInf.int) |
|
1608 |
| zeta (Ge (C eo)) = Int_of_integer (1 : IntInf.int) |
|
1609 |
| zeta (Ge (Bound ep)) = Int_of_integer (1 : IntInf.int) |
|
1610 |
| zeta (Ge (Neg et)) = Int_of_integer (1 : IntInf.int) |
|
1611 |
| zeta (Ge (Add (eu, ev))) = Int_of_integer (1 : IntInf.int) |
|
1612 |
| zeta (Ge (Sub (ew, ex))) = Int_of_integer (1 : IntInf.int) |
|
1613 |
| zeta (Ge (Mul (ey, ez))) = Int_of_integer (1 : IntInf.int) |
|
1614 |
| zeta (Eq (C fo)) = Int_of_integer (1 : IntInf.int) |
|
1615 |
| zeta (Eq (Bound fp)) = Int_of_integer (1 : IntInf.int) |
|
1616 |
| zeta (Eq (Neg ft)) = Int_of_integer (1 : IntInf.int) |
|
1617 |
| zeta (Eq (Add (fu, fv))) = Int_of_integer (1 : IntInf.int) |
|
1618 |
| zeta (Eq (Sub (fw, fx))) = Int_of_integer (1 : IntInf.int) |
|
1619 |
| zeta (Eq (Mul (fy, fz))) = Int_of_integer (1 : IntInf.int) |
|
1620 |
| zeta (NEq (C go)) = Int_of_integer (1 : IntInf.int) |
|
1621 |
| zeta (NEq (Bound gp)) = Int_of_integer (1 : IntInf.int) |
|
1622 |
| zeta (NEq (Neg gt)) = Int_of_integer (1 : IntInf.int) |
|
1623 |
| zeta (NEq (Add (gu, gv))) = Int_of_integer (1 : IntInf.int) |
|
1624 |
| zeta (NEq (Sub (gw, gx))) = Int_of_integer (1 : IntInf.int) |
|
1625 |
| zeta (NEq (Mul (gy, gz))) = Int_of_integer (1 : IntInf.int) |
|
1626 |
| zeta (Dvd (aa, C ho)) = Int_of_integer (1 : IntInf.int) |
|
1627 |
| zeta (Dvd (aa, Bound hp)) = Int_of_integer (1 : IntInf.int) |
|
1628 |
| zeta (Dvd (aa, Neg ht)) = Int_of_integer (1 : IntInf.int) |
|
1629 |
| zeta (Dvd (aa, Add (hu, hv))) = Int_of_integer (1 : IntInf.int) |
|
1630 |
| zeta (Dvd (aa, Sub (hw, hx))) = Int_of_integer (1 : IntInf.int) |
|
1631 |
| zeta (Dvd (aa, Mul (hy, hz))) = Int_of_integer (1 : IntInf.int) |
|
1632 |
| zeta (NDvd (ac, C io)) = Int_of_integer (1 : IntInf.int) |
|
1633 |
| zeta (NDvd (ac, Bound ip)) = Int_of_integer (1 : IntInf.int) |
|
1634 |
| zeta (NDvd (ac, Neg it)) = Int_of_integer (1 : IntInf.int) |
|
1635 |
| zeta (NDvd (ac, Add (iu, iv))) = Int_of_integer (1 : IntInf.int) |
|
1636 |
| zeta (NDvd (ac, Sub (iw, ix))) = Int_of_integer (1 : IntInf.int) |
|
1637 |
| zeta (NDvd (ac, Mul (iy, iz))) = Int_of_integer (1 : IntInf.int) |
|
61128 | 1638 |
| zeta (NOT ae) = Int_of_integer (1 : IntInf.int) |
55685 | 1639 |
| zeta (Imp (aj, ak)) = Int_of_integer (1 : IntInf.int) |
1640 |
| zeta (Iff (al, am)) = Int_of_integer (1 : IntInf.int) |
|
1641 |
| zeta (E an) = Int_of_integer (1 : IntInf.int) |
|
1642 |
| zeta (A ao) = Int_of_integer (1 : IntInf.int) |
|
1643 |
| zeta (Closed ap) = Int_of_integer (1 : IntInf.int) |
|
1644 |
| zeta (NClosed aq) = Int_of_integer (1 : IntInf.int) |
|
61128 | 1645 |
| zeta (Lt (CN (cm, c, e))) = |
55685 | 1646 |
(if equal_nat cm zero_nat then c else Int_of_integer (1 : IntInf.int)) |
61128 | 1647 |
| zeta (Le (CN (dm, c, e))) = |
55685 | 1648 |
(if equal_nat dm zero_nat then c else Int_of_integer (1 : IntInf.int)) |
61128 | 1649 |
| zeta (Gt (CN (em, c, e))) = |
55685 | 1650 |
(if equal_nat em zero_nat then c else Int_of_integer (1 : IntInf.int)) |
61128 | 1651 |
| zeta (Ge (CN (fm, c, e))) = |
55685 | 1652 |
(if equal_nat fm zero_nat then c else Int_of_integer (1 : IntInf.int)) |
61128 | 1653 |
| zeta (Eq (CN (gm, c, e))) = |
55685 | 1654 |
(if equal_nat gm zero_nat then c else Int_of_integer (1 : IntInf.int)) |
61128 | 1655 |
| zeta (NEq (CN (hm, c, e))) = |
55685 | 1656 |
(if equal_nat hm zero_nat then c else Int_of_integer (1 : IntInf.int)) |
61128 | 1657 |
| zeta (Dvd (i, CN (im, c, e))) = |
55685 | 1658 |
(if equal_nat im zero_nat then c else Int_of_integer (1 : IntInf.int)) |
61128 | 1659 |
| zeta (NDvd (i, CN (jm, c, e))) = |
55685 | 1660 |
(if equal_nat jm zero_nat then c else Int_of_integer (1 : IntInf.int)); |
1661 |
||
1662 |
fun beta (And (p, q)) = beta p @ beta q |
|
1663 |
| beta (Or (p, q)) = beta p @ beta q |
|
1664 |
| beta T = [] |
|
1665 |
| beta F = [] |
|
1666 |
| beta (Lt (C bo)) = [] |
|
1667 |
| beta (Lt (Bound bp)) = [] |
|
1668 |
| beta (Lt (Neg bt)) = [] |
|
1669 |
| beta (Lt (Add (bu, bv))) = [] |
|
1670 |
| beta (Lt (Sub (bw, bx))) = [] |
|
1671 |
| beta (Lt (Mul (by, bz))) = [] |
|
1672 |
| beta (Le (C co)) = [] |
|
1673 |
| beta (Le (Bound cp)) = [] |
|
1674 |
| beta (Le (Neg ct)) = [] |
|
1675 |
| beta (Le (Add (cu, cv))) = [] |
|
1676 |
| beta (Le (Sub (cw, cx))) = [] |
|
1677 |
| beta (Le (Mul (cy, cz))) = [] |
|
1678 |
| beta (Gt (C doa)) = [] |
|
1679 |
| beta (Gt (Bound dp)) = [] |
|
1680 |
| beta (Gt (Neg dt)) = [] |
|
1681 |
| beta (Gt (Add (du, dv))) = [] |
|
1682 |
| beta (Gt (Sub (dw, dx))) = [] |
|
1683 |
| beta (Gt (Mul (dy, dz))) = [] |
|
1684 |
| beta (Ge (C eo)) = [] |
|
1685 |
| beta (Ge (Bound ep)) = [] |
|
1686 |
| beta (Ge (Neg et)) = [] |
|
1687 |
| beta (Ge (Add (eu, ev))) = [] |
|
1688 |
| beta (Ge (Sub (ew, ex))) = [] |
|
1689 |
| beta (Ge (Mul (ey, ez))) = [] |
|
1690 |
| beta (Eq (C fo)) = [] |
|
1691 |
| beta (Eq (Bound fp)) = [] |
|
1692 |
| beta (Eq (Neg ft)) = [] |
|
1693 |
| beta (Eq (Add (fu, fv))) = [] |
|
1694 |
| beta (Eq (Sub (fw, fx))) = [] |
|
1695 |
| beta (Eq (Mul (fy, fz))) = [] |
|
1696 |
| beta (NEq (C go)) = [] |
|
1697 |
| beta (NEq (Bound gp)) = [] |
|
1698 |
| beta (NEq (Neg gt)) = [] |
|
1699 |
| beta (NEq (Add (gu, gv))) = [] |
|
1700 |
| beta (NEq (Sub (gw, gx))) = [] |
|
1701 |
| beta (NEq (Mul (gy, gz))) = [] |
|
1702 |
| beta (Dvd (aa, ab)) = [] |
|
1703 |
| beta (NDvd (ac, ad)) = [] |
|
61128 | 1704 |
| beta (NOT ae) = [] |
55685 | 1705 |
| beta (Imp (aj, ak)) = [] |
1706 |
| beta (Iff (al, am)) = [] |
|
1707 |
| beta (E an) = [] |
|
1708 |
| beta (A ao) = [] |
|
1709 |
| beta (Closed ap) = [] |
|
1710 |
| beta (NClosed aq) = [] |
|
61128 | 1711 |
| beta (Lt (CN (cm, c, e))) = (if equal_nat cm zero_nat then [] else []) |
1712 |
| beta (Le (CN (dm, c, e))) = (if equal_nat dm zero_nat then [] else []) |
|
1713 |
| beta (Gt (CN (em, c, e))) = (if equal_nat em zero_nat then [Neg e] else []) |
|
1714 |
| beta (Ge (CN (fm, c, e))) = |
|
55685 | 1715 |
(if equal_nat fm zero_nat |
1716 |
then [Sub (C (uminus_int (Int_of_integer (1 : IntInf.int))), e)] else []) |
|
61128 | 1717 |
| beta (Eq (CN (gm, c, e))) = |
55685 | 1718 |
(if equal_nat gm zero_nat |
1719 |
then [Sub (C (uminus_int (Int_of_integer (1 : IntInf.int))), e)] else []) |
|
61128 | 1720 |
| beta (NEq (CN (hm, c, e))) = |
55685 | 1721 |
(if equal_nat hm zero_nat then [Neg e] else []); |
1722 |
||
1723 |
fun mirror (And (p, q)) = And (mirror p, mirror q) |
|
1724 |
| mirror (Or (p, q)) = Or (mirror p, mirror q) |
|
1725 |
| mirror T = T |
|
1726 |
| mirror F = F |
|
1727 |
| mirror (Lt (C bo)) = Lt (C bo) |
|
1728 |
| mirror (Lt (Bound bp)) = Lt (Bound bp) |
|
1729 |
| mirror (Lt (Neg bt)) = Lt (Neg bt) |
|
1730 |
| mirror (Lt (Add (bu, bv))) = Lt (Add (bu, bv)) |
|
1731 |
| mirror (Lt (Sub (bw, bx))) = Lt (Sub (bw, bx)) |
|
1732 |
| mirror (Lt (Mul (by, bz))) = Lt (Mul (by, bz)) |
|
1733 |
| mirror (Le (C co)) = Le (C co) |
|
1734 |
| mirror (Le (Bound cp)) = Le (Bound cp) |
|
1735 |
| mirror (Le (Neg ct)) = Le (Neg ct) |
|
1736 |
| mirror (Le (Add (cu, cv))) = Le (Add (cu, cv)) |
|
1737 |
| mirror (Le (Sub (cw, cx))) = Le (Sub (cw, cx)) |
|
1738 |
| mirror (Le (Mul (cy, cz))) = Le (Mul (cy, cz)) |
|
1739 |
| mirror (Gt (C doa)) = Gt (C doa) |
|
1740 |
| mirror (Gt (Bound dp)) = Gt (Bound dp) |
|
1741 |
| mirror (Gt (Neg dt)) = Gt (Neg dt) |
|
1742 |
| mirror (Gt (Add (du, dv))) = Gt (Add (du, dv)) |
|
1743 |
| mirror (Gt (Sub (dw, dx))) = Gt (Sub (dw, dx)) |
|
1744 |
| mirror (Gt (Mul (dy, dz))) = Gt (Mul (dy, dz)) |
|
1745 |
| mirror (Ge (C eo)) = Ge (C eo) |
|
1746 |
| mirror (Ge (Bound ep)) = Ge (Bound ep) |
|
1747 |
| mirror (Ge (Neg et)) = Ge (Neg et) |
|
1748 |
| mirror (Ge (Add (eu, ev))) = Ge (Add (eu, ev)) |
|
1749 |
| mirror (Ge (Sub (ew, ex))) = Ge (Sub (ew, ex)) |
|
1750 |
| mirror (Ge (Mul (ey, ez))) = Ge (Mul (ey, ez)) |
|
1751 |
| mirror (Eq (C fo)) = Eq (C fo) |
|
1752 |
| mirror (Eq (Bound fp)) = Eq (Bound fp) |
|
1753 |
| mirror (Eq (Neg ft)) = Eq (Neg ft) |
|
1754 |
| mirror (Eq (Add (fu, fv))) = Eq (Add (fu, fv)) |
|
1755 |
| mirror (Eq (Sub (fw, fx))) = Eq (Sub (fw, fx)) |
|
1756 |
| mirror (Eq (Mul (fy, fz))) = Eq (Mul (fy, fz)) |
|
1757 |
| mirror (NEq (C go)) = NEq (C go) |
|
1758 |
| mirror (NEq (Bound gp)) = NEq (Bound gp) |
|
1759 |
| mirror (NEq (Neg gt)) = NEq (Neg gt) |
|
1760 |
| mirror (NEq (Add (gu, gv))) = NEq (Add (gu, gv)) |
|
1761 |
| mirror (NEq (Sub (gw, gx))) = NEq (Sub (gw, gx)) |
|
1762 |
| mirror (NEq (Mul (gy, gz))) = NEq (Mul (gy, gz)) |
|
1763 |
| mirror (Dvd (aa, C ho)) = Dvd (aa, C ho) |
|
1764 |
| mirror (Dvd (aa, Bound hp)) = Dvd (aa, Bound hp) |
|
1765 |
| mirror (Dvd (aa, Neg ht)) = Dvd (aa, Neg ht) |
|
1766 |
| mirror (Dvd (aa, Add (hu, hv))) = Dvd (aa, Add (hu, hv)) |
|
1767 |
| mirror (Dvd (aa, Sub (hw, hx))) = Dvd (aa, Sub (hw, hx)) |
|
1768 |
| mirror (Dvd (aa, Mul (hy, hz))) = Dvd (aa, Mul (hy, hz)) |
|
1769 |
| mirror (NDvd (ac, C io)) = NDvd (ac, C io) |
|
1770 |
| mirror (NDvd (ac, Bound ip)) = NDvd (ac, Bound ip) |
|
1771 |
| mirror (NDvd (ac, Neg it)) = NDvd (ac, Neg it) |
|
1772 |
| mirror (NDvd (ac, Add (iu, iv))) = NDvd (ac, Add (iu, iv)) |
|
1773 |
| mirror (NDvd (ac, Sub (iw, ix))) = NDvd (ac, Sub (iw, ix)) |
|
1774 |
| mirror (NDvd (ac, Mul (iy, iz))) = NDvd (ac, Mul (iy, iz)) |
|
61128 | 1775 |
| mirror (NOT ae) = NOT ae |
55685 | 1776 |
| mirror (Imp (aj, ak)) = Imp (aj, ak) |
1777 |
| mirror (Iff (al, am)) = Iff (al, am) |
|
1778 |
| mirror (E an) = E an |
|
1779 |
| mirror (A ao) = A ao |
|
1780 |
| mirror (Closed ap) = Closed ap |
|
1781 |
| mirror (NClosed aq) = NClosed aq |
|
61128 | 1782 |
| mirror (Lt (CN (cm, c, e))) = |
1783 |
(if equal_nat cm zero_nat then Gt (CN (zero_nat, c, Neg e)) |
|
1784 |
else Lt (CN (suc (minus_nat cm one_nat), c, e))) |
|
1785 |
| mirror (Le (CN (dm, c, e))) = |
|
1786 |
(if equal_nat dm zero_nat then Ge (CN (zero_nat, c, Neg e)) |
|
1787 |
else Le (CN (suc (minus_nat dm one_nat), c, e))) |
|
1788 |
| mirror (Gt (CN (em, c, e))) = |
|
1789 |
(if equal_nat em zero_nat then Lt (CN (zero_nat, c, Neg e)) |
|
1790 |
else Gt (CN (suc (minus_nat em one_nat), c, e))) |
|
1791 |
| mirror (Ge (CN (fm, c, e))) = |
|
1792 |
(if equal_nat fm zero_nat then Le (CN (zero_nat, c, Neg e)) |
|
1793 |
else Ge (CN (suc (minus_nat fm one_nat), c, e))) |
|
1794 |
| mirror (Eq (CN (gm, c, e))) = |
|
1795 |
(if equal_nat gm zero_nat then Eq (CN (zero_nat, c, Neg e)) |
|
1796 |
else Eq (CN (suc (minus_nat gm one_nat), c, e))) |
|
1797 |
| mirror (NEq (CN (hm, c, e))) = |
|
1798 |
(if equal_nat hm zero_nat then NEq (CN (zero_nat, c, Neg e)) |
|
1799 |
else NEq (CN (suc (minus_nat hm one_nat), c, e))) |
|
1800 |
| mirror (Dvd (i, CN (im, c, e))) = |
|
1801 |
(if equal_nat im zero_nat then Dvd (i, CN (zero_nat, c, Neg e)) |
|
1802 |
else Dvd (i, CN (suc (minus_nat im one_nat), c, e))) |
|
1803 |
| mirror (NDvd (i, CN (jm, c, e))) = |
|
1804 |
(if equal_nat jm zero_nat then NDvd (i, CN (zero_nat, c, Neg e)) |
|
1805 |
else NDvd (i, CN (suc (minus_nat jm one_nat), c, e))); |
|
55685 | 1806 |
|
1807 |
fun member A_ [] y = false |
|
1808 |
| member A_ (x :: xs) y = eq A_ x y orelse member A_ xs y; |
|
1809 |
||
1810 |
fun remdups A_ [] = [] |
|
1811 |
| remdups A_ (x :: xs) = |
|
1812 |
(if member A_ xs x then remdups A_ xs else x :: remdups A_ xs); |
|
1813 |
||
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1814 |
fun zsplit0 (C c) = (zero_inta, C c) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1815 |
| zsplit0 (Bound n) = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1816 |
(if equal_nat n zero_nat then (Int_of_integer (1 : IntInf.int), C zero_inta) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1817 |
else (zero_inta, Bound n)) |
61128 | 1818 |
| zsplit0 (CN (n, i, a)) = |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1819 |
let |
61128 | 1820 |
val aa = zsplit0 a; |
1821 |
val (ia, ab) = aa; |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1822 |
in |
61128 | 1823 |
(if equal_nat n zero_nat then (plus_inta i ia, ab) |
1824 |
else (ia, CN (n, i, ab))) |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1825 |
end |
61128 | 1826 |
| zsplit0 (Neg a) = |
1827 |
let |
|
1828 |
val aa = zsplit0 a; |
|
1829 |
val (i, ab) = aa; |
|
1830 |
in |
|
1831 |
(uminus_int i, Neg ab) |
|
1832 |
end |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1833 |
| zsplit0 (Add (a, b)) = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1834 |
let |
61128 | 1835 |
val aa = zsplit0 a; |
1836 |
val (ia, ab) = aa; |
|
1837 |
val ba = zsplit0 b; |
|
1838 |
val (ib, bb) = ba; |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1839 |
in |
61128 | 1840 |
(plus_inta ia ib, Add (ab, bb)) |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1841 |
end |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1842 |
| zsplit0 (Sub (a, b)) = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1843 |
let |
61128 | 1844 |
val aa = zsplit0 a; |
1845 |
val (ia, ab) = aa; |
|
1846 |
val ba = zsplit0 b; |
|
1847 |
val (ib, bb) = ba; |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1848 |
in |
61128 | 1849 |
(minus_inta ia ib, Sub (ab, bb)) |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1850 |
end |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1851 |
| zsplit0 (Mul (i, a)) = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1852 |
let |
61128 | 1853 |
val aa = zsplit0 a; |
1854 |
val (ia, ab) = aa; |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1855 |
in |
61128 | 1856 |
(times_inta i ia, Mul (i, ab)) |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1857 |
end; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1858 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1859 |
fun zlfm (And (p, q)) = And (zlfm p, zlfm q) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1860 |
| zlfm (Or (p, q)) = Or (zlfm p, zlfm q) |
61128 | 1861 |
| zlfm (Imp (p, q)) = Or (zlfm (NOT p), zlfm q) |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1862 |
| zlfm (Iff (p, q)) = |
61128 | 1863 |
Or (And (zlfm p, zlfm q), And (zlfm (NOT p), zlfm (NOT q))) |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1864 |
| zlfm (Lt a) = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1865 |
let |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1866 |
val (c, r) = zsplit0 a; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1867 |
in |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1868 |
(if equal_inta c zero_inta then Lt r |
61128 | 1869 |
else (if less_int zero_inta c then Lt (CN (zero_nat, c, r)) |
1870 |
else Gt (CN (zero_nat, uminus_int c, Neg r)))) |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1871 |
end |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1872 |
| zlfm (Le a) = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1873 |
let |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1874 |
val (c, r) = zsplit0 a; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1875 |
in |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1876 |
(if equal_inta c zero_inta then Le r |
61128 | 1877 |
else (if less_int zero_inta c then Le (CN (zero_nat, c, r)) |
1878 |
else Ge (CN (zero_nat, uminus_int c, Neg r)))) |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1879 |
end |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1880 |
| zlfm (Gt a) = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1881 |
let |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1882 |
val (c, r) = zsplit0 a; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1883 |
in |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1884 |
(if equal_inta c zero_inta then Gt r |
61128 | 1885 |
else (if less_int zero_inta c then Gt (CN (zero_nat, c, r)) |
1886 |
else Lt (CN (zero_nat, uminus_int c, Neg r)))) |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1887 |
end |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1888 |
| zlfm (Ge a) = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1889 |
let |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1890 |
val (c, r) = zsplit0 a; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1891 |
in |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1892 |
(if equal_inta c zero_inta then Ge r |
61128 | 1893 |
else (if less_int zero_inta c then Ge (CN (zero_nat, c, r)) |
1894 |
else Le (CN (zero_nat, uminus_int c, Neg r)))) |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1895 |
end |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1896 |
| zlfm (Eq a) = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1897 |
let |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1898 |
val (c, r) = zsplit0 a; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1899 |
in |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1900 |
(if equal_inta c zero_inta then Eq r |
61128 | 1901 |
else (if less_int zero_inta c then Eq (CN (zero_nat, c, r)) |
1902 |
else Eq (CN (zero_nat, uminus_int c, Neg r)))) |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1903 |
end |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1904 |
| zlfm (NEq a) = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1905 |
let |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1906 |
val (c, r) = zsplit0 a; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1907 |
in |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1908 |
(if equal_inta c zero_inta then NEq r |
61128 | 1909 |
else (if less_int zero_inta c then NEq (CN (zero_nat, c, r)) |
1910 |
else NEq (CN (zero_nat, uminus_int c, Neg r)))) |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1911 |
end |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1912 |
| zlfm (Dvd (i, a)) = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1913 |
(if equal_inta i zero_inta then zlfm (Eq a) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1914 |
else let |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1915 |
val (c, r) = zsplit0 a; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1916 |
in |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1917 |
(if equal_inta c zero_inta then Dvd (abs_int i, r) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1918 |
else (if less_int zero_inta c |
61128 | 1919 |
then Dvd (abs_int i, CN (zero_nat, c, r)) |
1920 |
else Dvd (abs_int i, CN (zero_nat, uminus_int c, Neg r)))) |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1921 |
end) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1922 |
| zlfm (NDvd (i, a)) = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1923 |
(if equal_inta i zero_inta then zlfm (NEq a) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1924 |
else let |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1925 |
val (c, r) = zsplit0 a; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1926 |
in |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1927 |
(if equal_inta c zero_inta then NDvd (abs_int i, r) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1928 |
else (if less_int zero_inta c |
61128 | 1929 |
then NDvd (abs_int i, CN (zero_nat, c, r)) |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1930 |
else NDvd (abs_int i, |
61128 | 1931 |
CN (zero_nat, uminus_int c, Neg r)))) |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1932 |
end) |
61128 | 1933 |
| zlfm (NOT (And (p, q))) = Or (zlfm (NOT p), zlfm (NOT q)) |
1934 |
| zlfm (NOT (Or (p, q))) = And (zlfm (NOT p), zlfm (NOT q)) |
|
1935 |
| zlfm (NOT (Imp (p, q))) = And (zlfm p, zlfm (NOT q)) |
|
1936 |
| zlfm (NOT (Iff (p, q))) = |
|
1937 |
Or (And (zlfm p, zlfm (NOT q)), And (zlfm (NOT p), zlfm q)) |
|
1938 |
| zlfm (NOT (NOT p)) = zlfm p |
|
1939 |
| zlfm (NOT T) = F |
|
1940 |
| zlfm (NOT F) = T |
|
1941 |
| zlfm (NOT (Lt a)) = zlfm (Ge a) |
|
1942 |
| zlfm (NOT (Le a)) = zlfm (Gt a) |
|
1943 |
| zlfm (NOT (Gt a)) = zlfm (Le a) |
|
1944 |
| zlfm (NOT (Ge a)) = zlfm (Lt a) |
|
1945 |
| zlfm (NOT (Eq a)) = zlfm (NEq a) |
|
1946 |
| zlfm (NOT (NEq a)) = zlfm (Eq a) |
|
1947 |
| zlfm (NOT (Dvd (i, a))) = zlfm (NDvd (i, a)) |
|
1948 |
| zlfm (NOT (NDvd (i, a))) = zlfm (Dvd (i, a)) |
|
1949 |
| zlfm (NOT (Closed p)) = NClosed p |
|
1950 |
| zlfm (NOT (NClosed p)) = Closed p |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1951 |
| zlfm T = T |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1952 |
| zlfm F = F |
61128 | 1953 |
| zlfm (NOT (E ci)) = NOT (E ci) |
1954 |
| zlfm (NOT (A cj)) = NOT (A cj) |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1955 |
| zlfm (E ao) = E ao |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1956 |
| zlfm (A ap) = A ap |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1957 |
| zlfm (Closed aq) = Closed aq |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1958 |
| zlfm (NClosed ar) = NClosed ar; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1959 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1960 |
fun unita p = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1961 |
let |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1962 |
val pa = zlfm p; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1963 |
val l = zeta pa; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1964 |
val q = |
61128 | 1965 |
And (Dvd (l, CN (zero_nat, Int_of_integer (1 : IntInf.int), C zero_inta)), |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1966 |
a_beta pa l); |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1967 |
val d = delta q; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1968 |
val b = remdups equal_num (map simpnum (beta q)); |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1969 |
val a = remdups equal_num (map simpnum (alpha q)); |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1970 |
in |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1971 |
(if less_eq_nat (size_list b) (size_list a) then (q, (b, d)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1972 |
else (mirror q, (a, d))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1973 |
end; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1974 |
|
55685 | 1975 |
fun decrnum (Bound n) = Bound (minus_nat n one_nat) |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1976 |
| decrnum (Neg a) = Neg (decrnum a) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1977 |
| decrnum (Add (a, b)) = Add (decrnum a, decrnum b) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1978 |
| decrnum (Sub (a, b)) = Sub (decrnum a, decrnum b) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1979 |
| decrnum (Mul (c, a)) = Mul (c, decrnum a) |
61128 | 1980 |
| decrnum (CN (n, i, a)) = CN (minus_nat n one_nat, i, decrnum a) |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1981 |
| decrnum (C v) = C v; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1982 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1983 |
fun decr (Lt a) = Lt (decrnum a) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1984 |
| decr (Le a) = Le (decrnum a) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1985 |
| decr (Gt a) = Gt (decrnum a) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1986 |
| decr (Ge a) = Ge (decrnum a) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1987 |
| decr (Eq a) = Eq (decrnum a) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1988 |
| decr (NEq a) = NEq (decrnum a) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1989 |
| decr (Dvd (i, a)) = Dvd (i, decrnum a) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1990 |
| decr (NDvd (i, a)) = NDvd (i, decrnum a) |
61128 | 1991 |
| decr (NOT p) = NOT (decr p) |
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1992 |
| decr (And (p, q)) = And (decr p, decr q) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1993 |
| decr (Or (p, q)) = Or (decr p, decr q) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1994 |
| decr (Imp (p, q)) = Imp (decr p, decr q) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1995 |
| decr (Iff (p, q)) = Iff (decr p, decr q) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1996 |
| decr T = T |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1997 |
| decr F = F |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1998 |
| decr (E v) = E v |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
1999 |
| decr (A v) = A v |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2000 |
| decr (Closed v) = Closed v |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2001 |
| decr (NClosed v) = NClosed v; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2002 |
|
55685 | 2003 |
fun upto_aux i j js = |
2004 |
(if less_int j i then js |
|
61128 | 2005 |
else upto_aux i (minus_inta j (Int_of_integer (1 : IntInf.int))) (j :: js)); |
55685 | 2006 |
|
2007 |
fun uptoa i j = upto_aux i j []; |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2008 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2009 |
fun maps f [] = [] |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2010 |
| maps f (x :: xs) = f x @ maps f xs; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2011 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2012 |
fun cooper p = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2013 |
let |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2014 |
val (q, (b, d)) = unita p; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2015 |
val js = uptoa (Int_of_integer (1 : IntInf.int)) d; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2016 |
val mq = simpfm (minusinf q); |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2017 |
val md = evaldjf (fn j => simpfm (subst0 (C j) mq)) js; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2018 |
in |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2019 |
(if equal_fm md T then T |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2020 |
else let |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2021 |
val qd = |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2022 |
evaldjf (fn (ba, j) => simpfm (subst0 (Add (ba, C j)) q)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2023 |
(maps (fn ba => map (fn a => (ba, a)) js) b); |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2024 |
in |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2025 |
decr (disj md qd) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2026 |
end) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2027 |
end; |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2028 |
|
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2029 |
fun qelim (E p) = (fn qe => dj qe (qelim p qe)) |
61128 | 2030 |
| qelim (A p) = (fn qe => nota (qe (qelim (NOT p) qe))) |
2031 |
| qelim (NOT p) = (fn qe => nota (qelim p qe)) |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2032 |
| qelim (And (p, q)) = (fn qe => conj (qelim p qe) (qelim q qe)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2033 |
| qelim (Or (p, q)) = (fn qe => disj (qelim p qe) (qelim q qe)) |
55685 | 2034 |
| qelim (Imp (p, q)) = (fn qe => imp (qelim p qe) (qelim q qe)) |
2035 |
| qelim (Iff (p, q)) = (fn qe => iff (qelim p qe) (qelim q qe)) |
|
51143
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2036 |
| qelim T = (fn _ => simpfm T) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2037 |
| qelim F = (fn _ => simpfm F) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2038 |
| qelim (Lt v) = (fn _ => simpfm (Lt v)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2039 |
| qelim (Le v) = (fn _ => simpfm (Le v)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2040 |
| qelim (Gt v) = (fn _ => simpfm (Gt v)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2041 |
| qelim (Ge v) = (fn _ => simpfm (Ge v)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2042 |
| qelim (Eq v) = (fn _ => simpfm (Eq v)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2043 |
| qelim (NEq v) = (fn _ => simpfm (NEq v)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2044 |
| qelim (Dvd (v, va)) = (fn _ => simpfm (Dvd (v, va))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2045 |
| qelim (NDvd (v, va)) = (fn _ => simpfm (NDvd (v, va))) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2046 |
| qelim (Closed v) = (fn _ => simpfm (Closed v)) |
0a2371e7ced3
two target language numeral types: integer and natural, as replacement for code_numeral;
haftmann
parents:
44930
diff
changeset
|
2047 |
| qelim (NClosed v) = (fn _ => simpfm (NClosed v)); |
23466 | 2048 |
|
29787 | 2049 |
fun prep (E T) = T |
2050 |
| prep (E F) = F |
|
2051 |
| prep (E (Or (p, q))) = Or (prep (E p), prep (E q)) |
|
61128 | 2052 |
| prep (E (Imp (p, q))) = Or (prep (E (NOT p)), prep (E q)) |
29787 | 2053 |
| prep (E (Iff (p, q))) = |
61128 | 2054 |
Or (prep (E (And (p, q))), prep (E (And (NOT p, NOT q)))) |
2055 |
| prep (E (NOT (And (p, q)))) = Or (prep (E (NOT p)), prep (E (NOT q))) |
|
2056 |
| prep (E (NOT (Imp (p, q)))) = prep (E (And (p, NOT q))) |
|
2057 |
| prep (E (NOT (Iff (p, q)))) = |
|
2058 |
Or (prep (E (And (p, NOT q))), prep (E (And (NOT p, q)))) |
|
29787 | 2059 |
| prep (E (Lt ef)) = E (prep (Lt ef)) |
2060 |
| prep (E (Le eg)) = E (prep (Le eg)) |
|
2061 |
| prep (E (Gt eh)) = E (prep (Gt eh)) |
|
2062 |
| prep (E (Ge ei)) = E (prep (Ge ei)) |
|
2063 |
| prep (E (Eq ej)) = E (prep (Eq ej)) |
|
2064 |
| prep (E (NEq ek)) = E (prep (NEq ek)) |
|
2065 |
| prep (E (Dvd (el, em))) = E (prep (Dvd (el, em))) |
|
2066 |
| prep (E (NDvd (en, eo))) = E (prep (NDvd (en, eo))) |
|
61128 | 2067 |
| prep (E (NOT T)) = E (prep (NOT T)) |
2068 |
| prep (E (NOT F)) = E (prep (NOT F)) |
|
2069 |
| prep (E (NOT (Lt gw))) = E (prep (NOT (Lt gw))) |
|
2070 |
| prep (E (NOT (Le gx))) = E (prep (NOT (Le gx))) |
|
2071 |
| prep (E (NOT (Gt gy))) = E (prep (NOT (Gt gy))) |
|
2072 |
| prep (E (NOT (Ge gz))) = E (prep (NOT (Ge gz))) |
|
2073 |
| prep (E (NOT (Eq ha))) = E (prep (NOT (Eq ha))) |
|
2074 |
| prep (E (NOT (NEq hb))) = E (prep (NOT (NEq hb))) |
|
2075 |
| prep (E (NOT (Dvd (hc, hd)))) = E (prep (NOT (Dvd (hc, hd)))) |
|
2076 |
| prep (E (NOT (NDvd (he, hf)))) = E (prep (NOT (NDvd (he, hf)))) |
|
2077 |
| prep (E (NOT (NOT hg))) = E (prep (NOT (NOT hg))) |
|
2078 |
| prep (E (NOT (Or (hj, hk)))) = E (prep (NOT (Or (hj, hk)))) |
|
2079 |
| prep (E (NOT (E hp))) = E (prep (NOT (E hp))) |
|
2080 |
| prep (E (NOT (A hq))) = E (prep (NOT (A hq))) |
|
2081 |
| prep (E (NOT (Closed hr))) = E (prep (NOT (Closed hr))) |
|
2082 |
| prep (E (NOT (NClosed hs))) = E (prep (NOT (NClosed hs))) |
|
29787 | 2083 |
| prep (E (And (eq, er))) = E (prep (And (eq, er))) |
2084 |
| prep (E (E ey)) = E (prep (E ey)) |
|
23689
0410269099dc
replaced code generator framework for reflected cooper
haftmann
parents:
23466
diff
changeset
|
2085 |
| prep (E (A ez)) = E (prep (A ez)) |
29787 | 2086 |
| prep (E (Closed fa)) = E (prep (Closed fa)) |
2087 |
| prep (E (NClosed fb)) = E (prep (NClosed fb)) |
|
2088 |
| prep (A (And (p, q))) = And (prep (A p), prep (A q)) |
|
61128 | 2089 |
| prep (A T) = prep (NOT (E (NOT T))) |
2090 |
| prep (A F) = prep (NOT (E (NOT F))) |
|
2091 |
| prep (A (Lt jn)) = prep (NOT (E (NOT (Lt jn)))) |
|
2092 |
| prep (A (Le jo)) = prep (NOT (E (NOT (Le jo)))) |
|
2093 |
| prep (A (Gt jp)) = prep (NOT (E (NOT (Gt jp)))) |
|
2094 |
| prep (A (Ge jq)) = prep (NOT (E (NOT (Ge jq)))) |
|
2095 |
| prep (A (Eq jr)) = prep (NOT (E (NOT (Eq jr)))) |
|
2096 |
| prep (A (NEq js)) = prep (NOT (E (NOT (NEq js)))) |
|
2097 |
| prep (A (Dvd (jt, ju))) = prep (NOT (E (NOT (Dvd (jt, ju))))) |
|
2098 |
| prep (A (NDvd (jv, jw))) = prep (NOT (E (NOT (NDvd (jv, jw))))) |
|
2099 |
| prep (A (NOT jx)) = prep (NOT (E (NOT (NOT jx)))) |
|
2100 |
| prep (A (Or (ka, kb))) = prep (NOT (E (NOT (Or (ka, kb))))) |
|
2101 |
| prep (A (Imp (kc, kd))) = prep (NOT (E (NOT (Imp (kc, kd))))) |
|
2102 |
| prep (A (Iff (ke, kf))) = prep (NOT (E (NOT (Iff (ke, kf))))) |
|
2103 |
| prep (A (E kg)) = prep (NOT (E (NOT (E kg)))) |
|
2104 |
| prep (A (A kh)) = prep (NOT (E (NOT (A kh)))) |
|
2105 |
| prep (A (Closed ki)) = prep (NOT (E (NOT (Closed ki)))) |
|
2106 |
| prep (A (NClosed kj)) = prep (NOT (E (NOT (NClosed kj)))) |
|
2107 |
| prep (NOT (NOT p)) = prep p |
|
2108 |
| prep (NOT (And (p, q))) = Or (prep (NOT p), prep (NOT q)) |
|
2109 |
| prep (NOT (A p)) = prep (E (NOT p)) |
|
2110 |
| prep (NOT (Or (p, q))) = And (prep (NOT p), prep (NOT q)) |
|
2111 |
| prep (NOT (Imp (p, q))) = And (prep p, prep (NOT q)) |
|
2112 |
| prep (NOT (Iff (p, q))) = Or (prep (And (p, NOT q)), prep (And (NOT p, q))) |
|
2113 |
| prep (NOT T) = NOT (prep T) |
|
2114 |
| prep (NOT F) = NOT (prep F) |
|
2115 |
| prep (NOT (Lt bo)) = NOT (prep (Lt bo)) |
|
2116 |
| prep (NOT (Le bp)) = NOT (prep (Le bp)) |
|
2117 |
| prep (NOT (Gt bq)) = NOT (prep (Gt bq)) |
|
2118 |
| prep (NOT (Ge br)) = NOT (prep (Ge br)) |
|
2119 |
| prep (NOT (Eq bs)) = NOT (prep (Eq bs)) |
|
2120 |
| prep (NOT (NEq bt)) = NOT (prep (NEq bt)) |
|
2121 |
| prep (NOT (Dvd (bu, bv))) = NOT (prep (Dvd (bu, bv))) |
|
2122 |
| prep (NOT (NDvd (bw, bx))) = NOT (prep (NDvd (bw, bx))) |
|
2123 |
| prep (NOT (E ch)) = NOT (prep (E ch)) |
|
2124 |
| prep (NOT (Closed cj)) = NOT (prep (Closed cj)) |
|
2125 |
| prep (NOT (NClosed ck)) = NOT (prep (NClosed ck)) |
|
29787 | 2126 |
| prep (Or (p, q)) = Or (prep p, prep q) |
2127 |
| prep (And (p, q)) = And (prep p, prep q) |
|
61128 | 2128 |
| prep (Imp (p, q)) = prep (Or (NOT p, q)) |
2129 |
| prep (Iff (p, q)) = Or (prep (And (p, q)), prep (And (NOT p, NOT q))) |
|
29787 | 2130 |
| prep T = T |
2131 |
| prep F = F |
|
2132 |
| prep (Lt u) = Lt u |
|
2133 |
| prep (Le v) = Le v |
|
2134 |
| prep (Gt w) = Gt w |
|
2135 |
| prep (Ge x) = Ge x |
|
2136 |
| prep (Eq y) = Eq y |
|
2137 |
| prep (NEq z) = NEq z |
|
2138 |
| prep (Dvd (aa, ab)) = Dvd (aa, ab) |
|
2139 |
| prep (NDvd (ac, ad)) = NDvd (ac, ad) |
|
2140 |
| prep (Closed ap) = Closed ap |
|
2141 |
| prep (NClosed aq) = NClosed aq; |
|
23466 | 2142 |
|
29787 | 2143 |
fun pa p = qelim (prep p) cooper; |
2144 |
||
61128 | 2145 |
fun nat_of_integer k = Nat (max ord_integer (0 : IntInf.int) k); |
55685 | 2146 |
|
36798 | 2147 |
end; (*struct Cooper_Procedure*) |