src/HOL/Tools/Datatype/datatype_abs_proofs.ML
changeset 33338 de76079f973a
parent 33317 b4534348b8fd
child 33459 a4a38ed813f7
equal deleted inserted replaced
33337:9c3b9bf81e8b 33338:de76079f973a
   123 
   123 
   124     (* introduction rules for graph of primrec function *)
   124     (* introduction rules for graph of primrec function *)
   125 
   125 
   126     fun make_rec_intr T rec_set (cname, cargs) (rec_intr_ts, l) =
   126     fun make_rec_intr T rec_set (cname, cargs) (rec_intr_ts, l) =
   127       let
   127       let
   128         fun mk_prem ((dt, U), (j, k, prems, t1s, t2s)) =
   128         fun mk_prem (dt, U) (j, k, prems, t1s, t2s) =
   129           let val free1 = mk_Free "x" U j
   129           let val free1 = mk_Free "x" U j
   130           in (case (strip_dtyp dt, strip_type U) of
   130           in (case (strip_dtyp dt, strip_type U) of
   131              ((_, DtRec m), (Us, _)) =>
   131              ((_, DtRec m), (Us, _)) =>
   132                let
   132                let
   133                  val free2 = mk_Free "y" (Us ---> nth rec_result_Ts m) k;
   133                  val free2 = mk_Free "y" (Us ---> nth rec_result_Ts m) k;
   139                end
   139                end
   140            | _ => (j + 1, k, prems, free1::t1s, t2s))
   140            | _ => (j + 1, k, prems, free1::t1s, t2s))
   141           end;
   141           end;
   142 
   142 
   143         val Ts = map (typ_of_dtyp descr' sorts) cargs;
   143         val Ts = map (typ_of_dtyp descr' sorts) cargs;
   144         val (_, _, prems, t1s, t2s) = List.foldr mk_prem (1, 1, [], [], []) (cargs ~~ Ts)
   144         val (_, _, prems, t1s, t2s) = fold_rev mk_prem (cargs ~~ Ts) (1, 1, [], [], [])
   145 
   145 
   146       in (rec_intr_ts @ [Logic.list_implies (prems, HOLogic.mk_Trueprop
   146       in (rec_intr_ts @ [Logic.list_implies (prems, HOLogic.mk_Trueprop
   147         (rec_set $ list_comb (Const (cname, Ts ---> T), t1s) $
   147         (rec_set $ list_comb (Const (cname, Ts ---> T), t1s) $
   148           list_comb (nth rec_fns l, t1s @ t2s)))], l + 1)
   148           list_comb (nth rec_fns l, t1s @ t2s)))], l + 1)
   149       end;
   149       end;