Documentation

Gossip.Error.SyncCorrection

Synchronous One-Error Gossip with Correction #

Basics #

Here we define: agents, values, distributions, calls, sequents.

We use n for the number of agents.

@[reducible, inline]
abbrev Error.Agent {n : } :
Equations
Instances For
    @[reducible, inline]
    abbrev Error.Value {n : } :
    Equations
    Instances For

      We allow writing just the agent a for the value ⟨a, true⟩.

      Equations

      We write ‾a for the value ⟨a, false⟩.

      Equations
      Instances For
        @[reducible, inline]
        abbrev Error.Dist {n : } :

        An initial secret distribution, each agent only has their own value.

        Equations
        Instances For
          def Error.Dist.switch {n : } :
          AgentDistDist

          In the given distribution, invert the value for this agent i

          Equations
          Instances For
            inductive Error.Call {n : } :
            Instances For
              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

                    The pair of agents in the call, ignoring whether an error is made.

                    Equations
                    Instances For
                      @[reducible, inline]
                      abbrev Error.Sequence {n : } :

                      (Def 2) A sequence is a list of calls. For easy pattern matching this is in reverse order: the newest call is the first element.

                      Equations
                      Instances For
                        def Error.invert {n : } :

                        Flip the value of the secret of this agent in the given set.

                        Equations
                        Instances For

                          Syntax #

                          inductive Error.Form {n : } :

                          (Def 3) Logical language

                          Instances For
                            def Error.Form.length {n : } :
                            Form
                            Equations
                            Instances For

                              Roles #

                              inductive Error.Role :
                              • Caller : Role
                              • Callee : Role
                              • Other : Role

                                Not participating in the call

                              Instances For
                                Equations
                                @[simp]
                                theorem Error.roleOfIn_a {n✝ : } {a b : Agent} :
                                @[simp]
                                theorem Error.roleOfIn_eq_Caller_iff {n✝ : } {a x y : Agent} :
                                @[simp]
                                theorem Error.roleOfIn_eq_Callee_iff {n✝ : } {a x y : Agent} :
                                @[simp]
                                theorem Error.roleOfIn_eq_Other_iff {n✝ : } {a x y : Agent} :
                                @[simp]
                                theorem Error.roleOfIn_fstE_eq_Caller_iff {n✝ : } {a x z y : Agent} :
                                @[simp]
                                theorem Error.roleOfIn_fstE_eq_Callee_iff {n✝ : } {a x z y : Agent} :
                                @[simp]
                                theorem Error.roleOfIn_fstE_eq_Other_iff {n✝ : } {a x z y : Agent} :
                                @[simp]
                                theorem Error.roleOfIn_sndE_eq_Caller_iff {n✝ : } {a x y z : Agent} :
                                @[simp]
                                theorem Error.roleOfIn_sndE_eq_Callee_iff {n✝ : } {a x y z : Agent} :
                                @[simp]
                                theorem Error.roleOfIn_sndE_eq_Other_iff {n✝ : } {a x y z : Agent} :
                                def Error.other {n : } (i : Agent) (c : Call) :

                                Who is the other agent than i in this call? If i is not in the call, return caller.

                                Equations
                                Instances For

                                  Sequences with at most one transmission error #

                                  This sequence contains no transmission errors.

                                  Equations
                                  Instances For
                                    @[simp]
                                    def Error.maxOne {n : } :

                                    This sequence contains at most one transmission error.

                                    Equations
                                    Instances For
                                      @[simp]
                                      theorem Error.maxOne_nil {n : } :
                                      theorem Error.Sequence.maxOne_cons {n✝ : } {C : Call} {σ : List Call} :
                                      maxOne (C :: σ)maxOne σ

                                      If o proves that C :: σ has at most one error then we use the short notation ⁻o for the prove that σ has at most one error.

                                      Equations
                                      Instances For

                                        Sequence with at most one error.

                                        Equations
                                        Instances For

                                          Subsequence relation: σ⊑τ means that τ extends σ. Because sequences are lists with the newest call first we define this as List.IsSuffix σ τ.

                                          Equations
                                          Instances For
                                            Equations
                                            Instances For
                                              @[simp]
                                              @[simp]
                                              theorem Error.OSequence.maxOne {n : } {σ : OSequence} :

                                              Semantics #

                                              @[irreducible]
                                              def Error.resultSet {n : } (i : Agent) :

                                              (Def 4) Semantics of call. What values does this agent have after this sequence?

                                              Equations
                                              Instances For
                                                @[irreducible]
                                                def Error.contribSet {n : } (S : Dist) (σ : OSequence) :

                                                Right after sequence σ, what values will caller and callee contribute to the call?

                                                Equations
                                                Instances For
                                                  @[irreducible]
                                                  def Error.equiv {n k : } (a : Agent) :
                                                  Dist × { σ : OSequence // σ.length = k }Dist × { σ : OSequence // σ.length = k }Prop

                                                  (Def 5) Observation relation. This is synchronous.

                                                  Equations
                                                  Instances For
                                                    @[irreducible]
                                                    def Error.eval {n : } :
                                                    DistOSequenceFormProp

                                                    (Def 6) Semantics.

                                                    Equations
                                                    Instances For
                                                      Equations
                                                      • One or more equations did not get rendered due to their size.
                                                      Instances For
                                                        @[simp]
                                                        theorem Error.resultSet_nil {n : } {o : maxOne []} {S : Dist} {i : Agent} :
                                                        @[simp]
                                                        theorem Error.equiv_nil {n✝ : } {i : Agent} {S : Dist} {o1 : maxOne []} {a✝ : } {h1 : OSequence.length [], o1 = a✝} {T : Dist} {o2 : maxOne []} {h2 : OSequence.length [], o2 = a✝} :
                                                        equiv i (S, [], o1, h1) (T, [], o2, h2) S i = T i

                                                        Notation and Abbreviations #

                                                        We write v @ a to say that agent a has value v.

                                                        Equations
                                                        Instances For
                                                          Equations
                                                          • One or more equations did not get rendered due to their size.
                                                          Instances For
                                                            Equations
                                                            • One or more equations did not get rendered due to their size.
                                                            Instances For
                                                              def Error.valid {n : } (φ : Form) :

                                                              Validity of formulas

                                                              Equations
                                                              Instances For
                                                                theorem Error.eval_biimpl {n✝ : } {S : Dist} {σ : OSequence} {φ1 φ2 : Form} :
                                                                Sσ ( ¬'( ¬' ¬'φ1 ¬'φ2) ¬'( ¬' ¬'φ2 ¬'φ1)) (Sσ φ1 Sσ φ2)
                                                                theorem Error.eval_impl {n✝ : } {S : Dist} {σ : OSequence} {φ1 φ2 : Form} :
                                                                Sσ ( ¬'( ¬' ¬'φ1 ¬'φ2)) Sσ φ1Sσ φ2
                                                                theorem Error.eval_dis {n✝ : } {S : Dist} {σ : OSequence} {φ1 φ2 : Form} :
                                                                Sσ ( ¬'( ¬'φ1 ¬'φ2)) Sσ φ1 Sσ φ2

                                                                The observation relation is an equivalence #

                                                                def Error.equi {n : } (a : Agent) ( : Dist × OSequence) :

                                                                An abbreviation to easily say that we have the same length and (can thus say) equiv.

                                                                Equations
                                                                Instances For
                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For
                                                                    theorem Error.equi_of_equiv {n✝ : } {a : Agent} {S : Dist} {σ : OSequence} {a✝ : } {h1 : σ.length = a✝} {T : Dist} {τ : OSequence} {h2 : τ.length = a✝} :
                                                                    equiv a (S, σ, h1) (T, τ, h2)(S, σ) ~_ a(T, τ)
                                                                    theorem Error.equiv_of_equi {n✝ : } {a : Agent} {S : Dist} {σ : OSequence} {T : Dist} {τ : OSequence} {a✝ : } {h1 : σ.length = a✝} {h2 : τ.length = a✝} :
                                                                    (S, σ) ~_ a(T, τ)equiv a (S, σ, h1) (T, τ, h2)
                                                                    theorem Error.sameRole_of_equiv {n✝ : } {a : Agent} {S : Dist} {C₁ : Call} {σ : List Call} {o1 : maxOne (C₁ :: σ)} {a✝ : } {h1 : OSequence.length C₁ :: σ, o1 = a✝} {T : Dist} {C₂ : Call} {τ : List Call} {o2 : maxOne (C₂ :: τ)} {h2 : OSequence.length C₂ :: τ, o2 = a✝} :
                                                                    equiv a (S, C₁ :: σ, o1, h1) (T, C₂ :: τ, o2, h2)roleOfIn a C₁ = roleOfIn a C₂
                                                                    @[simp, irreducible]
                                                                    theorem Error.equiv_refl {n : } {a : Agent} {S : Dist} {k : } {σ : { σ : OSequence // σ.length = k }} :
                                                                    equiv a (S, σ) (S, σ)
                                                                    theorem Error.equiv_symm {n : } {i : Agent} {m : } {S : Dist} {σ : OSequence} {h1 : σ.length = m} {T : Dist} {τ : OSequence} {h2 : τ.length = m} :
                                                                    equiv i (S, σ, h1) (T, τ, h2) equiv i (T, τ, h2) (S, σ, h1)
                                                                    theorem Error.equiv_trans {n : } {a : Agent} {m : } {S : Dist} {σ : OSequence} {h1 : σ.length = m} {T : Dist} {τ : OSequence} {h2 : τ.length = m} {R : Dist} {ρ : OSequence} {h3 : ρ.length = m} :
                                                                    equiv a (S, σ, h1) (T, τ, h2)equiv a (T, τ, h2) (R, ρ, h3)equiv a (S, σ, h1) (R, ρ, h3)

                                                                    The observation relation equiv $∼_a$ is an equivalence relation.

                                                                    theorem Error.equiv_then_know_same {n : } {a : Agent} {m : } {S : Dist} {σ : OSequence} {h1 : σ.length = m} {T : Dist} {τ : OSequence} {h2 : τ.length = m} (equ : equiv a (S, σ, h1) (T, τ, h2)) (φ : Form) :
                                                                    Sσ Form.K a φ Tτ Form.K a φ

                                                                    Properties of the Semantics #

                                                                    theorem Error.indistinguishable_then_same_values {n : } {a : Agent} {S T : Dist} {σ τ : OSequence} :
                                                                    (S, σ) ~_ a(T, τ)Sσa = Tτa

                                                                    Lemma 7

                                                                    theorem Error.true_of_knowldege {n : } {S : Dist} {σ : OSequence} {a : Agent} {φ : Form} :
                                                                    Sσ Form.K a φSσ φ

                                                                    Knowledge is truthful. This follows from equiv_refl.

                                                                    theorem Error.know_self {n✝ : } {a : Agent} {S T : Dist} (m : ) (σ τ : OSequence) (h1 : σ.length = m) (h2 : List.length τ = m) :
                                                                    equiv a (S, σ, h1) (T, τ, h2)S a = T a

                                                                    Agents know their own initial state. This is not the same as Lemma 7.

                                                                    theorem Error.local_is_known {n : } {a b : Agent} (k : Bool) :
                                                                    ( ¬'( ¬' ¬'(b, k)@a ¬'Form.K a ((b, k)@a))) ( ¬'( ¬' ¬' ¬'(b, k)@a ¬'Form.K a ( ¬'(b, k)@a)))

                                                                    Lemma 8. The truth value of any $b_a$ atom is known by agent $a$. Note that k here says whether we have $b$ or $\overline{b}$.

                                                                    @[simp]
                                                                    theorem Error.stubbornness {n✝ : } {S : Dist} {a : Agent} {k : Bool} (m : ) (σ : OSequence) (h : σ.length = m) :
                                                                    Sσ (a, k)@a S a = k

                                                                    Corollary 12. Agents are stubborn about their own secrets.

                                                                    @[simp]
                                                                    theorem Error.not_notMem_resultSet {n✝ : } {b : Agent} {S : Dist} {σ : OSequence} :
                                                                    (b, !S b)Sσb

                                                                    A useful corollary of stubbornness.

                                                                    theorem Error.knowledge_of_secrets_is_preserved' {n✝ : } {S : Dist} {σ τ : OSequence} {a b : Agent} (k : Bool) (hKv : Sσ Form.K a ((b, k)@b)) (hSub : σ <:+ τ) :
                                                                    Sτ Form.K a ((b, k)@b)

                                                                    Lemma 9. Parts (i) and (ii) are given by the two k values. The proof here uses stubbornness.

                                                                    theorem Error.knowledge_of_secrets_is_preserved {n : } {S : Dist} {σ τ : OSequence} {a b : Agent} (hKv : Sσ ( ¬'( ¬'Form.K a ((b, true)@b) ¬'Form.K a ((b, false)@b)))) (hSub : σ <:+ τ) :

                                                                    Corollary 10. Knowledge of secrets is preserved.

                                                                    theorem Error.know_your_own {n : } {a : Agent} :

                                                                    Agents know their own value. Follows from stubbornness.

                                                                    theorem Error.not_in_call_then_invariant_resultSet {n : } {a : Agent} {C : Call} (h : roleOfIn a C = Role.Other) (S : Dist) (σ : List Call) (o : maxOne (C :: σ)) :
                                                                    SC :: σ, oa = Sσ, a

                                                                    Helper for Prop 13 "iff (call semantics)"

                                                                    theorem Error.not_in_call_then_invariant_kv {n : } {a : Agent} {C : Call} (h : roleOfIn a C = Role.Other) (b : Agent) (S : Dist) (σ : List Call) (o : maxOne (C :: σ)) :

                                                                    Helper for Prop 13 "iff (semantics of formulas and observation relation)"

                                                                    theorem Error.not_in_call_then_invariant {n : } {k : Bool} {a : Agent} {C : Call} (h : roleOfIn a C = Role.Other) (b : Agent) (S : Dist) (σ : List Call) (o : maxOne (C :: σ)) :
                                                                    SC :: σ, o Form.K a ((b, k)@b) Sσ, Form.K a ((b, k)@b)

                                                                    Stronger value-specific helper for Prop 13 "iff (semantics of formulas and observation relation)"

                                                                    theorem Error.knowledge_implies_correct_belief {n : } {a b : Agent} {k : Bool} :
                                                                    ( ¬'( ¬' ¬'Form.K a ((b, k)@b) ¬'((b, k)@b (b, k)@a ¬'(b, !k)@a)))

                                                                    Proposition 13.

                                                                    theorem Error.knowledge_is_justified_true_belief {k : Bool} {n : } {a b : Agent} :
                                                                    ( ¬'( ¬' ¬'Form.K a ((b, k)@b) ¬'Form.K a ((b, k)@b (b, k)@a ¬'(b, !k)@a)) ¬'( ¬' ¬'Form.K a ((b, k)@b (b, k)@a ¬'(b, !k)@a) ¬'Form.K a ((b, k)@b)))

                                                                    Corollary 14.

                                                                    Examples #

                                                                    def Error.ini (n : ) :

                                                                    Initial distribution with all values set to true.

                                                                    Equations
                                                                    Instances For

                                                                      Correct belief need not imply knowledge: given ini 2, after an initial call ab agent a correclty believes b, but a does not know the secret of b, because a also considers it possible that the call was a b^b instead.