Skip to content

Commit

Permalink
chore: process and remove adaptation_note for nightly-2024-09-06 (#17498
Browse files Browse the repository at this point in the history
)
  • Loading branch information
jcommelin committed Oct 7, 2024
1 parent 1b67a7c commit 8b37774
Show file tree
Hide file tree
Showing 26 changed files with 41 additions and 202 deletions.
18 changes: 3 additions & 15 deletions Mathlib/Algebra/Order/Floor.lean
Original file line number Diff line number Diff line change
Expand Up @@ -222,21 +222,13 @@ theorem floor_eq_zero : ⌊a⌋₊ = 0 ↔ a < 1 := by
rw [← lt_one_iff, ← @cast_one α]
exact floor_lt' Nat.one_ne_zero

#adaptation_note
/--
After nightly-2024-09-06 we can remove the `_root_` prefix below.
-/
theorem floor_eq_iff (ha : 0 ≤ a) : ⌊a⌋₊ = n ↔ ↑n ≤ a ∧ a < ↑n + 1 := by
rw [← le_floor_iff ha, ← Nat.cast_one, ← Nat.cast_add, ← floor_lt ha, Nat.lt_add_one_iff,
le_antisymm_iff, _root_.and_comm]
le_antisymm_iff, and_comm]

#adaptation_note
/--
After nightly-2024-09-06 we can remove the `_root_` prefix below.
-/
theorem floor_eq_iff' (hn : n ≠ 0) : ⌊a⌋₊ = n ↔ ↑n ≤ a ∧ a < ↑n + 1 := by
rw [← le_floor_iff' hn, ← Nat.cast_one, ← Nat.cast_add, ← floor_lt' (Nat.add_one_ne_zero n),
Nat.lt_add_one_iff, le_antisymm_iff, _root_.and_comm]
Nat.lt_add_one_iff, le_antisymm_iff, and_comm]

theorem floor_eq_on_Ico (n : ℕ) : ∀ a ∈ (Set.Ico n (n + 1) : Set α), ⌊a⌋₊ = n := fun _ ⟨h₀, h₁⟩ =>
(floor_eq_iff <| n.cast_nonneg.trans h₀).mpr ⟨h₀, h₁⟩
Expand Down Expand Up @@ -328,14 +320,10 @@ theorem floor_lt_ceil_of_lt_of_pos {a b : α} (h : a < b) (h' : 0 < b) : ⌊a⌋
exact h.trans_le (le_ceil _)
· rwa [floor_of_nonpos ha.le, lt_ceil, Nat.cast_zero]

#adaptation_note
/--
After nightly-2024-09-06 we can remove the `_root_` prefix below.
-/
theorem ceil_eq_iff (hn : n ≠ 0) : ⌈a⌉₊ = n ↔ ↑(n - 1) < a ∧ a ≤ n := by
rw [← ceil_le, ← not_le, ← ceil_le, not_le,
tsub_lt_iff_right (Nat.add_one_le_iff.2 (pos_iff_ne_zero.2 hn)), Nat.lt_add_one_iff,
le_antisymm_iff, _root_.and_comm]
le_antisymm_iff, and_comm]

@[simp]
theorem preimage_ceil_zero : (Nat.ceil : α → ℕ) ⁻¹' {0} = Iic 0 :=
Expand Down
6 changes: 1 addition & 5 deletions Mathlib/Algebra/Ring/Parity.lean
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,10 @@ lemma even_or_odd (n : ℕ) : Even n ∨ Odd n := (even_xor_odd n).or
lemma even_or_odd' (n : ℕ) : ∃ k, n = 2 * k ∨ n = 2 * k + 1 := by
simpa only [← two_mul, exists_or, Odd, Even] using even_or_odd n

#adaptation_note
/--
After nightly-2024-09-06 we can remove the `_root_` prefix below.
-/
lemma even_xor_odd' (n : ℕ) : ∃ k, Xor' (n = 2 * k) (n = 2 * k + 1) := by
obtain ⟨k, rfl⟩ | ⟨k, rfl⟩ := even_or_odd n <;> use k
· simpa only [← two_mul, eq_self_iff_true, xor_true] using (succ_ne_self (2 * k)).symm
· simpa only [xor_true, _root_.xor_comm] using (succ_ne_self _)
· simpa only [xor_true, xor_comm] using (succ_ne_self _)

