AFTD Auto-Formalizing Theoretical Domains

poset_max_elements

def

Given a natural number n, a partial order P on Fin n, and a finite subset S of Fin n, the subset of S (as a Finset) consisting of all elements maximal in S with respect to P.

Statement

noncomputable def poset_max_elements {n : ℕ} (P : PartialOrder (Fin n)) (S : Finset (Fin n)) : Finset (Fin n)
Defined in
arXiv:2610.18740 Section 5
Verified
21 Oct 2026
Axioms
none listed

Read back from the Lean

Given a natural number n, a partial order P on Fin n, and a finite subset S of Fin n, poset_max_elements P S is defined as the sub-finset of S consisting of all elements x ∈ S such that for every y ∈ S, if x ≤ y (according to the partial order P), then y = x (i.e., the set of maximal elements of S under P).

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 set of maximal elements of a subset in a partial order on Fin n. -/
noncomputable def poset_max_elements {n : ℕ} (P : PartialOrder (Fin n)) (S : Finset (Fin n)) : Finset (Fin n) := open scoped Classical in
  letI := P
  Finset.filter (fun x => ∀ y ∈ S, x ≤ y → y = x) S
See it in the graphDiscuss this resultChallenge it