src/Provers/induct_method.ML
changeset 18678 dd0c569fa43d
parent 18631 ca56111fe69c
child 18708 4b3dadb4fe33
equal deleted inserted replaced
18677:01265301db7f 18678:dd0c569fa43d
    51 
    51 
    52 (* alignment *)
    52 (* alignment *)
    53 
    53 
    54 fun align_left msg xs ys =
    54 fun align_left msg xs ys =
    55   let val m = length xs and n = length ys
    55   let val m = length xs and n = length ys
    56   in if m < n then raise ERROR_MESSAGE msg else (Library.take (n, xs) ~~ ys) end;
    56   in if m < n then error msg else (Library.take (n, xs) ~~ ys) end;
    57 
    57 
    58 fun align_right msg xs ys =
    58 fun align_right msg xs ys =
    59   let val m = length xs and n = length ys
    59   let val m = length xs and n = length ys
    60   in if m < n then raise ERROR_MESSAGE msg else (Library.drop (m - n, xs) ~~ ys) end;
    60   in if m < n then error msg else (Library.drop (m - n, xs) ~~ ys) end;
    61 
    61 
    62 
    62 
    63 (* prep_inst *)
    63 (* prep_inst *)
    64 
    64 
    65 fun prep_inst thy align tune (tm, ts) =
    65 fun prep_inst thy align tune (tm, ts) =
    70             val cx = cert x;
    70             val cx = cert x;
    71             val {T = xT, thy, ...} = Thm.rep_cterm cx;
    71             val {T = xT, thy, ...} = Thm.rep_cterm cx;
    72             val ct = cert (tune t);
    72             val ct = cert (tune t);
    73           in
    73           in
    74             if Sign.typ_instance thy (#T (Thm.rep_cterm ct), xT) then SOME (cx, ct)
    74             if Sign.typ_instance thy (#T (Thm.rep_cterm ct), xT) then SOME (cx, ct)
    75             else raise ERROR_MESSAGE (Pretty.string_of (Pretty.block
    75             else error (Pretty.string_of (Pretty.block
    76              [Pretty.str "Ill-typed instantiation:", Pretty.fbrk,
    76              [Pretty.str "Ill-typed instantiation:", Pretty.fbrk,
    77               Display.pretty_cterm ct, Pretty.str " ::", Pretty.brk 1,
    77               Display.pretty_cterm ct, Pretty.str " ::", Pretty.brk 1,
    78               Display.pretty_ctyp (#T (Thm.crep_cterm ct))]))
    78               Display.pretty_ctyp (#T (Thm.crep_cterm ct))]))
    79           end
    79           end
    80       | prep_var (_, NONE) = NONE;
    80       | prep_var (_, NONE) = NONE;