data.list.sigma
⟷
Mathlib.Data.List.Sigma
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
@@ -80,6 +80,12 @@ nodupkeys_iff_pairwise.1 h
nodupkeys (s::l) ↔ s.1 ∉ l.keys ∧ nodupkeys l :=
by simp [keys, nodupkeys]
+theorem not_mem_keys_of_nodupkeys_cons {s : sigma β} {l : list (sigma β)} (h : nodupkeys (s :: l)) :
+ s.1 ∉ l.keys := (nodupkeys_cons.1 h).1
+
+theorem nodupkeys_of_nodupkeys_cons {s : sigma β} {l : list (sigma β)} (h : nodupkeys (s :: l)) :
+ nodupkeys l := (nodupkeys_cons.1 h).2
+
theorem nodupkeys.eq_of_fst_eq {l : list (sigma β)}
(nd : nodupkeys l) {s s' : sigma β} (h : s ∈ l) (h' : s' ∈ l) :
s.1 = s'.1 → s = s' :=
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
list.replicate
and migrate to it (#18127)
This definition differs from list.repeat
by the order of arguments. The new order is in sync with the Lean 4 version.
@@ -262,7 +262,7 @@ theorem lookup_all_sublist (a : α) :
theorem lookup_all_length_le_one (a : α) {l : list (sigma β)} (h : l.nodupkeys) :
length (lookup_all a l) ≤ 1 :=
by have := nodup.sublist ((lookup_all_sublist a l).map _) h;
- rw map_map at this; rwa [← nodup_repeat, ← map_const _ a]
+ rw map_map at this; rwa [← nodup_replicate, ← map_const _ a]
theorem lookup_all_eq_lookup (a : α) {l : list (sigma β)} (h : l.nodupkeys) :
lookup_all a l = (lookup a l).to_list :=
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(first ported)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -192,7 +192,7 @@ theorem nodupKeys_join {L : List (List (Sigma β))} :
NodupKeys (join L) ↔ (∀ l ∈ L, NodupKeys l) ∧ Pairwise Disjoint (L.map keys) :=
by
rw [nodupkeys_iff_pairwise, pairwise_join, pairwise_map]
- refine' and_congr (ball_congr fun l h => by simp [nodupkeys_iff_pairwise]) _
+ refine' and_congr (forall₂_congr fun l h => by simp [nodupkeys_iff_pairwise]) _
apply iff_of_eq; congr with (l₁ l₂)
simp [keys, disjoint_iff_ne]
#align list.nodupkeys_join List.nodupKeys_join
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -90,7 +90,7 @@ theorem not_mem_keys {a} {l : List (Sigma β)} : a ∉ l.keys ↔ ∀ b : β a,
#print List.not_eq_key /-
theorem not_eq_key {a} {l : List (Sigma β)} : a ∉ l.keys ↔ ∀ s : Sigma β, s ∈ l → a ≠ s.1 :=
- Iff.intro (fun h₁ s h₂ e => absurd (mem_keys_of_mem h₂) (by rwa [e] at h₁ )) fun f h₁ =>
+ Iff.intro (fun h₁ s h₂ e => absurd (mem_keys_of_mem h₂) (by rwa [e] at h₁)) fun f h₁ =>
let ⟨b, h₂⟩ := exists_of_mem_keys h₁
f _ h₂ rfl
#align list.not_eq_key List.not_eq_key
@@ -213,30 +213,30 @@ theorem mem_ext {l₀ l₁ : List (Sigma β)} (nd₀ : l₀.Nodup) (nd₁ : l₁
first
| specialize h x
- | specialize h y; simp at h
+ | specialize h y; simp at h
cases h
- simp at nd₀ nd₁
+ simp at nd₀ nd₁
classical
obtain rfl | h' := eq_or_ne x y
· constructor
refine' l₀_ih nd₀.2 nd₁.2 fun a => _
- specialize h a; simp at h
+ specialize h a; simp at h
obtain rfl | h' := eq_or_ne a x
· exact iff_of_false nd₀.1 nd₁.1
· simpa [h'] using h
· trans x :: y :: ys.erase x
· constructor
refine' l₀_ih nd₀.2 ((nd₁.2.eraseₓ _).cons fun h => nd₁.1 <| mem_of_mem_erase h) fun a => _
- · specialize h a; simp at h
+ · specialize h a; simp at h
obtain rfl | h' := eq_or_ne a x
· exact iff_of_false nd₀.1 fun h => h.elim h' nd₁.2.not_mem_erase
- · rw [or_iff_right h'] at h
+ · rw [or_iff_right h'] at h
rw [h, mem_cons_iff]
exact or_congr_right (mem_erase_of_ne h').symm
trans y :: x :: ys.erase x
· constructor
· constructor; symm; apply perm_cons_erase
- specialize h x; simp [h'] at h ; exact h
+ specialize h x; simp [h'] at h; exact h
#align list.mem_ext List.mem_ext
-/
@@ -296,8 +296,8 @@ theorem of_mem_dlookup {a : α} {b : β a} :
∀ {l : List (Sigma β)}, b ∈ dlookup a l → Sigma.mk a b ∈ l
| ⟨a', b'⟩ :: l, H => by
by_cases h : a = a'
- · subst a'; simp at H ; simp [H]
- · simp [h] at H ; exact Or.inr (of_mem_lookup H)
+ · subst a'; simp at H; simp [H]
+ · simp [h] at H; exact Or.inr (of_mem_lookup H)
#align list.of_mem_lookup List.of_mem_dlookup
-/
@@ -415,7 +415,7 @@ theorem lookupAll_sublist (a : α) : ∀ l : List (Sigma β), (lookupAll a l).ma
#print List.lookupAll_length_le_one /-
theorem lookupAll_length_le_one (a : α) {l : List (Sigma β)} (h : l.NodupKeys) :
length (lookupAll a l) ≤ 1 := by
- have := nodup.sublist ((lookup_all_sublist a l).map _) h <;> rw [map_map] at this <;>
+ have := nodup.sublist ((lookup_all_sublist a l).map _) h <;> rw [map_map] at this <;>
rwa [← nodup_replicate, ← map_const _ a]
#align list.lookup_all_length_le_one List.lookupAll_length_le_one
-/
@@ -495,7 +495,7 @@ theorem Perm.kreplace {a : α} {b : β a} {l₁ l₂ : List (Sigma β)} (nd : l
perm_lookmap _ <| by
refine' nd.pairwise_ne.imp _
intro x y h z h₁ w h₂
- split_ifs at h₁ h₂ <;> cases h₁ <;> cases h₂
+ split_ifs at h₁ h₂ <;> cases h₁ <;> cases h₂
exact (h (h_2.symm.trans h_1)).elim
#align list.perm.kreplace List.Perm.kreplace
-/
@@ -534,7 +534,7 @@ theorem kerase_cons_ne {a} {s : Sigma β} {l : List (Sigma β)} (h : a ≠ s.1)
#print List.kerase_of_not_mem_keys /-
@[simp]
theorem kerase_of_not_mem_keys {a} {l : List (Sigma β)} (h : a ∉ l.keys) : kerase a l = l := by
- induction' l with _ _ ih <;> [rfl; · simp [not_or] at h ; simp [h.1, ih h.2]]
+ induction' l with _ _ ih <;> [rfl; · simp [not_or] at h; simp [h.1, ih h.2]]
#align list.kerase_of_not_mem_keys List.kerase_of_not_mem_keys
-/
@@ -568,7 +568,7 @@ theorem exists_of_kerase {a : α} {l : List (Sigma β)} (h : a ∈ l.keys) :
by_cases e : a = hd.1
· subst e
exact ⟨hd.2, [], tl, by simp, by cases hd <;> rfl, by simp⟩
- · simp at h
+ · simp at h
cases h
case inl h => exact absurd h e
case inr h =>
@@ -632,7 +632,7 @@ theorem not_mem_keys_kerase (a) {l : List (Sigma β)} (nd : l.NodupKeys) : a ∉
induction l
case nil => simp
case cons hd tl ih =>
- simp at nd
+ simp at nd
by_cases h : a = hd.1
· subst h; simp [nd.1]
· simp [h, ih nd.2]
@@ -670,7 +670,7 @@ theorem kerase_append_left {a} :
| [], _, h => by cases h
| s :: l₁, l₂, h₁ =>
if h₂ : a = s.1 then by simp [h₂]
- else by simp at h₁ <;> cases h₁ <;> [exact absurd h₁ h₂; simp [h₂, kerase_append_left h₁]]
+ else by simp at h₁ <;> cases h₁ <;> [exact absurd h₁ h₂; simp [h₂, kerase_append_left h₁]]
#align list.kerase_append_left List.kerase_append_left
-/
@@ -678,7 +678,7 @@ theorem kerase_append_left {a} :
theorem kerase_append_right {a} :
∀ {l₁ l₂ : List (Sigma β)}, a ∉ l₁.keys → kerase a (l₁ ++ l₂) = l₁ ++ kerase a l₂
| [], _, h => rfl
- | _ :: l₁, l₂, h => by simp [not_or] at h <;> simp [h.1, kerase_append_right h.2]
+ | _ :: l₁, l₂, h => by simp [not_or] at h <;> simp [h.1, kerase_append_right h.2]
#align list.kerase_append_right List.kerase_append_right
-/
@@ -906,7 +906,7 @@ theorem NodupKeys.kunion (nd₁ : l₁.NodupKeys) (nd₂ : l₂.NodupKeys) : (ku
induction l₁ generalizing l₂
case nil => simp only [nil_kunion, nd₂]
case cons s l₁ ih =>
- simp at nd₁
+ simp at nd₁
simp [not_or, nd₁.1, nd₂, ih nd₁.2 (nd₂.kerase s.1)]
#align list.nodupkeys.kunion List.NodupKeys.kunion
-/
@@ -942,7 +942,7 @@ theorem Perm.kunion {l₁ l₂ l₃ l₄ : List (Sigma β)} (nd₃ : l₃.NodupK
theorem dlookup_kunion_left {a} {l₁ l₂ : List (Sigma β)} (h : a ∈ l₁.keys) :
dlookup a (kunion l₁ l₂) = dlookup a l₁ :=
by
- induction' l₁ with s _ ih generalizing l₂ <;> simp at h <;> cases h <;> cases' s with a'
+ induction' l₁ with s _ ih generalizing l₂ <;> simp at h <;> cases h <;> cases' s with a'
· subst h; simp
· rw [kunion_cons]
by_cases h' : a = a'
@@ -958,7 +958,7 @@ theorem dlookup_kunion_right {a} {l₁ l₂ : List (Sigma β)} (h : a ∉ l₁.k
by
induction l₁ generalizing l₂
case nil => simp
- case cons _ _ ih => simp [not_or] at h ; simp [h.1, ih h.2]
+ case cons _ _ ih => simp [not_or] at h; simp [h.1, ih h.2]
#align list.lookup_kunion_right List.dlookup_kunion_right
-/
@@ -973,7 +973,7 @@ theorem mem_dlookup_kunion {a} {b : β a} {l₁ l₂ : List (Sigma β)} :
cases' s with a'
by_cases h₁ : a = a'
· subst h₁; simp
- · let h₂ := @ih (kerase a' l₂); simp [h₁] at h₂ ; simp [h₁, h₂]
+ · let h₂ := @ih (kerase a' l₂); simp [h₁] at h₂; simp [h₁, h₂]
#align list.mem_lookup_kunion List.mem_dlookup_kunion
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -217,6 +217,26 @@ theorem mem_ext {l₀ l₁ : List (Sigma β)} (nd₀ : l₀.Nodup) (nd₁ : l₁
cases h
simp at nd₀ nd₁
classical
+ obtain rfl | h' := eq_or_ne x y
+ · constructor
+ refine' l₀_ih nd₀.2 nd₁.2 fun a => _
+ specialize h a; simp at h
+ obtain rfl | h' := eq_or_ne a x
+ · exact iff_of_false nd₀.1 nd₁.1
+ · simpa [h'] using h
+ · trans x :: y :: ys.erase x
+ · constructor
+ refine' l₀_ih nd₀.2 ((nd₁.2.eraseₓ _).cons fun h => nd₁.1 <| mem_of_mem_erase h) fun a => _
+ · specialize h a; simp at h
+ obtain rfl | h' := eq_or_ne a x
+ · exact iff_of_false nd₀.1 fun h => h.elim h' nd₁.2.not_mem_erase
+ · rw [or_iff_right h'] at h
+ rw [h, mem_cons_iff]
+ exact or_congr_right (mem_erase_of_ne h').symm
+ trans y :: x :: ys.erase x
+ · constructor
+ · constructor; symm; apply perm_cons_erase
+ specialize h x; simp [h'] at h ; exact h
#align list.mem_ext List.mem_ext
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -217,26 +217,6 @@ theorem mem_ext {l₀ l₁ : List (Sigma β)} (nd₀ : l₀.Nodup) (nd₁ : l₁
cases h
simp at nd₀ nd₁
classical
- obtain rfl | h' := eq_or_ne x y
- · constructor
- refine' l₀_ih nd₀.2 nd₁.2 fun a => _
- specialize h a; simp at h
- obtain rfl | h' := eq_or_ne a x
- · exact iff_of_false nd₀.1 nd₁.1
- · simpa [h'] using h
- · trans x :: y :: ys.erase x
- · constructor
- refine' l₀_ih nd₀.2 ((nd₁.2.eraseₓ _).cons fun h => nd₁.1 <| mem_of_mem_erase h) fun a => _
- · specialize h a; simp at h
- obtain rfl | h' := eq_or_ne a x
- · exact iff_of_false nd₀.1 fun h => h.elim h' nd₁.2.not_mem_erase
- · rw [or_iff_right h'] at h
- rw [h, mem_cons_iff]
- exact or_congr_right (mem_erase_of_ne h').symm
- trans y :: x :: ys.erase x
- · constructor
- · constructor; symm; apply perm_cons_erase
- specialize h x; simp [h'] at h ; exact h
#align list.mem_ext List.mem_ext
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -621,7 +621,7 @@ theorem NodupKeys.kerase (a : α) : NodupKeys l → (kerase a l).NodupKeys :=
#print List.Perm.kerase /-
theorem Perm.kerase {a : α} {l₁ l₂ : List (Sigma β)} (nd : l₁.NodupKeys) :
l₁ ~ l₂ → kerase a l₁ ~ kerase a l₂ :=
- Perm.erasep _ <| (nodupKeys_iff_pairwise.1 nd).imp <| by rintro x y h rfl <;> exact h
+ Perm.eraseP _ <| (nodupKeys_iff_pairwise.1 nd).imp <| by rintro x y h rfl <;> exact h
#align list.perm.kerase List.Perm.kerase
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,8 +3,8 @@ Copyright (c) 2018 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro, Sean Leather
-/
-import Mathbin.Data.List.Range
-import Mathbin.Data.List.Perm
+import Data.List.Range
+import Data.List.Perm
#align_import data.list.sigma from "leanprover-community/mathlib"@"f808feb6c18afddb25e66a71d317643cf7fb5fbb"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,15 +2,12 @@
Copyright (c) 2018 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro, Sean Leather
-
-! This file was ported from Lean 3 source module data.list.sigma
-! leanprover-community/mathlib commit f808feb6c18afddb25e66a71d317643cf7fb5fbb
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Data.List.Range
import Mathbin.Data.List.Perm
+#align_import data.list.sigma from "leanprover-community/mathlib"@"f808feb6c18afddb25e66a71d317643cf7fb5fbb"
+
/-!
# Utilities for lists of sigmas
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -594,9 +594,11 @@ theorem mem_keys_kerase_of_ne {a₁ a₂} {l : List (Sigma β)} (h : a₁ ≠ a
#align list.mem_keys_kerase_of_ne List.mem_keys_kerase_of_ne
-/
+#print List.keys_kerase /-
theorem keys_kerase {a} {l : List (Sigma β)} : (kerase a l).keys = l.keys.eraseₓ a := by
rw [keys, kerase, ← erasep_map Sigma.fst l, erase_eq_erasep]
#align list.keys_kerase List.keys_kerase
+-/
#print List.kerase_kerase /-
theorem kerase_kerase {a a'} {l : List (Sigma β)} :
@@ -703,6 +705,7 @@ theorem kerase_comm (a₁ a₂) (l : List (Sigma β)) :
#align list.kerase_comm List.kerase_comm
-/
+#print List.sizeOf_kerase /-
theorem sizeOf_kerase {α} {β : α → Type _} [DecidableEq α] [SizeOf (Sigma β)] (x : α)
(xs : List (Sigma β)) : SizeOf.sizeOf (List.kerase x xs) ≤ SizeOf.sizeOf xs :=
by
@@ -711,6 +714,7 @@ theorem sizeOf_kerase {α} {β : α → Type _} [DecidableEq α] [SizeOf (Sigma
· simp
· by_cases x = y.1 <;> simp [*, List.sizeof]
#align list.sizeof_kerase List.sizeOf_kerase
+-/
/-! ### `kinsert` -/
@@ -831,6 +835,7 @@ theorem dlookup_dedupKeys (a : α) (l : List (Sigma β)) : dlookup a (dedupKeys
#align list.lookup_dedupkeys List.dlookup_dedupKeys
-/
+#print List.sizeOf_dedupKeys /-
theorem sizeOf_dedupKeys {α} {β : α → Type _} [DecidableEq α] [SizeOf (Sigma β)]
(xs : List (Sigma β)) : SizeOf.sizeOf (List.dedupKeys xs) ≤ SizeOf.sizeOf xs :=
by
@@ -841,6 +846,7 @@ theorem sizeOf_dedupKeys {α} {β : α → Type _} [DecidableEq α] [SizeOf (Sig
trans; apply sizeof_kerase
assumption
#align list.sizeof_dedupkeys List.sizeOf_dedupKeys
+-/
/-! ### `kunion` -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/5f25c089cb34db4db112556f23c50d12da81b297
@@ -220,26 +220,26 @@ theorem mem_ext {l₀ l₁ : List (Sigma β)} (nd₀ : l₀.Nodup) (nd₁ : l₁
cases h
simp at nd₀ nd₁
classical
- obtain rfl | h' := eq_or_ne x y
+ obtain rfl | h' := eq_or_ne x y
+ · constructor
+ refine' l₀_ih nd₀.2 nd₁.2 fun a => _
+ specialize h a; simp at h
+ obtain rfl | h' := eq_or_ne a x
+ · exact iff_of_false nd₀.1 nd₁.1
+ · simpa [h'] using h
+ · trans x :: y :: ys.erase x
+ · constructor
+ refine' l₀_ih nd₀.2 ((nd₁.2.eraseₓ _).cons fun h => nd₁.1 <| mem_of_mem_erase h) fun a => _
+ · specialize h a; simp at h
+ obtain rfl | h' := eq_or_ne a x
+ · exact iff_of_false nd₀.1 fun h => h.elim h' nd₁.2.not_mem_erase
+ · rw [or_iff_right h'] at h
+ rw [h, mem_cons_iff]
+ exact or_congr_right (mem_erase_of_ne h').symm
+ trans y :: x :: ys.erase x
· constructor
- refine' l₀_ih nd₀.2 nd₁.2 fun a => _
- specialize h a; simp at h
- obtain rfl | h' := eq_or_ne a x
- · exact iff_of_false nd₀.1 nd₁.1
- · simpa [h'] using h
- · trans x :: y :: ys.erase x
- · constructor
- refine' l₀_ih nd₀.2 ((nd₁.2.eraseₓ _).cons fun h => nd₁.1 <| mem_of_mem_erase h) fun a => _
- · specialize h a; simp at h
- obtain rfl | h' := eq_or_ne a x
- · exact iff_of_false nd₀.1 fun h => h.elim h' nd₁.2.not_mem_erase
- · rw [or_iff_right h'] at h
- rw [h, mem_cons_iff]
- exact or_congr_right (mem_erase_of_ne h').symm
- trans y :: x :: ys.erase x
- · constructor
- · constructor; symm; apply perm_cons_erase
- specialize h x; simp [h'] at h ; exact h
+ · constructor; symm; apply perm_cons_erase
+ specialize h x; simp [h'] at h ; exact h
#align list.mem_ext List.mem_ext
-/
@@ -498,7 +498,7 @@ theorem Perm.kreplace {a : α} {b : β a} {l₁ l₂ : List (Sigma β)} (nd : l
perm_lookmap _ <| by
refine' nd.pairwise_ne.imp _
intro x y h z h₁ w h₂
- split_ifs at h₁ h₂ <;> cases h₁ <;> cases h₂
+ split_ifs at h₁ h₂ <;> cases h₁ <;> cases h₂
exact (h (h_2.symm.trans h_1)).elim
#align list.perm.kreplace List.Perm.kreplace
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -93,7 +93,7 @@ theorem not_mem_keys {a} {l : List (Sigma β)} : a ∉ l.keys ↔ ∀ b : β a,
#print List.not_eq_key /-
theorem not_eq_key {a} {l : List (Sigma β)} : a ∉ l.keys ↔ ∀ s : Sigma β, s ∈ l → a ≠ s.1 :=
- Iff.intro (fun h₁ s h₂ e => absurd (mem_keys_of_mem h₂) (by rwa [e] at h₁)) fun f h₁ =>
+ Iff.intro (fun h₁ s h₂ e => absurd (mem_keys_of_mem h₂) (by rwa [e] at h₁ )) fun f h₁ =>
let ⟨b, h₂⟩ := exists_of_mem_keys h₁
f _ h₂ rfl
#align list.not_eq_key List.not_eq_key
@@ -212,31 +212,34 @@ theorem mem_ext {l₀ l₁ : List (Sigma β)} (nd₀ : l₀.Nodup) (nd₁ : l₁
by
induction' l₀ with x xs generalizing l₁ <;> cases' l₁ with y ys
· constructor
- iterate 2
- first |specialize h x|specialize h y; simp at h
+ iterate 2
+
+ first
+ | specialize h x
+ | specialize h y; simp at h
cases h
- simp at nd₀ nd₁
+ simp at nd₀ nd₁
classical
obtain rfl | h' := eq_or_ne x y
· constructor
refine' l₀_ih nd₀.2 nd₁.2 fun a => _
- specialize h a; simp at h
+ specialize h a; simp at h
obtain rfl | h' := eq_or_ne a x
· exact iff_of_false nd₀.1 nd₁.1
· simpa [h'] using h
· trans x :: y :: ys.erase x
· constructor
refine' l₀_ih nd₀.2 ((nd₁.2.eraseₓ _).cons fun h => nd₁.1 <| mem_of_mem_erase h) fun a => _
- · specialize h a; simp at h
+ · specialize h a; simp at h
obtain rfl | h' := eq_or_ne a x
· exact iff_of_false nd₀.1 fun h => h.elim h' nd₁.2.not_mem_erase
- · rw [or_iff_right h'] at h
+ · rw [or_iff_right h'] at h
rw [h, mem_cons_iff]
exact or_congr_right (mem_erase_of_ne h').symm
trans y :: x :: ys.erase x
· constructor
· constructor; symm; apply perm_cons_erase
- specialize h x; simp [h'] at h; exact h
+ specialize h x; simp [h'] at h ; exact h
#align list.mem_ext List.mem_ext
-/
@@ -296,8 +299,8 @@ theorem of_mem_dlookup {a : α} {b : β a} :
∀ {l : List (Sigma β)}, b ∈ dlookup a l → Sigma.mk a b ∈ l
| ⟨a', b'⟩ :: l, H => by
by_cases h : a = a'
- · subst a'; simp at H; simp [H]
- · simp [h] at H; exact Or.inr (of_mem_lookup H)
+ · subst a'; simp at H ; simp [H]
+ · simp [h] at H ; exact Or.inr (of_mem_lookup H)
#align list.of_mem_lookup List.of_mem_dlookup
-/
@@ -390,7 +393,7 @@ theorem lookupAll_eq_nil {a : α} :
#print List.head?_lookupAll /-
theorem head?_lookupAll (a : α) : ∀ l : List (Sigma β), head? (lookupAll a l) = dlookup a l
| [] => by simp
- | ⟨a', b⟩ :: l => by by_cases h : a = a' <;> [· subst h; simp;simp [*]]
+ | ⟨a', b⟩ :: l => by by_cases h : a = a' <;> [· subst h; simp; simp [*]]
#align list.head_lookup_all List.head?_lookupAll
-/
@@ -398,7 +401,7 @@ theorem head?_lookupAll (a : α) : ∀ l : List (Sigma β), head? (lookupAll a l
theorem mem_lookupAll {a : α} {b : β a} :
∀ {l : List (Sigma β)}, b ∈ lookupAll a l ↔ Sigma.mk a b ∈ l
| [] => by simp
- | ⟨a', b'⟩ :: l => by by_cases h : a = a' <;> [· subst h; simp [*];simp [*]]
+ | ⟨a', b'⟩ :: l => by by_cases h : a = a' <;> [· subst h; simp [*]; simp [*]]
#align list.mem_lookup_all List.mem_lookupAll
-/
@@ -415,7 +418,7 @@ theorem lookupAll_sublist (a : α) : ∀ l : List (Sigma β), (lookupAll a l).ma
#print List.lookupAll_length_le_one /-
theorem lookupAll_length_le_one (a : α) {l : List (Sigma β)} (h : l.NodupKeys) :
length (lookupAll a l) ≤ 1 := by
- have := nodup.sublist ((lookup_all_sublist a l).map _) h <;> rw [map_map] at this <;>
+ have := nodup.sublist ((lookup_all_sublist a l).map _) h <;> rw [map_map] at this <;>
rwa [← nodup_replicate, ← map_const _ a]
#align list.lookup_all_length_le_one List.lookupAll_length_le_one
-/
@@ -495,7 +498,7 @@ theorem Perm.kreplace {a : α} {b : β a} {l₁ l₂ : List (Sigma β)} (nd : l
perm_lookmap _ <| by
refine' nd.pairwise_ne.imp _
intro x y h z h₁ w h₂
- split_ifs at h₁ h₂ <;> cases h₁ <;> cases h₂
+ split_ifs at h₁ h₂ <;> cases h₁ <;> cases h₂
exact (h (h_2.symm.trans h_1)).elim
#align list.perm.kreplace List.Perm.kreplace
-/
@@ -534,7 +537,7 @@ theorem kerase_cons_ne {a} {s : Sigma β} {l : List (Sigma β)} (h : a ≠ s.1)
#print List.kerase_of_not_mem_keys /-
@[simp]
theorem kerase_of_not_mem_keys {a} {l : List (Sigma β)} (h : a ∉ l.keys) : kerase a l = l := by
- induction' l with _ _ ih <;> [rfl;· simp [not_or] at h; simp [h.1, ih h.2]]
+ induction' l with _ _ ih <;> [rfl; · simp [not_or] at h ; simp [h.1, ih h.2]]
#align list.kerase_of_not_mem_keys List.kerase_of_not_mem_keys
-/
@@ -559,7 +562,7 @@ theorem mem_keys_of_mem_keys_kerase {a₁ a₂} {l : List (Sigma β)} :
#print List.exists_of_kerase /-
theorem exists_of_kerase {a : α} {l : List (Sigma β)} (h : a ∈ l.keys) :
- ∃ (b : β a)(l₁ l₂ : List (Sigma β)),
+ ∃ (b : β a) (l₁ l₂ : List (Sigma β)),
a ∉ l₁.keys ∧ l = l₁ ++ ⟨a, b⟩ :: l₂ ∧ kerase a l = l₁ ++ l₂ :=
by
induction l
@@ -568,7 +571,7 @@ theorem exists_of_kerase {a : α} {l : List (Sigma β)} (h : a ∈ l.keys) :
by_cases e : a = hd.1
· subst e
exact ⟨hd.2, [], tl, by simp, by cases hd <;> rfl, by simp⟩
- · simp at h
+ · simp at h
cases h
case inl h => exact absurd h e
case inr h =>
@@ -630,7 +633,7 @@ theorem not_mem_keys_kerase (a) {l : List (Sigma β)} (nd : l.NodupKeys) : a ∉
induction l
case nil => simp
case cons hd tl ih =>
- simp at nd
+ simp at nd
by_cases h : a = hd.1
· subst h; simp [nd.1]
· simp [h, ih nd.2]
@@ -668,7 +671,7 @@ theorem kerase_append_left {a} :
| [], _, h => by cases h
| s :: l₁, l₂, h₁ =>
if h₂ : a = s.1 then by simp [h₂]
- else by simp at h₁ <;> cases h₁ <;> [exact absurd h₁ h₂;simp [h₂, kerase_append_left h₁]]
+ else by simp at h₁ <;> cases h₁ <;> [exact absurd h₁ h₂; simp [h₂, kerase_append_left h₁]]
#align list.kerase_append_left List.kerase_append_left
-/
@@ -676,7 +679,7 @@ theorem kerase_append_left {a} :
theorem kerase_append_right {a} :
∀ {l₁ l₂ : List (Sigma β)}, a ∉ l₁.keys → kerase a (l₁ ++ l₂) = l₁ ++ kerase a l₂
| [], _, h => rfl
- | _ :: l₁, l₂, h => by simp [not_or] at h <;> simp [h.1, kerase_append_right h.2]
+ | _ :: l₁, l₂, h => by simp [not_or] at h <;> simp [h.1, kerase_append_right h.2]
#align list.kerase_append_right List.kerase_append_right
-/
@@ -881,7 +884,7 @@ theorem mem_keys_kunion {a} {l₁ l₂ : List (Sigma β)} :
by
induction l₁ generalizing l₂
case nil => simp
- case cons s l₁ ih => by_cases h : a = s.1 <;> [simp [h];simp [h, ih]]
+ case cons s l₁ ih => by_cases h : a = s.1 <;> [simp [h]; simp [h, ih]]
#align list.mem_keys_kunion List.mem_keys_kunion
-/
@@ -900,7 +903,7 @@ theorem NodupKeys.kunion (nd₁ : l₁.NodupKeys) (nd₂ : l₂.NodupKeys) : (ku
induction l₁ generalizing l₂
case nil => simp only [nil_kunion, nd₂]
case cons s l₁ ih =>
- simp at nd₁
+ simp at nd₁
simp [not_or, nd₁.1, nd₂, ih nd₁.2 (nd₂.kerase s.1)]
#align list.nodupkeys.kunion List.NodupKeys.kunion
-/
@@ -936,7 +939,7 @@ theorem Perm.kunion {l₁ l₂ l₃ l₄ : List (Sigma β)} (nd₃ : l₃.NodupK
theorem dlookup_kunion_left {a} {l₁ l₂ : List (Sigma β)} (h : a ∈ l₁.keys) :
dlookup a (kunion l₁ l₂) = dlookup a l₁ :=
by
- induction' l₁ with s _ ih generalizing l₂ <;> simp at h <;> cases h <;> cases' s with a'
+ induction' l₁ with s _ ih generalizing l₂ <;> simp at h <;> cases h <;> cases' s with a'
· subst h; simp
· rw [kunion_cons]
by_cases h' : a = a'
@@ -952,7 +955,7 @@ theorem dlookup_kunion_right {a} {l₁ l₂ : List (Sigma β)} (h : a ∉ l₁.k
by
induction l₁ generalizing l₂
case nil => simp
- case cons _ _ ih => simp [not_or] at h; simp [h.1, ih h.2]
+ case cons _ _ ih => simp [not_or] at h ; simp [h.1, ih h.2]
#align list.lookup_kunion_right List.dlookup_kunion_right
-/
@@ -967,7 +970,7 @@ theorem mem_dlookup_kunion {a} {b : β a} {l₁ l₂ : List (Sigma β)} :
cases' s with a'
by_cases h₁ : a = a'
· subst h₁; simp
- · let h₂ := @ih (kerase a' l₂); simp [h₁] at h₂; simp [h₁, h₂]
+ · let h₂ := @ih (kerase a' l₂); simp [h₁] at h₂ ; simp [h₁, h₂]
#align list.mem_lookup_kunion List.mem_dlookup_kunion
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -591,12 +591,6 @@ theorem mem_keys_kerase_of_ne {a₁ a₂} {l : List (Sigma β)} (h : a₁ ≠ a
#align list.mem_keys_kerase_of_ne List.mem_keys_kerase_of_ne
-/
-/- warning: list.keys_kerase -> List.keys_kerase is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : α -> Type.{u2}} [_inst_1 : DecidableEq.{succ u1} α] {a : α} {l : List.{max u1 u2} (Sigma.{u1, u2} α β)}, Eq.{succ u1} (List.{u1} α) (List.keys.{u1, u2} α β (List.kerase.{u1, u2} α β (fun (a : α) (b : α) => _inst_1 a b) a l)) (List.eraseₓ.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (List.keys.{u1, u2} α β l) a)
-but is expected to have type
- forall {α : Type.{u1}} {β : α -> Type.{u2}} [_inst_1 : DecidableEq.{succ u1} α] {a : α} {l : List.{max u2 u1} (Sigma.{u1, u2} α β)}, Eq.{succ u1} (List.{u1} α) (List.keys.{u1, u2} α β (List.kerase.{u1, u2} α β (fun (a : α) (b : α) => _inst_1 a b) a l)) (List.erase.{u1} α (instBEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) (List.keys.{u1, u2} α β l) a)
-Case conversion may be inaccurate. Consider using '#align list.keys_kerase List.keys_keraseₓ'. -/
theorem keys_kerase {a} {l : List (Sigma β)} : (kerase a l).keys = l.keys.eraseₓ a := by
rw [keys, kerase, ← erasep_map Sigma.fst l, erase_eq_erasep]
#align list.keys_kerase List.keys_kerase
@@ -706,12 +700,6 @@ theorem kerase_comm (a₁ a₂) (l : List (Sigma β)) :
#align list.kerase_comm List.kerase_comm
-/
-/- warning: list.sizeof_kerase -> List.sizeOf_kerase is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : α -> Type.{u2}} [_inst_2 : DecidableEq.{succ u1} α] [_inst_3 : SizeOf.{max (succ u1) (succ u2)} (Sigma.{u1, u2} α β)] (x : α) (xs : List.{max u1 u2} (Sigma.{u1, u2} α β)), LE.le.{0} Nat Nat.hasLe (SizeOf.sizeOf.{succ (max u1 u2)} (List.{max u1 u2} (Sigma.{u1, u2} α β)) (List.hasSizeof.{max u1 u2} (Sigma.{u1, u2} α β) _inst_3) (List.kerase.{u1, u2} α β (fun (a : α) (b : α) => _inst_2 a b) x xs)) (SizeOf.sizeOf.{succ (max u1 u2)} (List.{max u1 u2} (Sigma.{u1, u2} α β)) (List.hasSizeof.{max u1 u2} (Sigma.{u1, u2} α β) _inst_3) xs)
-but is expected to have type
- forall {α : Type.{u2}} {β : α -> Type.{u1}} [_inst_2 : DecidableEq.{succ u2} α] [_inst_3 : SizeOf.{max (succ u1) (succ u2)} (Sigma.{u2, u1} α β)] (x : α) (xs : List.{max u1 u2} (Sigma.{u2, u1} α β)), LE.le.{0} Nat instLENat (SizeOf.sizeOf.{max (succ u1) (succ u2)} (List.{max u1 u2} (Sigma.{u2, u1} α β)) (List._sizeOf_inst.{max u1 u2} (Sigma.{u2, u1} α β) _inst_3) (List.kerase.{u2, u1} α β (fun (a : α) (b : α) => _inst_2 a b) x xs)) (SizeOf.sizeOf.{max (succ u1) (succ u2)} (List.{max u1 u2} (Sigma.{u2, u1} α β)) (List._sizeOf_inst.{max u1 u2} (Sigma.{u2, u1} α β) _inst_3) xs)
-Case conversion may be inaccurate. Consider using '#align list.sizeof_kerase List.sizeOf_keraseₓ'. -/
theorem sizeOf_kerase {α} {β : α → Type _} [DecidableEq α] [SizeOf (Sigma β)] (x : α)
(xs : List (Sigma β)) : SizeOf.sizeOf (List.kerase x xs) ≤ SizeOf.sizeOf xs :=
by
@@ -840,12 +828,6 @@ theorem dlookup_dedupKeys (a : α) (l : List (Sigma β)) : dlookup a (dedupKeys
#align list.lookup_dedupkeys List.dlookup_dedupKeys
-/
-/- warning: list.sizeof_dedupkeys -> List.sizeOf_dedupKeys is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : α -> Type.{u2}} [_inst_2 : DecidableEq.{succ u1} α] [_inst_3 : SizeOf.{max (succ u1) (succ u2)} (Sigma.{u1, u2} α β)] (xs : List.{max u1 u2} (Sigma.{u1, u2} α β)), LE.le.{0} Nat Nat.hasLe (SizeOf.sizeOf.{succ (max u1 u2)} (List.{max u1 u2} (Sigma.{u1, u2} α β)) (List.hasSizeof.{max u1 u2} (Sigma.{u1, u2} α β) _inst_3) (List.dedupKeys.{u1, u2} α β (fun (a : α) (b : α) => _inst_2 a b) xs)) (SizeOf.sizeOf.{succ (max u1 u2)} (List.{max u1 u2} (Sigma.{u1, u2} α β)) (List.hasSizeof.{max u1 u2} (Sigma.{u1, u2} α β) _inst_3) xs)
-but is expected to have type
- forall {α : Type.{u2}} {β : α -> Type.{u1}} [_inst_2 : DecidableEq.{succ u2} α] [_inst_3 : SizeOf.{max (succ u1) (succ u2)} (Sigma.{u2, u1} α β)] (xs : List.{max u1 u2} (Sigma.{u2, u1} α β)), LE.le.{0} Nat instLENat (SizeOf.sizeOf.{max (succ u1) (succ u2)} (List.{max u1 u2} (Sigma.{u2, u1} α β)) (List._sizeOf_inst.{max u1 u2} (Sigma.{u2, u1} α β) _inst_3) (List.dedupKeys.{u2, u1} α β (fun (a : α) (b : α) => _inst_2 a b) xs)) (SizeOf.sizeOf.{max (succ u1) (succ u2)} (List.{max u1 u2} (Sigma.{u2, u1} α β)) (List._sizeOf_inst.{max u1 u2} (Sigma.{u2, u1} α β) _inst_3) xs)
-Case conversion may be inaccurate. Consider using '#align list.sizeof_dedupkeys List.sizeOf_dedupKeysₓ'. -/
theorem sizeOf_dedupKeys {α} {β : α → Type _} [DecidableEq α] [SizeOf (Sigma β)]
(xs : List (Sigma β)) : SizeOf.sizeOf (List.dedupKeys xs) ≤ SizeOf.sizeOf xs :=
by
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -220,16 +220,14 @@ theorem mem_ext {l₀ l₁ : List (Sigma β)} (nd₀ : l₀.Nodup) (nd₁ : l₁
obtain rfl | h' := eq_or_ne x y
· constructor
refine' l₀_ih nd₀.2 nd₁.2 fun a => _
- specialize h a
- simp at h
+ specialize h a; simp at h
obtain rfl | h' := eq_or_ne a x
· exact iff_of_false nd₀.1 nd₁.1
· simpa [h'] using h
· trans x :: y :: ys.erase x
· constructor
refine' l₀_ih nd₀.2 ((nd₁.2.eraseₓ _).cons fun h => nd₁.1 <| mem_of_mem_erase h) fun a => _
- · specialize h a
- simp at h
+ · specialize h a; simp at h
obtain rfl | h' := eq_or_ne a x
· exact iff_of_false nd₀.1 fun h => h.elim h' nd₁.2.not_mem_erase
· rw [or_iff_right h'] at h
@@ -237,12 +235,8 @@ theorem mem_ext {l₀ l₁ : List (Sigma β)} (nd₀ : l₀.Nodup) (nd₁ : l₁
exact or_congr_right (mem_erase_of_ne h').symm
trans y :: x :: ys.erase x
· constructor
- · constructor
- symm
- apply perm_cons_erase
- specialize h x
- simp [h'] at h
- exact h
+ · constructor; symm; apply perm_cons_erase
+ specialize h x; simp [h'] at h; exact h
#align list.mem_ext List.mem_ext
-/
@@ -286,8 +280,7 @@ theorem dlookup_isSome {a : α} : ∀ {l : List (Sigma β)}, (dlookup a l).isSom
| [] => by simp
| ⟨a', b⟩ :: l => by
by_cases h : a = a'
- · subst a'
- simp
+ · subst a'; simp
· simp [h, lookup_is_some]
#align list.lookup_is_some List.dlookup_isSome
-/
@@ -303,11 +296,8 @@ theorem of_mem_dlookup {a : α} {b : β a} :
∀ {l : List (Sigma β)}, b ∈ dlookup a l → Sigma.mk a b ∈ l
| ⟨a', b'⟩ :: l, H => by
by_cases h : a = a'
- · subst a'
- simp at H
- simp [H]
- · simp [h] at H
- exact Or.inr (of_mem_lookup H)
+ · subst a'; simp at H; simp [H]
+ · simp [h] at H; exact Or.inr (of_mem_lookup H)
#align list.of_mem_lookup List.of_mem_dlookup
-/
@@ -327,8 +317,7 @@ theorem map_dlookup_eq_find (a : α) :
| [] => rfl
| ⟨a', b'⟩ :: l => by
by_cases h : a = a'
- · subst a'
- simp
+ · subst a'; simp
· simp [h, map_lookup_eq_find]
#align list.map_lookup_eq_find List.map_dlookup_eq_find
-/
@@ -393,8 +382,7 @@ theorem lookupAll_eq_nil {a : α} :
| [] => by simp
| ⟨a', b⟩ :: l => by
by_cases h : a = a'
- · subst a'
- simp
+ · subst a'; simp
· simp [h, lookup_all_eq_nil]
#align list.lookup_all_eq_nil List.lookupAll_eq_nil
-/
@@ -402,11 +390,7 @@ theorem lookupAll_eq_nil {a : α} :
#print List.head?_lookupAll /-
theorem head?_lookupAll (a : α) : ∀ l : List (Sigma β), head? (lookupAll a l) = dlookup a l
| [] => by simp
- | ⟨a', b⟩ :: l => by
- by_cases h : a = a' <;>
- [·
- subst h
- simp;simp [*]]
+ | ⟨a', b⟩ :: l => by by_cases h : a = a' <;> [· subst h; simp;simp [*]]
#align list.head_lookup_all List.head?_lookupAll
-/
@@ -414,11 +398,7 @@ theorem head?_lookupAll (a : α) : ∀ l : List (Sigma β), head? (lookupAll a l
theorem mem_lookupAll {a : α} {b : β a} :
∀ {l : List (Sigma β)}, b ∈ lookupAll a l ↔ Sigma.mk a b ∈ l
| [] => by simp
- | ⟨a', b'⟩ :: l => by
- by_cases h : a = a' <;>
- [·
- subst h
- simp [*];simp [*]]
+ | ⟨a', b'⟩ :: l => by by_cases h : a = a' <;> [· subst h; simp [*];simp [*]]
#align list.mem_lookup_all List.mem_lookupAll
-/
@@ -427,11 +407,8 @@ theorem lookupAll_sublist (a : α) : ∀ l : List (Sigma β), (lookupAll a l).ma
| [] => by simp
| ⟨a', b'⟩ :: l => by
by_cases h : a = a'
- · subst h
- simp
- exact (lookup_all_sublist l).cons₂ _ _ _
- · simp [h]
- exact (lookup_all_sublist l).cons _ _ _
+ · subst h; simp; exact (lookup_all_sublist l).cons₂ _ _ _
+ · simp [h]; exact (lookup_all_sublist l).cons _ _ _
#align list.lookup_all_sublist List.lookupAll_sublist
-/
@@ -482,8 +459,7 @@ theorem kreplace_of_forall_not (a : α) (b : β a) {l : List (Sigma β)}
(H : ∀ b : β a, Sigma.mk a b ∉ l) : kreplace a b l = l :=
lookmap_of_forall_not _ <| by
rintro ⟨a', b'⟩ h; dsimp; split_ifs
- · subst a'
- exact H _ h; · rfl
+ · subst a'; exact H _ h; · rfl
#align list.kreplace_of_forall_not List.kreplace_of_forall_not
-/
@@ -492,17 +468,11 @@ theorem kreplace_self {a : α} {b : β a} {l : List (Sigma β)} (nd : NodupKeys
(h : Sigma.mk a b ∈ l) : kreplace a b l = l :=
by
refine' (lookmap_congr _).trans (lookmap_id' (Option.guard fun s => a = s.1) _ _)
- · rintro ⟨a', b'⟩ h'
- dsimp [Option.guard]
- split_ifs
- · subst a'
- exact ⟨rfl, hEq_of_eq <| nd.eq_of_mk_mem h h'⟩
+ · rintro ⟨a', b'⟩ h'; dsimp [Option.guard]; split_ifs
+ · subst a'; exact ⟨rfl, hEq_of_eq <| nd.eq_of_mk_mem h h'⟩
· rfl
- · rintro ⟨a₁, b₁⟩ ⟨a₂, b₂⟩
- dsimp [Option.guard]
- split_ifs
- · exact id
- · rintro ⟨⟩
+ · rintro ⟨a₁, b₁⟩ ⟨a₂, b₂⟩; dsimp [Option.guard]; split_ifs
+ · exact id; · rintro ⟨⟩
#align list.kreplace_self List.kreplace_self
-/
@@ -564,10 +534,7 @@ theorem kerase_cons_ne {a} {s : Sigma β} {l : List (Sigma β)} (h : a ≠ s.1)
#print List.kerase_of_not_mem_keys /-
@[simp]
theorem kerase_of_not_mem_keys {a} {l : List (Sigma β)} (h : a ∉ l.keys) : kerase a l = l := by
- induction' l with _ _ ih <;>
- [rfl;·
- simp [not_or] at h
- simp [h.1, ih h.2]]
+ induction' l with _ _ ih <;> [rfl;· simp [not_or] at h; simp [h.1, ih h.2]]
#align list.kerase_of_not_mem_keys List.kerase_of_not_mem_keys
-/
@@ -642,11 +609,9 @@ theorem kerase_kerase {a a'} {l : List (Sigma β)} :
· subst a'
induction' l with x xs; · rfl
· by_cases a' = x.1
- · subst a'
- simp [kerase_cons_ne h, kerase_cons_eq rfl]
+ · subst a'; simp [kerase_cons_ne h, kerase_cons_eq rfl]
by_cases h' : a = x.1
- · subst a
- simp [kerase_cons_eq rfl, kerase_cons_ne (Ne.symm h)]
+ · subst a; simp [kerase_cons_eq rfl, kerase_cons_ne (Ne.symm h)]
· simp [kerase_cons_ne, *]
#align list.kerase_kerase List.kerase_kerase
-/
@@ -673,8 +638,7 @@ theorem not_mem_keys_kerase (a) {l : List (Sigma β)} (nd : l.NodupKeys) : a ∉
case cons hd tl ih =>
simp at nd
by_cases h : a = hd.1
- · subst h
- simp [nd.1]
+ · subst h; simp [nd.1]
· simp [h, ih nd.2]
#align list.not_mem_keys_kerase List.not_mem_keys_kerase
-/
@@ -697,12 +661,9 @@ theorem dlookup_kerase_ne {a a'} {l : List (Sigma β)} (h : a ≠ a') :
case cons hd tl ih =>
cases' hd with ah bh
by_cases h₁ : a = ah <;> by_cases h₂ : a' = ah
- · substs h₁ h₂
- cases Ne.irrefl h
- · subst h₁
- simp [h₂]
- · subst h₂
- simp [h]
+ · substs h₁ h₂; cases Ne.irrefl h
+ · subst h₁; simp [h₂]
+ · subst h₂; simp [h]
· simp [h₁, h₂, ih]
#align list.lookup_kerase_ne List.dlookup_kerase_ne
-/
@@ -832,8 +793,7 @@ theorem kextract_eq_dlookup_kerase (a : α) :
| [] => rfl
| ⟨a', b⟩ :: l => by
simp [kextract]; dsimp; split_ifs
- · subst a'
- simp [kerase]
+ · subst a'; simp [kerase]
· simp [kextract, Ne.symm h, kextract_eq_lookup_kerase l, kerase]
#align list.kextract_eq_lookup_kerase List.kextract_eq_dlookup_kerase
-/
@@ -858,19 +818,13 @@ theorem dedupKeys_cons {x : Sigma β} (l : List (Sigma β)) :
#print List.nodupKeys_dedupKeys /-
theorem nodupKeys_dedupKeys (l : List (Sigma β)) : NodupKeys (dedupKeys l) :=
by
- dsimp [dedupkeys]
- generalize hl : nil = l'
- have : nodupkeys l' := by
- rw [← hl]
- apply nodup_nil
+ dsimp [dedupkeys]; generalize hl : nil = l'
+ have : nodupkeys l' := by rw [← hl]; apply nodup_nil
clear hl
induction' l with x xs
· apply this
- · cases x
- simp [dedupkeys]
- constructor
- · simp [keys_kerase]
- apply l_ih.not_mem_erase
+ · cases x; simp [dedupkeys]; constructor
+ · simp [keys_kerase]; apply l_ih.not_mem_erase
· exact l_ih.kerase _
#align list.nodupkeys_dedupkeys List.nodupKeys_dedupKeys
-/
@@ -881,10 +835,8 @@ theorem dlookup_dedupKeys (a : α) (l : List (Sigma β)) : dlookup a (dedupKeys
induction l; rfl
cases' l_hd with a' b
by_cases a = a'
- · subst a'
- rw [dedupkeys_cons, lookup_kinsert, lookup_cons_eq]
- · rw [dedupkeys_cons, lookup_kinsert_ne h, l_ih, lookup_cons_ne]
- exact h
+ · subst a'; rw [dedupkeys_cons, lookup_kinsert, lookup_cons_eq]
+ · rw [dedupkeys_cons, lookup_kinsert_ne h, l_ih, lookup_cons_ne]; exact h
#align list.lookup_dedupkeys List.dlookup_dedupKeys
-/
@@ -901,8 +853,7 @@ theorem sizeOf_dedupKeys {α} {β : α → Type _} [DecidableEq α] [SizeOf (Sig
induction' xs with x xs
· simp [List.dedupKeys]
· simp only [dedupkeys_cons, List.sizeof, kinsert_def, add_le_add_iff_left, Sigma.eta]
- trans
- apply sizeof_kerase
+ trans; apply sizeof_kerase
assumption
#align list.sizeof_dedupkeys List.sizeOf_dedupKeys
@@ -1004,12 +955,10 @@ theorem dlookup_kunion_left {a} {l₁ l₂ : List (Sigma β)} (h : a ∈ l₁.ke
dlookup a (kunion l₁ l₂) = dlookup a l₁ :=
by
induction' l₁ with s _ ih generalizing l₂ <;> simp at h <;> cases h <;> cases' s with a'
- · subst h
- simp
+ · subst h; simp
· rw [kunion_cons]
by_cases h' : a = a'
- · subst h'
- simp
+ · subst h'; simp
· simp [h', ih h]
#align list.lookup_kunion_left List.dlookup_kunion_left
-/
@@ -1035,11 +984,8 @@ theorem mem_dlookup_kunion {a} {b : β a} {l₁ l₂ : List (Sigma β)} :
case cons s _ ih =>
cases' s with a'
by_cases h₁ : a = a'
- · subst h₁
- simp
- · let h₂ := @ih (kerase a' l₂)
- simp [h₁] at h₂
- simp [h₁, h₂]
+ · subst h₁; simp
+ · let h₂ := @ih (kerase a' l₂); simp [h₁] at h₂; simp [h₁, h₂]
#align list.mem_lookup_kunion List.mem_dlookup_kunion
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/8d33f09cd7089ecf074b4791907588245aec5d1b
@@ -406,7 +406,7 @@ theorem head?_lookupAll (a : α) : ∀ l : List (Sigma β), head? (lookupAll a l
by_cases h : a = a' <;>
[·
subst h
- simp, simp [*]]
+ simp;simp [*]]
#align list.head_lookup_all List.head?_lookupAll
-/
@@ -418,7 +418,7 @@ theorem mem_lookupAll {a : α} {b : β a} :
by_cases h : a = a' <;>
[·
subst h
- simp [*], simp [*]]
+ simp [*];simp [*]]
#align list.mem_lookup_all List.mem_lookupAll
-/
@@ -564,8 +564,9 @@ theorem kerase_cons_ne {a} {s : Sigma β} {l : List (Sigma β)} (h : a ≠ s.1)
#print List.kerase_of_not_mem_keys /-
@[simp]
theorem kerase_of_not_mem_keys {a} {l : List (Sigma β)} (h : a ∉ l.keys) : kerase a l = l := by
- induction' l with _ _ ih <;> [rfl,
- · simp [not_or] at h
+ induction' l with _ _ ih <;>
+ [rfl;·
+ simp [not_or] at h
simp [h.1, ih h.2]]
#align list.kerase_of_not_mem_keys List.kerase_of_not_mem_keys
-/
@@ -712,7 +713,7 @@ theorem kerase_append_left {a} :
| [], _, h => by cases h
| s :: l₁, l₂, h₁ =>
if h₂ : a = s.1 then by simp [h₂]
- else by simp at h₁ <;> cases h₁ <;> [exact absurd h₁ h₂, simp [h₂, kerase_append_left h₁]]
+ else by simp at h₁ <;> cases h₁ <;> [exact absurd h₁ h₂;simp [h₂, kerase_append_left h₁]]
#align list.kerase_append_left List.kerase_append_left
-/
@@ -947,7 +948,7 @@ theorem mem_keys_kunion {a} {l₁ l₂ : List (Sigma β)} :
by
induction l₁ generalizing l₂
case nil => simp
- case cons s l₁ ih => by_cases h : a = s.1 <;> [simp [h], simp [h, ih]]
+ case cons s l₁ ih => by_cases h : a = s.1 <;> [simp [h];simp [h, ih]]
#align list.mem_keys_kunion List.mem_keys_kunion
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce86f4e05e9a9b8da5e316b22c76ce76440c56a1
@@ -74,7 +74,7 @@ theorem mem_keys_of_mem {s : Sigma β} {l : List (Sigma β)} : s ∈ l → s.1
#print List.exists_of_mem_keys /-
theorem exists_of_mem_keys {a} {l : List (Sigma β)} (h : a ∈ l.keys) :
∃ b : β a, Sigma.mk a b ∈ l :=
- let ⟨⟨a', b'⟩, m, e⟩ := exists_of_mem_map' h
+ let ⟨⟨a', b'⟩, m, e⟩ := exists_of_mem_map h
Eq.recOn e (Exists.intro b' m)
#align list.exists_of_mem_keys List.exists_of_mem_keys
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/290a7ba01fbcab1b64757bdaa270d28f4dcede35
@@ -136,15 +136,19 @@ theorem nodupKeys_cons {s : Sigma β} {l : List (Sigma β)} :
#align list.nodupkeys_cons List.nodupKeys_cons
-/
+#print List.not_mem_keys_of_nodupKeys_cons /-
theorem not_mem_keys_of_nodupKeys_cons {s : Sigma β} {l : List (Sigma β)} (h : NodupKeys (s :: l)) :
s.1 ∉ l.keys :=
(nodupKeys_cons.1 h).1
#align list.not_mem_keys_of_nodupkeys_cons List.not_mem_keys_of_nodupKeys_cons
+-/
+#print List.nodupKeys_of_nodupKeys_cons /-
theorem nodupKeys_of_nodupKeys_cons {s : Sigma β} {l : List (Sigma β)} (h : NodupKeys (s :: l)) :
NodupKeys l :=
(nodupKeys_cons.1 h).2
#align list.nodupkeys_of_nodupkeys_cons List.nodupKeys_of_nodupKeys_cons
+-/
#print List.NodupKeys.eq_of_fst_eq /-
theorem NodupKeys.eq_of_fst_eq {l : List (Sigma β)} (nd : NodupKeys l) {s s' : Sigma β} (h : s ∈ l)
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
@@ -434,7 +434,7 @@ theorem exists_of_kerase {a : α} {l : List (Sigma β)} (h : a ∈ l.keys) :
exact ⟨hd.2, [], tl, by simp, by cases hd; rfl, by simp⟩
· simp only [keys_cons, mem_cons] at h
cases' h with h h
- exact absurd h e
+ · exact absurd h e
rcases ih h with ⟨b, tl₁, tl₂, h₁, h₂, h₃⟩
exact ⟨b, hd :: tl₁, tl₂, not_mem_cons_of_ne_of_not_mem e h₁, by (rw [h₂]; rfl), by
simp [e, h₃]⟩
@@ -655,7 +655,8 @@ theorem nodupKeys_dedupKeys (l : List (Sigma β)) : NodupKeys (dedupKeys l) := b
#align list.nodupkeys_dedupkeys List.nodupKeys_dedupKeys
theorem dlookup_dedupKeys (a : α) (l : List (Sigma β)) : dlookup a (dedupKeys l) = dlookup a l := by
- induction' l with l_hd _ l_ih; rfl
+ induction' l with l_hd _ l_ih
+ · rfl
cases' l_hd with a' b
by_cases h : a = a'
· subst a'
@@ -671,8 +672,8 @@ theorem sizeOf_dedupKeys {α} {β : α → Type*} [DecidableEq α] [SizeOf (Sigm
· simp [dedupKeys]
· simp only [dedupKeys_cons, kinsert_def, Nat.add_le_add_iff_left, Sigma.eta]
trans
- apply sizeOf_kerase
- assumption
+ · apply sizeOf_kerase
+ · assumption
#align list.sizeof_dedupkeys List.sizeOf_dedupKeys
/-! ### `kunion` -/
bex
and ball
from lemma names (#11615)
Follow-up to #10816.
Remaining places containing such lemmas are
Option.bex_ne_none
and Option.ball_ne_none
: defined in Lean coreNat.decidableBallLT
and Nat.decidableBallLE
: defined in Lean corebef_def
is still used in a number of places and could be renamedBAll.imp_{left,right}
, BEx.imp_{left,right}
, BEx.intro
and BEx.elim
I only audited the first ~150 lemmas mentioning "ball"; too many lemmas named after Metric.ball/openBall/closedBall.
Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>
@@ -144,7 +144,7 @@ theorem perm_nodupKeys {l₁ l₂ : List (Sigma β)} (h : l₁ ~ l₂) : NodupKe
theorem nodupKeys_join {L : List (List (Sigma β))} :
NodupKeys (join L) ↔ (∀ l ∈ L, NodupKeys l) ∧ Pairwise Disjoint (L.map keys) := by
rw [nodupKeys_iff_pairwise, pairwise_join, pairwise_map]
- refine' and_congr (ball_congr fun l _ => by simp [nodupKeys_iff_pairwise]) _
+ refine' and_congr (forall₂_congr fun l _ => by simp [nodupKeys_iff_pairwise]) _
apply iff_of_eq; congr with (l₁ l₂)
simp [keys, disjoint_iff_ne]
#align list.nodupkeys_join List.nodupKeys_join
Algebra.BigOperators.List.Basic
, Data.List.Chain
not depend on Data.Nat.Order.Basic
by using Nat
-specific Std lemmas rather than general mathlib ones. I leave the Data.Nat.Basic
import since Algebra.BigOperators.List.Basic
is algebra territory.Algebra.BigOperators.List.Basic
not depend on Algebra.Divisibility.Basic
. I'm not too sure about that one since they already are algebra. My motivation is that they involve ring-like objects while big operators are about group-like objects, but this is in some sense a second order refactor.MonoidWithZero
lemmas from Algebra.BigOperators.List.Basic
to Algebra.BigOperators.List.Lemmas
.Algebra.BigOperators.List.Defs
to Algebra.BigOperators.List.Basic
since no file imported the former without the latter and their imports are becoming very close after this PR.Data.List.Count
, Data.List.Dedup
, Data.List.ProdSigma
, Data.List.Zip
not depend on Algebra.BigOperators.List.Basic
.Algebra.BigOperators.List.Basic
. For the lemmas that were Nat
-specific, keep a version of them stated using Nat.sum
.Nat.sum_eq_listSum (l : List Nat) : Nat.sum l = l.sum
.@@ -669,7 +669,7 @@ theorem sizeOf_dedupKeys {α} {β : α → Type*} [DecidableEq α] [SizeOf (Sigm
simp only [SizeOf.sizeOf, _sizeOf_1]
induction' xs with x xs
· simp [dedupKeys]
- · simp only [dedupKeys_cons, kinsert_def, add_le_add_iff_left, Sigma.eta]
+ · simp only [dedupKeys_cons, kinsert_def, Nat.add_le_add_iff_left, Sigma.eta]
trans
apply sizeOf_kerase
assumption
@@ -390,7 +390,7 @@ def kerase (a : α) : List (Sigma β) → List (Sigma β) :=
eraseP fun s => a = s.1
#align list.kerase List.kerase
--- Porting note: removing @[simp], `simp` can prove it
+-- Porting note (#10618): removing @[simp], `simp` can prove it
theorem kerase_nil {a} : @kerase _ β _ a [] = [] :=
rfl
#align list.kerase_nil List.kerase_nil
@@ -783,7 +783,7 @@ theorem mem_dlookup_kunion {a} {b : β a} {l₁ l₂ : List (Sigma β)} :
simp [h₁, h₂]
#align list.mem_lookup_kunion List.mem_dlookup_kunion
--- Porting note: New theorem, alternative version of `mem_dlookup_kunion` for simp
+-- Porting note (#10756): new theorem, alternative version of `mem_dlookup_kunion` for simp
@[simp]
theorem dlookup_kunion_eq_some {a} {b : β a} {l₁ l₂ : List (Sigma β)} :
dlookup a (kunion l₁ l₂) = some b ↔
@@ -223,8 +223,7 @@ theorem map_dlookup_eq_find (a : α) :
by_cases h : a = a'
· subst a'
simp
- · simp [h]
- exact map_dlookup_eq_find a l
+ · simpa [h] using map_dlookup_eq_find a l
#align list.map_lookup_eq_find List.map_dlookup_eq_find
theorem mem_dlookup_iff {a : α} {b : β a} {l : List (Sigma β)} (nd : l.NodupKeys) :
@@ -433,7 +432,7 @@ theorem exists_of_kerase {a : α} {l : List (Sigma β)} (h : a ∈ l.keys) :
by_cases e : a = hd.1
· subst e
exact ⟨hd.2, [], tl, by simp, by cases hd; rfl, by simp⟩
- · simp at h
+ · simp only [keys_cons, mem_cons] at h
cases' h with h h
exact absurd h e
rcases ih h with ⟨b, tl₁, tl₂, h₁, h₂, h₃⟩
@@ -532,7 +531,9 @@ theorem kerase_append_left {a} :
theorem kerase_append_right {a} :
∀ {l₁ l₂ : List (Sigma β)}, a ∉ l₁.keys → kerase a (l₁ ++ l₂) = l₁ ++ kerase a l₂
| [], _, _ => rfl
- | _ :: l₁, l₂, h => by simp [not_or] at h; simp [h.1, kerase_append_right h.2]
+ | _ :: l₁, l₂, h => by
+ simp only [keys_cons, mem_cons, not_or] at h
+ simp [h.1, kerase_append_right h.2]
#align list.kerase_append_right List.kerase_append_right
theorem kerase_comm (a₁ a₂) (l : List (Sigma β)) :
@@ -616,7 +617,7 @@ theorem kextract_eq_dlookup_kerase (a : α) :
∀ l : List (Sigma β), kextract a l = (dlookup a l, kerase a l)
| [] => rfl
| ⟨a', b⟩ :: l => by
- simp [kextract]; dsimp; split_ifs with h
+ simp only [kextract]; dsimp; split_ifs with h
· subst a'
simp [kerase]
· simp [kextract, Ne.symm h, kextract_eq_dlookup_kerase a l, kerase]
@@ -648,7 +649,7 @@ theorem nodupKeys_dedupKeys (l : List (Sigma β)) : NodupKeys (dedupKeys l) := b
· cases x
simp only [foldr_cons, kinsert_def, nodupKeys_cons, ne_eq, not_true]
constructor
- · simp [keys_kerase]
+ · simp only [keys_kerase]
apply l_ih.not_mem_erase
· exact l_ih.kerase _
#align list.nodupkeys_dedupkeys List.nodupKeys_dedupKeys
@@ -763,7 +764,7 @@ theorem dlookup_kunion_right {a} {l₁ l₂ : List (Sigma β)} (h : a ∉ l₁.k
dlookup a (kunion l₁ l₂) = dlookup a l₂ := by
induction l₁ generalizing l₂ with
| nil => simp
- | cons _ _ ih => simp [not_or] at h; simp [h.1, ih h.2]
+ | cons _ _ ih => simp_all [not_or]
#align list.lookup_kunion_right List.dlookup_kunion_right
-- Porting note: removing simp, LHS not in normal form, added new version
Homogenises porting notes via capitalisation and addition of whitespace.
It makes the following changes:
@@ -162,7 +162,7 @@ variable [DecidableEq α]
/-! ### `dlookup` -/
---Porting note: renaming to `dlookup` since `lookup` already exists
+-- Porting note: renaming to `dlookup` since `lookup` already exists
/-- `dlookup a l` is the first value in `l` corresponding to the key `a`,
or `none` if no such element exists. -/
def dlookup (a : α) : List (Sigma β) → Option (β a)
@@ -391,7 +391,7 @@ def kerase (a : α) : List (Sigma β) → List (Sigma β) :=
eraseP fun s => a = s.1
#align list.kerase List.kerase
---Porting note: removing @[simp], `simp` can prove it
+-- Porting note: removing @[simp], `simp` can prove it
theorem kerase_nil {a} : @kerase _ β _ a [] = [] :=
rfl
#align list.kerase_nil List.kerase_nil
@@ -766,7 +766,7 @@ theorem dlookup_kunion_right {a} {l₁ l₂ : List (Sigma β)} (h : a ∉ l₁.k
| cons _ _ ih => simp [not_or] at h; simp [h.1, ih h.2]
#align list.lookup_kunion_right List.dlookup_kunion_right
---Porting note: removing simp, LHS not in normal form, added new version
+-- Porting note: removing simp, LHS not in normal form, added new version
theorem mem_dlookup_kunion {a} {b : β a} {l₁ l₂ : List (Sigma β)} :
b ∈ dlookup a (kunion l₁ l₂) ↔ b ∈ dlookup a l₁ ∨ a ∉ l₁.keys ∧ b ∈ dlookup a l₂ := by
induction l₁ generalizing l₂ with
@@ -782,7 +782,7 @@ theorem mem_dlookup_kunion {a} {b : β a} {l₁ l₂ : List (Sigma β)} :
simp [h₁, h₂]
#align list.mem_lookup_kunion List.mem_dlookup_kunion
---Porting note: New theorem, alternative version of `mem_dlookup_kunion` for simp
+-- Porting note: New theorem, alternative version of `mem_dlookup_kunion` for simp
@[simp]
theorem dlookup_kunion_eq_some {a} {b : β a} {l₁ l₂ : List (Sigma β)} :
dlookup a (kunion l₁ l₂) = some b ↔
@@ -453,6 +453,10 @@ theorem mem_keys_kerase_of_ne {a₁ a₂} {l : List (Sigma β)} (h : a₁ ≠ a
theorem keys_kerase {a} {l : List (Sigma β)} : (kerase a l).keys = l.keys.erase a := by
rw [keys, kerase, erase_eq_eraseP, eraseP_map, Function.comp]
+ simp only [beq_eq_decide]
+ congr
+ funext
+ simp
#align list.keys_kerase List.keys_kerase
theorem kerase_kerase {a a'} {l : List (Sigma β)} :
bump/v4.5.0
branch. (#9188)
This PR:
v4.5.0-rc1
v4.5.0-rc1
bump/v4.5.0
branch
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@@ -28,7 +28,6 @@ If `α : Type*` and `β : α → Type*`, then we regard `s : Sigma β` as having
- `List.kextract` returns a value with a given key and the rest of the values.
-/
-
universe u v
namespace List
@@ -204,9 +203,7 @@ theorem of_mem_dlookup {a : α} {b : β a} :
| ⟨a', b'⟩ :: l, H => by
by_cases h : a = a'
· subst a'
- simp? at H says
- simp only [ne_eq, not_true_eq_false, dlookup_cons_eq, Option.mem_def,
- Option.some.injEq] at H
+ simp? at H says simp only [dlookup_cons_eq, Option.mem_def, Option.some.injEq] at H
simp [H]
· simp only [ne_eq, h, not_false_iff, dlookup_cons_ne] at H
simp [of_mem_dlookup H]
@@ -204,7 +204,9 @@ theorem of_mem_dlookup {a : α} {b : β a} :
| ⟨a', b'⟩ :: l, H => by
by_cases h : a = a'
· subst a'
- simp at H
+ simp? at H says
+ simp only [ne_eq, not_true_eq_false, dlookup_cons_eq, Option.mem_def,
+ Option.some.injEq] at H
simp [H]
· simp only [ne_eq, h, not_false_iff, dlookup_cons_ne] at H
simp [of_mem_dlookup H]
@@ -488,7 +490,7 @@ theorem not_mem_keys_kerase (a) {l : List (Sigma β)} (nd : l.NodupKeys) :
induction l with
| nil => simp
| cons hd tl ih =>
- simp at nd
+ simp? at nd says simp only [nodupKeys_cons] at nd
by_cases h : a = hd.1
· subst h
simp [nd.1]
@@ -717,7 +719,7 @@ theorem NodupKeys.kunion (nd₁ : l₁.NodupKeys) (nd₂ : l₂.NodupKeys) : (ku
induction l₁ generalizing l₂ with
| nil => simp only [nil_kunion, nd₂]
| cons s l₁ ih =>
- simp at nd₁
+ simp? at nd₁ says simp only [nodupKeys_cons] at nd₁
simp [not_or, nd₁.1, nd₂, ih nd₁.2 (nd₂.kerase s.1)]
#align list.nodupkeys.kunion List.NodupKeys.kunion
@@ -774,7 +776,8 @@ theorem mem_dlookup_kunion {a} {b : β a} {l₁ l₂ : List (Sigma β)} :
· subst h₁
simp
· let h₂ := @ih (kerase a' l₂)
- simp [h₁] at h₂
+ simp? [h₁] at h₂ says
+ simp only [Option.mem_def, ne_eq, h₁, not_false_eq_true, dlookup_kerase_ne] at h₂
simp [h₁, h₂]
#align list.mem_lookup_kunion List.mem_dlookup_kunion
@@ -155,7 +155,7 @@ theorem nodup_enum_map_fst (l : List α) : (l.enum.map Prod.fst).Nodup := by sim
theorem mem_ext {l₀ l₁ : List (Sigma β)} (nd₀ : l₀.Nodup) (nd₁ : l₁.Nodup)
(h : ∀ x, x ∈ l₀ ↔ x ∈ l₁) : l₀ ~ l₁ :=
- (perm_ext nd₀ nd₁).2 h
+ (perm_ext_iff_of_nodup nd₀ nd₁).2 h
#align list.mem_ext List.mem_ext
variable [DecidableEq α]
@@ -476,8 +476,10 @@ theorem NodupKeys.kerase (a : α) : NodupKeys l → (kerase a l).NodupKeys :=
#align list.nodupkeys.kerase List.NodupKeys.kerase
theorem Perm.kerase {a : α} {l₁ l₂ : List (Sigma β)} (nd : l₁.NodupKeys) :
- l₁ ~ l₂ → kerase a l₁ ~ kerase a l₂ :=
- Perm.erasep _ <| (nodupKeys_iff_pairwise.1 nd).imp <| by rintro x y h rfl; exact h
+ l₁ ~ l₂ → kerase a l₁ ~ kerase a l₂ := by
+ apply Perm.eraseP
+ apply (nodupKeys_iff_pairwise.1 nd).imp
+ intros; simp_all
#align list.perm.kerase List.Perm.kerase
@[simp]
This is the supremum of
along with some minor fixes from failures on nightly-testing as Mathlib master
is merged into it.
Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.
I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0
branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.
In particular this includes adjustments for the Lean PRs
We can get rid of all the
local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)
macros across Mathlib (and in any projects that want to write natural number powers of reals).
Changes the default behaviour of simp
to (config := {decide := false})
. This makes simp
(and consequentially norm_num
) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp
or norm_num
to decide
or rfl
, or adding (config := {decide := true})
.
This changed the behaviour of simp
so that simp [f]
will only unfold "fully applied" occurrences of f
. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true })
. We may in future add a syntax for this, e.g. simp [!f]
; please provide feedback! In the meantime, we have made the following changes:
(config := { unfoldPartialApp := true })
in some places, to recover the old behaviour@[eqns]
to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp
and Function.flip
.This change in Lean may require further changes down the line (e.g. adding the !f
syntax, and/or upstreaming the special treatment for Function.comp
and Function.flip
, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!
Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>
@@ -453,7 +453,7 @@ theorem mem_keys_kerase_of_ne {a₁ a₂} {l : List (Sigma β)} (h : a₁ ≠ a
#align list.mem_keys_kerase_of_ne List.mem_keys_kerase_of_ne
theorem keys_kerase {a} {l : List (Sigma β)} : (kerase a l).keys = l.keys.erase a := by
- rw [keys, kerase, erase_eq_eraseP, eraseP_map]; dsimp [Function.comp]
+ rw [keys, kerase, erase_eq_eraseP, eraseP_map, Function.comp]
#align list.keys_kerase List.keys_kerase
theorem kerase_kerase {a a'} {l : List (Sigma β)} :
Removes nonterminal simps on lines looking like simp [...]
@@ -641,7 +641,7 @@ theorem nodupKeys_dedupKeys (l : List (Sigma β)) : NodupKeys (dedupKeys l) := b
induction' l with x xs l_ih
· apply this
· cases x
- simp [dedupKeys]
+ simp only [foldr_cons, kinsert_def, nodupKeys_cons, ne_eq, not_true]
constructor
· simp [keys_kerase]
apply l_ih.not_mem_erase
@@ -549,7 +549,7 @@ theorem kerase_comm (a₁ a₂) (l : List (Sigma β)) :
#align list.kerase_comm List.kerase_comm
theorem sizeOf_kerase {α} {β : α → Type*} [DecidableEq α] [SizeOf (Sigma β)] (x : α)
- (xs : List (Sigma β)) : SizeOf.sizeOf (List.kerase x xs) ≤ SizeOf.sizeOf xs :=by
+ (xs : List (Sigma β)) : SizeOf.sizeOf (List.kerase x xs) ≤ SizeOf.sizeOf xs := by
simp only [SizeOf.sizeOf, _sizeOf_1]
induction' xs with y ys
· simp
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -13,7 +13,7 @@ import Mathlib.Data.List.Perm
This file includes several ways of interacting with `List (Sigma β)`, treated as a key-value store.
-If `α : Type _` and `β : α → Type _`, then we regard `s : Sigma β` as having key `s.1 : α` and value
+If `α : Type*` and `β : α → Type*`, then we regard `s : Sigma β` as having key `s.1 : α` and value
`s.2 : β s.1`. Hence, `List (Sigma β)` behaves like a key-value store.
## Main Definitions
@@ -548,7 +548,7 @@ theorem kerase_comm (a₁ a₂) (l : List (Sigma β)) :
else by simp [ha₁, mt mem_keys_of_mem_keys_kerase ha₁]
#align list.kerase_comm List.kerase_comm
-theorem sizeOf_kerase {α} {β : α → Type _} [DecidableEq α] [SizeOf (Sigma β)] (x : α)
+theorem sizeOf_kerase {α} {β : α → Type*} [DecidableEq α] [SizeOf (Sigma β)] (x : α)
(xs : List (Sigma β)) : SizeOf.sizeOf (List.kerase x xs) ≤ SizeOf.sizeOf xs :=by
simp only [SizeOf.sizeOf, _sizeOf_1]
induction' xs with y ys
@@ -658,7 +658,7 @@ theorem dlookup_dedupKeys (a : α) (l : List (Sigma β)) : dlookup a (dedupKeys
exact h
#align list.lookup_dedupkeys List.dlookup_dedupKeys
-theorem sizeOf_dedupKeys {α} {β : α → Type _} [DecidableEq α] [SizeOf (Sigma β)]
+theorem sizeOf_dedupKeys {α} {β : α → Type*} [DecidableEq α] [SizeOf (Sigma β)]
(xs : List (Sigma β)) : SizeOf.sizeOf (dedupKeys xs) ≤ SizeOf.sizeOf xs := by
simp only [SizeOf.sizeOf, _sizeOf_1]
induction' xs with x xs
@@ -244,7 +244,7 @@ theorem lookup_ext {l₀ l₁ : List (Sigma β)} (nd₀ : l₀.NodupKeys) (nd₁
rw [← mem_dlookup_iff, ← mem_dlookup_iff, h] <;> assumption
#align list.lookup_ext List.lookup_ext
-/-! ### `lookup_all` -/
+/-! ### `lookupAll` -/
/-- `lookup_all a l` is the list of all values in `l` corresponding to the key `a`. -/
@@ -428,9 +428,9 @@ theorem mem_keys_of_mem_keys_kerase {a₁ a₂} {l : List (Sigma β)} :
theorem exists_of_kerase {a : α} {l : List (Sigma β)} (h : a ∈ l.keys) :
∃ (b : β a) (l₁ l₂ : List (Sigma β)),
a ∉ l₁.keys ∧ l = l₁ ++ ⟨a, b⟩ :: l₂ ∧ kerase a l = l₁ ++ l₂ := by
- induction l
- case nil => cases h
- case cons hd tl ih =>
+ induction l with
+ | nil => cases h
+ | cons hd tl ih =>
by_cases e : a = hd.1
· subst e
exact ⟨hd.2, [], tl, by simp, by cases hd; rfl, by simp⟩
@@ -460,7 +460,8 @@ theorem kerase_kerase {a a'} {l : List (Sigma β)} :
(kerase a' l).kerase a = (kerase a l).kerase a' := by
by_cases h : a = a'
· subst a'; rfl
- induction' l with x xs; · rfl
+ induction' l with x xs
+ · rfl
· by_cases a' = x.1
· subst a'
simp [kerase_cons_ne h, kerase_cons_eq rfl]
@@ -482,9 +483,9 @@ theorem Perm.kerase {a : α} {l₁ l₂ : List (Sigma β)} (nd : l₁.NodupKeys)
@[simp]
theorem not_mem_keys_kerase (a) {l : List (Sigma β)} (nd : l.NodupKeys) :
a ∉ (kerase a l).keys := by
- induction l
- case nil => simp
- case cons hd tl ih =>
+ induction l with
+ | nil => simp
+ | cons hd tl ih =>
simp at nd
by_cases h : a = hd.1
· subst h
@@ -501,9 +502,9 @@ theorem dlookup_kerase (a) {l : List (Sigma β)} (nd : l.NodupKeys) :
@[simp]
theorem dlookup_kerase_ne {a a'} {l : List (Sigma β)} (h : a ≠ a') :
dlookup a (kerase a' l) = dlookup a l := by
- induction l
- case nil => rfl
- case cons hd tl ih =>
+ induction l with
+ | nil => rfl
+ | cons hd tl ih =>
cases' hd with ah bh
by_cases h₁ : a = ah <;> by_cases h₂ : a' = ah
· substs h₁ h₂
@@ -698,9 +699,9 @@ theorem kunion_cons {s} {l₁ l₂ : List (Sigma β)} :
@[simp]
theorem mem_keys_kunion {a} {l₁ l₂ : List (Sigma β)} :
a ∈ (kunion l₁ l₂).keys ↔ a ∈ l₁.keys ∨ a ∈ l₂.keys := by
- induction l₁ generalizing l₂
- case nil => simp
- case cons s l₁ ih => by_cases h : a = s.1 <;> [simp [h]; simp [h, ih]]
+ induction l₁ generalizing l₂ with
+ | nil => simp
+ | cons s l₁ ih => by_cases h : a = s.1 <;> [simp [h]; simp [h, ih]]
#align list.mem_keys_kunion List.mem_keys_kunion
@[simp]
@@ -711,21 +712,21 @@ theorem kunion_kerase {a} :
#align list.kunion_kerase List.kunion_kerase
theorem NodupKeys.kunion (nd₁ : l₁.NodupKeys) (nd₂ : l₂.NodupKeys) : (kunion l₁ l₂).NodupKeys := by
- induction l₁ generalizing l₂
- case nil => simp only [nil_kunion, nd₂]
- case cons s l₁ ih =>
+ induction l₁ generalizing l₂ with
+ | nil => simp only [nil_kunion, nd₂]
+ | cons s l₁ ih =>
simp at nd₁
simp [not_or, nd₁.1, nd₂, ih nd₁.2 (nd₂.kerase s.1)]
#align list.nodupkeys.kunion List.NodupKeys.kunion
theorem Perm.kunion_right {l₁ l₂ : List (Sigma β)} (p : l₁ ~ l₂) (l) :
kunion l₁ l ~ kunion l₂ l := by
- induction p generalizing l
- case nil => rfl
- case cons hd tl₁ tl₂ _ ih =>
+ induction p generalizing l with
+ | nil => rfl
+ | cons hd _ ih =>
simp [ih (List.kerase _ _), Perm.cons]
- case swap s₁ s₂ l => simp [kerase_comm, Perm.swap]
- case trans l₁ l₂ l₃ _ _ ih₁₂ ih₂₃ => exact Perm.trans (ih₁₂ l) (ih₂₃ l)
+ | swap s₁ s₂ l => simp [kerase_comm, Perm.swap]
+ | trans _ _ ih₁₂ ih₂₃ => exact Perm.trans (ih₁₂ l) (ih₂₃ l)
#align list.perm.kunion_right List.Perm.kunion_right
theorem Perm.kunion_left :
@@ -755,17 +756,17 @@ theorem dlookup_kunion_left {a} {l₁ l₂ : List (Sigma β)} (h : a ∈ l₁.ke
@[simp]
theorem dlookup_kunion_right {a} {l₁ l₂ : List (Sigma β)} (h : a ∉ l₁.keys) :
dlookup a (kunion l₁ l₂) = dlookup a l₂ := by
- induction l₁ generalizing l₂
- case nil => simp
- case cons _ _ ih => simp [not_or] at h; simp [h.1, ih h.2]
+ induction l₁ generalizing l₂ with
+ | nil => simp
+ | cons _ _ ih => simp [not_or] at h; simp [h.1, ih h.2]
#align list.lookup_kunion_right List.dlookup_kunion_right
--Porting note: removing simp, LHS not in normal form, added new version
theorem mem_dlookup_kunion {a} {b : β a} {l₁ l₂ : List (Sigma β)} :
b ∈ dlookup a (kunion l₁ l₂) ↔ b ∈ dlookup a l₁ ∨ a ∉ l₁.keys ∧ b ∈ dlookup a l₂ := by
- induction l₁ generalizing l₂
- case nil => simp
- case cons s _ ih =>
+ induction l₁ generalizing l₂ with
+ | nil => simp
+ | cons s _ ih =>
cases' s with a'
by_cases h₁ : a = a'
· subst h₁
@@ -2,15 +2,12 @@
Copyright (c) 2018 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro, Sean Leather
-
-! This file was ported from Lean 3 source module data.list.sigma
-! leanprover-community/mathlib commit f808feb6c18afddb25e66a71d317643cf7fb5fbb
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Data.List.Range
import Mathlib.Data.List.Perm
+#align_import data.list.sigma from "leanprover-community/mathlib"@"f808feb6c18afddb25e66a71d317643cf7fb5fbb"
+
/-!
# Utilities for lists of sigmas
This PR is the result of running
find . -type f -name "*.lean" -exec sed -i -E 's/^( +)\. /\1· /' {} \;
find . -type f -name "*.lean" -exec sed -i -E 'N;s/^( +·)\n +(.*)$/\1 \2/;P;D' {} \;
which firstly replaces .
focusing dots with ·
and secondly removes isolated instances of such dots, unifying them with the following line. A new rule is placed in the style linter to verify this.
@@ -285,8 +285,8 @@ theorem head?_lookupAll (a : α) : ∀ l : List (Sigma β), head? (lookupAll a l
| [] => by simp
| ⟨a', b⟩ :: l => by
by_cases h : a = a'
- . subst h; simp
- . rw [lookupAll_cons_ne, dlookup_cons_ne, head?_lookupAll a l] <;> assumption
+ · subst h; simp
+ · rw [lookupAll_cons_ne, dlookup_cons_ne, head?_lookupAll a l] <;> assumption
#align list.head_lookup_all List.head?_lookupAll
theorem mem_lookupAll {a : α} {b : β a} :
@@ -296,7 +296,7 @@ theorem mem_lookupAll {a : α} {b : β a} :
by_cases h : a = a'
· subst h
simp [*, mem_lookupAll]
- . simp [*, mem_lookupAll]
+ · simp [*, mem_lookupAll]
#align list.mem_lookup_all List.mem_lookupAll
theorem lookupAll_sublist (a : α) : ∀ l : List (Sigma β), (lookupAll a l).map (Sigma.mk a) <+ l
@@ -348,7 +348,7 @@ theorem kreplace_of_forall_not (a : α) (b : β a) {l : List (Sigma β)}
rintro ⟨a', b'⟩ h; dsimp; split_ifs
· subst a'
exact H _ h
- . rfl
+ · rfl
#align list.kreplace_of_forall_not List.kreplace_of_forall_not
theorem kreplace_self {a : α} {b : β a} {l : List (Sigma β)} (nd : NodupKeys l)
at
and goals (#5387)
Changes are of the form
some_tactic at h⊢
-> some_tactic at h ⊢
some_tactic at h
-> some_tactic at h
@@ -383,7 +383,7 @@ theorem Perm.kreplace {a : α} {b : β a} {l₁ l₂ : List (Sigma β)} (nd : l
perm_lookmap _ <| by
refine' nd.pairwise_ne.imp _
intro x y h z h₁ w h₂
- split_ifs at h₁ h₂ with h_2 h_1 <;> cases h₁ <;> cases h₂
+ split_ifs at h₁ h₂ with h_2 h_1 <;> cases h₁ <;> cases h₂
exact (h (h_2.symm.trans h_1)).elim
#align list.perm.kreplace List.Perm.kreplace
@@ -429,7 +429,7 @@ theorem mem_keys_of_mem_keys_kerase {a₁ a₂} {l : List (Sigma β)} :
#align list.mem_keys_of_mem_keys_kerase List.mem_keys_of_mem_keys_kerase
theorem exists_of_kerase {a : α} {l : List (Sigma β)} (h : a ∈ l.keys) :
- ∃ (b : β a)(l₁ l₂ : List (Sigma β)),
+ ∃ (b : β a) (l₁ l₂ : List (Sigma β)),
a ∉ l₁.keys ∧ l = l₁ ++ ⟨a, b⟩ :: l₂ ∧ kerase a l = l₁ ++ l₂ := by
induction l
case nil => cases h
fix-comments.py
on all files.@@ -17,7 +17,7 @@ import Mathlib.Data.List.Perm
This file includes several ways of interacting with `List (Sigma β)`, treated as a key-value store.
If `α : Type _` and `β : α → Type _`, then we regard `s : Sigma β` as having key `s.1 : α` and value
-`s.2 : β s.1`. Hence, `list (sigma β)` behaves like a key-value store.
+`s.2 : β s.1`. Hence, `List (Sigma β)` behaves like a key-value store.
## Main Definitions
@@ -597,7 +597,7 @@ theorem dlookup_kinsert_ne {a a'} {b' : β a'} {l : List (Sigma β)} (h : a ≠
/-! ### `kextract` -/
-/-- Finds the first entry with a given key `a` and returns its value (as an `option` because there
+/-- Finds the first entry with a given key `a` and returns its value (as an `Option` because there
might be no entry with key `a`) alongside with the rest of the entries. -/
def kextract (a : α) : List (Sigma β) → Option (β a) × List (Sigma β)
| [] => (none, [])
@@ -622,7 +622,7 @@ theorem kextract_eq_dlookup_kerase (a : α) :
/-! ### `dedupKeys` -/
-/-- Remove entries with duplicate keys from `l : list (sigma β)`. -/
+/-- Remove entries with duplicate keys from `l : List (Sigma β)`. -/
def dedupKeys : List (Sigma β) → List (Sigma β) :=
List.foldr (fun x => kinsert x.1 x.2) []
#align list.dedupkeys List.dedupKeys
The main breaking change is that tac <;> [t1, t2]
is now written tac <;> [t1; t2]
, to avoid clashing with tactics like cases
and use
that take comma-separated lists.
@@ -412,9 +412,7 @@ theorem kerase_cons_ne {a} {s : Sigma β} {l : List (Sigma β)} (h : a ≠ s.1)
@[simp]
theorem kerase_of_not_mem_keys {a} {l : List (Sigma β)} (h : a ∉ l.keys) : kerase a l = l := by
- induction' l with _ _ ih <;> [rfl,
- · simp [not_or] at h
- simp [h.1, ih h.2]]
+ induction' l with _ _ ih <;> [rfl; (simp [not_or] at h; simp [h.1, ih h.2])]
#align list.kerase_of_not_mem_keys List.kerase_of_not_mem_keys
theorem kerase_sublist (a : α) (l : List (Sigma β)) : kerase a l <+ l :=
@@ -523,10 +521,9 @@ theorem dlookup_kerase_ne {a a'} {l : List (Sigma β)} (h : a ≠ a') :
theorem kerase_append_left {a} :
∀ {l₁ l₂ : List (Sigma β)}, a ∈ l₁.keys → kerase a (l₁ ++ l₂) = kerase a l₁ ++ l₂
| [], _, h => by cases h
- | s :: l₁, l₂, h₁ =>
- if h₂ : a = s.1 then by simp [h₂]
- else by simp at h₁; cases' h₁ with h₁ h₁ <;>
- [exact absurd h₁ h₂, simp [h₂, kerase_append_left h₁]]
+ | s :: l₁, l₂, h₁ => by
+ if h₂ : a = s.1 then simp [h₂]
+ else simp at h₁; cases' h₁ with h₁ h₁ <;> [exact absurd h₁ h₂; simp [h₂, kerase_append_left h₁]]
#align list.kerase_append_left List.kerase_append_left
theorem kerase_append_right {a} :
@@ -706,7 +703,7 @@ theorem mem_keys_kunion {a} {l₁ l₂ : List (Sigma β)} :
a ∈ (kunion l₁ l₂).keys ↔ a ∈ l₁.keys ∨ a ∈ l₂.keys := by
induction l₁ generalizing l₂
case nil => simp
- case cons s l₁ ih => by_cases h : a = s.1 <;> [simp [h], simp [h, ih]]
+ case cons s l₁ ih => by_cases h : a = s.1 <;> [simp [h]; simp [h, ih]]
#align list.mem_keys_kunion List.mem_keys_kunion
@[simp]
Notably incorporates https://github.com/leanprover/std4/pull/98 and https://github.com/leanprover/std4/pull/109.
https://github.com/leanprover/std4/pull/98 moves a number of lemmas from Mathlib to Std, so the bump requires deleting them in Mathlib. I did check on each lemma whether its attributes were kept in the move (and gave attribute markings in Mathlib if they were not present in Std), but a reviewer may wish to re-check.
List.mem_map
changed statement from b ∈ l.map f ↔ ∃ a, a ∈ l ∧ b = f a
to b ∈ l.map f ↔ ∃ a, a ∈ l ∧ f a = b
. Similarly for List.exists_of_mem_map
. This was a deliberate change, so I have simply adjusted proofs (many become simpler, which supports the change). I also deleted List.mem_map'
, List.exists_of_mem_map'
, which were temporary versions in Mathlib while waiting for this change (replacing their uses with the unprimed versions).
Also, the lemma sublist_nil_iff_eq_nil
seems to have been renamed to sublist_nil
during the move, so I added an alias for the old name.
(another issue fixed during review by @digama0) List.Sublist.filter
had an argument change from explicit to implicit. This appears to have been an oversight (cc @JamesGallicchio). I have temporarily introduced List.Sublist.filter'
with the argument explicit, and replaced Mathlib uses of Sublist.filter
with Sublist.filter'
. Later we can fix the argument in Std, and then delete List.Sublist.filter'
.
@@ -62,7 +62,7 @@ theorem mem_keys_of_mem {s : Sigma β} {l : List (Sigma β)} : s ∈ l → s.1
theorem exists_of_mem_keys {a} {l : List (Sigma β)} (h : a ∈ l.keys) :
∃ b : β a, Sigma.mk a b ∈ l :=
- let ⟨⟨_, b'⟩, m, e⟩ := exists_of_mem_map' h
+ let ⟨⟨_, b'⟩, m, e⟩ := exists_of_mem_map h
Eq.recOn e (Exists.intro b' m)
#align list.exists_of_mem_keys List.exists_of_mem_keys
Mathlib4 pair for https://github.com/leanprover-community/mathlib/pull/15434
Co-authored-by: Parcly Taxel <reddeloostw@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro, Sean Leather
! This file was ported from Lean 3 source module data.list.sigma
-! leanprover-community/mathlib commit f694c7dead66f5d4c80f446c796a5aad14707f0e
+! leanprover-community/mathlib commit f808feb6c18afddb25e66a71d317643cf7fb5fbb
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -107,6 +107,16 @@ theorem nodupKeys_cons {s : Sigma β} {l : List (Sigma β)} :
NodupKeys (s :: l) ↔ s.1 ∉ l.keys ∧ NodupKeys l := by simp [keys, NodupKeys]
#align list.nodupkeys_cons List.nodupKeys_cons
+theorem not_mem_keys_of_nodupKeys_cons {s : Sigma β} {l : List (Sigma β)} (h : NodupKeys (s :: l)) :
+ s.1 ∉ l.keys :=
+ (nodupKeys_cons.1 h).1
+#align list.not_mem_keys_of_nodupkeys_cons List.not_mem_keys_of_nodupKeys_cons
+
+theorem nodupKeys_of_nodupKeys_cons {s : Sigma β} {l : List (Sigma β)} (h : NodupKeys (s :: l)) :
+ NodupKeys l :=
+ (nodupKeys_cons.1 h).2
+#align list.nodupkeys_of_nodupkeys_cons List.nodupKeys_of_nodupKeys_cons
+
theorem NodupKeys.eq_of_fst_eq {l : List (Sigma β)} (nd : NodupKeys l) {s s' : Sigma β} (h : s ∈ l)
(h' : s' ∈ l) : s.1 = s'.1 → s = s' :=
@Pairwise.forall_of_forall _ (fun s s' : Sigma β => s.1 = s'.1 → s = s') _
This tracks one of the changes in leanprover-community/mathlib#18127, which for this file was a backport.
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro, Sean Leather
! This file was ported from Lean 3 source module data.list.sigma
-! leanprover-community/mathlib commit ccad6d5093bd2f5c6ca621fc74674cce51355af6
+! leanprover-community/mathlib commit f694c7dead66f5d4c80f446c796a5aad14707f0e
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -453,7 +453,7 @@ theorem keys_kerase {a} {l : List (Sigma β)} : (kerase a l).keys = l.keys.erase
theorem kerase_kerase {a a'} {l : List (Sigma β)} :
(kerase a' l).kerase a = (kerase a l).kerase a' := by
- by_cases a = a'
+ by_cases h : a = a'
· subst a'; rfl
induction' l with x xs; · rfl
· by_cases a' = x.1
@@ -646,7 +646,7 @@ theorem nodupKeys_dedupKeys (l : List (Sigma β)) : NodupKeys (dedupKeys l) := b
theorem dlookup_dedupKeys (a : α) (l : List (Sigma β)) : dlookup a (dedupKeys l) = dlookup a l := by
induction' l with l_hd _ l_ih; rfl
cases' l_hd with a' b
- by_cases a = a'
+ by_cases h : a = a'
· subst a'
rw [dedupKeys_cons, dlookup_kinsert, dlookup_cons_eq]
· rw [dedupKeys_cons, dlookup_kinsert_ne h, l_ih, dlookup_cons_ne]
Type*
to Type _
(#1866)
A bunch of docstrings were still mentioning Type*
. This changes them to Type _
.
@@ -16,7 +16,7 @@ import Mathlib.Data.List.Perm
This file includes several ways of interacting with `List (Sigma β)`, treated as a key-value store.
-If `α : Type*` and `β : α → Type*`, then we regard `s : Sigma β` as having key `s.1 : α` and value
+If `α : Type _` and `β : α → Type _`, then we regard `s : Sigma β` as having key `s.1 : α` and value
`s.2 : β s.1`. Hence, `list (sigma β)` behaves like a key-value store.
## Main Definitions
@@ -475,7 +475,7 @@ theorem Perm.kerase {a : α} {l₁ l₂ : List (Sigma β)} (nd : l₁.NodupKeys)
#align list.perm.kerase List.Perm.kerase
@[simp]
-theorem not_mem_keys_kerase (a) {l : List (Sigma β)} (nd : l.NodupKeys) :
+theorem not_mem_keys_kerase (a) {l : List (Sigma β)} (nd : l.NodupKeys) :
a ∉ (kerase a l).keys := by
induction l
case nil => simp
This was done semi-automatically with some regular expressions in vim in contrast to the fully automatic https://github.com/leanprover-community/mathlib4/pull/1523.
Co-authored-by: Moritz Firsching <firsching@google.com>
@@ -475,8 +475,8 @@ theorem Perm.kerase {a : α} {l₁ l₂ : List (Sigma β)} (nd : l₁.NodupKeys)
#align list.perm.kerase List.Perm.kerase
@[simp]
-theorem not_mem_keys_kerase (a) {l : List (Sigma β)} (nd : l.NodupKeys) : a ∉ (kerase a l).keys :=
- by
+theorem not_mem_keys_kerase (a) {l : List (Sigma β)} (nd : l.NodupKeys) :
+ a ∉ (kerase a l).keys := by
induction l
case nil => simp
case cons hd tl ih =>
by
line breaks (#1523)
During porting, I usually fix the desired format we seem to want for the line breaks around by
with
awk '{do {{if (match($0, "^ by$") && length(p) < 98) {p=p " by";} else {if (NR!=1) {print p}; p=$0}}} while (getline == 1) if (getline==0) print p}' Mathlib/File/Im/Working/On.lean
I noticed there are some more files that slipped through.
This pull request is the result of running this command:
grep -lr "^ by\$" Mathlib | xargs -n 1 awk -i inplace '{do {{if (match($0, "^ by$") && length(p) < 98 && not (match(p, "^[ \t]*--"))) {p=p " by";} else {if (NR!=1) {print p}; p=$0}}} while (getline == 1) if (getline==0) print p}'
Co-authored-by: Moritz Firsching <firsching@google.com>
@@ -136,8 +136,7 @@ theorem perm_nodupKeys {l₁ l₂ : List (Sigma β)} (h : l₁ ~ l₂) : NodupKe
#align list.perm_nodupkeys List.perm_nodupKeys
theorem nodupKeys_join {L : List (List (Sigma β))} :
- NodupKeys (join L) ↔ (∀ l ∈ L, NodupKeys l) ∧ Pairwise Disjoint (L.map keys) :=
- by
+ NodupKeys (join L) ↔ (∀ l ∈ L, NodupKeys l) ∧ Pairwise Disjoint (L.map keys) := by
rw [nodupKeys_iff_pairwise, pairwise_join, pairwise_map]
refine' and_congr (ball_congr fun l _ => by simp [nodupKeys_iff_pairwise]) _
apply iff_of_eq; congr with (l₁ l₂)
@@ -423,8 +422,7 @@ theorem mem_keys_of_mem_keys_kerase {a₁ a₂} {l : List (Sigma β)} :
theorem exists_of_kerase {a : α} {l : List (Sigma β)} (h : a ∈ l.keys) :
∃ (b : β a)(l₁ l₂ : List (Sigma β)),
- a ∉ l₁.keys ∧ l = l₁ ++ ⟨a, b⟩ :: l₂ ∧ kerase a l = l₁ ++ l₂ :=
- by
+ a ∉ l₁.keys ∧ l = l₁ ++ ⟨a, b⟩ :: l₂ ∧ kerase a l = l₁ ++ l₂ := by
induction l
case nil => cases h
case cons hd tl ih =>
@@ -627,8 +625,8 @@ theorem dedupKeys_cons {x : Sigma β} (l : List (Sigma β)) :
rfl
#align list.dedupkeys_cons List.dedupKeys_cons
-theorem nodupKeys_dedupKeys (l : List (Sigma β)) : NodupKeys (dedupKeys l) :=
- by
+
+theorem nodupKeys_dedupKeys (l : List (Sigma β)) : NodupKeys (dedupKeys l) := by
dsimp [dedupKeys]
generalize hl : nil = l'
have : NodupKeys l' := by
@@ -645,8 +643,7 @@ theorem nodupKeys_dedupKeys (l : List (Sigma β)) : NodupKeys (dedupKeys l) :=
· exact l_ih.kerase _
#align list.nodupkeys_dedupkeys List.nodupKeys_dedupKeys
-theorem dlookup_dedupKeys (a : α) (l : List (Sigma β)) : dlookup a (dedupKeys l) = dlookup a l :=
- by
+theorem dlookup_dedupKeys (a : α) (l : List (Sigma β)) : dlookup a (dedupKeys l) = dlookup a l := by
induction' l with l_hd _ l_ih; rfl
cases' l_hd with a' b
by_cases a = a'
@@ -709,8 +706,7 @@ theorem kunion_kerase {a} :
| s :: _, l => by by_cases h : a = s.1 <;> simp [h, kerase_comm a s.1 l, kunion_kerase]
#align list.kunion_kerase List.kunion_kerase
-theorem NodupKeys.kunion (nd₁ : l₁.NodupKeys) (nd₂ : l₂.NodupKeys) : (kunion l₁ l₂).NodupKeys :=
- by
+theorem NodupKeys.kunion (nd₁ : l₁.NodupKeys) (nd₂ : l₂.NodupKeys) : (kunion l₁ l₂).NodupKeys := by
induction l₁ generalizing l₂
case nil => simp only [nil_kunion, nd₂]
case cons s l₁ ih =>
@@ -180,17 +180,17 @@ theorem dlookup_cons_ne (l) {a} : ∀ s : Sigma β, a ≠ s.1 → dlookup a (s :
| ⟨_, _⟩, h => dif_neg h.symm
#align list.lookup_cons_ne List.dlookup_cons_ne
-theorem dlookup_is_some {a : α} : ∀ {l : List (Sigma β)}, (dlookup a l).isSome ↔ a ∈ l.keys
+theorem dlookup_isSome {a : α} : ∀ {l : List (Sigma β)}, (dlookup a l).isSome ↔ a ∈ l.keys
| [] => by simp
| ⟨a', b⟩ :: l => by
by_cases h : a = a'
· subst a'
simp
- · simp [h, dlookup_is_some]
-#align list.lookup_is_some List.dlookup_is_some
+ · simp [h, dlookup_isSome]
+#align list.lookup_is_some List.dlookup_isSome
theorem dlookup_eq_none {a : α} {l : List (Sigma β)} : dlookup a l = none ↔ a ∉ l.keys := by
- simp [← dlookup_is_some, Option.isNone_iff_eq_none]
+ simp [← dlookup_isSome, Option.isNone_iff_eq_none]
#align list.lookup_eq_none List.dlookup_eq_none
theorem of_mem_dlookup {a : α} {b : β a} :
@@ -206,7 +206,7 @@ theorem of_mem_dlookup {a : α} {b : β a} :
theorem mem_dlookup {a} {b : β a} {l : List (Sigma β)} (nd : l.NodupKeys) (h : Sigma.mk a b ∈ l) :
b ∈ dlookup a l := by
- cases' Option.isSome_iff_exists.mp (dlookup_is_some.mpr (mem_keys_of_mem h)) with b' h'
+ cases' Option.isSome_iff_exists.mp (dlookup_isSome.mpr (mem_keys_of_mem h)) with b' h'
cases nd.eq_of_mk_mem h (of_mem_dlookup h')
exact h'
#align list.mem_lookup List.mem_dlookup
@@ -454,8 +454,7 @@ theorem keys_kerase {a} {l : List (Sigma β)} : (kerase a l).keys = l.keys.erase
#align list.keys_kerase List.keys_kerase
theorem kerase_kerase {a a'} {l : List (Sigma β)} :
- (kerase a' l).kerase a = (kerase a l).kerase a' :=
- by
+ (kerase a' l).kerase a = (kerase a l).kerase a' := by
by_cases a = a'
· subst a'; rfl
induction' l with x xs; · rfl
@@ -697,8 +696,7 @@ theorem kunion_cons {s} {l₁ l₂ : List (Sigma β)} :
@[simp]
theorem mem_keys_kunion {a} {l₁ l₂ : List (Sigma β)} :
- a ∈ (kunion l₁ l₂).keys ↔ a ∈ l₁.keys ∨ a ∈ l₂.keys :=
- by
+ a ∈ (kunion l₁ l₂).keys ↔ a ∈ l₁.keys ∨ a ∈ l₂.keys := by
induction l₁ generalizing l₂
case nil => simp
case cons s l₁ ih => by_cases h : a = s.1 <;> [simp [h], simp [h, ih]]
@@ -743,8 +741,7 @@ theorem Perm.kunion {l₁ l₂ l₃ l₄ : List (Sigma β)} (nd₃ : l₃.NodupK
@[simp]
theorem dlookup_kunion_left {a} {l₁ l₂ : List (Sigma β)} (h : a ∈ l₁.keys) :
- dlookup a (kunion l₁ l₂) = dlookup a l₁ :=
- by
+ dlookup a (kunion l₁ l₂) = dlookup a l₁ := by
induction' l₁ with s _ ih generalizing l₂ <;> simp at h; cases' h with h h <;> cases' s with a'
· subst h
simp
@@ -757,8 +754,7 @@ theorem dlookup_kunion_left {a} {l₁ l₂ : List (Sigma β)} (h : a ∈ l₁.ke
@[simp]
theorem dlookup_kunion_right {a} {l₁ l₂ : List (Sigma β)} (h : a ∉ l₁.keys) :
- dlookup a (kunion l₁ l₂) = dlookup a l₂ :=
- by
+ dlookup a (kunion l₁ l₂) = dlookup a l₂ := by
induction l₁ generalizing l₂
case nil => simp
case cons _ _ ih => simp [not_or] at h; simp [h.1, ih h.2]
@@ -22,7 +22,7 @@ If `α : Type*` and `β : α → Type*`, then we regard `s : Sigma β` as having
## Main Definitions
- `List.keys` extracts the list of keys.
-- `List.nodupkeys` determines if the store has duplicate keys.
+- `List.NodupKeys` determines if the store has duplicate keys.
- `List.lookup`/`lookup_all` accesses the value(s) of a particular key.
- `List.kreplace` replaces the first value with a given key by a given value.
- `List.kerase` removes a value.
@@ -80,69 +80,69 @@ theorem not_eq_key {a} {l : List (Sigma β)} : a ∉ l.keys ↔ ∀ s : Sigma β
f _ h₂ rfl
#align list.not_eq_key List.not_eq_key
-/-! ### `nodupkeys` -/
+/-! ### `NodupKeys` -/
/-- Determines whether the store uses a key several times. -/
-def Nodupkeys (l : List (Sigma β)) : Prop :=
+def NodupKeys (l : List (Sigma β)) : Prop :=
l.keys.Nodup
-#align list.nodupkeys List.Nodupkeys
+#align list.nodupkeys List.NodupKeys
-theorem nodupkeys_iff_pairwise {l} : Nodupkeys l ↔ Pairwise (fun s s' : Sigma β => s.1 ≠ s'.1) l :=
+theorem nodupKeys_iff_pairwise {l} : NodupKeys l ↔ Pairwise (fun s s' : Sigma β => s.1 ≠ s'.1) l :=
pairwise_map
-#align list.nodupkeys_iff_pairwise List.nodupkeys_iff_pairwise
+#align list.nodupkeys_iff_pairwise List.nodupKeys_iff_pairwise
-theorem Nodupkeys.pairwise_ne {l} (h : Nodupkeys l) :
+theorem NodupKeys.pairwise_ne {l} (h : NodupKeys l) :
Pairwise (fun s s' : Sigma β => s.1 ≠ s'.1) l :=
- nodupkeys_iff_pairwise.1 h
-#align list.nodupkeys.pairwise_ne List.Nodupkeys.pairwise_ne
+ nodupKeys_iff_pairwise.1 h
+#align list.nodupkeys.pairwise_ne List.NodupKeys.pairwise_ne
@[simp]
-theorem nodupkeys_nil : @Nodupkeys α β [] :=
+theorem nodupKeys_nil : @NodupKeys α β [] :=
Pairwise.nil
-#align list.nodupkeys_nil List.nodupkeys_nil
+#align list.nodupkeys_nil List.nodupKeys_nil
@[simp]
-theorem nodupkeys_cons {s : Sigma β} {l : List (Sigma β)} :
- Nodupkeys (s :: l) ↔ s.1 ∉ l.keys ∧ Nodupkeys l := by simp [keys, Nodupkeys]
-#align list.nodupkeys_cons List.nodupkeys_cons
+theorem nodupKeys_cons {s : Sigma β} {l : List (Sigma β)} :
+ NodupKeys (s :: l) ↔ s.1 ∉ l.keys ∧ NodupKeys l := by simp [keys, NodupKeys]
+#align list.nodupkeys_cons List.nodupKeys_cons
-theorem Nodupkeys.eq_of_fst_eq {l : List (Sigma β)} (nd : Nodupkeys l) {s s' : Sigma β} (h : s ∈ l)
+theorem NodupKeys.eq_of_fst_eq {l : List (Sigma β)} (nd : NodupKeys l) {s s' : Sigma β} (h : s ∈ l)
(h' : s' ∈ l) : s.1 = s'.1 → s = s' :=
@Pairwise.forall_of_forall _ (fun s s' : Sigma β => s.1 = s'.1 → s = s') _
(fun _ _ H h => (H h.symm).symm) (fun _ _ _ => rfl)
- ((nodupkeys_iff_pairwise.1 nd).imp fun h h' => (h h').elim) _ h _ h'
-#align list.nodupkeys.eq_of_fst_eq List.Nodupkeys.eq_of_fst_eq
+ ((nodupKeys_iff_pairwise.1 nd).imp fun h h' => (h h').elim) _ h _ h'
+#align list.nodupkeys.eq_of_fst_eq List.NodupKeys.eq_of_fst_eq
-theorem Nodupkeys.eq_of_mk_mem {a : α} {b b' : β a} {l : List (Sigma β)} (nd : Nodupkeys l)
+theorem NodupKeys.eq_of_mk_mem {a : α} {b b' : β a} {l : List (Sigma β)} (nd : NodupKeys l)
(h : Sigma.mk a b ∈ l) (h' : Sigma.mk a b' ∈ l) : b = b' := by
cases nd.eq_of_fst_eq h h' rfl; rfl
-#align list.nodupkeys.eq_of_mk_mem List.Nodupkeys.eq_of_mk_mem
+#align list.nodupkeys.eq_of_mk_mem List.NodupKeys.eq_of_mk_mem
-theorem nodupkeys_singleton (s : Sigma β) : Nodupkeys [s] :=
+theorem nodupKeys_singleton (s : Sigma β) : NodupKeys [s] :=
nodup_singleton _
-#align list.nodupkeys_singleton List.nodupkeys_singleton
+#align list.nodupkeys_singleton List.nodupKeys_singleton
-theorem Nodupkeys.sublist {l₁ l₂ : List (Sigma β)} (h : l₁ <+ l₂) : Nodupkeys l₂ → Nodupkeys l₁ :=
+theorem NodupKeys.sublist {l₁ l₂ : List (Sigma β)} (h : l₁ <+ l₂) : NodupKeys l₂ → NodupKeys l₁ :=
Nodup.sublist <| h.map _
-#align list.nodupkeys.sublist List.Nodupkeys.sublist
+#align list.nodupkeys.sublist List.NodupKeys.sublist
-protected theorem Nodupkeys.nodup {l : List (Sigma β)} : Nodupkeys l → Nodup l :=
+protected theorem NodupKeys.nodup {l : List (Sigma β)} : NodupKeys l → Nodup l :=
Nodup.of_map _
-#align list.nodupkeys.nodup List.Nodupkeys.nodup
+#align list.nodupkeys.nodup List.NodupKeys.nodup
-theorem perm_nodupkeys {l₁ l₂ : List (Sigma β)} (h : l₁ ~ l₂) : Nodupkeys l₁ ↔ Nodupkeys l₂ :=
+theorem perm_nodupKeys {l₁ l₂ : List (Sigma β)} (h : l₁ ~ l₂) : NodupKeys l₁ ↔ NodupKeys l₂ :=
(h.map _).nodup_iff
-#align list.perm_nodupkeys List.perm_nodupkeys
+#align list.perm_nodupkeys List.perm_nodupKeys
-theorem nodupkeys_join {L : List (List (Sigma β))} :
- Nodupkeys (join L) ↔ (∀ l ∈ L, Nodupkeys l) ∧ Pairwise Disjoint (L.map keys) :=
+theorem nodupKeys_join {L : List (List (Sigma β))} :
+ NodupKeys (join L) ↔ (∀ l ∈ L, NodupKeys l) ∧ Pairwise Disjoint (L.map keys) :=
by
- rw [nodupkeys_iff_pairwise, pairwise_join, pairwise_map]
- refine' and_congr (ball_congr fun l _ => by simp [nodupkeys_iff_pairwise]) _
+ rw [nodupKeys_iff_pairwise, pairwise_join, pairwise_map]
+ refine' and_congr (ball_congr fun l _ => by simp [nodupKeys_iff_pairwise]) _
apply iff_of_eq; congr with (l₁ l₂)
simp [keys, disjoint_iff_ne]
-#align list.nodupkeys_join List.nodupkeys_join
+#align list.nodupkeys_join List.nodupKeys_join
theorem nodup_enum_map_fst (l : List α) : (l.enum.map Prod.fst).Nodup := by simp [List.nodup_range]
#align list.nodup_enum_map_fst List.nodup_enum_map_fst
@@ -204,7 +204,7 @@ theorem of_mem_dlookup {a : α} {b : β a} :
simp [of_mem_dlookup H]
#align list.of_mem_lookup List.of_mem_dlookup
-theorem mem_dlookup {a} {b : β a} {l : List (Sigma β)} (nd : l.Nodupkeys) (h : Sigma.mk a b ∈ l) :
+theorem mem_dlookup {a} {b : β a} {l : List (Sigma β)} (nd : l.NodupKeys) (h : Sigma.mk a b ∈ l) :
b ∈ dlookup a l := by
cases' Option.isSome_iff_exists.mp (dlookup_is_some.mpr (mem_keys_of_mem h)) with b' h'
cases nd.eq_of_mk_mem h (of_mem_dlookup h')
@@ -222,17 +222,17 @@ theorem map_dlookup_eq_find (a : α) :
exact map_dlookup_eq_find a l
#align list.map_lookup_eq_find List.map_dlookup_eq_find
-theorem mem_dlookup_iff {a : α} {b : β a} {l : List (Sigma β)} (nd : l.Nodupkeys) :
+theorem mem_dlookup_iff {a : α} {b : β a} {l : List (Sigma β)} (nd : l.NodupKeys) :
b ∈ dlookup a l ↔ Sigma.mk a b ∈ l :=
⟨of_mem_dlookup, mem_dlookup nd⟩
#align list.mem_lookup_iff List.mem_dlookup_iff
-theorem perm_dlookup (a : α) {l₁ l₂ : List (Sigma β)} (nd₁ : l₁.Nodupkeys) (nd₂ : l₂.Nodupkeys)
+theorem perm_dlookup (a : α) {l₁ l₂ : List (Sigma β)} (nd₁ : l₁.NodupKeys) (nd₂ : l₂.NodupKeys)
(p : l₁ ~ l₂) : dlookup a l₁ = dlookup a l₂ := by
ext b; simp only [mem_dlookup_iff nd₁, mem_dlookup_iff nd₂]; exact p.mem_iff
#align list.perm_lookup List.perm_dlookup
-theorem lookup_ext {l₀ l₁ : List (Sigma β)} (nd₀ : l₀.Nodupkeys) (nd₁ : l₁.Nodupkeys)
+theorem lookup_ext {l₀ l₁ : List (Sigma β)} (nd₀ : l₀.NodupKeys) (nd₁ : l₁.NodupKeys)
(h : ∀ x y, y ∈ l₀.dlookup x ↔ y ∈ l₁.dlookup x) : l₀ ~ l₁ :=
mem_ext nd₀.nodup nd₁.nodup fun ⟨a, b⟩ => by
rw [← mem_dlookup_iff, ← mem_dlookup_iff, h] <;> assumption
@@ -301,14 +301,14 @@ theorem lookupAll_sublist (a : α) : ∀ l : List (Sigma β), (lookupAll a l).ma
exact (lookupAll_sublist a l).cons _
#align list.lookup_all_sublist List.lookupAll_sublist
-theorem lookupAll_length_le_one (a : α) {l : List (Sigma β)} (h : l.Nodupkeys) :
+theorem lookupAll_length_le_one (a : α) {l : List (Sigma β)} (h : l.NodupKeys) :
length (lookupAll a l) ≤ 1 := by
have := Nodup.sublist ((lookupAll_sublist a l).map _) h
rw [map_map] at this
rwa [← nodup_replicate, ← map_const]
#align list.lookup_all_length_le_one List.lookupAll_length_le_one
-theorem lookupAll_eq_dlookup (a : α) {l : List (Sigma β)} (h : l.Nodupkeys) :
+theorem lookupAll_eq_dlookup (a : α) {l : List (Sigma β)} (h : l.NodupKeys) :
lookupAll a l = (dlookup a l).toList := by
rw [← head?_lookupAll]
have h1 := lookupAll_length_le_one a h; revert h1
@@ -316,11 +316,11 @@ theorem lookupAll_eq_dlookup (a : α) {l : List (Sigma β)} (h : l.Nodupkeys) :
exact absurd h1 (by simp)
#align list.lookup_all_eq_lookup List.lookupAll_eq_dlookup
-theorem lookupAll_nodup (a : α) {l : List (Sigma β)} (h : l.Nodupkeys) : (lookupAll a l).Nodup :=
+theorem lookupAll_nodup (a : α) {l : List (Sigma β)} (h : l.NodupKeys) : (lookupAll a l).Nodup :=
by (rw [lookupAll_eq_dlookup a h]; apply Option.toList_nodup)
#align list.lookup_all_nodup List.lookupAll_nodup
-theorem perm_lookupAll (a : α) {l₁ l₂ : List (Sigma β)} (nd₁ : l₁.Nodupkeys) (nd₂ : l₂.Nodupkeys)
+theorem perm_lookupAll (a : α) {l₁ l₂ : List (Sigma β)} (nd₁ : l₁.NodupKeys) (nd₂ : l₂.NodupKeys)
(p : l₁ ~ l₂) : lookupAll a l₁ = lookupAll a l₂ := by
simp [lookupAll_eq_dlookup, nd₁, nd₂, perm_dlookup a nd₁ nd₂ p]
#align list.perm_lookup_all List.perm_lookupAll
@@ -342,7 +342,7 @@ theorem kreplace_of_forall_not (a : α) (b : β a) {l : List (Sigma β)}
. rfl
#align list.kreplace_of_forall_not List.kreplace_of_forall_not
-theorem kreplace_self {a : α} {b : β a} {l : List (Sigma β)} (nd : Nodupkeys l)
+theorem kreplace_self {a : α} {b : β a} {l : List (Sigma β)} (nd : NodupKeys l)
(h : Sigma.mk a b ∈ l) : kreplace a b l = l := by
refine' (lookmap_congr _).trans (lookmap_id' (Option.guard fun (s : Sigma β) => a = s.1) _ _)
· rintro ⟨a', b'⟩ h'
@@ -365,11 +365,11 @@ theorem keys_kreplace (a : α) (b : β a) : ∀ l : List (Sigma β), (kreplace a
split_ifs with h <;> simp (config := { contextual := true }) [h]
#align list.keys_kreplace List.keys_kreplace
-theorem kreplace_nodupkeys (a : α) (b : β a) {l : List (Sigma β)} :
- (kreplace a b l).Nodupkeys ↔ l.Nodupkeys := by simp [Nodupkeys, keys_kreplace]
-#align list.kreplace_nodupkeys List.kreplace_nodupkeys
+theorem kreplace_nodupKeys (a : α) (b : β a) {l : List (Sigma β)} :
+ (kreplace a b l).NodupKeys ↔ l.NodupKeys := by simp [NodupKeys, keys_kreplace]
+#align list.kreplace_nodupkeys List.kreplace_nodupKeys
-theorem Perm.kreplace {a : α} {b : β a} {l₁ l₂ : List (Sigma β)} (nd : l₁.Nodupkeys) :
+theorem Perm.kreplace {a : α} {b : β a} {l₁ l₂ : List (Sigma β)} (nd : l₁.NodupKeys) :
l₁ ~ l₂ → kreplace a b l₁ ~ kreplace a b l₂ :=
perm_lookmap _ <| by
refine' nd.pairwise_ne.imp _
@@ -468,17 +468,17 @@ theorem kerase_kerase {a a'} {l : List (Sigma β)} :
· simp [kerase_cons_ne, *]
#align list.kerase_kerase List.kerase_kerase
-theorem Nodupkeys.kerase (a : α) : Nodupkeys l → (kerase a l).Nodupkeys :=
- Nodupkeys.sublist <| kerase_sublist _ _
-#align list.nodupkeys.kerase List.Nodupkeys.kerase
+theorem NodupKeys.kerase (a : α) : NodupKeys l → (kerase a l).NodupKeys :=
+ NodupKeys.sublist <| kerase_sublist _ _
+#align list.nodupkeys.kerase List.NodupKeys.kerase
-theorem Perm.kerase {a : α} {l₁ l₂ : List (Sigma β)} (nd : l₁.Nodupkeys) :
+theorem Perm.kerase {a : α} {l₁ l₂ : List (Sigma β)} (nd : l₁.NodupKeys) :
l₁ ~ l₂ → kerase a l₁ ~ kerase a l₂ :=
- Perm.erasep _ <| (nodupkeys_iff_pairwise.1 nd).imp <| by rintro x y h rfl; exact h
+ Perm.erasep _ <| (nodupKeys_iff_pairwise.1 nd).imp <| by rintro x y h rfl; exact h
#align list.perm.kerase List.Perm.kerase
@[simp]
-theorem not_mem_keys_kerase (a) {l : List (Sigma β)} (nd : l.Nodupkeys) : a ∉ (kerase a l).keys :=
+theorem not_mem_keys_kerase (a) {l : List (Sigma β)} (nd : l.NodupKeys) : a ∉ (kerase a l).keys :=
by
induction l
case nil => simp
@@ -491,7 +491,7 @@ theorem not_mem_keys_kerase (a) {l : List (Sigma β)} (nd : l.Nodupkeys) : a ∉
#align list.not_mem_keys_kerase List.not_mem_keys_kerase
@[simp]
-theorem dlookup_kerase (a) {l : List (Sigma β)} (nd : l.Nodupkeys) :
+theorem dlookup_kerase (a) {l : List (Sigma β)} (nd : l.NodupKeys) :
dlookup a (kerase a l) = none :=
dlookup_eq_none.mpr (not_mem_keys_kerase a nd)
#align list.lookup_kerase List.dlookup_kerase
@@ -571,12 +571,12 @@ theorem mem_keys_kinsert {a a'} {b' : β a'} {l : List (Sigma β)} :
a ∈ (kinsert a' b' l).keys ↔ a = a' ∨ a ∈ l.keys := by by_cases h : a = a' <;> simp [h]
#align list.mem_keys_kinsert List.mem_keys_kinsert
-theorem kinsert_nodupkeys (a) (b : β a) {l : List (Sigma β)} (nd : l.Nodupkeys) :
- (kinsert a b l).Nodupkeys :=
- nodupkeys_cons.mpr ⟨not_mem_keys_kerase a nd, nd.kerase a⟩
-#align list.kinsert_nodupkeys List.kinsert_nodupkeys
+theorem kinsert_nodupKeys (a) (b : β a) {l : List (Sigma β)} (nd : l.NodupKeys) :
+ (kinsert a b l).NodupKeys :=
+ nodupKeys_cons.mpr ⟨not_mem_keys_kerase a nd, nd.kerase a⟩
+#align list.kinsert_nodupkeys List.kinsert_nodupKeys
-theorem Perm.kinsert {a} {b : β a} {l₁ l₂ : List (Sigma β)} (nd₁ : l₁.Nodupkeys) (p : l₁ ~ l₂) :
+theorem Perm.kinsert {a} {b : β a} {l₁ l₂ : List (Sigma β)} (nd₁ : l₁.NodupKeys) (p : l₁ ~ l₂) :
kinsert a b l₁ ~ kinsert a b l₂ :=
(p.kerase nd₁).cons _
#align list.perm.kinsert List.Perm.kinsert
@@ -615,58 +615,58 @@ theorem kextract_eq_dlookup_kerase (a : α) :
· simp [kextract, Ne.symm h, kextract_eq_dlookup_kerase a l, kerase]
#align list.kextract_eq_lookup_kerase List.kextract_eq_dlookup_kerase
-/-! ### `dedupkeys` -/
+/-! ### `dedupKeys` -/
/-- Remove entries with duplicate keys from `l : list (sigma β)`. -/
-def dedupkeys : List (Sigma β) → List (Sigma β) :=
+def dedupKeys : List (Sigma β) → List (Sigma β) :=
List.foldr (fun x => kinsert x.1 x.2) []
-#align list.dedupkeys List.dedupkeys
+#align list.dedupkeys List.dedupKeys
-theorem dedupkeys_cons {x : Sigma β} (l : List (Sigma β)) :
- dedupkeys (x :: l) = kinsert x.1 x.2 (dedupkeys l) :=
+theorem dedupKeys_cons {x : Sigma β} (l : List (Sigma β)) :
+ dedupKeys (x :: l) = kinsert x.1 x.2 (dedupKeys l) :=
rfl
-#align list.dedupkeys_cons List.dedupkeys_cons
+#align list.dedupkeys_cons List.dedupKeys_cons
-theorem nodupkeys_dedupkeys (l : List (Sigma β)) : Nodupkeys (dedupkeys l) :=
+theorem nodupKeys_dedupKeys (l : List (Sigma β)) : NodupKeys (dedupKeys l) :=
by
- dsimp [dedupkeys]
+ dsimp [dedupKeys]
generalize hl : nil = l'
- have : Nodupkeys l' := by
+ have : NodupKeys l' := by
rw [← hl]
apply nodup_nil
clear hl
induction' l with x xs l_ih
· apply this
· cases x
- simp [dedupkeys]
+ simp [dedupKeys]
constructor
· simp [keys_kerase]
apply l_ih.not_mem_erase
· exact l_ih.kerase _
-#align list.nodupkeys_dedupkeys List.nodupkeys_dedupkeys
+#align list.nodupkeys_dedupkeys List.nodupKeys_dedupKeys
-theorem dlookup_dedupkeys (a : α) (l : List (Sigma β)) : dlookup a (dedupkeys l) = dlookup a l :=
+theorem dlookup_dedupKeys (a : α) (l : List (Sigma β)) : dlookup a (dedupKeys l) = dlookup a l :=
by
induction' l with l_hd _ l_ih; rfl
cases' l_hd with a' b
by_cases a = a'
· subst a'
- rw [dedupkeys_cons, dlookup_kinsert, dlookup_cons_eq]
- · rw [dedupkeys_cons, dlookup_kinsert_ne h, l_ih, dlookup_cons_ne]
+ rw [dedupKeys_cons, dlookup_kinsert, dlookup_cons_eq]
+ · rw [dedupKeys_cons, dlookup_kinsert_ne h, l_ih, dlookup_cons_ne]
exact h
-#align list.lookup_dedupkeys List.dlookup_dedupkeys
+#align list.lookup_dedupkeys List.dlookup_dedupKeys
-theorem sizeOf_dedupkeys {α} {β : α → Type _} [DecidableEq α] [SizeOf (Sigma β)]
- (xs : List (Sigma β)) : SizeOf.sizeOf (List.dedupkeys xs) ≤ SizeOf.sizeOf xs := by
+theorem sizeOf_dedupKeys {α} {β : α → Type _} [DecidableEq α] [SizeOf (Sigma β)]
+ (xs : List (Sigma β)) : SizeOf.sizeOf (dedupKeys xs) ≤ SizeOf.sizeOf xs := by
simp only [SizeOf.sizeOf, _sizeOf_1]
induction' xs with x xs
- · simp [List.dedupkeys]
- · simp only [dedupkeys_cons, kinsert_def, add_le_add_iff_left, Sigma.eta]
+ · simp [dedupKeys]
+ · simp only [dedupKeys_cons, kinsert_def, add_le_add_iff_left, Sigma.eta]
trans
apply sizeOf_kerase
assumption
-#align list.sizeof_dedupkeys List.sizeOf_dedupkeys
+#align list.sizeof_dedupkeys List.sizeOf_dedupKeys
/-! ### `kunion` -/
@@ -711,14 +711,14 @@ theorem kunion_kerase {a} :
| s :: _, l => by by_cases h : a = s.1 <;> simp [h, kerase_comm a s.1 l, kunion_kerase]
#align list.kunion_kerase List.kunion_kerase
-theorem Nodupkeys.kunion (nd₁ : l₁.Nodupkeys) (nd₂ : l₂.Nodupkeys) : (kunion l₁ l₂).Nodupkeys :=
+theorem NodupKeys.kunion (nd₁ : l₁.NodupKeys) (nd₂ : l₂.NodupKeys) : (kunion l₁ l₂).NodupKeys :=
by
induction l₁ generalizing l₂
case nil => simp only [nil_kunion, nd₂]
case cons s l₁ ih =>
simp at nd₁
simp [not_or, nd₁.1, nd₂, ih nd₁.2 (nd₂.kerase s.1)]
-#align list.nodupkeys.kunion List.Nodupkeys.kunion
+#align list.nodupkeys.kunion List.NodupKeys.kunion
theorem Perm.kunion_right {l₁ l₂ : List (Sigma β)} (p : l₁ ~ l₂) (l) :
kunion l₁ l ~ kunion l₂ l := by
@@ -731,12 +731,12 @@ theorem Perm.kunion_right {l₁ l₂ : List (Sigma β)} (p : l₁ ~ l₂) (l) :
#align list.perm.kunion_right List.Perm.kunion_right
theorem Perm.kunion_left :
- ∀ (l) {l₁ l₂ : List (Sigma β)}, l₁.Nodupkeys → l₁ ~ l₂ → kunion l l₁ ~ kunion l l₂
+ ∀ (l) {l₁ l₂ : List (Sigma β)}, l₁.NodupKeys → l₁ ~ l₂ → kunion l l₁ ~ kunion l l₂
| [], _, _, _, p => p
| s :: l, _, _, nd₁, p => ((p.kerase nd₁).kunion_left l <| nd₁.kerase s.1).cons s
#align list.perm.kunion_left List.Perm.kunion_left
-theorem Perm.kunion {l₁ l₂ l₃ l₄ : List (Sigma β)} (nd₃ : l₃.Nodupkeys) (p₁₂ : l₁ ~ l₂)
+theorem Perm.kunion {l₁ l₂ l₃ l₄ : List (Sigma β)} (nd₃ : l₃.NodupKeys) (p₁₂ : l₁ ~ l₂)
(p₃₄ : l₃ ~ l₄) : kunion l₁ l₃ ~ kunion l₂ l₄ :=
(p₁₂.kunion_right l₃).trans (p₃₄.kunion_left l₂ nd₃)
#align list.perm.kunion List.Perm.kunion
The unported dependencies are