AFTD Auto-Formalizing Theoretical Domains

greedy_rc_step

def

For cm : Γ → Γ and S, S' : Finset (List Γ), greedy_rc_step cm S S' holds when S has more than one element and, with V = S ∪ rev_comp cm '' S, there are x, y ∈ V with y ≠ x and y ≠ rev_comp cm x whose string_overlap_len x y is at least string_overlap_len x' y' for every pair x', y' ∈ V with y' ≠ x' and y' ≠ rev_comp cm x', and S' = insert (string_overlap_merge x y) (S \ {x, rev_comp cm x, y, rev_comp cm y}). This is one iteration of GREEDY-RC with arbitrary tie-breaking.

Statement

def greedy_rc_step {Γ : Type*} [DecidableEq Γ] (cm : Γ → Γ)
    (S S' : Finset (List Γ)) : Prop
Defined in
arXiv:2611.16573, Algorithm 2
Verified
14 Nov 2026
Axioms
none listed
Built on 3
  • rev_compThe reverse complement rc(s) of a string s = a_1…a_m under a complement map cm is cm(a_m)…cm(a_1).
  • string_overlap_lenFor two lists x, y : List Γ over an arbitrary alphabet type Γ with decidable equality (strings are lists of letters, not Lean Strings),…
  • string_overlap_mergeFor two lists x, y : List Γ over an alphabet type Γ with decidable equality, the overlap merge ⟨x,y⟩ is the list consisting of the first…
Used by 4

Read back from the Lean

For a type Γ with decidable equality, a complement map cm : Γ → Γ, and finite sets of lists S, S' : Finset (List Γ), greedy_rc_step cm S S' asserts that: 1. S has cardinality strictly greater than 1 (1 < S.card). 2. There exist lists x, y ∈ S ∪ S.image (rev_comp cm) such that: a. y is neither x nor the reverse complement of x (y ≠ x ∧ y ≠ rev_comp cm x). b. For all x', y' ∈ S ∪ S.image (rev_comp cm), if y' ≠ x' and y' ≠ rev_comp cm x', then the string overlap length between x' and y' is at most that between x and y (string_overlap_len x' y' ≤ string_overlap_len x y). c. S' is the finset obtained by removing x, rev_comp cm x, y, and rev_comp cm y from S, and inserting the merged string string_overlap_merge x y.

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

/-- One iteration of the while loop of GREEDY-RC (Algorithm 2), with any tie-breaking. -/
def greedy_rc_step {Γ : Type*} [DecidableEq Γ] (cm : Γ → Γ)
    (S S' : Finset (List Γ)) : Prop :=
  1 < S.card ∧
  ∃ x ∈ S ∪ S.image (rev_comp cm), ∃ y ∈ S ∪ S.image (rev_comp cm),
    (y ≠ x ∧ y ≠ rev_comp cm x) ∧
    (∀ x' ∈ S ∪ S.image (rev_comp cm), ∀ y' ∈ S ∪ S.image (rev_comp cm),
      (y' ≠ x' ∧ y' ≠ rev_comp cm x') →
        string_overlap_len x' y' ≤ string_overlap_len x y) ∧
    S' = insert (string_overlap_merge x y) (S \ {x, rev_comp cm x, y, rev_comp cm y})
See it in the graphDiscuss this resultChallenge it