Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Isabelle/Doc/Tutorial/Misc/   (Isabelle Prover Version 2025-1©)  Datei vom 16.11.2025 mit Größe 1 kB image not shown  

Quelle  Option2.thy

  Sprache: Isabelle
 

(*<*)
theory Option2 imports Main begin
hide_const None Some
hide_type option
(*>*)

text\indexbold{*option (type)}\indexbold{*None (constant)}%
 indexbold{*Some (constant)}
  final datatype is very simple but still eminently useful:
 


datatype 'a option = None | Some 'a

text\noindent
  one needs to add a distinguished element to some existing type.
  example, type t option can model the result of a computation that
  either terminate with an error (represented by constNone) or return
  value termv (represented by termSome v).
 , typnat extended with $\infty$ can be modeled by type
 typnat option. In both cases one could define a new datatype with
  constructors like termError and termInfinity,
  it is often simpler to use option. For an application see
 S\ref{sec:Trie}.
 

(*<*)
(*
definition infplus :: "nat option \<Rightarrow> nat option \<Rightarrow> nat option" where
"infplus x y \<equiv> case x of None \<Rightarrow> None
               | Some m \<Rightarrow> (case y of None \<Rightarrow> None | Some n \<Rightarrow> Some(m+n))"

*)

end
(*>*)

Messung V0.5 in Prozent
C=15 H=100 G=71

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet am  2026-06-30) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.