Skip to content

Commit f59eee0

Browse files
chore: bump Std (#6721)
This incorporates changes from #6575 I have also renamed `Multiset.countp` to `Multiset.countP` for consistency. Co-authored-by: James Gallichio <jamesgallicchio@gmail.com> Co-authored-by: James <jamesgallicchio@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
1 parent 46eac94 commit f59eee0

File tree

30 files changed

+256
-510
lines changed

30 files changed

+256
-510
lines changed

Archive/MiuLanguage/DecisionNec.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ theorem count_equiv_one_or_two_mod3_of_derivable (en : Miustr) :
7575
any_goals apply mod3_eq_1_or_mod3_eq_2 h_ih
7676
-- Porting note: `simp_rw [count_append]` usually doesn't work
7777
· left; rw [count_append, count_append]; rfl
78-
· right; simp_rw [count_append, count_cons, if_false, two_mul]
78+
· right; simp_rw [count_append, count_cons, if_false, two_mul]; simp
7979
· left; rw [count_append, count_append, count_append]
8080
simp_rw [count_cons_self, count_nil, count_cons, ite_false, add_right_comm, add_mod_right]
81+
simp
8182
· left; rw [count_append, count_append, count_append]
8283
simp only [ne_eq, count_cons_of_ne, count_nil, add_zero]
8384
#align miu.count_equiv_one_or_two_mod3_of_derivable Miu.count_equiv_one_or_two_mod3_of_derivable

Archive/MiuLanguage/DecisionSuf.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,12 @@ theorem count_I_eq_length_of_count_U_zero_and_neg_mem {ys : Miustr} (hu : count
262262
· -- case `x = M` gives a contradiction.
263263
exfalso; exact hm (mem_cons_self M xs)
264264
· -- case `x = I`
265-
rw [count_cons, if_pos rfl, length, succ_eq_add_one, succ_inj']
265+
rw [count_cons, if_pos rfl, length, succ_inj']
266266
apply hxs
267267
· simpa only [count]
268268
· rw [mem_cons, not_or] at hm; exact hm.2
269269
· -- case `x = U` gives a contradiction.
270-
exfalso; simp only [count, countp_cons_of_pos] at hu
270+
exfalso; simp only [count, countP_cons_of_pos] at hu
271271
exact succ_ne_zero _ hu
272272
set_option linter.uppercaseLean3 false in
273273
#align miu.count_I_eq_length_of_count_U_zero_and_neg_mem Miu.count_I_eq_length_of_count_U_zero_and_neg_mem
@@ -277,7 +277,7 @@ set_option linter.uppercaseLean3 false in
277277
theorem base_case_suf (en : Miustr) (h : Decstr en) (hu : count U en = 0) : Derivable en := by
278278
rcases h with ⟨⟨mhead, nmtail⟩, hi⟩
279279
have : en ≠ nil := by
280-
intro k; simp only [k, count, countp, if_false, zero_mod, zero_ne_one, false_or_iff] at hi
280+
intro k; simp only [k, count, countP, if_false, zero_mod, zero_ne_one, false_or_iff] at hi
281281
rcases exists_cons_of_ne_nil this with ⟨y, ys, rfl⟩
282282
rcases mhead
283283
rsuffices ⟨c, rfl, hc⟩ : ∃ c, replicate c I = ys ∧ (c % 3 = 1 ∨ c % 3 = 2)

Mathlib.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,7 +1529,6 @@ import Mathlib.Data.List.ToFinsupp
15291529
import Mathlib.Data.List.Zip
15301530
import Mathlib.Data.MLList.BestFirst
15311531
import Mathlib.Data.MLList.DepthFirst
1532-
import Mathlib.Data.MLList.Heartbeats
15331532
import Mathlib.Data.MLList.IO
15341533
import Mathlib.Data.MLList.Split
15351534
import Mathlib.Data.Matrix.Auto
@@ -2110,7 +2109,6 @@ import Mathlib.Init.Propext
21102109
import Mathlib.Init.Quot
21112110
import Mathlib.Init.Set
21122111
import Mathlib.Init.ZeroOne
2113-
import Mathlib.Lean.CoreM
21142112
import Mathlib.Lean.Data.NameMap
21152113
import Mathlib.Lean.Elab.Tactic.Basic
21162114
import Mathlib.Lean.EnvExtension

Mathlib/Algebra/BigOperators/Associated.lean

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,22 @@ theorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α}
6363

6464
theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]
6565
[∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)
66-
(div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countp (Associated a) ≤ 1) : s.prod ∣ n := by
66+
(div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by
6767
induction' s using Multiset.induction_on with a s induct n primes divs generalizing n
6868
· simp only [Multiset.prod_zero, one_dvd]
6969
· rw [Multiset.prod_cons]
7070
obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)
7171
apply mul_dvd_mul_left a
7272
refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)
73-
fun a => (Multiset.countp_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)
73+
fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)
7474
· have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)
7575
have a_prime := h a (Multiset.mem_cons_self a s)
7676
have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)
7777
refine' (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => _
7878
have assoc := b_prime.associated_of_dvd a_prime b_div_a
7979
have := uniq a
80-
rw [Multiset.countp_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,
81-
Multiset.countp_pos] at this
80+
rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,
81+
Multiset.countP_pos] at this
8282
exact this ⟨b, b_in_s, assoc.symm⟩
8383
#align multiset.prod_primes_dvd Multiset.prod_primes_dvd
8484

