21 val typ_of_dtyp : |
21 val typ_of_dtyp : |
22 Datatype_Aux.descr -> (Datatype_Aux.dtyp * typ) list -> Datatype_Aux.dtyp |
22 Datatype_Aux.descr -> (Datatype_Aux.dtyp * typ) list -> Datatype_Aux.dtyp |
23 -> typ |
23 -> typ |
24 val is_type_surely_finite : Proof.context -> bool -> typ -> bool |
24 val is_type_surely_finite : Proof.context -> bool -> typ -> bool |
25 val is_type_surely_infinite : Proof.context -> bool -> typ -> bool |
25 val is_type_surely_infinite : Proof.context -> bool -> typ -> bool |
|
26 val s_not : term -> term |
|
27 val s_conj : term * term -> term |
|
28 val s_disj : term * term -> term |
|
29 val s_imp : term * term -> term |
|
30 val s_iff : term * term -> term |
26 val monomorphic_term : Type.tyenv -> term -> term |
31 val monomorphic_term : Type.tyenv -> term -> term |
27 val eta_expand : typ list -> term -> int -> term |
32 val eta_expand : typ list -> term -> int -> term |
28 val transform_elim_prop : term -> term |
33 val transform_elim_prop : term -> term |
29 val specialize_type : theory -> (string * typ) -> term -> term |
34 val specialize_type : theory -> (string * typ) -> term -> term |
30 val strip_subgoal : |
35 val strip_subgoal : |
201 in Int.min (max, aux false [] T) end |
206 in Int.min (max, aux false [] T) end |
202 |
207 |
203 fun is_type_surely_finite ctxt sound T = tiny_card_of_type ctxt sound 0 T <> 0 |
208 fun is_type_surely_finite ctxt sound T = tiny_card_of_type ctxt sound 0 T <> 0 |
204 fun is_type_surely_infinite ctxt sound T = tiny_card_of_type ctxt sound 1 T = 0 |
209 fun is_type_surely_infinite ctxt sound T = tiny_card_of_type ctxt sound 1 T = 0 |
205 |
210 |
|
211 (* Simple simplifications to ensure that sort annotations don't leave a trail of |
|
212 spurious "True"s. *) |
|
213 fun s_not (Const (@{const_name All}, T) $ Abs (s, T', t')) = |
|
214 Const (@{const_name Ex}, T) $ Abs (s, T', s_not t') |
|
215 | s_not (Const (@{const_name Ex}, T) $ Abs (s, T', t')) = |
|
216 Const (@{const_name All}, T) $ Abs (s, T', s_not t') |
|
217 | s_not (@{const HOL.implies} $ t1 $ t2) = @{const HOL.conj} $ t1 $ s_not t2 |
|
218 | s_not (@{const HOL.conj} $ t1 $ t2) = |
|
219 @{const HOL.disj} $ s_not t1 $ s_not t2 |
|
220 | s_not (@{const HOL.disj} $ t1 $ t2) = |
|
221 @{const HOL.conj} $ s_not t1 $ s_not t2 |
|
222 | s_not (@{const False}) = @{const True} |
|
223 | s_not (@{const True}) = @{const False} |
|
224 | s_not (@{const Not} $ t) = t |
|
225 | s_not t = @{const Not} $ t |
|
226 fun s_conj (@{const True}, t2) = t2 |
|
227 | s_conj (t1, @{const True}) = t1 |
|
228 | s_conj p = HOLogic.mk_conj p |
|
229 fun s_disj (@{const False}, t2) = t2 |
|
230 | s_disj (t1, @{const False}) = t1 |
|
231 | s_disj p = HOLogic.mk_disj p |
|
232 fun s_imp (@{const True}, t2) = t2 |
|
233 | s_imp (t1, @{const False}) = s_not t1 |
|
234 | s_imp p = HOLogic.mk_imp p |
|
235 fun s_iff (@{const True}, t2) = t2 |
|
236 | s_iff (t1, @{const True}) = t1 |
|
237 | s_iff (t1, t2) = HOLogic.eq_const HOLogic.boolT $ t1 $ t2 |
|
238 |
206 fun monomorphic_term subst = |
239 fun monomorphic_term subst = |
207 map_types (map_type_tvar (fn v => |
240 map_types (map_type_tvar (fn v => |
208 case Type.lookup subst v of |
241 case Type.lookup subst v of |
209 SOME typ => typ |
242 SOME typ => typ |
210 | NONE => TVar v)) |
243 | NONE => TVar v)) |