src/HOL/Nominal/nominal_inductive.ML
changeset 54983 2c57fc1f7a8c
parent 54895 515630483010
child 54991 1169c65e9698
equal deleted inserted replaced
54982:b327bf0dabfb 54983:2c57fc1f7a8c
   341                  val ihyp' = Thm.instantiate ([], map (pairself (cterm_of thy))
   341                  val ihyp' = Thm.instantiate ([], map (pairself (cterm_of thy))
   342                    (map (Envir.subst_term env) vs ~~
   342                    (map (Envir.subst_term env) vs ~~
   343                     map (fold_rev (NominalDatatype.mk_perm [])
   343                     map (fold_rev (NominalDatatype.mk_perm [])
   344                       (rev pis' @ pis)) params' @ [z])) ihyp;
   344                       (rev pis' @ pis)) params' @ [z])) ihyp;
   345                  fun mk_pi th =
   345                  fun mk_pi th =
   346                    Simplifier.simplify (put_simpset HOL_basic_ss ctxt addsimps [@{thm id_apply}]
   346                    Simplifier.simplify (put_simpset HOL_basic_ss ctxt' addsimps [@{thm id_apply}]
   347                        addsimprocs [NominalDatatype.perm_simproc])
   347                        addsimprocs [NominalDatatype.perm_simproc])
   348                      (Simplifier.simplify (put_simpset eqvt_ss ctxt)
   348                      (Simplifier.simplify (put_simpset eqvt_ss ctxt')
   349                        (fold_rev (mk_perm_bool o cterm_of thy)
   349                        (fold_rev (mk_perm_bool o cterm_of thy)
   350                          (rev pis' @ pis) th));
   350                          (rev pis' @ pis) th));
   351                  val (gprems1, gprems2) = split_list
   351                  val (gprems1, gprems2) = split_list
   352                    (map (fn (th, t) =>
   352                    (map (fn (th, t) =>
   353                       if null (preds_of ps t) then (SOME th, mk_pi th)
   353                       if null (preds_of ps t) then (SOME th, mk_pi th)
   354                       else
   354                       else
   355                         (map_thm ctxt (split_conj (K o I) names)
   355                         (map_thm ctxt' (split_conj (K o I) names)
   356                            (etac conjunct1 1) monos NONE th,
   356                            (etac conjunct1 1) monos NONE th,
   357                          mk_pi (the (map_thm ctxt (inst_conj_all names ps (rev pis''))
   357                          mk_pi (the (map_thm ctxt' (inst_conj_all names ps (rev pis''))
   358                            (inst_conj_all_tac ctxt (length pis'')) monos (SOME t) th))))
   358                            (inst_conj_all_tac ctxt' (length pis'')) monos (SOME t) th))))
   359                       (gprems ~~ oprems)) |>> map_filter I;
   359                       (gprems ~~ oprems)) |>> map_filter I;
   360                  val vc_compat_ths' = map (fn th =>
   360                  val vc_compat_ths' = map (fn th =>
   361                    let
   361                    let
   362                      val th' = first_order_mrs gprems1 th;
   362                      val th' = first_order_mrs gprems1 th;
   363                      val (bop, lhs, rhs) = (case concl_of th' of
   363                      val (bop, lhs, rhs) = (case concl_of th' of
   623         fun eqvt_err s =
   623         fun eqvt_err s =
   624           let val ([t], ctxt''') = Variable.import_terms true [prop_of intr] ctxt
   624           let val ([t], ctxt''') = Variable.import_terms true [prop_of intr] ctxt
   625           in error ("Could not prove equivariance for introduction rule\n" ^
   625           in error ("Could not prove equivariance for introduction rule\n" ^
   626             Syntax.string_of_term ctxt''' t ^ "\n" ^ s)
   626             Syntax.string_of_term ctxt''' t ^ "\n" ^ s)
   627           end;
   627           end;
   628         val res = SUBPROOF (fn {prems, params, ...} =>
   628         val res = SUBPROOF (fn {context = ctxt'', prems, params, ...} =>
   629           let
   629           let
   630             val prems' = map (fn th => the_default th (map_thm ctxt'
   630             val prems' = map (fn th => the_default th (map_thm ctxt''
   631               (split_conj (K I) names) (etac conjunct2 1) monos NONE th)) prems;
   631               (split_conj (K I) names) (etac conjunct2 1) monos NONE th)) prems;
   632             val prems'' = map (fn th => Simplifier.simplify eqvt_simpset
   632             val prems'' = map (fn th => Simplifier.simplify eqvt_simpset
   633               (mk_perm_bool (cterm_of thy pi) th)) prems';
   633               (mk_perm_bool (cterm_of thy pi) th)) prems';
   634             val intr' = Drule.cterm_instantiate (map (cterm_of thy) vs ~~
   634             val intr' = Drule.cterm_instantiate (map (cterm_of thy) vs ~~
   635                map (cterm_of thy o NominalDatatype.mk_perm [] pi o term_of o #2) params)
   635                map (cterm_of thy o NominalDatatype.mk_perm [] pi o term_of o #2) params)