src/Tools/induct.ML
changeset 28965 1de908189869
parent 28375 c879d88d038a
child 29276 94b1ffec9201
equal deleted inserted replaced
28963:f6d9e0e0b153 28965:1de908189869
     1 (*  Title:      Tools/induct.ML
     1 (*  Title:      Tools/induct.ML
     2     ID:         $Id$
       
     3     Author:     Markus Wenzel, TU Muenchen
     2     Author:     Markus Wenzel, TU Muenchen
     4 
     3 
     5 Proof by cases, induction, and coinduction.
     4 Proof by cases, induction, and coinduction.
     6 *)
     5 *)
     7 
     6 
    49   val typeN: string
    48   val typeN: string
    50   val predN: string
    49   val predN: string
    51   val setN: string
    50   val setN: string
    52   (*proof methods*)
    51   (*proof methods*)
    53   val fix_tac: Proof.context -> int -> (string * typ) list -> int -> tactic
    52   val fix_tac: Proof.context -> int -> (string * typ) list -> int -> tactic
    54   val add_defs: (Name.binding option * term) option list -> Proof.context ->
    53   val add_defs: (Binding.T option * term) option list -> Proof.context ->
    55     (term option list * thm list) * Proof.context
    54     (term option list * thm list) * Proof.context
    56   val atomize_term: theory -> term -> term
    55   val atomize_term: theory -> term -> term
    57   val atomize_tac: int -> tactic
    56   val atomize_tac: int -> tactic
    58   val inner_atomize_tac: int -> tactic
    57   val inner_atomize_tac: int -> tactic
    59   val rulified_term: thm -> theory * term
    58   val rulified_term: thm -> theory * term
    61   val internalize: int -> thm -> thm
    60   val internalize: int -> thm -> thm
    62   val guess_instance: Proof.context -> thm -> int -> thm -> thm Seq.seq
    61   val guess_instance: Proof.context -> thm -> int -> thm -> thm Seq.seq
    63   val cases_tac: Proof.context -> term option list list -> thm option ->
    62   val cases_tac: Proof.context -> term option list list -> thm option ->
    64     thm list -> int -> cases_tactic
    63     thm list -> int -> cases_tactic
    65   val get_inductT: Proof.context -> term option list list -> thm list list
    64   val get_inductT: Proof.context -> term option list list -> thm list list
    66   val induct_tac: Proof.context -> (Name.binding option * term) option list list ->
    65   val induct_tac: Proof.context -> (Binding.T option * term) option list list ->
    67     (string * typ) list list -> term option list -> thm list option ->
    66     (string * typ) list list -> term option list -> thm list option ->
    68     thm list -> int -> cases_tactic
    67     thm list -> int -> cases_tactic
    69   val coinduct_tac: Proof.context -> term option list -> term option list -> thm option ->
    68   val coinduct_tac: Proof.context -> term option list -> term option list -> thm option ->
    70     thm list -> int -> cases_tactic
    69     thm list -> int -> cases_tactic
    71   val setup: theory -> theory
    70   val setup: theory -> theory
   551 
   550 
   552 fun add_defs def_insts =
   551 fun add_defs def_insts =
   553   let
   552   let
   554     fun add (SOME (SOME x, t)) ctxt =
   553     fun add (SOME (SOME x, t)) ctxt =
   555           let val ([(lhs, (_, th))], ctxt') =
   554           let val ([(lhs, (_, th))], ctxt') =
   556             LocalDefs.add_defs [((x, NoSyn), ((Name.no_binding, []), t))] ctxt
   555             LocalDefs.add_defs [((x, NoSyn), ((Binding.empty, []), t))] ctxt
   557           in ((SOME lhs, [th]), ctxt') end
   556           in ((SOME lhs, [th]), ctxt') end
   558       | add (SOME (NONE, t)) ctxt = ((SOME t, []), ctxt)
   557       | add (SOME (NONE, t)) ctxt = ((SOME t, []), ctxt)
   559       | add NONE ctxt = ((NONE, []), ctxt);
   558       | add NONE ctxt = ((NONE, []), ctxt);
   560   in fold_map add def_insts #> apfst (split_list #> apsnd flat) end;
   559   in fold_map add def_insts #> apfst (split_list #> apsnd flat) end;
   561 
   560