Documentation

Gossip.Error.Basic

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
                          theorem Error.mem_invert_iff {n : } {c : Agent} {A : Set Value} {v : Value} :
                          v invert c A (if v.1 = c then (v.1, !v.2) else v) A

                          Membership in invert c A reduces to membership of the "flipped" value in A.

                          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_eq_caller {n : } {a : Agent} {b : { b : Agent // b a }} :
                                @[simp]
                                theorem Error.roleOfIn_eq_callee {n : } {a : Agent} {b : { b : Agent // b a }} :
                                @[simp]
                                theorem Error.roleOfIn_fstE_eq_caller {n : } {a c : Agent} {b : { b : Agent // b a }} :
                                @[simp]
                                theorem Error.roleOfIn_fstE_eq_callee {n : } {a c : Agent} {b : { b : Agent // b a }} :
                                @[simp]
                                theorem Error.roleOfIn_sndE_eq_caller {n : } {a c : Agent} {b : { b : Agent // b a }} :
                                @[simp]
                                theorem Error.roleOfIn_sndE_eq_callee {n : } {a c : Agent} {b : { b : Agent // b a }} :
                                @[simp]
                                theorem Error.roleOfIn_eq_Caller_iff {n✝ : } {a x : Agent} {y : { b : Agent // b x }} :
                                @[simp]
                                theorem Error.roleOfIn_eq_Callee_iff {n✝ : } {a x : Agent} {y : { b : Agent // b x }} :
                                @[simp]
                                theorem Error.roleOfIn_eq_Other_iff {n✝ : } {a x : Agent} {y : { b : Agent // b x }} :
                                @[simp]
                                theorem Error.roleOfIn_fstE_eq_Caller_iff {n✝ : } {a x z : Agent} {y : { b : Agent // b x }} :
                                @[simp]
                                theorem Error.roleOfIn_fstE_eq_Callee_iff {n✝ : } {a x z : Agent} {y : { b : Agent // b x }} :
                                @[simp]
                                theorem Error.roleOfIn_fstE_eq_Other_iff {n✝ : } {a x z : Agent} {y : { b : Agent // b x }} :
                                @[simp]
                                theorem Error.roleOfIn_sndE_eq_Caller_iff {n✝ : } {a x : Agent} {y : { b : Agent // b x }} {z : Agent} :
                                @[simp]
                                theorem Error.roleOfIn_sndE_eq_Callee_iff {n✝ : } {a x : Agent} {y : { b : Agent // b x }} {z : Agent} :
                                @[simp]
                                theorem Error.roleOfIn_sndE_eq_Other_iff {n✝ : } {a x : Agent} {y : { b : Agent // b x }} {z : Agent} :
                                @[simp]
                                theorem Error.roleOfIn_pair_fst {n✝ : } {C : Call} :
                                @[simp]
                                theorem Error.roleOfIn_pair_snd {n✝ : } {C : Call} :

                                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 to get a proof 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.ofLen_length {n k : } (σ : { σ : OSequence // σ.length = k }) :
                                            (↑σ).length = k
                                            @[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_con {n✝ : } {S : Dist} {σ : OSequence} {φ1 φ2 : Form} :
                                                              Sσ (φ1 φ2) Sσ φ1 Sσ φ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 φ
                                                                  theorem Error.not_in_call_equiv_of_equiv {n : } {κ : Call} {σ : Sequence} {o : maxOne (κ :: σ)} {τ : Sequence} {p : maxOne (κ :: τ)} {h1 : OSequence.length τ, = OSequence.length σ, } {h2 : OSequence.length κ :: τ, p = OSequence.length κ :: σ, o} {S T : Dist} (a : Agent) (not_in_call : roleOfIn a κ = Role.Other) (equ_before : equiv a (S, σ, , ) (T, τ, , h1)) :
                                                                  equiv a (S, κ :: σ, o, ) (T, κ :: τ, p, h2)