src/Doc/Datatypes/Datatypes.thy
changeset 54626 8a5e82425e55
parent 54624 36301c99ed26
child 54832 789fbbc092d2
equal deleted inserted replaced
54625:f312a035d0cf 54626:8a5e82425e55
   458 
   458 
   459 @{rail "
   459 @{rail "
   460   @@{command datatype_new} target? @{syntax dt_options}? \\
   460   @@{command datatype_new} target? @{syntax dt_options}? \\
   461     (@{syntax dt_name} '=' (@{syntax ctor} + '|') + @'and')
   461     (@{syntax dt_name} '=' (@{syntax ctor} + '|') + @'and')
   462   ;
   462   ;
   463   @{syntax_def dt_options}: '(' (('no_discs_sels' | 'rep_compat') + ',') ')'
   463   @{syntax_def dt_options}: '(' (('no_discs_sels' | 'no_code' | 'rep_compat') + ',') ')'
   464 "}
   464 "}
   465 
   465 
   466 The syntactic entity \synt{target} can be used to specify a local
   466 The syntactic entity \synt{target} can be used to specify a local
   467 context---e.g., @{text "(in linorder)"}. It is documented in the Isar reference
   467 context---e.g., @{text "(in linorder)"}. It is documented in the Isar reference
   468 manual \cite{isabelle-isar-ref}.
   468 manual \cite{isabelle-isar-ref}.
   473 \setlength{\itemsep}{0pt}
   473 \setlength{\itemsep}{0pt}
   474 
   474 
   475 \item
   475 \item
   476 The @{text "no_discs_sels"} option indicates that no discriminators or selectors
   476 The @{text "no_discs_sels"} option indicates that no discriminators or selectors
   477 should be generated.
   477 should be generated.
       
   478 
       
   479 \item
       
   480 The @{text "no_code"} option indicates that the datatype should not be
       
   481 registered for code generation.
   478 
   482 
   479 \item
   483 \item
   480 The @{text "rep_compat"} option indicates that the generated names should
   484 The @{text "rep_compat"} option indicates that the generated names should
   481 contain optional (and normally not displayed) ``@{text "new."}'' components to
   485 contain optional (and normally not displayed) ``@{text "new."}'' components to
   482 prevent clashes with a later call to \keyw{rep\_datatype}. See
   486 prevent clashes with a later call to \keyw{rep\_datatype}. See
  2385 %
  2389 %
  2386 %  * also useful for compatibility with old package, e.g. add destructors to
  2390 %  * also useful for compatibility with old package, e.g. add destructors to
  2387 %    old \keyw{datatype}
  2391 %    old \keyw{datatype}
  2388 %
  2392 %
  2389 %  * @{command wrap_free_constructors}
  2393 %  * @{command wrap_free_constructors}
  2390 %    * @{text "no_discs_sels"}, @{text "rep_compat"}
  2394 %    * @{text "no_discs_sels"}, @{text "no_code"}, @{text "rep_compat"}
  2391 %    * hack to have both co and nonco view via locale (cf. ext nats)
  2395 %    * hack to have both co and nonco view via locale (cf. ext nats)
  2392 %  * code generator
  2396 %  * code generator
  2393 %     * eq, refl, simps
  2397 %     * eq, refl, simps
  2394 *}
  2398 *}
  2395 
  2399 
  2421   @{syntax_def name_term}: (name ':' term)
  2425   @{syntax_def name_term}: (name ':' term)
  2422   ;
  2426   ;
  2423   X_list: '[' (X + ',') ']'
  2427   X_list: '[' (X + ',') ']'
  2424 "}
  2428 "}
  2425 
  2429 
  2426 % options: no_discs_sels rep_compat
  2430 % options: no_discs_sels no_code rep_compat
  2427 
  2431 
  2428 \noindent
  2432 \noindent
  2429 Section~\ref{ssec:datatype-generated-theorems} lists the generated theorems.
  2433 Section~\ref{ssec:datatype-generated-theorems} lists the generated theorems.
  2430 *}
  2434 *}
  2431 
  2435