src/HOL/Tools/Qelim/generated_cooper.ML
author haftmann
Tue, 03 Feb 2009 16:50:40 +0100
changeset 29787 23bf900a21db
parent 24584 01e83ffa6c54
child 29823 0ab754d13ccd
permissions -rw-r--r--
regenerated presburger code
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24584
01e83ffa6c54 fixed title
haftmann
parents: 23714
diff changeset
     1
(*  Title:      HOL/Tools/Qelim/generated_cooper.ML
23689
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
     2
29787
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
     3
This file is generated from HOL/Reflection/Cooper.thy.  DO NOT EDIT.
23689
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
     4
*)
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
     5
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
     6
structure GeneratedCooper = 
23466
886655a150f6 moved quantifier elimination tools to Tools/Qelim/;
wenzelm
parents:
diff changeset
     7
struct
886655a150f6 moved quantifier elimination tools to Tools/Qelim/;
wenzelm
parents:
diff changeset
     8
23714
49b08f25db29 now a monolithic module
haftmann
parents: 23689
diff changeset
     9
type 'a eq = {eq : 'a -> 'a -> bool};
49b08f25db29 now a monolithic module
haftmann
parents: 23689
diff changeset
    10
fun eq (A_:'a eq) = #eq A_;
23466
886655a150f6 moved quantifier elimination tools to Tools/Qelim/;
wenzelm
parents:
diff changeset
    11
29787
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    12
val eq_nat = {eq = (fn a => fn b => ((a : IntInf.int) = b))} : IntInf.int eq;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    13
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    14
fun eqop A_ a b = eq A_ a b;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    15
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    16
fun divmod n m = (if eqop eq_nat m 0 then (0, n) else IntInf.divMod (n, m));
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    17
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    18
fun snd (a, y) = y;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    19
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    20
fun mod_nat m n = snd (divmod m n);
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    21
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    22
fun gcd m n = (if eqop eq_nat n 0 then m else gcd n (mod_nat m n));
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    23
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    24
fun fst (y, b) = y;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    25
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    26
fun div_nat m n = fst (divmod m n);
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    27
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    28
fun lcm m n = div_nat (IntInf.* (m, n)) (gcd m n);
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    29
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    30
fun leta s f = f s;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    31
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    32
fun suc n = IntInf.+ (n, 1);
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    33
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    34
datatype num = Mul of IntInf.int * num | Sub of num * num | Add of num * num |
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    35
  Neg of num | Cn of IntInf.int * IntInf.int * num | Bound of IntInf.int |
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    36
  C of IntInf.int;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    37
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    38
datatype fm = NClosed of IntInf.int | Closed of IntInf.int | A of fm | E of fm |
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    39
  Iff of fm * fm | Imp of fm * fm | Or of fm * fm | And of fm * fm | Not of fm |
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    40
  NDvd of IntInf.int * num | Dvd of IntInf.int * num | NEq of num | Eq of num |
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    41
  Ge of num | Gt of num | Le of num | Lt of num | F | T;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    42
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    43
fun abs_int i = (if IntInf.< (i, (0 : IntInf.int)) then IntInf.~ i else i);
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    44
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    45
fun zlcm i j =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    46
  (lcm (IntInf.max (0, (abs_int i))) (IntInf.max (0, (abs_int j))));
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    47
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    48
fun map f [] = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    49
  | map f (x :: xs) = f x :: map f xs;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    50
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    51
fun append [] y = y
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    52
  | append (x :: xs) ys = x :: append xs ys;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    53
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    54
fun disjuncts (Or (p, q)) = append (disjuncts p) (disjuncts q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    55
  | disjuncts F = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    56
  | disjuncts T = [T]
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    57
  | disjuncts (Lt u) = [Lt u]
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    58
  | disjuncts (Le v) = [Le v]
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    59
  | disjuncts (Gt w) = [Gt w]
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    60
  | disjuncts (Ge x) = [Ge x]
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    61
  | disjuncts (Eq y) = [Eq y]
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    62
  | disjuncts (NEq z) = [NEq z]
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    63
  | disjuncts (Dvd (aa, ab)) = [Dvd (aa, ab)]
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    64
  | disjuncts (NDvd (ac, ad)) = [NDvd (ac, ad)]
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    65
  | disjuncts (Not ae) = [Not ae]
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    66
  | disjuncts (And (af, ag)) = [And (af, ag)]
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    67
  | disjuncts (Imp (aj, ak)) = [Imp (aj, ak)]
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    68
  | disjuncts (Iff (al, am)) = [Iff (al, am)]
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    69
  | disjuncts (E an) = [E an]
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    70
  | disjuncts (A ao) = [A ao]
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    71
  | disjuncts (Closed ap) = [Closed ap]
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    72
  | disjuncts (NClosed aq) = [NClosed aq];
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    73
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    74
fun fm_case f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    75
  (NClosed nat) = f19 nat
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    76
  | fm_case f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    77
    (Closed nat) = f18 nat
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    78
  | fm_case f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    79
    (A fm) = f17 fm
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    80
  | fm_case f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    81
    (E fm) = f16 fm
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    82
  | fm_case f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    83
    (Iff (fm1, fm2)) = f15 fm1 fm2
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    84
  | fm_case f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    85
    (Imp (fm1, fm2)) = f14 fm1 fm2
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    86
  | fm_case f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    87
    (Or (fm1, fm2)) = f13 fm1 fm2
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    88
  | fm_case f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    89
    (And (fm1, fm2)) = f12 fm1 fm2
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    90
  | fm_case f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    91
    (Not fm) = f11 fm
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    92
  | fm_case f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    93
    (NDvd (inta, num)) = f10 inta num
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    94
  | fm_case f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    95
    (Dvd (inta, num)) = f9 inta num
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    96
  | fm_case f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    97
    (NEq num) = f8 num
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    98
  | fm_case f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
    99
    (Eq num) = f7 num
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   100
  | fm_case f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   101
    (Ge num) = f6 num
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   102
  | fm_case f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   103
    (Gt num) = f5 num
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   104
  | fm_case f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   105
    (Le num) = f4 num
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   106
  | fm_case f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   107
    (Lt num) = f3 num
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   108
  | fm_case f1 y f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19 F
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   109
    = y
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   110
  | fm_case y f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19 T
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   111
    = y;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   112
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   113
fun eq_num (Mul (cb, dc)) (Sub (ae, be)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   114
  | eq_num (Mul (cb, dc)) (Add (ae, be)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   115
  | eq_num (Sub (cc, dc)) (Add (ae, be)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   116
  | eq_num (Mul (bd, cc)) (Neg ae) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   117
  | eq_num (Sub (be, cc)) (Neg ae) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   118
  | eq_num (Add (be, cc)) (Neg ae) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   119
  | eq_num (Mul (db, ea)) (Cn (ac, bd, cc)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   120
  | eq_num (Sub (dc, ea)) (Cn (ac, bd, cc)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   121
  | eq_num (Add (dc, ea)) (Cn (ac, bd, cc)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   122
  | eq_num (Neg dc) (Cn (ac, bd, cc)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   123
  | eq_num (Mul (bd, cc)) (Bound ac) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   124
  | eq_num (Sub (be, cc)) (Bound ac) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   125
  | eq_num (Add (be, cc)) (Bound ac) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   126
  | eq_num (Neg be) (Bound ac) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   127
  | eq_num (Cn (bc, cb, dc)) (Bound ac) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   128
  | eq_num (Mul (bd, cc)) (C ad) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   129
  | eq_num (Sub (be, cc)) (C ad) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   130
  | eq_num (Add (be, cc)) (C ad) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   131
  | eq_num (Neg be) (C ad) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   132
  | eq_num (Cn (bc, cb, dc)) (C ad) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   133
  | eq_num (Bound bc) (C ad) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   134
  | eq_num (Sub (ab, bb)) (Mul (c, da)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   135
  | eq_num (Add (ab, bb)) (Mul (c, da)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   136
  | eq_num (Add (ab, bb)) (Sub (ca, da)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   137
  | eq_num (Neg ab) (Mul (ba, ca)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   138
  | eq_num (Neg ab) (Sub (bb, ca)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   139
  | eq_num (Neg ab) (Add (bb, ca)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   140
  | eq_num (Cn (a, ba, ca)) (Mul (d, e)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   141
  | eq_num (Cn (a, ba, ca)) (Sub (da, e)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   142
  | eq_num (Cn (a, ba, ca)) (Add (da, e)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   143
  | eq_num (Cn (a, ba, ca)) (Neg da) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   144
  | eq_num (Bound a) (Mul (ba, ca)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   145
  | eq_num (Bound a) (Sub (bb, ca)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   146
  | eq_num (Bound a) (Add (bb, ca)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   147
  | eq_num (Bound a) (Neg bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   148
  | eq_num (Bound a) (Cn (b, c, da)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   149
  | eq_num (C aa) (Mul (ba, ca)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   150
  | eq_num (C aa) (Sub (bb, ca)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   151
  | eq_num (C aa) (Add (bb, ca)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   152
  | eq_num (C aa) (Neg bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   153
  | eq_num (C aa) (Cn (b, c, da)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   154
  | eq_num (C aa) (Bound b) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   155
  | eq_num (Mul (inta, num)) (Mul (int', num')) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   156
    ((inta : IntInf.int) = int') andalso eq_num num num'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   157
  | eq_num (Sub (num1, num2)) (Sub (num1', num2')) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   158
    eq_num num1 num1' andalso eq_num num2 num2'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   159
  | eq_num (Add (num1, num2)) (Add (num1', num2')) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   160
    eq_num num1 num1' andalso eq_num num2 num2'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   161
  | eq_num (Neg num) (Neg num') = eq_num num num'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   162
  | eq_num (Cn (nat, inta, num)) (Cn (nat', int', num')) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   163
    ((nat : IntInf.int) = nat') andalso
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   164
      (((inta : IntInf.int) = int') andalso eq_num num num')
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   165
  | eq_num (Bound nat) (Bound nat') = ((nat : IntInf.int) = nat')
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   166
  | eq_num (C inta) (C int') = ((inta : IntInf.int) = int');
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   167
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   168
fun eq_fm (NClosed bd) (Closed ad) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   169
  | eq_fm (NClosed bd) (A af) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   170
  | eq_fm (Closed bd) (A af) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   171
  | eq_fm (NClosed bd) (E af) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   172
  | eq_fm (Closed bd) (E af) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   173
  | eq_fm (A bf) (E af) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   174
  | eq_fm (NClosed cd) (Iff (af, bf)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   175
  | eq_fm (Closed cd) (Iff (af, bf)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   176
  | eq_fm (A cf) (Iff (af, bf)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   177
  | eq_fm (E cf) (Iff (af, bf)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   178
  | eq_fm (NClosed cd) (Imp (af, bf)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   179
  | eq_fm (Closed cd) (Imp (af, bf)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   180
  | eq_fm (A cf) (Imp (af, bf)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   181
  | eq_fm (E cf) (Imp (af, bf)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   182
  | eq_fm (Iff (cf, db)) (Imp (af, bf)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   183
  | eq_fm (NClosed cd) (Or (af, bf)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   184
  | eq_fm (Closed cd) (Or (af, bf)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   185
  | eq_fm (A cf) (Or (af, bf)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   186
  | eq_fm (E cf) (Or (af, bf)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   187
  | eq_fm (Iff (cf, db)) (Or (af, bf)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   188
  | eq_fm (Imp (cf, db)) (Or (af, bf)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   189
  | eq_fm (NClosed cd) (And (af, bf)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   190
  | eq_fm (Closed cd) (And (af, bf)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   191
  | eq_fm (A cf) (And (af, bf)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   192
  | eq_fm (E cf) (And (af, bf)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   193
  | eq_fm (Iff (cf, db)) (And (af, bf)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   194
  | eq_fm (Imp (cf, db)) (And (af, bf)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   195
  | eq_fm (Or (cf, db)) (And (af, bf)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   196
  | eq_fm (NClosed bd) (Not af) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   197
  | eq_fm (Closed bd) (Not af) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   198
  | eq_fm (A bf) (Not af) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   199
  | eq_fm (E bf) (Not af) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   200
  | eq_fm (Iff (bf, cf)) (Not af) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   201
  | eq_fm (Imp (bf, cf)) (Not af) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   202
  | eq_fm (Or (bf, cf)) (Not af) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   203
  | eq_fm (And (bf, cf)) (Not af) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   204
  | eq_fm (NClosed cd) (NDvd (ae, bg)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   205
  | eq_fm (Closed cd) (NDvd (ae, bg)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   206
  | eq_fm (A cf) (NDvd (ae, bg)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   207
  | eq_fm (E cf) (NDvd (ae, bg)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   208
  | eq_fm (Iff (cf, db)) (NDvd (ae, bg)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   209
  | eq_fm (Imp (cf, db)) (NDvd (ae, bg)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   210
  | eq_fm (Or (cf, db)) (NDvd (ae, bg)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   211
  | eq_fm (And (cf, db)) (NDvd (ae, bg)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   212
  | eq_fm (Not cf) (NDvd (ae, bg)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   213
  | eq_fm (NClosed cd) (Dvd (ae, bg)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   214
  | eq_fm (Closed cd) (Dvd (ae, bg)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   215
  | eq_fm (A cf) (Dvd (ae, bg)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   216
  | eq_fm (E cf) (Dvd (ae, bg)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   217
  | eq_fm (Iff (cf, db)) (Dvd (ae, bg)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   218
  | eq_fm (Imp (cf, db)) (Dvd (ae, bg)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   219
  | eq_fm (Or (cf, db)) (Dvd (ae, bg)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   220
  | eq_fm (And (cf, db)) (Dvd (ae, bg)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   221
  | eq_fm (Not cf) (Dvd (ae, bg)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   222
  | eq_fm (NDvd (ce, dc)) (Dvd (ae, bg)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   223
  | eq_fm (NClosed bd) (NEq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   224
  | eq_fm (Closed bd) (NEq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   225
  | eq_fm (A bf) (NEq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   226
  | eq_fm (E bf) (NEq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   227
  | eq_fm (Iff (bf, cf)) (NEq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   228
  | eq_fm (Imp (bf, cf)) (NEq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   229
  | eq_fm (Or (bf, cf)) (NEq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   230
  | eq_fm (And (bf, cf)) (NEq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   231
  | eq_fm (Not bf) (NEq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   232
  | eq_fm (NDvd (be, cg)) (NEq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   233
  | eq_fm (Dvd (be, cg)) (NEq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   234
  | eq_fm (NClosed bd) (Eq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   235
  | eq_fm (Closed bd) (Eq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   236
  | eq_fm (A bf) (Eq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   237
  | eq_fm (E bf) (Eq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   238
  | eq_fm (Iff (bf, cf)) (Eq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   239
  | eq_fm (Imp (bf, cf)) (Eq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   240
  | eq_fm (Or (bf, cf)) (Eq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   241
  | eq_fm (And (bf, cf)) (Eq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   242
  | eq_fm (Not bf) (Eq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   243
  | eq_fm (NDvd (be, cg)) (Eq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   244
  | eq_fm (Dvd (be, cg)) (Eq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   245
  | eq_fm (NEq bg) (Eq ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   246
  | eq_fm (NClosed bd) (Ge ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   247
  | eq_fm (Closed bd) (Ge ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   248
  | eq_fm (A bf) (Ge ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   249
  | eq_fm (E bf) (Ge ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   250
  | eq_fm (Iff (bf, cf)) (Ge ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   251
  | eq_fm (Imp (bf, cf)) (Ge ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   252
  | eq_fm (Or (bf, cf)) (Ge ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   253
  | eq_fm (And (bf, cf)) (Ge ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   254
  | eq_fm (Not bf) (Ge ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   255
  | eq_fm (NDvd (be, cg)) (Ge ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   256
  | eq_fm (Dvd (be, cg)) (Ge ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   257
  | eq_fm (NEq bg) (Ge ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   258
  | eq_fm (Eq bg) (Ge ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   259
  | eq_fm (NClosed bd) (Gt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   260
  | eq_fm (Closed bd) (Gt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   261
  | eq_fm (A bf) (Gt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   262
  | eq_fm (E bf) (Gt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   263
  | eq_fm (Iff (bf, cf)) (Gt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   264
  | eq_fm (Imp (bf, cf)) (Gt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   265
  | eq_fm (Or (bf, cf)) (Gt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   266
  | eq_fm (And (bf, cf)) (Gt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   267
  | eq_fm (Not bf) (Gt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   268
  | eq_fm (NDvd (be, cg)) (Gt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   269
  | eq_fm (Dvd (be, cg)) (Gt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   270
  | eq_fm (NEq bg) (Gt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   271
  | eq_fm (Eq bg) (Gt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   272
  | eq_fm (Ge bg) (Gt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   273
  | eq_fm (NClosed bd) (Le ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   274
  | eq_fm (Closed bd) (Le ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   275
  | eq_fm (A bf) (Le ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   276
  | eq_fm (E bf) (Le ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   277
  | eq_fm (Iff (bf, cf)) (Le ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   278
  | eq_fm (Imp (bf, cf)) (Le ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   279
  | eq_fm (Or (bf, cf)) (Le ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   280
  | eq_fm (And (bf, cf)) (Le ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   281
  | eq_fm (Not bf) (Le ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   282
  | eq_fm (NDvd (be, cg)) (Le ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   283
  | eq_fm (Dvd (be, cg)) (Le ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   284
  | eq_fm (NEq bg) (Le ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   285
  | eq_fm (Eq bg) (Le ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   286
  | eq_fm (Ge bg) (Le ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   287
  | eq_fm (Gt bg) (Le ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   288
  | eq_fm (NClosed bd) (Lt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   289
  | eq_fm (Closed bd) (Lt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   290
  | eq_fm (A bf) (Lt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   291
  | eq_fm (E bf) (Lt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   292
  | eq_fm (Iff (bf, cf)) (Lt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   293
  | eq_fm (Imp (bf, cf)) (Lt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   294
  | eq_fm (Or (bf, cf)) (Lt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   295
  | eq_fm (And (bf, cf)) (Lt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   296
  | eq_fm (Not bf) (Lt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   297
  | eq_fm (NDvd (be, cg)) (Lt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   298
  | eq_fm (Dvd (be, cg)) (Lt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   299
  | eq_fm (NEq bg) (Lt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   300
  | eq_fm (Eq bg) (Lt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   301
  | eq_fm (Ge bg) (Lt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   302
  | eq_fm (Gt bg) (Lt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   303
  | eq_fm (Le bg) (Lt ag) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   304
  | eq_fm (NClosed ad) F = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   305
  | eq_fm (Closed ad) F = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   306
  | eq_fm (A af) F = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   307
  | eq_fm (E af) F = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   308
  | eq_fm (Iff (af, bf)) F = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   309
  | eq_fm (Imp (af, bf)) F = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   310
  | eq_fm (Or (af, bf)) F = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   311
  | eq_fm (And (af, bf)) F = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   312
  | eq_fm (Not af) F = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   313
  | eq_fm (NDvd (ae, bg)) F = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   314
  | eq_fm (Dvd (ae, bg)) F = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   315
  | eq_fm (NEq ag) F = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   316
  | eq_fm (Eq ag) F = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   317
  | eq_fm (Ge ag) F = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   318
  | eq_fm (Gt ag) F = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   319
  | eq_fm (Le ag) F = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   320
  | eq_fm (Lt ag) F = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   321
  | eq_fm (NClosed ad) T = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   322
  | eq_fm (Closed ad) T = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   323
  | eq_fm (A af) T = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   324
  | eq_fm (E af) T = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   325
  | eq_fm (Iff (af, bf)) T = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   326
  | eq_fm (Imp (af, bf)) T = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   327
  | eq_fm (Or (af, bf)) T = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   328
  | eq_fm (And (af, bf)) T = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   329
  | eq_fm (Not af) T = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   330
  | eq_fm (NDvd (ae, bg)) T = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   331
  | eq_fm (Dvd (ae, bg)) T = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   332
  | eq_fm (NEq ag) T = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   333
  | eq_fm (Eq ag) T = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   334
  | eq_fm (Ge ag) T = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   335
  | eq_fm (Gt ag) T = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   336
  | eq_fm (Le ag) T = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   337
  | eq_fm (Lt ag) T = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   338
  | eq_fm F T = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   339
  | eq_fm (Closed a) (NClosed b) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   340
  | eq_fm (A ab) (NClosed b) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   341
  | eq_fm (A ab) (Closed b) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   342
  | eq_fm (E ab) (NClosed b) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   343
  | eq_fm (E ab) (Closed b) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   344
  | eq_fm (E ab) (A bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   345
  | eq_fm (Iff (ab, bb)) (NClosed c) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   346
  | eq_fm (Iff (ab, bb)) (Closed c) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   347
  | eq_fm (Iff (ab, bb)) (A cb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   348
  | eq_fm (Iff (ab, bb)) (E cb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   349
  | eq_fm (Imp (ab, bb)) (NClosed c) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   350
  | eq_fm (Imp (ab, bb)) (Closed c) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   351
  | eq_fm (Imp (ab, bb)) (A cb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   352
  | eq_fm (Imp (ab, bb)) (E cb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   353
  | eq_fm (Imp (ab, bb)) (Iff (cb, d)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   354
  | eq_fm (Or (ab, bb)) (NClosed c) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   355
  | eq_fm (Or (ab, bb)) (Closed c) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   356
  | eq_fm (Or (ab, bb)) (A cb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   357
  | eq_fm (Or (ab, bb)) (E cb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   358
  | eq_fm (Or (ab, bb)) (Iff (cb, d)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   359
  | eq_fm (Or (ab, bb)) (Imp (cb, d)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   360
  | eq_fm (And (ab, bb)) (NClosed c) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   361
  | eq_fm (And (ab, bb)) (Closed c) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   362
  | eq_fm (And (ab, bb)) (A cb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   363
  | eq_fm (And (ab, bb)) (E cb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   364
  | eq_fm (And (ab, bb)) (Iff (cb, d)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   365
  | eq_fm (And (ab, bb)) (Imp (cb, d)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   366
  | eq_fm (And (ab, bb)) (Or (cb, d)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   367
  | eq_fm (Not ab) (NClosed b) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   368
  | eq_fm (Not ab) (Closed b) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   369
  | eq_fm (Not ab) (A bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   370
  | eq_fm (Not ab) (E bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   371
  | eq_fm (Not ab) (Iff (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   372
  | eq_fm (Not ab) (Imp (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   373
  | eq_fm (Not ab) (Or (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   374
  | eq_fm (Not ab) (And (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   375
  | eq_fm (NDvd (aa, bc)) (NClosed c) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   376
  | eq_fm (NDvd (aa, bc)) (Closed c) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   377
  | eq_fm (NDvd (aa, bc)) (A cb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   378
  | eq_fm (NDvd (aa, bc)) (E cb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   379
  | eq_fm (NDvd (aa, bc)) (Iff (cb, d)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   380
  | eq_fm (NDvd (aa, bc)) (Imp (cb, d)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   381
  | eq_fm (NDvd (aa, bc)) (Or (cb, d)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   382
  | eq_fm (NDvd (aa, bc)) (And (cb, d)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   383
  | eq_fm (NDvd (aa, bc)) (Not cb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   384
  | eq_fm (Dvd (aa, bc)) (NClosed c) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   385
  | eq_fm (Dvd (aa, bc)) (Closed c) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   386
  | eq_fm (Dvd (aa, bc)) (A cb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   387
  | eq_fm (Dvd (aa, bc)) (E cb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   388
  | eq_fm (Dvd (aa, bc)) (Iff (cb, d)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   389
  | eq_fm (Dvd (aa, bc)) (Imp (cb, d)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   390
  | eq_fm (Dvd (aa, bc)) (Or (cb, d)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   391
  | eq_fm (Dvd (aa, bc)) (And (cb, d)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   392
  | eq_fm (Dvd (aa, bc)) (Not cb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   393
  | eq_fm (Dvd (aa, bc)) (NDvd (ca, da)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   394
  | eq_fm (NEq ac) (NClosed b) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   395
  | eq_fm (NEq ac) (Closed b) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   396
  | eq_fm (NEq ac) (A bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   397
  | eq_fm (NEq ac) (E bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   398
  | eq_fm (NEq ac) (Iff (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   399
  | eq_fm (NEq ac) (Imp (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   400
  | eq_fm (NEq ac) (Or (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   401
  | eq_fm (NEq ac) (And (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   402
  | eq_fm (NEq ac) (Not bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   403
  | eq_fm (NEq ac) (NDvd (ba, cc)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   404
  | eq_fm (NEq ac) (Dvd (ba, cc)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   405
  | eq_fm (Eq ac) (NClosed b) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   406
  | eq_fm (Eq ac) (Closed b) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   407
  | eq_fm (Eq ac) (A bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   408
  | eq_fm (Eq ac) (E bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   409
  | eq_fm (Eq ac) (Iff (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   410
  | eq_fm (Eq ac) (Imp (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   411
  | eq_fm (Eq ac) (Or (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   412
  | eq_fm (Eq ac) (And (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   413
  | eq_fm (Eq ac) (Not bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   414
  | eq_fm (Eq ac) (NDvd (ba, cc)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   415
  | eq_fm (Eq ac) (Dvd (ba, cc)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   416
  | eq_fm (Eq ac) (NEq bc) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   417
  | eq_fm (Ge ac) (NClosed b) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   418
  | eq_fm (Ge ac) (Closed b) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   419
  | eq_fm (Ge ac) (A bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   420
  | eq_fm (Ge ac) (E bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   421
  | eq_fm (Ge ac) (Iff (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   422
  | eq_fm (Ge ac) (Imp (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   423
  | eq_fm (Ge ac) (Or (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   424
  | eq_fm (Ge ac) (And (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   425
  | eq_fm (Ge ac) (Not bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   426
  | eq_fm (Ge ac) (NDvd (ba, cc)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   427
  | eq_fm (Ge ac) (Dvd (ba, cc)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   428
  | eq_fm (Ge ac) (NEq bc) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   429
  | eq_fm (Ge ac) (Eq bc) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   430
  | eq_fm (Gt ac) (NClosed b) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   431
  | eq_fm (Gt ac) (Closed b) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   432
  | eq_fm (Gt ac) (A bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   433
  | eq_fm (Gt ac) (E bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   434
  | eq_fm (Gt ac) (Iff (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   435
  | eq_fm (Gt ac) (Imp (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   436
  | eq_fm (Gt ac) (Or (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   437
  | eq_fm (Gt ac) (And (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   438
  | eq_fm (Gt ac) (Not bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   439
  | eq_fm (Gt ac) (NDvd (ba, cc)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   440
  | eq_fm (Gt ac) (Dvd (ba, cc)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   441
  | eq_fm (Gt ac) (NEq bc) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   442
  | eq_fm (Gt ac) (Eq bc) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   443
  | eq_fm (Gt ac) (Ge bc) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   444
  | eq_fm (Le ac) (NClosed b) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   445
  | eq_fm (Le ac) (Closed b) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   446
  | eq_fm (Le ac) (A bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   447
  | eq_fm (Le ac) (E bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   448
  | eq_fm (Le ac) (Iff (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   449
  | eq_fm (Le ac) (Imp (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   450
  | eq_fm (Le ac) (Or (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   451
  | eq_fm (Le ac) (And (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   452
  | eq_fm (Le ac) (Not bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   453
  | eq_fm (Le ac) (NDvd (ba, cc)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   454
  | eq_fm (Le ac) (Dvd (ba, cc)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   455
  | eq_fm (Le ac) (NEq bc) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   456
  | eq_fm (Le ac) (Eq bc) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   457
  | eq_fm (Le ac) (Ge bc) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   458
  | eq_fm (Le ac) (Gt bc) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   459
  | eq_fm (Lt ac) (NClosed b) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   460
  | eq_fm (Lt ac) (Closed b) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   461
  | eq_fm (Lt ac) (A bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   462
  | eq_fm (Lt ac) (E bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   463
  | eq_fm (Lt ac) (Iff (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   464
  | eq_fm (Lt ac) (Imp (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   465
  | eq_fm (Lt ac) (Or (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   466
  | eq_fm (Lt ac) (And (bb, cb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   467
  | eq_fm (Lt ac) (Not bb) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   468
  | eq_fm (Lt ac) (NDvd (ba, cc)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   469
  | eq_fm (Lt ac) (Dvd (ba, cc)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   470
  | eq_fm (Lt ac) (NEq bc) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   471
  | eq_fm (Lt ac) (Eq bc) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   472
  | eq_fm (Lt ac) (Ge bc) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   473
  | eq_fm (Lt ac) (Gt bc) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   474
  | eq_fm (Lt ac) (Le bc) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   475
  | eq_fm F (NClosed a) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   476
  | eq_fm F (Closed a) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   477
  | eq_fm F (A ab) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   478
  | eq_fm F (E ab) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   479
  | eq_fm F (Iff (ab, bb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   480
  | eq_fm F (Imp (ab, bb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   481
  | eq_fm F (Or (ab, bb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   482
  | eq_fm F (And (ab, bb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   483
  | eq_fm F (Not ab) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   484
  | eq_fm F (NDvd (aa, bc)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   485
  | eq_fm F (Dvd (aa, bc)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   486
  | eq_fm F (NEq ac) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   487
  | eq_fm F (Eq ac) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   488
  | eq_fm F (Ge ac) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   489
  | eq_fm F (Gt ac) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   490
  | eq_fm F (Le ac) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   491
  | eq_fm F (Lt ac) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   492
  | eq_fm T (NClosed a) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   493
  | eq_fm T (Closed a) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   494
  | eq_fm T (A ab) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   495
  | eq_fm T (E ab) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   496
  | eq_fm T (Iff (ab, bb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   497
  | eq_fm T (Imp (ab, bb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   498
  | eq_fm T (Or (ab, bb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   499
  | eq_fm T (And (ab, bb)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   500
  | eq_fm T (Not ab) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   501
  | eq_fm T (NDvd (aa, bc)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   502
  | eq_fm T (Dvd (aa, bc)) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   503
  | eq_fm T (NEq ac) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   504
  | eq_fm T (Eq ac) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   505
  | eq_fm T (Ge ac) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   506
  | eq_fm T (Gt ac) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   507
  | eq_fm T (Le ac) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   508
  | eq_fm T (Lt ac) = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   509
  | eq_fm T F = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   510
  | eq_fm (NClosed nat) (NClosed nat') = ((nat : IntInf.int) = nat')
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   511
  | eq_fm (Closed nat) (Closed nat') = ((nat : IntInf.int) = nat')
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   512
  | eq_fm (A fm) (A fm') = eq_fm fm fm'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   513
  | eq_fm (E fm) (E fm') = eq_fm fm fm'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   514
  | eq_fm (Iff (fm1, fm2)) (Iff (fm1', fm2')) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   515
    eq_fm fm1 fm1' andalso eq_fm fm2 fm2'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   516
  | eq_fm (Imp (fm1, fm2)) (Imp (fm1', fm2')) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   517
    eq_fm fm1 fm1' andalso eq_fm fm2 fm2'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   518
  | eq_fm (Or (fm1, fm2)) (Or (fm1', fm2')) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   519
    eq_fm fm1 fm1' andalso eq_fm fm2 fm2'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   520
  | eq_fm (And (fm1, fm2)) (And (fm1', fm2')) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   521
    eq_fm fm1 fm1' andalso eq_fm fm2 fm2'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   522
  | eq_fm (Not fm) (Not fm') = eq_fm fm fm'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   523
  | eq_fm (NDvd (inta, num)) (NDvd (int', num')) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   524
    ((inta : IntInf.int) = int') andalso eq_num num num'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   525
  | eq_fm (Dvd (inta, num)) (Dvd (int', num')) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   526
    ((inta : IntInf.int) = int') andalso eq_num num num'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   527
  | eq_fm (NEq num) (NEq num') = eq_num num num'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   528
  | eq_fm (Eq num) (Eq num') = eq_num num num'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   529
  | eq_fm (Ge num) (Ge num') = eq_num num num'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   530
  | eq_fm (Gt num) (Gt num') = eq_num num num'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   531
  | eq_fm (Le num) (Le num') = eq_num num num'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   532
  | eq_fm (Lt num) (Lt num') = eq_num num num'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   533
  | eq_fm F F = true
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   534
  | eq_fm T T = true;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   535
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   536
val eq_fma = {eq = eq_fm} : fm eq;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   537
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   538
fun djf f p q =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   539
  (if eqop eq_fma q T then T
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   540
    else (if eqop eq_fma q F then f p
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   541
           else let
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   542
                  val a = f p;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   543
                in
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   544
                  (case a of T => T | F => q | Lt num => Or (f p, q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   545
                     | Le num => Or (f p, q) | Gt num => Or (f p, q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   546
                     | Ge num => Or (f p, q) | Eq num => Or (f p, q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   547
                     | NEq num => Or (f p, q) | Dvd (inta, num) => Or (f p, q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   548
                     | NDvd (inta, num) => Or (f p, q) | Not fm => Or (f p, q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   549
                     | And (fm1, fm2) => Or (f p, q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   550
                     | Or (fm1, fm2) => Or (f p, q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   551
                     | Imp (fm1, fm2) => Or (f p, q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   552
                     | Iff (fm1, fm2) => Or (f p, q) | E fm => Or (f p, q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   553
                     | A fm => Or (f p, q) | Closed nat => Or (f p, q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   554
                     | NClosed nat => Or (f p, q))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   555
                end));
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   556
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   557
fun foldr f [] y = y
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   558
  | foldr f (x :: xs) a = f x (foldr f xs a);
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   559
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   560
fun evaldjf f ps = foldr (djf f) ps F;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   561
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   562
fun dj f p = evaldjf f (disjuncts p);
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   563
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   564
fun disj p q =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   565
  (if eqop eq_fma p T orelse eqop eq_fma q T then T
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   566
    else (if eqop eq_fma p F then q
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   567
           else (if eqop eq_fma q F then p else Or (p, q))));
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   568
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   569
fun minus_nat n m = IntInf.max (0, (IntInf.- (n, m)));
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   570
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   571
fun decrnum (Bound n) = Bound (minus_nat n 1)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   572
  | decrnum (Neg a) = Neg (decrnum a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   573
  | decrnum (Add (a, b)) = Add (decrnum a, decrnum b)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   574
  | decrnum (Sub (a, b)) = Sub (decrnum a, decrnum b)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   575
  | decrnum (Mul (c, a)) = Mul (c, decrnum a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   576
  | decrnum (Cn (n, i, a)) = Cn (minus_nat n 1, i, decrnum a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   577
  | decrnum (C u) = C u;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   578
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   579
fun decr (Lt a) = Lt (decrnum a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   580
  | decr (Le a) = Le (decrnum a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   581
  | decr (Gt a) = Gt (decrnum a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   582
  | decr (Ge a) = Ge (decrnum a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   583
  | decr (Eq a) = Eq (decrnum a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   584
  | decr (NEq a) = NEq (decrnum a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   585
  | decr (Dvd (i, a)) = Dvd (i, decrnum a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   586
  | decr (NDvd (i, a)) = NDvd (i, decrnum a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   587
  | decr (Not p) = Not (decr p)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   588
  | decr (And (p, q)) = And (decr p, decr q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   589
  | decr (Or (p, q)) = Or (decr p, decr q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   590
  | decr (Imp (p, q)) = Imp (decr p, decr q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   591
  | decr (Iff (p, q)) = Iff (decr p, decr q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   592
  | decr T = T
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   593
  | decr F = F
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   594
  | decr (E ao) = E ao
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   595
  | decr (A ap) = A ap
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   596
  | decr (Closed aq) = Closed aq
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   597
  | decr (NClosed ar) = NClosed ar;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   598
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   599
fun concat [] = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   600
  | concat (x :: xs) = append x (concat xs);
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   601
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   602
fun split f (a, b) = f a b;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   603
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   604
fun numsubst0 t (C c) = C c
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   605
  | numsubst0 t (Bound n) = (if eqop eq_nat n 0 then t else Bound n)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   606
  | numsubst0 t (Neg a) = Neg (numsubst0 t a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   607
  | numsubst0 t (Add (a, b)) = Add (numsubst0 t a, numsubst0 t b)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   608
  | numsubst0 t (Sub (a, b)) = Sub (numsubst0 t a, numsubst0 t b)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   609
  | numsubst0 t (Mul (i, a)) = Mul (i, numsubst0 t a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   610
  | numsubst0 ta (Cn (v, ia, aa)) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   611
    (if eqop eq_nat v 0 then Add (Mul (ia, ta), numsubst0 ta aa)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   612
      else Cn (suc (minus_nat v 1), ia, numsubst0 ta aa));
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   613
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   614
fun subst0 t T = T
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   615
  | subst0 t F = F
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   616
  | subst0 t (Lt a) = Lt (numsubst0 t a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   617
  | subst0 t (Le a) = Le (numsubst0 t a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   618
  | subst0 t (Gt a) = Gt (numsubst0 t a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   619
  | subst0 t (Ge a) = Ge (numsubst0 t a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   620
  | subst0 t (Eq a) = Eq (numsubst0 t a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   621
  | subst0 t (NEq a) = NEq (numsubst0 t a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   622
  | subst0 t (Dvd (i, a)) = Dvd (i, numsubst0 t a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   623
  | subst0 t (NDvd (i, a)) = NDvd (i, numsubst0 t a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   624
  | subst0 t (Not p) = Not (subst0 t p)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   625
  | subst0 t (And (p, q)) = And (subst0 t p, subst0 t q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   626
  | subst0 t (Or (p, q)) = Or (subst0 t p, subst0 t q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   627
  | subst0 t (Imp (p, q)) = Imp (subst0 t p, subst0 t q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   628
  | subst0 t (Iff (p, q)) = Iff (subst0 t p, subst0 t q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   629
  | subst0 t (Closed p) = Closed p
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   630
  | subst0 t (NClosed p) = NClosed p;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   631
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   632
fun minusinf (And (p, q)) = And (minusinf p, minusinf q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   633
  | minusinf (Or (p, q)) = Or (minusinf p, minusinf q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   634
  | minusinf T = T
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   635
  | minusinf F = F
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   636
  | minusinf (Lt (C bo)) = Lt (C bo)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   637
  | minusinf (Lt (Bound bp)) = Lt (Bound bp)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   638
  | minusinf (Lt (Neg bt)) = Lt (Neg bt)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   639
  | minusinf (Lt (Add (bu, bv))) = Lt (Add (bu, bv))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   640
  | minusinf (Lt (Sub (bw, bx))) = Lt (Sub (bw, bx))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   641
  | minusinf (Lt (Mul (by, bz))) = Lt (Mul (by, bz))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   642
  | minusinf (Le (C co)) = Le (C co)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   643
  | minusinf (Le (Bound cp)) = Le (Bound cp)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   644
  | minusinf (Le (Neg ct)) = Le (Neg ct)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   645
  | minusinf (Le (Add (cu, cv))) = Le (Add (cu, cv))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   646
  | minusinf (Le (Sub (cw, cx))) = Le (Sub (cw, cx))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   647
  | minusinf (Le (Mul (cy, cz))) = Le (Mul (cy, cz))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   648
  | minusinf (Gt (C doa)) = Gt (C doa)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   649
  | minusinf (Gt (Bound dp)) = Gt (Bound dp)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   650
  | minusinf (Gt (Neg dt)) = Gt (Neg dt)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   651
  | minusinf (Gt (Add (du, dv))) = Gt (Add (du, dv))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   652
  | minusinf (Gt (Sub (dw, dx))) = Gt (Sub (dw, dx))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   653
  | minusinf (Gt (Mul (dy, dz))) = Gt (Mul (dy, dz))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   654
  | minusinf (Ge (C eo)) = Ge (C eo)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   655
  | minusinf (Ge (Bound ep)) = Ge (Bound ep)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   656
  | minusinf (Ge (Neg et)) = Ge (Neg et)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   657
  | minusinf (Ge (Add (eu, ev))) = Ge (Add (eu, ev))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   658
  | minusinf (Ge (Sub (ew, ex))) = Ge (Sub (ew, ex))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   659
  | minusinf (Ge (Mul (ey, ez))) = Ge (Mul (ey, ez))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   660
  | minusinf (Eq (C fo)) = Eq (C fo)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   661
  | minusinf (Eq (Bound fp)) = Eq (Bound fp)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   662
  | minusinf (Eq (Neg ft)) = Eq (Neg ft)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   663
  | minusinf (Eq (Add (fu, fv))) = Eq (Add (fu, fv))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   664
  | minusinf (Eq (Sub (fw, fx))) = Eq (Sub (fw, fx))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   665
  | minusinf (Eq (Mul (fy, fz))) = Eq (Mul (fy, fz))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   666
  | minusinf (NEq (C go)) = NEq (C go)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   667
  | minusinf (NEq (Bound gp)) = NEq (Bound gp)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   668
  | minusinf (NEq (Neg gt)) = NEq (Neg gt)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   669
  | minusinf (NEq (Add (gu, gv))) = NEq (Add (gu, gv))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   670
  | minusinf (NEq (Sub (gw, gx))) = NEq (Sub (gw, gx))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   671
  | minusinf (NEq (Mul (gy, gz))) = NEq (Mul (gy, gz))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   672
  | minusinf (Dvd (aa, ab)) = Dvd (aa, ab)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   673
  | minusinf (NDvd (ac, ad)) = NDvd (ac, ad)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   674
  | minusinf (Not ae) = Not ae
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   675
  | minusinf (Imp (aj, ak)) = Imp (aj, ak)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   676
  | minusinf (Iff (al, am)) = Iff (al, am)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   677
  | minusinf (E an) = E an
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   678
  | minusinf (A ao) = A ao
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   679
  | minusinf (Closed ap) = Closed ap
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   680
  | minusinf (NClosed aq) = NClosed aq
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   681
  | minusinf (Lt (Cn (cm, c, e))) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   682
    (if eqop eq_nat cm 0 then T else Lt (Cn (suc (minus_nat cm 1), c, e)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   683
  | minusinf (Le (Cn (dm, c, e))) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   684
    (if eqop eq_nat dm 0 then T else Le (Cn (suc (minus_nat dm 1), c, e)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   685
  | minusinf (Gt (Cn (em, c, e))) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   686
    (if eqop eq_nat em 0 then F else Gt (Cn (suc (minus_nat em 1), c, e)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   687
  | minusinf (Ge (Cn (fm, c, e))) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   688
    (if eqop eq_nat fm 0 then F else Ge (Cn (suc (minus_nat fm 1), c, e)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   689
  | minusinf (Eq (Cn (gm, c, e))) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   690
    (if eqop eq_nat gm 0 then F else Eq (Cn (suc (minus_nat gm 1), c, e)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   691
  | minusinf (NEq (Cn (hm, c, e))) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   692
    (if eqop eq_nat hm 0 then T else NEq (Cn (suc (minus_nat hm 1), c, e)));
23689
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
   693
23466
886655a150f6 moved quantifier elimination tools to Tools/Qelim/;
wenzelm
parents:
diff changeset
   694
fun adjust b =
23689
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
   695
  (fn a as (q, r) =>
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
   696
    (if IntInf.<= ((0 : IntInf.int), IntInf.- (r, b))
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
   697
      then (IntInf.+ (IntInf.* ((2 : IntInf.int), q), (1 : IntInf.int)),
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
   698
             IntInf.- (r, b))
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
   699
      else (IntInf.* ((2 : IntInf.int), q), r)));
23466
886655a150f6 moved quantifier elimination tools to Tools/Qelim/;
wenzelm
parents:
diff changeset
   700
886655a150f6 moved quantifier elimination tools to Tools/Qelim/;
wenzelm
parents:
diff changeset
   701
fun negDivAlg a b =
23689
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
   702
  (if IntInf.<= ((0 : IntInf.int), IntInf.+ (a, b)) orelse
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
   703
        IntInf.<= (b, (0 : IntInf.int))
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
   704
    then ((~1 : IntInf.int), IntInf.+ (a, b))
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
   705
    else adjust b (negDivAlg a (IntInf.* ((2 : IntInf.int), b))));
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
   706
29787
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   707
fun apsnd f (x, y) = (x, f y);
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   708
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   709
val eq_int = {eq = (fn a => fn b => ((a : IntInf.int) = b))} : IntInf.int eq;
23466
886655a150f6 moved quantifier elimination tools to Tools/Qelim/;
wenzelm
parents:
diff changeset
   710
886655a150f6 moved quantifier elimination tools to Tools/Qelim/;
wenzelm
parents:
diff changeset
   711
fun posDivAlg a b =
23689
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
   712
  (if IntInf.< (a, b) orelse IntInf.<= (b, (0 : IntInf.int))
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
   713
    then ((0 : IntInf.int), a)
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
   714
    else adjust b (posDivAlg a (IntInf.* ((2 : IntInf.int), b))));
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
   715
29787
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   716
fun divmoda a b =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   717
  (if IntInf.<= ((0 : IntInf.int), a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   718
    then (if IntInf.<= ((0 : IntInf.int), b) then posDivAlg a b
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   719
           else (if eqop eq_int a (0 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   720
                  then ((0 : IntInf.int), (0 : IntInf.int))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   721
                  else apsnd IntInf.~ (negDivAlg (IntInf.~ a) (IntInf.~ b))))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   722
    else (if IntInf.< ((0 : IntInf.int), b) then negDivAlg a b
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   723
           else apsnd IntInf.~ (posDivAlg (IntInf.~ a) (IntInf.~ b))));
23689
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
   724
29787
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   725
fun mod_int a b = snd (divmoda a b);
23714
49b08f25db29 now a monolithic module
haftmann
parents: 23689
diff changeset
   726
29787
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   727
fun num_case f1 f2 f3 f4 f5 f6 f7 (Mul (inta, num)) = f7 inta num
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   728
  | num_case f1 f2 f3 f4 f5 f6 f7 (Sub (num1, num2)) = f6 num1 num2
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   729
  | num_case f1 f2 f3 f4 f5 f6 f7 (Add (num1, num2)) = f5 num1 num2
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   730
  | num_case f1 f2 f3 f4 f5 f6 f7 (Neg num) = f4 num
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   731
  | num_case f1 f2 f3 f4 f5 f6 f7 (Cn (nat, inta, num)) = f3 nat inta num
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   732
  | num_case f1 f2 f3 f4 f5 f6 f7 (Bound nat) = f2 nat
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   733
  | num_case f1 f2 f3 f4 f5 f6 f7 (C inta) = f1 inta;
23689
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
   734
29787
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   735
fun nummul i (C j) = C (IntInf.* (i, j))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   736
  | nummul i (Cn (n, c, t)) = Cn (n, IntInf.* (c, i), nummul i t)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   737
  | nummul i (Bound v) = Mul (i, Bound v)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   738
  | nummul i (Neg v) = Mul (i, Neg v)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   739
  | nummul i (Add (v, va)) = Mul (i, Add (v, va))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   740
  | nummul i (Sub (v, va)) = Mul (i, Sub (v, va))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   741
  | nummul i (Mul (v, va)) = Mul (i, Mul (v, va));
23689
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
   742
29787
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   743
fun numneg t = nummul (IntInf.~ (1 : IntInf.int)) t;
23689
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
   744
29787
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   745
fun numadd (Cn (n1, c1, r1), Cn (n2, c2, r2)) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   746
  (if eqop eq_nat n1 n2
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   747
    then let
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   748
           val c = IntInf.+ (c1, c2);
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   749
         in
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   750
           (if eqop eq_int c (0 : IntInf.int) then numadd (r1, r2)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   751
             else Cn (n1, c, numadd (r1, r2)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   752
         end
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   753
    else (if IntInf.<= (n1, n2)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   754
           then Cn (n1, c1, numadd (r1, Add (Mul (c2, Bound n2), r2)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   755
           else Cn (n2, c2, numadd (Add (Mul (c1, Bound n1), r1), r2))))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   756
  | numadd (Cn (n1, c1, r1), C dd) = Cn (n1, c1, numadd (r1, C dd))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   757
  | numadd (Cn (n1, c1, r1), Bound de) = Cn (n1, c1, numadd (r1, Bound de))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   758
  | numadd (Cn (n1, c1, r1), Neg di) = Cn (n1, c1, numadd (r1, Neg di))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   759
  | numadd (Cn (n1, c1, r1), Add (dj, dk)) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   760
    Cn (n1, c1, numadd (r1, Add (dj, dk)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   761
  | numadd (Cn (n1, c1, r1), Sub (dl, dm)) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   762
    Cn (n1, c1, numadd (r1, Sub (dl, dm)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   763
  | numadd (Cn (n1, c1, r1), Mul (dn, doa)) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   764
    Cn (n1, c1, numadd (r1, Mul (dn, doa)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   765
  | numadd (C w, Cn (n2, c2, r2)) = Cn (n2, c2, numadd (C w, r2))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   766
  | numadd (Bound x, Cn (n2, c2, r2)) = Cn (n2, c2, numadd (Bound x, r2))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   767
  | numadd (Neg ac, Cn (n2, c2, r2)) = Cn (n2, c2, numadd (Neg ac, r2))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   768
  | numadd (Add (ad, ae), Cn (n2, c2, r2)) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   769
    Cn (n2, c2, numadd (Add (ad, ae), r2))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   770
  | numadd (Sub (af, ag), Cn (n2, c2, r2)) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   771
    Cn (n2, c2, numadd (Sub (af, ag), r2))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   772
  | numadd (Mul (ah, ai), Cn (n2, c2, r2)) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   773
    Cn (n2, c2, numadd (Mul (ah, ai), r2))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   774
  | numadd (C b1, C b2) = C (IntInf.+ (b1, b2))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   775
  | numadd (C aj, Bound bi) = Add (C aj, Bound bi)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   776
  | numadd (C aj, Neg bm) = Add (C aj, Neg bm)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   777
  | numadd (C aj, Add (bn, bo)) = Add (C aj, Add (bn, bo))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   778
  | numadd (C aj, Sub (bp, bq)) = Add (C aj, Sub (bp, bq))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   779
  | numadd (C aj, Mul (br, bs)) = Add (C aj, Mul (br, bs))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   780
  | numadd (Bound ak, C cf) = Add (Bound ak, C cf)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   781
  | numadd (Bound ak, Bound cg) = Add (Bound ak, Bound cg)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   782
  | numadd (Bound ak, Neg ck) = Add (Bound ak, Neg ck)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   783
  | numadd (Bound ak, Add (cl, cm)) = Add (Bound ak, Add (cl, cm))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   784
  | numadd (Bound ak, Sub (cn, co)) = Add (Bound ak, Sub (cn, co))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   785
  | numadd (Bound ak, Mul (cp, cq)) = Add (Bound ak, Mul (cp, cq))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   786
  | numadd (Neg ao, C en) = Add (Neg ao, C en)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   787
  | numadd (Neg ao, Bound eo) = Add (Neg ao, Bound eo)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   788
  | numadd (Neg ao, Neg es) = Add (Neg ao, Neg es)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   789
  | numadd (Neg ao, Add (et, eu)) = Add (Neg ao, Add (et, eu))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   790
  | numadd (Neg ao, Sub (ev, ew)) = Add (Neg ao, Sub (ev, ew))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   791
  | numadd (Neg ao, Mul (ex, ey)) = Add (Neg ao, Mul (ex, ey))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   792
  | numadd (Add (ap, aq), C fl) = Add (Add (ap, aq), C fl)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   793
  | numadd (Add (ap, aq), Bound fm) = Add (Add (ap, aq), Bound fm)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   794
  | numadd (Add (ap, aq), Neg fq) = Add (Add (ap, aq), Neg fq)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   795
  | numadd (Add (ap, aq), Add (fr, fs)) = Add (Add (ap, aq), Add (fr, fs))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   796
  | numadd (Add (ap, aq), Sub (ft, fu)) = Add (Add (ap, aq), Sub (ft, fu))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   797
  | numadd (Add (ap, aq), Mul (fv, fw)) = Add (Add (ap, aq), Mul (fv, fw))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   798
  | numadd (Sub (ar, asa), C gj) = Add (Sub (ar, asa), C gj)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   799
  | numadd (Sub (ar, asa), Bound gk) = Add (Sub (ar, asa), Bound gk)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   800
  | numadd (Sub (ar, asa), Neg go) = Add (Sub (ar, asa), Neg go)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   801
  | numadd (Sub (ar, asa), Add (gp, gq)) = Add (Sub (ar, asa), Add (gp, gq))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   802
  | numadd (Sub (ar, asa), Sub (gr, gs)) = Add (Sub (ar, asa), Sub (gr, gs))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   803
  | numadd (Sub (ar, asa), Mul (gt, gu)) = Add (Sub (ar, asa), Mul (gt, gu))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   804
  | numadd (Mul (at, au), C hh) = Add (Mul (at, au), C hh)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   805
  | numadd (Mul (at, au), Bound hi) = Add (Mul (at, au), Bound hi)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   806
  | numadd (Mul (at, au), Neg hm) = Add (Mul (at, au), Neg hm)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   807
  | numadd (Mul (at, au), Add (hn, ho)) = Add (Mul (at, au), Add (hn, ho))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   808
  | numadd (Mul (at, au), Sub (hp, hq)) = Add (Mul (at, au), Sub (hp, hq))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   809
  | numadd (Mul (at, au), Mul (hr, hs)) = Add (Mul (at, au), Mul (hr, hs));
23714
49b08f25db29 now a monolithic module
haftmann
parents: 23689
diff changeset
   810
29787
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   811
val eq_numa = {eq = eq_num} : num eq;
23689
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
   812
29787
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   813
fun numsub s t =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   814
  (if eqop eq_numa s t then C (0 : IntInf.int) else numadd (s, numneg t));
23689
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
   815
29787
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   816
fun simpnum (C j) = C j
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   817
  | simpnum (Bound n) = Cn (n, (1 : IntInf.int), C (0 : IntInf.int))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   818
  | simpnum (Neg t) = numneg (simpnum t)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   819
  | simpnum (Add (t, s)) = numadd (simpnum t, simpnum s)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   820
  | simpnum (Sub (t, s)) = numsub (simpnum t) (simpnum s)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   821
  | simpnum (Mul (i, t)) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   822
    (if eqop eq_int i (0 : IntInf.int) then C (0 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   823
      else nummul i (simpnum t))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   824
  | simpnum (Cn (v, va, vb)) = Cn (v, va, vb);
23714
49b08f25db29 now a monolithic module
haftmann
parents: 23689
diff changeset
   825
29787
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   826
fun nota (Not y) = y
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   827
  | nota T = F
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   828
  | nota F = T
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   829
  | nota (Lt vc) = Not (Lt vc)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   830
  | nota (Le vc) = Not (Le vc)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   831
  | nota (Gt vc) = Not (Gt vc)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   832
  | nota (Ge vc) = Not (Ge vc)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   833
  | nota (Eq vc) = Not (Eq vc)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   834
  | nota (NEq vc) = Not (NEq vc)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   835
  | nota (Dvd (va, vab)) = Not (Dvd (va, vab))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   836
  | nota (NDvd (va, vab)) = Not (NDvd (va, vab))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   837
  | nota (And (vb, vaa)) = Not (And (vb, vaa))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   838
  | nota (Or (vb, vaa)) = Not (Or (vb, vaa))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   839
  | nota (Imp (vb, vaa)) = Not (Imp (vb, vaa))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   840
  | nota (Iff (vb, vaa)) = Not (Iff (vb, vaa))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   841
  | nota (E vb) = Not (E vb)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   842
  | nota (A vb) = Not (A vb)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   843
  | nota (Closed v) = Not (Closed v)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   844
  | nota (NClosed v) = Not (NClosed v);
23714
49b08f25db29 now a monolithic module
haftmann
parents: 23689
diff changeset
   845
29787
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   846
fun iffa p q =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   847
  (if eqop eq_fma p q then T
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   848
    else (if eqop eq_fma p (nota q) orelse eqop eq_fma (nota p) q then F
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   849
           else (if eqop eq_fma p F then nota q
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   850
                  else (if eqop eq_fma q F then nota p
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   851
                         else (if eqop eq_fma p T then q
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   852
                                else (if eqop eq_fma q T then p
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   853
                                       else Iff (p, q)))))));
23466
886655a150f6 moved quantifier elimination tools to Tools/Qelim/;
wenzelm
parents:
diff changeset
   854
29787
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   855
fun impa p q =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   856
  (if eqop eq_fma p F orelse eqop eq_fma q T then T
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   857
    else (if eqop eq_fma p T then q
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   858
           else (if eqop eq_fma q F then nota p else Imp (p, q))));
23714
49b08f25db29 now a monolithic module
haftmann
parents: 23689
diff changeset
   859
29787
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   860
fun conj p q =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   861
  (if eqop eq_fma p F orelse eqop eq_fma q F then F
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   862
    else (if eqop eq_fma p T then q
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   863
           else (if eqop eq_fma q T then p else And (p, q))));
23714
49b08f25db29 now a monolithic module
haftmann
parents: 23689
diff changeset
   864
29787
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   865
fun simpfm (And (p, q)) = conj (simpfm p) (simpfm q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   866
  | simpfm (Or (p, q)) = disj (simpfm p) (simpfm q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   867
  | simpfm (Imp (p, q)) = impa (simpfm p) (simpfm q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   868
  | simpfm (Iff (p, q)) = iffa (simpfm p) (simpfm q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   869
  | simpfm (Not p) = nota (simpfm p)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   870
  | simpfm (Lt a) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   871
    let
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   872
      val a' = simpnum a;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   873
    in
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   874
      (case a' of C v => (if IntInf.< (v, (0 : IntInf.int)) then T else F)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   875
         | Bound nat => Lt a' | Cn (nat, inta, num) => Lt a' | Neg num => Lt a'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   876
         | Add (num1, num2) => Lt a' | Sub (num1, num2) => Lt a'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   877
         | Mul (inta, num) => Lt a')
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   878
    end
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   879
  | simpfm (Le a) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   880
    let
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   881
      val a' = simpnum a;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   882
    in
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   883
      (case a' of C v => (if IntInf.<= (v, (0 : IntInf.int)) then T else F)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   884
         | Bound nat => Le a' | Cn (nat, inta, num) => Le a' | Neg num => Le a'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   885
         | Add (num1, num2) => Le a' | Sub (num1, num2) => Le a'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   886
         | Mul (inta, num) => Le a')
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   887
    end
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   888
  | simpfm (Gt a) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   889
    let
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   890
      val a' = simpnum a;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   891
    in
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   892
      (case a' of C v => (if IntInf.< ((0 : IntInf.int), v) then T else F)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   893
         | Bound nat => Gt a' | Cn (nat, inta, num) => Gt a' | Neg num => Gt a'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   894
         | Add (num1, num2) => Gt a' | Sub (num1, num2) => Gt a'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   895
         | Mul (inta, num) => Gt a')
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   896
    end
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   897
  | simpfm (Ge a) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   898
    let
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   899
      val a' = simpnum a;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   900
    in
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   901
      (case a' of C v => (if IntInf.<= ((0 : IntInf.int), v) then T else F)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   902
         | Bound nat => Ge a' | Cn (nat, inta, num) => Ge a' | Neg num => Ge a'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   903
         | Add (num1, num2) => Ge a' | Sub (num1, num2) => Ge a'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   904
         | Mul (inta, num) => Ge a')
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   905
    end
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   906
  | simpfm (Eq a) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   907
    let
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   908
      val a' = simpnum a;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   909
    in
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   910
      (case a' of C v => (if eqop eq_int v (0 : IntInf.int) then T else F)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   911
         | Bound nat => Eq a' | Cn (nat, inta, num) => Eq a' | Neg num => Eq a'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   912
         | Add (num1, num2) => Eq a' | Sub (num1, num2) => Eq a'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   913
         | Mul (inta, num) => Eq a')
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   914
    end
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   915
  | simpfm (NEq a) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   916
    let
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   917
      val a' = simpnum a;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   918
    in
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   919
      (case a' of C v => (if not (eqop eq_int v (0 : IntInf.int)) then T else F)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   920
         | Bound nat => NEq a' | Cn (nat, inta, num) => NEq a'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   921
         | Neg num => NEq a' | Add (num1, num2) => NEq a'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   922
         | Sub (num1, num2) => NEq a' | Mul (inta, num) => NEq a')
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   923
    end
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   924
  | simpfm (Dvd (i, a)) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   925
    (if eqop eq_int i (0 : IntInf.int) then simpfm (Eq a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   926
      else (if eqop eq_int (abs_int i) (1 : IntInf.int) then T
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   927
             else let
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   928
                    val a' = simpnum a;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   929
                  in
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   930
                    (case a'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   931
                       of C v =>
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   932
                         (if eqop eq_int (mod_int v i) (0 : IntInf.int) then T
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   933
                           else F)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   934
                       | Bound nat => Dvd (i, a')
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   935
                       | Cn (nat, inta, num) => Dvd (i, a')
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   936
                       | Neg num => Dvd (i, a')
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   937
                       | Add (num1, num2) => Dvd (i, a')
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   938
                       | Sub (num1, num2) => Dvd (i, a')
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   939
                       | Mul (inta, num) => Dvd (i, a'))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   940
                  end))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   941
  | simpfm (NDvd (i, a)) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   942
    (if eqop eq_int i (0 : IntInf.int) then simpfm (NEq a)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   943
      else (if eqop eq_int (abs_int i) (1 : IntInf.int) then F
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   944
             else let
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   945
                    val a' = simpnum a;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   946
                  in
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   947
                    (case a'
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   948
                       of C v =>
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   949
                         (if not (eqop eq_int (mod_int v i) (0 : IntInf.int))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   950
                           then T else F)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   951
                       | Bound nat => NDvd (i, a')
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   952
                       | Cn (nat, inta, num) => NDvd (i, a')
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   953
                       | Neg num => NDvd (i, a')
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   954
                       | Add (num1, num2) => NDvd (i, a')
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   955
                       | Sub (num1, num2) => NDvd (i, a')
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   956
                       | Mul (inta, num) => NDvd (i, a'))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   957
                  end))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   958
  | simpfm T = T
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   959
  | simpfm F = F
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   960
  | simpfm (E v) = E v
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   961
  | simpfm (A v) = A v
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   962
  | simpfm (Closed v) = Closed v
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   963
  | simpfm (NClosed v) = NClosed v;
23466
886655a150f6 moved quantifier elimination tools to Tools/Qelim/;
wenzelm
parents:
diff changeset
   964
29787
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   965
fun iupt i j =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   966
  (if IntInf.< (j, i) then []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   967
    else i :: iupt (IntInf.+ (i, (1 : IntInf.int))) j);
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   968
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   969
fun mirror (And (p, q)) = And (mirror p, mirror q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   970
  | mirror (Or (p, q)) = Or (mirror p, mirror q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   971
  | mirror T = T
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   972
  | mirror F = F
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   973
  | mirror (Lt (C bo)) = Lt (C bo)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   974
  | mirror (Lt (Bound bp)) = Lt (Bound bp)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   975
  | mirror (Lt (Neg bt)) = Lt (Neg bt)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   976
  | mirror (Lt (Add (bu, bv))) = Lt (Add (bu, bv))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   977
  | mirror (Lt (Sub (bw, bx))) = Lt (Sub (bw, bx))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   978
  | mirror (Lt (Mul (by, bz))) = Lt (Mul (by, bz))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   979
  | mirror (Le (C co)) = Le (C co)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   980
  | mirror (Le (Bound cp)) = Le (Bound cp)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   981
  | mirror (Le (Neg ct)) = Le (Neg ct)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   982
  | mirror (Le (Add (cu, cv))) = Le (Add (cu, cv))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   983
  | mirror (Le (Sub (cw, cx))) = Le (Sub (cw, cx))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   984
  | mirror (Le (Mul (cy, cz))) = Le (Mul (cy, cz))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   985
  | mirror (Gt (C doa)) = Gt (C doa)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   986
  | mirror (Gt (Bound dp)) = Gt (Bound dp)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   987
  | mirror (Gt (Neg dt)) = Gt (Neg dt)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   988
  | mirror (Gt (Add (du, dv))) = Gt (Add (du, dv))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   989
  | mirror (Gt (Sub (dw, dx))) = Gt (Sub (dw, dx))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   990
  | mirror (Gt (Mul (dy, dz))) = Gt (Mul (dy, dz))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   991
  | mirror (Ge (C eo)) = Ge (C eo)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   992
  | mirror (Ge (Bound ep)) = Ge (Bound ep)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   993
  | mirror (Ge (Neg et)) = Ge (Neg et)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   994
  | mirror (Ge (Add (eu, ev))) = Ge (Add (eu, ev))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   995
  | mirror (Ge (Sub (ew, ex))) = Ge (Sub (ew, ex))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   996
  | mirror (Ge (Mul (ey, ez))) = Ge (Mul (ey, ez))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   997
  | mirror (Eq (C fo)) = Eq (C fo)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   998
  | mirror (Eq (Bound fp)) = Eq (Bound fp)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
   999
  | mirror (Eq (Neg ft)) = Eq (Neg ft)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1000
  | mirror (Eq (Add (fu, fv))) = Eq (Add (fu, fv))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1001
  | mirror (Eq (Sub (fw, fx))) = Eq (Sub (fw, fx))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1002
  | mirror (Eq (Mul (fy, fz))) = Eq (Mul (fy, fz))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1003
  | mirror (NEq (C go)) = NEq (C go)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1004
  | mirror (NEq (Bound gp)) = NEq (Bound gp)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1005
  | mirror (NEq (Neg gt)) = NEq (Neg gt)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1006
  | mirror (NEq (Add (gu, gv))) = NEq (Add (gu, gv))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1007
  | mirror (NEq (Sub (gw, gx))) = NEq (Sub (gw, gx))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1008
  | mirror (NEq (Mul (gy, gz))) = NEq (Mul (gy, gz))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1009
  | mirror (Dvd (aa, C ho)) = Dvd (aa, C ho)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1010
  | mirror (Dvd (aa, Bound hp)) = Dvd (aa, Bound hp)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1011
  | mirror (Dvd (aa, Neg ht)) = Dvd (aa, Neg ht)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1012
  | mirror (Dvd (aa, Add (hu, hv))) = Dvd (aa, Add (hu, hv))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1013
  | mirror (Dvd (aa, Sub (hw, hx))) = Dvd (aa, Sub (hw, hx))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1014
  | mirror (Dvd (aa, Mul (hy, hz))) = Dvd (aa, Mul (hy, hz))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1015
  | mirror (NDvd (ac, C io)) = NDvd (ac, C io)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1016
  | mirror (NDvd (ac, Bound ip)) = NDvd (ac, Bound ip)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1017
  | mirror (NDvd (ac, Neg it)) = NDvd (ac, Neg it)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1018
  | mirror (NDvd (ac, Add (iu, iv))) = NDvd (ac, Add (iu, iv))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1019
  | mirror (NDvd (ac, Sub (iw, ix))) = NDvd (ac, Sub (iw, ix))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1020
  | mirror (NDvd (ac, Mul (iy, iz))) = NDvd (ac, Mul (iy, iz))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1021
  | mirror (Not ae) = Not ae
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1022
  | mirror (Imp (aj, ak)) = Imp (aj, ak)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1023
  | mirror (Iff (al, am)) = Iff (al, am)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1024
  | mirror (E an) = E an
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1025
  | mirror (A ao) = A ao
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1026
  | mirror (Closed ap) = Closed ap
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1027
  | mirror (NClosed aq) = NClosed aq
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1028
  | mirror (Lt (Cn (cm, c, e))) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1029
    (if eqop eq_nat cm 0 then Gt (Cn (0, c, Neg e))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1030
      else Lt (Cn (suc (minus_nat cm 1), c, e)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1031
  | mirror (Le (Cn (dm, c, e))) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1032
    (if eqop eq_nat dm 0 then Ge (Cn (0, c, Neg e))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1033
      else Le (Cn (suc (minus_nat dm 1), c, e)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1034
  | mirror (Gt (Cn (em, c, e))) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1035
    (if eqop eq_nat em 0 then Lt (Cn (0, c, Neg e))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1036
      else Gt (Cn (suc (minus_nat em 1), c, e)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1037
  | mirror (Ge (Cn (fm, c, e))) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1038
    (if eqop eq_nat fm 0 then Le (Cn (0, c, Neg e))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1039
      else Ge (Cn (suc (minus_nat fm 1), c, e)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1040
  | mirror (Eq (Cn (gm, c, e))) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1041
    (if eqop eq_nat gm 0 then Eq (Cn (0, c, Neg e))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1042
      else Eq (Cn (suc (minus_nat gm 1), c, e)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1043
  | mirror (NEq (Cn (hm, c, e))) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1044
    (if eqop eq_nat hm 0 then NEq (Cn (0, c, Neg e))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1045
      else NEq (Cn (suc (minus_nat hm 1), c, e)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1046
  | mirror (Dvd (i, Cn (im, c, e))) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1047
    (if eqop eq_nat im 0 then Dvd (i, Cn (0, c, Neg e))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1048
      else Dvd (i, Cn (suc (minus_nat im 1), c, e)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1049
  | mirror (NDvd (i, Cn (jm, c, e))) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1050
    (if eqop eq_nat jm 0 then NDvd (i, Cn (0, c, Neg e))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1051
      else NDvd (i, Cn (suc (minus_nat jm 1), c, e)));
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1052
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1053
fun size_list [] = 0
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1054
  | size_list (a :: lista) = IntInf.+ (size_list lista, suc 0);
23466
886655a150f6 moved quantifier elimination tools to Tools/Qelim/;
wenzelm
parents:
diff changeset
  1055
29787
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1056
fun alpha (And (p, q)) = append (alpha p) (alpha q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1057
  | alpha (Or (p, q)) = append (alpha p) (alpha q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1058
  | alpha T = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1059
  | alpha F = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1060
  | alpha (Lt (C bo)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1061
  | alpha (Lt (Bound bp)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1062
  | alpha (Lt (Neg bt)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1063
  | alpha (Lt (Add (bu, bv))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1064
  | alpha (Lt (Sub (bw, bx))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1065
  | alpha (Lt (Mul (by, bz))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1066
  | alpha (Le (C co)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1067
  | alpha (Le (Bound cp)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1068
  | alpha (Le (Neg ct)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1069
  | alpha (Le (Add (cu, cv))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1070
  | alpha (Le (Sub (cw, cx))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1071
  | alpha (Le (Mul (cy, cz))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1072
  | alpha (Gt (C doa)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1073
  | alpha (Gt (Bound dp)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1074
  | alpha (Gt (Neg dt)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1075
  | alpha (Gt (Add (du, dv))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1076
  | alpha (Gt (Sub (dw, dx))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1077
  | alpha (Gt (Mul (dy, dz))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1078
  | alpha (Ge (C eo)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1079
  | alpha (Ge (Bound ep)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1080
  | alpha (Ge (Neg et)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1081
  | alpha (Ge (Add (eu, ev))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1082
  | alpha (Ge (Sub (ew, ex))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1083
  | alpha (Ge (Mul (ey, ez))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1084
  | alpha (Eq (C fo)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1085
  | alpha (Eq (Bound fp)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1086
  | alpha (Eq (Neg ft)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1087
  | alpha (Eq (Add (fu, fv))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1088
  | alpha (Eq (Sub (fw, fx))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1089
  | alpha (Eq (Mul (fy, fz))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1090
  | alpha (NEq (C go)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1091
  | alpha (NEq (Bound gp)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1092
  | alpha (NEq (Neg gt)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1093
  | alpha (NEq (Add (gu, gv))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1094
  | alpha (NEq (Sub (gw, gx))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1095
  | alpha (NEq (Mul (gy, gz))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1096
  | alpha (Dvd (aa, ab)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1097
  | alpha (NDvd (ac, ad)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1098
  | alpha (Not ae) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1099
  | alpha (Imp (aj, ak)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1100
  | alpha (Iff (al, am)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1101
  | alpha (E an) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1102
  | alpha (A ao) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1103
  | alpha (Closed ap) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1104
  | alpha (NClosed aq) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1105
  | alpha (Lt (Cn (cm, c, e))) = (if eqop eq_nat cm 0 then [e] else [])
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1106
  | alpha (Le (Cn (dm, c, e))) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1107
    (if eqop eq_nat dm 0 then [Add (C (~1 : IntInf.int), e)] else [])
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1108
  | alpha (Gt (Cn (em, c, e))) = (if eqop eq_nat em 0 then [] else [])
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1109
  | alpha (Ge (Cn (fm, c, e))) = (if eqop eq_nat fm 0 then [] else [])
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1110
  | alpha (Eq (Cn (gm, c, e))) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1111
    (if eqop eq_nat gm 0 then [Add (C (~1 : IntInf.int), e)] else [])
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1112
  | alpha (NEq (Cn (hm, c, e))) = (if eqop eq_nat hm 0 then [e] else []);
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1113
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1114
fun beta (And (p, q)) = append (beta p) (beta q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1115
  | beta (Or (p, q)) = append (beta p) (beta q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1116
  | beta T = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1117
  | beta F = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1118
  | beta (Lt (C bo)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1119
  | beta (Lt (Bound bp)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1120
  | beta (Lt (Neg bt)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1121
  | beta (Lt (Add (bu, bv))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1122
  | beta (Lt (Sub (bw, bx))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1123
  | beta (Lt (Mul (by, bz))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1124
  | beta (Le (C co)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1125
  | beta (Le (Bound cp)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1126
  | beta (Le (Neg ct)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1127
  | beta (Le (Add (cu, cv))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1128
  | beta (Le (Sub (cw, cx))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1129
  | beta (Le (Mul (cy, cz))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1130
  | beta (Gt (C doa)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1131
  | beta (Gt (Bound dp)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1132
  | beta (Gt (Neg dt)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1133
  | beta (Gt (Add (du, dv))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1134
  | beta (Gt (Sub (dw, dx))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1135
  | beta (Gt (Mul (dy, dz))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1136
  | beta (Ge (C eo)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1137
  | beta (Ge (Bound ep)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1138
  | beta (Ge (Neg et)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1139
  | beta (Ge (Add (eu, ev))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1140
  | beta (Ge (Sub (ew, ex))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1141
  | beta (Ge (Mul (ey, ez))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1142
  | beta (Eq (C fo)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1143
  | beta (Eq (Bound fp)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1144
  | beta (Eq (Neg ft)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1145
  | beta (Eq (Add (fu, fv))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1146
  | beta (Eq (Sub (fw, fx))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1147
  | beta (Eq (Mul (fy, fz))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1148
  | beta (NEq (C go)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1149
  | beta (NEq (Bound gp)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1150
  | beta (NEq (Neg gt)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1151
  | beta (NEq (Add (gu, gv))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1152
  | beta (NEq (Sub (gw, gx))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1153
  | beta (NEq (Mul (gy, gz))) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1154
  | beta (Dvd (aa, ab)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1155
  | beta (NDvd (ac, ad)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1156
  | beta (Not ae) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1157
  | beta (Imp (aj, ak)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1158
  | beta (Iff (al, am)) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1159
  | beta (E an) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1160
  | beta (A ao) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1161
  | beta (Closed ap) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1162
  | beta (NClosed aq) = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1163
  | beta (Lt (Cn (cm, c, e))) = (if eqop eq_nat cm 0 then [] else [])
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1164
  | beta (Le (Cn (dm, c, e))) = (if eqop eq_nat dm 0 then [] else [])
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1165
  | beta (Gt (Cn (em, c, e))) = (if eqop eq_nat em 0 then [Neg e] else [])
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1166
  | beta (Ge (Cn (fm, c, e))) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1167
    (if eqop eq_nat fm 0 then [Sub (C (~1 : IntInf.int), e)] else [])
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1168
  | beta (Eq (Cn (gm, c, e))) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1169
    (if eqop eq_nat gm 0 then [Sub (C (~1 : IntInf.int), e)] else [])
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1170
  | beta (NEq (Cn (hm, c, e))) = (if eqop eq_nat hm 0 then [Neg e] else []);
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1171
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1172
fun member A_ x [] = false
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1173
  | member A_ x (y :: ys) = eqop A_ x y orelse member A_ x ys;
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1174
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1175
fun remdups A_ [] = []
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1176
  | remdups A_ (x :: xs) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1177
    (if member A_ x xs then remdups A_ xs else x :: remdups A_ xs);
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1178
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1179
fun delta (And (p, q)) = zlcm (delta p) (delta q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1180
  | delta (Or (p, q)) = zlcm (delta p) (delta q)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1181
  | delta T = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1182
  | delta F = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1183
  | delta (Lt u) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1184
  | delta (Le v) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1185
  | delta (Gt w) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1186
  | delta (Ge x) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1187
  | delta (Eq ya) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1188
  | delta (NEq z) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1189
  | delta (Dvd (aa, C bo)) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1190
  | delta (Dvd (aa, Bound bp)) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1191
  | delta (Dvd (aa, Neg bt)) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1192
  | delta (Dvd (aa, Add (bu, bv))) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1193
  | delta (Dvd (aa, Sub (bw, bx))) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1194
  | delta (Dvd (aa, Mul (by, bz))) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1195
  | delta (NDvd (ac, C co)) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1196
  | delta (NDvd (ac, Bound cp)) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1197
  | delta (NDvd (ac, Neg ct)) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1198
  | delta (NDvd (ac, Add (cu, cv))) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1199
  | delta (NDvd (ac, Sub (cw, cx))) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1200
  | delta (NDvd (ac, Mul (cy, cz))) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1201
  | delta (Not ae) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1202
  | delta (Imp (aj, ak)) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1203
  | delta (Iff (al, am)) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1204
  | delta (E an) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1205
  | delta (A ao) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1206
  | delta (Closed ap) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1207
  | delta (NClosed aq) = (1 : IntInf.int)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1208
  | delta (Dvd (b, Cn (cm, c, e))) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1209
    (if eqop eq_nat cm 0 then b else (1 : IntInf.int))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1210
  | delta (NDvd (b, Cn (dm, c, e))) =
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1211
    (if eqop eq_nat dm 0 then b else (1 : IntInf.int));
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1212
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1213
fun div_int a b = fst (divmoda a b);
23689
0410269099dc replaced code generator framework for reflected cooper
haftmann
parents: 23466
diff changeset
  1214
29787
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1215
fun a_beta (And (p, q)) = (fn k => And (a_beta p k, a_beta q k))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1216
  | a_beta (Or (p, q)) = (fn k => Or (a_beta p k, a_beta q k))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1217
  | a_beta T = (fn k => T)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1218
  | a_beta F = (fn k => F)
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1219
  | a_beta (Lt (C bo)) = (fn k => Lt (C bo))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1220
  | a_beta (Lt (Bound bp)) = (fn k => Lt (Bound bp))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1221
  | a_beta (Lt (Neg bt)) = (fn k => Lt (Neg bt))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1222
  | a_beta (Lt (Add (bu, bv))) = (fn k => Lt (Add (bu, bv)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1223
  | a_beta (Lt (Sub (bw, bx))) = (fn k => Lt (Sub (bw, bx)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1224
  | a_beta (Lt (Mul (by, bz))) = (fn k => Lt (Mul (by, bz)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1225
  | a_beta (Le (C co)) = (fn k => Le (C co))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1226
  | a_beta (Le (Bound cp)) = (fn k => Le (Bound cp))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1227
  | a_beta (Le (Neg ct)) = (fn k => Le (Neg ct))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1228
  | a_beta (Le (Add (cu, cv))) = (fn k => Le (Add (cu, cv)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1229
  | a_beta (Le (Sub (cw, cx))) = (fn k => Le (Sub (cw, cx)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1230
  | a_beta (Le (Mul (cy, cz))) = (fn k => Le (Mul (cy, cz)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1231
  | a_beta (Gt (C doa)) = (fn k => Gt (C doa))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1232
  | a_beta (Gt (Bound dp)) = (fn k => Gt (Bound dp))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1233
  | a_beta (Gt (Neg dt)) = (fn k => Gt (Neg dt))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1234
  | a_beta (Gt (Add (du, dv))) = (fn k => Gt (Add (du, dv)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1235
  | a_beta (Gt (Sub (dw, dx))) = (fn k => Gt (Sub (dw, dx)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1236
  | a_beta (Gt (Mul (dy, dz))) = (fn k => Gt (Mul (dy, dz)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1237
  | a_beta (Ge (C eo)) = (fn k => Ge (C eo))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1238
  | a_beta (Ge (Bound ep)) = (fn k => Ge (Bound ep))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1239
  | a_beta (Ge (Neg et)) = (fn k => Ge (Neg et))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1240
  | a_beta (Ge (Add (eu, ev))) = (fn k => Ge (Add (eu, ev)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1241
  | a_beta (Ge (Sub (ew, ex))) = (fn k => Ge (Sub (ew, ex)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1242
  | a_beta (Ge (Mul (ey, ez))) = (fn k => Ge (Mul (ey, ez)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1243
  | a_beta (Eq (C fo)) = (fn k => Eq (C fo))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1244
  | a_beta (Eq (Bound fp)) = (fn k => Eq (Bound fp))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1245
  | a_beta (Eq (Neg ft)) = (fn k => Eq (Neg ft))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1246
  | a_beta (Eq (Add (fu, fv))) = (fn k => Eq (Add (fu, fv)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1247
  | a_beta (Eq (Sub (fw, fx))) = (fn k => Eq (Sub (fw, fx)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1248
  | a_beta (Eq (Mul (fy, fz))) = (fn k => Eq (Mul (fy, fz)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1249
  | a_beta (NEq (C go)) = (fn k => NEq (C go))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1250
  | a_beta (NEq (Bound gp)) = (fn k => NEq (Bound gp))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1251
  | a_beta (NEq (Neg gt)) = (fn k => NEq (Neg gt))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1252
  | a_beta (NEq (Add (gu, gv))) = (fn k => NEq (Add (gu, gv)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1253
  | a_beta (NEq (Sub (gw, gx))) = (fn k => NEq (Sub (gw, gx)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1254
  | a_beta (NEq (Mul (gy, gz))) = (fn k => NEq (Mul (gy, gz)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1255
  | a_beta (Dvd (aa, C ho)) = (fn k => Dvd (aa, C ho))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1256
  | a_beta (Dvd (aa, Bound hp)) = (fn k => Dvd (aa, Bound hp))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1257
  | a_beta (Dvd (aa, Neg ht)) = (fn k => Dvd (aa, Neg ht))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1258
  | a_beta (Dvd (aa, Add (hu, hv))) = (fn k => Dvd (aa, Add (hu, hv)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1259
  | a_beta (Dvd (aa, Sub (hw, hx))) = (fn k => Dvd (aa, Sub (hw, hx)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1260
  | a_beta (Dvd (aa, Mul (hy, hz))) = (fn k => Dvd (aa, Mul (hy, hz)))
23bf900a21db regenerated presburger code
haftmann
parents: 24584
diff changeset
  1261
  | a_beta (NDvd (ac, C io)) = (fn k => NDvd (ac, C io))
23bf900a21db regenerated presburger code
haftmann
parents: