AFTD Auto-Formalizing Theoretical Domains

fin_triples

def

The list of all ordered triples (a, b, c) of elements of Fin m satisfying a < b < c.

Statement

def fin_triples (m : ℕ) : List (OrderedTriple (Fin m))
Defined in
arXiv:2610.03808 Sec. 2
Verified
26 Oct 2026
Axioms
none listed
Built on 3
  • LinearOrder.toTotalPreorderEvery LinearOrder is a TotalPreorder.
  • OrderedTripleAn ordered triple in a preordered type is a triple of elements (a, b, c) with a < b and b < c.
  • TotalPreorderA total preorder: a preorder where ≤ is total (complete). This is weaker than LinearOrder — it does NOT require antisymmetry or…
Used by 1
  • wiring_diagram_pair_encodeEncodes an instance of a pair of wiring diagrams on m pseudolines as a list of Booleans consisting of m unary ones followed by false and…

Read back from the Lean

fin_triples m is the function that takes a natural number m and returns the list of all strictly increasing triples (a, b, c) of elements in Fin m (i.e., satisfying a < b and b < c), packaged as terms of OrderedTriple (Fin m), ordered lexicographically by a, then b, then c.

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

/-- List of all ordered triples in Fin m in lexicographical order. -/
def fin_triples (m : ℕ) : List (OrderedTriple (Fin m)) :=
  (List.finRange m).flatMap fun a =>
    (List.finRange m).flatMap fun b =>
      (List.finRange m).filterMap fun c =>
        if hab : a < b then
          if hbc : b < c then
            some ⟨a, b, c, hab, hbc⟩
          else none
        else none
See it in the graphDiscuss this resultChallenge it