doc-src/IsarRef/hol.tex
changeset 9848 afc54ca6dc6f
parent 9800 221388d5696d
child 9905 14a71104a498
equal deleted inserted replaced
9847:32ce11c3f6b1 9848:afc54ca6dc6f
     8   rulify & : & \isaratt \\
     8   rulify & : & \isaratt \\
     9   rulify_prems & : & \isaratt \\
     9   rulify_prems & : & \isaratt \\
    10 \end{matharray}
    10 \end{matharray}
    11 
    11 
    12 \begin{descr}
    12 \begin{descr}
    13 
    13   
    14 \item [$rulify$] puts a theorem into object-rule form, replacing implication
    14 \item [$rulify$] puts a theorem into object-rule form, replacing implication
    15   and universal quantification of HOL by the corresponding meta-logical
    15   and universal quantification of HOL by the corresponding meta-logical
    16   connectives.  This is the same operation as performed by the
    16   connectives.  This is the same operation as performed in
    17   \texttt{qed_spec_mp} ML function.
    17   \texttt{qed_spec_mp} in ML.
    18   
    18   
    19 \item [$rulify_prems$] is similar to $rulify$, but acts on the premises of a
    19 \item [$rulify_prems$] is similar to $rulify$, but acts on the premises of a
    20   rule.
    20   rule.
    21 
    21 
    22 \end{descr}
    22 \end{descr}
    52 \end{descr}
    52 \end{descr}
    53 
    53 
    54 
    54 
    55 \section{Records}\label{sec:record}
    55 \section{Records}\label{sec:record}
    56 
    56 
    57 %FIXME record_split method
       
    58 \indexisarcmd{record}
    57 \indexisarcmd{record}
    59 \begin{matharray}{rcl}
    58 \begin{matharray}{rcl}
    60   \isarcmd{record} & : & \isartrans{theory}{theory} \\
    59   \isarcmd{record} & : & \isartrans{theory}{theory} \\
    61 \end{matharray}
    60 \end{matharray}
    62 
    61 
    87 
    86 
    88 \railalias{repdatatype}{rep\_datatype}
    87 \railalias{repdatatype}{rep\_datatype}
    89 \railterm{repdatatype}
    88 \railterm{repdatatype}
    90 
    89 
    91 \begin{rail}
    90 \begin{rail}
    92   'datatype' (parname? typespec infix? \\ '=' (constructor + '|') + 'and')
    91   'datatype' (dtspec + 'and')
    93   ;
    92   ;
    94   repdatatype (name * ) \\ 'distinct' thmrefs 'inject' thmrefs 'induction' thmrefs
    93   repdatatype (name * ) dtrules
    95   ;
    94   ;
    96 
    95 
    97   constructor: name (type * ) mixfix? comment?
    96   dtspec: parname? typespec infix? '=' (cons + '|')
    98   ;
    97   ;
       
    98   cons: name (type * ) mixfix? comment?
       
    99   ;
       
   100   dtrules: 'distinct' thmrefs 'inject' thmrefs 'induction' thmrefs
    99 \end{rail}
   101 \end{rail}
   100 
   102 
   101 \begin{descr}
   103 \begin{descr}
   102 \item [$\isarkeyword{datatype}$] defines inductive datatypes in HOL.
   104 \item [$\isarkeyword{datatype}$] defines inductive datatypes in HOL.
   103 \item [$\isarkeyword{rep_datatype}$] represents existing types as inductive
   105 \item [$\isarkeyword{rep_datatype}$] represents existing types as inductive
   118 
   120 
   119 
   121 
   120 \section{Recursive functions}
   122 \section{Recursive functions}
   121 
   123 
   122 \indexisarcmd{primrec}\indexisarcmd{recdef}
   124 \indexisarcmd{primrec}\indexisarcmd{recdef}
       
   125 \indexisaratt{recdef-simp}\indexisaratt{recdef-cong}\indexisaratt{recdef-wf}
   123 \begin{matharray}{rcl}
   126 \begin{matharray}{rcl}
   124   \isarcmd{primrec} & : & \isartrans{theory}{theory} \\
   127   \isarcmd{primrec} & : & \isartrans{theory}{theory} \\
   125   \isarcmd{recdef} & : & \isartrans{theory}{theory} \\
   128   \isarcmd{recdef} & : & \isartrans{theory}{theory} \\
       
   129   recdef_simp & : & \isaratt \\
       
   130   recdef_cong & : & \isaratt \\
       
   131   recdef_wf & : & \isaratt \\
   126 %FIXME
   132 %FIXME
   127 %  \isarcmd{defer_recdef} & : & \isartrans{theory}{theory} \\
   133 %  \isarcmd{defer_recdef} & : & \isartrans{theory}{theory} \\
   128 \end{matharray}
   134 \end{matharray}
   129 
   135 
       
   136 \railalias{recdefsimp}{recdef\_simp}
       
   137 \railterm{recdefsimp}
       
   138 
       
   139 \railalias{recdefcong}{recdef\_cong}
       
   140 \railterm{recdefcong}
       
   141 
       
   142 \railalias{recdefwf}{recdef\_wf}
       
   143 \railterm{recdefwf}
       
   144 
   130 \begin{rail}
   145 \begin{rail}
   131   'primrec' parname? (equation + )
   146   'primrec' parname? (equation + )
   132   ;
   147   ;
   133   'recdef' name term (equation +) hints
   148   'recdef' name term (eqn + ) hints?
   134   ;
   149   ;
   135 
   150   (recdefsimp | recdefcong | recdefwf) (() | 'add' | 'del')
   136   equation: thmdecl? prop comment?
   151   ;
   137   ;
   152 
   138   hints: ('congs' thmrefs)?
   153   equation: thmdecl? eqn
       
   154   ;
       
   155   eqn: prop comment?
       
   156   ;
       
   157   hints: '(' 'hints' (recdefmod * ) ')'
       
   158   ;
       
   159   recdefmod: (('simp' | 'cong' | 'wf' | 'split' | 'iff') (() | 'add' | 'del') ':' thmrefs) | clamod
   139   ;
   160   ;
   140 \end{rail}
   161 \end{rail}
   141 
   162 
   142 \begin{descr}
   163 \begin{descr}
   143 \item [$\isarkeyword{primrec}$] defines primitive recursive functions over
   164 \item [$\isarkeyword{primrec}$] defines primitive recursive functions over
   144   datatypes.
   165   datatypes, see also \cite{isabelle-HOL}.
   145 \item [$\isarkeyword{recdef}$] defines general well-founded recursive
   166 \item [$\isarkeyword{recdef}$] defines general well-founded recursive
   146   functions (using the TFL package).
   167   functions (using the TFL package), see also \cite{isabelle-HOL}.  The
   147 \end{descr}
   168   $simp$, $cong$, and $wf$ hints refer to auxiliary rules to be used in the
   148 
   169   internal automated proof process of TFL; the other declarations refer to the
   149 Both definitions accommodate reasoning by induction (cf.\ 
   170   Simplifier and Classical reasoner (\S\ref{sec:simplifier},
       
   171   \S\ref{sec:classical}, \S\ref{sec:clasimp}) that are used internally.
       
   172 
       
   173 \item [$recdef_simps$, $recdef_cong$, and $recdef_wf$] declare global hints
       
   174   for $\isarkeyword{recdef}$.
       
   175 \end{descr}
       
   176 
       
   177 Both kinds of recursive definitions accommodate reasoning by induction (cf.\ 
   150 \S\ref{sec:induct-method}): rule $c\mathord{.}induct$ (where $c$ is the name
   178 \S\ref{sec:induct-method}): rule $c\mathord{.}induct$ (where $c$ is the name
   151 of the function definition) refers to a specific induction rule, with
   179 of the function definition) refers to a specific induction rule, with
   152 parameters named according to the user-specified equations.  Case names of
   180 parameters named according to the user-specified equations.  Case names of
   153 $\isarkeyword{primrec}$ are that of the datatypes involved, while those of
   181 $\isarkeyword{primrec}$ are that of the datatypes involved, while those of
   154 $\isarkeyword{recdef}$ are numbered (starting from $1$).
   182 $\isarkeyword{recdef}$ are numbered (starting from $1$).
   157 $f\mathord.simps$, where $f$ is the (collective) name of the functions
   185 $f\mathord.simps$, where $f$ is the (collective) name of the functions
   158 defined.  Individual equations may be named explicitly as well; note that for
   186 defined.  Individual equations may be named explicitly as well; note that for
   159 $\isarkeyword{recdef}$ each specification given by the user may result in
   187 $\isarkeyword{recdef}$ each specification given by the user may result in
   160 several theorems.
   188 several theorems.
   161 
   189 
   162 See \cite{isabelle-HOL} for further information on recursive function
       
   163 definitions in HOL.
       
   164 
       
   165 
   190 
   166 \section{(Co)Inductive sets}
   191 \section{(Co)Inductive sets}
   167 
   192 
   168 \indexisarcmd{inductive}\indexisarcmd{coinductive}\indexisaratt{mono}
   193 \indexisarcmd{inductive}\indexisarcmd{coinductive}\indexisaratt{mono}
   169 \begin{matharray}{rcl}
   194 \begin{matharray}{rcl}
   170   \isarcmd{inductive} & : & \isartrans{theory}{theory} \\
   195   \isarcmd{inductive} & : & \isartrans{theory}{theory} \\
   171   \isarcmd{coinductive}^* & : & \isartrans{theory}{theory} \\
   196   \isarcmd{coinductive} & : & \isartrans{theory}{theory} \\
   172   mono & : & \isaratt \\
   197   mono & : & \isaratt \\
   173 \end{matharray}
   198 \end{matharray}
   174 
   199 
   175 \railalias{condefs}{con\_defs}
   200 \railalias{condefs}{con\_defs}
   176 \railterm{condefs}
   201 \railterm{condefs}
   177 
   202 
   178 \begin{rail}
   203 \begin{rail}
   179   ('inductive' | 'coinductive') (term comment? +) \\
   204   ('inductive' | 'coinductive') sets intros monos?
   180     'intros' attributes? (thmdecl? prop comment? +) \\
       
   181     'monos' thmrefs comment? \\ condefs thmrefs comment?
       
   182   ;
   205   ;
   183   'mono' (() | 'add' | 'del')
   206   'mono' (() | 'add' | 'del')
       
   207   ;
       
   208 
       
   209   sets: (term comment? +)
       
   210   ;
       
   211   intros: 'intros' attributes? (thmdecl? prop comment? +)
       
   212   ;
       
   213   monos: 'monos' thmrefs comment?
   184   ;
   214   ;
   185 \end{rail}
   215 \end{rail}
   186 
   216 
   187 \begin{descr}
   217 \begin{descr}
   188 \item [$\isarkeyword{inductive}$ and $\isarkeyword{coinductive}$] define
   218 \item [$\isarkeyword{inductive}$ and $\isarkeyword{coinductive}$] define
   212 via the $\CASENAME$ proof command within the subsequent proof text (cf.\ 
   242 via the $\CASENAME$ proof command within the subsequent proof text (cf.\ 
   213 \S\ref{sec:cases}).  This accommodates compact proof texts even when reasoning
   243 \S\ref{sec:cases}).  This accommodates compact proof texts even when reasoning
   214 about large specifications.
   244 about large specifications.
   215 
   245 
   216 \begin{rail}
   246 \begin{rail}
   217   'cases' ('(' 'simplified' ')')? ('(' 'open' ')')? \\ (insts * 'and') rule?  ;
   247   'cases' simplified? open? args rule?
   218 
   248   ;
   219   'induct' ('(' 'stripped' ')')? ('(' 'open' ')')? \\ (insts * 'and') rule?
   249   'induct' stripped? open? args rule?
   220   ;
   250   ;
   221 
   251 
       
   252   simplified: '(' 'simplified' ')'
       
   253   ;
       
   254   stripped: '(' 'stripped' ')'
       
   255   ;
       
   256   open: '(' 'open' ')'
       
   257   ;
       
   258   args: (insts * 'and') 
       
   259   ;
   222   rule: ('type' | 'set') ':' nameref | 'rule' ':' thmref
   260   rule: ('type' | 'set') ':' nameref | 'rule' ':' thmref
   223   ;
   261   ;
   224 \end{rail}
   262 \end{rail}
   225 
   263 
   226 \begin{descr}
   264 \begin{descr}