Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Isabelle/Archive-of-Formal-Proofs/thys/ROBDD/   (Sammlung formaler Beweise Version 2026-5©)  Datei vom 31.4.2026 mit Größe 1 kB image not shown  

Quelle  Option_Helpers.thy

  Sprache: Isabelle
 

sectionOption Helpers
textThese definitions were contributed by Peter Lammich.
theory Option_Helpers
imports Main "HOL-Library.Monad_Syntax"
begin

primrec oassert :: "bool ==> unit option" where
  "oassert True = Some ()" | "oassert False = None"

lemma oassert_iff[simp]: 
  "oassert Φ = Some x Φ" 
  "oassert Φ = None ¬Φ"  
  by (cases Φ) auto

textThe idea is that we want the result of some computation to be @{term "Some v"} and the contents of @{term v} to satisfy some property @{term Q}.

primrec ospec :: "('a option) ==> ('a ==> bool) ==> bool" where
  "ospec None _ = False"
"ospec (Some v) Q = Q v"

named_theorems ospec_rules

lemma oreturn_rule[ospec_rules]: "[ P r ] ==> ospec (Some r) P" by simp

lemma obind_rule[ospec_rules]: "[ ospec m Q; r. Q r ==> ospec (f r) P ] ==> ospec (m 🍋 f) P"
  apply (cases m)
   apply (auto split: Option.bind_splits)
  done

lemma ospec_alt: "ospec m P = (case m of None ==> False | Some x ==> P x)"
  by (auto split: option.splits)

lemma ospec_bind_simp: "ospec (m 🍋 f) P (ospec m (λr. ospec (f r) P))"
  apply (cases m)
   apply (auto split: Option.bind_splits)
  done

lemma ospec_cons: 
  assumes "ospec m Q"
  assumes "r. Q r ==> P r"
  shows "ospec m P"
  using assms by (cases m) auto

lemma oreturn_synth: "ospec (Some x) (λr. r=x)" by simp

lemma ospecD: "ospec x P ==> x = Some y ==> P y" by simp
lemma ospecD2: "ospec x P ==> y. x = Some y P y" by(cases x) simp_all

end

Messung V0.5 in Prozent
C=90 H=97 G=93

¤ Dauer der Verarbeitung: 0.2 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

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.