src/Pure/Isar/proof.ML
changeset 28083 103d9282a946
parent 26922 c795d4b706b1
child 28084 a05ca48ef263
equal deleted inserted replaced
28082:37350f301128 28083:103d9282a946
    42   val refine_goals: (context -> thm -> unit) -> context -> thm list -> state -> state Seq.seq
    42   val refine_goals: (context -> thm -> unit) -> context -> thm list -> state -> state Seq.seq
    43   val match_bind: (string list * string) list -> state -> state
    43   val match_bind: (string list * string) list -> state -> state
    44   val match_bind_i: (term list * term) list -> state -> state
    44   val match_bind_i: (term list * term) list -> state -> state
    45   val let_bind: (string list * string) list -> state -> state
    45   val let_bind: (string list * string) list -> state -> state
    46   val let_bind_i: (term list * term) list -> state -> state
    46   val let_bind_i: (term list * term) list -> state -> state
    47   val fix: (string * string option * mixfix) list -> state -> state
    47   val fix: (Name.binding * string option * mixfix) list -> state -> state
    48   val fix_i: (string * typ option * mixfix) list -> state -> state
    48   val fix_i: (Name.binding * typ option * mixfix) list -> state -> state
    49   val assm: Assumption.export ->
    49   val assm: Assumption.export ->
    50     ((string * Attrib.src list) * (string * string list) list) list -> state -> state
    50     ((Name.binding * Attrib.src list) * (string * string list) list) list -> state -> state
    51   val assm_i: Assumption.export ->
    51   val assm_i: Assumption.export ->
    52     ((string * attribute list) * (term * term list) list) list -> state -> state
    52     ((Name.binding * attribute list) * (term * term list) list) list -> state -> state
    53   val assume: ((string * Attrib.src list) * (string * string list) list) list -> state -> state
    53   val assume: ((Name.binding * Attrib.src list) * (string * string list) list) list ->
    54   val assume_i: ((string * attribute list) * (term * term list) list) list -> state -> state
    54     state -> state
    55   val presume: ((string * Attrib.src list) * (string * string list) list) list -> state -> state
    55   val assume_i: ((Name.binding * attribute list) * (term * term list) list) list ->
    56   val presume_i: ((string * attribute list) * (term * term list) list) list -> state -> state
    56     state -> state
    57   val def: ((string * Attrib.src list) *
    57   val presume: ((Name.binding * Attrib.src list) * (string * string list) list) list ->
    58     ((string * mixfix) * (string * string list))) list -> state -> state
    58     state -> state
    59   val def_i: ((string * attribute list) *
    59   val presume_i: ((Name.binding * attribute list) * (term * term list) list) list ->
    60     ((string * mixfix) * (term * term list))) list -> state -> state
    60     state -> state
       
    61   val def: ((Name.binding * Attrib.src list) *
       
    62     ((Name.binding * mixfix) * (string * string list))) list -> state -> state
       
    63   val def_i: ((Name.binding * attribute list) *
       
    64     ((Name.binding * mixfix) * (term * term list))) list -> state -> state
    61   val chain: state -> state
    65   val chain: state -> state
    62   val chain_facts: thm list -> state -> state
    66   val chain_facts: thm list -> state -> state
    63   val get_thmss: state -> (Facts.ref * Attrib.src list) list -> thm list
    67   val get_thmss: state -> (Facts.ref * Attrib.src list) list -> thm list
    64   val note_thmss: ((string * Attrib.src list) *
    68   val note_thmss: ((Name.binding * Attrib.src list) *
    65     (Facts.ref * Attrib.src list) list) list -> state -> state
    69     (Facts.ref * Attrib.src list) list) list -> state -> state
    66   val note_thmss_i: ((string * attribute list) *
    70   val note_thmss_i: ((Name.binding * attribute list) *
    67     (thm list * attribute list) list) list -> state -> state
    71     (thm list * attribute list) list) list -> state -> state
    68   val from_thmss: ((Facts.ref * Attrib.src list) list) list -> state -> state
    72   val from_thmss: ((Facts.ref * Attrib.src list) list) list -> state -> state
    69   val from_thmss_i: ((thm list * attribute list) list) list -> state -> state
    73   val from_thmss_i: ((thm list * attribute list) list) list -> state -> state
    70   val with_thmss: ((Facts.ref * Attrib.src list) list) list -> state -> state
    74   val with_thmss: ((Facts.ref * Attrib.src list) list) list -> state -> state
    71   val with_thmss_i: ((thm list * attribute list) list) list -> state -> state
    75   val with_thmss_i: ((thm list * attribute list) list) list -> state -> state
    85   val apply_end: Method.text -> state -> state Seq.seq
    89   val apply_end: Method.text -> state -> state Seq.seq
    86   val local_goal: (context -> ((string * string) * (string * thm list) list) -> unit) ->
    90   val local_goal: (context -> ((string * string) * (string * thm list) list) -> unit) ->
    87     (theory -> 'a -> attribute) ->
    91     (theory -> 'a -> attribute) ->
    88     (context * 'b list -> context * (term list list * (context -> context))) ->
    92     (context * 'b list -> context * (term list list * (context -> context))) ->
    89     string -> Method.text option -> (thm list list -> state -> state Seq.seq) ->
    93     string -> Method.text option -> (thm list list -> state -> state Seq.seq) ->
    90     ((string * 'a list) * 'b) list -> state -> state
    94     ((Name.binding * 'a list) * 'b) list -> state -> state
    91   val local_qed: Method.text option * bool -> state -> state Seq.seq
    95   val local_qed: Method.text option * bool -> state -> state Seq.seq
    92   val theorem: Method.text option -> (thm list list -> context -> context) ->
    96   val theorem: Method.text option -> (thm list list -> context -> context) ->
    93     (string * string list) list list -> context -> state
    97     (string * string list) list list -> context -> state
    94   val theorem_i: Method.text option -> (thm list list -> context -> context) ->
    98   val theorem_i: Method.text option -> (thm list list -> context -> context) ->
    95     (term * term list) list list -> context -> state
    99     (term * term list) list list -> context -> state
   103   val global_default_proof: state -> context
   107   val global_default_proof: state -> context
   104   val global_immediate_proof: state -> context
   108   val global_immediate_proof: state -> context
   105   val global_done_proof: state -> context
   109   val global_done_proof: state -> context
   106   val global_skip_proof: bool -> state -> context
   110   val global_skip_proof: bool -> state -> context
   107   val have: Method.text option -> (thm list list -> state -> state Seq.seq) ->
   111   val have: Method.text option -> (thm list list -> state -> state Seq.seq) ->
   108     ((string * Attrib.src list) * (string * string list) list) list -> bool -> state -> state
   112     ((Name.binding * Attrib.src list) * (string * string list) list) list -> bool -> state -> state
   109   val have_i: Method.text option -> (thm list list -> state -> state Seq.seq) ->
   113   val have_i: Method.text option -> (thm list list -> state -> state Seq.seq) ->
   110     ((string * attribute list) * (term * term list) list) list -> bool -> state -> state
   114     ((Name.binding * attribute list) * (term * term list) list) list -> bool -> state -> state
   111   val show: Method.text option -> (thm list list -> state -> state Seq.seq) ->
   115   val show: Method.text option -> (thm list list -> state -> state Seq.seq) ->
   112     ((string * Attrib.src list) * (string * string list) list) list -> bool -> state -> state
   116     ((Name.binding * Attrib.src list) * (string * string list) list) list -> bool -> state -> state
   113   val show_i: Method.text option -> (thm list list -> state -> state Seq.seq) ->
   117   val show_i: Method.text option -> (thm list list -> state -> state Seq.seq) ->
   114     ((string * attribute list) * (term * term list) list) list -> bool -> state -> state
   118     ((Name.binding * attribute list) * (term * term list) list) list -> bool -> state -> state
   115 end;
   119 end;
   116 
   120 
   117 structure Proof: PROOF =
   121 structure Proof: PROOF =
   118 struct
   122 struct
   119 
   123 
   608   #> chain;
   612   #> chain;
   609 
   613 
   610 
   614 
   611 (* note etc. *)
   615 (* note etc. *)
   612 
   616 
   613 fun no_binding args = map (pair ("", [])) args;
   617 fun no_binding args = map (pair (Name.no_binding, [])) args;
   614 
   618 
   615 local
   619 local
   616 
   620 
   617 fun gen_thmss note_ctxt more_facts opt_chain opt_result prep_atts args state =
   621 fun gen_thmss note_ctxt more_facts opt_chain opt_result prep_atts args state =
   618   state
   622   state
   636 val with_thmss_i = gen_thmss (ProofContext.note_thmss_i "") the_facts chain #2 (K I) o no_binding;
   640 val with_thmss_i = gen_thmss (ProofContext.note_thmss_i "") the_facts chain #2 (K I) o no_binding;
   637 
   641 
   638 val local_results =
   642 val local_results =
   639   gen_thmss (ProofContext.note_thmss_i "") (K []) I I (K I) o map (apsnd Thm.simple_fact);
   643   gen_thmss (ProofContext.note_thmss_i "") (K []) I I (K I) o map (apsnd Thm.simple_fact);
   640 
   644 
   641 fun get_thmss state srcs = the_facts (note_thmss [(("", []), srcs)] state);
   645 fun get_thmss state srcs = the_facts (note_thmss [((Name.no_binding, []), srcs)] state);
   642 
   646 
   643 end;
   647 end;
   644 
   648 
   645 
   649 
   646 (* using/unfolding *)
   650 (* using/unfolding *)
   680 fun gen_invoke_case prep_att (name, xs, raw_atts) state =
   684 fun gen_invoke_case prep_att (name, xs, raw_atts) state =
   681   let
   685   let
   682     val atts = map (prep_att (theory_of state)) raw_atts;
   686     val atts = map (prep_att (theory_of state)) raw_atts;
   683     val (asms, state') = state |> map_context_result (fn ctxt =>
   687     val (asms, state') = state |> map_context_result (fn ctxt =>
   684       ctxt |> ProofContext.apply_case (ProofContext.get_case ctxt name xs));
   688       ctxt |> ProofContext.apply_case (ProofContext.get_case ctxt name xs));
   685     val assumptions = asms |> map (fn (a, ts) => ((a, atts), map (rpair []) ts));
   689     val assumptions = asms |> map (fn (a, ts) => ((Name.binding a, atts), map (rpair []) ts));
   686   in
   690   in
   687     state'
   691     state'
   688     |> map_context (ProofContext.qualified_names #> ProofContext.no_base_names)
   692     |> map_context (ProofContext.qualified_names #> ProofContext.no_base_names)
   689     |> assume_i assumptions
   693     |> assume_i assumptions
   690     |> add_binds_i AutoBind.no_facts
   694     |> add_binds_i AutoBind.no_facts
   691     |> map_context (ProofContext.restore_naming (context_of state))
   695     |> map_context (ProofContext.restore_naming (context_of state))
   692     |> `the_facts |-> (fn thms => note_thmss_i [((name, []), [(thms, [])])])
   696     |> `the_facts |-> (fn thms => note_thmss_i [((Name.binding name, []), [(thms, [])])])
   693   end;
   697   end;
   694 
   698 
   695 in
   699 in
   696 
   700 
   697 val invoke_case = gen_invoke_case Attrib.attribute;
   701 val invoke_case = gen_invoke_case Attrib.attribute;