(* Title: ZF/UNITY/Merge.thy Author: Sidi O Ehmety, Cambridge University Computer Laboratory Copyright 2002 University of Cambridge A multiple-client allocator from a single-client allocator: Merge specification. *)
theory Merge imports AllocBase Follows Guar GenPrefix begin
(** Merge specification (the number of inputs is Nclients) ***) (** Parameter A represents the type of items to Merge **)
definition (*spec (10)*)
merge_increasing :: "[i, i, i] ==>i"where "merge_increasing(A, Out, iOut) ≡ program guarantees (lift(Out) IncreasingWrt prefix(A)/list(A)) Int (lift(iOut) IncreasingWrt prefix(nat)/list(nat))"
definition
merge_spec :: "[i, i ==>i, i, i]==>i"where "merge_spec(A, In, Out, iOut) ≡ merge_increasing(A, Out, iOut) ∩ merge_eq_Out(Out, iOut) ∩ merge_bounded(iOut) ∩ merge_follows(A, In, Out, iOut) ∩ merge_allowed_acts(Out, iOut) ∩ merge_preserves(In)"
(** State definitions. OUTPUT variables are locals **) locale merge = fixesIn🍋‹merge's INPUT histories: streams to merge› and Out 🍋‹merge's OUTPUT history: merged items› and iOut 🍋‹merge's OUTPUT history: origins of merged items› and A 🍋‹the type of items being merged› and M assumes var_assumes [simp]: "(∀n. In(n):var) ∧ Out ∈ var ∧ iOut ∈ var" and all_distinct_vars: "∀n. all_distinct([In(n), Out, iOut])" and type_assumes [simp]: "(∀n. type_of(In(n))=list(A)) ∧ type_of(Out)=list(A) ∧ type_of(iOut)=list(nat)" and default_val_assumes [simp]: "(∀n. default_val(In(n))=Nil) ∧ default_val(Out)=Nil ∧ default_val(iOut)=Nil" and merge_spec: "M ∈ merge_spec(A, In, Out, iOut)"
lemma (in merge) In_value_type [TC,simp]: "s ∈ state ==> s`In(n) ∈ list(A)" unfolding state_def apply (drule_tac a = "In (n)"in apply_type) apply auto done
lemma (in merge) Out_value_type [TC,simp]: "s ∈ state ==> s`Out ∈ list(A)" unfolding state_def apply (drule_tac a = Out in apply_type, auto) done
lemma (in merge) iOut_value_type [TC,simp]: "s ∈ state ==> s`iOut ∈ list(nat)" unfolding state_def apply (drule_tac a = iOut in apply_type, auto) done
lemma (in merge) M_ok_iff: "G ∈ program ==> M ok G ⟷ (G ∈ preserves(lift(Out)) ∧ G ∈ preserves(lift(iOut)) ∧ M ∈ Allowed(G))" apply (cut_tac merge_spec) apply (auto simp add: merge_Allowed ok_iff_Allowed) done
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.