@@ -308,17 +308,17 @@ theorem Zipper.prependMap_invariant [Ord α] [TransOrd α] {t : Internal.Impl α
308308 apply Or.elim mem₁
309309 . intro eq_key
310310 rw [eq_key]
311- exact @ Internal.Impl.Ordered.compare_left α β _ _ k v l r ord_t k₂ mem₂
311+ exact Internal.Impl.Ordered.compare_left ord_t mem₂
312312 . intro hyp₂
313313 apply Or.elim hyp₂
314314 . intro in_r
315315 apply TransCmp.lt_trans
316- . exact @ Internal.Impl.Ordered.compare_left α β _ _ k v l r ord_t k₂ mem₂
316+ . exact Internal.Impl.Ordered.compare_left ord_t mem₂
317317 . rw [Internal.Impl.toList_eq_toListModel] at in_r
318- exact @ Internal.Impl.Ordered.compare_right α β _ _ k v l r ord_t k₁ in_r
318+ exact Internal.Impl.Ordered.compare_right ord_t in_r
319319 . intro in_z
320- specialize hyp k₁ in_z k₂ ( by simp [mem₂])
321- exact hyp
320+ apply hyp k₁ in_z k₂
321+ simp [mem₂]
322322
323323theorem Zipper.prependMap_done_invariant [Ord α] [TransOrd α] {t : Internal.Impl α β}
324324 {ord_t : t.Ordered} :
@@ -685,4 +685,43 @@ public theorem toList_rcxIter {α β} [Ord α] [TransOrd α]
685685 exact t_ord
686686
687687end Rcx
688+
689+ section Rcc
690+
691+ @[always_inline]
692+
693+ public def Rcc [Ord α] (t : Internal.Impl α β) (lower_bound : α) (upper_bound : α) : Iter (α := RxcIterator α β compare) ((a : α) × β a) :=
694+ ⟨RxcIterator.mk (Zipper.prependMapGE t lower_bound .done) upper_bound⟩
695+
696+ public theorem toList_rccIter {α β} [Ord α] [TransOrd α]
697+ {t : Internal.Impl α β} {t_ord : t.Ordered} {lower_bound upper_bound : α} :
698+ (Rcc t lower_bound upper_bound : Iter (Sigma β)).toList =
699+ t.toList.filter (fun e => (compare e.fst lower_bound).isGE ∧ (compare e.fst upper_bound).isLE) := by
700+ simp [Rcc]
701+ rw [toList_rxcIter]
702+ rw [toList_eq_takeWhile_list]
703+ . conv =>
704+ rhs
705+ lhs
706+ ext x
707+ rw [Bool.and_comm]
708+ rw [← List.filter_filter]
709+ congr 1
710+ rw [← prepend_eq_prependGE]
711+ . rw [Zipper.prependMap_to_list]
712+ rw [Internal.Impl.prune_LE_filter]
713+ simp [Zipper.toList]
714+ . exact t_ord
715+ . rw [← prepend_eq_prependGE]
716+ . simp [Zipper.prependMap_to_list]
717+ simp [Zipper.toList]
718+ rw [Internal.Impl.prune_LE_filter]
719+ apply List.Pairwise.filter
720+ simp [Internal.Impl.Ordered] at t_ord
721+ rw [Internal.Impl.toList_eq_toListModel]
722+ exact t_ord
723+ . exact t_ord
724+
725+ end Rcc
726+
688727end Std.DTreeMap
0 commit comments