feat: insertMany_append lemmas for map variants (#8184)
This PR adds the `insertMany_append` lemma for all map variants.
This commit is contained in:
parent
670158345a
commit
1d5110e140
15 changed files with 140 additions and 0 deletions
|
|
@ -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)) :
|
||||
|
|
|
|||
|
|
@ -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)) :
|
||||
|
|
|
|||
|
|
@ -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 : α} :
|
||||
|
|
|
|||
|
|
@ -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 : α} :
|
||||
|
|
|
|||
|
|
@ -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 _ => β) =
|
||||
|
|
|
|||
|
|
@ -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 : ρ}
|
||||
|
|
|
|||
|
|
@ -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 : ρ}
|
||||
|
|
|
|||
|
|
@ -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)) :
|
||||
|
|
|
|||
|
|
@ -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)) :
|
||||
|
|
|
|||
|
|
@ -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)) :
|
||||
|
|
|
|||
|
|
@ -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)) :
|
||||
|
|
|
|||
|
|
@ -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 : α} :
|
||||
|
|
|
|||
|
|
@ -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 : α} :
|
||||
|
|
|
|||
|
|
@ -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 : α} :
|
||||
|
|
|
|||
|
|
@ -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 : α} :
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue