Encounters and reachability: helper lemmas (CRN-3) #
Generic facts about Protocol.interact, Protocol.Step, Protocol.Reaches and
Protocol.OutputStable, used by all constructions of CRN-3, and two counting lemmas for sums
over agents in which only the two agents of an encounter change.
theorem
Crn.Protocol.OutputStable.reaches
{X : Type u_1}
{Q : Type u_2}
{n : ℕ}
{P : Protocol X Q}
{b : Bool}
{c d : Fin n → Q}
(hc : P.OutputStable b c)
(h : P.Reaches c d)
:
P.OutputStable b d
Output-stability is inherited along reachability.
theorem
Crn.Protocol.outputStable_of_invariant
{X : Type u_1}
{Q : Type u_2}
{n : ℕ}
{P : Protocol X Q}
{I : (Fin n → Q) → Prop}
(hI : ∀ (c d : Fin n → Q), I c → P.Step c d → I d)
{b : Bool}
(hb : ∀ (c : Fin n → Q), I c → ∀ (v : Fin n), P.output (c v) = b)
{c : Fin n → Q}
(hc : I c)
:
P.OutputStable b c
A property preserved by every step, under which all agents output b, gives
output-stability.
theorem
Crn.sum_comp_eq_sum_counts
{X : Type u_1}
{n : ℕ}
[Fintype X]
[DecidableEq X]
{M : Type u_3}
[AddCommMonoid M]
(ι : Fin n → X)
(F : X → M)
:
A sum over agents of a function of their input symbols, grouped by symbol:
∑_w F(ι w) = ∑_i (counts ι)ᵢ • F i.