Nominal/Parser.thy
changeset 1326 4bc9278a808d
parent 1324 f5aa2134e199
child 1331 0f329449e304
equal deleted inserted replaced
1325:0be098c61d00 1326:4bc9278a808d
   229   val inducts = #inducts dtinfo;
   229   val inducts = #inducts dtinfo;
   230   val ((raw_perm_def, raw_perm_simps, perms), lthy3) =
   230   val ((raw_perm_def, raw_perm_simps, perms), lthy3) =
   231     Local_Theory.theory_result (define_raw_perms dtinfo (length dts)) lthy2;
   231     Local_Theory.theory_result (define_raw_perms dtinfo (length dts)) lthy2;
   232   val raw_binds_flat = map (map flat) raw_binds;
   232   val raw_binds_flat = map (map flat) raw_binds;
   233   val (((fv_ts_loc, fv_def_loc), alpha), lthy4) = define_fv_alpha dtinfo raw_binds_flat lthy3;
   233   val (((fv_ts_loc, fv_def_loc), alpha), lthy4) = define_fv_alpha dtinfo raw_binds_flat lthy3;
   234 (*  val alpha_ts_loc = #preds alpha
   234   val alpha_ts_loc = #preds alpha
   235   val morphism_4_3 = ProofContext.export_morphism lthy4 lthy3;
   235   val morphism_4_3 = ProofContext.export_morphism lthy4 lthy3;
   236   val alpha_ts = map (Morphism.term morphism_4_3) alpha_ts_loc;
   236   val alpha_ts = map (Morphism.term morphism_4_3) alpha_ts_loc;
   237   val alpha_induct_loc = #induct alpha
   237   val alpha_induct_loc = #induct alpha
   238   val dts_names = map (fn (i, (s, _, _)) => (s, i)) (#descr dtinfo);
   238   val dts_names = map (fn (i, (s, _, _)) => (s, i)) (#descr dtinfo);
   239   val bn_tys = map (domain_type o fastype_of) raw_bn_funs;
   239   val bn_tys = map (domain_type o fastype_of) raw_bn_funs;
   243   val alpha_cases = #elims alpha
   243   val alpha_cases = #elims alpha
   244   val alpha_inj_loc = build_alpha_inj alpha_intros (inject @ distinct) alpha_cases lthy4
   244   val alpha_inj_loc = build_alpha_inj alpha_intros (inject @ distinct) alpha_cases lthy4
   245   val (bv_eqvts, lthy5) = fold_map (build_bv_eqvt perms (raw_bn_eqs @ raw_perm_def) inducts) bns lthy4;
   245   val (bv_eqvts, lthy5) = fold_map (build_bv_eqvt perms (raw_bn_eqs @ raw_perm_def) inducts) bns lthy4;
   246   val (fv_eqvts, lthy6) = build_eqvts Binding.empty fv_ts_loc perms
   246   val (fv_eqvts, lthy6) = build_eqvts Binding.empty fv_ts_loc perms
   247     ((flat (map snd bv_eqvts)) @ fv_def_loc @ raw_perm_def) induct lthy5;
   247     ((flat (map snd bv_eqvts)) @ fv_def_loc @ raw_perm_def) induct lthy5;
   248   val alpha_eqvt_loc = build_alpha_eqvts alpha_ts_loc perms 
   248 (*  val alpha_eqvt_loc = build_alpha_eqvts alpha_ts_loc perms 
   249     (raw_perm_def @ alpha_inj_loc) alpha_induct_loc lthy6;
   249     (raw_perm_def @ alpha_inj_loc) alpha_induct_loc lthy6;
   250   val alpha_eqvt = ProofContext.export lthy6 lthy2 alpha_eqvt_loc;
   250   val alpha_eqvt = ProofContext.export lthy6 lthy2 alpha_eqvt_loc;
   251   val alpha_equivp_loc = build_equivps alpha_ts_loc induct alpha_induct_loc
   251   val alpha_equivp_loc = build_equivps alpha_ts_loc induct alpha_induct_loc
   252     inject alpha_inj_loc distinct alpha_cases alpha_eqvt_loc lthy6;
   252     inject alpha_inj_loc distinct alpha_cases alpha_eqvt_loc lthy6;
   253   val alpha_equivp = ProofContext.export lthy6 lthy2 alpha_equivp_loc;
   253   val alpha_equivp = ProofContext.export lthy6 lthy2 alpha_equivp_loc;
   254   val qty_names = map (fn (_, b, _, _) => b) dts;
   254   val qty_names = map (fn (_, b, _, _) => b) dts;
   255   val lthy7 = define_quotient_type
   255   val lthy7 = define_quotient_type
   256     (map (fn ((b, t), alpha) => (([], b, NoSyn), (t, alpha))) ((qty_names ~~ all_typs) ~~ alpha_ts))
   256     (map (fn ((b, t), alpha) => (([], b, NoSyn), (t, alpha))) ((qty_names ~~ all_typs) ~~ alpha_ts))
   257     (ALLGOALS (resolve_tac alpha_equivp)) lthy6;*)
   257     (ALLGOALS (resolve_tac alpha_equivp)) lthy6;*)
   258 in
   258 in
   259   ((raw_dt_names, raw_bn_funs, raw_bn_eqs, raw_binds), lthy4)
   259   ((raw_dt_names, raw_bn_funs, raw_bn_eqs, raw_binds), lthy6)
   260 end
   260 end
   261 *}
   261 *}
   262 
   262 
   263 ML {* 
   263 ML {* 
   264 (* parsing the datatypes and declaring *)
   264 (* parsing the datatypes and declaring *)