Machinery for constructing infinite fair executions #
The main goal of this file is to define a fairScheduler that, given a function d
of type DeliverMsg, a state predicate q, and a state s0 of an algorithm a,
constructs an infinite execution of a starting from state s0 in which all processes
from a set ps are fair and q is true infinitely often. With additional assumptions,
we may also want to require that all actions in the infinite execution satisfy an action
predicate r.
Given a state s and a message m, a function d of type DeliverMsg is supposed to
return (xs, t) where xs is a finite execution from s to t in which m is delivered.
Equations
- Cslib.FLP.DeliverMsg P M S = (Cslib.FLP.State P M S → Cslib.FLP.Message P M → List (Cslib.FLP.Action P M) × Cslib.FLP.State P M S)
Instances For
d.ForallActions r requires that all actions returned by d satisfy r.
Equations
- d.ForallActions r = ∀ (s : Cslib.FLP.State P M S) (m : Cslib.FLP.Message P M), List.Forall r (d s m).1
Instances For
d.foldList s ml ms uses d to deliver all messages that are in ml but not in ms from
state s. Note that if a message m in ml is delivered during the delivery of an earlier
message, m is added to ms so that it is not processed again.
Instances For
d.scheduleMsgs ps s schedules and delivers all messages which are in-flight in state s
and have destinations in ps in some order (as determined by choice). If no such message exists,
then the the stuttering step is taken.
Equations
- One or more equations did not get rendered due to their size.
Instances For
If d.ForallActions r, then d.foldList s ml ms can only use actions satisfying r.
Starting from state s0, a.fairSchedular d ps s0 constructs an infinite sequence of
finite executions of a by repeatedly applying d.scheduleMsgs ps.
Equations
- a.fairScheduler d ps s0 0 = ([], s0)
- a.fairScheduler d ps s0 k.succ = d.scheduleMsgs ps (a.fairScheduler d ps s0 k).2
Instances For
The infinite sequence of states forming the end states of the finite executions constructed
by Algorithm.fairScheduler.
Equations
- a.fairSegEnds d ps s0 = { get := fun (k : ℕ) => (a.fairScheduler d ps s0 k).2 }
Instances For
The infinite sequence of finite action sequences from the finite executions constructed
by Algorithm.fairScheduler.
Equations
- a.fairSegActions d ps s0 = { get := fun (k : ℕ) => (a.fairScheduler d ps s0 k).1 }.tail
Instances For
a.FairDeliverMsg d ps q says that for any state s of a satisfying q and
any message m which is in-flight in s and whose destination is in ps, d s m
produces a legal finite execution of a in which m is delivered and which ends in
a state satisfying q again.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Re-stating the definition of Algorithm.fairScheduler as a mutual recursion of
Algorithm.fairSegEnds and Algorithm.fairSegActions.
Re-stating the definition of Algorithm.fairScheduler as a mutual recursion of
Algorithm.fairSegEnds and Algorithm.fairSegActions.
If d.ForallActions r, then a.fairSegActions d ps s0 can only use actions satisfying r.
The correctness of d.foldList s ml ms under the assumption a.FairDeliverMsg d ps q.
The correctness of d.scheduleMsgs ps s under the assumption a.FairDeliverMsg d ps q.
The correctness of a.fairSegEnds d ps s0 and a.fairSegActions d ps s0
under the assumption a.FairDeliverMsg d ps q.
Given an infinite sequence of non-empty finite executions of algorithm a,
if all messages with destinations in ps that are in-flight at the beginning of each
finite execution are delivered in that finite execution, then those finite executions can
be concatenated into an infinite execution of a in which every process in ps is fair.
Under the assumption a.FairDeliverMsg d ps q, the infinite sequence of finite executions
of a represented by a.fairSegEnds d ps s0 and a.fairSegActions d ps s0 can be concatenated
into an infinite execution of a in which every process in ps is fair and q is true at
the ends of all those finite executions.
If d.ForallActions r, then the concatenation of all a.fairSegActions d ps s0 segments
can only use actions satisfying r.