AFTD Auto-Formalizing Theoretical Domains

eval_ordered_triple

def

Given a function chi : OrderedTriple α → ℤˣ assigning units of ℤ to ordered triples in a linearly ordered type α, and elements x, a, b : α with a < b, x ≠ a, and x ≠ b, eval_ordered_triple chi x a b hab hxa hxb evaluates chi at (x, a, b) by returning chi(x, a, b) if x < a, -chi(a, x, b) if a < x < b, and chi(a, b, x) if b < x.

Statement

def eval_ordered_triple {α : Type*} [LinearOrder α] (chi : OrderedTriple α → ℤˣ) (x a b : α) (hab : a < b) (hxa : x ≠ a) (hxb : x ≠ b) : ℤˣ
Defined in
arXiv:2610.03808 Def. 6.1
Verified
26 Oct 2026
Axioms
none listed
Built on 3
  • TotalPreorderA total preorder: a preorder where ≤ is total (complete). This is weaker than LinearOrder — it does NOT require antisymmetry or…
  • 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.
Used by 1
  • is_rank_three_uniform_chirotopeA function chi : OrderedTriple α → ℤˣ assigning units of ℤ to ordered triples in a linearly ordered type α is a uniform rank-3 chirotope…

Read back from the Lean

eval_ordered_triple defines a function that, given a linearly ordered type α, a function chi from OrderedTriple α to the units of integers ℤˣ ({1, -1}), elements x, a, b : α, and proofs hab : a < b, hxa : x ≠ a, and hxb : x ≠ b, returns a unit in ℤˣ evaluated by cases: - If x < a, it returns chi ⟨x, a, b, hx, hab⟩. - If ¬(x < a) and x < b (so a < x < b), it returns -chi ⟨a, x, b, _, hb⟩. - If ¬(x < a) and ¬(x < b) (so a < b < x), it returns chi ⟨a, b, x, hab, _⟩.

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

/-- Evaluation of a chirotope on an ordered triple of distinct elements, accounting for the sign of the sorting permutation. -/
def eval_ordered_triple {α : Type*} [LinearOrder α] (chi : OrderedTriple α → ℤˣ) (x a b : α) (hab : a < b) (hxa : x ≠ a) (hxb : x ≠ b) : ℤˣ :=
  if hx : x < a then
    chi ⟨x, a, b, hx, hab⟩
  else if hb : x < b then
    -chi ⟨a, x, b, lt_of_le_of_ne (not_lt.mp hx) hxa.symm, hb⟩
  else
    chi ⟨a, b, x, hab, lt_of_le_of_ne (not_lt.mp hb) hxb.symm⟩
See it in the graphDiscuss this resultChallenge it