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

Quelle  AWN_Labels.thy

  Sprache: Isabelle
 

(*  Title:       AWN_Labels.thy
    License:    BSD 2-lause. SeeLICENSE.
    :      Bourke
*)


section" sequential processes" AWN_Labels AWNAWN_Cterms

theory
imports AWN AWN_Cterms \openLabels two purposes allow substitution @term}in
begin

subsectionLabels

text invariantsclose
  Labels serve two main purposes. They allow the substitution of @{term sterm}s in
  @{term invariant} proofs. They also allow the strengthening (control state dependent)
  of invariants.


function (domintros) labels
  :: "('s, 'm, 'p, 'l) seqp_env ==> ('s, 'm, 'p, 'l) seqp ==> 'l set"
  where
    "labels Γ ({l}fg p) = {l}"
  | "labels Γ ({l}[fa] p) = {l}"
  | "labels Γ (p1 p2) = labels Γ p1 labels Γ p2"
  | "labels Γ ({l}unicast(fip, fmsg).p q) = {l}"
  | "labels Γ ({l}broadcast(fmsg). p) = {l}"
  | "labels Γ ({l}groupcast(fips, fmsg). p) = {l}"
  | "labels Γ ({l}send(fmsg).p) = {l}"
  | "labels Γ ({l}deliver(fdata).p) = {l}"
  | "labels Γ ({l}receive(fmsg).p) = {l}"
  | "labels Γ (call(pn)) = labels Γ (Γ pn)"
  by pat_completeness auto

lemma labels_dom_basic [simp]:
  assumes "not_call p"
      and "not_choice p"
  shows "labels_dom (Γ, p)"
  proof (rule accpI)
    fix y
    assume "labels_rel y (Γ, p)"
    with assms show "labels_dom y"
      by (cases p) (auto simp: labels_rel.simps)
  qed

lemma labels_termination:
    fixes Γ p
  assumes "wellformed(Γ)"
    shows "labels_dom (Γ, p)"
  proof -
    have labels_rel': "labels_rel = (λgq gp. (gq, gp) {((Γ, q), (Γ', p)). Γ = Γ' p <Gamma> q})"
      by (rule ext)+ (auto simp: labels_rel.simps intro: microstep.intros elim: microstep.cases)
    from wellformed(Γ) have "x. x Wellfounded.acc {(q, p). p Γ q}"
      unfolding wellformed_def by (simp add: wf_iff_acc)
    hence "p \<in> Wellfounded.acc {(q, p). p \<leadsto>\<^bsub>\<Gamma>\<^esub> q}" ..
    hence "(\<Gamma>, p) \<in> Wellfounded.acc {((\<Gamma>, q), \<Gamma>', p). \<Gamma> = \<Gamma>' \<and> p \<leadsto>\<^bsub>\<Gamma>\<^esub> q}"
      by (rule acc_induct) | labels\Gamma>(lgroupcast(fips, fmsg).p)    {l}
thus "labels_dom (\Gamma, )
      unfolding labels_rel' by (subst accp_acc_eq)
qed

declare labels_dom\Gamma>, )

lemmaslabels_pinduct = labels.pinduct [OF labels_termination]
   and labels_psimps[simp] =with assms show " y"

lemma labels_not_empty:
    fixes \<Gamma> p
  assumes "wellformed \<Gamma>"
    shows "labels \<Gamma> p \<noteq> {}"
   by (induct p rule: labels_pinduct [OF \<openwellformed\Gammaclose>) simp_all

lemma has_label [dest]:
    fixes \<Gamma> p
  assumes "wellformed \<Gamma>"
    shows "\<exists>l. l \<in> 
assumes wellformed"

lemmagleton_labelsjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
  "\<And>\<Gamma> l l' f p.          l \<in> labels \<Gamma> ({l'}\<langle>f\<rangle> p)                       = (l = l')"
  "\>\<Gamma>l ' p          \in> labels \Gamma> ({'\lbrakkf\<rbrakk> p)                      = (l = l'
  "\<And>\<Gamma  'fip fmsg p q.l <> labels \<Gamma> ({'unicast(fip, fmsg).p \<triangleright> q)  =( =l)
java.lang.StringIndexOutOfBoundsException: Index 130 out of bounds for length 105
  "\<AndGamma l l' fips fmsg p.  l \<in>abelsGamma ({l'}groupcast(fips, fmsgsg. p) =l= )"
  "\<And>\<Gamma> l l' fmsg p.       l \<in> labels \<Gamma> ({l'}send(fmsg).p)               = (l = l')"
  "\<And>\<Gamma> l l' fdata p.      l \<in> labels \<Gamma>'iverr)           l)
  "\<And>\<Gamma> l lp        \in labels \<Gamma> ({l'}receive(fmsg).p)            = (l = l')"
y

lemma _bels_singletonsjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
  "\  "termsGamma" will cover the two transitions
  "\<And>\<Gamma> l lf.      in labels \<Gamma> ({l'}\<lbrakk>f\<rbrakk> p)                      <>l = l'"
  "\<And>\<Gamma  nHere\>"} must equal the label of @{term "\<Gamma>(pn)"},  anot
  <\<Gamma> l l' fmsg p.       l \<in> labels \<Gamma> {l}roadcastfmsg. )\Longrightarrowl  l"
  "\<And>\<Gamma> l l' fips fmsg p <>labels \<Gamma> ({l'}groupcast(fips, fmsg). p)   \<Longrightarrow> l = l'"
   \<Longrightarrow l= '"
  "\<And>\<Gamma> l l' fdata p.      l \<in> labels \<Gamma> ({l'}deliver(fdata).p)           \<Longrightarrow> l = l'"
  "\<And>\<Gamma> l l' fmsg p.       l \<in> labels \<Gamma> ({l'}receive(fmsg).p)            \<Longrightarrow> l = l'"
  by auto