lemma mod_two_add_add_odd_mod_two (m : ℕ) {n : ℕ} (hn : Odd n) : m % 2 + (m + n) % 2 = 1 :=
((even_or_odd m).elim fun hm ↦ by rw [even_iff.1 hm, odd_iff.1 (hm.add_odd hn)]) fun hm ↦ by
Expand Down
12 changes: 2 additions & 10 deletions Mathlib/Combinatorics/SetFamily/KruskalKatona.lean
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ namespace Finset
namespace Colex
variable {α : Type*} [LinearOrder α] {𝒜 𝒜₁ 𝒜₂ : Finset (Finset α)} {s t : Finset α} {r : ℕ}

#adaptation_note
/--
After nightly-2024-09-06 we can remove the `_root_` prefix below.
-/
/-- This is important for iterating Kruskal-Katona: the shadow of an initial segment is also an
initial segment. -/
lemma shadow_initSeg [Fintype α] (hs : s.Nonempty) :
Expand All @@ -71,7 +67,7 @@ lemma shadow_initSeg [Fintype α] (hs : s.Nonempty) :
· simpa [ha] using erase_le_erase_min' hts hst.ge (mem_insert_self _ _)
-- Now show that if t ≤ s - min s, there is j such that t ∪ j ≤ s
-- We choose j as the smallest thing not in t
simp_rw [le_iff_eq_or_lt, lt_iff_exists_filter_lt, mem_sdiff, filter_inj, _root_.and_assoc]
simp_rw [le_iff_eq_or_lt, lt_iff_exists_filter_lt, mem_sdiff, filter_inj, and_assoc]
simp only [toColex_inj, ofColex_toColex, ne_eq, and_imp]
rintro cards' (rfl | ⟨k, hks, hkt, z⟩)
-- If t = s - min s, then use j = min s so t ∪ j = s
Expand Down Expand Up @@ -129,17 +125,13 @@ variable {α : Type*} [LinearOrder α] {s U V : Finset α} {n : ℕ}

namespace UV

