@@ -6396,19 +6396,36 @@ theorem insert [TransOrd α] (h₁ : t₁.WF) (h₂ : t₂.WF) (h : t₁ ~m t₂
63966396 {k : α} {v : β k} : (t₁.insert k v h₁.balanced).impl ~m (t₂.insert k v h₂.balanced).impl := by
63976397 simp_to_model [insert, Equiv] using List.insertEntry_of_perm _ h.1
63986398
6399+ theorem insert! [TransOrd α] (h₁ : t₁.WF) (h₂ : t₂.WF) (h : t₁ ~m t₂)
6400+ {k : α} {v : β k} : t₁.insert! k v ~m t₂.insert! k v := by
6401+ simpa only [insert_eq_insert!] using h.insert h₁ h₂
6402+
63996403theorem erase [TransOrd α] (h₁ : t₁.WF) (h₂ : t₂.WF) (h : t₁ ~m t₂)
64006404 {k : α} : (t₁.erase k h₁.balanced).impl ~m (t₂.erase k h₂.balanced).impl := by
64016405 simp_to_model [erase, Equiv] using List.eraseKey_of_perm _ h.1
64026406
6407+ theorem erase! [TransOrd α] (h₁ : t₁.WF) (h₂ : t₂.WF) (h : t₁ ~m t₂)
6408+ {k : α} : t₁.erase! k ~m t₂.erase! k := by
6409+ simpa only [erase_eq_erase!] using h.erase h₁ h₂
6410+
64036411theorem insertIfNew [TransOrd α] (h₁ : t₁.WF) (h₂ : t₂.WF) (h : t₁ ~m t₂)
64046412 {k : α} {v : β k} : (t₁.insertIfNew k v h₁.balanced).impl ~m (t₂.insertIfNew k v h₂.balanced).impl := by
64056413 simp_to_model [insertIfNew, Equiv] using List.insertEntryIfNew_of_perm _ h.1
64066414
6415+ theorem insertIfNew! [TransOrd α] (h₁ : t₁.WF) (h₂ : t₂.WF) (h : t₁ ~m t₂)
6416+ {k : α} {v : β k} : t₁.insertIfNew! k v ~m t₂.insertIfNew! k v := by
6417+ simpa only [insertIfNew_eq_insertIfNew!] using h.insertIfNew h₁ h₂
6418+
64076419theorem alter [TransOrd α] [LawfulEqOrd α] (h₁ : t₁.WF) (h₂ : t₂.WF) (h : t₁ ~m t₂)
64086420 {k : α} {f : Option (β k) → Option (β k)} :
64096421 (t₁.alter k f h₁.balanced).impl ~m (t₂.alter k f h₂.balanced).impl := by
64106422 simp_to_model [alter, Equiv] using List.alterKey_of_perm _ h.1
64116423
6424+ theorem alter! [TransOrd α] [LawfulEqOrd α] (h₁ : t₁.WF) (h₂ : t₂.WF) (h : t₁ ~m t₂)
6425+ {k : α} {f : Option (β k) → Option (β k)} :
6426+ t₁.alter! k f ~m t₂.alter! k f := by
6427+ simpa only [alter_eq_alter!] using h.alter h₁ h₂
6428+
64126429theorem modify [TransOrd α] [LawfulEqOrd α] (h₁ : t₁.WF) (h₂ : t₂.WF) (h : t₁ ~m t₂)
64136430 {k : α} {f : β k → β k} : t₁.modify k f ~m t₂.modify k f := by
64146431 simp_to_model [modify, Equiv] using List.modifyKey_of_perm _ h.1
@@ -6417,13 +6434,21 @@ theorem filter (h₁ : t₁.WF) (h₂ : t₂.WF) (h : t₁ ~m t₂) {f : (a : α
64176434 (t₁.filter f h₁.balanced).impl ~m (t₂.filter f h₂.balanced).impl := by
64186435 simpa only [equiv_iff_toListModel_perm, toListModel_filter] using h.impl.filter _
64196436
6437+ theorem filter! (h₁ : t₁.WF) (h₂ : t₂.WF) (h : t₁ ~m t₂) {f : (a : α) → β a → Bool} :
6438+ t₁.filter! f ~m t₂.filter! f := by
6439+ simpa only [filter_eq_filter!] using h.filter h₁ h₂
6440+
64206441theorem map (h : t₁ ~m t₂) {f : (a : α) → β a → γ a} : t₁.map f ~m t₂.map f := by
64216442 simpa only [equiv_iff_toListModel_perm, toListModel_map] using h.impl.map _
64226443
64236444theorem filterMap (h₁ : t₁.WF) (h₂ : t₂.WF) (h : t₁ ~m t₂) {f : (a : α) → β a → Option (γ a)} :
64246445 (t₁.filterMap f h₁.balanced).impl ~m (t₂.filterMap f h₂.balanced).impl := by
64256446 simpa only [equiv_iff_toListModel_perm, toListModel_filterMap] using h.impl.filterMap _
64266447
6448+ theorem filterMap! (h₁ : t₁.WF) (h₂ : t₂.WF) (h : t₁ ~m t₂) {f : (a : α) → β a → Option (γ a)} :
6449+ t₁.filterMap! f ~m t₂.filterMap! f := by
6450+ simpa only [filterMap_eq_filterMap!] using h.filterMap h₁ h₂
6451+
64276452section Const
64286453
64296454variable {β : Type v} {t₁ t₂ : Impl α β} {δ : Type w} {m : Type w → Type w}
@@ -6582,6 +6607,11 @@ theorem constAlter [TransOrd α] (h₁ : t₁.WF) (h₂ : t₂.WF) (h : t₁ ~m
65826607 (Const.alter k f t₁ h₁.balanced).impl ~m (Const.alter k f t₂ h₂.balanced).impl := by
65836608 simp_to_model [Const.alter, Equiv] using List.Const.alterKey_of_perm _ h.1
65846609
6610+ theorem constAlter! [TransOrd α] (h₁ : t₁.WF) (h₂ : t₂.WF) (h : t₁ ~m t₂)
6611+ {k : α} {f : Option β → Option β} :
6612+ Const.alter! k f t₁ ~m Const.alter! k f t₂ := by
6613+ simpa only [Const.alter_eq_alter!] using h.constAlter h₁ h₂
6614+
65856615theorem constModify [TransOrd α] (h₁ : t₁.WF) (h₂ : t₂.WF) (h : t₁ ~m t₂)
65866616 {k : α} {f : β → β} : Const.modify k f t₁ ~m Const.modify k f t₂ := by
65876617 simp_to_model [Const.modify, Equiv] using List.Const.modifyKey_of_perm _ h.1
@@ -6591,9 +6621,9 @@ end Const
65916621variable {t₄ : Impl α β}
65926622
65936623theorem mergeWith [TransOrd α] [LawfulEqOrd α]
6624+ (h : t₁ ~m t₂) (h' : t₃ ~m t₄)
65946625 (h₁ : t₁.WF) (h₂ : t₂.WF)
65956626 (h₃ : t₃.WF) (h₄ : t₄.WF)
6596- (h : t₁ ~m t₂) (h' : t₃ ~m t₄)
65976627 {f : (a : α) → β a → β a → β a} :
65986628 (t₁.mergeWith f t₃ h₁.balanced).impl ~m (t₂.mergeWith f t₄ h₂.balanced).impl := by
65996629 simp only [Impl.mergeWith, h'.foldl_eq h₃ h₄, foldl_eq_foldl]
@@ -6602,6 +6632,14 @@ theorem mergeWith [TransOrd α] [LawfulEqOrd α]
66026632 intro a ha c c' hc
66036633 exact ⟨hc.1 .alter, hc.2 .1 .alter, hc.2 .2 .alter hc.1 hc.2 .1 ⟩
66046634
6635+ theorem mergeWith! [TransOrd α] [LawfulEqOrd α]
6636+ (h : t₁ ~m t₂) (h' : t₃ ~m t₄)
6637+ (h₁ : t₁.WF) (h₂ : t₂.WF)
6638+ (h₃ : t₃.WF) (h₄ : t₄.WF)
6639+ {f : (a : α) → β a → β a → β a} :
6640+ t₁.mergeWith! f t₃ ~m t₂.mergeWith! f t₄ := by
6641+ simpa only [mergeWith_eq_mergeWith!] using h.mergeWith h' h₁ h₂ h₃ h₄
6642+
66056643-- extensionalities
66066644
66076645theorem of_forall_get?_eq [TransOrd α] [LawfulEqOrd α] (h₁ : t₁.WF) (h₂ : t₂.WF) :
0 commit comments