| author | Thomas Lindae <thomas.lindae@in.tum.de> | 
| Thu, 16 May 2024 11:59:33 +0200 | |
| changeset 81042 | f1e0ca5aaa6b | 
| parent 70586 | 57df8a85317a | 
| permissions | -rw-r--r-- | 
| 63992 | 1  | 
(* Title: Tools/Argo/argo_expr.ML  | 
| 
63960
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
2  | 
Author: Sascha Boehme  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
3  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
4  | 
The input language of the Argo solver.  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
5  | 
*)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
6  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
7  | 
signature ARGO_EXPR =  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
8  | 
sig  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
9  | 
(* data types *)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
10  | 
datatype typ = Bool | Real | Func of typ * typ | Type of string  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
11  | 
datatype kind =  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
12  | 
True | False | Not | And | Or | Imp | Iff | Ite | Eq | App | Con of string * typ |  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
13  | 
Le | Lt | Num of Rat.rat | Neg | Add | Sub | Mul | Div | Min | Max | Abs  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
14  | 
datatype expr = E of kind * expr list  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
15  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
16  | 
(* indices, equalities, orders *)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
17  | 
val int_of_kind: kind -> int  | 
| 70586 | 18  | 
val con_ord: (string * typ) ord  | 
| 
63960
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
19  | 
val eq_kind: kind * kind -> bool  | 
| 70586 | 20  | 
val kind_ord: kind ord  | 
| 
63960
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
21  | 
val eq_expr: expr * expr -> bool  | 
| 70586 | 22  | 
val expr_ord: expr ord  | 
| 
63960
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
23  | 
val dual_expr: expr -> expr -> bool  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
24  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
25  | 
(* constructors *)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
26  | 
val kind_of_string: string -> kind  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
27  | 
val true_expr: expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
28  | 
val false_expr: expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
29  | 
val mk_not: expr -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
30  | 
val mk_and: expr list -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
31  | 
val mk_and2: expr -> expr -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
32  | 
val mk_or: expr list -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
33  | 
val mk_or2: expr -> expr -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
34  | 
val mk_imp: expr -> expr -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
35  | 
val mk_iff: expr -> expr -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
36  | 
val mk_ite: expr -> expr -> expr -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
37  | 
val mk_eq: expr -> expr -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
38  | 
val mk_app: expr -> expr -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
39  | 
val mk_con: string * typ -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
40  | 
val mk_le: expr -> expr -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
41  | 
val mk_lt: expr -> expr -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
42  | 
val mk_num: Rat.rat -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
43  | 
val mk_neg: expr -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
44  | 
val mk_add: expr list -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
45  | 
val mk_add2: expr -> expr -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
46  | 
val mk_sub: expr -> expr -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
47  | 
val mk_mul: expr -> expr -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
48  | 
val mk_div: expr -> expr -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
49  | 
val mk_min: expr -> expr -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
50  | 
val mk_max: expr -> expr -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
51  | 
val mk_abs: expr -> expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
52  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
53  | 
(* type checking *)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
54  | 
exception TYPE of expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
55  | 
exception EXPR of expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
56  | 
val type_of: expr -> typ (* raises EXPR *)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
57  | 
val check: expr -> bool (* raises TYPE and EXPR *)  | 
| 
64927
 
a5a09855e424
less complex rewriting of Argo expressions: select candidate rewrite rules by analyzing only on the kind of the head expression, then select the applicable rewrite rule using ML pattern matching; keep all normalization code in a single place: modules of decision procedures focus on their core aspects; more normalization for non-linear arithmetic
 
boehmes 
parents: 
63992 
diff
changeset
 | 
58  | 
|
| 
 
a5a09855e424
less complex rewriting of Argo expressions: select candidate rewrite rules by analyzing only on the kind of the head expression, then select the applicable rewrite rule using ML pattern matching; keep all normalization code in a single place: modules of decision procedures focus on their core aspects; more normalization for non-linear arithmetic
 
boehmes 
parents: 
63992 
diff
changeset
 | 
59  | 
(* testers *)  | 
| 
 
a5a09855e424
less complex rewriting of Argo expressions: select candidate rewrite rules by analyzing only on the kind of the head expression, then select the applicable rewrite rule using ML pattern matching; keep all normalization code in a single place: modules of decision procedures focus on their core aspects; more normalization for non-linear arithmetic
 
