src/HOL/Nominal/nominal_induct.ML
changeset 33957 e9afca2118d4
parent 33955 fff6f11b1f09
child 34907 b0aaec87751c
equal deleted inserted replaced
33956:6f549f5e7066 33957:e9afca2118d4
    44       let
    44       let
    45         val vars = Induct.vars_of concl;
    45         val vars = Induct.vars_of concl;
    46         val m = length vars and n = length inst;
    46         val m = length vars and n = length inst;
    47         val _ = if m >= n + 2 then () else error "Too few variables in conclusion of rule";
    47         val _ = if m >= n + 2 then () else error "Too few variables in conclusion of rule";
    48         val P :: x :: ys = vars;
    48         val P :: x :: ys = vars;
    49         val zs = (uncurry drop) (m - n - 2, ys);
    49         val zs = drop (m - n - 2) ys;
    50       in
    50       in
    51         (P, tuple_fun (map #2 avoiding) (Term.dest_Var P)) ::
    51         (P, tuple_fun (map #2 avoiding) (Term.dest_Var P)) ::
    52         (x, tuple (map Free avoiding)) ::
    52         (x, tuple (map Free avoiding)) ::
    53         map_filter (fn (z, SOME t) => SOME (z, t) | _ => NONE) (zs ~~ inst)
    53         map_filter (fn (z, SOME t) => SOME (z, t) | _ => NONE) (zs ~~ inst)
    54       end;
    54       end;
    69       let
    69       let
    70         val ps = Logic.strip_params prem;
    70         val ps = Logic.strip_params prem;
    71         val p = length ps;
    71         val p = length ps;
    72         val ys =
    72         val ys =
    73           if p < n then []
    73           if p < n then []
    74           else map (tune o #1) ((uncurry take) (p - n, ps)) @ xs;
    74           else map (tune o #1) (take (p - n) ps) @ xs;
    75       in Logic.list_rename_params (ys, prem) end;
    75       in Logic.list_rename_params (ys, prem) end;
    76     fun rename_prems prop =
    76     fun rename_prems prop =
    77       let val (As, C) = Logic.strip_horn (Thm.prop_of rule)
    77       let val (As, C) = Logic.strip_horn (Thm.prop_of rule)
    78       in Logic.list_implies (map rename As, C) end;
    78       in Logic.list_implies (map rename As, C) end;
    79   in Thm.equal_elim (Thm.reflexive (Drule.cterm_fun rename_prems (Thm.cprop_of rule))) rule end;
    79   in Thm.equal_elim (Thm.reflexive (Drule.cterm_fun rename_prems (Thm.cprop_of rule))) rule end;