AFTD Auto-Formalizing Theoretical Domains

handshake_update_contam

def

The updated contamination map after a handshake: players add their germs to the glove sides they touch directly, and in a double handshake the outer sides of the two gloves share their contaminants.

Statement

def handshake_update_contam {V : Type*} {Γ : Type*} [DecidableEq Γ] (h : Handshake V Γ) (t : Γ × Bool → Set V) : Γ × Bool → Set V
Defined in
scout/2610-17602-clean-handshake-sequences.md:176
Verified
18 Oct 2026
Axioms
none listed
Built on 2
  • HandshakeA handshake between vertices in $V$ using gloves from $\Gamma$, which is either single-gloved (one vertex wears a glove side inside, the…
  • opp_glove_sideThe opposite side of a glove side $(g, b)$ in $\Gamma \times \mathrm{Bool}$ is $(g, \neg b)$, representing the inside-out orientation of…
Used by 9
  • seq_touchers_subset_contamContamination is monotone in the following sense: after running the sequence seq from the contamination map t, the contamination of…
  • glove_number_k3The glove number of the complete graph $K_3$ is equal to 2.
  • CleanHandshakeSeqInductive predicate stating that a sequence of handshakes is clean when executed starting from an initial contamination map $t$.
  • glove_number_complete_graph_upper_boundFor all integers $n \ge 2$, the glove number of the complete graph $K_n$ is at most $n - 1$.
  • handshake_clean_update_contam_subset_toucherIf the handshake h is clean with respect to the contamination map t and the vertex v touches the side s during h, then after…
  • glove_number_complete_graph_posFor every integer $n \ge 2$, the glove number of the complete graph $K_n$ is at least 1.
  • seq_contamThe contamination map obtained by running the handshake sequence seq starting from the contamination map t. (This is the index-free…
  • seq_touchers_subsingletonIn a clean handshake sequence, each glove side is directly touched by at most one vertex: the set of touching vertices of a side is a…
  • has_clean_handshake_seq_succIf a graph $G$ admits a clean handshake sequence with $k$ gloves, then it admits one with $k+1$ gloves: an extra glove can be left unused.

Read back from the Lean

handshake_update_contam defines a function taking a handshake h : Handshake V Γ and a contamination map t : Γ × Bool → Set V, returning an updated contamination map of type Γ × Bool → Set V. For an input s : Γ × Bool: - If h is Handshake.single x a y: - If s = a, it returns t a ∪ {x}. - Else if s = opp_glove_side a, it returns t (opp_glove_side a) ∪ {y}. - Otherwise, it returns t s. - If h is Handshake.double x a b y: - If s = a, it returns t a ∪ {x}. - Else if s = b, it returns t b ∪ {y}. - Else if s = opp_glove_side a ∨ s = opp_glove_side b, it returns t (opp_glove_side a) ∪ t (opp_glove_side b). - Otherwise, it returns t s.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

Lean source view module on GitHub

/-- Contamination update rule following a handshake. -/
def handshake_update_contam {V : Type*} {Γ : Type*} [DecidableEq Γ] (h : Handshake V Γ) (t : Γ × Bool → Set V) : Γ × Bool → Set V := fun s =>
    match h with
    | .single x a y =>
        if s = a then t a ∪ {x}
        else if s = opp_glove_side a then t (opp_glove_side a) ∪ {y}
        else t s
    | .double x a b y =>
        if s = a then t a ∪ {x}
        else if s = b then t b ∪ {y}
        else if s = opp_glove_side a ∨ s = opp_glove_side b then
          t (opp_glove_side a) ∪ t (opp_glove_side b)
        else t s
See it in the graphDiscuss this resultChallenge it