#adaptation_note
/--
After nightly-2024-09-06 we can remove the `_root_` prefix below.
-/
/-- Applying the compression makes the set smaller in colex. This is intuitive since a portion of
the set is being "shifted down" as `max U < max V`. -/
lemma toColex_compress_lt_toColex {hU : U.Nonempty} {hV : V.Nonempty} (h : max' U hU < max' V hV)
(hA : compress U V s ≠ s) : toColex (compress U V s) < toColex s := by
rw [compress, ite_ne_right_iff] at hA
rw [compress, if_pos hA.1, lt_iff_exists_filter_lt]
simp_rw [mem_sdiff (s := s), filter_inj, _root_.and_assoc]
simp_rw [mem_sdiff (s := s), filter_inj, and_assoc]
refine ⟨_, hA.1.2 <| max'_mem _ hV, not_mem_sdiff_of_mem_right <| max'_mem _ _, fun a ha ↦ ?_⟩
have : a ∉ V := fun H ↦ ha.not_le (le_max' _ _ H)
have : a ∉ U := fun H ↦ ha.not_lt ((le_max' _ _ H).trans_lt h)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ namespace Finpartition

variable {α : Type*} [DecidableEq α] {s t : Finset α} {m n a b : ℕ} {P : Finpartition s}

#adaptation_note
/--
After nightly-2024-09-06 we can remove the `_root_` prefix below.
-/
/-- Given a partition `P` of `s`, as well as a proof that `a * m + b * (m + 1) = s.card`, we can
find a new partition `Q` of `s` where each part has size `m` or `m + 1`, every part of `P` is the
union of parts of `Q` plus at most `m` extra elements, there are `b` parts of size `m + 1` and
Expand All @@ -50,7 +46,7 @@ theorem equitabilise_aux (hs : a * m + b * (m + 1) = s.card) :
obtain rfl | m_pos := m.eq_zero_or_pos
· refine ⟨⊥, by simp, ?_, by simpa [Finset.filter_true_of_mem] using hs.symm⟩
simp only [le_zero_iff, card_eq_zero, mem_biUnion, exists_prop, mem_filter, id,
_root_.and_assoc, sdiff_eq_empty_iff_subset, subset_iff]
and_assoc, sdiff_eq_empty_iff_subset, subset_iff]
exact fun x hx a ha =>
⟨{a}, mem_map_of_mem _ (P.le hx ha), singleton_subset_iff.2 ha, mem_singleton_self _⟩
-- Prove the case `m > 0` by strong induction on `s`
Expand Down
6 changes: 1 addition & 5 deletions Mathlib/Combinatorics/SimpleGraph/Triangle/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@ lemma LocallyLinear.map (f : α ↪ β) (hG : G.LocallyLinear) : (G.map f).Local
· rw [← Equiv.coe_toEmbedding, ← map_symm]
exact LocallyLinear.map _

#adaptation_note
/--
After nightly-2024-09-06 we can remove the `_root_` prefix below.
-/
lemma edgeDisjointTriangles_iff_mem_sym2_subsingleton :
G.EdgeDisjointTriangles ↔
∀ ⦃e : Sym2 α⦄, ¬ e.IsDiag → {s ∈ G.cliqueSet 3 | e ∈ (s : Finset α).sym2}.Subsingleton := by
Expand All @@ -96,7 +92,7 @@ lemma edgeDisjointTriangles_iff_mem_sym2_subsingleton :
ext s
simp only [mem_sym2_iff, Sym2.mem_iff, forall_eq_or_imp, forall_eq, Set.sep_and,
Set.mem_inter_iff, Set.mem_sep_iff, mem_cliqueSet_iff, Set.mem_setOf_eq,
and_and_and_comm (b := _ ∈ _), _root_.and_self, is3Clique_iff]
and_and_and_comm (b := _ ∈ _), and_self, is3Clique_iff]
constructor
· rintro ⟨⟨c, d, e, hcd, hce, hde, rfl⟩, hab⟩
simp only [mem_insert, mem_singleton] at hab
Expand Down
6 changes: 1 addition & 5 deletions Mathlib/Data/Finset/NatDivisors.lean
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,12 @@ exhibiting `Nat.divisors` as a multiplicative homomorphism from `ℕ` to `Finset
open Nat Finset
open scoped Pointwise

#adaptation_note
/--
After nightly-2024-09-06 we can remove the `_root_` prefix below.
-/
/-- The divisors of a product of natural numbers are the pointwise product of the divisors of the
factors. -/
lemma Nat.divisors_mul (m n : ℕ) : divisors (m * n) = divisors m * divisors n := by
ext k
simp_rw [mem_mul, mem_divisors, dvd_mul, mul_ne_zero_iff, ← exists_and_left, ← exists_and_right]
simp only [_root_.and_assoc, _root_.and_comm, and_left_comm]
simp only [and_assoc, and_comm, and_left_comm]

/-- `Nat.divisors` as a `MonoidHom`. -/
@[simps]
Expand Down
7 changes: 1 addition & 6 deletions Mathlib/Data/Int/Defs.lean
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,7 @@ protected lemma le_antisymm_iff : a = b ↔ a ≤ b ∧ b ≤ a :=
protected lemma le_iff_eq_or_lt : a ≤ b ↔ a = b ∨ a < b := by
rw [Int.le_antisymm_iff, Int.lt_iff_le_not_le, ← and_or_left]; simp [em]

#adaptation_note
/--
After nightly-2024-09-06 we can remove the `_root_` prefix below.
-/
protected lemma le_iff_lt_or_eq : a ≤ b ↔ a < b ∨ a = b := by rw [Int.le_iff_eq_or_lt,
_root_.or_comm]
protected lemma le_iff_lt_or_eq : a ≤ b ↔ a < b ∨ a = b := by rw [Int.le_iff_eq_or_lt, or_comm]

end Order

Expand Down
7 changes: 1 addition & 6 deletions Mathlib/Data/List/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2177,18 +2177,13 @@ end Forall
theorem get_attach (L : List α) (i) :
(L.attach.get i).1 = L.get ⟨i, length_attach (L := L) ▸ i.2⟩ := by simp

#adaptation_note
/--
After nightly-2024-09-06 we can remove the `_root_` prefix below.
-/
@[simp 1100]
theorem mem_map_swap (x : α) (y : β) (xs : List (α × β)) :
(y, x) ∈ map Prod.swap xs ↔ (x, y) ∈ xs := by
induction' xs with x xs xs_ih
· simp only [not_mem_nil, map_nil]
· cases' x with a b
simp only [mem_cons, Prod.mk.inj_iff, map, Prod.swap_prod_mk, Prod.exists, xs_ih,
_root_.and_comm]
simp only [mem_cons, Prod.mk.inj_iff, map, Prod.swap_prod_mk, Prod.exists, xs_ih, and_comm]

theorem dropSlice_eq (xs : List α) (n m : ℕ) : dropSlice n m xs = xs.take n ++ xs.drop (n + m) := by
induction n generalizing xs
Expand Down
25 changes: 4 additions & 21 deletions Mathlib/Data/List/Chain.lean
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ theorem Chain.iff_mem {a : α} {l : List α} :
theorem chain_singleton {a b : α} : Chain R a [b] ↔ R a b := by
simp only [chain_cons, Chain.nil, and_true]

#adaptation_note
/--
After nightly-2024-09-06 we can remove the `_root_` prefix below.
-/
theorem chain_split {a b : α} {l₁ l₂ : List α} :
Chain R a (l₁ ++ b :: l₂) ↔ Chain R a (l₁ ++ [b]) ∧ Chain R b l₂ := by
induction' l₁ with x l₁ IH generalizing a <;>
Expand Down Expand Up @@ -243,18 +239,13 @@ theorem Chain'.cons' {x} : ∀ {l : List α}, Chain' R l → (∀ y ∈ l.head?,
theorem chain'_cons' {x l} : Chain' R (x :: l) ↔ (∀ y ∈ head? l, R x y) ∧ Chain' R l :=
fun h => ⟨h.rel_head?, h.tail⟩, fun ⟨h₁, h₂⟩ => h₂.cons' h₁⟩

#adaptation_note
/--
After nightly-2024-09-06 we can remove the `_root_` prefixes below.
-/
theorem chain'_append :
∀ {l₁ l₂ : List α},
Chain' R (l₁ ++ l₂) ↔ Chain' R l₁ ∧ Chain' R l₂ ∧ ∀ x ∈ l₁.getLast?, ∀ y ∈ l₂.head?, R x y
| [], l => by simp
| [a], l => by simp [chain'_cons', _root_.and_comm]
| [a], l => by simp [chain'_cons', and_comm]
| a :: b :: l₁, l₂ => by
rw [cons_append, cons_append, chain'_cons, chain'_cons, ← cons_append, chain'_append,
_root_.and_assoc]
rw [cons_append, cons_append, chain'_cons, chain'_cons, ← cons_append, chain'_append, and_assoc]
simp

theorem Chain'.append (h₁ : Chain' R l₁) (h₂ : Chain' R l₂)
Expand Down Expand Up @@ -293,16 +284,12 @@ theorem Chain'.imp_head {x y} (h : ∀ {z}, R x z → R y z) {l} (hl : Chain' R
Chain' R (y :: l) :=
hl.tail.cons' fun _ hz => h <| hl.rel_head? hz

#adaptation_note
/--
After nightly-2024-09-06 we can remove the `_root_` prefix below.
-/
theorem chain'_reverse : ∀ {l}, Chain' R (reverse l) ↔ Chain' (flip R) l
| [] => Iff.rfl
| [a] => by simp only [chain'_singleton, reverse_singleton]
| a :: b :: l => by
rw [chain'_cons, reverse_cons, reverse_cons, append_assoc, cons_append, nil_append,
chain'_split, ← reverse_cons, @chain'_reverse (b :: l), _root_.and_comm, chain'_pair, flip]
chain'_split, ← reverse_cons, @chain'_reverse (b :: l), and_comm, chain'_pair, flip]

theorem chain'_iff_get {R} : ∀ {l : List α}, Chain' R l ↔
∀ (i : ℕ) (h : i < length l - 1),
Expand All @@ -320,10 +307,6 @@ theorem Chain'.append_overlap {l₁ l₂ l₃ : List α} (h₁ : Chain' R (l₁
h₁.append h₂.right_of_append <| by
simpa only [getLast?_append_of_ne_nil _ hn] using (chain'_append.1 h₂).2.2

#adaptation_note
/--
After nightly-2024-09-06 we can remove the `_root_` prefix below.
-/
lemma chain'_join : ∀ {L : List (List α)}, [] ∉ L →
(Chain' R L.join ↔ (∀ l ∈ L, Chain' R l) ∧
L.Chain' (fun l₁ l₂ => ∀ᵉ (x ∈ l₁.getLast?) (y ∈ l₂.head?), R x y))
Expand All @@ -333,7 +316,7 @@ lemma chain'_join : ∀ {L : List (List α)}, [] ∉ L →
rw [mem_cons, not_or, ← Ne] at hL
rw [join, chain'_append, chain'_join hL.2, forall_mem_cons, chain'_cons]
rw [mem_cons, not_or, ← Ne] at hL
simp only [forall_mem_cons, _root_.and_assoc, join, head?_append_of_ne_nil _ hL.2.1.symm]
simp only [forall_mem_cons, and_assoc, join, head?_append_of_ne_nil _ hL.2.1.symm]
exact Iff.rfl.and (Iff.rfl.and <| Iff.rfl.and and_comm)

/-- If `a` and `b` are related by the reflexive transitive closure of `r`, then there is an
Expand Down
18 changes: 3 additions & 15 deletions Mathlib/Data/List/Nodup.lean
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,13 @@ theorem nodup_iff_get?_ne_get? {l : List α} :
l.Nodup ↔ ∀ i j : ℕ, i < j → j < l.length → l.get? i ≠ l.get? j := by
simp [nodup_iff_getElem?_ne_getElem?]

#adaptation_note
/--
After nightly-2024-09-06 we can remove the `_root_` prefix below.
-/
theorem Nodup.ne_singleton_iff {l : List α} (h : Nodup l) (x : α) :
l ≠ [x] ↔ l = [] ∨ ∃ y ∈ l, y ≠ x := by
induction' l with hd tl hl
· simp
· specialize hl h.of_cons
by_cases hx : tl = [x]
· simpa [hx, _root_.and_comm, and_or_left] using h
· simpa [hx, and_comm, and_or_left] using h
· rw [← Ne, hl] at hx
rcases hx with (rfl | ⟨y, hy, hx⟩)
· simp
Expand Down Expand Up @@ -178,13 +174,9 @@ theorem Nodup.append (d₁ : Nodup l₁) (d₂ : Nodup l₂) (dj : Disjoint l₁
theorem nodup_append_comm {l₁ l₂ : List α} : Nodup (l₁ ++ l₂) ↔ Nodup (l₂ ++ l₁) := by
simp only [nodup_append, and_left_comm, disjoint_comm]

#adaptation_note
/--
After nightly-2024-09-06 we can remove the `_root_` prefix below.
-/
theorem nodup_middle {a : α} {l₁ l₂ : List α} :
Nodup (l₁ ++ a :: l₂) ↔ Nodup (a :: (l₁ ++ l₂)) := by
simp only [nodup_append, not_or, and_left_comm, _root_.and_assoc, nodup_cons, mem_append,
simp only [nodup_append, not_or, and_left_comm, and_assoc, nodup_cons, mem_append,
disjoint_cons_right]

theorem Nodup.of_map (f : α → β) {l : List α} : Nodup (map f l) → Nodup l :=
Expand Down Expand Up @@ -267,14 +259,10 @@ theorem nodup_join {L : List (List α)} :
Nodup (join L) ↔ (∀ l ∈ L, Nodup l) ∧ Pairwise Disjoint L := by
simp only [Nodup, pairwise_join, disjoint_left.symm, forall_mem_ne]

#adaptation_note
/--
After nightly-2024-09-06 we can remove the `_root_` prefix below.
-/
theorem nodup_bind {l₁ : List α} {f : α → List β} :
Nodup (l₁.bind f) ↔
(∀ x ∈ l₁, Nodup (f x)) ∧ Pairwise (fun a b : α => Disjoint (f a) (f b)) l₁ := by
simp only [List.bind, nodup_join, pairwise_map, _root_.and_comm, and_left_comm, mem_map,
simp only [List.bind, nodup_join, pairwise_map, and_comm, and_left_comm, mem_map,
exists_imp, and_imp]
rw [show (∀ (l : List β) (x : α), f x = l → x ∈ l₁ → Nodup l) ↔ ∀ x : α, x ∈ l₁ → Nodup (f x)
from forall_swap.trans <| forall_congr' fun _ => forall_eq']
Expand Down
6 changes: 1 addition & 5 deletions Mathlib/Data/List/Perm.lean
Original file line number Diff line number Diff line change
Expand Up @@ -246,17 +246,13 @@ theorem Perm.bagInter {l₁ l₂ t₁ t₂ : List α} (hl : l₁ ~ l₂) (ht : t
l₁.bagInter t₁ ~ l₂.bagInter t₂ :=
ht.bagInter_left l₂ ▸ hl.bagInter_right _

#adaptation_note
/--
After nightly-2024-09-06 we can remove the `_root_` prefix below.
-/
theorem perm_replicate_append_replicate {l : List α} {a b : α} {m n : ℕ} (h : a ≠ b) :
l ~ replicate m a ++ replicate n b ↔ count a l = m ∧ count b l = n ∧ l ⊆ [a, b] := by
rw [perm_iff_count, ← Decidable.and_forall_ne a, ← Decidable.and_forall_ne b]
suffices l ⊆ [a, b] ↔ ∀ c, c ≠ b → c ≠ a → c ∉ l by
simp (config := { contextual := true }) [count_replicate, h, this, count_eq_zero, Ne.symm]
trans ∀ c, c ∈ l → c = b ∨ c = a
· simp [subset_def, _root_.or_comm]
· simp [subset_def, or_comm]
· exact forall_congr' fun _ => by rw [← and_imp, ← not_or, not_imp_not]

theorem Perm.dedup {l₁ l₂ : List α} (p : l₁ ~ l₂) : dedup l₁ ~ dedup l₂ :=
Expand Down
6 changes: 1 addition & 5 deletions Mathlib/Data/List/Permutation.lean
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,6 @@ theorem foldr_permutationsAux2 (t : α) (ts : List α) (r L : List (List α)) :
· rfl
· simp_rw [foldr_cons, ih, bind_cons, append_assoc, permutationsAux2_append]

#adaptation_note
/--
After nightly-2024-09-06 we can remove the `_root_` prefix below.
-/
theorem mem_foldr_permutationsAux2 {t : α} {ts : List α} {r L : List (List α)} {l' : List α} :
l' ∈ foldr (fun y r => (permutationsAux2 t ts r y id).2) r L ↔
l' ∈ r ∨ ∃ l₁ l₂, l₁ ++ l₂ ∈ L ∧ l₂ ≠ [] ∧ l' = l₁ ++ t :: l₂ ++ ts := by
Expand All @@ -180,7 +176,7 @@ theorem mem_foldr_permutationsAux2 {t : α} {ts : List α} {r L : List (List α)
fun ⟨_, aL, l₁, l₂, l0, e, h⟩ => ⟨l₁, l₂, l0, e ▸ aL, h⟩, fun ⟨l₁, l₂, l0, aL, h⟩ =>
⟨_, aL, l₁, l₂, l0, rfl, h⟩⟩
rw [foldr_permutationsAux2]
simp only [mem_permutationsAux2', ← this, _root_.or_comm, and_left_comm, mem_append, mem_bind,
simp only [mem_permutationsAux2', ← this, or_comm, and_left_comm, mem_append, mem_bind,
append_assoc, cons_append, exists_prop]

theorem length_foldr_permutationsAux2 (t : α) (ts : List α) (r L : List (List α)) :
Expand Down
6 changes: 1 addition & 5 deletions Mathlib/Data/List/Rotate.lean
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,11 @@ theorem rotate_cons_succ (l : List α) (a : α) (n : ℕ) :
(a :: l : List α).rotate (n + 1) = (l ++ [a]).rotate n := by
rw [rotate_eq_rotate', rotate_eq_rotate', rotate'_cons_succ]

#adaptation_note
/--
After nightly-2024-09-06 we can remove the `_root_` prefix below.
-/
@[simp]
theorem mem_rotate : ∀ {l : List α} {a : α} {n : ℕ}, a ∈ l.rotate n ↔ a ∈ l
| [], _, n => by simp
| a :: l, _, 0 => by simp
| a :: l, _, n + 1 => by simp [rotate_cons_succ, mem_rotate, _root_.or_comm]
| a :: l, _, n + 1 => by simp [rotate_cons_succ, mem_rotate, or_comm]

@[simp]
theorem length_rotate (l : List α) (n : ℕ) : (l.rotate n).length = l.length := by
Expand Down
Loading

0 comments on commit 8b37774

Please sign in to comment.