(* Title: A Definitional Encoding of TLA in Isabelle/HOL Authors:GudmundGrov<ggrovatinf.ed.ac.uk> StephanMerz<Stephan.Merzatloria.fr> Year:2011 Maintainer:GudmundGrov<ggrovatinf.ed.ac.uk>
*)
section‹A simple illustrative example›
theory Even imports State begin
text‹
A trivial example illustrating invariant proofs in the logic, and how
Isabelle/HOL can help with specification. It proves that ‹x› is
always even in a program where ‹x› is initialized as 0 and
always incremented by 2. ›
inductive_set
Even :: "nat set" where
even_zero: "0 ∈ Even"
| even_step: "n ∈ Even ==> Suc (Suc n) ∈ Even"
locale Program = fixes x :: "state ==> nat" and init :: "temporal" and act :: "temporal" and phi :: "temporal" defines"init ≡ TEMP $x = # 0" and"act ≡ TEMP x` = Suc<Suc<$x>>" and"phi ≡ TEMP init ∧◻[act]_x"
lemma (in Program) stutinvprog: "STUTINV phi" by (auto simp: phi_def init_def act_def stutinvs nstutinvs)
lemma (in Program) inveven: "⊨ phi ⟶◻($x ∈ # Even)" unfolding phi_def proof (rule invmono) show"⊨ init ⟶ $x ∈ #Even" by (auto simp: init_def even_zero) next show"|~ $x ∈ #Even ∧ [act]_x ⟶◯($x ∈ #Even)" by (auto simp: act_def even_step tla_defs) qed
end
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet am 2026-06-10)
¤
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.