AFTD Auto-Formalizing Theoretical Domains

merge_adjacent_blocks

def

For a type α with [DecidableEq α], a list of finite sets l : List (Finset α), and an index t : ℕ, merge_adjacent_blocks l t replaces the blocks at indices t and t + 1 with their union l[t] ∪ l[t + 1], returning the list l unmodified if t + 1 ≥ l.length or if l has fewer than two elements.

Statement

def merge_adjacent_blocks {α : Type*} [DecidableEq α] : List (Finset α) → ℕ → List (Finset α)
Defined in
arXiv:2611.34537 Section 1
Verified
27 Nov 2026
Axioms
none listed
Used by 1
  • is_child_ofFor a finite type α with decidable equality and ordered set partitions a and b of α, b is a child of a (is_child_of b a) if there exists…

Read back from the Lean

A recursive function merge_adjacent_blocks that takes a type α with decidable equality, a list l of finite sets of α (List (Finset α)), and a natural number t : ℕ. It merges the adjacent sets at 0-based index t and t + 1 into their union: - If t = 0 and the list has at least two elements b₁ :: b₂ :: rest, it returns (b₁ ∪ b₂) :: rest. - If t = s + 1 and the list is non-empty b :: rest, it returns b :: merge_adjacent_blocks rest s. - In all other cases (i.e. when t + 1 ≥ l.length), it returns l unchanged.

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

/-- Merging adjacent blocks at index t in a list of blocks, returning the list unchanged if out of bounds. -/
def merge_adjacent_blocks {α : Type*} [DecidableEq α] : List (Finset α) → ℕ → List (Finset α)
| b₁ :: b₂ :: rest, 0 => (b₁ ∪ b₂) :: rest
| b :: rest, t + 1 => b :: merge_adjacent_blocks rest t
| l, _ => l
See it in the graphDiscuss this resultChallenge it