doc-src/IsarImplementation/Thy/document/Logic.tex
changeset 46253 3e427a12f0f3
parent 42934 287182c2f23a
child 46254 e18ccb00fb8f
equal deleted inserted replaced
46252:9aad9b87354a 46253:3e427a12f0f3
   702 %
   702 %
   703 \isatagmlref
   703 \isatagmlref
   704 %
   704 %
   705 \begin{isamarkuptext}%
   705 \begin{isamarkuptext}%
   706 \begin{mldecls}
   706 \begin{mldecls}
       
   707   \indexdef{}{ML}{Logic.all}\verb|Logic.all: term -> term -> term| \\
       
   708   \indexdef{}{ML}{Logic.mk\_implies}\verb|Logic.mk_implies: term * term -> term| \\
       
   709   \end{mldecls}
       
   710   \begin{mldecls}
   707   \indexdef{}{ML type}{ctyp}\verb|type ctyp| \\
   711   \indexdef{}{ML type}{ctyp}\verb|type ctyp| \\
   708   \indexdef{}{ML type}{cterm}\verb|type cterm| \\
   712   \indexdef{}{ML type}{cterm}\verb|type cterm| \\
   709   \indexdef{}{ML}{Thm.ctyp\_of}\verb|Thm.ctyp_of: theory -> typ -> ctyp| \\
   713   \indexdef{}{ML}{Thm.ctyp\_of}\verb|Thm.ctyp_of: theory -> typ -> ctyp| \\
   710   \indexdef{}{ML}{Thm.cterm\_of}\verb|Thm.cterm_of: theory -> term -> cterm| \\
   714   \indexdef{}{ML}{Thm.cterm\_of}\verb|Thm.cterm_of: theory -> term -> cterm| \\
       
   715   \indexdef{}{ML}{Thm.capply}\verb|Thm.capply: cterm -> cterm -> cterm| \\
       
   716   \indexdef{}{ML}{Thm.cabs}\verb|Thm.cabs: cterm -> cterm -> cterm| \\
       
   717   \indexdef{}{ML}{Thm.all}\verb|Thm.all: cterm -> cterm -> cterm| \\
       
   718   \indexdef{}{ML}{Drule.mk\_implies}\verb|Drule.mk_implies: cterm * cterm -> cterm| \\
   711   \end{mldecls}
   719   \end{mldecls}
   712   \begin{mldecls}
   720   \begin{mldecls}
   713   \indexdef{}{ML type}{thm}\verb|type thm| \\
   721   \indexdef{}{ML type}{thm}\verb|type thm| \\
   714   \indexdef{}{ML}{proofs}\verb|proofs: int Unsynchronized.ref| \\
   722   \indexdef{}{ML}{proofs}\verb|proofs: int Unsynchronized.ref| \\
   715   \indexdef{}{ML}{Thm.transfer}\verb|Thm.transfer: theory -> thm -> thm| \\
   723   \indexdef{}{ML}{Thm.transfer}\verb|Thm.transfer: theory -> thm -> thm| \\
   732 \verb|  string * typ -> (string * typ) list -> theory -> theory| \\
   740 \verb|  string * typ -> (string * typ) list -> theory -> theory| \\
   733   \end{mldecls}
   741   \end{mldecls}
   734 
   742 
   735   \begin{description}
   743   \begin{description}
   736 
   744 
       
   745   \item \verb|Logic.all|~\isa{a\ B} produces a Pure quantification
       
   746   \isa{{\isaliteral{5C3C416E643E}{\isasymAnd}}a{\isaliteral{2E}{\isachardot}}\ B}, where occurrences of the atomic term \isa{a} in
       
   747   the body proposition \isa{B} are replaced by bound variables.
       
   748   (See also \verb|lambda| on terms.)
       
   749 
       
   750   \item \verb|Logic.mk_implies|~\isa{{\isaliteral{28}{\isacharparenleft}}A{\isaliteral{2C}{\isacharcomma}}\ B{\isaliteral{29}{\isacharparenright}}} produces a Pure
       
   751   implication \isa{A\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B}.
       
   752 
   737   \item Types \verb|ctyp| and \verb|cterm| represent certified
   753   \item Types \verb|ctyp| and \verb|cterm| represent certified
   738   types and terms, respectively.  These are abstract datatypes that
   754   types and terms, respectively.  These are abstract datatypes that
   739   guarantee that its values have passed the full well-formedness (and
   755   guarantee that its values have passed the full well-formedness (and
   740   well-typedness) checks, relative to the declarations of type
   756   well-typedness) checks, relative to the declarations of type
   741   constructors, constants etc. in the theory.
   757   constructors, constants etc.\ in the background theory.  The
       
   758   abstract types \verb|ctyp| and \verb|cterm| are part of the
       
   759   same inference kernel that is mainly responsible for \verb|thm|.
       
   760   Thus syntactic operations on \verb|ctyp| and \verb|cterm|
       
   761   are located in the \verb|Thm| module, even though theorems are
       
   762   not yet involved at that stage.
   742 
   763 
   743   \item \verb|Thm.ctyp_of|~\isa{thy\ {\isaliteral{5C3C7461753E}{\isasymtau}}} and \verb|Thm.cterm_of|~\isa{thy\ t} explicitly checks types and terms,
   764   \item \verb|Thm.ctyp_of|~\isa{thy\ {\isaliteral{5C3C7461753E}{\isasymtau}}} and \verb|Thm.cterm_of|~\isa{thy\ t} explicitly checks types and terms,
   744   respectively.  This also involves some basic normalizations, such
   765   respectively.  This also involves some basic normalizations, such
   745   expansion of type and term abbreviations from the theory context.
   766   expansion of type and term abbreviations from the theory context.
   746 
   767   Full re-certification is relatively slow and should be avoided in
   747   Re-certification is relatively slow and should be avoided in tight
   768   tight reasoning loops.
   748   reasoning loops.  There are separate operations to decompose
   769 
   749   certified entities (including actual theorems).
   770   \item \verb|Thm.capply|, \verb|Thm.cabs|, \verb|Thm.all|, \verb|Drule.mk_implies| etc.\ compose certified terms (or propositions)
       
   771   incrementally.  This is equivalent to \verb|Thm.cterm_of| after
       
   772   unchecked \verb|op $|, \verb|lambda|, \verb|Logic.all|, \verb|Logic.mk_implies| etc., but there can be a big difference in
       
   773   performance when large existing entities are composed by a few extra
       
   774   constructions on top.  There are separate operations to decompose
       
   775   certified terms and theorems to produce certified terms again.
   750 
   776 
   751   \item Type \verb|thm| represents proven propositions.  This is
   777   \item Type \verb|thm| represents proven propositions.  This is
   752   an abstract datatype that guarantees that its values have been
   778   an abstract datatype that guarantees that its values have been
   753   constructed by basic principles of the \verb|Thm| module.
   779   constructed by basic principles of the \verb|Thm| module.
   754   Every \verb|thm| value contains a sliding back-reference to the
   780   Every \verb|thm| value contains a sliding back-reference to the