diff --git a/src/Std/Data/DHashMap/Lemmas.lean b/src/Std/Data/DHashMap/Lemmas.lean index 3349405ac3..0de0968b5e 100644 --- a/src/Std/Data/DHashMap/Lemmas.lean +++ b/src/Std/Data/DHashMap/Lemmas.lean @@ -1395,6 +1395,13 @@ theorem insertMany_cons {l : List ((a : α) × β a)} {k : α} {v : β k} : m.insertMany (⟨k, v⟩ :: l) = (m.insert k v).insertMany l := Subtype.eq (congrArg Subtype.val (Raw₀.insertMany_cons ⟨m.1, m.2.size_buckets_pos⟩) :) +theorem insertMany_append {l₁ l₂ : List ((a : α) × β a)} : + m.insertMany (l₁ ++ l₂) = (m.insertMany l₁).insertMany l₂ := by + induction l₁ generalizing m with + | nil => simp + | cons hd tl ih => + rw [List.cons_append, insertMany_cons, insertMany_cons, ih] + @[elab_as_elim] theorem insertMany_ind {motive : DHashMap α β → Prop} (m : DHashMap α β) (l : ρ) (init : motive m) (insert : ∀ m a b, motive m → motive (m.insert a b)) : @@ -1589,6 +1596,13 @@ theorem insertMany_cons {l : List (α × β)} {k : α} {v : β} : insertMany m (⟨k, v⟩ :: l) = insertMany (m.insert k v) l := Subtype.eq (congrArg Subtype.val (Raw₀.Const.insertMany_cons ⟨m.1, m.2.size_buckets_pos⟩) :) +theorem insertMany_append {l₁ l₂ : List (α × β)} : + insertMany m (l₁ ++ l₂) = insertMany (insertMany m l₁) l₂ := by + induction l₁ generalizing m with + | nil => simp + | cons hd tl ih => + rw [List.cons_append, insertMany_cons, insertMany_cons, ih] + @[elab_as_elim] theorem insertMany_ind {motive : DHashMap α (fun _ => β) → Prop} (m : DHashMap α fun _ => β) (l : ρ) (init : motive m) (insert : ∀ m a b, motive m → motive (m.insert a b)) : diff --git a/src/Std/Data/DHashMap/RawLemmas.lean b/src/Std/Data/DHashMap/RawLemmas.lean index 49a38184fd..6ea1806bcb 100644 --- a/src/Std/Data/DHashMap/RawLemmas.lean +++ b/src/Std/Data/DHashMap/RawLemmas.lean @@ -1494,6 +1494,13 @@ theorem insertMany_cons {l : List ((a : α) × β a)} {k : α} {v : β k} [Equiv simp_to_raw rw [Raw₀.insertMany_cons] +theorem insertMany_append [EquivBEq α] [LawfulHashable α] (h : m.WF) {l₁ l₂ : List ((a : α) × β a)} : + insertMany m (l₁ ++ l₂) = insertMany (insertMany m l₁) l₂ := by + induction l₁ generalizing m with + | nil => simp [h] + | cons hd tl ih => + rw [List.cons_append, insertMany_cons h, insertMany_cons h, ih h.insert] + @[elab_as_elim] theorem insertMany_ind {motive : Raw α β → Prop} (m : Raw α β) (l : ρ) (init : motive m) (insert : ∀ m a b, motive m → motive (m.insert a b)) : @@ -1697,6 +1704,13 @@ theorem insertMany_cons (h : m.WF) {l : List (α × β)} simp_to_raw rw [Raw₀.Const.insertMany_cons] +theorem insertMany_append (h : m.WF) {l₁ l₂ : List (α × β)} : + insertMany m (l₁ ++ l₂) = insertMany (insertMany m l₁) l₂ := by + induction l₁ generalizing m with + | nil => simp [h] + | cons hd tl ih => + rw [List.cons_append, insertMany_cons h, insertMany_cons h, ih h.insert] + @[elab_as_elim] theorem insertMany_ind {motive : Raw α (fun _ => β) → Prop} (m : Raw α fun _ => β) (l : ρ) (init : motive m) (insert : ∀ m a b, motive m → motive (m.insert a b)) : diff --git a/src/Std/Data/DTreeMap/Lemmas.lean b/src/Std/Data/DTreeMap/Lemmas.lean index a98aadb25a..f9223589e5 100644 --- a/src/Std/Data/DTreeMap/Lemmas.lean +++ b/src/Std/Data/DTreeMap/Lemmas.lean @@ -1289,6 +1289,13 @@ theorem insertMany_cons {l : List ((a : α) × β a)} {k : α} {v : β k} : t.insertMany (⟨k, v⟩ :: l) = (t.insert k v).insertMany l := ext <| Impl.insertMany_cons t.wf +theorem insertMany_append {l₁ l₂ : List ((a : α) × β a)} : + insertMany t (l₁ ++ l₂) = insertMany (insertMany t l₁) l₂ := by + induction l₁ generalizing t with + | nil => simp + | cons hd tl ih => + rw [List.cons_append, insertMany_cons, insertMany_cons, ih] + @[simp] theorem contains_insertMany_list [TransCmp cmp] [BEq α] [LawfulBEqCmp cmp] {l : List ((a : α) × β a)} {k : α} : @@ -1462,6 +1469,13 @@ theorem insertMany_cons {l : List (α × β)} {k : α} {v : β} : Const.insertMany t ((k, v) :: l) = Const.insertMany (t.insert k v) l := ext <| Impl.Const.insertMany_cons t.wf +theorem insertMany_append {l₁ l₂ : List (α × β)} : + insertMany t (l₁ ++ l₂) = insertMany (insertMany t l₁) l₂ := by + induction l₁ generalizing t with + | nil => simp + | cons hd tl ih => + rw [List.cons_append, insertMany_cons, insertMany_cons, ih] + @[simp] theorem contains_insertMany_list [TransCmp cmp] [BEq α] [LawfulBEqCmp cmp] {l : List (α × β)} {k : α} : diff --git a/src/Std/Data/DTreeMap/Raw/Lemmas.lean b/src/Std/Data/DTreeMap/Raw/Lemmas.lean index 1e3b6ac88e..df4594f999 100644 --- a/src/Std/Data/DTreeMap/Raw/Lemmas.lean +++ b/src/Std/Data/DTreeMap/Raw/Lemmas.lean @@ -1296,6 +1296,13 @@ theorem insertMany_cons {l : List ((a : α) × β a)} {k : α} {v : β k} : t.insertMany (⟨k, v⟩ :: l) = (t.insert k v).insertMany l := ext <| Impl.insertMany!_cons +theorem insertMany_append {l₁ l₂ : List ((a : α) × β a)} : + insertMany t (l₁ ++ l₂) = insertMany (insertMany t l₁) l₂ := by + induction l₁ generalizing t with + | nil => simp + | cons hd tl ih => + rw [List.cons_append, insertMany_cons, insertMany_cons, ih] + @[simp] theorem contains_insertMany_list [TransCmp cmp] [BEq α] [LawfulBEqCmp cmp] (h : t.WF) {l : List ((a : α) × β a)} {k : α} : @@ -1469,6 +1476,13 @@ theorem insertMany_cons {l : List (α × β)} {k : α} {v : β} : Const.insertMany t ((k, v) :: l) = Const.insertMany (t.insert k v) l := ext <| Impl.Const.insertMany!_cons +theorem insertMany_append {l₁ l₂ : List (α × β)} : + insertMany t (l₁ ++ l₂) = insertMany (insertMany t l₁) l₂ := by + induction l₁ generalizing t with + | nil => simp + | cons hd tl ih => + rw [List.cons_append, insertMany_cons, insertMany_cons, ih] + @[simp] theorem contains_insertMany_list [TransCmp cmp] [BEq α] [LawfulBEqCmp cmp] (h : t.WF) {l : List (α × β)} {k : α} : diff --git a/src/Std/Data/ExtDHashMap/Lemmas.lean b/src/Std/Data/ExtDHashMap/Lemmas.lean index 2ca65cb761..49b6d82974 100644 --- a/src/Std/Data/ExtDHashMap/Lemmas.lean +++ b/src/Std/Data/ExtDHashMap/Lemmas.lean @@ -968,6 +968,13 @@ theorem insertMany_cons [EquivBEq α] [LawfulHashable α] exact (List.foldl_hom (f := Subtype.val) fun x y => rfl).symm exact (List.foldl_hom (f := Subtype.val) fun x y => rfl).symm +theorem insertMany_append [EquivBEq α] [LawfulHashable α] {l₁ l₂ : List ((a : α) × β a)} : + insertMany m (l₁ ++ l₂) = insertMany (insertMany m l₁) l₂ := by + induction l₁ generalizing m with + | nil => simp + | cons hd tl ih => + rw [List.cons_append, insertMany_cons, insertMany_cons, ih] + private theorem insertMany_list_mk [EquivBEq α] [LawfulHashable α] {m : DHashMap α β} {l : List ((a : α) × β a)} : (ExtDHashMap.insertMany (Quotient.mk _ m) l : ExtDHashMap α β) = Quotient.mk _ (m.insertMany l) := by @@ -1218,6 +1225,13 @@ theorem insertMany_cons [EquivBEq α] [LawfulHashable α] {l : List (α × β)} exact (List.foldl_hom (f := Subtype.val) fun x y => rfl).symm exact (List.foldl_hom (f := Subtype.val) fun x y => rfl).symm +theorem insertMany_append [EquivBEq α] [LawfulHashable α] {l₁ l₂ : List (α × β)} : + insertMany m (l₁ ++ l₂) = insertMany (insertMany m l₁) l₂ := by + induction l₁ generalizing m with + | nil => simp + | cons hd tl ih => + rw [List.cons_append, insertMany_cons, insertMany_cons, ih] + private theorem insertMany_list_mk [EquivBEq α] [LawfulHashable α] {m : DHashMap α fun _ => β} {l : List (α × β)} : (insertMany (Quotient.mk _ m) l : ExtDHashMap α fun _ => β) = diff --git a/src/Std/Data/ExtHashMap/Lemmas.lean b/src/Std/Data/ExtHashMap/Lemmas.lean index 0635ca9771..d8f0a912ff 100644 --- a/src/Std/Data/ExtHashMap/Lemmas.lean +++ b/src/Std/Data/ExtHashMap/Lemmas.lean @@ -726,6 +726,13 @@ theorem insertMany_cons [EquivBEq α] [LawfulHashable α] {l : List (α × β)} insertMany m (⟨k, v⟩ :: l) = insertMany (m.insert k v) l := ext ExtDHashMap.Const.insertMany_cons +theorem insertMany_append [EquivBEq α] [LawfulHashable α] {l₁ l₂ : List (α × β)} : + insertMany m (l₁ ++ l₂) = insertMany (insertMany m l₁) l₂ := by + induction l₁ generalizing m with + | nil => simp + | cons hd tl ih => + rw [List.cons_append, insertMany_cons, insertMany_cons, ih] + @[elab_as_elim] theorem insertMany_ind [EquivBEq α] [LawfulHashable α] {motive : ExtHashMap α β → Prop} (m : ExtHashMap α β) {l : ρ} diff --git a/src/Std/Data/ExtHashSet/Lemmas.lean b/src/Std/Data/ExtHashSet/Lemmas.lean index 178efcab54..ad15bbc52c 100644 --- a/src/Std/Data/ExtHashSet/Lemmas.lean +++ b/src/Std/Data/ExtHashSet/Lemmas.lean @@ -398,6 +398,13 @@ theorem insertMany_cons [EquivBEq α] [LawfulHashable α] {l : List α} {k : α} insertMany m (k :: l) = insertMany (m.insert k) l := ext ExtHashMap.insertManyIfNewUnit_cons +theorem insertMany_append [EquivBEq α] [LawfulHashable α] {l₁ l₂ : List α} : + insertMany m (l₁ ++ l₂) = insertMany (insertMany m l₁) l₂ := by + induction l₁ generalizing m with + | nil => simp + | cons hd tl ih => + rw [List.cons_append, insertMany_cons, insertMany_cons, ih] + @[elab_as_elim] theorem insertMany_ind [EquivBEq α] [LawfulHashable α] {motive : ExtHashSet α → Prop} (m : ExtHashSet α) {l : ρ} diff --git a/src/Std/Data/HashMap/Lemmas.lean b/src/Std/Data/HashMap/Lemmas.lean index 58199d90f4..6dd2f56822 100644 --- a/src/Std/Data/HashMap/Lemmas.lean +++ b/src/Std/Data/HashMap/Lemmas.lean @@ -976,6 +976,13 @@ theorem insertMany_cons {l : List (α × β)} {k : α} {v : β} : insertMany m (⟨k, v⟩ :: l) = insertMany (m.insert k v) l := ext DHashMap.Const.insertMany_cons +theorem insertMany_append {l₁ l₂ : List (α × β)} : + insertMany m (l₁ ++ l₂) = insertMany (insertMany m l₁) l₂ := by + induction l₁ generalizing m with + | nil => simp + | cons hd tl ih => + rw [List.cons_append, insertMany_cons, insertMany_cons, ih] + @[elab_as_elim] theorem insertMany_ind {motive : HashMap α β → Prop} (m : HashMap α β) {l : ρ} (init : motive m) (insert : ∀ m a b, motive m → motive (m.insert a b)) : diff --git a/src/Std/Data/HashMap/RawLemmas.lean b/src/Std/Data/HashMap/RawLemmas.lean index 54db0f27b6..a25836e410 100644 --- a/src/Std/Data/HashMap/RawLemmas.lean +++ b/src/Std/Data/HashMap/RawLemmas.lean @@ -1001,6 +1001,13 @@ theorem insertMany_cons (h : m.WF) {l : List (α × β)} insertMany m (⟨k, v⟩ :: l) = insertMany (m.insert k v) l := ext (DHashMap.Raw.Const.insertMany_cons h.out) +theorem insertMany_append (h : m.WF) {l₁ l₂ : List (α × β)} : + insertMany m (l₁ ++ l₂) = insertMany (insertMany m l₁) l₂ := by + induction l₁ generalizing m with + | nil => simp [h] + | cons hd tl ih => + rw [List.cons_append, insertMany_cons h, insertMany_cons h, ih h.insert] + @[elab_as_elim] theorem insertMany_ind {motive : Raw α β → Prop} (m : Raw α β) {l : ρ} (init : motive m) (insert : ∀ m a b, motive m → motive (m.insert a b)) : diff --git a/src/Std/Data/HashSet/Lemmas.lean b/src/Std/Data/HashSet/Lemmas.lean index da9ed00492..ae932fecbc 100644 --- a/src/Std/Data/HashSet/Lemmas.lean +++ b/src/Std/Data/HashSet/Lemmas.lean @@ -526,6 +526,13 @@ theorem insertMany_cons {l : List α} {k : α} : insertMany m (k :: l) = insertMany (m.insert k) l := ext HashMap.insertManyIfNewUnit_cons +theorem insertMany_append {l₁ l₂ : List α} : + insertMany m (l₁ ++ l₂) = insertMany (insertMany m l₁) l₂ := by + induction l₁ generalizing m with + | nil => simp + | cons hd tl ih => + rw [List.cons_append, insertMany_cons, insertMany_cons, ih] + @[elab_as_elim] theorem insertMany_ind {motive : HashSet α → Prop} (m : HashSet α) {l : ρ} (init : motive m) (insert : ∀ m a, motive m → motive (m.insert a)) : diff --git a/src/Std/Data/HashSet/RawLemmas.lean b/src/Std/Data/HashSet/RawLemmas.lean index 4188f5a0f4..7f99f504b3 100644 --- a/src/Std/Data/HashSet/RawLemmas.lean +++ b/src/Std/Data/HashSet/RawLemmas.lean @@ -551,6 +551,13 @@ theorem insertMany_cons (h : m.WF) {l : List α} {k : α} : insertMany m (k :: l) = insertMany (m.insert k) l := ext (HashMap.Raw.insertManyIfNewUnit_cons h.1) +theorem insertMany_append (h : m.WF) {l₁ l₂ : List α} : + insertMany m (l₁ ++ l₂) = insertMany (insertMany m l₁) l₂ := by + induction l₁ generalizing m with + | nil => simp [h] + | cons hd tl ih => + rw [List.cons_append, insertMany_cons h, insertMany_cons h, ih h.insert] + @[elab_as_elim] theorem insertMany_ind {motive : Raw α → Prop} (m : Raw α) (l : ρ) (init : motive m) (insert : ∀ m a, motive m → motive (m.insert a)) : diff --git a/src/Std/Data/TreeMap/Lemmas.lean b/src/Std/Data/TreeMap/Lemmas.lean index 3221711057..62624d7a65 100644 --- a/src/Std/Data/TreeMap/Lemmas.lean +++ b/src/Std/Data/TreeMap/Lemmas.lean @@ -911,6 +911,13 @@ theorem insertMany_cons {l : List (α × β)} {k : α} {v : β} : t.insertMany (⟨k, v⟩ :: l) = (t.insert k v).insertMany l := ext <| DTreeMap.Const.insertMany_cons +theorem insertMany_append {l₁ l₂ : List (α × β)} : + insertMany t (l₁ ++ l₂) = insertMany (insertMany t l₁) l₂ := by + induction l₁ generalizing t with + | nil => simp + | cons hd tl ih => + rw [List.cons_append, insertMany_cons, insertMany_cons, ih] + @[simp] theorem contains_insertMany_list [TransCmp cmp] [BEq α] [LawfulBEqCmp cmp] {l : List (α × β)} {k : α} : diff --git a/src/Std/Data/TreeMap/Raw/Lemmas.lean b/src/Std/Data/TreeMap/Raw/Lemmas.lean index fc5657088d..d9c3a4a743 100644 --- a/src/Std/Data/TreeMap/Raw/Lemmas.lean +++ b/src/Std/Data/TreeMap/Raw/Lemmas.lean @@ -920,6 +920,13 @@ theorem insertMany_cons {l : List (α × β)} {k : α} {v : β} : t.insertMany (⟨k, v⟩ :: l) = (t.insert k v).insertMany l := ext <| DTreeMap.Raw.Const.insertMany_cons +theorem insertMany_append {l₁ l₂ : List (α × β)} : + insertMany t (l₁ ++ l₂) = insertMany (insertMany t l₁) l₂ := by + induction l₁ generalizing t with + | nil => simp + | cons hd tl ih => + rw [List.cons_append, insertMany_cons, insertMany_cons, ih] + @[simp] theorem contains_insertMany_list [TransCmp cmp] [BEq α] [LawfulBEqCmp cmp] (h : t.WF) {l : List (α × β)} {k : α} : diff --git a/src/Std/Data/TreeSet/Lemmas.lean b/src/Std/Data/TreeSet/Lemmas.lean index b3d3cc8511..5a3fe24131 100644 --- a/src/Std/Data/TreeSet/Lemmas.lean +++ b/src/Std/Data/TreeSet/Lemmas.lean @@ -490,6 +490,13 @@ theorem insertMany_cons {l : List α} {k : α} : t.insertMany (k :: l) = (t.insert k).insertMany l := ext TreeMap.insertManyIfNewUnit_cons +theorem insertMany_append {l₁ l₂ : List α} : + insertMany t (l₁ ++ l₂) = insertMany (insertMany t l₁) l₂ := by + induction l₁ generalizing t with + | nil => simp + | cons hd tl ih => + rw [List.cons_append, insertMany_cons, insertMany_cons, ih] + @[simp] theorem contains_insertMany_list [TransCmp cmp] [BEq α] [LawfulBEqCmp cmp] {l : List α} {k : α} : diff --git a/src/Std/Data/TreeSet/Raw/Lemmas.lean b/src/Std/Data/TreeSet/Raw/Lemmas.lean index c7a97897bf..dffbf3bbc9 100644 --- a/src/Std/Data/TreeSet/Raw/Lemmas.lean +++ b/src/Std/Data/TreeSet/Raw/Lemmas.lean @@ -488,6 +488,13 @@ theorem insertMany_cons {l : List α} {k : α} : t.insertMany (k :: l) = (t.insert k).insertMany l := ext TreeMap.Raw.insertManyIfNewUnit_cons +theorem insertMany_append {l₁ l₂ : List α} : + insertMany t (l₁ ++ l₂) = insertMany (insertMany t l₁) l₂ := by + induction l₁ generalizing t with + | nil => simp + | cons hd tl ih => + rw [List.cons_append, insertMany_cons, insertMany_cons, ih] + @[simp] theorem contains_insertMany_list [TransCmp cmp] [BEq α] [LawfulBEqCmp cmp] (h : t.WF) {l : List α} {k : α} :