src/HOL/Tools/BNF/bnf_lfp.ML
changeset 70494 41108e3e9ca5
parent 69593 3dda49e08b9d
child 71245 e5664a75f4b5
equal deleted inserted replaced
70493:a9053fa30909 70494:41108e3e9ca5
   189           take m all_gs @ map HOLogic.mk_comp (drop m all_gs ~~ fs)) $ x;
   189           take m all_gs @ map HOLogic.mk_comp (drop m all_gs ~~ fs)) $ x;
   190         val vars = fold (Variable.add_free_names lthy) [lhs, rhs] [];
   190         val vars = fold (Variable.add_free_names lthy) [lhs, rhs] [];
   191       in
   191       in
   192         Goal.prove_sorry lthy vars [] (mk_Trueprop_eq (lhs, rhs))
   192         Goal.prove_sorry lthy vars [] (mk_Trueprop_eq (lhs, rhs))
   193           (fn {context = ctxt, prems = _} => mk_map_comp_id_tac ctxt map_comp0)
   193           (fn {context = ctxt, prems = _} => mk_map_comp_id_tac ctxt map_comp0)
   194         |> Thm.close_derivation
   194         |> Thm.close_derivation \<^here>
   195       end;
   195       end;
   196 
   196 
   197     val map_comp_id_thms = @{map 5} mk_map_comp_id xFs mapsAsBs mapsBsCs' mapsAsCs' map_comps;
   197     val map_comp_id_thms = @{map 5} mk_map_comp_id xFs mapsAsBs mapsBsCs' mapsAsCs' map_comps;
   198 
   198 
   199     (*forall a : set(m+1) x. f(m+1) a = a; ...; forall a : set(m+n) x. f(m+n) a = a ==>
   199     (*forall a : set(m+1) x. f(m+1) a = a; ...; forall a : set(m+n) x. f(m+n) a = a ==>
   206         val goal = mk_Trueprop_eq (Term.list_comb (mapAsAs, passive_ids @ self_fs) $ x, x);
   206         val goal = mk_Trueprop_eq (Term.list_comb (mapAsAs, passive_ids @ self_fs) $ x, x);
   207         val vars = fold (Variable.add_free_names lthy) (goal :: prems) [];
   207         val vars = fold (Variable.add_free_names lthy) (goal :: prems) [];
   208       in
   208       in
   209         Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, goal))
   209         Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, goal))
   210           (fn {context = ctxt, prems = _} => mk_map_cong0L_tac ctxt m map_cong0 map_id)
   210           (fn {context = ctxt, prems = _} => mk_map_cong0L_tac ctxt m map_cong0 map_id)
   211         |> Thm.close_derivation
   211         |> Thm.close_derivation \<^here>
   212       end;
   212       end;
   213 
   213 
   214     val map_cong0L_thms = @{map 5} mk_map_cong0L xFs mapsAsAs setssAs map_cong0s map_ids;
   214     val map_cong0L_thms = @{map 5} mk_map_cong0L xFs mapsAsAs setssAs map_cong0s map_ids;
   215     val in_mono'_thms = map (fn bnf => in_mono_of_bnf bnf OF (replicate m subset_refl)) bnfs;
   215     val in_mono'_thms = map (fn bnf => in_mono_of_bnf bnf OF (replicate m subset_refl)) bnfs;
   216     val in_cong'_thms = map (fn bnf => in_cong_of_bnf bnf OF (replicate m refl)) bnfs;
   216     val in_cong'_thms = map (fn bnf => in_cong_of_bnf bnf OF (replicate m refl)) bnfs;
   275       in
   275       in
   276         map (fn goal =>
   276         map (fn goal =>
   277           Variable.add_free_names lthy goal []
   277           Variable.add_free_names lthy goal []
   278           |> (fn vars => Goal.prove_sorry lthy vars [] goal (fn {context = ctxt, prems = _} =>
   278           |> (fn vars => Goal.prove_sorry lthy vars [] goal (fn {context = ctxt, prems = _} =>
   279             mk_alg_set_tac ctxt alg_def))
   279             mk_alg_set_tac ctxt alg_def))
   280           |> Thm.close_derivation)
   280           |> Thm.close_derivation \<^here>)
   281         goals
   281         goals
   282       end;
   282       end;
   283 
   283 
   284     val timer = time (timer "Algebra definition & thms");
   284     val timer = time (timer "Algebra definition & thms");
   285 
   285 
   294         map2 (fn goal => fn alg_set =>
   294         map2 (fn goal => fn alg_set =>
   295           Variable.add_free_names lthy goal []
   295           Variable.add_free_names lthy goal []
   296           |> (fn vars => Goal.prove_sorry lthy vars [] goal
   296           |> (fn vars => Goal.prove_sorry lthy vars [] goal
   297             (fn {context = ctxt, prems = _} =>
   297             (fn {context = ctxt, prems = _} =>
   298               mk_alg_not_empty_tac ctxt alg_set alg_set_thms wit_thms))
   298               mk_alg_not_empty_tac ctxt alg_set alg_set_thms wit_thms))
   299           |> Thm.close_derivation)
   299           |> Thm.close_derivation \<^here>)
   300         goals alg_set_thms
   300         goals alg_set_thms
   301       end;
   301       end;
   302 
   302 
   303     val timer = time (timer "Proved nonemptiness");
   303     val timer = time (timer "Proved nonemptiness");
   304 
   304 
   370         val elim_goals = @{map 7} mk_elim_goal setssAs mapsAsBs fs ss s's xFs FTsAs;
   370         val elim_goals = @{map 7} mk_elim_goal setssAs mapsAsBs fs ss s's xFs FTsAs;
   371         fun prove goal =
   371         fun prove goal =
   372           Variable.add_free_names lthy goal []
   372           Variable.add_free_names lthy goal []
   373           |> (fn vars => Goal.prove_sorry lthy vars [] goal (fn {context = ctxt, prems = _} =>
   373           |> (fn vars => Goal.prove_sorry lthy vars [] goal (fn {context = ctxt, prems = _} =>
   374             mk_mor_elim_tac ctxt mor_def))
   374             mk_mor_elim_tac ctxt mor_def))
   375           |> Thm.close_derivation;
   375           |> Thm.close_derivation \<^here>;
   376       in
   376       in
   377         map prove elim_goals
   377         map prove elim_goals
   378       end;
   378       end;
   379 
   379 
   380     val mor_incl_thm =
   380     val mor_incl_thm =
   383         val concl = HOLogic.mk_Trueprop (mk_mor Bs ss Bs_copy ss active_ids);
   383         val concl = HOLogic.mk_Trueprop (mk_mor Bs ss Bs_copy ss active_ids);
   384         val vars = fold (Variable.add_free_names lthy) (concl :: prems) [];
   384         val vars = fold (Variable.add_free_names lthy) (concl :: prems) [];
   385       in
   385       in
   386         Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, concl))
   386         Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, concl))
   387           (fn {context = ctxt, prems = _} => mk_mor_incl_tac ctxt mor_def map_ids)
   387           (fn {context = ctxt, prems = _} => mk_mor_incl_tac ctxt mor_def map_ids)
   388         |> Thm.close_derivation
   388         |> Thm.close_derivation \<^here>
   389       end;
   389       end;
   390 
   390 
   391     val mor_comp_thm =
   391     val mor_comp_thm =
   392       let
   392       let
   393         val prems =
   393         val prems =
   397           HOLogic.mk_Trueprop (mk_mor Bs ss B''s s''s (map2 (curry HOLogic.mk_comp) gs fs));
   397           HOLogic.mk_Trueprop (mk_mor Bs ss B''s s''s (map2 (curry HOLogic.mk_comp) gs fs));
   398         val vars = fold (Variable.add_free_names lthy) (concl :: prems) [];
   398         val vars = fold (Variable.add_free_names lthy) (concl :: prems) [];
   399       in
   399       in
   400         Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, concl))
   400         Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, concl))
   401           (fn {context = ctxt, prems = _} => mk_mor_comp_tac ctxt mor_def set_mapss map_comp_id_thms)
   401           (fn {context = ctxt, prems = _} => mk_mor_comp_tac ctxt mor_def set_mapss map_comp_id_thms)
   402         |> Thm.close_derivation
   402         |> Thm.close_derivation \<^here>
   403       end;
   403       end;
   404 
   404 
   405     val mor_cong_thm =
   405     val mor_cong_thm =
   406       let
   406       let
   407         val prems = map HOLogic.mk_Trueprop
   407         val prems = map HOLogic.mk_Trueprop
   409         val concl = HOLogic.mk_Trueprop (mk_mor Bs ss B's s's fs_copy);
   409         val concl = HOLogic.mk_Trueprop (mk_mor Bs ss B's s's fs_copy);
   410         val vars = fold (Variable.add_free_names lthy) (concl :: prems) [];
   410         val vars = fold (Variable.add_free_names lthy) (concl :: prems) [];
   411       in
   411       in
   412         Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, concl))
   412         Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, concl))
   413           (fn {context = ctxt, prems = _} => (hyp_subst_tac ctxt THEN' assume_tac ctxt) 1)
   413           (fn {context = ctxt, prems = _} => (hyp_subst_tac ctxt THEN' assume_tac ctxt) 1)
   414         |> Thm.close_derivation
   414         |> Thm.close_derivation \<^here>
   415       end;
   415       end;
   416 
   416 
   417     val mor_str_thm =
   417     val mor_str_thm =
   418       let
   418       let
   419         val maps = map2 (fn Ds => fn bnf => Term.list_comb
   419         val maps = map2 (fn Ds => fn bnf => Term.list_comb
   422           (mk_mor (map HOLogic.mk_UNIV FTsAs) maps active_UNIVs ss ss);
   422           (mk_mor (map HOLogic.mk_UNIV FTsAs) maps active_UNIVs ss ss);
   423         val vars = Variable.add_free_names lthy goal [];
   423         val vars = Variable.add_free_names lthy goal [];
   424       in
   424       in
   425         Goal.prove_sorry lthy vars [] goal
   425         Goal.prove_sorry lthy vars [] goal
   426           (fn {context = ctxt, prems = _} => mk_mor_str_tac ctxt ks mor_def)
   426           (fn {context = ctxt, prems = _} => mk_mor_str_tac ctxt ks mor_def)
   427         |> Thm.close_derivation
   427         |> Thm.close_derivation \<^here>
   428       end;
   428       end;
   429 
   429 
   430     val mor_UNIV_thm =
   430     val mor_UNIV_thm =
   431       let
   431       let
   432         fun mk_conjunct mapAsBs f s s' = HOLogic.mk_eq
   432         fun mk_conjunct mapAsBs f s s' = HOLogic.mk_eq
   436         val rhs = Library.foldr1 HOLogic.mk_conj (@{map 4} mk_conjunct mapsAsBs fs ss s's);
   436         val rhs = Library.foldr1 HOLogic.mk_conj (@{map 4} mk_conjunct mapsAsBs fs ss s's);
   437         val vars = fold (Variable.add_free_names lthy) [lhs, rhs] [];
   437         val vars = fold (Variable.add_free_names lthy) [lhs, rhs] [];
   438       in
   438       in
   439         Goal.prove_sorry lthy vars [] (mk_Trueprop_eq (lhs, rhs))
   439         Goal.prove_sorry lthy vars [] (mk_Trueprop_eq (lhs, rhs))
   440           (fn {context = ctxt, prems = _} => mk_mor_UNIV_tac ctxt m morE_thms mor_def)
   440           (fn {context = ctxt, prems = _} => mk_mor_UNIV_tac ctxt m morE_thms mor_def)
   441         |> Thm.close_derivation
   441         |> Thm.close_derivation \<^here>
   442       end;
   442       end;
   443 
   443 
   444     val timer = time (timer "Morphism definition & thms");
   444     val timer = time (timer "Morphism definition & thms");
   445 
   445 
   446     (* bounds *)
   446     (* bounds *)
   550           (Term.absfree jdx' (Library.foldr1 HOLogic.mk_conj (map mk_conjunct idxs))));
   550           (Term.absfree jdx' (Library.foldr1 HOLogic.mk_conj (map mk_conjunct idxs))));
   551         val vars = fold (Variable.add_free_names lthy) [prem, concl] [];
   551         val vars = fold (Variable.add_free_names lthy) [prem, concl] [];
   552       in
   552       in
   553         Goal.prove_sorry lthy vars [] (Logic.list_implies ([prem], concl))
   553         Goal.prove_sorry lthy vars [] (Logic.list_implies ([prem], concl))
   554           (fn {context = ctxt, prems = _} => mk_bd_limit_tac ctxt n suc_bd_Cinfinite)
   554           (fn {context = ctxt, prems = _} => mk_bd_limit_tac ctxt n suc_bd_Cinfinite)
   555         |> Thm.close_derivation
   555         |> Thm.close_derivation \<^here>
   556       end;
   556       end;
   557 
   557 
   558     val timer = time (timer "Bounds");
   558     val timer = time (timer "Bounds");
   559 
   559 
   560     (* minimal algebra *)
   560     (* minimal algebra *)
   590         val goal = Logic.mk_implies (HOLogic.mk_Trueprop i_field, concl);
   590         val goal = Logic.mk_implies (HOLogic.mk_Trueprop i_field, concl);
   591         val vars = Variable.add_free_names lthy goal [];
   591         val vars = Variable.add_free_names lthy goal [];
   592 
   592 
   593         val min_algs_thm = Goal.prove_sorry lthy vars [] goal
   593         val min_algs_thm = Goal.prove_sorry lthy vars [] goal
   594           (fn {context = ctxt, prems = _} => mk_min_algs_tac ctxt suc_bd_worel in_cong'_thms)
   594           (fn {context = ctxt, prems = _} => mk_min_algs_tac ctxt suc_bd_worel in_cong'_thms)
   595           |> Thm.close_derivation;
   595           |> Thm.close_derivation \<^here>;
   596 
   596 
   597         val min_algs_thms = map (fn k => min_algs_thm RS mk_nthI n k) ks;
   597         val min_algs_thms = map (fn k => min_algs_thm RS mk_nthI n k) ks;
   598 
   598 
   599         fun mk_mono_goal min_alg =
   599         fun mk_mono_goal min_alg =
   600           HOLogic.mk_Trueprop (mk_relChain suc_bd (Term.absfree idx' min_alg));
   600           HOLogic.mk_Trueprop (mk_relChain suc_bd (Term.absfree idx' min_alg));
   602         val monos =
   602         val monos =
   603           map2 (fn goal => fn min_algs =>
   603           map2 (fn goal => fn min_algs =>
   604             Variable.add_free_names lthy goal []
   604             Variable.add_free_names lthy goal []
   605             |> (fn vars => Goal.prove_sorry lthy vars [] goal
   605             |> (fn vars => Goal.prove_sorry lthy vars [] goal
   606               (fn {context = ctxt, prems = _} => mk_min_algs_mono_tac ctxt min_algs))
   606               (fn {context = ctxt, prems = _} => mk_min_algs_mono_tac ctxt min_algs))
   607             |> Thm.close_derivation)
   607             |> Thm.close_derivation \<^here>)
   608           (map mk_mono_goal min_algss) min_algs_thms;
   608           (map mk_mono_goal min_algss) min_algs_thms;
   609 
   609 
   610         fun mk_card_conjunct min_alg = mk_ordLeq (mk_card_of min_alg) Asuc_bd;
   610         fun mk_card_conjunct min_alg = mk_ordLeq (mk_card_of min_alg) Asuc_bd;
   611         val card_conjunction = Library.foldr1 HOLogic.mk_conj (map mk_card_conjunct min_algss);
   611         val card_conjunction = Library.foldr1 HOLogic.mk_conj (map mk_card_conjunct min_algss);
   612         val card_cT = Thm.ctyp_of lthy suc_bdT;
   612         val card_cT = Thm.ctyp_of lthy suc_bdT;
   620             Goal.prove_sorry lthy vars [] goal
   620             Goal.prove_sorry lthy vars [] goal
   621               (fn {context = ctxt, prems = _} => mk_min_algs_card_of_tac ctxt card_cT card_ct
   621               (fn {context = ctxt, prems = _} => mk_min_algs_card_of_tac ctxt card_cT card_ct
   622                 m suc_bd_worel min_algs_thms in_sbds
   622                 m suc_bd_worel min_algs_thms in_sbds
   623                 sbd_Card_order sbd_Cnotzero suc_bd_Card_order suc_bd_Cinfinite suc_bd_Cnotzero
   623                 sbd_Card_order sbd_Cnotzero suc_bd_Card_order suc_bd_Cinfinite suc_bd_Cnotzero
   624                 suc_bd_Asuc_bd Asuc_bd_Cinfinite)
   624                 suc_bd_Asuc_bd Asuc_bd_Cinfinite)
   625             |> Thm.close_derivation
   625             |> Thm.close_derivation \<^here>
   626           end;
   626           end;
   627 
   627 
   628         val least_prem = HOLogic.mk_Trueprop (mk_alg Bs ss);
   628         val least_prem = HOLogic.mk_Trueprop (mk_alg Bs ss);
   629         val least_conjunction = Library.foldr1 HOLogic.mk_conj (map2 mk_leq min_algss Bs);
   629         val least_conjunction = Library.foldr1 HOLogic.mk_conj (map2 mk_leq min_algss Bs);
   630         val least_cT = Thm.ctyp_of lthy suc_bdT;
   630         val least_cT = Thm.ctyp_of lthy suc_bdT;
   637             val vars = Variable.add_free_names lthy goal [];
   637             val vars = Variable.add_free_names lthy goal [];
   638           in
   638           in
   639             Goal.prove_sorry lthy vars [] goal
   639             Goal.prove_sorry lthy vars [] goal
   640               (fn {context = ctxt, prems = _} => mk_min_algs_least_tac ctxt least_cT least_ct
   640               (fn {context = ctxt, prems = _} => mk_min_algs_least_tac ctxt least_cT least_ct
   641                 suc_bd_worel min_algs_thms alg_set_thms)
   641                 suc_bd_worel min_algs_thms alg_set_thms)
   642             |> Thm.close_derivation
   642             |> Thm.close_derivation \<^here>
   643           end;
   643           end;
   644       in
   644       in
   645         (min_algs_thms, monos, card_of, least)
   645         (min_algs_thms, monos, card_of, least)
   646       end;
   646       end;
   647 
   647 
   696             val vars = Variable.add_free_names lthy goal [];
   696             val vars = Variable.add_free_names lthy goal [];
   697           in
   697           in
   698             Goal.prove_sorry lthy vars [] goal
   698             Goal.prove_sorry lthy vars [] goal
   699               (fn {context = ctxt, prems = _} => mk_alg_min_alg_tac ctxt m alg_def min_alg_defs
   699               (fn {context = ctxt, prems = _} => mk_alg_min_alg_tac ctxt m alg_def min_alg_defs
   700                 suc_bd_limit_thm sbd_Cinfinite set_sbdss min_algs_thms min_algs_mono_thms)
   700                 suc_bd_limit_thm sbd_Cinfinite set_sbdss min_algs_thms min_algs_mono_thms)
   701             |> Thm.close_derivation
   701             |> Thm.close_derivation \<^here>
   702           end;
   702           end;
   703 
   703 
   704         fun mk_card_of_thm min_alg def =
   704         fun mk_card_of_thm min_alg def =
   705           let
   705           let
   706             val goal = HOLogic.mk_Trueprop (mk_ordLeq (mk_card_of min_alg) Asuc_bd);
   706             val goal = HOLogic.mk_Trueprop (mk_ordLeq (mk_card_of min_alg) Asuc_bd);
   707             val vars = Variable.add_free_names lthy goal [];
   707             val vars = Variable.add_free_names lthy goal [];
   708           in
   708           in
   709             Goal.prove_sorry lthy vars [] goal
   709             Goal.prove_sorry lthy vars [] goal
   710               (fn {context = ctxt, prems = _} => mk_card_of_min_alg_tac ctxt def card_of_min_algs_thm
   710               (fn {context = ctxt, prems = _} => mk_card_of_min_alg_tac ctxt def card_of_min_algs_thm
   711                 suc_bd_Card_order suc_bd_Asuc_bd Asuc_bd_Cinfinite)
   711                 suc_bd_Card_order suc_bd_Asuc_bd Asuc_bd_Cinfinite)
   712             |> Thm.close_derivation
   712             |> Thm.close_derivation \<^here>
   713           end;
   713           end;
   714 
   714 
   715         fun mk_least_thm min_alg B def =
   715         fun mk_least_thm min_alg B def =
   716           let
   716           let
   717             val prem = HOLogic.mk_Trueprop (mk_alg Bs ss);
   717             val prem = HOLogic.mk_Trueprop (mk_alg Bs ss);
   718             val goal = Logic.mk_implies (prem, HOLogic.mk_Trueprop (mk_leq min_alg B));
   718             val goal = Logic.mk_implies (prem, HOLogic.mk_Trueprop (mk_leq min_alg B));
   719             val vars = Variable.add_free_names lthy goal [];
   719             val vars = Variable.add_free_names lthy goal [];
   720           in
   720           in
   721             Goal.prove_sorry lthy vars [] goal
   721             Goal.prove_sorry lthy vars [] goal
   722               (fn {context = ctxt, prems = _} => mk_least_min_alg_tac ctxt def least_min_algs_thm)
   722               (fn {context = ctxt, prems = _} => mk_least_min_alg_tac ctxt def least_min_algs_thm)
   723             |> Thm.close_derivation
   723             |> Thm.close_derivation \<^here>
   724           end;
   724           end;
   725 
   725 
   726         val leasts = @{map 3} mk_least_thm min_algs Bs min_alg_defs;
   726         val leasts = @{map 3} mk_least_thm min_algs Bs min_alg_defs;
   727 
   727 
   728         val incl =
   728         val incl =
   733             val vars = Variable.add_free_names lthy goal [];
   733             val vars = Variable.add_free_names lthy goal [];
   734           in
   734           in
   735             Goal.prove_sorry lthy vars [] goal
   735             Goal.prove_sorry lthy vars [] goal
   736               (fn {context = ctxt, prems = _} =>
   736               (fn {context = ctxt, prems = _} =>
   737                 EVERY' (rtac ctxt mor_incl_thm :: map (etac ctxt) leasts) 1)
   737                 EVERY' (rtac ctxt mor_incl_thm :: map (etac ctxt) leasts) 1)
   738             |> Thm.close_derivation
   738             |> Thm.close_derivation \<^here>
   739           end;
   739           end;
   740       in
   740       in
   741         (alg_min_alg, map2 mk_card_of_thm min_algs min_alg_defs, leasts, incl)
   741         (alg_min_alg, map2 mk_card_of_thm min_algs min_alg_defs, leasts, incl)
   742       end;
   742       end;
   743 
   743 
   828 
   828 
   829     val alg_select_thm = Goal.prove_sorry lthy [] []
   829     val alg_select_thm = Goal.prove_sorry lthy [] []
   830       (HOLogic.mk_Trueprop (mk_Ball II
   830       (HOLogic.mk_Trueprop (mk_Ball II
   831         (Term.absfree iidx' (mk_alg select_Bs select_ss))))
   831         (Term.absfree iidx' (mk_alg select_Bs select_ss))))
   832       (fn {context = ctxt, prems = _} => mk_alg_select_tac ctxt Abs_IIT_inverse_thm)
   832       (fn {context = ctxt, prems = _} => mk_alg_select_tac ctxt Abs_IIT_inverse_thm)
   833       |> Thm.close_derivation;
   833       |> Thm.close_derivation \<^here>;
   834 
   834 
   835     val mor_select_thm =
   835     val mor_select_thm =
   836       let
   836       let
   837         val i_prem = mk_Trueprop_mem (iidx, II);
   837         val i_prem = mk_Trueprop_mem (iidx, II);
   838         val mor_prem = HOLogic.mk_Trueprop (mk_mor select_Bs select_ss active_UNIVs ss Asuc_fs);
   838         val mor_prem = HOLogic.mk_Trueprop (mk_mor select_Bs select_ss active_UNIVs ss Asuc_fs);
   844       in
   844       in
   845         Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, concl))
   845         Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, concl))
   846           (fn {context = ctxt, prems = _} => mk_mor_select_tac ctxt mor_def mor_cong_thm
   846           (fn {context = ctxt, prems = _} => mk_mor_select_tac ctxt mor_def mor_cong_thm
   847             mor_comp_thm mor_incl_min_alg_thm alg_def alg_select_thm alg_set_thms set_mapss
   847             mor_comp_thm mor_incl_min_alg_thm alg_def alg_select_thm alg_set_thms set_mapss
   848             str_init_defs)
   848             str_init_defs)
   849         |> Thm.close_derivation
   849         |> Thm.close_derivation \<^here>
   850       end;
   850       end;
   851 
   851 
   852     val init_unique_mor_thms =
   852     val init_unique_mor_thms =
   853       let
   853       let
   854         val prems = map2 (HOLogic.mk_Trueprop oo curry HOLogic.mk_mem) init_xs car_inits
   854         val prems = map2 (HOLogic.mk_Trueprop oo curry HOLogic.mk_mem) init_xs car_inits
   863         val vars = fold (Variable.add_free_names lthy) (unique :: all_prems) [];
   863         val vars = fold (Variable.add_free_names lthy) (unique :: all_prems) [];
   864         val unique_mor =
   864         val unique_mor =
   865           Goal.prove_sorry lthy vars [] (Logic.list_implies (all_prems, unique))
   865           Goal.prove_sorry lthy vars [] (Logic.list_implies (all_prems, unique))
   866             (fn {context = ctxt, prems = _} => mk_init_unique_mor_tac ctxt cts m alg_def
   866             (fn {context = ctxt, prems = _} => mk_init_unique_mor_tac ctxt cts m alg_def
   867               alg_init_thm least_min_alg_thms in_mono'_thms alg_set_thms morE_thms map_cong0s)
   867               alg_init_thm least_min_alg_thms in_mono'_thms alg_set_thms morE_thms map_cong0s)
   868           |> Thm.close_derivation;
   868           |> Thm.close_derivation \<^here>;
   869       in
   869       in
   870         split_conj_thm unique_mor
   870         split_conj_thm unique_mor
   871       end;
   871       end;
   872 
   872 
   873     val init_setss = mk_setss (passiveAs @ active_initTs);
   873     val init_setss = mk_setss (passiveAs @ active_initTs);
   897         val vars = fold (Variable.add_free_names lthy) [concl, prem] [];
   897         val vars = fold (Variable.add_free_names lthy) [concl, prem] [];
   898       in
   898       in
   899         Goal.prove_sorry lthy vars [] (Logic.mk_implies (prem, concl))
   899         Goal.prove_sorry lthy vars [] (Logic.mk_implies (prem, concl))
   900           (fn {context = ctxt, prems = _} => mk_init_induct_tac ctxt m alg_def alg_init_thm
   900           (fn {context = ctxt, prems = _} => mk_init_induct_tac ctxt m alg_def alg_init_thm
   901             least_min_alg_thms alg_set_thms)
   901             least_min_alg_thms alg_set_thms)
   902         |> Thm.close_derivation
   902         |> Thm.close_derivation \<^here>
   903       end;
   903       end;
   904 
   904 
   905     val timer = time (timer "Initiality definition & thms");
   905     val timer = time (timer "Initiality definition & thms");
   906 
   906 
   907     val ((T_names, (T_glob_infos, T_loc_infos)), lthy) =
   907     val ((T_names, (T_glob_infos, T_loc_infos)), lthy) =
   975         val mor_Rep =
   975         val mor_Rep =
   976           Goal.prove_sorry lthy [] []
   976           Goal.prove_sorry lthy [] []
   977             (HOLogic.mk_Trueprop (mk_mor UNIVs ctors car_inits str_inits Rep_Ts))
   977             (HOLogic.mk_Trueprop (mk_mor UNIVs ctors car_inits str_inits Rep_Ts))
   978             (fn {context = ctxt, prems = _} => mk_mor_Rep_tac ctxt m defs Reps Abs_inverses
   978             (fn {context = ctxt, prems = _} => mk_mor_Rep_tac ctxt m defs Reps Abs_inverses
   979               alg_min_alg_thm alg_set_thms set_mapss)
   979               alg_min_alg_thm alg_set_thms set_mapss)
   980           |> Thm.close_derivation;
   980           |> Thm.close_derivation \<^here>;
   981 
   981 
   982         fun mk_ct initFT str abs = Term.absdummy initFT (abs $ (str $ Bound 0))
   982         fun mk_ct initFT str abs = Term.absdummy initFT (abs $ (str $ Bound 0))
   983         val cts = @{map 3} (Thm.cterm_of lthy ooo mk_ct) init_FTs str_inits Abs_Ts;
   983         val cts = @{map 3} (Thm.cterm_of lthy ooo mk_ct) init_FTs str_inits Abs_Ts;
   984 
   984 
   985         val mor_Abs =
   985         val mor_Abs =
   986           Goal.prove_sorry lthy [] []
   986           Goal.prove_sorry lthy [] []
   987             (HOLogic.mk_Trueprop (mk_mor car_inits str_inits UNIVs ctors Abs_Ts))
   987             (HOLogic.mk_Trueprop (mk_mor car_inits str_inits UNIVs ctors Abs_Ts))
   988             (fn {context = ctxt, prems = _} => mk_mor_Abs_tac ctxt cts defs Abs_inverses
   988             (fn {context = ctxt, prems = _} => mk_mor_Abs_tac ctxt cts defs Abs_inverses
   989               map_comp_id_thms map_cong0L_thms)
   989               map_comp_id_thms map_cong0L_thms)
   990           |> Thm.close_derivation;
   990           |> Thm.close_derivation \<^here>;
   991       in
   991       in
   992         (mor_Rep, mor_Abs)
   992         (mor_Rep, mor_Abs)
   993       end;
   993       end;
   994 
   994 
   995     val timer = time (timer "ctor definitions & thms");
   995     val timer = time (timer "ctor definitions & thms");
  1044         val vars = fold (Variable.add_free_names lthy) (concl :: prems) [];
  1044         val vars = fold (Variable.add_free_names lthy) (concl :: prems) [];
  1045       in
  1045       in
  1046         Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, concl))
  1046         Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, concl))
  1047           (fn {context = ctxt, prems = _} => mk_copy_tac ctxt m alg_def mor_def alg_set_thms
  1047           (fn {context = ctxt, prems = _} => mk_copy_tac ctxt m alg_def mor_def alg_set_thms
  1048             set_mapss)
  1048             set_mapss)
  1049         |> Thm.close_derivation
  1049         |> Thm.close_derivation \<^here>
  1050       end;
  1050       end;
  1051 
  1051 
  1052     val init_ex_mor_thm =
  1052     val init_ex_mor_thm =
  1053       let
  1053       let
  1054         val goal = HOLogic.mk_Trueprop
  1054         val goal = HOLogic.mk_Trueprop
  1057       in
  1057       in
  1058         Goal.prove_sorry lthy vars [] goal
  1058         Goal.prove_sorry lthy vars [] goal
  1059           (fn {context = ctxt, prems = _} =>
  1059           (fn {context = ctxt, prems = _} =>
  1060             mk_init_ex_mor_tac ctxt Abs_IIT_inverse_thm (alg_min_alg_thm RS copy_thm)
  1060             mk_init_ex_mor_tac ctxt Abs_IIT_inverse_thm (alg_min_alg_thm RS copy_thm)
  1061               card_of_min_alg_thms mor_Rep_thm mor_comp_thm mor_select_thm mor_incl_thm)
  1061               card_of_min_alg_thms mor_Rep_thm mor_comp_thm mor_select_thm mor_incl_thm)
  1062         |> Thm.close_derivation
  1062         |> Thm.close_derivation \<^here>
  1063       end;
  1063       end;
  1064 
  1064 
  1065     val mor_fold_thm =
  1065     val mor_fold_thm =
  1066       let
  1066       let
  1067         val mor_cong = mor_cong_thm OF (map (mk_nth_conv n) ks);
  1067         val mor_cong = mor_cong_thm OF (map (mk_nth_conv n) ks);
  1071         val vars = Variable.add_free_names lthy goal [];
  1071         val vars = Variable.add_free_names lthy goal [];
  1072       in
  1072       in
  1073         Goal.prove_sorry lthy vars [] goal
  1073         Goal.prove_sorry lthy vars [] goal
  1074           (fn {context = ctxt, ...} =>
  1074           (fn {context = ctxt, ...} =>
  1075             mk_mor_fold_tac ctxt cT ct fold_defs init_ex_mor_thm mor_cong)
  1075             mk_mor_fold_tac ctxt cT ct fold_defs init_ex_mor_thm mor_cong)
  1076         |> Thm.close_derivation
  1076         |> Thm.close_derivation \<^here>
  1077       end;
  1077       end;
  1078 
  1078 
  1079     val ctor_fold_thms = map (fn morE => rule_by_tactic lthy
  1079     val ctor_fold_thms = map (fn morE => rule_by_tactic lthy
  1080       ((rtac lthy CollectI THEN' CONJ_WRAP' (K (rtac lthy @{thm subset_UNIV})) (1 upto m + n)) 1)
  1080       ((rtac lthy CollectI THEN' CONJ_WRAP' (K (rtac lthy @{thm subset_UNIV})) (1 upto m + n)) 1)
  1081       (mor_fold_thm RS morE)) morE_thms;
  1081       (mor_fold_thm RS morE)) morE_thms;
  1087         val unique = HOLogic.mk_Trueprop (Library.foldr1 HOLogic.mk_conj (map2 mk_fun_eq fs ks));
  1087         val unique = HOLogic.mk_Trueprop (Library.foldr1 HOLogic.mk_conj (map2 mk_fun_eq fs ks));
  1088         val vars = fold (Variable.add_free_names lthy) [prem, unique] [];
  1088         val vars = fold (Variable.add_free_names lthy) [prem, unique] [];
  1089         val unique_mor = Goal.prove_sorry lthy vars [] (Logic.mk_implies (prem, unique))
  1089         val unique_mor = Goal.prove_sorry lthy vars [] (Logic.mk_implies (prem, unique))
  1090           (fn {context = ctxt, prems = _} => mk_fold_unique_mor_tac ctxt type_defs
  1090           (fn {context = ctxt, prems = _} => mk_fold_unique_mor_tac ctxt type_defs
  1091             init_unique_mor_thms Reps mor_comp_thm mor_Abs_thm mor_fold_thm)
  1091             init_unique_mor_thms Reps mor_comp_thm mor_Abs_thm mor_fold_thm)
  1092           |> Thm.close_derivation;
  1092           |> Thm.close_derivation \<^here>;
  1093       in
  1093       in
  1094         `split_conj_thm unique_mor
  1094         `split_conj_thm unique_mor
  1095       end;
  1095       end;
  1096 
  1096 
  1097     val (ctor_fold_unique_thms, ctor_fold_unique_thm) =
  1097     val (ctor_fold_unique_thms, ctor_fold_unique_thm) =
  1146       in
  1146       in
  1147         @{map 5} (fn goal => fn dtor_def => fn foldx => fn map_comp_id => fn map_cong0L =>
  1147         @{map 5} (fn goal => fn dtor_def => fn foldx => fn map_comp_id => fn map_cong0L =>
  1148           Goal.prove_sorry lthy [] [] goal
  1148           Goal.prove_sorry lthy [] [] goal
  1149             (fn {context = ctxt, prems = _} => mk_dtor_o_ctor_tac ctxt dtor_def foldx map_comp_id
  1149             (fn {context = ctxt, prems = _} => mk_dtor_o_ctor_tac ctxt dtor_def foldx map_comp_id
  1150               map_cong0L ctor_o_fold_thms)
  1150               map_cong0L ctor_o_fold_thms)
  1151           |> Thm.close_derivation)
  1151           |> Thm.close_derivation \<^here>)
  1152         goals dtor_defs ctor_fold_thms map_comp_id_thms map_cong0L_thms
  1152         goals dtor_defs ctor_fold_thms map_comp_id_thms map_cong0L_thms
  1153       end;
  1153       end;
  1154 
  1154 
  1155     val dtor_ctor_thms = map (fn thm => thm RS @{thm pointfree_idE}) dtor_o_ctor_thms;
  1155     val dtor_ctor_thms = map (fn thm => thm RS @{thm pointfree_idE}) dtor_o_ctor_thms;
  1156     val ctor_dtor_thms = map (fn thm => thm RS @{thm pointfree_idE}) ctor_o_dtor_thms;
  1156     val ctor_dtor_thms = map (fn thm => thm RS @{thm pointfree_idE}) ctor_o_dtor_thms;
  1213       in
  1213       in
  1214         (Goal.prove_sorry lthy vars [] goal
  1214         (Goal.prove_sorry lthy vars [] goal
  1215           (fn {context = ctxt, prems = _} =>
  1215           (fn {context = ctxt, prems = _} =>
  1216             mk_ctor_induct_tac ctxt m set_mapss init_induct_thm morE_thms mor_Abs_thm
  1216             mk_ctor_induct_tac ctxt m set_mapss init_induct_thm morE_thms mor_Abs_thm
  1217             Rep_inverses Abs_inverses Reps)
  1217             Rep_inverses Abs_inverses Reps)
  1218         |> Thm.close_derivation,
  1218         |> Thm.close_derivation \<^here>,
  1219         rev (Term.add_tfrees goal []))
  1219         rev (Term.add_tfrees goal []))
  1220       end;
  1220       end;
  1221 
  1221 
  1222     val cTs = map (SOME o Thm.ctyp_of lthy o TFree) induct_params;
  1222     val cTs = map (SOME o Thm.ctyp_of lthy o TFree) induct_params;
  1223 
  1223 
  1256         val vars = Variable.add_free_names lthy goal [];
  1256         val vars = Variable.add_free_names lthy goal [];
  1257       in
  1257       in
  1258         (Goal.prove_sorry lthy vars [] goal
  1258         (Goal.prove_sorry lthy vars [] goal
  1259           (fn {context = ctxt, prems = _} => mk_ctor_induct2_tac ctxt cTs cts ctor_induct_thm
  1259           (fn {context = ctxt, prems = _} => mk_ctor_induct2_tac ctxt cTs cts ctor_induct_thm
  1260             weak_ctor_induct_thms)
  1260             weak_ctor_induct_thms)
  1261         |> Thm.close_derivation,
  1261         |> Thm.close_derivation \<^here>,
  1262         rev (Term.add_tfrees goal []))
  1262         rev (Term.add_tfrees goal []))
  1263       end;
  1263       end;
  1264 
  1264 
  1265     val timer = time (timer "induction");
  1265     val timer = time (timer "induction");
  1266 
  1266 
  1493               @{map 4} (fn goal => fn foldx => fn map_comp_id => fn map_cong0 =>
  1493               @{map 4} (fn goal => fn foldx => fn map_comp_id => fn map_cong0 =>
  1494                 Variable.add_free_names lthy goal []
  1494                 Variable.add_free_names lthy goal []
  1495                 |> (fn vars => Goal.prove_sorry lthy vars [] goal
  1495                 |> (fn vars => Goal.prove_sorry lthy vars [] goal
  1496                   (fn {context = ctxt, prems = _} => unfold_thms_tac ctxt Imap_defs THEN
  1496                   (fn {context = ctxt, prems = _} => unfold_thms_tac ctxt Imap_defs THEN
  1497                     mk_map_tac ctxt m n foldx map_comp_id map_cong0))
  1497                     mk_map_tac ctxt m n foldx map_comp_id map_cong0))
  1498                 |> Thm.close_derivation)
  1498                 |> Thm.close_derivation \<^here>)
  1499               goals ctor_fold_thms map_comp_id_thms map_cong0s;
  1499               goals ctor_fold_thms map_comp_id_thms map_cong0s;
  1500           in
  1500           in
  1501             `(map (fn thm => thm RS @{thm comp_eq_dest})) maps
  1501             `(map (fn thm => thm RS @{thm comp_eq_dest})) maps
  1502           end;
  1502           end;
  1503 
  1503 
  1512                 (map2 (curry HOLogic.mk_eq) us fs_Imaps));
  1512                 (map2 (curry HOLogic.mk_eq) us fs_Imaps));
  1513             val vars = fold (Variable.add_free_names lthy) (goal :: prems) [];
  1513             val vars = fold (Variable.add_free_names lthy) (goal :: prems) [];
  1514             val unique = Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, goal))
  1514             val unique = Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, goal))
  1515               (fn {context = ctxt, prems = _} => unfold_thms_tac ctxt Imap_defs THEN
  1515               (fn {context = ctxt, prems = _} => unfold_thms_tac ctxt Imap_defs THEN
  1516                 mk_ctor_map_unique_tac ctxt ctor_fold_unique_thm sym_map_comps)
  1516                 mk_ctor_map_unique_tac ctxt ctor_fold_unique_thm sym_map_comps)
  1517               |> Thm.close_derivation;
  1517               |> Thm.close_derivation \<^here>;
  1518           in
  1518           in
  1519             `split_conj_thm unique
  1519             `split_conj_thm unique
  1520           end;
  1520           end;
  1521 
  1521 
  1522         val timer = time (timer "map functions for the new datatypes");
  1522         val timer = time (timer "map functions for the new datatypes");
  1530               @{map 3} (fn sets => @{map 4} (mk_goal sets) ctors sets)
  1530               @{map 3} (fn sets => @{map 4} (mk_goal sets) ctors sets)
  1531                 Isetss_by_range colss map_setss;
  1531                 Isetss_by_range colss map_setss;
  1532             val setss = map (map2 (fn foldx => fn goal =>
  1532             val setss = map (map2 (fn foldx => fn goal =>
  1533                 Goal.prove_sorry lthy [] [] goal (fn {context = ctxt, prems = _} =>
  1533                 Goal.prove_sorry lthy [] [] goal (fn {context = ctxt, prems = _} =>
  1534                   unfold_thms_tac ctxt Iset_defs THEN mk_set_tac ctxt foldx)
  1534                   unfold_thms_tac ctxt Iset_defs THEN mk_set_tac ctxt foldx)
  1535                 |> Thm.close_derivation)
  1535                 |> Thm.close_derivation \<^here>)
  1536               ctor_fold_thms) goalss;
  1536               ctor_fold_thms) goalss;
  1537 
  1537 
  1538             fun mk_simp_goal pas_set act_sets sets ctor z set =
  1538             fun mk_simp_goal pas_set act_sets sets ctor z set =
  1539               mk_Trueprop_eq (set $ (ctor $ z),
  1539               mk_Trueprop_eq (set $ (ctor $ z),
  1540                 mk_union (pas_set $ z,
  1540                 mk_union (pas_set $ z,
  1548             val ctor_setss = @{map 3} (fn i => @{map 3} (fn set_nats => fn goal => fn set =>
  1548             val ctor_setss = @{map 3} (fn i => @{map 3} (fn set_nats => fn goal => fn set =>
  1549               Variable.add_free_names lthy goal []
  1549               Variable.add_free_names lthy goal []
  1550               |> (fn vars => Goal.prove_sorry lthy vars [] goal
  1550               |> (fn vars => Goal.prove_sorry lthy vars [] goal
  1551                   (fn {context = ctxt, prems = _} =>
  1551                   (fn {context = ctxt, prems = _} =>
  1552                     mk_ctor_set_tac ctxt set (nth set_nats (i - 1)) (drop m set_nats)))
  1552                     mk_ctor_set_tac ctxt set (nth set_nats (i - 1)) (drop m set_nats)))
  1553                 |> Thm.close_derivation)
  1553                 |> Thm.close_derivation \<^here>)
  1554               set_mapss) ls simp_goalss setss;
  1554               set_mapss) ls simp_goalss setss;
  1555           in
  1555           in
  1556             ctor_setss
  1556             ctor_setss
  1557           end;
  1557           end;
  1558 
  1558 
  1595             val thms =
  1595             val thms =
  1596               @{map 5} (fn goal => fn csets => fn ctor_sets => fn induct => fn i =>
  1596               @{map 5} (fn goal => fn csets => fn ctor_sets => fn induct => fn i =>
  1597                 Variable.add_free_names lthy goal []
  1597                 Variable.add_free_names lthy goal []
  1598                 |> (fn vars => Goal.prove_sorry lthy vars [] goal
  1598                 |> (fn vars => Goal.prove_sorry lthy vars [] goal
  1599                   (fn {context = ctxt, prems = _} => mk_tac ctxt induct csets ctor_sets i))
  1599                   (fn {context = ctxt, prems = _} => mk_tac ctxt induct csets ctor_sets i))
  1600                 |> Thm.close_derivation)
  1600                 |> Thm.close_derivation \<^here>)
  1601               goals csetss ctor_Iset_thmss inducts ls;
  1601               goals csetss ctor_Iset_thmss inducts ls;
  1602           in
  1602           in
  1603             map split_conj_thm thms
  1603             map split_conj_thm thms
  1604           end;
  1604           end;
  1605 
  1605 
  1624               @{map 4} (fn goal => fn ctor_sets => fn induct => fn i =>
  1624               @{map 4} (fn goal => fn ctor_sets => fn induct => fn i =>
  1625                 Variable.add_free_names lthy goal []
  1625                 Variable.add_free_names lthy goal []
  1626                 |> (fn vars => Goal.prove_sorry lthy vars [] goal
  1626                 |> (fn vars => Goal.prove_sorry lthy vars [] goal
  1627                     (fn {context = ctxt, prems = _} => unfold_thms_tac ctxt Ibd_defs THEN
  1627                     (fn {context = ctxt, prems = _} => unfold_thms_tac ctxt Ibd_defs THEN
  1628                       mk_tac ctxt induct ctor_sets i))
  1628                       mk_tac ctxt induct ctor_sets i))
  1629                 |> Thm.close_derivation)
  1629                 |> Thm.close_derivation \<^here>)
  1630               goals ctor_Iset_thmss inducts ls;
  1630               goals ctor_Iset_thmss inducts ls;
  1631           in
  1631           in
  1632             map split_conj_thm thms
  1632             map split_conj_thm thms
  1633           end;
  1633           end;
  1634 
  1634 
  1655             val vars = Variable.add_free_names lthy goal [];
  1655             val vars = Variable.add_free_names lthy goal [];
  1656 
  1656 
  1657             val thm = Goal.prove_sorry lthy vars [] goal
  1657             val thm = Goal.prove_sorry lthy vars [] goal
  1658                 (fn {context = ctxt, prems = _} => mk_mcong_tac ctxt (rtac ctxt induct) set_Iset_thmsss
  1658                 (fn {context = ctxt, prems = _} => mk_mcong_tac ctxt (rtac ctxt induct) set_Iset_thmsss
  1659                   map_cong0s ctor_Imap_thms)
  1659                   map_cong0s ctor_Imap_thms)
  1660               |> Thm.close_derivation;
  1660               |> Thm.close_derivation \<^here>;
  1661           in
  1661           in
  1662             split_conj_thm thm
  1662             split_conj_thm thm
  1663           end;
  1663           end;
  1664 
  1664 
  1665         val in_rels = map in_rel_of_bnf bnfs;
  1665         val in_rels = map in_rel_of_bnf bnfs;
  1691               Variable.add_free_names lthy goal []
  1691               Variable.add_free_names lthy goal []
  1692               |> (fn vars => Goal.prove_sorry lthy vars [] goal
  1692               |> (fn vars => Goal.prove_sorry lthy vars [] goal
  1693                (fn {context = ctxt, prems = _} =>
  1693                (fn {context = ctxt, prems = _} =>
  1694                  mk_ctor_rel_tac ctxt in_Irels i in_rel map_comp0 map_cong0 ctor_map ctor_sets
  1694                  mk_ctor_rel_tac ctxt in_Irels i in_rel map_comp0 map_cong0 ctor_map ctor_sets
  1695                    ctor_inject ctor_dtor set_map0s ctor_set_incls ctor_set_set_inclss))
  1695                    ctor_inject ctor_dtor set_map0s ctor_set_incls ctor_set_set_inclss))
  1696               |> Thm.close_derivation)
  1696               |> Thm.close_derivation \<^here>)
  1697             ks goals in_rels map_comps map_cong0s ctor_Imap_thms ctor_Iset_thmss'
  1697             ks goals in_rels map_comps map_cong0s ctor_Imap_thms ctor_Iset_thmss'
  1698               ctor_inject_thms ctor_dtor_thms set_mapss ctor_Iset_incl_thmss
  1698               ctor_inject_thms ctor_dtor_thms set_mapss ctor_Iset_incl_thmss
  1699               ctor_set_Iset_incl_thmsss
  1699               ctor_set_Iset_incl_thmsss
  1700           end;
  1700           end;
  1701 
  1701 
  1716             val vars = Variable.add_free_names lthy goal [];
  1716             val vars = Variable.add_free_names lthy goal [];
  1717           in
  1717           in
  1718             Goal.prove_sorry lthy vars [] goal
  1718             Goal.prove_sorry lthy vars [] goal
  1719               (fn {context = ctxt, prems = _} => mk_le_rel_OO_tac ctxt m induct ctor_nchotomy_thms
  1719               (fn {context = ctxt, prems = _} => mk_le_rel_OO_tac ctxt m induct ctor_nchotomy_thms
  1720                 ctor_Irel_thms rel_mono_strong0s le_rel_OOs)
  1720                 ctor_Irel_thms rel_mono_strong0s le_rel_OOs)
  1721             |> Thm.close_derivation
  1721             |> Thm.close_derivation \<^here>
  1722           end;
  1722           end;
  1723 
  1723 
  1724         val timer = time (timer "helpers for BNF properties");
  1724         val timer = time (timer "helpers for BNF properties");
  1725 
  1725 
  1726         val map_id0_tacs = map (fn thm => fn ctxt => mk_map_id0_tac ctxt map_id0s thm)
  1726         val map_id0_tacs = map (fn thm => fn ctxt => mk_map_id0_tac ctxt map_id0s thm)