src/Doc/IsarImplementation/Logic.thy
changeset 52407 e4662afb3483
parent 52406 1e57c3c4e05c
child 52408 fa2dc6c6c94f
equal deleted inserted replaced
52406:1e57c3c4e05c 52407:e4662afb3483
   521   \infer[@{text "(axiom)"}]{@{text "\<turnstile> A"}}{@{text "A \<in> \<Theta>"}}
   521   \infer[@{text "(axiom)"}]{@{text "\<turnstile> A"}}{@{text "A \<in> \<Theta>"}}
   522   \qquad
   522   \qquad
   523   \infer[@{text "(assume)"}]{@{text "A \<turnstile> A"}}{}
   523   \infer[@{text "(assume)"}]{@{text "A \<turnstile> A"}}{}
   524   \]
   524   \]
   525   \[
   525   \[
   526   \infer[@{text "(\<And>\<hyphen>intro)"}]{@{text "\<Gamma> \<turnstile> \<And>x. b[x]"}}{@{text "\<Gamma> \<turnstile> b[x]"} & @{text "x \<notin> \<Gamma>"}}
   526   \infer[@{text "(\<And>\<hyphen>intro)"}]{@{text "\<Gamma> \<turnstile> \<And>x. B[x]"}}{@{text "\<Gamma> \<turnstile> B[x]"} & @{text "x \<notin> \<Gamma>"}}
   527   \qquad
   527   \qquad
   528   \infer[@{text "(\<And>\<hyphen>elim)"}]{@{text "\<Gamma> \<turnstile> b[a]"}}{@{text "\<Gamma> \<turnstile> \<And>x. b[x]"}}
   528   \infer[@{text "(\<And>\<hyphen>elim)"}]{@{text "\<Gamma> \<turnstile> B[a]"}}{@{text "\<Gamma> \<turnstile> \<And>x. B[x]"}}
   529   \]
   529   \]
   530   \[
   530   \[
   531   \infer[@{text "(\<Longrightarrow>\<hyphen>intro)"}]{@{text "\<Gamma> - A \<turnstile> A \<Longrightarrow> B"}}{@{text "\<Gamma> \<turnstile> B"}}
   531   \infer[@{text "(\<Longrightarrow>\<hyphen>intro)"}]{@{text "\<Gamma> - A \<turnstile> A \<Longrightarrow> B"}}{@{text "\<Gamma> \<turnstile> B"}}
   532   \qquad
   532   \qquad
   533   \infer[@{text "(\<Longrightarrow>\<hyphen>elim)"}]{@{text "\<Gamma>\<^sub>1 \<union> \<Gamma>\<^sub>2 \<turnstile> B"}}{@{text "\<Gamma>\<^sub>1 \<turnstile> A \<Longrightarrow> B"} & @{text "\<Gamma>\<^sub>2 \<turnstile> A"}}
   533   \infer[@{text "(\<Longrightarrow>\<hyphen>elim)"}]{@{text "\<Gamma>\<^sub>1 \<union> \<Gamma>\<^sub>2 \<turnstile> B"}}{@{text "\<Gamma>\<^sub>1 \<turnstile> A \<Longrightarrow> B"} & @{text "\<Gamma>\<^sub>2 \<turnstile> A"}}
  1208   source language.
  1208   source language.
  1209 
  1209 
  1210   \end{description}
  1210   \end{description}
  1211 *}
  1211 *}
  1212 
  1212 
       
  1213 
       
  1214 section {* Proof terms \label{sec:proof-terms} *}
       
  1215 
       
  1216 text {* The Isabelle/Pure inference kernel can record the proof of
       
  1217   each theorem as a proof term that contains all logical inferences in
       
  1218   detail.  Rule composition by resolution (\secref{sec:obj-rules}) and
       
  1219   type-class reasoning is broken down to primitive rules of the
       
  1220   logical framework.  The proof term can be inspected by a separate
       
  1221   proof-checker, for example.
       
  1222 
       
  1223   According to the well-known \emph{Curry-Howard isomorphism}, a proof
       
  1224   can be viewed as a @{text "\<lambda>"}-term. Following this idea, proofs in
       
  1225   Isabelle are internally represented by a datatype similar to the one
       
  1226   for terms described in \secref{sec:terms}.  On top of these
       
  1227   syntactic terms, two more layers of @{text "\<lambda>"}-calculus are added,
       
  1228   which correspond to @{text "\<And>x :: \<alpha>. B x"} and @{text "A \<Longrightarrow> B"}
       
  1229   according to the propositions-as-types principle.  The resulting
       
  1230   3-level @{text "\<lambda>"}-calculus resembles ``@{text "\<lambda>HOL"}'' in the
       
  1231   more abstract setting of Pure Type Systems (PTS)
       
  1232   \cite{Barendregt-Geuvers:2001}, if some fine points like schematic
       
  1233   polymorphism and type classes are ignored.
       
  1234 
       
  1235   \medskip\emph{Proof abstractions} of the form @{text "\<^bold>\<lambda>x :: \<alpha>. prf"}
       
  1236   or @{text "\<^bold>\<lambda>p : A. prf"} correspond to introduction of @{text
       
  1237   "\<And>"}/@{text "\<Longrightarrow>"}, and \emph{proof applications} of the form @{text
       
  1238   "p \<cdot> t"} or @{text "p \<bullet> q"} correspond to elimination of @{text
       
  1239   "\<And>"}/@{text "\<Longrightarrow>"}.  Actual types @{text "\<alpha>"}, propositions @{text
       
  1240   "A"}, and terms @{text "t"} might be suppressed and reconstructed
       
  1241   from the overall proof term.
       
  1242 
       
  1243   \medskip Various atomic proofs indicate special situations within
       
  1244   the proof construction as follows.
       
  1245 
       
  1246   A \emph{bound proof variable} is a natural number @{text "b"} that
       
  1247   acts as de-Bruijn index for proof term abstractions.
       
  1248 
       
  1249   A \emph{minimal proof} ``@{text "?"}'' is a dummy proof term.  This
       
  1250   indicates some unrecorded part of the proof.
       
  1251 
       
  1252   @{text "Hyp A"} refers to some pending hypothesis by giving its
       
  1253   proposition.  This indicates an open context of implicit hypotheses,
       
  1254   similar to loose bound variables or free variables within a term
       
  1255   (\secref{sec:terms}).
       
  1256 
       
  1257   An \emph{axiom} or \emph{oracle} @{text "a : A[\<^vec>\<tau>]"} refers
       
  1258   some postulated @{text "proof constant"}, which is subject to
       
  1259   schematic polymorphism of theory content, and the particular type
       
  1260   instantiation may be given explicitly.  The vector of types @{text
       
  1261   "\<^vec>\<tau>"} refers to the schematic type variables in the generic
       
  1262   proposition @{text "A"} in canonical order.
       
  1263 
       
  1264   A \emph{proof promise} @{text "a : A[\<^vec>\<tau>]"} is a placeholder
       
  1265   for some proof of polymorphic proposition @{text "A"}, with explicit
       
  1266   type instantiation as given by the vector @{text "\<^vec>\<tau>"}, as
       
  1267   above.  Unlike axioms or oracles, proof promises may be
       
  1268   \emph{fulfilled} eventually, by substituting @{text "a"} by some
       
  1269   particular proof @{text "q"} at the corresponding type instance.
       
  1270   This acts like Hindley-Milner @{text "let"}-polymorphism: a generic
       
  1271   local proof definition may get used at different type instances, and
       
  1272   is replaced by the concrete instance eventually.
       
  1273 
       
  1274   A \emph{named theorem} wraps up some concrete proof as a closed
       
  1275   formal entity, in the manner of constant definitions for proof
       
  1276   terms.  The \emph{proof body} of such boxed theorems involves some
       
  1277   digest about oracles and promises occurring in the original proof.
       
  1278   This allows the inference kernel to manage this critical information
       
  1279   without the full overhead of explicit proof terms.
       
  1280 *}
       
  1281 
  1213 end
  1282 end