boehmes 
parents: 
63992 
diff
changeset
 | 
60  | 
val is_nary: kind -> bool  | 
| 
66301
 
8a6a89d6cf2b
more explicit Argo proof traces; more correct proof replay for term applications
 
boehmes 
parents: 
64927 
diff
changeset
 | 
61  | 
|
| 
 
8a6a89d6cf2b
more explicit Argo proof traces; more correct proof replay for term applications
 
boehmes 
parents: 
64927 
diff
changeset
 | 
62  | 
(* string representations *)  | 
| 
 
8a6a89d6cf2b
more explicit Argo proof traces; more correct proof replay for term applications
 
boehmes 
parents: 
64927 
diff
changeset
 | 
63  | 
val string_of_kind: kind -> string  | 
| 
63960
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
64  | 
end  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
65  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
66  | 
structure Argo_Expr: ARGO_EXPR =  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
67  | 
struct  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
68  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
69  | 
(* data types *)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
70  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
71  | 
datatype typ = Bool | Real | Func of typ * typ | Type of string  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
72  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
73  | 
datatype kind =  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
74  | 
True | False | Not | And | Or | Imp | Iff | Ite | Eq | App | Con of string * typ |  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
75  | 
Le | Lt | Num of Rat.rat | Neg | Add | Sub | Mul | Div | Min | Max | Abs  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
76  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
77  | 
datatype expr = E of kind * expr list  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
78  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
79  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
80  | 
(* indices, equalities, orders *)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
81  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
82  | 
fun int_of_type Bool = 0  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
83  | 
| int_of_type Real = 1  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
84  | 
| int_of_type (Func _) = 2  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
85  | 
| int_of_type (Type _) = 3  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
86  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
87  | 
fun int_of_kind True = 0  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
88  | 
| int_of_kind False = 1  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
89  | 
| int_of_kind Not = 2  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
90  | 
| int_of_kind And = 3  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
91  | 
| int_of_kind Or = 4  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
92  | 
| int_of_kind Imp = 5  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
93  | 
| int_of_kind Iff = 6  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
94  | 
| int_of_kind Ite = 7  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
95  | 
| int_of_kind Eq = 8  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
96  | 
| int_of_kind App = 9  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
97  | 
| int_of_kind (Con _) = 10  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
98  | 
| int_of_kind Le = 11  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
99  | 
| int_of_kind Lt = 12  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
100  | 
| int_of_kind (Num _) = 13  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
101  | 
| int_of_kind Neg = 14  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
102  | 
| int_of_kind Add = 15  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
103  | 
| int_of_kind Sub = 16  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
104  | 
| int_of_kind Mul = 17  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
105  | 
| int_of_kind Div = 18  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
106  | 
| int_of_kind Min = 19  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
107  | 
| int_of_kind Max = 20  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
108  | 
| int_of_kind Abs = 21  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
109  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
110  | 
fun eq_type (Bool, Bool) = true  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
111  | 
| eq_type (Real, Real) = true  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
112  | 
| eq_type (Func tys1, Func tys2) = eq_pair eq_type eq_type (tys1, tys2)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
113  | 
| eq_type (Type n1, Type n2) = (n1 = n2)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
114  | 
| eq_type _ = false  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
115  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
116  | 
fun type_ord (Bool, Bool) = EQUAL  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
117  | 
| type_ord (Real, Real) = EQUAL  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
118  | 
| type_ord (Type n1, Type n2) = fast_string_ord (n1, n2)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
119  | 
| type_ord (Func tys1, Func tys2) = prod_ord type_ord type_ord (tys1, tys2)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
120  | 
| type_ord (ty1, ty2) = int_ord (int_of_type ty1, int_of_type ty2)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
121  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
122  | 
fun eq_con cp = eq_pair (op =) eq_type cp  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
123  | 
fun con_ord cp = prod_ord fast_string_ord type_ord cp  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
124  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
125  | 
fun eq_kind (Con c1, Con c2) = eq_con (c1, c2)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
126  | 
| eq_kind (Num n1, Num n2) = n1 = n2  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
127  | 
| eq_kind (k1, k2) = (k1 = k2)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
128  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
129  | 
fun kind_ord (Con c1, Con c2) = con_ord (c1, c2)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
130  | 
| kind_ord (Num n1, Num n2) = Rat.ord (n1, n2)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
131  | 
| kind_ord (k1, k2) = int_ord (int_of_kind k1, int_of_kind k2)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
132  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
133  | 
fun eq_expr (E e1, E e2) = eq_pair eq_kind (eq_list eq_expr) (e1, e2)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
134  | 
fun expr_ord (E e1, E e2) = prod_ord kind_ord (list_ord expr_ord) (e1, e2)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
135  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
136  | 
fun dual_expr (E (Not, [e1])) e2 = eq_expr (e1, e2)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
137  | 
| dual_expr e1 (E (Not, [e2])) = eq_expr (e1, e2)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
138  | 
| dual_expr _ _ = false  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
139  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
140  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
141  | 
(* constructors *)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
142  | 
|
| 
66301
 
