OAI/Combinatorics/BinaryEdit/MatchingSegments.lean
8 declarations, 0 contain sorry, 0 declared as axioms
- def
OAI.TreeEdit.BinaryLower.segmentIndexline 8Source documentation
Shift an index known to lie in a segment into that segment's index type.
def segmentIndex {α : Type*} (x : List α) (start width : ℕ) (i : Fin x.length) (hlo : start ≤ (i : ℕ)) (hhi : (i : ℕ) < start + width) : Fin ((x.drop start).take width).length := … - theorem
OAI.TreeEdit.BinaryLower.get_segmentIndexline 18Source documentation
Shifting indices into a list segment preserves the selected letter.
theorem get_segmentIndex {α : Type*} (x : List α) (start width : ℕ) (i : Fin x.length) (hlo : start ≤ (i : ℕ)) (hhi : (i : ℕ) < start + width) : ((x.drop start).take width).get (segmentIndex x start width i hlo hhi) = x.get i := by …Mentions: OAI.TreeEdit.BinaryLower.segmentIndex
- theorem
OAI.TreeEdit.BinaryLower.matching_in_segments_le_lcsline 28Source documentation
An increasing matching confined to two intervals is a common subsequence of the corresponding contiguous segments.
theorem matching_in_segments_le_lcs {α : Type*} (x y : List α) {k : ℕ} (i : Fin k → Fin x.length) (j : Fin k → Fin y.length) (hi : StrictMono i) (hj : StrictMono j) (hlabel : ∀ t, x.get (i t) = y.get (j t)) (a b p q : ℕ) (hi_lo : ∀ t, a ≤ (i t : ℕ)) (hi_hi : ∀ t, (i t : ℕ) < a + p) (hj_lo : ∀ t, b ≤ (j t : ℕ)) (hj_hi : ∀ t, (j t : ℕ) < b + q) : k ≤ lcs ((x.drop a).take p) ((y.drop b).take q) := by …Mentions: OAI.TreeEdit.lcs
- theorem
OAI.TreeEdit.BinaryLower.matching_subset_in_segments_le_lcsline 59Source documentation
Restricting a matching to any finite collection of edges lying in two segments gives the same bound for the cardinality of that collection.
theorem matching_subset_in_segments_le_lcs {α : Type*} (x y : List α) {k : ℕ} (i : Fin k → Fin x.length) (j : Fin k → Fin y.length) (hi : StrictMono i) (hj : StrictMono j) (hlabel : ∀ t, x.get (i t) = y.get (j t)) (S : Finset (Fin k)) (a b p q : ℕ) (hi_lo : ∀ t ∈ S, a ≤ (i t : ℕ)) (hi_hi : ∀ t ∈ S, (i t : ℕ) < a + p) (hj_lo : ∀ t ∈ S, b ≤ (j t : ℕ)) (hj_hi : ∀ t ∈ S, (j t : ℕ) < b + q) : S.card ≤ lcs ((x.drop a).take p) ((y.drop b).take q) := by …Mentions: OAI.TreeEdit.lcs
- theorem
OAI.TreeEdit.BinaryLower.matching_subset_in_segments_le_lcs_natline 77Source documentation
Natural-index interface for span-counting arguments.
theorem matching_subset_in_segments_le_lcs_nat {α : Type*} (x y : List α) {k : ℕ} (i j : Fin k → ℕ) (hi : StrictMono i) (hj : StrictMono j) (hix : ∀ t, i t < x.length) (hjy : ∀ t, j t < y.length) (hlabel : ∀ t, x.get ⟨i t, hix t⟩ = y.get ⟨j t, hjy t⟩) (S : Finset (Fin k)) (a b p q : ℕ) (hi_lo : ∀ t ∈ S, a ≤ i t) (hi_hi : ∀ t ∈ S, i t < a + p) (hj_lo : ∀ t ∈ S, b ≤ j t) (hj_hi : ∀ t ∈ S, j t < b + q) : S.card ≤ lcs ((x.drop a).take p) ((y.drop b).take q) := by …Mentions: OAI.TreeEdit.lcs
- theorem
OAI.TreeEdit.BinaryLower.common_sublist_in_segmentsline 91Source documentation
An increasing matching confined to two intervals is a common subsequence of the corresponding contiguous segments.
theorem common_sublist_in_segments {α : Type*} (x y : List α) {k : ℕ} (i : Fin k → Fin x.length) (j : Fin k → Fin y.length) (hi : StrictMono i) (hj : StrictMono j) (hlabel : ∀ t, x.get (i t) = y.get (j t)) (a b p q : ℕ) (hi_lo : ∀ t, a ≤ (i t : ℕ)) (hi_hi : ∀ t, (i t : ℕ) < a + p) (hj_lo : ∀ t, b ≤ (j t : ℕ)) (hj_hi : ∀ t, (j t : ℕ) < b + q) : ∃ z : List α, z.Sublist ((x.drop a).take p) ∧ z.Sublist ((y.drop b).take q) ∧ z.length = k := by … - theorem
OAI.TreeEdit.BinaryLower.common_sublist_subset_in_segmentsline 122Source documentation
Witness form of the restricted matching-to-segment bound.
theorem common_sublist_subset_in_segments {α : Type*} (x y : List α) {k : ℕ} (i : Fin k → Fin x.length) (j : Fin k → Fin y.length) (hi : StrictMono i) (hj : StrictMono j) (hlabel : ∀ t, x.get (i t) = y.get (j t)) (S : Finset (Fin k)) (a b p q : ℕ) (hi_lo : ∀ t ∈ S, a ≤ (i t : ℕ)) (hi_hi : ∀ t ∈ S, (i t : ℕ) < a + p) (hj_lo : ∀ t ∈ S, b ≤ (j t : ℕ)) (hj_hi : ∀ t ∈ S, (j t : ℕ) < b + q) : ∃ z : List α, z.Sublist ((x.drop a).take p) ∧ z.Sublist ((y.drop b).take q) ∧ z.length = S.card := by … - theorem
OAI.TreeEdit.BinaryLower.common_sublist_subset_ofFn_segmentsline 141Source documentation
Raw fixed-length function interface for the segment witness.
theorem common_sublist_subset_ofFn_segments {α : Type*} {n m k : ℕ} (x : Fin n → α) (y : Fin m → α) (i : Fin k → Fin n) (j : Fin k → Fin m) (hi : StrictMono i) (hj : StrictMono j) (hlabel : ∀ t, x (i t) = y (j t)) (S : Finset (Fin k)) (a b p q : ℕ) (hi_lo : ∀ t ∈ S, a ≤ (i t : ℕ)) (hi_hi : ∀ t ∈ S, (i t : ℕ) < a + p) (hj_lo : ∀ t ∈ S, b ≤ (j t : ℕ)) (hj_hi : ∀ t ∈ S, (j t : ℕ) < b + q) : ∃ z : List α, z.Sublist (((List.ofFn x).drop a).take p) ∧ z.Sublist (((List.ofFn y).drop b).take q) ∧ z.length = S.card := by …