src/HOL/TLA/Buffer/Buffer.thy
changeset 60591 e0b77517f9a9
parent 60588 750c533459b1
child 60592 c9bd1d902f04
equal deleted inserted replaced
60590:479071e8778f 60591:e0b77517f9a9
     3 *)
     3 *)
     4 
     4 
     5 section {* A simple FIFO buffer (synchronous communication, interleaving) *}
     5 section {* A simple FIFO buffer (synchronous communication, interleaving) *}
     6 
     6 
     7 theory Buffer
     7 theory Buffer
     8 imports TLA
     8 imports "../TLA"
     9 begin
     9 begin
    10 
    10 
    11 consts
    11 consts
    12   (* actions *)
    12   (* actions *)
    13   BInit     :: "'a stfun \<Rightarrow> 'a list stfun \<Rightarrow> 'a stfun \<Rightarrow> stpred"
    13   BInit     :: "'a stfun \<Rightarrow> 'a list stfun \<Rightarrow> 'a stfun \<Rightarrow> stpred"
    20   Buffer    :: "'a stfun \<Rightarrow> 'a stfun \<Rightarrow> temporal"
    20   Buffer    :: "'a stfun \<Rightarrow> 'a stfun \<Rightarrow> temporal"
    21 
    21 
    22 defs
    22 defs
    23   BInit_def:   "BInit ic q oc    == PRED q = #[]"
    23   BInit_def:   "BInit ic q oc    == PRED q = #[]"
    24   Enq_def:     "Enq ic q oc      == ACT (ic$ \<noteq> $ic)
    24   Enq_def:     "Enq ic q oc      == ACT (ic$ \<noteq> $ic)
    25                                      & (q$ = $q @ [ ic$ ])
    25                                      \<and> (q$ = $q @ [ ic$ ])
    26                                      & (oc$ = $oc)"
    26                                      \<and> (oc$ = $oc)"
    27   Deq_def:     "Deq ic q oc      == ACT ($q \<noteq> #[])
    27   Deq_def:     "Deq ic q oc      == ACT ($q \<noteq> #[])
    28                                      & (oc$ = hd< $q >)
    28                                      \<and> (oc$ = hd< $q >)
    29                                      & (q$ = tl< $q >)
    29                                      \<and> (q$ = tl< $q >)
    30                                      & (ic$ = $ic)"
    30                                      \<and> (ic$ = $ic)"
    31   Next_def:    "Next ic q oc     == ACT (Enq ic q oc | Deq ic q oc)"
    31   Next_def:    "Next ic q oc     == ACT (Enq ic q oc \<or> Deq ic q oc)"
    32   IBuffer_def: "IBuffer ic q oc  == TEMP Init (BInit ic q oc)
    32   IBuffer_def: "IBuffer ic q oc  == TEMP Init (BInit ic q oc)
    33                                       & \<box>[Next ic q oc]_(ic,q,oc)
    33                                       \<and> \<box>[Next ic q oc]_(ic,q,oc)
    34                                       & WF(Deq ic q oc)_(ic,q,oc)"
    34                                       \<and> WF(Deq ic q oc)_(ic,q,oc)"
    35   Buffer_def:  "Buffer ic oc     == TEMP (\<exists>\<exists>q. IBuffer ic q oc)"
    35   Buffer_def:  "Buffer ic oc     == TEMP (\<exists>\<exists>q. IBuffer ic q oc)"
    36 
    36 
    37 
    37 
    38 (* ---------------------------- Data lemmas ---------------------------- *)
    38 (* ---------------------------- Data lemmas ---------------------------- *)
    39 
    39