AFTD Auto-Formalizing Theoretical Domains

edge_order_code_top_two

theoremverified

The order consisting of the single edge {1, 0} of the complete graph on two vertices is encoded as false (endpoint 0), then true, true, false (endpoint 1).

Statement

theorem edge_order_code_top_two :
    edge_order_code [(⟨s(1, 0), by simp⟩ : (⊤ : SimpleGraph (Fin 2)).edgeSet)] =
      [false, true, true, false]
Source
Sanity check of edge_order_code (OP-851 encoding).
Verified
07 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
  • edge_order_codeThe binary encoding of a querying order (a list of edges of a graph on vertices 0..n-1): the edges in order, each edge {i, j} written as…
  • nat_self_delimiting_codeThe self-delimiting binary code of a natural number m: each bit b of the binary expansion of m (least significant bit first, as in…

The proof, explained

The single edge {1, 0} in the complete graph on two vertices is encoded by ordering its endpoints as 0 and 1. The vertex 0 is encoded as [false] and 1 as [true, true, false], producing the concatenated bit list [false, true, true, false]. Because all operations are finite and computable, Lean verifies the identity by direct computation (`decide`).

  1. The unordered pair s(1, 0) is an edge of the complete graph on two vertices. automation

    In the complete graph ⊤ on Fin 2, two vertices are connected if and only if they are distinct. The `simp` tactic simplifies this membership condition to 1 ≠ 0 and discharges it.

    line 2

        edge_order_code [(⟨s(1, 0), by simp⟩ : (⊤ : SimpleGraph (Fin 2)).edgeSet)] =
  2. The edge order code of the single-edge list [s(1, 0)] equals [false, true, true, false]. automation

    The definition `edge_order_code` processes the edge by sorting its endpoints to min(1, 0) = 0 and max(1, 0) = 1, encodes 0 as `[false]` and 1 as `[true, true, false]`, and concatenates the results. Because this evaluation involves only finite concrete types and computable functions, the `decide` tactic checks the equality by direct computation.

    line 4

      decide

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

theorem edge_order_code_top_two :    edge_order_code [(⟨s(1, 0), by simp⟩ : (⊤ : SimpleGraph (Fin 2)).edgeSet)] =      [false, true, true, false] := by  decide
See it in the graphDiscuss this resultChallenge it