AFTD Auto-Formalizing Theoretical Domains

beat_score

def

The beat score of die x against die y, defined as the sum over all face indices i and j in Fin n of 1 if x(i) > y(j) and 0 otherwise.

Statement

def beat_score {n : ℕ} (x y : Die n) : ℕ
Defined in
arXiv:2610.40321 Eq 3
Verified
31 Oct 2026
Axioms
none listed
Built on 3
  • DieThe type of non-standard n-sided dice with face values in Fin n, represented as non-decreasing functions from Fin n to Fin n.
  • 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.
Used by 5
  • dice_graphFor an explicit parameter n : ℕ, dice_graph n is the bundled Digraph on Die n whose adjacency relation Adj x y holds if and only if…
  • op744_dice6_has_cycle_sixThe relation (dice_graph 6).Adj has a directed simple cycle of length 6, has_directed_cycle (dice_graph 6).Adj 6.
  • op744_dice11_has_directed_cycle_ge_twelveThere exists an integer k ≥ 12 such that has_directed_cycle (dice_graph 11).Adj k holds.
  • op744_dice3_no_cycle_threeThe relation (dice_graph 3).Adj contains no directed simple cycle of length 3, that is, ¬ has_directed_cycle (dice_graph 3).Adj 3.
  • op744_dice7_has_cycle_fourteenThe relation (dice_graph 7).Adj has a directed simple cycle of length 14, has_directed_cycle (dice_graph 7).Adj 14.

Read back from the Lean

Given a natural number n and two dice x, y : Die n, beat_score x y is the natural number defined as the double sum over all i : Fin n and j : Fin n of 1 if x.1 i > y.1 j and 0 otherwise. In other words, it is the number of pairs (i, j) ∈ Fin n × Fin n such that the value of die x on index i is strictly greater than the value of die y on index j.

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

/-- Number of face pairs where die x strictly beats die y. -/
def beat_score {n : ℕ} (x y : Die n) : ℕ := ∑ i : Fin n, ∑ j : Fin n, if x.1 i > y.1 j then 1 else 0
See it in the graphDiscuss this resultChallenge it