8a6a89d6cf2b
more explicit Argo proof traces; more correct proof replay for term applications
 
boehmes 
parents: 
64927 
diff
changeset
 | 
143  | 
val string_kinds = [  | 
| 
63960
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
144  | 
  ("true", True),("false", False), ("not", Not), ("and", And), ("or", Or), ("imp", Imp),
 | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
145  | 
  ("iff", Iff), ("ite", Ite), ("eq", Eq), ("app", App), ("le", Le), ("lt", Lt), ("neg", Neg),
 | 
| 
66301
 
8a6a89d6cf2b
more explicit Argo proof traces; more correct proof replay for term applications
 
boehmes 
parents: 
64927 
diff
changeset
 | 
146  | 
  ("add", Add), ("sub", Sub), ("mul", Mul), ("div", Div), ("min", Min), ("max", Max), ("abs", Abs)]
 | 
| 
 
8a6a89d6cf2b
more explicit Argo proof traces; more correct proof replay for term applications
 
boehmes 
parents: 
64927 
diff
changeset
 | 
147  | 
|
| 
 
8a6a89d6cf2b
more explicit Argo proof traces; more correct proof replay for term applications
 
boehmes 
parents: 
64927 
diff
changeset
 | 
148  | 
val kind_of_string = the o Symtab.lookup (Symtab.make string_kinds)  | 
| 
63960
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
149  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
150  | 
val true_expr = E (True, [])  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
151  | 
val false_expr = E (False, [])  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
152  | 
fun mk_not e = E (Not, [e])  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
153  | 
fun mk_and es = E (And, es)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
154  | 
fun mk_and2 e1 e2 = mk_and [e1, e2]  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
155  | 
fun mk_or es = E (Or, es)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
156  | 
fun mk_or2 e1 e2 = mk_or [e1, e2]  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
157  | 
fun mk_imp e1 e2 = E (Imp, [e1, e2])  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
158  | 
fun mk_iff e1 e2 = E (Iff, [e1, e2])  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
159  | 
fun mk_ite e1 e2 e3 = E (Ite, [e1, e2, e3])  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
160  | 
fun mk_eq e1 e2 = E (Eq, [e1, e2])  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
161  | 
fun mk_app e1 e2 = E (App, [e1, e2])  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
162  | 
fun mk_con n = E (Con n, [])  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
163  | 
fun mk_le e1 e2 = E (Le, [e1, e2])  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
164  | 
fun mk_lt e1 e2 = E (Lt, [e1, e2])  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
165  | 
fun mk_num r = E (Num r, [])  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
166  | 
fun mk_neg e = E (Neg, [e])  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
167  | 
fun mk_add es = E (Add, es)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
168  | 
fun mk_add2 e1 e2 = mk_add [e1, e2]  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
169  | 
fun mk_sub e1 e2 = E (Sub, [e1, e2])  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
170  | 
fun mk_mul e1 e2 = E (Mul, [e1, e2])  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
171  | 
fun mk_div e1 e2 = E (Div, [e1, e2])  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
172  | 
fun mk_min e1 e2 = E (Min, [e1, e2])  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
173  | 
fun mk_max e1 e2 = E (Max, [e1, e2])  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
174  | 
fun mk_abs e = E (Abs, [e])  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
175  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
176  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
177  | 
(* type checking *)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
178  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
179  | 
exception TYPE of expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
180  | 
exception EXPR of expr  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
181  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
182  | 
fun dest_func_type _ (Func tys) = tys  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
183  | 
| dest_func_type e _ = raise TYPE e  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
184  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
185  | 
fun type_of (E (True, _)) = Bool  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
186  | 
| type_of (E (False, _)) = Bool  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
187  | 
| type_of (E (Not, _)) = Bool  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
188  | 
| type_of (E (And, _)) = Bool  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
189  | 
| type_of (E (Or, _)) = Bool  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
190  | 
| type_of (E (Imp, _)) = Bool  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
191  | 
| type_of (E (Iff, _)) = Bool  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
192  | 
| type_of (E (Ite, [_, e, _])) = type_of e  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
193  | 
| type_of (E (Eq, _)) = Bool  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
194  | 
| type_of (E (App, [e, _])) = snd (dest_func_type e (type_of e))  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
195  | 
| type_of (E (Con (_, ty), _)) = ty  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
196  | 
| type_of (E (Le, _)) = Bool  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
197  | 
| type_of (E (Lt, _)) = Bool  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
198  | 
| type_of (E (Num _, _)) = Real  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
199  | 
| type_of (E (Neg, _)) = Real  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
200  | 
| type_of (E (Add, _)) = Real  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
201  | 
| type_of (E (Sub, _)) = Real  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
202  | 
| type_of (E (Mul, _)) = Real  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
203  | 
| type_of (E (Div, _)) = Real  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
204  | 
| type_of (E (Min, _)) = Real  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
205  | 
| type_of (E (Max, _)) = Real  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
206  | 
| type_of (E (Abs, _)) = Real  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
207  | 
| type_of e = raise EXPR e  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
208  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
209  | 
fun all_type ty (E (_, es)) = forall (curry eq_type ty o type_of) es  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
210  | 
val all_bool = all_type Bool  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
211  | 
val all_real = all_type Real  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
212  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
213  | 
(*  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
214  | 
Types as well as proper arities are checked.  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
215  | 
Exception TYPE is raised for invalid types.  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
216  | 
Exception EXPR is raised for invalid expressions and invalid arities.  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
217  | 
*)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
218  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
219  | 
fun check (e as E (_, es)) = (forall check es andalso raw_check e) orelse raise TYPE e  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
220  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
221  | 
and raw_check (E (True, [])) = true  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
222  | 
| raw_check (E (False, [])) = true  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
223  | 
| raw_check (e as E (Not, [_])) = all_bool e  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
224  | 
| raw_check (e as E (And, _ :: _)) = all_bool e  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
225  | 
| raw_check (e as E (Or, _ :: _)) = all_bool e  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
226  | 
| raw_check (e as E (Imp, [_, _])) = all_bool e  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
227  | 
| raw_check (e as E (Iff, [_, _])) = all_bool e  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
228  | 
| raw_check (E (Ite, [e1, e2, e3])) =  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
229  | 
let val ty1 = type_of e1 and ty2 = type_of e2 and ty3 = type_of e3  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
230  | 
in eq_type (ty1, Bool) andalso eq_type (ty2, ty3) end  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
231  | 
| raw_check (E (Eq, [e1, e2])) =  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
232  | 
let val ty1 = type_of e1 and ty2 = type_of e2  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
233  | 
in eq_type (ty1, ty2) andalso not (eq_type (ty1, Bool)) end  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
234  | 
| raw_check (E (App, [e1, e2])) =  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
235  | 
eq_type (fst (dest_func_type e1 (type_of e1)), type_of e2)  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
236  | 
| raw_check (E (Con _, [])) = true  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
237  | 
| raw_check (E (Num _, [])) = true  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
238  | 
| raw_check (e as E (Le, [_, _])) = all_real e  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
239  | 
| raw_check (e as E (Lt, [_, _])) = all_real e  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
240  | 
| raw_check (e as E (Neg, [_])) = all_real e  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
241  | 
| raw_check (e as E (Add, _)) = all_real e  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
242  | 
| raw_check (e as E (Sub, [_, _])) = all_real e  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
243  | 
| raw_check (e as E (Mul, [_, _])) = all_real e  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
244  | 
| raw_check (e as E (Div, [_, _])) = all_real e  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
245  | 
| raw_check (e as E (Min, [_, _])) = all_real e  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
246  | 
| raw_check (e as E (Max, [_, _])) = all_real e  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
247  | 
| raw_check (e as E (Abs, [_])) = all_real e  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
248  | 
| raw_check e = raise EXPR e  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
249  | 
|
| 
64927
 
