doc-src/IsarImplementation/Thy/document/logic.tex
changeset 20520 05fd007bdeb9
parent 20519 d7ad1217c24a
child 20521 189811b39869
equal deleted inserted replaced
20519:d7ad1217c24a 20520:05fd007bdeb9
   130   \indexmltype{typ}\verb|type typ| \\
   130   \indexmltype{typ}\verb|type typ| \\
   131   \indexml{map-atyps}\verb|map_atyps: (typ -> typ) -> typ -> typ| \\
   131   \indexml{map-atyps}\verb|map_atyps: (typ -> typ) -> typ -> typ| \\
   132   \indexml{fold-atyps}\verb|fold_atyps: (typ -> 'a -> 'a) -> typ -> 'a -> 'a| \\
   132   \indexml{fold-atyps}\verb|fold_atyps: (typ -> 'a -> 'a) -> typ -> 'a -> 'a| \\
   133   \indexml{Sign.subsort}\verb|Sign.subsort: theory -> sort * sort -> bool| \\
   133   \indexml{Sign.subsort}\verb|Sign.subsort: theory -> sort * sort -> bool| \\
   134   \indexml{Sign.of-sort}\verb|Sign.of_sort: theory -> typ * sort -> bool| \\
   134   \indexml{Sign.of-sort}\verb|Sign.of_sort: theory -> typ * sort -> bool| \\
   135   \indexml{Sign.add-types}\verb|Sign.add_types: (bstring * int * mixfix) list -> theory -> theory| \\
   135   \indexml{Sign.add-types}\verb|Sign.add_types: (string * int * mixfix) list -> theory -> theory| \\
   136   \indexml{Sign.add-tyabbrs-i}\verb|Sign.add_tyabbrs_i: |\isasep\isanewline%
   136   \indexml{Sign.add-tyabbrs-i}\verb|Sign.add_tyabbrs_i: |\isasep\isanewline%
   137 \verb|  (bstring * string list * typ * mixfix) list -> theory -> theory| \\
   137 \verb|  (string * string list * typ * mixfix) list -> theory -> theory| \\
   138   \indexml{Sign.primitive-class}\verb|Sign.primitive_class: string * class list -> theory -> theory| \\
   138   \indexml{Sign.primitive-class}\verb|Sign.primitive_class: string * class list -> theory -> theory| \\
   139   \indexml{Sign.primitive-classrel}\verb|Sign.primitive_classrel: class * class -> theory -> theory| \\
   139   \indexml{Sign.primitive-classrel}\verb|Sign.primitive_classrel: class * class -> theory -> theory| \\
   140   \indexml{Sign.primitive-arity}\verb|Sign.primitive_arity: arity -> theory -> theory| \\
   140   \indexml{Sign.primitive-arity}\verb|Sign.primitive_arity: arity -> theory -> theory| \\
   141   \end{mldecls}
   141   \end{mldecls}
   142 
   142 
   199 %
   199 %
   200 \begin{isamarkuptext}%
   200 \begin{isamarkuptext}%
   201 \glossary{Term}{FIXME}
   201 \glossary{Term}{FIXME}
   202 
   202 
   203   The language of terms is that of simply-typed \isa{{\isasymlambda}}-calculus
   203   The language of terms is that of simply-typed \isa{{\isasymlambda}}-calculus
   204   with de-Bruijn indices for bound variables
   204   with de-Bruijn indices for bound variables (cf.\ \cite{debruijn72}
   205   \cite{debruijn72,paulson-ml2}, and named free variables and
   205   or \cite{paulson-ml2}), and named free variables and constants.
   206   constants.  Terms with loose bound variables are usually considered
   206   Terms with loose bound variables are usually considered malformed.
   207   malformed.  The types of variables and constants is stored
   207   The types of variables and constants is stored explicitly at each
   208   explicitly at each occurrence in the term.
   208   occurrence in the term.
   209 
   209 
   210   \medskip A \emph{bound variable} is a natural number \isa{b},
   210   \medskip A \emph{bound variable} is a natural number \isa{b},
   211   which refers to the next binder that is \isa{b} steps upwards
   211   which refers to the next binder that is \isa{b} steps upwards
   212   from the occurrence of \isa{b} (counting from zero).  Bindings
   212   from the occurrence of \isa{b} (counting from zero).  Bindings
   213   may be introduced as abstractions within the term, or as a separate
   213   may be introduced as abstractions within the term, or as a separate
   317   \indexml{map-aterms}\verb|map_aterms: (term -> term) -> term -> term| \\
   317   \indexml{map-aterms}\verb|map_aterms: (term -> term) -> term -> term| \\
   318   \indexml{fold-aterms}\verb|fold_aterms: (term -> 'a -> 'a) -> term -> 'a -> 'a| \\
   318   \indexml{fold-aterms}\verb|fold_aterms: (term -> 'a -> 'a) -> term -> 'a -> 'a| \\
   319   \indexml{fastype-of}\verb|fastype_of: term -> typ| \\
   319   \indexml{fastype-of}\verb|fastype_of: term -> typ| \\
   320   \indexml{lambda}\verb|lambda: term -> term -> term| \\
   320   \indexml{lambda}\verb|lambda: term -> term -> term| \\
   321   \indexml{betapply}\verb|betapply: term * term -> term| \\
   321   \indexml{betapply}\verb|betapply: term * term -> term| \\
   322   \indexml{Sign.add-consts-i}\verb|Sign.add_consts_i: (bstring * typ * mixfix) list -> theory -> theory| \\
   322   \indexml{Sign.add-consts-i}\verb|Sign.add_consts_i: (string * typ * mixfix) list -> theory -> theory| \\
   323   \indexml{Sign.add-abbrevs}\verb|Sign.add_abbrevs: string * bool ->|\isasep\isanewline%
   323   \indexml{Sign.add-abbrevs}\verb|Sign.add_abbrevs: string * bool ->|\isasep\isanewline%
   324 \verb|  ((bstring * mixfix) * term) list -> theory -> theory| \\
   324 \verb|  ((string * mixfix) * term) list -> theory -> theory| \\
   325   \indexml{Sign.const-typargs}\verb|Sign.const_typargs: theory -> string * typ -> typ list| \\
   325   \indexml{Sign.const-typargs}\verb|Sign.const_typargs: theory -> string * typ -> typ list| \\
   326   \indexml{Sign.const-instance}\verb|Sign.const_instance: theory -> string * typ list -> typ| \\
   326   \indexml{Sign.const-instance}\verb|Sign.const_instance: theory -> string * typ list -> typ| \\
   327   \end{mldecls}
   327   \end{mldecls}
   328 
   328 
   329   \begin{description}
   329   \begin{description}
   354 
   354 
   355   \item \verb|fastype_of|~\isa{t} recomputes the type of a
   355   \item \verb|fastype_of|~\isa{t} recomputes the type of a
   356   well-formed term, while omitting any sanity checks.  This operation
   356   well-formed term, while omitting any sanity checks.  This operation
   357   is relatively slow.
   357   is relatively slow.
   358 
   358 
   359   \item \verb|lambda|~\isa{a\ b} produces an abstraction \isa{{\isasymlambda}a{\isachardot}\ b}, where occurrences of the original (atomic) term \isa{a} are replaced by bound variables.
   359   \item \verb|lambda|~\isa{a\ b} produces an abstraction \isa{{\isasymlambda}a{\isachardot}\ b}, where occurrences of the original (atomic) term \isa{a} in the body \isa{b} are replaced by bound variables.
   360 
   360 
   361   \item \verb|betapply|~\isa{t\ u} produces an application \isa{t\ u}, with topmost \isa{{\isasymbeta}}-conversion \isa{t} is an
   361   \item \verb|betapply|~\isa{t\ u} produces an application \isa{t\ u}, with topmost \isa{{\isasymbeta}}-conversion if \isa{t} happens to
   362   abstraction.
   362   be an abstraction.
   363 
   363 
   364   \item \verb|Sign.add_consts_i|~\isa{{\isacharbrackleft}{\isacharparenleft}c{\isacharcomma}\ {\isasymsigma}{\isacharcomma}\ mx{\isacharparenright}{\isacharcomma}\ {\isasymdots}{\isacharbrackright}} declares a
   364   \item \verb|Sign.add_consts_i|~\isa{{\isacharbrackleft}{\isacharparenleft}c{\isacharcomma}\ {\isasymsigma}{\isacharcomma}\ mx{\isacharparenright}{\isacharcomma}\ {\isasymdots}{\isacharbrackright}} declares a
   365   new constant \isa{c\ {\isacharcolon}{\isacharcolon}\ {\isasymsigma}} with optional mixfix syntax.
   365   new constant \isa{c\ {\isacharcolon}{\isacharcolon}\ {\isasymsigma}} with optional mixfix syntax.
   366 
   366 
   367   \item \verb|Sign.add_abbrevs|~\isa{print{\isacharunderscore}mode\ {\isacharbrackleft}{\isacharparenleft}{\isacharparenleft}c{\isacharcomma}\ t{\isacharparenright}{\isacharcomma}\ mx{\isacharparenright}{\isacharcomma}\ {\isasymdots}{\isacharbrackright}}
   367   \item \verb|Sign.add_abbrevs|~\isa{print{\isacharunderscore}mode\ {\isacharbrackleft}{\isacharparenleft}{\isacharparenleft}c{\isacharcomma}\ t{\isacharparenright}{\isacharcomma}\ mx{\isacharparenright}{\isacharcomma}\ {\isasymdots}{\isacharbrackright}}
   368   declares a new term abbreviation \isa{c\ {\isasymequiv}\ t} with optional
   368   declares a new term abbreviation \isa{c\ {\isasymequiv}\ t} with optional
   369   mixfix syntax.
   369   mixfix syntax.
   370 
   370 
   371   \item \verb|Sign.const_typargs|~\isa{thy\ {\isacharparenleft}c{\isacharcomma}\ {\isasymtau}{\isacharparenright}} produces the
   371   \item \verb|Sign.const_typargs|~\isa{thy\ {\isacharparenleft}c{\isacharcomma}\ {\isasymtau}{\isacharparenright}} and \verb|Sign.const_instance|~\isa{thy\ {\isacharparenleft}c{\isacharcomma}\ {\isacharbrackleft}{\isasymtau}\isactrlisub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymtau}\isactrlisub n{\isacharbrackright}{\isacharparenright}}
   372   type arguments of the instance \isa{c\isactrlisub {\isasymtau}} wrt.\ its
   372   convert between the two representations of constants, namely full
   373   declaration in the theory.
   373   type instance vs.\ compact type arguments form (depending on the
   374 
   374   most general declaration given in the context).
   375   \item \verb|Sign.const_instance|~\isa{thy\ {\isacharparenleft}c{\isacharcomma}\ {\isacharbrackleft}{\isasymtau}\isactrlisub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymtau}\isactrlisub n{\isacharbrackright}{\isacharparenright}} produces the full instance \isa{c{\isacharparenleft}{\isasymtau}\isactrlisub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymtau}\isactrlisub n{\isacharparenright}} wrt.\ its declaration in the theory.
       
   376 
   375 
   377   \end{description}%
   376   \end{description}%
   378 \end{isamarkuptext}%
   377 \end{isamarkuptext}%
   379 \isamarkuptrue%
   378 \isamarkuptrue%
   380 %
   379 %
   479   ``LCF-approach'', although they could be exploited separately
   478   ``LCF-approach'', although they could be exploited separately
   480   \cite{Berghofer-Nipkow:2000}.  The implementation provides a runtime
   479   \cite{Berghofer-Nipkow:2000}.  The implementation provides a runtime
   481   option to control the generation of full proof terms.
   480   option to control the generation of full proof terms.
   482 
   481 
   483   \medskip The axiomatization of a theory is implicitly closed by
   482   \medskip The axiomatization of a theory is implicitly closed by
   484   forming all instances of type and term variables: \isa{{\isasymturnstile}\ A{\isasymtheta}} for
   483   forming all instances of type and term variables: \isa{{\isasymturnstile}\ A{\isasymvartheta}} for
   485   any substitution instance of axiom \isa{{\isasymturnstile}\ A}.  By pushing
   484   any substitution instance of axiom \isa{{\isasymturnstile}\ A}.  By pushing
   486   substitution through derivations inductively, we get admissible
   485   substitution through derivations inductively, we get admissible
   487   substitution rules for theorems shown in \figref{fig:subst-rules}.
   486   substitution rules for theorems shown in \figref{fig:subst-rules}.
   488 
   487 
   489   \begin{figure}[htb]
   488   \begin{figure}[htb]