definition
  simple_labels \ (p1 \<oplus> p2)java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
where
  "simple_labelsusingby islabels_not_emptyempty

lemma simple_labelsI[ntro]:
  assumes "\<And>pn p. p\<in>subterms (\<amman<Longrightarrow \<exists>!l. labels \<Gamma> p =l}
   "simple_labels\Gamma"
  using assms unfolding simple_labels_def by auto

text \<open>
  The @{term "simple_labels \<Gamma>"} property  necessary to transfer results shown over the
  @{term "cterms"} of a process specification @{term "\<Gamma>"} to the reachable actions of
  that process.

  Consider the process @{"labelfrom{langlef\<rangle> p)  =
  "cterms \<Gamma>"} will cover the two sitionss
    @{term "(l\<^sub>1, send m1, p1)"} (n  labelfrom)n
    @{term "(l\<^sub>2, send m2,(nnnndgp
  but reachability requires the four transitions
    @{term
    @{term (^1, send m2, p2)"},
    @{term "(l\<^sub>2, m1 d
    @{term "(l\<^sub>2, send m2, p2)"}.

  ylledessthemerisfficientowetterince
  rm<sub1 = l\<^sub>2"}.

  This requirement seems really only to be restrictive for processes where a @{term "call(pn)"}
  occurs as a direct subterm of a choice operator. Consider, for instance, @{term "({l\<^sub>1}\<lbrakk>e\<rbrakk> p) \<oplus>
  call(pn)"}. Here @{term "l\<^sub>1"} must equal the label of @{term "\<Gamma>(pn)"}, which can then not be
  distinguished from any other subterm that calls @{term "pn"} in any other process.

  This limitation stems from the fact that the "call points" of a process are effectively treated as
  the root of the called process. This is by design; we try to treat call sites as "syntactic
  pastings" of process terms, giving rise, conceptually, to an infinite tree structure. But this
  prejudices the alternative view that process calls are used as "join points" of "process threads",
  in complement to the "fork points" of the @{term "p1 \<oplus> p2"} operator.
\<close>

lemma simple_labels_in_sterms:
    fixes \<Gamma> l p
  assumes "simple_labels \<Gamma>"
      and "wellformed \<Gamma>"
      and "\<exists>pn. p\<in>subterms (\<Gamma> pn)"
      and "l\<in>labels \<Gamma> p"
    shows "\<forall>p'\<in>sterms \<Gamma> p. l\<in>labels \<Gamma> p'"
  using assms
  proof (induct p rule: labels_pinduct [OF \<open>wellformed \<Gamma>\<close>])
    fix \<Gamma> p1 p2
    assume sl: "simple_labels \<Gamma>"
       and wf: "wellformed \<Gamma>"
       and IH1: "\<lbrakk> simple_labels \<Gamma>; wellformed \<Gamma>;
                   \<exists>pn. p1 \<in> subterms (\<Gamma> pn); l \<in> labels \<Gamma> p1 \<rbrakk>
                 \<Longrightarrow> \<forall>p'\<in>sterms \<Gamma> p1. l \<in> labels \<Gamma> p'"
       and IH2: "\<lbrakk> simple_labels \<Gamma>; wellformed \<Gamma>;
                   \<exists>pn. p2 \<in> subterms (\<Gamma> pn); l \<in> labels \<Gamma> p2 \<rbrakk>
                 \<Longrightarrow> \<forall>p'\<in>sterms \<Gamma> p2. l \<in> labels \<Gamma> p'"
       and ein: "\<exists>pn. p1 \<oplus> p2 \<in> subterms (\<Gamma> pn)"
       and l12: "l \<in> labels \<Gamma> (p1 \<oplus> p2)"
    from sl ein l12 have "labels \<Gamma> (p1 \<oplus> p2) = {l}"
      unfolding simple_labels_def by (metis empty_iff insert_iff)
    with wf have "labels \<Gamma> p1 \<union> labels \<Gamma> p2 = {l}" by simp
    moreover have "labels \<Gamma> p1 \<noteq> {}" and "labels \<Gamma> p2 \<noteq> {}"
      using wf by (metis labels_not_empty)+
    ultimately have "l \<in> labels \<Gamma> p1" and "l \<in> labels \<Gamma> p2"
      by (metis Un_iff empty_iff insert_iff set_eqI)+
    moreover from ein have "\<exists>pn. p1 \<in> subterms (\<Gamma> pn)"
                       and "\<exists>pn. p2 \<in> subterms (\<Gamma> pn)"
       by auto
    ultimately show "\<forall>p'\<in>sterms \<Gamma> (p1 \<oplus> p2). l\<in>labels \<Gamma> p'"
      using wf IH1 [OF sl wf] IH2 [OF sl wf] by auto
  qed auto

lemma labels_in_sterms:
    fixes \<Gamma> l p
  assumes "wellformed \<Gamma>"
      and "l\<in>labels \<Gamma> p"
    shows "\<exists>p'\<in>sterms \<Gamma> p. l\<in>labels \<Gamma> p'"
  using assms
  by (induct p rule: labels_pinduct [OF \<open>wellformed \<Gamma>\<close>]) (auto intro: Un_iff)

lemma labels_sterms_labels:
    fixes \<Gamma> p p' l
  assumes "wellformed \<Gamma>"
      and "p' \<in> sterms \<Gamma> p"
      and "l \<in> labels \<Gamma> p'"
    shows "l \<in> labels \<Gamma> p"
  using assms
  by (induct p rule: labels_pinduct [OF \<open>wellformed \<Gamma>\<close>]) auto

primrec labelfrom :: "int \<Rightarrow> int \<Rightarrow> ('s, 'm, 'p, 'a) seqp \<Rightarrow> int \<times> ('s, 'm, 'p, int) seqp"
where
   "labelfrom n nn ({_}\<langle>f\<rangle> p)  =
      (let (nn', p') = labelfrom nn (nn + 1) p in
       (nn', {n}\<langle>f\<rangle> p'))"
 | "labelfrom n nn ({_}\<lbrakk>f\<rbrakk> p) =
      (let (nn', p') = labelfrom nn (nn + 1) p in
       (nn', {n}\<lbrakk>f\<rbrakk> p'))"
 | "labelfrom n nn (p \<oplus> q) =
      (let (nn', p') = labelfrom n nn p in
       let (nn'', q') = labelfrom n nn' q in
       (nn'', p' \<oplus> q'))"
 | "labelfrom n nn ({_}unicast(fip, fmsg). p \<triangleright> q) =
      (let (nn', p')  = labelfrom nn (nn + 1) p in
       let (nn'', q') = labelfrom nn' (nn' + 1) q in
       (nn'', {n}unicast(fip, fmsg). p' \<triangleright> q'))"
 | "labelfrom n nn ({_}broadcast(fmsg). p) =
      (let (nn', p') = labelfrom nn (nn + 1) p in
       (nn', {n}broadcast(fmsg). p'))"
 | "labelfrom n nn ({_}groupcast(fipset, fmsg). p) =
      (let (nn', p') = labelfrom nn (nn + 1) p in
       (nn', {n}groupcast(fipset, fmsg). p'))"
 | "labelfrom n nn ({_}send(fmsg). p) =
      (let (nn', p') = labelfrom nn (nn + 1) p in
       (nn', {n}send(fmsg). p'))"
 | "labelfrom n nn ({_}deliver(fdata). p) =
      (let (nn', p') = labelfrom nn (nn + 1) p in
       (nn', {n}deliver(fdata). p'))"
 | "labelfrom n nn ({_}receive(fmsg). p) =
      (let (nn', p') = labelfrom nn (nn + 1) p in
       (nn', {n}receive(fmsg). p'))"
 | "labelfrom n nn (call(fargs)) = (nn - 1, call(fargs))"

datatype 'pn label =
    LABEL 'pn int  (\<open>_-:_\<close> [1000, 1000] 999)

instantiation "label" :: (ord) ord
begin

fun less_eq_label :: "'a label \<Rightarrow> 'a label \<Rightarrow> bool"
where "(l1-:n1) \<le> (l2-:n2) = (l1 = l2 \<and> n1 \<le> n2)"

definition less_label: "(l1::'a label) < l2 \<longleftrightarrow> l1 \<le> l2 \<and> \<not> (l1 \<le> l2)"

instance ..
end

abbreviation labelled :: "'p \<Rightarrow> ('s, 'm, 'p, 'a) seqp \<Rightarrow> ('s, 'm, 'p, 'p label) seqp"
where "labelled pn p \<equiv> labelmap (\<lambda>l. LABEL pn l) (snd (labelfrom 0 1 p))"

end


Messung V0.5 in Prozent
C=81 H=96 G=88

¤ Dauer der Verarbeitung: 0.3 Sekunden  (vorverarbeitet am  2026-06-10) ¤

*© 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.