a5a09855e424
less complex rewriting of Argo expressions: select candidate rewrite rules by analyzing only on the kind of the head expression, then select the applicable rewrite rule using ML pattern matching; keep all normalization code in a single place: modules of decision procedures focus on their core aspects; more normalization for non-linear arithmetic
 
boehmes 
parents: 
63992 
diff
changeset
 | 
250  | 
|
| 
 
a5a09855e424
less complex rewriting of Argo expressions: select candidate rewrite rules by analyzing only on the kind of the head expression, then select the applicable rewrite rule using ML pattern matching; keep all normalization code in a single place: modules of decision procedures focus on their core aspects; more normalization for non-linear arithmetic
 
boehmes 
parents: 
63992 
diff
changeset
 | 
251  | 
(* testers *)  | 
| 
 
a5a09855e424
less complex rewriting of Argo expressions: select candidate rewrite rules by analyzing only on the kind of the head expression, then select the applicable rewrite rule using ML pattern matching; keep all normalization code in a single place: modules of decision procedures focus on their core aspects; more normalization for non-linear arithmetic
 
boehmes 
parents: 
63992 
diff
changeset
 | 
252  | 
|
| 
 
a5a09855e424
less complex rewriting of Argo expressions: select candidate rewrite rules by analyzing only on the kind of the head expression, then select the applicable rewrite rule using ML pattern matching; keep all normalization code in a single place: modules of decision procedures focus on their core aspects; more normalization for non-linear arithmetic
 
