bound argument for abstype proposition
authorhaftmann
Wed, 24 Feb 2010 14:42:28 +0100
changeset 35373 f759782e35ac
parent 35372 ca158c7b1144
child 35374 af1c8c15340e
bound argument for abstype proposition
src/HOL/Rat.thy
src/Pure/Isar/code.ML
--- a/src/HOL/Rat.thy	Wed Feb 24 14:34:40 2010 +0100
+++ b/src/HOL/Rat.thy	Wed Feb 24 14:42:28 2010 +0100
@@ -1020,7 +1020,8 @@
 
 code_abstype Frct quotient_of
 proof (rule eq_reflection)
-  show "Frct (quotient_of x) = x" by (cases x) (auto intro: quotient_of_eq)
+  fix r :: rat
+  show "Frct (quotient_of r) = r" by (cases r) (auto intro: quotient_of_eq)
 qed
 
 lemma Frct_code_post [code_post]:
--- a/src/Pure/Isar/code.ML	Wed Feb 24 14:34:40 2010 +0100
+++ b/src/Pure/Isar/code.ML	Wed Feb 24 14:42:28 2010 +0100
@@ -422,8 +422,9 @@
           ^ " :: " ^ string_of_typ thy ty');
     val _ = Thm.cterm_of thy (Const (rep, ty_abs --> ty)) handle TYPE _ =>
       error ("Not a projection:\n" ^ string_of_const thy rep);
-    val cert = Logic.mk_equals (Const (abs, ty --> ty_abs) $ (Const (rep, ty_abs --> ty)
-      $ Free ("x", ty_abs)), Free ("x", ty_abs));
+    val param = Free ("x", ty_abs);
+    val cert = Logic.all param (Logic.mk_equals
+      (Const (abs, ty --> ty_abs) $ (Const (rep, ty_abs --> ty) $ param), param));
   in (tyco, (vs ~~ sorts, ((fst abs_ty, ty), (rep, cert)))) end;    
 
 fun get_type_entry thy tyco = case these (Symtab.lookup ((the_types o the_exec) thy) tyco)