src/HOL/Nominal/nominal_inductive.ML
changeset 29265 5b4247055bd7
parent 27847 0dffedf9aff5
child 29270 0eade173f77e
equal deleted inserted replaced
29264:4ea3358fac3f 29265:5b4247055bd7
     1 (*  Title:      HOL/Nominal/nominal_inductive.ML
     1 (*  Title:      HOL/Nominal/nominal_inductive.ML
     2     ID:         $Id$
       
     3     Author:     Stefan Berghofer, TU Muenchen
     2     Author:     Stefan Berghofer, TU Muenchen
     4 
     3 
     5 Infrastructure for proving equivariance and strong induction theorems
     4 Infrastructure for proving equivariance and strong induction theorems
     6 for inductive predicates involving nominal datatypes.
     5 for inductive predicates involving nominal datatypes.
     7 *)
     6 *)
   236       let
   235       let
   237         val params' = params @ [("y", fsT)];
   236         val params' = params @ [("y", fsT)];
   238         val prem = Logic.list_implies
   237         val prem = Logic.list_implies
   239           (map mk_fresh bvars @ mk_distinct bvars @
   238           (map mk_fresh bvars @ mk_distinct bvars @
   240            map (fn prem =>
   239            map (fn prem =>
   241              if null (term_frees prem inter ps) then prem
   240              if null (OldTerm.term_frees prem inter ps) then prem
   242              else lift_prem prem) prems,
   241              else lift_prem prem) prems,
   243            HOLogic.mk_Trueprop (lift_pred p ts));
   242            HOLogic.mk_Trueprop (lift_pred p ts));
   244         val vs = map (Var o apfst (rpair 0)) (rename_wrt_term prem params')
   243         val vs = map (Var o apfst (rpair 0)) (rename_wrt_term prem params')
   245       in
   244       in
   246         (list_all (params', prem), (rev vs, subst_bounds (vs, prem)))
   245         (list_all (params', prem), (rev vs, subst_bounds (vs, prem)))
   262         lift_pred' (Free (fs_ctxt_name, fsT)) p ts)) concls));
   261         lift_pred' (Free (fs_ctxt_name, fsT)) p ts)) concls));
   263 
   262 
   264     val vc_compat = map (fn (params, bvars, prems, (p, ts)) =>
   263     val vc_compat = map (fn (params, bvars, prems, (p, ts)) =>
   265       map (fn q => list_all (params, incr_boundvars ~1 (Logic.list_implies
   264       map (fn q => list_all (params, incr_boundvars ~1 (Logic.list_implies
   266           (List.mapPartial (fn prem =>
   265           (List.mapPartial (fn prem =>
   267              if null (ps inter term_frees prem) then SOME prem
   266              if null (ps inter OldTerm.term_frees prem) then SOME prem
   268              else map_term (split_conj (K o I) names) prem prem) prems, q))))
   267              else map_term (split_conj (K o I) names) prem prem) prems, q))))
   269         (mk_distinct bvars @
   268         (mk_distinct bvars @
   270          maps (fn (t, T) => map (fn (u, U) => HOLogic.mk_Trueprop
   269          maps (fn (t, T) => map (fn (u, U) => HOLogic.mk_Trueprop
   271            (NominalPackage.fresh_const U T $ u $ t)) bvars)
   270            (NominalPackage.fresh_const U T $ u $ t)) bvars)
   272              (ts ~~ binder_types (fastype_of p)))) prems;
   271              (ts ~~ binder_types (fastype_of p)))) prems;
   351                      (Simplifier.simplify eqvt_ss
   350                      (Simplifier.simplify eqvt_ss
   352                        (fold_rev (mk_perm_bool o cterm_of thy)
   351                        (fold_rev (mk_perm_bool o cterm_of thy)
   353                          (rev pis' @ pis) th));
   352                          (rev pis' @ pis) th));
   354                  val (gprems1, gprems2) = split_list
   353                  val (gprems1, gprems2) = split_list
   355                    (map (fn (th, t) =>
   354                    (map (fn (th, t) =>
   356                       if null (term_frees t inter ps) then (SOME th, mk_pi th)
   355                       if null (OldTerm.term_frees t inter ps) then (SOME th, mk_pi th)
   357                       else
   356                       else
   358                         (map_thm ctxt (split_conj (K o I) names)
   357                         (map_thm ctxt (split_conj (K o I) names)
   359                            (etac conjunct1 1) monos NONE th,
   358                            (etac conjunct1 1) monos NONE th,
   360                          mk_pi (the (map_thm ctxt (inst_conj_all names ps (rev pis''))
   359                          mk_pi (the (map_thm ctxt (inst_conj_all names ps (rev pis''))
   361                            (inst_conj_all_tac (length pis'')) monos (SOME t) th))))
   360                            (inst_conj_all_tac (length pis'')) monos (SOME t) th))))