src/HOL/Tools/Datatype/datatype.ML
changeset 45910 566c34b64f70
parent 45909 6fe61da4c467
child 46218 ecf6375e2abb
equal deleted inserted replaced
45909:6fe61da4c467 45910:566c34b64f70
   250     fun dt_constr_defs (((((_, (_, _, constrs)), tname), typedef: Typedef.info), T), constr_syntax)
   250     fun dt_constr_defs (((((_, (_, _, constrs)), tname), typedef: Typedef.info), T), constr_syntax)
   251         (thy, defs, eqns, rep_congs, dist_lemmas) =
   251         (thy, defs, eqns, rep_congs, dist_lemmas) =
   252       let
   252       let
   253         val _ $ (_ $ (cong_f $ _) $ _) = concl_of arg_cong;
   253         val _ $ (_ $ (cong_f $ _) $ _) = concl_of arg_cong;
   254         val rep_const = cterm_of thy (Const (#Rep_name (#1 typedef), T --> Univ_elT));
   254         val rep_const = cterm_of thy (Const (#Rep_name (#1 typedef), T --> Univ_elT));
   255         val cong' =
   255         val cong' = cterm_instantiate [(cterm_of thy cong_f, rep_const)] arg_cong;
   256           Drule.export_without_context
   256         val dist = cterm_instantiate [(cterm_of thy distinct_f, rep_const)] distinct_lemma;
   257             (cterm_instantiate [(cterm_of thy cong_f, rep_const)] arg_cong);
       
   258         val dist =
       
   259           Drule.export_without_context
       
   260             (cterm_instantiate [(cterm_of thy distinct_f, rep_const)] distinct_lemma);
       
   261         val (thy', defs', eqns', _) =
   257         val (thy', defs', eqns', _) =
   262           fold (make_constr_def typedef T (length constrs))
   258           fold (make_constr_def typedef T (length constrs))
   263             (constrs ~~ constr_syntax) (Sign.add_path tname thy, defs, [], 1);
   259             (constrs ~~ constr_syntax) (Sign.add_path tname thy, defs, [], 1);
   264       in
   260       in
   265         (Sign.parent_path thy', defs', eqns @ [eqns'],
   261         (Sign.parent_path thy', defs', eqns @ [eqns'],
   541         fun prove [] = []
   537         fun prove [] = []
   542           | prove (t :: ts) =
   538           | prove (t :: ts) =
   543               let
   539               let
   544                 val dist_thm = Skip_Proof.prove_global thy5 [] [] t (fn _ =>
   540                 val dist_thm = Skip_Proof.prove_global thy5 [] [] t (fn _ =>
   545                   EVERY [simp_tac (HOL_ss addsimps dist_rewrites') 1])
   541                   EVERY [simp_tac (HOL_ss addsimps dist_rewrites') 1])
   546               in dist_thm :: Drule.export_without_context (dist_thm RS not_sym) :: prove ts end;
   542               in dist_thm :: Drule.zero_var_indexes (dist_thm RS not_sym) :: prove ts end;
   547       in prove end;
   543       in prove end;
   548 
   544 
   549     val distinct_thms =
   545     val distinct_thms =
   550       map2 (prove_distinct_thms) dist_rewrites (Datatype_Prop.make_distincts descr);
   546       map2 (prove_distinct_thms) dist_rewrites (Datatype_Prop.make_distincts descr);
   551 
   547