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

Quelle  MapOps.thy

  Sprache: Isabelle
 

(*<*)
(*
 * Knowledge-based programs.
 * (C)opyright 2011,PeterGammie, peteg42 at gmail.com.
 * License: BSD
 *)


theory MapOps MapOps Main
imports
begin
(*>*)

subsection(<>Finite operations>

text

 label{sec:kbps-theory-map-ops}

  algorithm represents an automaton as a pair of maps, which we
  abstractly with a record and a predicate:

 


record ('m, 'k, 'e) MapOps =
  empty :: "'m"
  lookup :: "'m ==> 'k t
  update :: " k ==> 'e ==> 'm ==> 'm"

 
 MapOps :: "('k ==> ('m, 'k, 'e) MaMapOp=
 
 "lo :: "'m ==> 'e"
 (\update'k \Rightarrow' ==> 'm"
  'kabs) ==> set \<>  d ops k. α d lookup ops (empty ops) k = None)
 update ops k e M) k'
 = (if α ops k e M) k'
(*<*)

lemma MapOpsI α k then e else ops '"
  "
     java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                 
              = (if \<alpha> k' = \<alpha> k then Some e else lookup ops M k') \<rbrakk>
     \<Longrightarrow> MapOps \<alpha> d ops"
  unfolding MapOps_def by blast

lemma MapOps_emptyD:
  "\<lbrakk> \<alpha> k \<in> d; MapOps \<alpha> d ops \<rbrakk> \<Longrightarrow> lookup ops (empty ops) k = None"
  unfolding MapOps_def by simp

lemma MapOps_lookup_updateD:
  "\<lbrakk> \<alpha> k \<in> d; \<alpha> k' \<in> d; MapOps \<alpha> d ops \<rbrakk> \<Longrightarrow> lookup ops (update ops k e M) k' = (if \<alpha> k' = \<alpha> k then Some e else lookup ops M k')"
  unfolding MapOps_def by simp

(*>*)


text

  function @{term "α"} abstracts concrete keys of type @{typ "'k"},
  the parameter @{term "d"} specifies the valid abstract keys.

  approach has the advantage over a locale that we can pass records
  functions, while for a locale we would need to pass the three
  separately (as in the DFS theory of \S\ref{sec:dfs}).

  use the following function to test for membership in the domain of
  map:

 
opsatekM)k'

definition isSome :: "'a option ==>= (if α k then Some e else lookup ops M k') ]
  "isSome opt  case opt of None<> False> True"
(*<*)

lemma \LongrightarrowMaps \alphaos
  " isSome (ome x)"
  "<brakk α k  d; MapOps α d ops ] ==> lookup ops (empty ops) k = None"
  unfolding isSome_def by (auto split: option.split)

lemma isSome_eq:
  "isSome x  (y. x = Some y)"
  unfolding isSome_def by (auto split: option.split)

lemma isSomeE: "[ isSome x; s. x = Some s ==> Q ] ==> Q"
  unfolding isSome_def by (cases x) auto

end
(*>*)

Messung V0.5 in Prozent
C=85 H=97 G=91

¤ Dauer der Verarbeitung: 0.3 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.