@@ -90,10 +90,10 @@ theorem Finset.prod_primes_dvd [CancelCommMonoidWithZero α] [Unique αˣ] {s :
9090
(by simpa only [Multiset.map_id', Finset.mem_def] using div)
9191
(by
9292
-- POrting note: was
93-
-- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countp_eq_card_filter, ←
93+
-- `simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter, ←
9494
-- Multiset.count_eq_card_filter_eq, ← Multiset.nodup_iff_count_le_one, s.nodup]`
9595
intro a
96-
simp only [Multiset.map_id', associated_eq_eq, Multiset.countp_eq_card_filter]
96+
simp only [Multiset.map_id', associated_eq_eq, Multiset.countP_eq_card_filter]
9797
change Multiset.card (Multiset.filter (fun b => a = b) s.val) ≤ 1
9898
apply le_of_eq_of_le (Multiset.count_eq_card_filter_eq _ _).symm
9999
apply Multiset.nodup_iff_count_le_one.mp

Mathlib/Algebra/BigOperators/Basic.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,10 +1308,10 @@ theorem prod_list_count_of_subset [DecidableEq α] [CommMonoid α] (m : List α)
13081308
#align finset.prod_list_count_of_subset Finset.prod_list_count_of_subset
13091309
#align finset.sum_list_count_of_subset Finset.sum_list_count_of_subset
13101310

1311-
theorem sum_filter_count_eq_countp [DecidableEq α] (p : α → Prop) [DecidablePred p] (l : List α) :
1312-
∑ x in l.toFinset.filter p, l.count x = l.countp p := by
1313-
simp [Finset.sum, sum_map_count_dedup_filter_eq_countp p l]
1314-
#align finset.sum_filter_count_eq_countp Finset.sum_filter_count_eq_countp
1311+
theorem sum_filter_count_eq_countP [DecidableEq α] (p : α → Prop) [DecidablePred p] (l : List α) :
1312+
∑ x in l.toFinset.filter p, l.count x = l.countP p := by
1313+
simp [Finset.sum, sum_map_count_dedup_filter_eq_countP p l]
1314+
#align finset.sum_filter_count_eq_countp Finset.sum_filter_count_eq_countP
13151315

13161316
open Multiset
13171317

Mathlib/Algebra/FreeMonoid/Count.lean

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import Mathlib.Data.List.Count
1111
/-!
1212
# `List.count` as a bundled homomorphism
1313
14-
In this file we define `FreeMonoid.countp`, `FreeMonoid.count`, `FreeAddMonoid.countp`, and
15-
`FreeAddMonoid.count`. These are `List.countp` and `List.count` bundled as multiplicative and
14+
In this file we define `FreeMonoid.countP`, `FreeMonoid.count`, `FreeAddMonoid.countP`, and
15+
`FreeAddMonoid.count`. These are `List.countP` and `List.count` bundled as multiplicative and
1616
additive homomorphisms from `FreeMonoid` and `FreeAddMonoid`.
1717
1818
We do not use `to_additive` because it can't map `Multiplicative ℕ` to `ℕ`.
@@ -22,27 +22,27 @@ variable {α : Type*} (p : α → Prop) [DecidablePred p]
2222

2323
namespace FreeAddMonoid
2424

25-
/-- `List.countp` as a bundled additive monoid homomorphism. -/
26-
def countp : FreeAddMonoid α →+ ℕ where
27-
toFun := List.countp p
28-
map_zero' := List.countp_nil _
29-
map_add' := List.countp_append _
30-
#align free_add_monoid.countp FreeAddMonoid.countp
25+
/-- `List.countP` as a bundled additive monoid homomorphism. -/
26+
def countP : FreeAddMonoid α →+ ℕ where
27+
toFun := List.countP p
28+
map_zero' := List.countP_nil _
29+
map_add' := List.countP_append _
30+
#align free_add_monoid.countp FreeAddMonoid.countP
3131

32-
theorem countp_of (x : α) : countp p (of x) = if p x = true then 1 else 0 := by
33-
simp [countp, List.countp, List.countp.go]
34-
#align free_add_monoid.countp_of FreeAddMonoid.countp_of
32+
theorem countP_of (x : α) : countP p (of x) = if p x = true then 1 else 0 := by
33+
simp [countP, List.countP, List.countP.go]
34+
#align free_add_monoid.countp_of FreeAddMonoid.countP_of
3535

36-
theorem countp_apply (l : FreeAddMonoid α) : countp p l = List.countp p l := rfl
37-
#align free_add_monoid.countp_apply FreeAddMonoid.countp_apply
36+
theorem countP_apply (l : FreeAddMonoid α) : countP p l = List.countP p l := rfl
37+
#align free_add_monoid.countp_apply FreeAddMonoid.countP_apply
3838

3939
/-- `List.count` as a bundled additive monoid homomorphism. -/
4040
-- Porting note: was (x = ·)
41-
def count [DecidableEq α] (x : α) : FreeAddMonoid α →+ ℕ := countp (· = x)
41+
def count [DecidableEq α] (x : α) : FreeAddMonoid α →+ ℕ := countP (· = x)
4242
#align free_add_monoid.count FreeAddMonoid.count
4343

4444
theorem count_of [DecidableEq α] (x y : α) : count x (of y) = (Pi.single x 1 : α → ℕ) y := by
45-
simp [Pi.single, Function.update, count, countp, List.countp, List.countp.go,
45+
simp [Pi.single, Function.update, count, countP, List.countP, List.countP.go,
4646
Bool.beq_eq_decide_eq]
4747
#align free_add_monoid.count_of FreeAddMonoid.count_of
4848

@@ -54,28 +54,28 @@ end FreeAddMonoid
5454

5555
namespace FreeMonoid
5656

57-
/-- `List.countp` as a bundled multiplicative monoid homomorphism. -/
58-
def countp : FreeMonoid α →* Multiplicative ℕ :=
59-
AddMonoidHom.toMultiplicative (FreeAddMonoid.countp p)
60-
#align free_monoid.countp FreeMonoid.countp
57+
/-- `List.countP` as a bundled multiplicative monoid homomorphism. -/
58+
def countP : FreeMonoid α →* Multiplicative ℕ :=
59+
AddMonoidHom.toMultiplicative (FreeAddMonoid.countP p)
60+
#align free_monoid.countp FreeMonoid.countP
6161

62-
theorem countp_of' (x : α) :
63-
countp p (of x) = if p x then Multiplicative.ofAdd 1 else Multiplicative.ofAdd 0 := by
64-
erw [FreeAddMonoid.countp_of]
62+
theorem countP_of' (x : α) :
63+
countP p (of x) = if p x then Multiplicative.ofAdd 1 else Multiplicative.ofAdd 0 := by
64+
erw [FreeAddMonoid.countP_of]
6565
simp only [eq_iff_iff, iff_true, ofAdd_zero]; rfl
66-
#align free_monoid.countp_of' FreeMonoid.countp_of'
66+
#align free_monoid.countp_of' FreeMonoid.countP_of'
6767

68-
theorem countp_of (x : α) : countp p (of x) = if p x then Multiplicative.ofAdd 1 else 1 := by
69-
rw [countp_of', ofAdd_zero]
70-
#align free_monoid.countp_of FreeMonoid.countp_of
68+
theorem countP_of (x : α) : countP p (of x) = if p x then Multiplicative.ofAdd 1 else 1 := by
69+
rw [countP_of', ofAdd_zero]
70+
#align free_monoid.countp_of FreeMonoid.countP_of
7171

7272
-- `rfl` is not transitive
73-
theorem countp_apply (l : FreeAddMonoid α) : countp p l = Multiplicative.ofAdd (List.countp p l) :=
73+
theorem countP_apply (l : FreeAddMonoid α) : countP p l = Multiplicative.ofAdd (List.countP p l) :=
7474
rfl
75-
#align free_monoid.countp_apply FreeMonoid.countp_apply
75+
#align free_monoid.countp_apply FreeMonoid.countP_apply
7676

7777
/-- `List.count` as a bundled additive monoid homomorphism. -/
78-
def count [DecidableEq α] (x : α) : FreeMonoid α →* Multiplicative ℕ := countp (· = x)
78+
def count [DecidableEq α] (x : α) : FreeMonoid α →* Multiplicative ℕ := countP (· = x)
7979
#align free_monoid.count FreeMonoid.count
8080

8181
theorem count_apply [DecidableEq α] (x : α) (l : FreeAddMonoid α) :
@@ -84,7 +84,7 @@ theorem count_apply [DecidableEq α] (x : α) (l : FreeAddMonoid α) :
8484

8585
theorem count_of [DecidableEq α] (x y : α) :
8686
count x (of y) = @Pi.mulSingle α (fun _ => Multiplicative ℕ) _ _ x (Multiplicative.ofAdd 1) y :=
87-
by simp [count, countp_of, Pi.mulSingle_apply, eq_comm, Bool.beq_eq_decide_eq]
87+
by simp [count, countP_of, Pi.mulSingle_apply, eq_comm, Bool.beq_eq_decide_eq]
8888
#align free_monoid.count_of FreeMonoid.count_of
8989

9090
end FreeMonoid

Mathlib/Combinatorics/SimpleGraph/Trails.lean

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ as Eulerian circuits).
1818
## Main definitions
1919
2020
* `SimpleGraph.Walk.IsEulerian` is the predicate that a trail is an Eulerian trail.
21-
* `SimpleGraph.Walk.IsTrail.even_countp_edges_iff` gives a condition on the number of edges
21+
* `SimpleGraph.Walk.IsTrail.even_countP_edges_iff` gives a condition on the number of edges
2222
in a trail that can be incident to a given vertex.
2323
* `SimpleGraph.Walk.IsEulerian.even_degree_iff` gives a condition on the degrees of vertices
2424
when there exists an Eulerian trail.
@@ -51,13 +51,13 @@ def IsTrail.edgesFinset {u v : V} {p : G.Walk u v} (h : p.IsTrail) : Finset (Sym
5151

5252
variable [DecidableEq V]
5353

54-
theorem IsTrail.even_countp_edges_iff {u v : V} {p : G.Walk u v} (ht : p.IsTrail) (x : V) :
55-
Even (p.edges.countp fun e => x ∈ e) ↔ u ≠ v → x ≠ u ∧ x ≠ v := by
54+
theorem IsTrail.even_countP_edges_iff {u v : V} {p : G.Walk u v} (ht : p.IsTrail) (x : V) :
55+
Even (p.edges.countP fun e => x ∈ e) ↔ u ≠ v → x ≠ u ∧ x ≠ v := by
5656
induction' p with u u v w huv p ih
5757
· simp
5858
· rw [cons_isTrail_iff] at ht
5959
specialize ih ht.1
60-
simp only [List.countp_cons, Ne.def, edges_cons, Sym2.mem_iff]
60+
simp only [List.countP_cons, Ne.def, edges_cons, Sym2.mem_iff]
6161
split_ifs with h
6262
· rw [decide_eq_true_eq] at h
6363
obtain (rfl | rfl) := h
@@ -80,7 +80,7 @@ theorem IsTrail.even_countp_edges_iff {u v : V} {p : G.Walk u v} (ht : p.IsTrail
8080
simp only [imp_false, eq_self_iff_true, not_true, Classical.not_not] at h'
8181
cases h'
8282
simp only [not_true, and_false, false_and] at h
83-
#align simple_graph.walk.is_trail.even_countp_edges_iff SimpleGraph.Walk.IsTrail.even_countp_edges_iff
83+
#align simple_graph.walk.is_trail.even_countp_edges_iff SimpleGraph.Walk.IsTrail.even_countP_edges_iff
8484

8585
/-- An *Eulerian trail* (also known as an "Eulerian path") is a walk
8686
`p` that visits every edge exactly once. The lemma `SimpleGraph.Walk.IsEulerian.IsTrail` shows
@@ -101,7 +101,8 @@ theorem IsEulerian.isTrail {u v : V} {p : G.Walk u v} (h : p.IsEulerian) : p.IsT
101101

102102
theorem IsEulerian.mem_edges_iff {u v : V} {p : G.Walk u v} (h : p.IsEulerian) {e : Sym2 V} :
103103
e ∈ p.edges ↔ e ∈ G.edgeSet :=
104-
fun h => p.edges_subset_edgeSet h, fun he => by simpa using (h e he).ge⟩
104+
fun h => p.edges_subset_edgeSet h
105+
, fun he => by apply List.count_pos_iff_mem.mp; simpa using (h e he).ge ⟩
105106
#align simple_graph.walk.is_eulerian.mem_edges_iff SimpleGraph.Walk.IsEulerian.mem_edges_iff
106107

107108
/-- The edge set of an Eulerian graph is finite. -/
@@ -133,8 +134,8 @@ theorem IsEulerian.edgesFinset_eq [Fintype G.edgeSet] {u v : V} {p : G.Walk u v}
133134

134135
theorem IsEulerian.even_degree_iff {x u v : V} {p : G.Walk u v} (ht : p.IsEulerian) [Fintype V]
135136
[DecidableRel G.Adj] : Even (G.degree x) ↔ u ≠ v → x ≠ u ∧ x ≠ v := by
136-
convert ht.isTrail.even_countp_edges_iff x
137-
rw [← Multiset.coe_countp, Multiset.countp_eq_card_filter, ← card_incidenceFinset_eq_degree]
137+
convert ht.isTrail.even_countP_edges_iff x
138+
rw [← Multiset.coe_countP, Multiset.countP_eq_card_filter, ← card_incidenceFinset_eq_degree]
138139
change Multiset.card _ = _
139140
congr 1
140141
convert_to _ = (ht.isTrail.edgesFinset.filter (Membership.mem x)).val

Mathlib/Data/Bool/Count.lean

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ namespace List
2323
@[simp]
2424
theorem count_not_add_count (l : List Bool) (b : Bool) : count (!b) l + count b l = length l := by
2525
-- Porting note: Proof re-written
26-
-- Old proof: simp only [length_eq_countp_add_countp (Eq (!b)), Bool.not_not_eq, count]
27-
simp only [length_eq_countp_add_countp (· == !b), count, add_right_inj]
26+
-- Old proof: simp only [length_eq_countP_add_countP (Eq (!b)), Bool.not_not_eq, count]
27+
simp only [length_eq_countP_add_countP (· == !b), count, add_right_inj]
2828
suffices : (fun x => x == b) = (fun a => decide ¬(a == !b) = true); rw [this]
2929
ext x; cases x <;> cases b <;> rfl
3030
#align list.count_bnot_add_count List.count_not_add_count
@@ -110,7 +110,7 @@ theorem two_mul_count_bool_eq_ite (hl : Chain' (· ≠ ·) l) (b : Bool) :
110110
· rw [if_pos h2, hl.two_mul_count_bool_of_even h2]
111111
· cases' l with x l
112112
· exact (h2 even_zero).elim
113-
simp only [if_neg h2, count_cons', mul_add, head?, Option.mem_some_iff, @eq_comm _ x]
113+
simp only [if_neg h2, count_cons, mul_add, head?, Option.mem_some_iff, @eq_comm _ x]
114114
rw [length_cons, Nat.even_add_one, not_not] at h2
115115
replace hl : l.Chain' (· ≠ ·) := hl.tail
116116
rw [hl.two_mul_count_bool_of_even h2]
@@ -138,4 +138,3 @@ theorem two_mul_count_bool_le_length_add_one (hl : Chain' (· ≠ ·) l) (b : Bo
138138
end Chain'
139139

140140
end List
141-

Mathlib/Data/Fintype/Fin.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ theorem card_filter_univ_eq_vector_get_eq_count [DecidableEq α] (a : α) (v : V
8787
induction' v using Vector.inductionOn with n x xs hxs
8888
· simp
8989
· simp_rw [card_filter_univ_succ', Vector.get_cons_zero, Vector.toList_cons, Function.comp,
90-
Vector.get_cons_succ, hxs, List.count_cons', add_comm (ite (a = x) 1 0)]
90+
Vector.get_cons_succ, hxs, List.count_cons, add_comm (ite (a = x) 1 0)]
9191
#align fin.card_filter_univ_eq_vector_nth_eq_count Fin.card_filter_univ_eq_vector_get_eq_count
9292

9393
end Fin

0 commit comments

Comments
 (0)