boehmes 
parents: 
63992 
diff
changeset
 | 
253  | 
fun is_nary k = member (op =) [And, Or, Add] k  | 
| 
 
a5a09855e424
less complex rewriting of Argo expressions: select candidate rewrite rules by analyzing only on the kind of the head expression, then select the applicable rewrite rule using ML pattern matching; keep all normalization code in a single place: modules of decision procedures focus on their core aspects; more normalization for non-linear arithmetic
 
boehmes 
parents: 
63992 
diff
changeset
 | 
254  | 
|
| 
66301
 
8a6a89d6cf2b
more explicit Argo proof traces; more correct proof replay for term applications
 
boehmes 
parents: 
64927 
diff
changeset
 | 
255  | 
|
| 
 
8a6a89d6cf2b
more explicit Argo proof traces; more correct proof replay for term applications
 
boehmes 
parents: 
64927 
diff
changeset
 | 
256  | 
(* string representations *)  | 
| 
 
8a6a89d6cf2b
more explicit Argo proof traces; more correct proof replay for term applications
 
boehmes 
parents: 
64927 
diff
changeset
 | 
257  | 
|
| 
 
8a6a89d6cf2b
more explicit Argo proof traces; more correct proof replay for term applications
 
boehmes 
parents: 
64927 
diff
changeset
 | 
258  | 
val kind_strings = map swap string_kinds  | 
| 
 
8a6a89d6cf2b
more explicit Argo proof traces; more correct proof replay for term applications
 
boehmes 
parents: 
64927 
diff
changeset
 | 
259  | 
|
| 
 
8a6a89d6cf2b
more explicit Argo proof traces; more correct proof replay for term applications
 
boehmes 
parents: 
64927 
diff
changeset
 | 
260  | 
fun string_of_kind (Con (n, _)) = n  | 
| 
 
8a6a89d6cf2b
more explicit Argo proof traces; more correct proof replay for term applications
 
boehmes 
parents: 
64927 
diff
changeset
 | 
261  | 
| string_of_kind (Num n) = Rat.string_of_rat n  | 
| 
 
8a6a89d6cf2b
more explicit Argo proof traces; more correct proof replay for term applications
 
boehmes 
parents: 
64927 
diff
changeset
 | 
262  | 
| string_of_kind k = the (AList.lookup (op =) kind_strings k)  | 
| 
 
8a6a89d6cf2b
more explicit Argo proof traces; more correct proof replay for term applications
 
boehmes 
parents: 
64927 
diff
changeset
 | 
263  | 
|
| 
63960
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
264  | 
end  | 
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
265  | 
|
| 
 
3daf02070be5
new proof method "argo" for a combination of quantifier-free propositional logic with equality and linear real arithmetic
 
boehmes 
parents:  
diff
changeset
 | 
266  | 
structure Argo_Exprtab = Table(type key = Argo_Expr.expr val ord = Argo_Expr.expr_ord)  |