greedy_rc_step
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
- tgreedy_rc_output_sanityWith cm = id, TGREEDY-RC on {12} can output 12.
- greedy_rc_step_sanityWith cm = id, one GREEDY-RC step on {12, 23} gives {123}.
- tgreedy_rc_two_point_five_approx_of_partsIf t is an output of TGREEDY-RC on S, every MGREEDY-RC output T from S is RC-substring-free, GREEDY-RC from any RC-substring-free T to {t}…
- tgreedy_rc_outputFor cm : Γ → Γ, S : Finset (List Γ) and t : List Γ, tgreedy_rc_output cm S t holds when there is T : Finset (List Γ) such that the state…
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})