AFTD Auto-Formalizing Theoretical Domains

two_part_triple_sign

def

Given a natural number m, an integer-valued function Z : Fin m → Fin m → ℤ, and a finite set T : Finset (Sum (Fin m) (Fin m)), two_part_triple_sign m Z T is the integer defined as follows: let TA = {a : Fin m | Sum.inl a ∈ T} and TB = {b : Fin m | Sum.inr b ∈ T}; if (TA.card = 3 ∧ TB.card = 0) ∨ (TA.card = 0 ∧ TB.card = 3) then 1, else if TA.card = 1 ∧ TB.card = 2 then -1, else if TA.card = 2 ∧ TB.card = 1 then - ∏ a ∈ TA, ∏ b ∈ TB, Z a b, else 0.

Statement

def two_part_triple_sign (m : ℕ) (Z : Fin m → Fin m → ℤ) (T : Finset (Sum (Fin m) (Fin m))) : ℤ
Defined in
scout/2611-32833-even-quartets-and-the-maximum-density-of-a-simplical-3-cocy.md:150
Verified
29 Nov 2026
Axioms
none listed
Used by 1
  • two_part_even_quartetsGiven m : ℕ and a sign matrix Z : Fin m → Fin m → ℤ, two_part_even_quartets m Z is the collection of 4-element subsets Q ⊆ Sum (Fin m)…

Read back from the Lean

Given a natural number m, a matrix/function Z : Fin m → Fin m → ℤ, and a finite subset T of Fin m ⊕ Fin m, two_part_triple_sign m Z T is the integer defined as follows: Let TA = {a : Fin m | Sum.inl a ∈ T} and TB = {b : Fin m | Sum.inr b ∈ T}. - If (|TA| = 3 and |TB| = 0) or (|TA| = 0 and |TB| = 3), the result is 1. - Otherwise, if |TA| = 1 and |TB| = 2, the result is -1. - Otherwise, if |TA| = 2 and |TB| = 1, the result is the negation of the product over all a ∈ TA and b ∈ TB of Z a b (i.e. - ∏ a ∈ TA, ∏ b ∈ TB, Z a b). - Otherwise, the result is 0.

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 sign of a triple in the two-part sign matrix construction. -/
def two_part_triple_sign (m : ℕ) (Z : Fin m → Fin m → ℤ) (T : Finset (Sum (Fin m) (Fin m))) : ℤ :=
  let TA := (Finset.univ : Finset (Fin m)).filter (fun a => Sum.inl a ∈ T)
  let TB := (Finset.univ : Finset (Fin m)).filter (fun b => Sum.inr b ∈ T)
  if (TA.card = 3 ∧ TB.card = 0) ∨ (TA.card = 0 ∧ TB.card = 3) then 1
  else if TA.card = 1 ∧ TB.card = 2 then -1
  else if TA.card = 2 ∧ TB.card = 1 then - ∏ a ∈ TA, ∏ b ∈ TB, Z a b
  else 0
See it in the graphDiscuss this resultChallenge it