doc-src/IsarRef/Thy/document/HOL_Specific.tex
changeset 31913 edce86bf8521
parent 31254 03a35fbc9dc6
child 31998 2c7a24f74db9
equal deleted inserted replaced
31912:f5bd306f5e9d 31913:edce86bf8521
    96 \begin{matharray}{rcl}
    96 \begin{matharray}{rcl}
    97     \hyperlink{attribute.HOL.split-format}{\mbox{\isa{split{\isacharunderscore}format}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{attribute} \\
    97     \hyperlink{attribute.HOL.split-format}{\mbox{\isa{split{\isacharunderscore}format}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{attribute} \\
    98   \end{matharray}
    98   \end{matharray}
    99 
    99 
   100   \begin{rail}
   100   \begin{rail}
   101     'split\_format' (((name *) + 'and') | ('(' 'complete' ')'))
   101     'split\_format' ((( name * ) + 'and') | ('(' 'complete' ')'))
   102     ;
   102     ;
   103   \end{rail}
   103   \end{rail}
   104 
   104 
   105   \begin{description}
   105   \begin{description}
   106   
   106   
   372     'rep\_datatype' ('(' (name +) ')')? (term +)
   372     'rep\_datatype' ('(' (name +) ')')? (term +)
   373     ;
   373     ;
   374 
   374 
   375     dtspec: parname? typespec infix? '=' (cons + '|')
   375     dtspec: parname? typespec infix? '=' (cons + '|')
   376     ;
   376     ;
   377     cons: name (type *) mixfix?
   377     cons: name ( type * ) mixfix?
   378   \end{rail}
   378   \end{rail}
   379 
   379 
   380   \begin{description}
   380   \begin{description}
   381 
   381 
   382   \item \hyperlink{command.HOL.datatype}{\mbox{\isa{\isacommand{datatype}}}} defines inductive datatypes in
   382   \item \hyperlink{command.HOL.datatype}{\mbox{\isa{\isacommand{datatype}}}} defines inductive datatypes in
   518   \end{matharray}
   518   \end{matharray}
   519 
   519 
   520   \begin{rail}
   520   \begin{rail}
   521     'relation' term
   521     'relation' term
   522     ;
   522     ;
   523     'lexicographic\_order' (clasimpmod *)
   523     'lexicographic\_order' ( clasimpmod * )
   524     ;
   524     ;
   525   \end{rail}
   525   \end{rail}
   526 
   526 
   527   \begin{description}
   527   \begin{description}
   528 
   528 
   568   \begin{rail}
   568   \begin{rail}
   569     'recdef' ('(' 'permissive' ')')? \\ name term (prop +) hints?
   569     'recdef' ('(' 'permissive' ')')? \\ name term (prop +) hints?
   570     ;
   570     ;
   571     recdeftc thmdecl? tc
   571     recdeftc thmdecl? tc
   572     ;
   572     ;
   573     hints: '(' 'hints' (recdefmod *) ')'
   573     hints: '(' 'hints' ( recdefmod * ) ')'
   574     ;
   574     ;
   575     recdefmod: (('recdef\_simp' | 'recdef\_cong' | 'recdef\_wf') (() | 'add' | 'del') ':' thmrefs) | clasimpmod
   575     recdefmod: (('recdef\_simp' | 'recdef\_cong' | 'recdef\_wf') (() | 'add' | 'del') ':' thmrefs) | clasimpmod
   576     ;
   576     ;
   577     tc: nameref ('(' nat ')')?
   577     tc: nameref ('(' nat ')')?
   578     ;
   578     ;
   791 \begin{matharray}{rcl}
   791 \begin{matharray}{rcl}
   792     \indexdef{HOL}{method}{iprover}\hypertarget{method.HOL.iprover}{\hyperlink{method.HOL.iprover}{\mbox{\isa{iprover}}}} & : & \isa{method} \\
   792     \indexdef{HOL}{method}{iprover}\hypertarget{method.HOL.iprover}{\hyperlink{method.HOL.iprover}{\mbox{\isa{iprover}}}} & : & \isa{method} \\
   793   \end{matharray}
   793   \end{matharray}
   794 
   794 
   795   \begin{rail}
   795   \begin{rail}
   796     'iprover' ('!' ?) (rulemod *)
   796     'iprover' ('!' ?) ( rulemod * )
   797     ;
   797     ;
   798   \end{rail}
   798   \end{rail}
   799 
   799 
   800   The \hyperlink{method.HOL.iprover}{\mbox{\isa{iprover}}} method performs intuitionistic proof
   800   The \hyperlink{method.HOL.iprover}{\mbox{\isa{iprover}}} method performs intuitionistic proof
   801   search, depending on specifically declared rules from the context,
   801   search, depending on specifically declared rules from the context,
   833   geometry.  See \hyperlink{file.~~/src/HOL/ex/Coherent.thy}{\mbox{\isa{\isatt{{\isachartilde}{\isachartilde}{\isacharslash}src{\isacharslash}HOL{\isacharslash}ex{\isacharslash}Coherent{\isachardot}thy}}}} for some
   833   geometry.  See \hyperlink{file.~~/src/HOL/ex/Coherent.thy}{\mbox{\isa{\isatt{{\isachartilde}{\isachartilde}{\isacharslash}src{\isacharslash}HOL{\isacharslash}ex{\isacharslash}Coherent{\isachardot}thy}}}} for some
   834   examples.%
   834   examples.%
   835 \end{isamarkuptext}%
   835 \end{isamarkuptext}%
   836 \isamarkuptrue%
   836 \isamarkuptrue%
   837 %
   837 %
       
   838 \isamarkupsection{Checking and refuting propositions%
       
   839 }
       
   840 \isamarkuptrue%
       
   841 %
       
   842 \begin{isamarkuptext}%
       
   843 Identifying incorrect propositions usually involves evaluation of
       
   844   particular assignments and systematic counter example search.  This
       
   845   is supported by the following commands.
       
   846 
       
   847   \begin{matharray}{rcl}
       
   848     \indexdef{HOL}{command}{value}\hypertarget{command.HOL.value}{\hyperlink{command.HOL.value}{\mbox{\isa{\isacommand{value}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{{\isachardoublequote}context\ {\isasymrightarrow}{\isachardoublequote}} \\
       
   849     \indexdef{HOL}{command}{quickcheck}\hypertarget{command.HOL.quickcheck}{\hyperlink{command.HOL.quickcheck}{\mbox{\isa{\isacommand{quickcheck}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{{\isachardoublequote}proof\ {\isasymrightarrow}{\isachardoublequote}} \\
       
   850     \indexdef{HOL}{command}{quickcheck\_params}\hypertarget{command.HOL.quickcheck-params}{\hyperlink{command.HOL.quickcheck-params}{\mbox{\isa{\isacommand{quickcheck{\isacharunderscore}params}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}}
       
   851   \end{matharray}
       
   852 
       
   853   \begin{rail}
       
   854     'value' ( ( '[' name ']' ) ? ) modes? term
       
   855     ;
       
   856 
       
   857     'quickcheck' ( ( '[' args ']' ) ? ) nat?
       
   858     ;
       
   859 
       
   860     'quickcheck_params' ( ( '[' args ']' ) ? )
       
   861     ;
       
   862 
       
   863     modes: '(' (name + ) ')'
       
   864     ;
       
   865 
       
   866     args: ( name '=' value + ',' )
       
   867     ;
       
   868   \end{rail}
       
   869 
       
   870   \begin{description}
       
   871 
       
   872   \item \hyperlink{command.HOL.value}{\mbox{\isa{\isacommand{value}}}}~\isa{t} evaluates and prints a
       
   873     term; optionally \isa{modes} can be specified, which are
       
   874     appended to the current print mode (see also \cite{isabelle-ref}).
       
   875     Internally, the evaluation is performed by registered evaluators,
       
   876     which are invoked sequentially until a result is returned.
       
   877     Alternatively a specific evaluator can be selected using square
       
   878     brackets; available evaluators include \isa{nbe} for
       
   879     \emph{normalization by evaluation} and \emph{code} for code
       
   880     generation in SML.
       
   881 
       
   882   \item \hyperlink{command.HOL.quickcheck}{\mbox{\isa{\isacommand{quickcheck}}}} tests the current goal for
       
   883     counter examples using a series of arbitrary assignments for its
       
   884     free variables; by default the first subgoal is tested, an other
       
   885     can be selected explicitly using an optional goal index.
       
   886     A number of configuration options are supported for
       
   887     \hyperlink{command.HOL.quickcheck}{\mbox{\isa{\isacommand{quickcheck}}}}, notably:
       
   888 
       
   889     \begin{description}
       
   890 
       
   891       \item[size] specifies the maximum size of the search space for
       
   892         assignment values.
       
   893 
       
   894       \item[iterations] sets how many sets of assignments are
       
   895         generated for each particular size.
       
   896 
       
   897     \end{description}
       
   898 
       
   899     These option can be given within square brackets.
       
   900 
       
   901   \item \hyperlink{command.HOL.quickcheck-params}{\mbox{\isa{\isacommand{quickcheck{\isacharunderscore}params}}}} changes quickcheck
       
   902     configuration options persitently.
       
   903 
       
   904   \end{description}%
       
   905 \end{isamarkuptext}%
       
   906 \isamarkuptrue%
       
   907 %
   838 \isamarkupsection{Invoking automated reasoning tools -- The Sledgehammer%
   908 \isamarkupsection{Invoking automated reasoning tools -- The Sledgehammer%
   839 }
   909 }
   840 \isamarkuptrue%
   910 \isamarkuptrue%
   841 %
   911 %
   842 \begin{isamarkuptext}%
   912 \begin{isamarkuptext}%
   871     \indexdef{HOL}{command}{atp\_messages}\hypertarget{command.HOL.atp-messages}{\hyperlink{command.HOL.atp-messages}{\mbox{\isa{\isacommand{atp{\isacharunderscore}messages}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{{\isachardoublequote}any\ {\isasymrightarrow}{\isachardoublequote}} \\
   941     \indexdef{HOL}{command}{atp\_messages}\hypertarget{command.HOL.atp-messages}{\hyperlink{command.HOL.atp-messages}{\mbox{\isa{\isacommand{atp{\isacharunderscore}messages}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{{\isachardoublequote}any\ {\isasymrightarrow}{\isachardoublequote}} \\
   872     \indexdef{HOL}{method}{metis}\hypertarget{method.HOL.metis}{\hyperlink{method.HOL.metis}{\mbox{\isa{metis}}}} & : & \isa{method} \\
   942     \indexdef{HOL}{method}{metis}\hypertarget{method.HOL.metis}{\hyperlink{method.HOL.metis}{\mbox{\isa{metis}}}} & : & \isa{method} \\
   873   \end{matharray}
   943   \end{matharray}
   874 
   944 
   875   \begin{rail}
   945   \begin{rail}
   876   'sledgehammer' (nameref *)
   946   'sledgehammer' ( nameref * )
   877   ;
   947   ;
   878   'atp\_messages' ('(' nat ')')?
   948   'atp\_messages' ('(' nat ')')?
   879   ;
   949   ;
   880 
   950 
   881   'metis' thmrefs
   951   'metis' thmrefs
   996   One framework generates code from both functional and relational
  1066   One framework generates code from both functional and relational
   997   programs to SML.  See \cite{isabelle-HOL} for further information
  1067   programs to SML.  See \cite{isabelle-HOL} for further information
   998   (this actually covers the new-style theory format as well).
  1068   (this actually covers the new-style theory format as well).
   999 
  1069 
  1000   \begin{matharray}{rcl}
  1070   \begin{matharray}{rcl}
  1001     \indexdef{HOL}{command}{value}\hypertarget{command.HOL.value}{\hyperlink{command.HOL.value}{\mbox{\isa{\isacommand{value}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{{\isachardoublequote}context\ {\isasymrightarrow}{\isachardoublequote}} \\
       
  1002     \indexdef{HOL}{command}{code\_module}\hypertarget{command.HOL.code-module}{\hyperlink{command.HOL.code-module}{\mbox{\isa{\isacommand{code{\isacharunderscore}module}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\
  1071     \indexdef{HOL}{command}{code\_module}\hypertarget{command.HOL.code-module}{\hyperlink{command.HOL.code-module}{\mbox{\isa{\isacommand{code{\isacharunderscore}module}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\
  1003     \indexdef{HOL}{command}{code\_library}\hypertarget{command.HOL.code-library}{\hyperlink{command.HOL.code-library}{\mbox{\isa{\isacommand{code{\isacharunderscore}library}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\
  1072     \indexdef{HOL}{command}{code\_library}\hypertarget{command.HOL.code-library}{\hyperlink{command.HOL.code-library}{\mbox{\isa{\isacommand{code{\isacharunderscore}library}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\
  1004     \indexdef{HOL}{command}{consts\_code}\hypertarget{command.HOL.consts-code}{\hyperlink{command.HOL.consts-code}{\mbox{\isa{\isacommand{consts{\isacharunderscore}code}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\
  1073     \indexdef{HOL}{command}{consts\_code}\hypertarget{command.HOL.consts-code}{\hyperlink{command.HOL.consts-code}{\mbox{\isa{\isacommand{consts{\isacharunderscore}code}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\
  1005     \indexdef{HOL}{command}{types\_code}\hypertarget{command.HOL.types-code}{\hyperlink{command.HOL.types-code}{\mbox{\isa{\isacommand{types{\isacharunderscore}code}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\  
  1074     \indexdef{HOL}{command}{types\_code}\hypertarget{command.HOL.types-code}{\hyperlink{command.HOL.types-code}{\mbox{\isa{\isacommand{types{\isacharunderscore}code}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\  
  1006     \indexdef{HOL}{attribute}{code}\hypertarget{attribute.HOL.code}{\hyperlink{attribute.HOL.code}{\mbox{\isa{code}}}} & : & \isa{attribute} \\
  1075     \indexdef{HOL}{attribute}{code}\hypertarget{attribute.HOL.code}{\hyperlink{attribute.HOL.code}{\mbox{\isa{code}}}} & : & \isa{attribute} \\
  1007   \end{matharray}
  1076   \end{matharray}
  1008 
  1077 
  1009   \begin{rail}
  1078   \begin{rail}
  1010   'value' term
       
  1011   ;
       
  1012 
       
  1013   ( 'code\_module' | 'code\_library' ) modespec ? name ? \\
  1079   ( 'code\_module' | 'code\_library' ) modespec ? name ? \\
  1014     ( 'file' name ) ? ( 'imports' ( name + ) ) ? \\
  1080     ( 'file' name ) ? ( 'imports' ( name + ) ) ? \\
  1015     'contains' ( ( name '=' term ) + | term + )
  1081     'contains' ( ( name '=' term ) + | term + )
  1016   ;
  1082   ;
  1017 
  1083 
  1040   ;
  1106   ;
  1041 
  1107 
  1042   'code' (name)?
  1108   'code' (name)?
  1043   ;
  1109   ;
  1044   \end{rail}
  1110   \end{rail}
  1045 
       
  1046   \begin{description}
       
  1047 
       
  1048   \item \hyperlink{command.HOL.value}{\mbox{\isa{\isacommand{value}}}}~\isa{t} evaluates and prints a term
       
  1049   using the code generator.
       
  1050 
       
  1051   \end{description}
       
  1052 
  1111 
  1053   \medskip The other framework generates code from functional programs
  1112   \medskip The other framework generates code from functional programs
  1054   (including overloading using type classes) to SML \cite{SML}, OCaml
  1113   (including overloading using type classes) to SML \cite{SML}, OCaml
  1055   \cite{OCaml} and Haskell \cite{haskell-revised-report}.
  1114   \cite{OCaml} and Haskell \cite{haskell-revised-report}.
  1056   Conceptually, code generation is split up in three steps:
  1115   Conceptually, code generation is split up in three steps: