doc-src/IsarRef/Thy/Proof.thy
changeset 42626 6ac8c55c657e
parent 42617 77d239840285
child 42651 e3fdb7c96be5
equal deleted inserted replaced
42625:79e1e99e0a2a 42626:6ac8c55c657e
   337 
   337 
   338   \item @{command "then"} indicates forward chaining by the current
   338   \item @{command "then"} indicates forward chaining by the current
   339   facts in order to establish the goal to be claimed next.  The
   339   facts in order to establish the goal to be claimed next.  The
   340   initial proof method invoked to refine that will be offered the
   340   initial proof method invoked to refine that will be offered the
   341   facts to do ``anything appropriate'' (see also
   341   facts to do ``anything appropriate'' (see also
   342   \secref{sec:proof-steps}).  For example, method @{method_ref rule}
   342   \secref{sec:proof-steps}).  For example, method @{method (Pure) rule}
   343   (see \secref{sec:pure-meth-att}) would typically do an elimination
   343   (see \secref{sec:pure-meth-att}) would typically do an elimination
   344   rather than an introduction.  Automatic methods usually insert the
   344   rather than an introduction.  Automatic methods usually insert the
   345   facts into the goal state before operation.  This provides a simple
   345   facts into the goal state before operation.  This provides a simple
   346   scheme to control relevance of facts in automated proof search.
   346   scheme to control relevance of facts in automated proof search.
   347   
   347   
   366   Forward chaining with an empty list of theorems is the same as not
   366   Forward chaining with an empty list of theorems is the same as not
   367   chaining at all.  Thus ``@{command "from"}~@{text nothing}'' has no
   367   chaining at all.  Thus ``@{command "from"}~@{text nothing}'' has no
   368   effect apart from entering @{text "prove(chain)"} mode, since
   368   effect apart from entering @{text "prove(chain)"} mode, since
   369   @{fact_ref nothing} is bound to the empty list of theorems.
   369   @{fact_ref nothing} is bound to the empty list of theorems.
   370 
   370 
   371   Basic proof methods (such as @{method_ref rule}) expect multiple
   371   Basic proof methods (such as @{method_ref (Pure) rule}) expect multiple
   372   facts to be given in their proper order, corresponding to a prefix
   372   facts to be given in their proper order, corresponding to a prefix
   373   of the premises of the rule involved.  Note that positions may be
   373   of the premises of the rule involved.  Note that positions may be
   374   easily skipped using something like @{command "from"}~@{text "_
   374   easily skipped using something like @{command "from"}~@{text "_
   375   \<AND> a \<AND> b"}, for example.  This involves the trivial rule
   375   \<AND> a \<AND> b"}, for example.  This involves the trivial rule
   376   @{text "PROP \<psi> \<Longrightarrow> PROP \<psi>"}, which is bound in Isabelle/Pure as
   376   @{text "PROP \<psi> \<Longrightarrow> PROP \<psi>"}, which is bound in Isabelle/Pure as
   616   automatic proof tools that are prone leave a large number of badly
   616   automatic proof tools that are prone leave a large number of badly
   617   structured sub-goals are no help in continuing the proof document in
   617   structured sub-goals are no help in continuing the proof document in
   618   an intelligible manner.
   618   an intelligible manner.
   619 
   619 
   620   Unless given explicitly by the user, the default initial method is
   620   Unless given explicitly by the user, the default initial method is
   621   ``@{method_ref rule}'', which applies a single standard elimination
   621   @{method_ref (Pure) rule} (or its classical variant @{method_ref
   622   or introduction rule according to the topmost symbol involved.
   622   rule}), which applies a single standard elimination or introduction
   623   There is no separate default terminal method.  Any remaining goals
   623   rule according to the topmost symbol involved.  There is no separate
   624   are always solved by assumption in the very last step.
   624   default terminal method.  Any remaining goals are always solved by
       
   625   assumption in the very last step.
   625 
   626 
   626   @{rail "
   627   @{rail "
   627     @@{command proof} method?
   628     @@{command proof} method?
   628     ;
   629     ;
   629     @@{command qed} method?
   630     @@{command qed} method?
   695   \begin{matharray}{rcl}
   696   \begin{matharray}{rcl}
   696     @{method_def "-"} & : & @{text method} \\
   697     @{method_def "-"} & : & @{text method} \\
   697     @{method_def "fact"} & : & @{text method} \\
   698     @{method_def "fact"} & : & @{text method} \\
   698     @{method_def "assumption"} & : & @{text method} \\
   699     @{method_def "assumption"} & : & @{text method} \\
   699     @{method_def "this"} & : & @{text method} \\
   700     @{method_def "this"} & : & @{text method} \\
   700     @{method_def "rule"} & : & @{text method} \\
   701     @{method_def (Pure) "rule"} & : & @{text method} \\
   701     @{attribute_def (Pure) "intro"} & : & @{text attribute} \\
   702     @{attribute_def (Pure) "intro"} & : & @{text attribute} \\
   702     @{attribute_def (Pure) "elim"} & : & @{text attribute} \\
   703     @{attribute_def (Pure) "elim"} & : & @{text attribute} \\
   703     @{attribute_def (Pure) "dest"} & : & @{text attribute} \\
   704     @{attribute_def (Pure) "dest"} & : & @{text attribute} \\
   704     @{attribute_def "rule"} & : & @{text attribute} \\[0.5ex]
   705     @{attribute_def (Pure) "rule"} & : & @{text attribute} \\[0.5ex]
   705     @{attribute_def "OF"} & : & @{text attribute} \\
   706     @{attribute_def "OF"} & : & @{text attribute} \\
   706     @{attribute_def "of"} & : & @{text attribute} \\
   707     @{attribute_def "of"} & : & @{text attribute} \\
   707     @{attribute_def "where"} & : & @{text attribute} \\
   708     @{attribute_def "where"} & : & @{text attribute} \\
   708   \end{matharray}
   709   \end{matharray}
   709 
   710 
   710   @{rail "
   711   @{rail "
   711     @@{method fact} @{syntax thmrefs}?
   712     @@{method fact} @{syntax thmrefs}?
   712     ;
   713     ;
   713     @@{method rule} @{syntax thmrefs}?
   714     @@{method (Pure) rule} @{syntax thmrefs}?
   714     ;
   715     ;
   715     rulemod: ('intro' | 'elim' | 'dest')
   716     rulemod: ('intro' | 'elim' | 'dest')
   716       ((('!' | () | '?') @{syntax nat}?) | 'del') ':' @{syntax thmrefs}
   717       ((('!' | () | '?') @{syntax nat}?) | 'del') ':' @{syntax thmrefs}
   717     ;
   718     ;
   718     (@@{attribute intro} | @@{attribute elim} | @@{attribute dest})
   719     (@@{attribute intro} | @@{attribute elim} | @@{attribute dest})
   719       ('!' | () | '?') @{syntax nat}?
   720       ('!' | () | '?') @{syntax nat}?
   720     ;
   721     ;
   721     @@{attribute rule} 'del'
   722     @@{attribute (Pure) rule} 'del'
   722     ;
   723     ;
   723     @@{attribute OF} @{syntax thmrefs}
   724     @@{attribute OF} @{syntax thmrefs}
   724     ;
   725     ;
   725     @@{attribute of} @{syntax insts} ('concl' ':' @{syntax insts})?
   726     @@{attribute of} @{syntax insts} ('concl' ':' @{syntax insts})?
   726     ;
   727     ;
   732   \begin{description}
   733   \begin{description}
   733   
   734   
   734   \item ``@{method "-"}'' (minus) does nothing but insert the forward
   735   \item ``@{method "-"}'' (minus) does nothing but insert the forward
   735   chaining facts as premises into the goal.  Note that command
   736   chaining facts as premises into the goal.  Note that command
   736   @{command_ref "proof"} without any method actually performs a single
   737   @{command_ref "proof"} without any method actually performs a single
   737   reduction step using the @{method_ref rule} method; thus a plain
   738   reduction step using the @{method_ref (Pure) rule} method; thus a plain
   738   \emph{do-nothing} proof step would be ``@{command "proof"}~@{text
   739   \emph{do-nothing} proof step would be ``@{command "proof"}~@{text
   739   "-"}'' rather than @{command "proof"} alone.
   740   "-"}'' rather than @{command "proof"} alone.
   740   
   741   
   741   \item @{method "fact"}~@{text "a\<^sub>1 \<dots> a\<^sub>n"} composes some fact from
   742   \item @{method "fact"}~@{text "a\<^sub>1 \<dots> a\<^sub>n"} composes some fact from
   742   @{text "a\<^sub>1, \<dots>, a\<^sub>n"} (or implicitly from the current proof context)
   743   @{text "a\<^sub>1, \<dots>, a\<^sub>n"} (or implicitly from the current proof context)
   759   
   760   
   760   \item @{method this} applies all of the current facts directly as
   761   \item @{method this} applies all of the current facts directly as
   761   rules.  Recall that ``@{command "."}'' (dot) abbreviates ``@{command
   762   rules.  Recall that ``@{command "."}'' (dot) abbreviates ``@{command
   762   "by"}~@{text this}''.
   763   "by"}~@{text this}''.
   763   
   764   
   764   \item @{method rule}~@{text "a\<^sub>1 \<dots> a\<^sub>n"} applies some rule given as
   765   \item @{method (Pure) rule}~@{text "a\<^sub>1 \<dots> a\<^sub>n"} applies some rule given as
   765   argument in backward manner; facts are used to reduce the rule
   766   argument in backward manner; facts are used to reduce the rule
   766   before applying it to the goal.  Thus @{method rule} without facts
   767   before applying it to the goal.  Thus @{method (Pure) rule} without facts
   767   is plain introduction, while with facts it becomes elimination.
   768   is plain introduction, while with facts it becomes elimination.
   768   
   769   
   769   When no arguments are given, the @{method rule} method tries to pick
   770   When no arguments are given, the @{method (Pure) rule} method tries to pick
   770   appropriate rules automatically, as declared in the current context
   771   appropriate rules automatically, as declared in the current context
   771   using the @{attribute (Pure) intro}, @{attribute (Pure) elim},
   772   using the @{attribute (Pure) intro}, @{attribute (Pure) elim},
   772   @{attribute (Pure) dest} attributes (see below).  This is the
   773   @{attribute (Pure) dest} attributes (see below).  This is the
   773   default behavior of @{command "proof"} and ``@{command ".."}'' 
   774   default behavior of @{command "proof"} and ``@{command ".."}'' 
   774   (double-dot) steps (see \secref{sec:proof-steps}).
   775   (double-dot) steps (see \secref{sec:proof-steps}).
   775   
   776   
   776   \item @{attribute (Pure) intro}, @{attribute (Pure) elim}, and
   777   \item @{attribute (Pure) intro}, @{attribute (Pure) elim}, and
   777   @{attribute (Pure) dest} declare introduction, elimination, and
   778   @{attribute (Pure) dest} declare introduction, elimination, and
   778   destruct rules, to be used with method @{method rule}, and similar
   779   destruct rules, to be used with method @{method (Pure) rule}, and similar
   779   tools.  Note that the latter will ignore rules declared with
   780   tools.  Note that the latter will ignore rules declared with
   780   ``@{text "?"}'', while ``@{text "!"}''  are used most aggressively.
   781   ``@{text "?"}'', while ``@{text "!"}''  are used most aggressively.
   781   
   782   
   782   The classical reasoner (see \secref{sec:classical}) introduces its
   783   The classical reasoner (see \secref{sec:classical}) introduces its
   783   own variants of these attributes; use qualified names to access the
   784   own variants of these attributes; use qualified names to access the
   784   present versions of Isabelle/Pure, i.e.\ @{attribute (Pure)
   785   present versions of Isabelle/Pure, i.e.\ @{attribute (Pure)
   785   "Pure.intro"}.
   786   "Pure.intro"}.
   786   
   787   
   787   \item @{attribute rule}~@{text del} undeclares introduction,
   788   \item @{attribute (Pure) rule}~@{text del} undeclares introduction,
   788   elimination, or destruct rules.
   789   elimination, or destruct rules.
   789   
   790   
   790   \item @{attribute OF}~@{text "a\<^sub>1 \<dots> a\<^sub>n"} applies some
   791   \item @{attribute OF}~@{text "a\<^sub>1 \<dots> a\<^sub>n"} applies some
   791   theorem to all of the given rules @{text "a\<^sub>1, \<dots>, a\<^sub>n"}
   792   theorem to all of the given rules @{text "a\<^sub>1, \<dots>, a\<^sub>n"}
   792   (in parallel).  This corresponds to the @{ML "op MRS"} operation in
   793   (in parallel).  This corresponds to the @{ML "op MRS"} operation in