author | nipkow |
Wed, 30 Aug 2000 13:22:10 +0200 | |
changeset 9737 | 7aae235675dc |
parent 9373 | 78a11a353473 |
child 9867 | bf8300fa4238 |
permissions | -rw-r--r-- |
3302 | 1 |
(* Title: TFL/usyntax |
2 |
ID: $Id$ |
|
3 |
Author: Konrad Slind, Cambridge University Computer Laboratory |
|
4 |
Copyright 1997 University of Cambridge |
|
5 |
||
6 |
Emulation of HOL's abstract syntax functions |
|
7 |
*) |
|
8 |
||
2112 | 9 |
structure USyntax : USyntax_sig = |
10 |
struct |
|
11 |
||
12 |
structure Utils = Utils; |
|
13 |
open Utils; |
|
14 |
||
15 |
infix 4 ##; |
|
16 |
||
3353
9112a2efb9a3
Removal of module Mask and datatype binding with its constructor |->
paulson
parents:
3330
diff
changeset
|
17 |
fun USYN_ERR{func,mesg} = Utils.ERR{module = "USyntax", func = func, mesg = mesg}; |
2112 | 18 |
|
19 |
||
20 |
(*--------------------------------------------------------------------------- |
|
21 |
* |
|
22 |
* Types |
|
23 |
* |
|
24 |
*---------------------------------------------------------------------------*) |
|
25 |
val mk_prim_vartype = TVar; |
|
26 |
fun mk_vartype s = mk_prim_vartype((s,0),["term"]); |
|
27 |
||
28 |
(* But internally, it's useful *) |
|
29 |
fun dest_vtype (TVar x) = x |
|
3353
9112a2efb9a3
Removal of module Mask and datatype binding with its constructor |->
paulson
parents:
3330
diff
changeset
|
30 |
| dest_vtype _ = raise USYN_ERR{func = "dest_vtype", |
2112 | 31 |
mesg = "not a flexible type variable"}; |
32 |
||
33 |
val is_vartype = Utils.can dest_vtype; |
|
34 |
||
35 |
val type_vars = map mk_prim_vartype o typ_tvars |
|
3391
5e45dd3b64e9
More de-HOLification: using Free, Const, etc. instead of mk_var, mk_const
paulson
parents:
3353
diff
changeset
|
36 |
fun type_varsl L = distinct (Utils.rev_itlist (curry op @ o type_vars) L []); |
2112 | 37 |
|
38 |
val alpha = mk_vartype "'a" |
|
39 |
val beta = mk_vartype "'b" |
|
40 |
||
9373 | 41 |
val strip_prod_type = HOLogic.prodT_factors; |
2112 | 42 |
|
43 |
||
44 |
||
45 |
(*--------------------------------------------------------------------------- |
|
46 |
* |
|
47 |
* Terms |
|
48 |
* |
|
49 |
*---------------------------------------------------------------------------*) |
|
50 |
||
51 |
(* Free variables, in order of occurrence, from left to right in the |
|
52 |
* syntax tree. *) |
|
53 |
fun free_vars_lr tm = |
|
54 |
let fun memb x = let fun m[] = false | m(y::rst) = (x=y)orelse m rst in m end |
|
55 |
fun add (t, frees) = case t of |
|
56 |
Free _ => if (memb t frees) then frees else t::frees |
|
57 |
| Abs (_,_,body) => add(body,frees) |
|
58 |
| f$t => add(t, add(f, frees)) |
|
59 |
| _ => frees |
|
60 |
in rev(add(tm,[])) |
|
61 |
end; |
|
62 |
||
63 |
||
64 |
||
65 |
val type_vars_in_term = map mk_prim_vartype o term_tvars; |
|
66 |
||
67 |
||
68 |
||
69 |
(* Prelogic *) |
|
3353
9112a2efb9a3
Removal of module Mask and datatype binding with its constructor |->
paulson
parents:
3330
diff
changeset
|
70 |
fun dest_tybinding (v,ty) = (#1(dest_vtype v),ty) |
2112 | 71 |
fun inst theta = subst_vars (map dest_tybinding theta,[]) |
72 |
||
73 |
||
74 |
(* Construction routines *) |
|
75 |
||
76 |
fun mk_abs{Bvar as Var((s,_),ty),Body} = Abs(s,ty,abstract_over(Bvar,Body)) |
|
77 |
| mk_abs{Bvar as Free(s,ty),Body} = Abs(s,ty,abstract_over(Bvar,Body)) |
|
3353
9112a2efb9a3
Removal of module Mask and datatype binding with its constructor |->
paulson
parents:
3330
diff
changeset
|
78 |
| mk_abs _ = raise USYN_ERR{func = "mk_abs", mesg = "Bvar is not a variable"}; |
2112 | 79 |
|
80 |
||
81 |
fun mk_imp{ant,conseq} = |
|
3391
5e45dd3b64e9
More de-HOLification: using Free, Const, etc. instead of mk_var, mk_const
paulson
parents:
3353
diff
changeset
|
82 |
let val c = Const("op -->",HOLogic.boolT --> HOLogic.boolT --> HOLogic.boolT) |
3245
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
83 |
in list_comb(c,[ant,conseq]) |
2112 | 84 |
end; |
85 |
||
86 |
fun mk_select (r as {Bvar,Body}) = |
|
87 |
let val ty = type_of Bvar |
|
3391
5e45dd3b64e9
More de-HOLification: using Free, Const, etc. instead of mk_var, mk_const
paulson
parents:
3353
diff
changeset
|
88 |
val c = Const("Eps",(ty --> HOLogic.boolT) --> ty) |
3245
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
89 |
in list_comb(c,[mk_abs r]) |
2112 | 90 |
end; |
91 |
||
92 |
fun mk_forall (r as {Bvar,Body}) = |
|
93 |
let val ty = type_of Bvar |
|
3391
5e45dd3b64e9
More de-HOLification: using Free, Const, etc. instead of mk_var, mk_const
paulson
parents:
3353
diff
changeset
|
94 |
val c = Const("All",(ty --> HOLogic.boolT) --> HOLogic.boolT) |
3245
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
95 |
in list_comb(c,[mk_abs r]) |
2112 | 96 |
end; |
97 |
||
98 |
fun mk_exists (r as {Bvar,Body}) = |
|
99 |
let val ty = type_of Bvar |
|
3391
5e45dd3b64e9
More de-HOLification: using Free, Const, etc. instead of mk_var, mk_const
paulson
parents:
3353
diff
changeset
|
100 |
val c = Const("Ex",(ty --> HOLogic.boolT) --> HOLogic.boolT) |
3245
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
101 |
in list_comb(c,[mk_abs r]) |
2112 | 102 |
end; |
103 |
||
104 |
||
105 |
fun mk_conj{conj1,conj2} = |
|
3391
5e45dd3b64e9
More de-HOLification: using Free, Const, etc. instead of mk_var, mk_const
paulson
parents:
3353
diff
changeset
|
106 |
let val c = Const("op &",HOLogic.boolT --> HOLogic.boolT --> HOLogic.boolT) |
3245
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
107 |
in list_comb(c,[conj1,conj2]) |
2112 | 108 |
end; |
109 |
||
110 |
fun mk_disj{disj1,disj2} = |
|
3391
5e45dd3b64e9
More de-HOLification: using Free, Const, etc. instead of mk_var, mk_const
paulson
parents:
3353
diff
changeset
|
111 |
let val c = Const("op |",HOLogic.boolT --> HOLogic.boolT --> HOLogic.boolT) |
3245
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
112 |
in list_comb(c,[disj1,disj2]) |
2112 | 113 |
end; |
114 |
||
9373 | 115 |
fun prod_ty ty1 ty2 = HOLogic.mk_prodT (ty1,ty2); |
2112 | 116 |
|
117 |
local |
|
118 |
fun mk_uncurry(xt,yt,zt) = |
|
3391
5e45dd3b64e9
More de-HOLification: using Free, Const, etc. instead of mk_var, mk_const
paulson
parents:
3353
diff
changeset
|
119 |
Const("split",(xt --> yt --> zt) --> prod_ty xt yt --> zt) |
2112 | 120 |
fun dest_pair(Const("Pair",_) $ M $ N) = {fst=M, snd=N} |
3353
9112a2efb9a3
Removal of module Mask and datatype binding with its constructor |->
paulson
parents:
3330
diff
changeset
|
121 |
| dest_pair _ = raise USYN_ERR{func = "dest_pair", mesg = "not a pair"} |
2112 | 122 |
fun is_var(Var(_)) = true | is_var (Free _) = true | is_var _ = false |
123 |
in |
|
124 |
fun mk_pabs{varstruct,body} = |
|
125 |
let fun mpa(varstruct,body) = |
|
126 |
if (is_var varstruct) |
|
127 |
then mk_abs{Bvar = varstruct, Body = body} |
|
128 |
else let val {fst,snd} = dest_pair varstruct |
|
3405 | 129 |
in mk_uncurry(type_of fst,type_of snd,type_of body) $ |
130 |
mpa(fst,mpa(snd,body)) |
|
2112 | 131 |
end |
132 |
in mpa(varstruct,body) |
|
133 |
end |
|
3353
9112a2efb9a3
Removal of module Mask and datatype binding with its constructor |->
paulson
parents:
3330
diff
changeset
|
134 |
handle _ => raise USYN_ERR{func = "mk_pabs", mesg = ""}; |
2112 | 135 |
end; |
136 |
||
137 |
(* Destruction routines *) |
|
138 |
||
3245
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
139 |
datatype lambda = VAR of {Name : string, Ty : typ} |
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
140 |
| CONST of {Name : string, Ty : typ} |
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
141 |
| COMB of {Rator: term, Rand : term} |
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
142 |
| LAMB of {Bvar : term, Body : term}; |
2112 | 143 |
|
144 |
||
145 |
fun dest_term(Var((s,i),ty)) = VAR{Name = s, Ty = ty} |
|
146 |
| dest_term(Free(s,ty)) = VAR{Name = s, Ty = ty} |
|
147 |
| dest_term(Const(s,ty)) = CONST{Name = s, Ty = ty} |
|
148 |
| dest_term(M$N) = COMB{Rator=M,Rand=N} |
|
3391
5e45dd3b64e9
More de-HOLification: using Free, Const, etc. instead of mk_var, mk_const
paulson
parents:
3353
diff
changeset
|
149 |
| dest_term(Abs(s,ty,M)) = let val v = Free(s,ty) |
2112 | 150 |
in LAMB{Bvar = v, Body = betapply (M,v)} |
151 |
end |
|
3353
9112a2efb9a3
Removal of module Mask and datatype binding with its constructor |->
paulson
parents:
3330
diff
changeset
|
152 |
| dest_term(Bound _) = raise USYN_ERR{func = "dest_term",mesg = "Bound"}; |
2112 | 153 |
|
154 |
fun dest_const(Const(s,ty)) = {Name = s, Ty = ty} |
|
3353
9112a2efb9a3
Removal of module Mask and datatype binding with its constructor |->
paulson
parents:
3330
diff
changeset
|
155 |
| dest_const _ = raise USYN_ERR{func = "dest_const", mesg = "not a constant"}; |
2112 | 156 |
|
157 |
fun dest_comb(t1 $ t2) = {Rator = t1, Rand = t2} |
|
3353
9112a2efb9a3
Removal of module Mask and datatype binding with its constructor |->
paulson
parents:
3330
diff
changeset
|
158 |
| dest_comb _ = raise USYN_ERR{func = "dest_comb", mesg = "not a comb"}; |
2112 | 159 |
|
160 |
fun dest_abs(a as Abs(s,ty,M)) = |
|
3391
5e45dd3b64e9
More de-HOLification: using Free, Const, etc. instead of mk_var, mk_const
paulson
parents:
3353
diff
changeset
|
161 |
let val v = Free(s,ty) |
2112 | 162 |
in {Bvar = v, Body = betapply (a,v)} |
163 |
end |
|
3353
9112a2efb9a3
Removal of module Mask and datatype binding with its constructor |->
paulson
parents:
3330
diff
changeset
|
164 |
| dest_abs _ = raise USYN_ERR{func = "dest_abs", mesg = "not an abstraction"}; |
2112 | 165 |
|
166 |
fun dest_eq(Const("op =",_) $ M $ N) = {lhs=M, rhs=N} |
|
3353
9112a2efb9a3
Removal of module Mask and datatype binding with its constructor |->
paulson
parents:
3330
diff
changeset
|
167 |
| dest_eq _ = raise USYN_ERR{func = "dest_eq", mesg = "not an equality"}; |
2112 | 168 |
|
169 |
fun dest_imp(Const("op -->",_) $ M $ N) = {ant=M, conseq=N} |
|
3353
9112a2efb9a3
Removal of module Mask and datatype binding with its constructor |->
paulson
parents:
3330
diff
changeset
|
170 |
| dest_imp _ = raise USYN_ERR{func = "dest_imp", mesg = "not an implication"}; |
2112 | 171 |
|
172 |
fun dest_forall(Const("All",_) $ (a as Abs _)) = dest_abs a |
|
3353
9112a2efb9a3
Removal of module Mask and datatype binding with its constructor |->
paulson
parents:
3330
diff
changeset
|
173 |
| dest_forall _ = raise USYN_ERR{func = "dest_forall", mesg = "not a forall"}; |
2112 | 174 |
|
175 |
fun dest_exists(Const("Ex",_) $ (a as Abs _)) = dest_abs a |
|
3353
9112a2efb9a3
Removal of module Mask and datatype binding with its constructor |->
paulson
parents:
3330
diff
changeset
|
176 |
| dest_exists _ = raise USYN_ERR{func = "dest_exists", mesg="not an existential"}; |
2112 | 177 |
|
178 |
fun dest_neg(Const("not",_) $ M) = M |
|
3353
9112a2efb9a3
Removal of module Mask and datatype binding with its constructor |->
paulson
parents:
3330
diff
changeset
|
179 |
| dest_neg _ = raise USYN_ERR{func = "dest_neg", mesg = "not a negation"}; |
2112 | 180 |
|
181 |
fun dest_conj(Const("op &",_) $ M $ N) = {conj1=M, conj2=N} |
|
3353
9112a2efb9a3
Removal of module Mask and datatype binding with its constructor |->
paulson
parents:
3330
diff
changeset
|
182 |
| dest_conj _ = raise USYN_ERR{func = "dest_conj", mesg = "not a conjunction"}; |
2112 | 183 |
|
184 |
fun dest_disj(Const("op |",_) $ M $ N) = {disj1=M, disj2=N} |
|
3353
9112a2efb9a3
Removal of module Mask and datatype binding with its constructor |->
paulson
parents:
3330
diff
changeset
|
185 |
| dest_disj _ = raise USYN_ERR{func = "dest_disj", mesg = "not a disjunction"}; |
2112 | 186 |
|
187 |
fun mk_pair{fst,snd} = |
|
188 |
let val ty1 = type_of fst |
|
189 |
val ty2 = type_of snd |
|
3391
5e45dd3b64e9
More de-HOLification: using Free, Const, etc. instead of mk_var, mk_const
paulson
parents:
3353
diff
changeset
|
190 |
val c = Const("Pair",ty1 --> ty2 --> prod_ty ty1 ty2) |
3245
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
191 |
in list_comb(c,[fst,snd]) |
2112 | 192 |
end; |
193 |
||
194 |
fun dest_pair(Const("Pair",_) $ M $ N) = {fst=M, snd=N} |
|
3353
9112a2efb9a3
Removal of module Mask and datatype binding with its constructor |->
paulson
parents:
3330
diff
changeset
|
195 |
| dest_pair _ = raise USYN_ERR{func = "dest_pair", mesg = "not a pair"}; |
2112 | 196 |
|
197 |
||
3245
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
198 |
local fun ucheck t = (if #Name(dest_const t) = "split" then t |
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
199 |
else raise Match) |
2112 | 200 |
in |
201 |
fun dest_pabs tm = |
|
202 |
let val {Bvar,Body} = dest_abs tm |
|
203 |
in {varstruct = Bvar, body = Body} |
|
3245
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
204 |
end |
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
205 |
handle |
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
206 |
_ => let val {Rator,Rand} = dest_comb tm |
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
207 |
val _ = ucheck Rator |
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
208 |
val {varstruct = lv,body} = dest_pabs Rand |
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
209 |
val {varstruct = rv,body} = dest_pabs body |
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
210 |
in {varstruct = mk_pair{fst = lv, snd = rv}, body = body} |
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
211 |
end |
2112 | 212 |
end; |
213 |
||
214 |
||
215 |
val lhs = #lhs o dest_eq |
|
216 |
val rhs = #rhs o dest_eq |
|
217 |
val rand = #Rand o dest_comb |
|
218 |
||
219 |
||
220 |
(* Query routines *) |
|
221 |
val is_imp = can dest_imp |
|
222 |
val is_forall = can dest_forall |
|
223 |
val is_exists = can dest_exists |
|
224 |
val is_neg = can dest_neg |
|
225 |
val is_conj = can dest_conj |
|
226 |
val is_disj = can dest_disj |
|
227 |
val is_pair = can dest_pair |
|
228 |
val is_pabs = can dest_pabs |
|
229 |
||
230 |
||
3245
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
231 |
(* Construction of a cterm from a list of Terms *) |
2112 | 232 |
|
233 |
fun list_mk_abs(L,tm) = itlist (fn v => fn M => mk_abs{Bvar=v, Body=M}) L tm; |
|
234 |
||
235 |
(* These others are almost never used *) |
|
236 |
fun list_mk_imp(A,c) = itlist(fn a => fn tm => mk_imp{ant=a,conseq=tm}) A c; |
|
237 |
fun list_mk_forall(V,t) = itlist(fn v => fn b => mk_forall{Bvar=v, Body=b})V t; |
|
238 |
val list_mk_conj = end_itlist(fn c1 => fn tm => mk_conj{conj1=c1, conj2=tm}) |
|
239 |
||
240 |
||
241 |
(* Need to reverse? *) |
|
3391
5e45dd3b64e9
More de-HOLification: using Free, Const, etc. instead of mk_var, mk_const
paulson
parents:
3353
diff
changeset
|
242 |
fun gen_all tm = list_mk_forall(term_frees tm, tm); |
2112 | 243 |
|
3245
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
244 |
(* Destructing a cterm to a list of Terms *) |
2112 | 245 |
fun strip_comb tm = |
246 |
let fun dest(M$N, A) = dest(M, N::A) |
|
247 |
| dest x = x |
|
248 |
in dest(tm,[]) |
|
249 |
end; |
|
250 |
||
251 |
fun strip_abs(tm as Abs _) = |
|
252 |
let val {Bvar,Body} = dest_abs tm |
|
253 |
val (bvs, core) = strip_abs Body |
|
254 |
in (Bvar::bvs, core) |
|
255 |
end |
|
256 |
| strip_abs M = ([],M); |
|
257 |
||
258 |
||
259 |
fun strip_imp fm = |
|
260 |
if (is_imp fm) |
|
261 |
then let val {ant,conseq} = dest_imp fm |
|
3245
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
262 |
val (was,wb) = strip_imp conseq |
2112 | 263 |
in ((ant::was), wb) |
264 |
end |
|
265 |
else ([],fm); |
|
266 |
||
267 |
fun strip_forall fm = |
|
268 |
if (is_forall fm) |
|
269 |
then let val {Bvar,Body} = dest_forall fm |
|
270 |
val (bvs,core) = strip_forall Body |
|
271 |
in ((Bvar::bvs), core) |
|
272 |
end |
|
273 |
else ([],fm); |
|
274 |
||
275 |
||
276 |
fun strip_exists fm = |
|
277 |
if (is_exists fm) |
|
278 |
then let val {Bvar, Body} = dest_exists fm |
|
279 |
val (bvs,core) = strip_exists Body |
|
280 |
in (Bvar::bvs, core) |
|
281 |
end |
|
282 |
else ([],fm); |
|
283 |
||
284 |
fun strip_disj w = |
|
285 |
if (is_disj w) |
|
286 |
then let val {disj1,disj2} = dest_disj w |
|
287 |
in (strip_disj disj1@strip_disj disj2) |
|
288 |
end |
|
289 |
else [w]; |
|
290 |
||
291 |
||
292 |
(* Miscellaneous *) |
|
293 |
||
294 |
fun mk_vstruct ty V = |
|
3245
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
295 |
let fun follow_prod_type (Type("*",[ty1,ty2])) vs = |
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
296 |
let val (ltm,vs1) = follow_prod_type ty1 vs |
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
297 |
val (rtm,vs2) = follow_prod_type ty2 vs1 |
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
298 |
in (mk_pair{fst=ltm, snd=rtm}, vs2) end |
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
299 |
| follow_prod_type _ (v::vs) = (v,vs) |
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
300 |
in #1 (follow_prod_type ty V) end; |
2112 | 301 |
|
302 |
||
303 |
(* Search a term for a sub-term satisfying the predicate p. *) |
|
304 |
fun find_term p = |
|
305 |
let fun find tm = |
|
3405 | 306 |
if (p tm) then Some tm |
307 |
else case tm of |
|
308 |
Abs(_,_,body) => find body |
|
309 |
| (t$u) => (Some (the (find t)) handle _ => find u) |
|
310 |
| _ => None |
|
2112 | 311 |
in find |
312 |
end; |
|
313 |
||
314 |
fun dest_relation tm = |
|
3245
241838c01caf
Removal of redundant code (unused or already present in Isabelle.
paulson
parents:
2112
diff
changeset
|
315 |
if (type_of tm = HOLogic.boolT) |
2112 | 316 |
then let val (Const("op :",_) $ (Const("Pair",_)$y$x) $ R) = tm |
317 |
in (R,y,x) |
|
3353
9112a2efb9a3
Removal of module Mask and datatype binding with its constructor |->
paulson
parents:
3330
diff
changeset
|
318 |
end handle _ => raise USYN_ERR{func="dest_relation", |
2112 | 319 |
mesg="unexpected term structure"} |
3353
9112a2efb9a3
Removal of module Mask and datatype binding with its constructor |->
paulson
parents:
3330
diff
changeset
|
320 |
else raise USYN_ERR{func="dest_relation",mesg="not a boolean term"}; |
2112 | 321 |
|
8882 | 322 |
fun is_WFR (Const("WF.wf",_)$_) = true |
3405 | 323 |
| is_WFR _ = false; |
2112 | 324 |
|
3391
5e45dd3b64e9
More de-HOLification: using Free, Const, etc. instead of mk_var, mk_const
paulson
parents:
3353
diff
changeset
|
325 |
fun ARB ty = mk_select{Bvar=Free("v",ty), |
5e45dd3b64e9
More de-HOLification: using Free, Const, etc. instead of mk_var, mk_const
paulson
parents:
3353
diff
changeset
|
326 |
Body=Const("True",HOLogic.boolT)}; |
2112 | 327 |
|
328 |
end; (* Syntax *) |