fix: some inconsistencies in Map grind annotations (#9054)
This PR corrects some inconsistencies in `TreeMap`/`HashMap` grind annotations, for `isSome_get?_eq_contains` and `empty_eq_emptyc`.
This commit is contained in:
parent
19fd1f060f
commit
c52605dfe3
20 changed files with 24 additions and 29 deletions
|
|
@ -255,7 +255,7 @@ theorem get?_insert_self [LawfulBEq α] {k : α} {v : β k} : (m.insert k v).get
|
|||
theorem contains_eq_isSome_get? [LawfulBEq α] {a : α} : m.contains a = (m.get? a).isSome :=
|
||||
Raw₀.contains_eq_isSome_get? ⟨m.1, _⟩ m.2
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem isSome_get?_eq_contains [LawfulBEq α] {a : α} : (m.get? a).isSome = m.contains a :=
|
||||
contains_eq_isSome_get?.symm
|
||||
|
||||
|
|
@ -314,7 +314,7 @@ theorem contains_eq_isSome_get? [EquivBEq α] [LawfulHashable α] {a : α} :
|
|||
m.contains a = (get? m a).isSome :=
|
||||
Raw₀.Const.contains_eq_isSome_get? ⟨m.1, _⟩ m.2
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem isSome_get?_eq_contains [EquivBEq α] [LawfulHashable α] {a : α} :
|
||||
(get? m a).isSome = m.contains a :=
|
||||
contains_eq_isSome_get?.symm
|
||||
|
|
|
|||
|
|
@ -302,7 +302,7 @@ theorem contains_eq_isSome_get? [LawfulBEq α] (h : m.WF) {a : α} :
|
|||
m.contains a = (m.get? a).isSome := by
|
||||
simp_to_raw using Raw₀.contains_eq_isSome_get?
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem isSome_get?_eq_contains [LawfulBEq α] (h : m.WF) {a : α} :
|
||||
(m.get? a).isSome = m.contains a :=
|
||||
(contains_eq_isSome_get? h).symm
|
||||
|
|
@ -364,7 +364,7 @@ theorem contains_eq_isSome_get? [EquivBEq α] [LawfulHashable α] (h : m.WF) {a
|
|||
m.contains a = (get? m a).isSome := by
|
||||
simp_to_raw using Raw₀.Const.contains_eq_isSome_get?
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem isSome_get?_eq_contains [EquivBEq α] [LawfulHashable α] (h : m.WF) {a : α} :
|
||||
(get? m a).isSome = m.contains a :=
|
||||
(contains_eq_isSome_get? h).symm
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ structure Equiv (m₁ m₂ : DTreeMap α β cmp) where
|
|||
|
||||
@[inherit_doc] scoped infix:50 " ~m " => Equiv
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem empty_eq_emptyc : (empty : DTreeMap α β cmp) = ∅ :=
|
||||
rfl
|
||||
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ theorem contains_eq_isSome_get? [TransCmp cmp] [LawfulEqCmp cmp] {a : α} :
|
|||
t.contains a = (t.get? a).isSome :=
|
||||
Impl.contains_eq_isSome_get? t.wf
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem isSome_get?_eq_contains [TransCmp cmp] [LawfulEqCmp cmp] {a : α} :
|
||||
(t.get? a).isSome = t.contains a :=
|
||||
contains_eq_isSome_get?.symm
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ structure Equiv (m₁ m₂ : Raw α β cmp) where
|
|||
|
||||
@[inherit_doc] scoped infix:50 " ~m " => Equiv
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem empty_eq_emptyc : (empty : Raw α β cmp) = ∅ :=
|
||||
rfl
|
||||
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ theorem contains_eq_isSome_get? [TransCmp cmp] [LawfulEqCmp cmp] (h : t.WF) {a :
|
|||
t.contains a = (t.get? a).isSome :=
|
||||
Impl.contains_eq_isSome_get? h
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem isSome_get?_eq_contains [TransCmp cmp] [LawfulEqCmp cmp] (h : t.WF) {a : α} :
|
||||
(t.get? a).isSome = t.contains a :=
|
||||
(contains_eq_isSome_get? h).symm
|
||||
|
|
@ -295,7 +295,7 @@ theorem contains_eq_isSome_get? [TransCmp cmp] (h : t.WF) {a : α} :
|
|||
t.contains a = (get? t a).isSome :=
|
||||
Impl.Const.contains_eq_isSome_get? h
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem isSome_get?_eq_contains [TransCmp cmp] (h : t.WF) {a : α} :
|
||||
(get? t a).isSome = t.contains a :=
|
||||
(contains_eq_isSome_get? h).symm
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ theorem get?_insert_self [LawfulBEq α] {k : α} {v : β k} : (m.insert k v).get
|
|||
theorem contains_eq_isSome_get? [LawfulBEq α] {a : α} : m.contains a = (m.get? a).isSome :=
|
||||
m.inductionOn fun _ => DHashMap.contains_eq_isSome_get?
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem isSome_get?_eq_contains [LawfulBEq α] {a : α} : (m.get? a).isSome = m.contains a :=
|
||||
contains_eq_isSome_get?.symm
|
||||
|
||||
|
|
@ -242,7 +242,7 @@ theorem contains_eq_isSome_get? [EquivBEq α] [LawfulHashable α] {a : α} :
|
|||
m.contains a = (get? m a).isSome :=
|
||||
m.inductionOn fun _ => DHashMap.Const.contains_eq_isSome_get?
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem isSome_get?_eq_contains [EquivBEq α] [LawfulHashable α] {a : α} :
|
||||
(get? m a).isSome = m.contains a :=
|
||||
contains_eq_isSome_get?.symm
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ instance : EmptyCollection (ExtDTreeMap α β cmp) where
|
|||
instance : Inhabited (ExtDTreeMap α β cmp) where
|
||||
default := ∅
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem empty_eq_emptyc : (empty : ExtDTreeMap α β cmp) = ∅ :=
|
||||
rfl
|
||||
|
||||
|
|
|
|||
|
|
@ -43,11 +43,6 @@ theorem mem_iff_contains [TransCmp cmp] {k : α} : k ∈ t ↔ t.contains k :=
|
|||
theorem contains_iff_mem [TransCmp cmp] {k : α} : t.contains k ↔ k ∈ t :=
|
||||
Iff.rfl
|
||||
|
||||
-- We need to specify the pattern for the reverse direction manually,
|
||||
-- as the default heuristic leaves the `ExtDTreeMap α β` argument as a wildcard.
|
||||
grind_pattern contains_iff_mem => @Membership.mem α (ExtDTreeMap α β cmp) _ t k
|
||||
|
||||
|
||||
theorem contains_congr [TransCmp cmp] {k k' : α} (hab : cmp k k' = .eq) :
|
||||
t.contains k = t.contains k' :=
|
||||
t.inductionOn (fun _ hab => DTreeMap.contains_congr hab) hab
|
||||
|
|
@ -221,7 +216,7 @@ theorem contains_eq_isSome_get? [TransCmp cmp] [LawfulEqCmp cmp] {a : α} :
|
|||
t.contains a = (t.get? a).isSome :=
|
||||
t.inductionOn fun _ => DTreeMap.contains_eq_isSome_get?
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem isSome_get?_eq_contains [TransCmp cmp] [LawfulEqCmp cmp] {a : α} :
|
||||
(t.get? a).isSome = t.contains a :=
|
||||
t.inductionOn fun _ => DTreeMap.isSome_get?_eq_contains
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ theorem contains_eq_isSome_get? [EquivBEq α] [LawfulHashable α] {a : α} :
|
|||
m.contains a = (m.get? a).isSome :=
|
||||
ExtHashMap.contains_eq_isSome_getKey?
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem isSome_get?_eq_contains [EquivBEq α] [LawfulHashable α] {a : α} :
|
||||
(m.get? a).isSome = m.contains a :=
|
||||
contains_eq_isSome_get?.symm
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ instance : EmptyCollection (ExtTreeMap α β cmp) where
|
|||
|
||||
instance : Inhabited (ExtTreeMap α β cmp) := ⟨∅⟩
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem empty_eq_emptyc : (empty : ExtTreeMap α β cmp) = ∅ :=
|
||||
rfl
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ instance : EmptyCollection (ExtTreeSet α cmp) where
|
|||
instance : Inhabited (ExtTreeSet α cmp) where
|
||||
default := ∅
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem empty_eq_emptyc : (empty : ExtTreeSet α cmp) = ∅ :=
|
||||
rfl
|
||||
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ theorem contains_eq_isSome_get? [TransCmp cmp] {a : α} :
|
|||
t.contains a = (t.get? a).isSome :=
|
||||
ExtTreeMap.contains_eq_isSome_getKey?
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem isSome_get?_eq_contains [TransCmp cmp] {a : α} :
|
||||
(t.get? a).isSome = t.contains a :=
|
||||
contains_eq_isSome_get?.symm
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ theorem contains_eq_isSome_get? [EquivBEq α] [LawfulHashable α] {a : α} :
|
|||
m.contains a = (m.get? a).isSome :=
|
||||
HashMap.contains_eq_isSome_getKey?
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem isSome_get?_eq_contains [EquivBEq α] [LawfulHashable α] {a : α} :
|
||||
(m.get? a).isSome = m.contains a :=
|
||||
contains_eq_isSome_get?.symm
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ theorem contains_eq_isSome_get? [EquivBEq α] [LawfulHashable α] (h : m.WF) {a
|
|||
m.contains a = (m.get? a).isSome :=
|
||||
HashMap.Raw.contains_eq_isSome_getKey? h.out
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem isSome_get?_eq_contains [EquivBEq α] [LawfulHashable α] (h : m.WF) {a : α} :
|
||||
(m.get? a).isSome = m.contains a :=
|
||||
(contains_eq_isSome_get? h).symm
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ structure Equiv (m₁ m₂ : TreeMap α β cmp) where
|
|||
|
||||
@[inherit_doc] scoped infix:50 " ~m " => Equiv
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem empty_eq_emptyc : (empty : TreeMap α β cmp) = ∅ :=
|
||||
rfl
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ structure Equiv (m₁ m₂ : Raw α β cmp) where
|
|||
|
||||
@[inherit_doc] scoped infix:50 " ~m " => Equiv
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem empty_eq_emptyc : (empty : Raw α β cmp) = ∅ :=
|
||||
rfl
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ structure Equiv (m₁ m₂ : TreeSet α cmp) where
|
|||
|
||||
@[inherit_doc] scoped infix:50 " ~m " => Equiv
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem empty_eq_emptyc : (empty : TreeSet α cmp) = ∅ :=
|
||||
rfl
|
||||
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ theorem contains_eq_isSome_get? [TransCmp cmp] {a : α} :
|
|||
t.contains a = (t.get? a).isSome :=
|
||||
TreeMap.contains_eq_isSome_getKey?
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem isSome_get?_eq_contains [TransCmp cmp] {a : α} :
|
||||
(t.get? a).isSome = t.contains a :=
|
||||
contains_eq_isSome_get?.symm
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ structure Equiv (m₁ m₂ : Raw α cmp) where
|
|||
|
||||
@[inherit_doc] scoped infix:50 " ~m " => Equiv
|
||||
|
||||
@[simp]
|
||||
@[simp, grind =]
|
||||
theorem empty_eq_emptyc : (empty : Raw α cmp) = ∅ :=
|
||||
rfl
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue