AFTD Auto-Formalizing Theoretical Domains

perm_edit_cost

def

The edit cost $\mathcal{C}_{\mathsf{ed}}(\pi)$ of a permutation $\pi$ between two $n \times n$ matrices $A$ and $B$ is the sum over all $v, v' \in \{0, \dots, n-1\}$ of $|A(v, v') - B(\pi(v), \pi(v'))|$.

Statement

def perm_edit_cost {n : ℕ} (A B : Matrix (Fin n) (Fin n) ℝ) (π : Equiv.Perm (Fin n)) : ℝ
Defined in
arXiv:2611.05048 Section 3, line 325
Verified
04 Nov 2026
Axioms
none listed
Used by 3

Read back from the Lean

For a natural number n, two n × n real matrices A and B (represented as functions Fin n → Fin n → ℝ), and a permutation π of Fin n, perm_edit_cost A B π is defined as the real number equal to the double sum over all v, v' : Fin n of |A v v' - B (π v) (π v')|.

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

/-- The edit cost of a permutation π between two matrices A and B. -/
def perm_edit_cost {n : ℕ} (A B : Matrix (Fin n) (Fin n) ℝ) (π : Equiv.Perm (Fin n)) : ℝ := ∑ v : Fin n, ∑ v' : Fin n, |A v v' - B (π v) (π v')|
See it in the graphDiscuss this resultChallenge it