src/Doc/Implementation/Proof.thy
changeset 73764 35d8132633c6
parent 69597 ff784d5a5bfb
child 74240 36774e8af3db
equal deleted inserted replaced
73763:eccc4a13216d 73764:35d8132633c6
    90   by inventing fixed variables \<open>x\<^sub>1, \<dots>, x\<^sub>n\<close> for the body.
    90   by inventing fixed variables \<open>x\<^sub>1, \<dots>, x\<^sub>n\<close> for the body.
    91 \<close>
    91 \<close>
    92 
    92 
    93 text %mlref \<open>
    93 text %mlref \<open>
    94   \begin{mldecls}
    94   \begin{mldecls}
    95   @{index_ML Variable.add_fixes: "
    95   @{define_ML Variable.add_fixes: "
    96   string list -> Proof.context -> string list * Proof.context"} \\
    96   string list -> Proof.context -> string list * Proof.context"} \\
    97   @{index_ML Variable.variant_fixes: "
    97   @{define_ML Variable.variant_fixes: "
    98   string list -> Proof.context -> string list * Proof.context"} \\
    98   string list -> Proof.context -> string list * Proof.context"} \\
    99   @{index_ML Variable.declare_term: "term -> Proof.context -> Proof.context"} \\
    99   @{define_ML Variable.declare_term: "term -> Proof.context -> Proof.context"} \\
   100   @{index_ML Variable.declare_constraints: "term -> Proof.context -> Proof.context"} \\
   100   @{define_ML Variable.declare_constraints: "term -> Proof.context -> Proof.context"} \\
   101   @{index_ML Variable.export: "Proof.context -> Proof.context -> thm list -> thm list"} \\
   101   @{define_ML Variable.export: "Proof.context -> Proof.context -> thm list -> thm list"} \\
   102   @{index_ML Variable.polymorphic: "Proof.context -> term list -> term list"} \\
   102   @{define_ML Variable.polymorphic: "Proof.context -> term list -> term list"} \\
   103   @{index_ML Variable.import: "bool -> thm list -> Proof.context ->
   103   @{define_ML Variable.import: "bool -> thm list -> Proof.context ->
   104   ((((indexname * sort) * ctyp) list * ((indexname * typ) * cterm) list) * thm list)
   104   ((((indexname * sort) * ctyp) list * ((indexname * typ) * cterm) list) * thm list)
   105     * Proof.context"} \\
   105     * Proof.context"} \\
   106   @{index_ML Variable.focus: "binding list option -> term -> Proof.context ->
   106   @{define_ML Variable.focus: "binding list option -> term -> Proof.context ->
   107   ((string * (string * typ)) list * term) * Proof.context"} \\
   107   ((string * (string * typ)) list * term) * Proof.context"} \\
   108   \end{mldecls}
   108   \end{mldecls}
   109 
   109 
   110   \<^descr> \<^ML>\<open>Variable.add_fixes\<close>~\<open>xs ctxt\<close> fixes term variables \<open>xs\<close>, returning
   110   \<^descr> \<^ML>\<open>Variable.add_fixes\<close>~\<open>xs ctxt\<close> fixes term variables \<open>xs\<close>, returning
   111   the resulting internal names. By default, the internal representation
   111   the resulting internal names. By default, the internal representation
   261   \<open>x\<close> being fresh, so \<open>x\<close> does not occur in \<open>\<Gamma>\<close> here.
   261   \<open>x\<close> being fresh, so \<open>x\<close> does not occur in \<open>\<Gamma>\<close> here.
   262 \<close>
   262 \<close>
   263 
   263 
   264 text %mlref \<open>
   264 text %mlref \<open>
   265   \begin{mldecls}
   265   \begin{mldecls}
   266   @{index_ML_type Assumption.export} \\
   266   @{define_ML_type Assumption.export} \\
   267   @{index_ML Assumption.assume: "Proof.context -> cterm -> thm"} \\
   267   @{define_ML Assumption.assume: "Proof.context -> cterm -> thm"} \\
   268   @{index_ML Assumption.add_assms:
   268   @{define_ML Assumption.add_assms:
   269     "Assumption.export ->
   269     "Assumption.export ->
   270   cterm list -> Proof.context -> thm list * Proof.context"} \\
   270   cterm list -> Proof.context -> thm list * Proof.context"} \\
   271   @{index_ML Assumption.add_assumes: "
   271   @{define_ML Assumption.add_assumes: "
   272   cterm list -> Proof.context -> thm list * Proof.context"} \\
   272   cterm list -> Proof.context -> thm list * Proof.context"} \\
   273   @{index_ML Assumption.export: "bool -> Proof.context -> Proof.context -> thm -> thm"} \\
   273   @{define_ML Assumption.export: "bool -> Proof.context -> Proof.context -> thm -> thm"} \\
   274   \end{mldecls}
   274   \end{mldecls}
   275 
   275 
   276   \<^descr> Type \<^ML_type>\<open>Assumption.export\<close> represents arbitrary export rules, which
   276   \<^descr> Type \<^ML_type>\<open>Assumption.export\<close> represents arbitrary export rules, which
   277   is any function of type \<^ML_type>\<open>bool -> cterm list -> thm -> thm\<close>, where
   277   is any function of type \<^ML_type>\<open>bool -> cterm list -> thm -> thm\<close>, where
   278   the \<^ML_type>\<open>bool\<close> indicates goal mode, and the \<^ML_type>\<open>cterm list\<close>
   278   the \<^ML_type>\<open>bool\<close> indicates goal mode, and the \<^ML_type>\<open>cterm list\<close>
   357   not refer to the parameters in the conclusion, need to exported explicitly
   357   not refer to the parameters in the conclusion, need to exported explicitly
   358   into the original context.\<close>
   358   into the original context.\<close>
   359 
   359 
   360 text %mlref \<open>
   360 text %mlref \<open>
   361   \begin{mldecls}
   361   \begin{mldecls}
   362   @{index_ML SUBPROOF: "(Subgoal.focus -> tactic) ->
   362   @{define_ML SUBPROOF: "(Subgoal.focus -> tactic) ->
   363   Proof.context -> int -> tactic"} \\
   363   Proof.context -> int -> tactic"} \\
   364   @{index_ML Subgoal.FOCUS: "(Subgoal.focus -> tactic) ->
   364   @{define_ML Subgoal.FOCUS: "(Subgoal.focus -> tactic) ->
   365   Proof.context -> int -> tactic"} \\
   365   Proof.context -> int -> tactic"} \\
   366   @{index_ML Subgoal.FOCUS_PREMS: "(Subgoal.focus -> tactic) ->
   366   @{define_ML Subgoal.FOCUS_PREMS: "(Subgoal.focus -> tactic) ->
   367   Proof.context -> int -> tactic"} \\
   367   Proof.context -> int -> tactic"} \\
   368   @{index_ML Subgoal.FOCUS_PARAMS: "(Subgoal.focus -> tactic) ->
   368   @{define_ML Subgoal.FOCUS_PARAMS: "(Subgoal.focus -> tactic) ->
   369   Proof.context -> int -> tactic"} \\
   369   Proof.context -> int -> tactic"} \\
   370   @{index_ML Subgoal.focus: "Proof.context -> int -> binding list option ->
   370   @{define_ML Subgoal.focus: "Proof.context -> int -> binding list option ->
   371   thm -> Subgoal.focus * thm"} \\
   371   thm -> Subgoal.focus * thm"} \\
   372   @{index_ML Subgoal.focus_prems: "Proof.context -> int -> binding list option ->
   372   @{define_ML Subgoal.focus_prems: "Proof.context -> int -> binding list option ->
   373   thm -> Subgoal.focus * thm"} \\
   373   thm -> Subgoal.focus * thm"} \\
   374   @{index_ML Subgoal.focus_params: "Proof.context -> int -> binding list option ->
   374   @{define_ML Subgoal.focus_params: "Proof.context -> int -> binding list option ->
   375   thm -> Subgoal.focus * thm"} \\
   375   thm -> Subgoal.focus * thm"} \\
   376   \end{mldecls}
   376   \end{mldecls}
   377 
   377 
   378   \begin{mldecls}
   378   \begin{mldecls}
   379   @{index_ML Goal.prove: "Proof.context -> string list -> term list -> term ->
   379   @{define_ML Goal.prove: "Proof.context -> string list -> term list -> term ->
   380   ({prems: thm list, context: Proof.context} -> tactic) -> thm"} \\
   380   ({prems: thm list, context: Proof.context} -> tactic) -> thm"} \\
   381   @{index_ML Goal.prove_common: "Proof.context -> int option ->
   381   @{define_ML Goal.prove_common: "Proof.context -> int option ->
   382   string list -> term list -> term list ->
   382   string list -> term list -> term list ->
   383   ({prems: thm list, context: Proof.context} -> tactic) -> thm list"} \\
   383   ({prems: thm list, context: Proof.context} -> tactic) -> thm list"} \\
   384   \end{mldecls}
   384   \end{mldecls}
   385   \begin{mldecls}
   385   \begin{mldecls}
   386   @{index_ML Obtain.result: "(Proof.context -> tactic) -> thm list ->
   386   @{define_ML Obtain.result: "(Proof.context -> tactic) -> thm list ->
   387   Proof.context -> ((string * cterm) list * thm list) * Proof.context"} \\
   387   Proof.context -> ((string * cterm) list * thm list) * Proof.context"} \\
   388   \end{mldecls}
   388   \end{mldecls}
   389 
   389 
   390   \<^descr> \<^ML>\<open>SUBPROOF\<close>~\<open>tac ctxt i\<close> decomposes the structure of the specified
   390   \<^descr> \<^ML>\<open>SUBPROOF\<close>~\<open>tac ctxt i\<close> decomposes the structure of the specified
   391   sub-goal, producing an extended context and a reduced goal, which needs to
   391   sub-goal, producing an extended context and a reduced goal, which needs to