author | wenzelm |
Tue, 05 Sep 2000 18:45:51 +0200 | |
changeset 9850 | bee6eb4b6a42 |
parent 9543 | ce61d1c1a509 |
child 10384 | a499b9ce2ffe |
permissions | -rw-r--r-- |
4349
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
1 |
(* Title: FOL/fologic.ML |
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
2 |
ID: $Id$ |
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
3 |
Author: Lawrence C Paulson |
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
4 |
|
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
5 |
Abstract syntax operations for FOL. |
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
6 |
*) |
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
7 |
|
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
8 |
signature FOLOGIC = |
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
9 |
sig |
6140 | 10 |
val oT : typ |
11 |
val mk_Trueprop : term -> term |
|
9473 | 12 |
val atomic_Trueprop : string -> term |
6140 | 13 |
val dest_Trueprop : term -> term |
9850 | 14 |
val not : term |
6140 | 15 |
val conj : term |
16 |
val disj : term |
|
17 |
val imp : term |
|
9543 | 18 |
val iff : term |
7692 | 19 |
val mk_conj : term * term -> term |
20 |
val mk_disj : term * term -> term |
|
21 |
val mk_imp : term * term -> term |
|
6140 | 22 |
val dest_imp : term -> term*term |
9543 | 23 |
val mk_iff : term * term -> term |
24 |
val dest_iff : term -> term*term |
|
6140 | 25 |
val all_const : typ -> term |
26 |
val mk_all : term * term -> term |
|
27 |
val exists_const : typ -> term |
|
28 |
val mk_exists : term * term -> term |
|
29 |
val eq_const : typ -> term |
|
30 |
val mk_eq : term * term -> term |
|
31 |
val dest_eq : term -> term*term |
|
9543 | 32 |
val mk_binop: string -> term * term -> term |
33 |
val mk_binrel: string -> term * term -> term |
|
34 |
val dest_bin: string -> typ -> term -> term * term |
|
4349
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
35 |
end; |
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
36 |
|
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
37 |
|
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
38 |
structure FOLogic: FOLOGIC = |
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
39 |
struct |
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
40 |
|
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
41 |
val oT = Type("o",[]); |
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
42 |
|
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
43 |
val Trueprop = Const("Trueprop", oT-->propT); |
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
44 |
|
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
45 |
fun mk_Trueprop P = Trueprop $ P; |
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
46 |
|
9473 | 47 |
fun atomic_Trueprop x = mk_Trueprop (Free (x, oT)); |
48 |
||
4349
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
49 |
fun dest_Trueprop (Const ("Trueprop", _) $ P) = P |
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
50 |
| dest_Trueprop t = raise TERM ("dest_Trueprop", [t]); |
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
51 |
|
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
52 |
(** Logical constants **) |
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
53 |
|
9850 | 54 |
val not = Const ("Not", oT --> oT); |
55 |
val conj = Const("op &", [oT,oT]--->oT); |
|
56 |
val disj = Const("op |", [oT,oT]--->oT); |
|
57 |
val imp = Const("op -->", [oT,oT]--->oT) |
|
58 |
val iff = Const("op <->", [oT,oT]--->oT); |
|
4349
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
59 |
|
7692 | 60 |
fun mk_conj (t1, t2) = conj $ t1 $ t2 |
61 |
and mk_disj (t1, t2) = disj $ t1 $ t2 |
|
9543 | 62 |
and mk_imp (t1, t2) = imp $ t1 $ t2 |
63 |
and mk_iff (t1, t2) = iff $ t1 $ t2; |
|
7692 | 64 |
|
4466
305390f23734
Better equality handling in Blast_tac, usingd a new variant of hyp_subst_tac
paulson
parents:
4349
diff
changeset
|
65 |
fun dest_imp (Const("op -->",_) $ A $ B) = (A, B) |
305390f23734
Better equality handling in Blast_tac, usingd a new variant of hyp_subst_tac
paulson
parents:
4349
diff
changeset
|
66 |
| dest_imp t = raise TERM ("dest_imp", [t]); |
305390f23734
Better equality handling in Blast_tac, usingd a new variant of hyp_subst_tac
paulson
parents:
4349
diff
changeset
|
67 |
|
9543 | 68 |
fun dest_iff (Const("op <->",_) $ A $ B) = (A, B) |
69 |
| dest_iff t = raise TERM ("dest_iff", [t]); |
|
70 |
||
4349
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
71 |
fun eq_const T = Const ("op =", [T, T] ---> oT); |
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
72 |
fun mk_eq (t, u) = eq_const (fastype_of t) $ t $ u; |
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
73 |
|
6140 | 74 |
fun dest_eq (Const ("op =", _) $ lhs $ rhs) = (lhs, rhs) |
75 |
| dest_eq t = raise TERM ("dest_eq", [t]) |
|
76 |
||
4349
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
77 |
fun all_const T = Const ("All", [T --> oT] ---> oT); |
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
78 |
fun mk_all (Free(x,T),P) = all_const T $ (absfree (x,T,P)); |
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
79 |
|
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
80 |
fun exists_const T = Const ("Ex", [T --> oT] ---> oT); |
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
81 |
fun mk_exists (Free(x,T),P) = exists_const T $ (absfree (x,T,P)); |
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
82 |
|
9543 | 83 |
(* binary oprations and relations *) |
84 |
||
85 |
fun mk_binop c (t, u) = |
|
86 |
let val T = fastype_of t in |
|
87 |
Const (c, [T, T] ---> T) $ t $ u |
|
88 |
end; |
|
89 |
||
90 |
fun mk_binrel c (t, u) = |
|
91 |
let val T = fastype_of t in |
|
92 |
Const (c, [T, T] ---> oT) $ t $ u |
|
93 |
end; |
|
94 |
||
95 |
fun dest_bin c T (tm as Const (c', Type ("fun", [T', _])) $ t $ u) = |
|
96 |
if c = c' andalso T = T' then (t, u) |
|
97 |
else raise TERM ("dest_bin " ^ c, [tm]) |
|
98 |
| dest_bin c _ tm = raise TERM ("dest_bin " ^ c, [tm]); |
|
99 |
||
100 |
||
4349
50403e5a44c0
Instantiated the one-point-rule quantifier simpprocs for FOL
paulson
parents:
diff
changeset
|
101 |
end; |