data.list.sublists
⟷
Mathlib.Data.List.Sublists
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)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -89,7 +89,7 @@ theorem mem_sublists' {s t : List α} : s ∈ sublists' t ↔ s <+ t :=
theorem length_sublists' : ∀ l : List α, length (sublists' l) = 2 ^ length l
| [] => rfl
| a :: l => by
- simp only [sublists'_cons, length_append, length_sublists' l, length_map, length, pow_succ',
+ simp only [sublists'_cons, length_append, length_sublists' l, length_map, length, pow_succ,
mul_succ, MulZeroClass.mul_zero, zero_add]
#align list.length_sublists' List.length_sublists'
-/
@@ -257,15 +257,15 @@ theorem length_sublists (l : List α) : length (sublists l) = 2 ^ length l := by
#align list.length_sublists List.length_sublists
-/
-#print List.map_ret_sublist_sublists /-
-theorem map_ret_sublist_sublists (l : List α) : map List.ret l <+ sublists l :=
+#print List.map_pure_sublist_sublists /-
+theorem map_pure_sublist_sublists (l : List α) : map List.pure l <+ sublists l :=
reverseRecOn l (nil_sublist _) fun l a IH => by
simp only [map, map_append, sublists_concat] <;>
exact
((append_sublist_append_left _).2 <|
singleton_sublist.2 <| mem_map.2 ⟨[], mem_sublists.2 (nil_sublist _), by rfl⟩).trans
((append_sublist_append_right _).2 IH)
-#align list.map_ret_sublist_sublists List.map_ret_sublist_sublists
+#align list.map_ret_sublist_sublists List.map_pure_sublist_sublists
-/
/-! ### sublists_len -/
@@ -458,7 +458,7 @@ theorem pairwise_sublists {R} {l : List α} (H : Pairwise R l) :
#print List.nodup_sublists /-
@[simp]
theorem nodup_sublists {l : List α} : Nodup (sublists l) ↔ Nodup l :=
- ⟨fun h => (h.Sublist (map_ret_sublist_sublists _)).of_map _, fun h =>
+ ⟨fun h => (h.Sublist (map_pure_sublist_sublists _)).of_map _, fun h =>
(pairwise_sublists h).imp fun _ _ h => mt reverse_inj.2 h.to_ne⟩
#align list.nodup_sublists List.nodup_sublists
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -382,7 +382,7 @@ theorem length_of_sublistsLen {α : Type _} :
| 0, l, l', Or.inl rfl => rfl
| n + 1, a :: l, l', h =>
by
- rw [sublists_len_succ_cons, mem_append, mem_map] at h
+ rw [sublists_len_succ_cons, mem_append, mem_map] at h
rcases h with (h | ⟨l', h, rfl⟩)
· exact length_of_sublists_len h
· exact congr_arg (· + 1) (length_of_sublists_len h)
@@ -451,7 +451,7 @@ theorem Pairwise.sublists' {R} :
#print List.pairwise_sublists /-
theorem pairwise_sublists {R} {l : List α} (H : Pairwise R l) :
Pairwise (fun l₁ l₂ => Lex R (reverse l₁) (reverse l₂)) (sublists l) := by
- have := (pairwise_reverse.2 H).sublists'; rwa [sublists'_reverse, pairwise_map] at this
+ have := (pairwise_reverse.2 H).sublists'; rwa [sublists'_reverse, pairwise_map] at this
#align list.pairwise_sublists List.pairwise_sublists
-/
@@ -511,12 +511,12 @@ theorem revzip_sublists (l : List α) : ∀ l₁ l₂, (l₁, l₂) ∈ revzip l
by
rw [revzip]
apply List.reverseRecOn l
- · intro l₁ l₂ h; simp at h ; simp [h]
+ · intro l₁ l₂ h; simp at h; simp [h]
· intro l a IH l₁ l₂ h
rw [sublists_concat, reverse_append, zip_append, ← map_reverse, zip_map_right, zip_map_left] at
- h <;>
+ h <;>
[skip; · simp]
- simp only [Prod.mk.inj_iff, mem_map, mem_append, Prod.map_mk, Prod.exists] at h
+ simp only [Prod.mk.inj_iff, mem_map, mem_append, Prod.map_mk, Prod.exists] at h
rcases h with (⟨l₁, l₂', h, rfl, rfl⟩ | ⟨l₁', l₂, h, rfl, rfl⟩)
· rw [← append_assoc]
exact (IH _ _ h).append_right _
@@ -532,9 +532,9 @@ theorem revzip_sublists' (l : List α) : ∀ l₁ l₂, (l₁, l₂) ∈ revzip
by
rw [revzip]
induction' l with a l IH <;> intro l₁ l₂ h
- · simp at h ; simp [h]
- · rw [sublists'_cons, reverse_append, zip_append, ← map_reverse, zip_map_right, zip_map_left] at h
- <;> [simp at h ; simp]
+ · simp at h; simp [h]
+ · rw [sublists'_cons, reverse_append, zip_append, ← map_reverse, zip_map_right, zip_map_left] at
+ h <;> [simp at h; simp]
rcases h with (⟨l₁, l₂', h, rfl, rfl⟩ | ⟨l₁', h, rfl⟩)
· exact perm_middle.trans ((IH _ _ h).cons _)
· exact (IH _ _ h).cons _
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,8 +3,8 @@ Copyright (c) 2019 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
-import Mathbin.Data.Nat.Choose.Basic
-import Mathbin.Data.List.Perm
+import Data.Nat.Choose.Basic
+import Data.List.Perm
#align_import data.list.sublists from "leanprover-community/mathlib"@"f2f413b9d4be3a02840d0663dace76e8fe3da053"
mathlib commit https://github.com/leanprover-community/mathlib/commit/32a7e535287f9c73f2e4d2aef306a39190f0b504
@@ -470,11 +470,11 @@ theorem nodup_sublists' {l : List α} : Nodup (sublists' l) ↔ Nodup l := by
#align list.nodup_sublists' List.nodup_sublists'
-/
-alias nodup_sublists ↔ nodup.of_sublists nodup.sublists
+alias ⟨nodup.of_sublists, nodup.sublists⟩ := nodup_sublists
#align list.nodup.of_sublists List.nodup.of_sublists
#align list.nodup.sublists List.nodup.sublists
-alias nodup_sublists' ↔ nodup.of_sublists' nodup.sublists'
+alias ⟨nodup.of_sublists', nodup.sublists'⟩ := nodup_sublists'
#align list.nodup.of_sublists' List.nodup.of_sublists'
#align list.nodup.sublists' List.nodup.sublists'
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,15 +2,12 @@
Copyright (c) 2019 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-
-! This file was ported from Lean 3 source module data.list.sublists
-! leanprover-community/mathlib commit f2f413b9d4be3a02840d0663dace76e8fe3da053
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Data.Nat.Choose.Basic
import Mathbin.Data.List.Perm
+#align_import data.list.sublists from "leanprover-community/mathlib"@"f2f413b9d4be3a02840d0663dace76e8fe3da053"
+
/-! # sublists
> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -186,6 +186,7 @@ theorem sublistsAux_cons_append (l₁ l₂ : List α) :
rw [← bind_ret_eq_map, sublists_aux₁_bind]; exact (append_nil _).symm
#align list.sublists_aux_cons_append List.sublistsAux_cons_append
+#print List.sublists_append /-
theorem sublists_append (l₁ l₂ : List α) :
sublists (l₁ ++ l₂) = do
let x ← sublists l₂
@@ -196,6 +197,7 @@ theorem sublists_append (l₁ l₂ : List α) :
constructor <;>
rfl
#align list.sublists_append List.sublists_append
+-/
#print List.sublists_concat /-
@[simp]
@@ -292,6 +294,7 @@ def sublistsLen {α : Type _} (n : ℕ) (l : List α) : List (List α) :=
#align list.sublists_len List.sublistsLen
-/
+#print List.sublistsLenAux_append /-
theorem sublistsLenAux_append {α β γ : Type _} :
∀ (n : ℕ) (l : List α) (f : List α → β) (g : β → γ) (r : List β) (s : List γ),
sublistsLenAux n l (g ∘ f) (r.map g ++ s) = (sublistsLenAux n l f r).map g ++ s
@@ -302,15 +305,20 @@ theorem sublistsLenAux_append {α β γ : Type _} :
rw [show (g ∘ f) ∘ List.cons a = g ∘ f ∘ List.cons a by rfl, sublists_len_aux_append,
sublists_len_aux_append]
#align list.sublists_len_aux_append List.sublistsLenAux_append
+-/
+#print List.sublistsLenAux_eq /-
theorem sublistsLenAux_eq {α β : Type _} (l : List α) (n) (f : List α → β) (r) :
sublistsLenAux n l f r = (sublistsLen n l).map f ++ r := by
rw [sublists_len, ← sublists_len_aux_append] <;> rfl
#align list.sublists_len_aux_eq List.sublistsLenAux_eq
+-/
+#print List.sublistsLenAux_zero /-
theorem sublistsLenAux_zero {α : Type _} (l : List α) (f : List α → β) (r) :
sublistsLenAux 0 l f r = f [] :: r := by cases l <;> rfl
#align list.sublists_len_aux_zero List.sublistsLenAux_zero
+-/
#print List.sublistsLen_zero /-
@[simp]
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -49,12 +49,12 @@ theorem sublists'_singleton (a : α) : sublists' [a] = [[], [a]] :=
theorem map_sublists'Aux (g : List β → List γ) (l : List α) (f r) :
map g (sublists'Aux l f r) = sublists'Aux l (g ∘ f) (map g r) := by
- induction l generalizing f r <;> [rfl;simp only [*, sublists'_aux]]
+ induction l generalizing f r <;> [rfl; simp only [*, sublists'_aux]]
#align list.map_sublists'_aux List.map_sublists'Aux
theorem sublists'Aux_append (r' : List (List β)) (l : List α) (f r) :
sublists'Aux l f (r ++ r') = sublists'Aux l f r ++ r' := by
- induction l generalizing f r <;> [rfl;simp only [*, sublists'_aux]]
+ induction l generalizing f r <;> [rfl; simp only [*, sublists'_aux]]
#align list.sublists'_aux_append List.sublists'Aux_append
theorem sublists'Aux_eq_sublists' (l f r) : @sublists'Aux α β l f r = map f (sublists' l) ++ r := by
@@ -182,7 +182,7 @@ theorem sublistsAux_cons_append (l₁ l₂ : List α) :
by
simp only [sublists, sublists_aux_cons_eq_sublists_aux₁, sublists_aux₁_append, bind_eq_bind,
sublists_aux₁_bind]
- congr ; funext x; apply congr_arg _
+ congr; funext x; apply congr_arg _
rw [← bind_ret_eq_map, sublists_aux₁_bind]; exact (append_nil _).symm
#align list.sublists_aux_cons_append List.sublistsAux_cons_append
@@ -208,10 +208,9 @@ theorem sublists_concat (l : List α) (a : α) :
#print List.sublists_reverse /-
theorem sublists_reverse (l : List α) : sublists (reverse l) = map reverse (sublists' l) := by
- induction' l with hd tl ih <;>
- [rfl;simp only [reverse_cons, sublists_append, sublists'_cons, map_append, ih,
- sublists_singleton, map_eq_map, bind_eq_bind, map_map, cons_bind, append_nil, nil_bind,
- (· ∘ ·)]]
+ induction' l with hd tl ih <;> [rfl;
+ simp only [reverse_cons, sublists_append, sublists'_cons, map_append, ih, sublists_singleton,
+ map_eq_map, bind_eq_bind, map_map, cons_bind, append_nil, nil_bind, (· ∘ ·)]]
#align list.sublists_reverse List.sublists_reverse
-/
@@ -239,7 +238,7 @@ theorem sublistsAux_ne_nil : ∀ l : List α, [] ∉ sublistsAux l cons
rw [sublists_aux_cons_cons]
refine' not_mem_cons_of_ne_of_not_mem (cons_ne_nil _ _).symm _
have := sublists_aux_ne_nil l; revert this
- induction sublists_aux l cons <;> intro ; · rwa [foldr]
+ induction sublists_aux l cons <;> intro; · rwa [foldr]
simp only [foldr, mem_cons_iff, false_or_iff, not_or]
exact ⟨ne_of_not_mem_cons this, ih (not_mem_of_not_mem_cons this)⟩
#align list.sublists_aux_ne_nil List.sublistsAux_ne_nil
@@ -378,7 +377,7 @@ theorem length_of_sublistsLen {α : Type _} :
| 0, l, l', Or.inl rfl => rfl
| n + 1, a :: l, l', h =>
by
- rw [sublists_len_succ_cons, mem_append, mem_map] at h
+ rw [sublists_len_succ_cons, mem_append, mem_map] at h
rcases h with (h | ⟨l', h, rfl⟩)
· exact length_of_sublists_len h
· exact congr_arg (· + 1) (length_of_sublists_len h)
@@ -447,7 +446,7 @@ theorem Pairwise.sublists' {R} :
#print List.pairwise_sublists /-
theorem pairwise_sublists {R} {l : List α} (H : Pairwise R l) :
Pairwise (fun l₁ l₂ => Lex R (reverse l₁) (reverse l₂)) (sublists l) := by
- have := (pairwise_reverse.2 H).sublists'; rwa [sublists'_reverse, pairwise_map] at this
+ have := (pairwise_reverse.2 H).sublists'; rwa [sublists'_reverse, pairwise_map] at this
#align list.pairwise_sublists List.pairwise_sublists
-/
@@ -507,12 +506,12 @@ theorem revzip_sublists (l : List α) : ∀ l₁ l₂, (l₁, l₂) ∈ revzip l
by
rw [revzip]
apply List.reverseRecOn l
- · intro l₁ l₂ h; simp at h; simp [h]
+ · intro l₁ l₂ h; simp at h ; simp [h]
· intro l a IH l₁ l₂ h
rw [sublists_concat, reverse_append, zip_append, ← map_reverse, zip_map_right, zip_map_left] at
- h <;>
- [skip;· simp]
- simp only [Prod.mk.inj_iff, mem_map, mem_append, Prod.map_mk, Prod.exists] at h
+ h <;>
+ [skip; · simp]
+ simp only [Prod.mk.inj_iff, mem_map, mem_append, Prod.map_mk, Prod.exists] at h
rcases h with (⟨l₁, l₂', h, rfl, rfl⟩ | ⟨l₁', l₂, h, rfl, rfl⟩)
· rw [← append_assoc]
exact (IH _ _ h).append_right _
@@ -528,9 +527,9 @@ theorem revzip_sublists' (l : List α) : ∀ l₁ l₂, (l₁, l₂) ∈ revzip
by
rw [revzip]
induction' l with a l IH <;> intro l₁ l₂ h
- · simp at h; simp [h]
- · rw [sublists'_cons, reverse_append, zip_append, ← map_reverse, zip_map_right, zip_map_left] at
- h <;> [simp at h;simp]
+ · simp at h ; simp [h]
+ · rw [sublists'_cons, reverse_append, zip_append, ← map_reverse, zip_map_right, zip_map_left] at h
+ <;> [simp at h ; simp]
rcases h with (⟨l₁, l₂', h, rfl, rfl⟩ | ⟨l₁', h, rfl⟩)
· exact perm_middle.trans ((IH _ _ h).cons _)
· exact (IH _ _ h).cons _
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -47,25 +47,19 @@ theorem sublists'_singleton (a : α) : sublists' [a] = [[], [a]] :=
#align list.sublists'_singleton List.sublists'_singleton
-/
-/- warning: list.map_sublists'_aux clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align list.map_sublists'_aux [anonymous]ₓ'. -/
-theorem [anonymous] (g : List β → List γ) (l : List α) (f r) :
+theorem map_sublists'Aux (g : List β → List γ) (l : List α) (f r) :
map g (sublists'Aux l f r) = sublists'Aux l (g ∘ f) (map g r) := by
induction l generalizing f r <;> [rfl;simp only [*, sublists'_aux]]
-#align list.map_sublists'_aux [anonymous]
+#align list.map_sublists'_aux List.map_sublists'Aux
-/- warning: list.sublists'_aux_append clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align list.sublists'_aux_append [anonymous]ₓ'. -/
-theorem [anonymous] (r' : List (List β)) (l : List α) (f r) :
+theorem sublists'Aux_append (r' : List (List β)) (l : List α) (f r) :
sublists'Aux l f (r ++ r') = sublists'Aux l f r ++ r' := by
induction l generalizing f r <;> [rfl;simp only [*, sublists'_aux]]
-#align list.sublists'_aux_append [anonymous]
+#align list.sublists'_aux_append List.sublists'Aux_append
-/- warning: list.sublists'_aux_eq_sublists' clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align list.sublists'_aux_eq_sublists' [anonymous]ₓ'. -/
-theorem [anonymous] (l f r) : @sublists'Aux α β l f r = map f (sublists' l) ++ r := by
+theorem sublists'Aux_eq_sublists' (l f r) : @sublists'Aux α β l f r = map f (sublists' l) ++ r := by
rw [sublists', map_sublists'_aux, ← sublists'_aux_append] <;> rfl
-#align list.sublists'_aux_eq_sublists' [anonymous]
+#align list.sublists'_aux_eq_sublists' List.sublists'Aux_eq_sublists'
#print List.sublists'_cons /-
@[simp]
@@ -117,23 +111,18 @@ theorem sublists_singleton (a : α) : sublists [a] = [[], [a]] :=
#align list.sublists_singleton List.sublists_singleton
-/
-/- warning: list.sublists_aux₁_eq_sublists_aux clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align list.sublists_aux₁_eq_sublists_aux [anonymous]ₓ'. -/
-theorem [anonymous] :
+theorem sublistsAux₁_eq_sublistsAux :
∀ (l) (f : List α → List β), sublistsAux₁ l f = sublistsAux l fun ys r => f ys ++ r
| [], f => rfl
| a :: l, f => by rw [sublists_aux₁, sublists_aux] <;> simp only [*, append_assoc]
-#align list.sublists_aux₁_eq_sublists_aux [anonymous]
+#align list.sublists_aux₁_eq_sublists_aux List.sublistsAux₁_eq_sublistsAux
-/- warning: list.sublists_aux_cons_eq_sublists_aux₁ clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align list.sublists_aux_cons_eq_sublists_aux₁ [anonymous]ₓ'. -/
-theorem [anonymous] (l : List α) : sublistsAux l cons = sublistsAux₁ l fun x => [x] := by
+theorem sublistsAux_cons_eq_sublistsAux₁ (l : List α) :
+ sublistsAux l cons = sublistsAux₁ l fun x => [x] := by
rw [sublists_aux₁_eq_sublists_aux] <;> rfl
-#align list.sublists_aux_cons_eq_sublists_aux₁ [anonymous]
+#align list.sublists_aux_cons_eq_sublists_aux₁ List.sublistsAux_cons_eq_sublistsAux₁
-/- warning: list.sublists_aux_eq_foldr.aux clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align list.sublists_aux_eq_foldr.aux [anonymous]ₓ'. -/
-theorem [anonymous] {a : α} {l : List α}
+theorem SublistsAuxEqFoldr.aux {a : α} {l : List α}
(IH₁ : ∀ f : List α → List β → List β, sublistsAux l f = foldr f [] (sublistsAux l cons))
(IH₂ :
∀ f : List α → List (List α) → List (List α),
@@ -144,11 +133,9 @@ theorem [anonymous] {a : α} {l : List α}
simp only [sublists_aux, foldr_cons]; rw [IH₂, IH₁]; congr 1
induction' sublists_aux l cons with _ _ ih; · rfl
simp only [ih, foldr_cons]
-#align list.sublists_aux_eq_foldr.aux [anonymous]
+#align list.sublists_aux_eq_foldr.aux List.SublistsAuxEqFoldr.aux
-/- warning: list.sublists_aux_eq_foldr clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align list.sublists_aux_eq_foldr [anonymous]ₓ'. -/
-theorem [anonymous] (l : List α) :
+theorem sublistsAux_eq_foldr (l : List α) :
∀ f : List α → List β → List β, sublistsAux l f = foldr f [] (sublistsAux l cons) :=
by
suffices
@@ -158,46 +145,36 @@ theorem [anonymous] (l : List α) :
from this.1
induction' l with a l IH; · constructor <;> intro <;> rfl
exact ⟨sublists_aux_eq_foldr.aux IH.1 IH.2, sublists_aux_eq_foldr.aux IH.2 IH.2⟩
-#align list.sublists_aux_eq_foldr [anonymous]
+#align list.sublists_aux_eq_foldr List.sublistsAux_eq_foldr
-/- warning: list.sublists_aux_cons_cons clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align list.sublists_aux_cons_cons [anonymous]ₓ'. -/
-theorem [anonymous] (l : List α) (a : α) :
+theorem sublistsAux_cons_cons (l : List α) (a : α) :
sublistsAux (a :: l) cons =
[a] :: foldr (fun ys r => ys :: (a :: ys) :: r) [] (sublistsAux l cons) :=
by rw [← sublists_aux_eq_foldr] <;> rfl
-#align list.sublists_aux_cons_cons [anonymous]
+#align list.sublists_aux_cons_cons List.sublistsAux_cons_cons
-/- warning: list.sublists_aux₁_append clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align list.sublists_aux₁_append [anonymous]ₓ'. -/
-theorem [anonymous] :
+theorem sublistsAux₁_append :
∀ (l₁ l₂ : List α) (f : List α → List β),
sublistsAux₁ (l₁ ++ l₂) f =
sublistsAux₁ l₁ f ++ sublistsAux₁ l₂ fun x => f x ++ sublistsAux₁ l₁ (f ∘ (· ++ x))
| [], l₂, f => by simp only [sublists_aux₁, nil_append, append_nil]
| a :: l₁, l₂, f => by
simp only [sublists_aux₁, cons_append, sublists_aux₁_append l₁, append_assoc] <;> rfl
-#align list.sublists_aux₁_append [anonymous]
+#align list.sublists_aux₁_append List.sublistsAux₁_append
-/- warning: list.sublists_aux₁_concat clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align list.sublists_aux₁_concat [anonymous]ₓ'. -/
-theorem [anonymous] (l : List α) (a : α) (f : List α → List β) :
+theorem sublistsAux₁_concat (l : List α) (a : α) (f : List α → List β) :
sublistsAux₁ (l ++ [a]) f = sublistsAux₁ l f ++ f [a] ++ sublistsAux₁ l fun x => f (x ++ [a]) :=
by simp only [sublists_aux₁_append, sublists_aux₁, append_assoc, append_nil]
-#align list.sublists_aux₁_concat [anonymous]
+#align list.sublists_aux₁_concat List.sublistsAux₁_concat
-/- warning: list.sublists_aux₁_bind clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align list.sublists_aux₁_bind [anonymous]ₓ'. -/
-theorem [anonymous] :
+theorem sublistsAux₁_bind :
∀ (l : List α) (f : List α → List β) (g : β → List γ),
(sublistsAux₁ l f).bind g = sublistsAux₁ l fun x => (f x).bind g
| [], f, g => rfl
| a :: l, f, g => by simp only [sublists_aux₁, bind_append, sublists_aux₁_bind l]
-#align list.sublists_aux₁_bind [anonymous]
+#align list.sublists_aux₁_bind List.sublistsAux₁_bind
-/- warning: list.sublists_aux_cons_append clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align list.sublists_aux_cons_append [anonymous]ₓ'. -/
-theorem [anonymous] (l₁ l₂ : List α) :
+theorem sublistsAux_cons_append (l₁ l₂ : List α) :
sublistsAux (l₁ ++ l₂) cons =
sublistsAux l₁ cons ++ do
let x ← sublistsAux l₂ cons
@@ -207,7 +184,7 @@ theorem [anonymous] (l₁ l₂ : List α) :
sublists_aux₁_bind]
congr ; funext x; apply congr_arg _
rw [← bind_ret_eq_map, sublists_aux₁_bind]; exact (append_nil _).symm
-#align list.sublists_aux_cons_append [anonymous]
+#align list.sublists_aux_cons_append List.sublistsAux_cons_append
theorem sublists_append (l₁ l₂ : List α) :
sublists (l₁ ++ l₂) = do
@@ -256,9 +233,7 @@ theorem sublists'_eq_sublists (l : List α) : sublists' l = map reverse (sublist
#align list.sublists'_eq_sublists List.sublists'_eq_sublists
-/
-/- warning: list.sublists_aux_ne_nil clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align list.sublists_aux_ne_nil [anonymous]ₓ'. -/
-theorem [anonymous] : ∀ l : List α, [] ∉ sublistsAux l cons
+theorem sublistsAux_ne_nil : ∀ l : List α, [] ∉ sublistsAux l cons
| [] => id
| a :: l => by
rw [sublists_aux_cons_cons]
@@ -267,7 +242,7 @@ theorem [anonymous] : ∀ l : List α, [] ∉ sublistsAux l cons
induction sublists_aux l cons <;> intro ; · rwa [foldr]
simp only [foldr, mem_cons_iff, false_or_iff, not_or]
exact ⟨ne_of_not_mem_cons this, ih (not_mem_of_not_mem_cons this)⟩
-#align list.sublists_aux_ne_nil [anonymous]
+#align list.sublists_aux_ne_nil List.sublistsAux_ne_nil
#print List.mem_sublists /-
@[simp]
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -48,11 +48,6 @@ theorem sublists'_singleton (a : α) : sublists' [a] = [[], [a]] :=
-/
/- warning: list.map_sublists'_aux clashes with [anonymous] -> [anonymous]
-warning: list.map_sublists'_aux -> [anonymous] is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u}} {β : Type.{v}} {γ : Type.{w}} (g : (List.{v} β) -> (List.{w} γ)) (l : List.{u} α) (f : (List.{u} α) -> (List.{v} β)) (r : List.{v} (List.{v} β)), Eq.{succ w} (List.{w} (List.{w} γ)) (List.map.{v, w} (List.{v} β) (List.{w} γ) g (List.sublists'Aux.{u, v} α β l f r)) (List.sublists'Aux.{u, w} α γ l (Function.comp.{succ u, succ v, succ w} (List.{u} α) (List.{v} β) (List.{w} γ) g f) (List.map.{v, w} (List.{v} β) (List.{w} γ) g r))
-but is expected to have type
- forall {α : Type.{u}} {β : Type.{v}}, (Nat -> α -> β) -> Nat -> (List.{u} α) -> (List.{v} β)
Case conversion may be inaccurate. Consider using '#align list.map_sublists'_aux [anonymous]ₓ'. -/
theorem [anonymous] (g : List β → List γ) (l : List α) (f r) :
map g (sublists'Aux l f r) = sublists'Aux l (g ∘ f) (map g r) := by
@@ -60,11 +55,6 @@ theorem [anonymous] (g : List β → List γ) (l : List α) (f r) :
#align list.map_sublists'_aux [anonymous]
/- warning: list.sublists'_aux_append clashes with [anonymous] -> [anonymous]
-warning: list.sublists'_aux_append -> [anonymous] is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (r' : List.{u2} (List.{u2} β)) (l : List.{u1} α) (f : (List.{u1} α) -> (List.{u2} β)) (r : List.{u2} (List.{u2} β)), Eq.{succ u2} (List.{u2} (List.{u2} β)) (List.sublists'Aux.{u1, u2} α β l f (Append.append.{u2} (List.{u2} (List.{u2} β)) (List.hasAppend.{u2} (List.{u2} β)) r r')) (Append.append.{u2} (List.{u2} (List.{u2} β)) (List.hasAppend.{u2} (List.{u2} β)) (List.sublists'Aux.{u1, u2} α β l f r) r')
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}}, (Nat -> α -> β) -> Nat -> (List.{u1} α) -> (List.{u2} β)
Case conversion may be inaccurate. Consider using '#align list.sublists'_aux_append [anonymous]ₓ'. -/
theorem [anonymous] (r' : List (List β)) (l : List α) (f r) :
sublists'Aux l f (r ++ r') = sublists'Aux l f r ++ r' := by
@@ -72,11 +62,6 @@ theorem [anonymous] (r' : List (List β)) (l : List α) (f r) :
#align list.sublists'_aux_append [anonymous]
/- warning: list.sublists'_aux_eq_sublists' clashes with [anonymous] -> [anonymous]
-warning: list.sublists'_aux_eq_sublists' -> [anonymous] is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (l : List.{u1} α) (f : (List.{u1} α) -> (List.{u2} β)) (r : List.{u2} (List.{u2} β)), Eq.{succ u2} (List.{u2} (List.{u2} β)) (List.sublists'Aux.{u1, u2} α β l f r) (Append.append.{u2} (List.{u2} (List.{u2} β)) (List.hasAppend.{u2} (List.{u2} β)) (List.map.{u1, u2} (List.{u1} α) (List.{u2} β) f (List.sublists'.{u1} α l)) r)
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}}, (Nat -> α -> β) -> Nat -> (List.{u1} α) -> (List.{u2} β)
Case conversion may be inaccurate. Consider using '#align list.sublists'_aux_eq_sublists' [anonymous]ₓ'. -/
theorem [anonymous] (l f r) : @sublists'Aux α β l f r = map f (sublists' l) ++ r := by
rw [sublists', map_sublists'_aux, ← sublists'_aux_append] <;> rfl
@@ -133,11 +118,6 @@ theorem sublists_singleton (a : α) : sublists [a] = [[], [a]] :=
-/
/- warning: list.sublists_aux₁_eq_sublists_aux clashes with [anonymous] -> [anonymous]
-warning: list.sublists_aux₁_eq_sublists_aux -> [anonymous] is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (l : List.{u1} α) (f : (List.{u1} α) -> (List.{u2} β)), Eq.{succ u2} (List.{u2} β) (List.sublistsAux₁.{u1, u2} α β l f) (List.sublistsAux.{u1, u2} α β l (fun (ys : List.{u1} α) (r : List.{u2} β) => Append.append.{u2} (List.{u2} β) (List.hasAppend.{u2} β) (f ys) r))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}}, (Nat -> α -> β) -> Nat -> (List.{u1} α) -> (List.{u2} β)
Case conversion may be inaccurate. Consider using '#align list.sublists_aux₁_eq_sublists_aux [anonymous]ₓ'. -/
theorem [anonymous] :
∀ (l) (f : List α → List β), sublistsAux₁ l f = sublistsAux l fun ys r => f ys ++ r
@@ -146,22 +126,12 @@ theorem [anonymous] :
#align list.sublists_aux₁_eq_sublists_aux [anonymous]
/- warning: list.sublists_aux_cons_eq_sublists_aux₁ clashes with [anonymous] -> [anonymous]
-warning: list.sublists_aux_cons_eq_sublists_aux₁ -> [anonymous] is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u}} (l : List.{u} α), Eq.{succ u} (List.{u} (List.{u} α)) (List.sublistsAux.{u, u} α (List.{u} α) l (List.cons.{u} (List.{u} α))) (List.sublistsAux₁.{u, u} α (List.{u} α) l (fun (x : List.{u} α) => List.cons.{u} (List.{u} α) x (List.nil.{u} (List.{u} α))))
-but is expected to have type
- forall {α : Type.{u}} {l : Type.{v}}, (Nat -> α -> l) -> Nat -> (List.{u} α) -> (List.{v} l)
Case conversion may be inaccurate. Consider using '#align list.sublists_aux_cons_eq_sublists_aux₁ [anonymous]ₓ'. -/
theorem [anonymous] (l : List α) : sublistsAux l cons = sublistsAux₁ l fun x => [x] := by
rw [sublists_aux₁_eq_sublists_aux] <;> rfl
#align list.sublists_aux_cons_eq_sublists_aux₁ [anonymous]
/- warning: list.sublists_aux_eq_foldr.aux clashes with [anonymous] -> [anonymous]
-warning: list.sublists_aux_eq_foldr.aux -> [anonymous] is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {a : α} {l : List.{u1} α}, (forall (f : (List.{u1} α) -> (List.{u2} β) -> (List.{u2} β)), Eq.{succ u2} (List.{u2} β) (List.sublistsAux.{u1, u2} α β l f) (List.foldr.{u1, u2} (List.{u1} α) (List.{u2} β) f (List.nil.{u2} β) (List.sublistsAux.{u1, u1} α (List.{u1} α) l (List.cons.{u1} (List.{u1} α))))) -> (forall (f : (List.{u1} α) -> (List.{u1} (List.{u1} α)) -> (List.{u1} (List.{u1} α))), Eq.{succ u1} (List.{u1} (List.{u1} α)) (List.sublistsAux.{u1, u1} α (List.{u1} α) l f) (List.foldr.{u1, u1} (List.{u1} α) (List.{u1} (List.{u1} α)) f (List.nil.{u1} (List.{u1} α)) (List.sublistsAux.{u1, u1} α (List.{u1} α) l (List.cons.{u1} (List.{u1} α))))) -> (forall (f : (List.{u1} α) -> (List.{u2} β) -> (List.{u2} β)), Eq.{succ u2} (List.{u2} β) (List.sublistsAux.{u1, u2} α β (List.cons.{u1} α a l) f) (List.foldr.{u1, u2} (List.{u1} α) (List.{u2} β) f (List.nil.{u2} β) (List.sublistsAux.{u1, u1} α (List.{u1} α) (List.cons.{u1} α a l) (List.cons.{u1} (List.{u1} α)))))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}}, (Nat -> α -> β) -> Nat -> (List.{u1} α) -> (List.{u2} β)
Case conversion may be inaccurate. Consider using '#align list.sublists_aux_eq_foldr.aux [anonymous]ₓ'. -/
theorem [anonymous] {a : α} {l : List α}
(IH₁ : ∀ f : List α → List β → List β, sublistsAux l f = foldr f [] (sublistsAux l cons))
@@ -177,11 +147,6 @@ theorem [anonymous] {a : α} {l : List α}
#align list.sublists_aux_eq_foldr.aux [anonymous]
/- warning: list.sublists_aux_eq_foldr clashes with [anonymous] -> [anonymous]
-warning: list.sublists_aux_eq_foldr -> [anonymous] is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (l : List.{u1} α) (f : (List.{u1} α) -> (List.{u2} β) -> (List.{u2} β)), Eq.{succ u2} (List.{u2} β) (List.sublistsAux.{u1, u2} α β l f) (List.foldr.{u1, u2} (List.{u1} α) (List.{u2} β) f (List.nil.{u2} β) (List.sublistsAux.{u1, u1} α (List.{u1} α) l (List.cons.{u1} (List.{u1} α))))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}}, (Nat -> α -> β) -> Nat -> (List.{u1} α) -> (List.{u2} β)
Case conversion may be inaccurate. Consider using '#align list.sublists_aux_eq_foldr [anonymous]ₓ'. -/
theorem [anonymous] (l : List α) :
∀ f : List α → List β → List β, sublistsAux l f = foldr f [] (sublistsAux l cons) :=
@@ -196,11 +161,6 @@ theorem [anonymous] (l : List α) :
#align list.sublists_aux_eq_foldr [anonymous]
/- warning: list.sublists_aux_cons_cons clashes with [anonymous] -> [anonymous]
-warning: list.sublists_aux_cons_cons -> [anonymous] is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u}} (l : List.{u} α) (a : α), Eq.{succ u} (List.{u} (List.{u} α)) (List.sublistsAux.{u, u} α (List.{u} α) (List.cons.{u} α a l) (List.cons.{u} (List.{u} α))) (List.cons.{u} (List.{u} α) (List.cons.{u} α a (List.nil.{u} α)) (List.foldr.{u, u} (List.{u} α) (List.{u} (List.{u} α)) (fun (ys : List.{u} α) (r : List.{u} (List.{u} α)) => List.cons.{u} (List.{u} α) ys (List.cons.{u} (List.{u} α) (List.cons.{u} α a ys) r)) (List.nil.{u} (List.{u} α)) (List.sublistsAux.{u, u} α (List.{u} α) l (List.cons.{u} (List.{u} α)))))
-but is expected to have type
- forall {α : Type.{u}} {l : Type.{v}}, (Nat -> α -> l) -> Nat -> (List.{u} α) -> (List.{v} l)
Case conversion may be inaccurate. Consider using '#align list.sublists_aux_cons_cons [anonymous]ₓ'. -/
theorem [anonymous] (l : List α) (a : α) :
sublistsAux (a :: l) cons =
@@ -209,11 +169,6 @@ theorem [anonymous] (l : List α) (a : α) :
#align list.sublists_aux_cons_cons [anonymous]
/- warning: list.sublists_aux₁_append clashes with [anonymous] -> [anonymous]
-warning: list.sublists_aux₁_append -> [anonymous] is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (l₁ : List.{u1} α) (l₂ : List.{u1} α) (f : (List.{u1} α) -> (List.{u2} β)), Eq.{succ u2} (List.{u2} β) (List.sublistsAux₁.{u1, u2} α β (Append.append.{u1} (List.{u1} α) (List.hasAppend.{u1} α) l₁ l₂) f) (Append.append.{u2} (List.{u2} β) (List.hasAppend.{u2} β) (List.sublistsAux₁.{u1, u2} α β l₁ f) (List.sublistsAux₁.{u1, u2} α β l₂ (fun (x : List.{u1} α) => Append.append.{u2} (List.{u2} β) (List.hasAppend.{u2} β) (f x) (List.sublistsAux₁.{u1, u2} α β l₁ (Function.comp.{succ u1, succ u1, succ u2} (List.{u1} α) (List.{u1} α) (List.{u2} β) f (fun (_x : List.{u1} α) => Append.append.{u1} (List.{u1} α) (List.hasAppend.{u1} α) _x x))))))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}}, (Nat -> α -> β) -> Nat -> (List.{u1} α) -> (List.{u2} β)
Case conversion may be inaccurate. Consider using '#align list.sublists_aux₁_append [anonymous]ₓ'. -/
theorem [anonymous] :
∀ (l₁ l₂ : List α) (f : List α → List β),
@@ -225,11 +180,6 @@ theorem [anonymous] :
#align list.sublists_aux₁_append [anonymous]
/- warning: list.sublists_aux₁_concat clashes with [anonymous] -> [anonymous]
-warning: list.sublists_aux₁_concat -> [anonymous] is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (l : List.{u1} α) (a : α) (f : (List.{u1} α) -> (List.{u2} β)), Eq.{succ u2} (List.{u2} β) (List.sublistsAux₁.{u1, u2} α β (Append.append.{u1} (List.{u1} α) (List.hasAppend.{u1} α) l (List.cons.{u1} α a (List.nil.{u1} α))) f) (Append.append.{u2} (List.{u2} β) (List.hasAppend.{u2} β) (Append.append.{u2} (List.{u2} β) (List.hasAppend.{u2} β) (List.sublistsAux₁.{u1, u2} α β l f) (f (List.cons.{u1} α a (List.nil.{u1} α)))) (List.sublistsAux₁.{u1, u2} α β l (fun (x : List.{u1} α) => f (Append.append.{u1} (List.{u1} α) (List.hasAppend.{u1} α) x (List.cons.{u1} α a (List.nil.{u1} α))))))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}}, (Nat -> α -> β) -> Nat -> (List.{u1} α) -> (List.{u2} β)
Case conversion may be inaccurate. Consider using '#align list.sublists_aux₁_concat [anonymous]ₓ'. -/
theorem [anonymous] (l : List α) (a : α) (f : List α → List β) :
sublistsAux₁ (l ++ [a]) f = sublistsAux₁ l f ++ f [a] ++ sublistsAux₁ l fun x => f (x ++ [a]) :=
@@ -237,11 +187,6 @@ theorem [anonymous] (l : List α) (a : α) (f : List α → List β) :
#align list.sublists_aux₁_concat [anonymous]
/- warning: list.sublists_aux₁_bind clashes with [anonymous] -> [anonymous]
-warning: list.sublists_aux₁_bind -> [anonymous] is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u}} {β : Type.{v}} {γ : Type.{w}} (l : List.{u} α) (f : (List.{u} α) -> (List.{v} β)) (g : β -> (List.{w} γ)), Eq.{succ w} (List.{w} γ) (List.bind.{v, w} β γ (List.sublistsAux₁.{u, v} α β l f) g) (List.sublistsAux₁.{u, w} α γ l (fun (x : List.{u} α) => List.bind.{v, w} β γ (f x) g))
-but is expected to have type
- forall {α : Type.{u}} {β : Type.{v}}, (Nat -> α -> β) -> Nat -> (List.{u} α) -> (List.{v} β)
Case conversion may be inaccurate. Consider using '#align list.sublists_aux₁_bind [anonymous]ₓ'. -/
theorem [anonymous] :
∀ (l : List α) (f : List α → List β) (g : β → List γ),
@@ -251,11 +196,6 @@ theorem [anonymous] :
#align list.sublists_aux₁_bind [anonymous]
/- warning: list.sublists_aux_cons_append clashes with [anonymous] -> [anonymous]
-warning: list.sublists_aux_cons_append -> [anonymous] is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u}} (l₁ : List.{u} α) (l₂ : List.{u} α), Eq.{succ u} (List.{u} (List.{u} α)) (List.sublistsAux.{u, u} α (List.{u} α) (Append.append.{u} (List.{u} α) (List.hasAppend.{u} α) l₁ l₂) (List.cons.{u} (List.{u} α))) (Append.append.{u} (List.{u} (List.{u} α)) (List.hasAppend.{u} (List.{u} α)) (List.sublistsAux.{u, u} α (List.{u} α) l₁ (List.cons.{u} (List.{u} α))) (Bind.bind.{u, u} List.{u} (Monad.toHasBind.{u, u} List.{u} List.monad.{u}) (List.{u} α) (List.{u} α) (List.sublistsAux.{u, u} α (List.{u} α) l₂ (List.cons.{u} (List.{u} α))) (fun (x : List.{u} α) => Functor.map.{u, u} List.{u} (Traversable.toFunctor.{u} List.{u} List.traversable.{u}) (List.{u} α) (List.{u} α) (fun (_x : List.{u} α) => Append.append.{u} (List.{u} α) (List.hasAppend.{u} α) _x x) (List.sublists.{u} α l₁))))
-but is expected to have type
- forall {α : Type.{u}} {l₁ : Type.{v}}, (Nat -> α -> l₁) -> Nat -> (List.{u} α) -> (List.{v} l₁)
Case conversion may be inaccurate. Consider using '#align list.sublists_aux_cons_append [anonymous]ₓ'. -/
theorem [anonymous] (l₁ l₂ : List α) :
sublistsAux (l₁ ++ l₂) cons =
@@ -269,12 +209,6 @@ theorem [anonymous] (l₁ l₂ : List α) :
rw [← bind_ret_eq_map, sublists_aux₁_bind]; exact (append_nil _).symm
#align list.sublists_aux_cons_append [anonymous]
-/- warning: list.sublists_append -> List.sublists_append is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} (l₁ : List.{u1} α) (l₂ : List.{u1} α), Eq.{succ u1} (List.{u1} (List.{u1} α)) (List.sublists.{u1} α (Append.append.{u1} (List.{u1} α) (List.hasAppend.{u1} α) l₁ l₂)) (Bind.bind.{u1, u1} List.{u1} (Monad.toHasBind.{u1, u1} List.{u1} List.monad.{u1}) (List.{u1} α) (List.{u1} α) (List.sublists.{u1} α l₂) (fun (x : List.{u1} α) => Functor.map.{u1, u1} List.{u1} (Traversable.toFunctor.{u1} List.{u1} List.traversable.{u1}) (List.{u1} α) (List.{u1} α) (fun (_x : List.{u1} α) => Append.append.{u1} (List.{u1} α) (List.hasAppend.{u1} α) _x x) (List.sublists.{u1} α l₁)))
-but is expected to have type
- forall {α : Type.{u1}} (l₁ : List.{u1} α) (l₂ : List.{u1} α), Eq.{succ u1} (List.{u1} (List.{u1} α)) (List.sublists.{u1} α (HAppend.hAppend.{u1, u1, u1} (List.{u1} α) (List.{u1} α) (List.{u1} α) (instHAppend.{u1} (List.{u1} α) (List.instAppendList.{u1} α)) l₁ l₂)) (Bind.bind.{u1, u1} List.{u1} (Monad.toBind.{u1, u1} List.{u1} List.instMonadList.{u1}) (List.{u1} α) (List.{u1} α) (List.sublists.{u1} α l₂) (fun (x : List.{u1} α) => List.map.{u1, u1} (List.{u1} α) (List.{u1} α) (fun (_x : List.{u1} α) => HAppend.hAppend.{u1, u1, u1} (List.{u1} α) (List.{u1} α) (List.{u1} α) (instHAppend.{u1} (List.{u1} α) (List.instAppendList.{u1} α)) _x x) (List.sublists.{u1} α l₁)))
-Case conversion may be inaccurate. Consider using '#align list.sublists_append List.sublists_appendₓ'. -/
theorem sublists_append (l₁ l₂ : List α) :
sublists (l₁ ++ l₂) = do
let x ← sublists l₂
@@ -323,11 +257,6 @@ theorem sublists'_eq_sublists (l : List α) : sublists' l = map reverse (sublist
-/
/- warning: list.sublists_aux_ne_nil clashes with [anonymous] -> [anonymous]
-warning: list.sublists_aux_ne_nil -> [anonymous] is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u}} (l : List.{u} α), Not (Membership.Mem.{u, u} (List.{u} α) (List.{u} (List.{u} α)) (List.hasMem.{u} (List.{u} α)) (List.nil.{u} α) (List.sublistsAux.{u, u} α (List.{u} α) l (List.cons.{u} (List.{u} α))))
-but is expected to have type
- forall {α : Type.{u}} {l : Type.{v}}, (Nat -> α -> l) -> Nat -> (List.{u} α) -> (List.{v} l)
Case conversion may be inaccurate. Consider using '#align list.sublists_aux_ne_nil [anonymous]ₓ'. -/
theorem [anonymous] : ∀ l : List α, [] ∉ sublistsAux l cons
| [] => id
@@ -389,12 +318,6 @@ def sublistsLen {α : Type _} (n : ℕ) (l : List α) : List (List α) :=
#align list.sublists_len List.sublistsLen
-/
-/- warning: list.sublists_len_aux_append -> List.sublistsLenAux_append is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} (n : Nat) (l : List.{u1} α) (f : (List.{u1} α) -> β) (g : β -> γ) (r : List.{u2} β) (s : List.{u3} γ), Eq.{succ u3} (List.{u3} γ) (List.sublistsLenAux.{u1, u3} α γ n l (Function.comp.{succ u1, succ u2, succ u3} (List.{u1} α) β γ g f) (Append.append.{u3} (List.{u3} γ) (List.hasAppend.{u3} γ) (List.map.{u2, u3} β γ g r) s)) (Append.append.{u3} (List.{u3} γ) (List.hasAppend.{u3} γ) (List.map.{u2, u3} β γ g (List.sublistsLenAux.{u1, u2} α β n l f r)) s)
-but is expected to have type
- forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} (n : Nat) (l : List.{u3} α) (f : (List.{u3} α) -> β) (g : β -> γ) (r : List.{u2} β) (s : List.{u1} γ), Eq.{succ u1} (List.{u1} γ) (List.sublistsLenAux.{u3, u1} α γ n l (Function.comp.{succ u3, succ u2, succ u1} (List.{u3} α) β γ g f) (HAppend.hAppend.{u1, u1, u1} (List.{u1} γ) (List.{u1} γ) (List.{u1} γ) (instHAppend.{u1} (List.{u1} γ) (List.instAppendList.{u1} γ)) (List.map.{u2, u1} β γ g r) s)) (HAppend.hAppend.{u1, u1, u1} (List.{u1} γ) (List.{u1} γ) (List.{u1} γ) (instHAppend.{u1} (List.{u1} γ) (List.instAppendList.{u1} γ)) (List.map.{u2, u1} β γ g (List.sublistsLenAux.{u3, u2} α β n l f r)) s)
-Case conversion may be inaccurate. Consider using '#align list.sublists_len_aux_append List.sublistsLenAux_appendₓ'. -/
theorem sublistsLenAux_append {α β γ : Type _} :
∀ (n : ℕ) (l : List α) (f : List α → β) (g : β → γ) (r : List β) (s : List γ),
sublistsLenAux n l (g ∘ f) (r.map g ++ s) = (sublistsLenAux n l f r).map g ++ s
@@ -406,23 +329,11 @@ theorem sublistsLenAux_append {α β γ : Type _} :
sublists_len_aux_append]
#align list.sublists_len_aux_append List.sublistsLenAux_append
-/- warning: list.sublists_len_aux_eq -> List.sublistsLenAux_eq is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (l : List.{u1} α) (n : Nat) (f : (List.{u1} α) -> β) (r : List.{u2} β), Eq.{succ u2} (List.{u2} β) (List.sublistsLenAux.{u1, u2} α β n l f r) (Append.append.{u2} (List.{u2} β) (List.hasAppend.{u2} β) (List.map.{u1, u2} (List.{u1} α) β f (List.sublistsLen.{u1} α n l)) r)
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} (l : List.{u2} α) (n : Nat) (f : (List.{u2} α) -> β) (r : List.{u1} β), Eq.{succ u1} (List.{u1} β) (List.sublistsLenAux.{u2, u1} α β n l f r) (HAppend.hAppend.{u1, u1, u1} (List.{u1} β) (List.{u1} β) (List.{u1} β) (instHAppend.{u1} (List.{u1} β) (List.instAppendList.{u1} β)) (List.map.{u2, u1} (List.{u2} α) β f (List.sublistsLen.{u2} α n l)) r)
-Case conversion may be inaccurate. Consider using '#align list.sublists_len_aux_eq List.sublistsLenAux_eqₓ'. -/
theorem sublistsLenAux_eq {α β : Type _} (l : List α) (n) (f : List α → β) (r) :
sublistsLenAux n l f r = (sublistsLen n l).map f ++ r := by
rw [sublists_len, ← sublists_len_aux_append] <;> rfl
#align list.sublists_len_aux_eq List.sublistsLenAux_eq
-/- warning: list.sublists_len_aux_zero -> List.sublistsLenAux_zero is a dubious translation:
-lean 3 declaration is
- forall {β : Type.{u1}} {α : Type.{u2}} (l : List.{u2} α) (f : (List.{u2} α) -> β) (r : List.{u1} β), Eq.{succ u1} (List.{u1} β) (List.sublistsLenAux.{u2, u1} α β (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))) l f r) (List.cons.{u1} β (f (List.nil.{u2} α)) r)
-but is expected to have type
- forall {β : Type.{u2}} {α : Type.{u1}} (l : List.{u1} α) (f : (List.{u1} α) -> β) (r : List.{u2} β), Eq.{succ u2} (List.{u2} β) (List.sublistsLenAux.{u1, u2} α β (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) l f r) (List.cons.{u2} β (f (List.nil.{u1} α)) r)
-Case conversion may be inaccurate. Consider using '#align list.sublists_len_aux_zero List.sublistsLenAux_zeroₓ'. -/
theorem sublistsLenAux_zero {α : Type _} (l : List α) (f : List α → β) (r) :
sublistsLenAux 0 l f r = f [] :: r := by cases l <;> rfl
#align list.sublists_len_aux_zero List.sublistsLenAux_zero
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -560,10 +560,8 @@ theorem Pairwise.sublists' {R} :
#print List.pairwise_sublists /-
theorem pairwise_sublists {R} {l : List α} (H : Pairwise R l) :
- Pairwise (fun l₁ l₂ => Lex R (reverse l₁) (reverse l₂)) (sublists l) :=
- by
- have := (pairwise_reverse.2 H).sublists'
- rwa [sublists'_reverse, pairwise_map] at this
+ Pairwise (fun l₁ l₂ => Lex R (reverse l₁) (reverse l₂)) (sublists l) := by
+ have := (pairwise_reverse.2 H).sublists'; rwa [sublists'_reverse, pairwise_map] at this
#align list.pairwise_sublists List.pairwise_sublists
-/
@@ -623,9 +621,7 @@ theorem revzip_sublists (l : List α) : ∀ l₁ l₂, (l₁, l₂) ∈ revzip l
by
rw [revzip]
apply List.reverseRecOn l
- · intro l₁ l₂ h
- simp at h
- simp [h]
+ · intro l₁ l₂ h; simp at h; simp [h]
· intro l a IH l₁ l₂ h
rw [sublists_concat, reverse_append, zip_append, ← map_reverse, zip_map_right, zip_map_left] at
h <;>
@@ -646,8 +642,7 @@ theorem revzip_sublists' (l : List α) : ∀ l₁ l₂, (l₁, l₂) ∈ revzip
by
rw [revzip]
induction' l with a l IH <;> intro l₁ l₂ h
- · simp at h
- simp [h]
+ · simp at h; simp [h]
· rw [sublists'_cons, reverse_append, zip_append, ← map_reverse, zip_map_right, zip_map_left] at
h <;> [simp at h;simp]
rcases h with (⟨l₁, l₂', h, rfl, rfl⟩ | ⟨l₁', h, rfl⟩)
mathlib commit https://github.com/leanprover-community/mathlib/commit/8d33f09cd7089ecf074b4791907588245aec5d1b
@@ -56,7 +56,7 @@ but is expected to have type
Case conversion may be inaccurate. Consider using '#align list.map_sublists'_aux [anonymous]ₓ'. -/
theorem [anonymous] (g : List β → List γ) (l : List α) (f r) :
map g (sublists'Aux l f r) = sublists'Aux l (g ∘ f) (map g r) := by
- induction l generalizing f r <;> [rfl, simp only [*, sublists'_aux]]
+ induction l generalizing f r <;> [rfl;simp only [*, sublists'_aux]]
#align list.map_sublists'_aux [anonymous]
/- warning: list.sublists'_aux_append clashes with [anonymous] -> [anonymous]
@@ -68,7 +68,7 @@ but is expected to have type
Case conversion may be inaccurate. Consider using '#align list.sublists'_aux_append [anonymous]ₓ'. -/
theorem [anonymous] (r' : List (List β)) (l : List α) (f r) :
sublists'Aux l f (r ++ r') = sublists'Aux l f r ++ r' := by
- induction l generalizing f r <;> [rfl, simp only [*, sublists'_aux]]
+ induction l generalizing f r <;> [rfl;simp only [*, sublists'_aux]]
#align list.sublists'_aux_append [anonymous]
/- warning: list.sublists'_aux_eq_sublists' clashes with [anonymous] -> [anonymous]
@@ -297,9 +297,10 @@ theorem sublists_concat (l : List α) (a : α) :
#print List.sublists_reverse /-
theorem sublists_reverse (l : List α) : sublists (reverse l) = map reverse (sublists' l) := by
- induction' l with hd tl ih <;> [rfl,
- simp only [reverse_cons, sublists_append, sublists'_cons, map_append, ih, sublists_singleton,
- map_eq_map, bind_eq_bind, map_map, cons_bind, append_nil, nil_bind, (· ∘ ·)]]
+ induction' l with hd tl ih <;>
+ [rfl;simp only [reverse_cons, sublists_append, sublists'_cons, map_append, ih,
+ sublists_singleton, map_eq_map, bind_eq_bind, map_map, cons_bind, append_nil, nil_bind,
+ (· ∘ ·)]]
#align list.sublists_reverse List.sublists_reverse
-/
@@ -628,7 +629,7 @@ theorem revzip_sublists (l : List α) : ∀ l₁ l₂, (l₁, l₂) ∈ revzip l
· intro l a IH l₁ l₂ h
rw [sublists_concat, reverse_append, zip_append, ← map_reverse, zip_map_right, zip_map_left] at
h <;>
- [skip, · simp]
+ [skip;· simp]
simp only [Prod.mk.inj_iff, mem_map, mem_append, Prod.map_mk, Prod.exists] at h
rcases h with (⟨l₁, l₂', h, rfl, rfl⟩ | ⟨l₁', l₂, h, rfl, rfl⟩)
· rw [← append_assoc]
@@ -648,7 +649,7 @@ theorem revzip_sublists' (l : List α) : ∀ l₁ l₂, (l₁, l₂) ∈ revzip
· simp at h
simp [h]
· rw [sublists'_cons, reverse_append, zip_append, ← map_reverse, zip_map_right, zip_map_left] at
- h <;> [simp at h, simp]
+ h <;> [simp at h;simp]
rcases h with (⟨l₁, l₂', h, rfl, rfl⟩ | ⟨l₁', h, rfl⟩)
· exact perm_middle.trans ((IH _ _ h).cons _)
· exact (IH _ _ h).cons _
mathlib commit https://github.com/leanprover-community/mathlib/commit/3180fab693e2cee3bff62675571264cb8778b212
@@ -114,7 +114,7 @@ theorem length_sublists' : ∀ l : List α, length (sublists' l) = 2 ^ length l
| [] => rfl
| a :: l => by
simp only [sublists'_cons, length_append, length_sublists' l, length_map, length, pow_succ',
- mul_succ, mul_zero, zero_add]
+ mul_succ, MulZeroClass.mul_zero, zero_add]
#align list.length_sublists' List.length_sublists'
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
@@ -84,9 +84,10 @@ theorem mem_sublists' {s t : List α} : s ∈ sublists' t ↔ s <+ t := by
· simp only [sublists'_nil, mem_singleton]
exact ⟨fun h => by rw [h], eq_nil_of_sublist_nil⟩
simp only [sublists'_cons, mem_append, IH, mem_map]
- constructor <;> intro h; rcases h with (h | ⟨s, h, rfl⟩)
- · exact sublist_cons_of_sublist _ h
- · exact h.cons_cons _
+ constructor <;> intro h
+ · rcases h with (h | ⟨s, h, rfl⟩)
+ · exact sublist_cons_of_sublist _ h
+ · exact h.cons_cons _
· cases' h with _ _ _ h s _ _ h
· exact Or.inl h
· exact Or.inr ⟨s, h, rfl⟩
@@ -443,8 +443,8 @@ theorem revzip_sublists (l : List α) : ∀ l₁ l₂, (l₁, l₂) ∈ revzip l
mem_singleton, Prod.mk.injEq] at h
simp [h]
· intro l₁ l₂ h
- rw [sublists_concat, reverse_append, zip_append, ← map_reverse, zip_map_right,
- zip_map_left] at * <;> [skip; simp]
+ rw [sublists_concat, reverse_append, zip_append (by simp), ← map_reverse, zip_map_right,
+ zip_map_left] at *
simp only [Prod.mk.inj_iff, mem_map, mem_append, Prod.map_mk, Prod.exists] at h
rcases h with (⟨l₁, l₂', h, rfl, rfl⟩ | ⟨l₁', l₂, h, rfl, rfl⟩)
· rw [← append_assoc]
Remove dependencies on algebra in the Data.List
folder except for:
Data.List.EditDistance
: Actually relies on algebra. Maybe should be moved?Data.List.Card
: Completely unused and redundant.Data.List.Cycle
: Relies on Fintype
, which shouldn't rely on algebra but it's hard to fix right now. Maybe should be moved?Data.List.Func
: Completely unused and redundant.Data.List.Lex
: That's order theory. Could be moved.Data.List.Prime
. That's algebra. Should definitely be moved.Data.List.Sym
: Relies on Multiset
, which shouldn't rely on algebra but it's hard to fix right now. Maybe should be moved?Data.List.ToFinsupp
: That's algebra. Should definitely be moved.As a consequence, move the big operators lemmas that were in there to Algebra.BigOperators.List.Basic
. For the lemmas that were Nat
-specific and not about auxiliary definitions, keep a version of them in the original file but stated using Nat.sum
.
Before
After
@@ -97,7 +97,7 @@ theorem length_sublists' : ∀ l : List α, length (sublists' l) = 2 ^ length l
| [] => rfl
| a :: l => by
simp_arith only [sublists'_cons, length_append, length_sublists' l,
- length_map, length, Nat.pow_succ', mul_succ, mul_zero, zero_add, npow_eq_pow, pow_eq]
+ length_map, length, Nat.pow_succ']
#align list.length_sublists' List.length_sublists'
@[simp]
@@ -289,7 +289,7 @@ theorem length_sublistsLen {α : Type*} :
| _ + 1, [] => by simp
| n + 1, a :: l => by
rw [sublistsLen_succ_cons, length_append, length_sublistsLen (n+1) l,
- length_map, length_sublistsLen n l, length_cons, Nat.choose_succ_succ, add_comm]
+ length_map, length_sublistsLen n l, length_cons, Nat.choose_succ_succ, Nat.add_comm]
#align list.length_sublists_len List.length_sublistsLen
theorem sublistsLen_sublist_sublists' {α : Type*} :
@@ -210,17 +210,20 @@ theorem length_sublists (l : List α) : length (sublists l) = 2 ^ length l := by
simp only [sublists_eq_sublists', length_map, length_sublists', length_reverse]
#align list.length_sublists List.length_sublists
-theorem map_ret_sublist_sublists (l : List α) : map List.ret l <+ sublists l := by
- induction' l using reverseRecOn with l a ih <;>
- simp only [map, map_append, sublists_concat]
+theorem map_pure_sublist_sublists (l : List α) : map pure l <+ sublists l := by
+ induction' l using reverseRecOn with l a ih <;> simp only [map, map_append, sublists_concat]
· simp only [sublists_nil, sublist_cons]
exact ((append_sublist_append_left _).2 <|
singleton_sublist.2 <| mem_map.2 ⟨[], mem_sublists.2 (nil_sublist _), by rfl⟩).trans
((append_sublist_append_right _).2 ih)
-#align list.map_ret_sublist_sublists List.map_ret_sublist_sublists
+#align list.map_ret_sublist_sublists List.map_pure_sublist_sublists
-/-! ### sublistsLen -/
+set_option linter.deprecated false in
+@[deprecated map_pure_sublist_sublists] -- 2024-03-24
+theorem map_ret_sublist_sublists (l : List α) : map List.ret l <+ sublists l :=
+ map_pure_sublist_sublists l
+/-! ### sublistsLen -/
/-- Auxiliary function to construct the list of all sublists of a given length. Given an
integer `n`, a list `l`, a function `f` and an auxiliary list `L`, it returns the list made of
@@ -373,7 +376,7 @@ theorem pairwise_sublists {R} {l : List α} (H : Pairwise R l) :
@[simp]
theorem nodup_sublists {l : List α} : Nodup (sublists l) ↔ Nodup l :=
- ⟨fun h => (h.sublist (map_ret_sublist_sublists _)).of_map _, fun h =>
+ ⟨fun h => (h.sublist (map_pure_sublist_sublists _)).of_map _, fun h =>
(pairwise_sublists h).imp @fun l₁ l₂ h => by simpa using h.to_ne⟩
#align list.nodup_sublists List.nodup_sublists
@@ -165,7 +165,7 @@ theorem sublists_append (l₁ l₂ : List α) :
simp [List.bind, join_join, Function.comp]
#align list.sublists_append List.sublists_append
--- Porting note: New theorem
+-- Porting note (#10756): new theorem
theorem sublists_cons (a : α) (l : List α) :
sublists (a :: l) = sublists l >>= (fun x => [x, a :: x]) :=
show sublists ([a] ++ l) = _ by
@@ -399,7 +399,7 @@ theorem nodup_sublistsLen (n : ℕ) {l : List α} (h : Nodup l) : (sublistsLen n
exact this.sublist (sublistsLen_sublist_sublists' _ _)
#align list.nodup_sublists_len List.nodup_sublistsLen
--- Porting note: new theorem
+-- Porting note (#10756): new theorem
theorem sublists_map (f : α → β) : ∀ (l : List α),
sublists (map f l) = map (map f) (sublists l)
| [] => by simp
@@ -408,7 +408,7 @@ theorem sublists_map (f : α → β) : ∀ (l : List α),
bind_eq_bind, map_eq_bind, map_eq_bind]
induction sublists l <;> simp [*]
--- Porting note: new theorem
+-- Porting note (#10756): new theorem
theorem sublists'_map (f : α → β) : ∀ (l : List α),
sublists' (map f l) = map (map f) (sublists' l)
| [] => by simp
@@ -305,8 +305,7 @@ theorem sublistsLen_sublist_of_sublist {α : Type*} (n) {l₁ l₂ : List α} (h
· refine' IH.trans _
rw [sublistsLen_succ_cons]
apply sublist_append_left
- · simp [sublistsLen_succ_cons]
- exact IH.append ((IHn s).map _)
+ · simpa only [sublistsLen_succ_cons] using IH.append ((IHn s).map _)
#align list.sublists_len_sublist_of_sublist List.sublistsLen_sublist_of_sublist
theorem length_of_sublistsLen {α : Type*} :
@@ -456,10 +455,11 @@ theorem revzip_sublists (l : List α) : ∀ l₁ l₂, (l₁, l₂) ∈ revzip l
theorem revzip_sublists' (l : List α) : ∀ l₁ l₂, (l₁, l₂) ∈ revzip l.sublists' → l₁ ++ l₂ ~ l := by
rw [revzip]
induction' l with a l IH <;> intro l₁ l₂ h
- · simp at h
- simp [h]
+ · simp_all only [sublists'_nil, reverse_cons, reverse_nil, nil_append, zip_cons_cons,
+ zip_nil_right, mem_singleton, Prod.mk.injEq, append_nil, Perm.refl]
· rw [sublists'_cons, reverse_append, zip_append, ← map_reverse, zip_map_right, zip_map_left] at *
- <;> [simp at h; simp]
+ <;> [simp only [mem_append, mem_map, Prod_map, id_eq, Prod.mk.injEq, Prod.exists,
+ exists_eq_right_right] at h; simp]
rcases h with (⟨l₁, l₂', h, rfl, rfl⟩ | ⟨l₁', h, rfl⟩)
· exact perm_middle.trans ((IH _ _ h).cons _)
· exact (IH _ _ h).cons _
This is a very large PR, but it has been reviewed piecemeal already in PRs to the bump/v4.7.0
branch as we update to intermediate nightlies.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: damiano <adomani@gmail.com>
@@ -97,7 +97,7 @@ theorem length_sublists' : ∀ l : List α, length (sublists' l) = 2 ^ length l
| [] => rfl
| a :: l => by
simp_arith only [sublists'_cons, length_append, length_sublists' l,
- length_map, length, Nat.pow_succ', mul_succ, mul_zero, zero_add]
+ length_map, length, Nat.pow_succ', mul_succ, mul_zero, zero_add, npow_eq_pow, pow_eq]
#align list.length_sublists' List.length_sublists'
@[simp]
Homogenises porting notes via capitalisation and addition of whitespace.
It makes the following changes:
@@ -43,7 +43,7 @@ theorem sublists'_singleton (a : α) : sublists' [a] = [[], [a]] :=
#noalign list.sublists'_aux_append
#noalign list.sublists'_aux_eq_sublists'
---Porting note: Not the same as `sublists'_aux` from Lean3
+-- Porting note: Not the same as `sublists'_aux` from Lean3
/-- Auxiliary helper definition for `sublists'` -/
def sublists'Aux (a : α) (r₁ r₂ : List (List α)) : List (List α) :=
r₁.foldl (init := r₂) fun r l => r ++ [a :: l]
@@ -110,7 +110,7 @@ theorem sublists_singleton (a : α) : sublists [a] = [[], [a]] :=
rfl
#align list.sublists_singleton List.sublists_singleton
---Porting note: Not the same as `sublists_aux` from Lean3
+-- Porting note: Not the same as `sublists_aux` from Lean3
/-- Auxiliary helper function for `sublists` -/
def sublistsAux (a : α) (r : List (List α)) : List (List α) :=
r.foldl (init := []) fun r l => r ++ [l, a :: l]
@@ -165,7 +165,7 @@ theorem sublists_append (l₁ l₂ : List α) :
simp [List.bind, join_join, Function.comp]
#align list.sublists_append List.sublists_append
---Porting note: New theorem
+-- Porting note: New theorem
theorem sublists_cons (a : α) (l : List α) :
sublists (a :: l) = sublists l >>= (fun x => [x, a :: x]) :=
show sublists ([a] ++ l) = _ by
@@ -391,7 +391,7 @@ alias ⟨nodup.of_sublists', nodup.sublists'⟩ := nodup_sublists'
#align list.nodup.of_sublists' List.nodup.of_sublists'
#align list.nodup.sublists' List.nodup.sublists'
---Porting note: commented out
+-- Porting note: commented out
--attribute [protected] nodup.sublists nodup.sublists'
theorem nodup_sublistsLen (n : ℕ) {l : List α} (h : Nodup l) : (sublistsLen n l).Nodup := by
@@ -400,7 +400,7 @@ theorem nodup_sublistsLen (n : ℕ) {l : List α} (h : Nodup l) : (sublistsLen n
exact this.sublist (sublistsLen_sublist_sublists' _ _)
#align list.nodup_sublists_len List.nodup_sublistsLen
---Porting note: new theorem
+-- Porting note: new theorem
theorem sublists_map (f : α → β) : ∀ (l : List α),
sublists (map f l) = map (map f) (sublists l)
| [] => by simp
@@ -409,13 +409,13 @@ theorem sublists_map (f : α → β) : ∀ (l : List α),
bind_eq_bind, map_eq_bind, map_eq_bind]
induction sublists l <;> simp [*]
---Porting note: new theorem
+-- Porting note: new theorem
theorem sublists'_map (f : α → β) : ∀ (l : List α),
sublists' (map f l) = map (map f) (sublists' l)
| [] => by simp
| a::l => by simp [map_cons, sublists'_cons, sublists'_map f l, Function.comp]
---Porting note: moved because it is now used to prove `sublists_cons_perm_append`
+-- Porting note: moved because it is now used to prove `sublists_cons_perm_append`
theorem sublists_perm_sublists' (l : List α) : sublists l ~ sublists' l := by
rw [← finRange_map_get l, sublists_map, sublists'_map]
apply Perm.map
@@ -165,7 +165,7 @@ theorem sublists_append (l₁ l₂ : List α) :
simp [List.bind, join_join, Function.comp]
#align list.sublists_append List.sublists_append
---Portin note: New theorem
+--Porting note: New theorem
theorem sublists_cons (a : α) (l : List α) :
sublists (a :: l) = sublists l >>= (fun x => [x, a :: x]) :=
show sublists ([a] ++ l) = _ by
@@ -5,6 +5,7 @@ Authors: Mario Carneiro
-/
import Mathlib.Data.Nat.Choose.Basic
import Mathlib.Data.List.Perm
+import Mathlib.Data.List.Range
#align_import data.list.sublists from "leanprover-community/mathlib"@"ccad6d5093bd2f5c6ca621fc74674cce51355af6"
@@ -66,7 +66,7 @@ theorem sublists'_eq_sublists'Aux (l : List α) :
theorem sublists'Aux_eq_map (a : α) (r₁ : List (List α)) : ∀ (r₂ : List (List α)),
sublists'Aux a r₁ r₂ = r₂ ++ map (cons a) r₁ :=
- List.reverseRecOn r₁ (fun _ => by simp [sublists'Aux]) <| fun r₁ l ih r₂ => by
+ List.reverseRecOn r₁ (fun _ => by simp [sublists'Aux]) fun r₁ l ih r₂ => by
rw [map_append, map_singleton, ← append_assoc, ← ih, sublists'Aux, foldl_append, foldl]
simp [sublists'Aux]
@@ -128,7 +128,7 @@ theorem sublistsAux_eq_array_foldl :
theorem sublistsAux_eq_bind :
sublistsAux = fun (a : α) (r : List (List α)) => r.bind fun l => [l, a :: l] :=
- funext <| fun a => funext <| fun r =>
+ funext fun a => funext fun r =>
List.reverseRecOn r
(by simp [sublistsAux])
(fun r l ih => by
cases x with | ...
instead of cases x; case => ...
(#9321)
This converts usages of the pattern
cases h
case inl h' => ...
case inr h' => ...
which derive from mathported code, to the "structured cases
" syntax:
cases h with
| inl h' => ...
| inr h' => ...
The case where the subgoals are handled with ·
instead of case
is more contentious (and much more numerous) so I left those alone. This pattern also appears with cases'
, induction
, induction'
, and rcases
. Furthermore, there is a similar transformation for by_cases
:
by_cases h : cond
case pos => ...
case neg => ...
is replaced by:
if h : cond then
...
else
...
Co-authored-by: Mario Carneiro <di.gama@gmail.com>
@@ -157,11 +157,11 @@ theorem sublistsAux_eq_bind :
theorem sublists_append (l₁ l₂ : List α) :
sublists (l₁ ++ l₂) = (sublists l₂) >>= (fun x => (sublists l₁).map (· ++ x)) := by
simp only [sublists, foldr_append]
- induction l₁
- · case nil => simp
- · case cons a l₁ ih =>
- rw [foldr_cons, ih]
- simp [List.bind, join_join, Function.comp]
+ induction l₁ with
+ | nil => simp
+ | cons a l₁ ih =>
+ rw [foldr_cons, ih]
+ simp [List.bind, join_join, Function.comp]
#align list.sublists_append List.sublists_append
--Portin note: New theorem
Finset/Multiset.powersetCard 1
(#9137)
for [#9130](https://github.com/leanprover-community/mathlib4/pull/9130/files#r1429368677)
Co-authored-by: Junyan Xu <junyanxu.math@gmail.com>
@@ -274,6 +274,10 @@ theorem sublistsLen_succ_cons {α : Type*} (n) (a : α) (l) :
append_nil]; rfl
#align list.sublists_len_succ_cons List.sublistsLen_succ_cons
+theorem sublistsLen_one {α : Type*} (l : List α) : sublistsLen 1 l = l.reverse.map ([·]) :=
+ l.rec (by rw [sublistsLen_succ_nil, reverse_nil, map_nil]) fun a s ih ↦ by
+ rw [sublistsLen_succ_cons, ih, reverse_cons, map_append, sublistsLen_zero]; rfl
+
@[simp]
theorem length_sublistsLen {α : Type*} :
∀ (n) (l : List α), length (sublistsLen n l) = Nat.choose (length l) n
This covers these changes in Std: https://github.com/leanprover/std4/compare/6b4cf96c89e53cfcd73350bbcd90333a051ff4f0...[9dd24a34](https://github.com/leanprover-community/mathlib/commit/9dd24a3493cceefa2bede383f21e4ef548990b68)
Int.ofNat_natAbs_eq_of_nonneg
has become Int.natAbs_of_nonneg
(and one argument has become implicit)List.map_id''
and List.map_id'
have exchanged names. (Yay naming things using primes!)Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -175,7 +175,7 @@ theorem sublists_cons (a : α) (l : List α) :
theorem sublists_concat (l : List α) (a : α) :
sublists (l ++ [a]) = sublists l ++ map (fun x => x ++ [a]) (sublists l) := by
rw [sublists_append, sublists_singleton, bind_eq_bind, cons_bind, cons_bind, nil_bind,
- map_id' append_nil, append_nil]
+ map_id'' append_nil, append_nil]
#align list.sublists_concat List.sublists_concat
theorem sublists_reverse (l : List α) : sublists (reverse l) = map reverse (sublists' l) := by
@@ -189,7 +189,7 @@ theorem sublists_eq_sublists' (l : List α) : sublists l = map reverse (sublists
#align list.sublists_eq_sublists' List.sublists_eq_sublists'
theorem sublists'_reverse (l : List α) : sublists' (reverse l) = map reverse (sublists l) := by
- simp only [sublists_eq_sublists', map_map, map_id' reverse_reverse, Function.comp]
+ simp only [sublists_eq_sublists', map_map, map_id'' reverse_reverse, Function.comp]
#align list.sublists'_reverse List.sublists'_reverse
theorem sublists'_eq_sublists (l : List α) : sublists' l = map reverse (sublists (reverse l)) := by
@@ -431,7 +431,9 @@ theorem revzip_sublists (l : List α) : ∀ l₁ l₂, (l₁, l₂) ∈ revzip l
rw [revzip]
induction' l using List.reverseRecOn with l' a ih
· intro l₁ l₂ h
- simp at h
+ simp? at h says
+ simp only [sublists_nil, reverse_cons, reverse_nil, nil_append, zip_cons_cons, zip_nil_right,
+ mem_singleton, Prod.mk.injEq] at h
simp [h]
· intro l₁ l₂ h
rw [sublists_concat, reverse_append, zip_append, ← map_reverse, zip_map_right,
@@ -413,9 +413,11 @@ theorem sublists'_map (f : α → β) : ∀ (l : List α),
--Porting note: moved because it is now used to prove `sublists_cons_perm_append`
theorem sublists_perm_sublists' (l : List α) : sublists l ~ sublists' l := by
rw [← finRange_map_get l, sublists_map, sublists'_map]
- refine' Perm.map _ _
- exact (perm_ext (nodup_sublists.2 (nodup_finRange _)) (nodup_sublists'.2 (nodup_finRange _))).2
- (by simp)
+ apply Perm.map
+ apply (perm_ext_iff_of_nodup _ _).mpr
+ · simp
+ · exact nodup_sublists.mpr (nodup_finRange _)
+ · exact (nodup_sublists'.mpr (nodup_finRange _))
#align list.sublists_perm_sublists' List.sublists_perm_sublists'
theorem sublists_cons_perm_append (a : α) (l : List α) :
This includes leanprover/std4#301 which requires slight tweaks to the List.sublists
API.
One other proof also breaks, presumably due to other Std4 commits.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com>
@@ -135,12 +135,14 @@ theorem sublistsAux_eq_bind :
rw [append_bind, ← ih, bind_singleton, sublistsAux, foldl_append]
simp [sublistsAux])
-theorem sublists_eq_sublistsAux (l : List α) :
- sublists l = l.foldr sublistsAux [[]] := by
- simp only [sublists, sublistsAux_eq_array_foldl, Array.foldr_eq_foldr_data]
- rw [← foldr_hom Array.toList]
- · rfl
- · intros _ _; congr <;> simp
+@[csimp] theorem sublists_eq_sublistsFast : @sublists = @sublistsFast := by
+ ext α l : 2
+ trans l.foldr sublistsAux [[]]
+ · rw [sublistsAux_eq_bind, sublists]
+ · simp only [sublistsFast, sublistsAux_eq_array_foldl, Array.foldr_eq_foldr_data]
+ rw [← foldr_hom Array.toList]
+ · rfl
+ · intros _ _; congr <;> simp
#noalign list.sublists_aux₁_eq_sublists_aux
#noalign list.sublists_aux_cons_eq_sublists_aux₁
@@ -154,7 +156,7 @@ theorem sublists_eq_sublistsAux (l : List α) :
theorem sublists_append (l₁ l₂ : List α) :
sublists (l₁ ++ l₂) = (sublists l₂) >>= (fun x => (sublists l₁).map (· ++ x)) := by
- simp only [sublists_eq_sublistsAux, foldr_append, sublistsAux_eq_bind]
+ simp only [sublists, foldr_append]
induction l₁
· case nil => simp
· case cons a l₁ ih =>
@@ -376,11 +376,11 @@ theorem nodup_sublists' {l : List α} : Nodup (sublists' l) ↔ Nodup l := by
rw [sublists'_eq_sublists, nodup_map_iff reverse_injective, nodup_sublists, nodup_reverse]
#align list.nodup_sublists' List.nodup_sublists'
-alias nodup_sublists ↔ nodup.of_sublists nodup.sublists
+alias ⟨nodup.of_sublists, nodup.sublists⟩ := nodup_sublists
#align list.nodup.of_sublists List.nodup.of_sublists
#align list.nodup.sublists List.nodup.sublists
-alias nodup_sublists' ↔ nodup.of_sublists' nodup.sublists'
+alias ⟨nodup.of_sublists', nodup.sublists'⟩ := nodup_sublists'
#align list.nodup.of_sublists' List.nodup.of_sublists'
#align list.nodup.sublists' List.nodup.sublists'
@@ -60,7 +60,6 @@ theorem sublists'Aux_eq_array_foldl (a : α) : ∀ (r₁ r₂ : List (List α)),
theorem sublists'_eq_sublists'Aux (l : List α) :
sublists' l = l.foldr (fun a r => sublists'Aux a r r) [[]] := by
simp only [sublists', sublists'Aux_eq_array_foldl]
- dsimp only
rw [← List.foldr_hom Array.toList]
· rfl
· intros _ _; congr <;> simp
@@ -133,7 +133,7 @@ theorem sublistsAux_eq_bind :
List.reverseRecOn r
(by simp [sublistsAux])
(fun r l ih => by
- rw [bind_append, ← ih, bind_singleton, sublistsAux, foldl_append]
+ rw [append_bind, ← ih, bind_singleton, sublistsAux, foldl_append]
simp [sublistsAux])
theorem sublists_eq_sublistsAux (l : List α) :
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -223,7 +223,7 @@ theorem map_ret_sublist_sublists (l : List α) : map List.ret l <+ sublists l :=
/-- Auxiliary function to construct the list of all sublists of a given length. Given an
integer `n`, a list `l`, a function `f` and an auxiliary list `L`, it returns the list made of
`f` applied to all sublists of `l` of length `n`, concatenated with `L`. -/
-def sublistsLenAux {α β : Type _} : ℕ → List α → (List α → β) → List β → List β
+def sublistsLenAux {α β : Type*} : ℕ → List α → (List α → β) → List β → List β
| 0, _, f, r => f [] :: r
| _ + 1, [], _, r => r
| n + 1, a :: l, f, r => sublistsLenAux (n + 1) l f (sublistsLenAux n l (f ∘ List.cons a) r)
@@ -232,11 +232,11 @@ def sublistsLenAux {α β : Type _} : ℕ → List α → (List α → β) → L
/-- The list of all sublists of a list `l` that are of length `n`. For instance, for
`l = [0, 1, 2, 3]` and `n = 2`, one gets
`[[2, 3], [1, 3], [1, 2], [0, 3], [0, 2], [0, 1]]`. -/
-def sublistsLen {α : Type _} (n : ℕ) (l : List α) : List (List α) :=
+def sublistsLen {α : Type*} (n : ℕ) (l : List α) : List (List α) :=
sublistsLenAux n l id []
#align list.sublists_len List.sublistsLen
-theorem sublistsLenAux_append {α β γ : Type _} :
+theorem sublistsLenAux_append {α β γ : Type*} :
∀ (n : ℕ) (l : List α) (f : List α → β) (g : β → γ) (r : List β) (s : List γ),
sublistsLenAux n l (g ∘ f) (r.map g ++ s) = (sublistsLenAux n l f r).map g ++ s
| 0, l, f, g, r, s => by unfold sublistsLenAux; simp
@@ -247,34 +247,34 @@ theorem sublistsLenAux_append {α β γ : Type _} :
sublistsLenAux_append]
#align list.sublists_len_aux_append List.sublistsLenAux_append
-theorem sublistsLenAux_eq {α β : Type _} (l : List α) (n) (f : List α → β) (r) :
+theorem sublistsLenAux_eq {α β : Type*} (l : List α) (n) (f : List α → β) (r) :
sublistsLenAux n l f r = (sublistsLen n l).map f ++ r := by
rw [sublistsLen, ← sublistsLenAux_append]; rfl
#align list.sublists_len_aux_eq List.sublistsLenAux_eq
-theorem sublistsLenAux_zero {α : Type _} (l : List α) (f : List α → β) (r) :
+theorem sublistsLenAux_zero {α : Type*} (l : List α) (f : List α → β) (r) :
sublistsLenAux 0 l f r = f [] :: r := by cases l <;> rfl
#align list.sublists_len_aux_zero List.sublistsLenAux_zero
@[simp]
-theorem sublistsLen_zero {α : Type _} (l : List α) : sublistsLen 0 l = [[]] :=
+theorem sublistsLen_zero {α : Type*} (l : List α) : sublistsLen 0 l = [[]] :=
sublistsLenAux_zero _ _ _
#align list.sublists_len_zero List.sublistsLen_zero
@[simp]
-theorem sublistsLen_succ_nil {α : Type _} (n) : sublistsLen (n + 1) (@nil α) = [] :=
+theorem sublistsLen_succ_nil {α : Type*} (n) : sublistsLen (n + 1) (@nil α) = [] :=
rfl
#align list.sublists_len_succ_nil List.sublistsLen_succ_nil
@[simp]
-theorem sublistsLen_succ_cons {α : Type _} (n) (a : α) (l) :
+theorem sublistsLen_succ_cons {α : Type*} (n) (a : α) (l) :
sublistsLen (n + 1) (a :: l) = sublistsLen (n + 1) l ++ (sublistsLen n l).map (cons a) := by
rw [sublistsLen, sublistsLenAux, sublistsLenAux_eq, sublistsLenAux_eq, map_id,
append_nil]; rfl
#align list.sublists_len_succ_cons List.sublistsLen_succ_cons
@[simp]
-theorem length_sublistsLen {α : Type _} :
+theorem length_sublistsLen {α : Type*} :
∀ (n) (l : List α), length (sublistsLen n l) = Nat.choose (length l) n
| 0, l => by simp
| _ + 1, [] => by simp
@@ -283,7 +283,7 @@ theorem length_sublistsLen {α : Type _} :
length_map, length_sublistsLen n l, length_cons, Nat.choose_succ_succ, add_comm]
#align list.length_sublists_len List.length_sublistsLen
-theorem sublistsLen_sublist_sublists' {α : Type _} :
+theorem sublistsLen_sublist_sublists' {α : Type*} :
∀ (n) (l : List α), sublistsLen n l <+ sublists' l
| 0, l => by simp
| _ + 1, [] => nil_sublist _
@@ -292,7 +292,7 @@ theorem sublistsLen_sublist_sublists' {α : Type _} :
exact (sublistsLen_sublist_sublists' _ _).append ((sublistsLen_sublist_sublists' _ _).map _)
#align list.sublists_len_sublist_sublists' List.sublistsLen_sublist_sublists'
-theorem sublistsLen_sublist_of_sublist {α : Type _} (n) {l₁ l₂ : List α} (h : l₁ <+ l₂) :
+theorem sublistsLen_sublist_of_sublist {α : Type*} (n) {l₁ l₂ : List α} (h : l₁ <+ l₂) :
sublistsLen n l₁ <+ sublistsLen n l₂ := by
induction' n with n IHn generalizing l₁ l₂; · simp
induction' h with l₁ l₂ a _ IH l₁ l₂ a s IH; · rfl
@@ -303,7 +303,7 @@ theorem sublistsLen_sublist_of_sublist {α : Type _} (n) {l₁ l₂ : List α} (
exact IH.append ((IHn s).map _)
#align list.sublists_len_sublist_of_sublist List.sublistsLen_sublist_of_sublist
-theorem length_of_sublistsLen {α : Type _} :
+theorem length_of_sublistsLen {α : Type*} :
∀ {n} {l l' : List α}, l' ∈ sublistsLen n l → length l' = n
| 0, l, l', h => by simp_all
| n + 1, a :: l, l', h => by
@@ -313,7 +313,7 @@ theorem length_of_sublistsLen {α : Type _} :
· exact congr_arg (· + 1) (length_of_sublistsLen h)
#align list.length_of_sublists_len List.length_of_sublistsLen
-theorem mem_sublistsLen_self {α : Type _} {l l' : List α} (h : l' <+ l) :
+theorem mem_sublistsLen_self {α : Type*} {l l' : List α} (h : l' <+ l) :
l' ∈ sublistsLen (length l') l := by
induction' h with l₁ l₂ a s IH l₁ l₂ a s IH
· simp
@@ -326,7 +326,7 @@ theorem mem_sublistsLen_self {α : Type _} {l l' : List α} (h : l' <+ l) :
#align list.mem_sublists_len_self List.mem_sublistsLen_self
@[simp]
-theorem mem_sublistsLen {α : Type _} {n} {l l' : List α} :
+theorem mem_sublistsLen {α : Type*} {n} {l l' : List α} :
l' ∈ sublistsLen n l ↔ l' <+ l ∧ length l' = n :=
⟨fun h =>
⟨mem_sublists'.1 ((sublistsLen_sublist_sublists' _ _).subset h), length_of_sublistsLen h⟩,
@@ -455,7 +455,7 @@ theorem revzip_sublists' (l : List α) : ∀ l₁ l₂, (l₁, l₂) ∈ revzip
· exact (IH _ _ h).cons _
#align list.revzip_sublists' List.revzip_sublists'
-theorem range_bind_sublistsLen_perm {α : Type _} (l : List α) :
+theorem range_bind_sublistsLen_perm {α : Type*} (l : List α) :
((List.range (l.length + 1)).bind fun n => sublistsLen n l) ~ sublists' l := by
induction' l with h tl l_ih
· simp [range_succ]
@@ -222,7 +222,7 @@ theorem map_ret_sublist_sublists (l : List α) : map List.ret l <+ sublists l :=
/-- Auxiliary function to construct the list of all sublists of a given length. Given an
integer `n`, a list `l`, a function `f` and an auxiliary list `L`, it returns the list made of
-of `f` applied to all sublists of `l` of length `n`, concatenated with `L`. -/
+`f` applied to all sublists of `l` of length `n`, concatenated with `L`. -/
def sublistsLenAux {α β : Type _} : ℕ → List α → (List α → β) → List β → List β
| 0, _, f, r => f [] :: r
| _ + 1, [], _, r => r
@@ -154,7 +154,7 @@ theorem sublists_eq_sublistsAux (l : List α) :
#noalign list.sublists_aux_cons_append
theorem sublists_append (l₁ l₂ : List α) :
- sublists (l₁ ++ l₂) = (sublists l₂) >>= (fun x => (sublists l₁).map (. ++ x)) := by
+ sublists (l₁ ++ l₂) = (sublists l₂) >>= (fun x => (sublists l₁).map (· ++ x)) := by
simp only [sublists_eq_sublistsAux, foldr_append, sublistsAux_eq_bind]
induction l₁
· case nil => simp
@@ -389,7 +389,7 @@ alias nodup_sublists' ↔ nodup.of_sublists' nodup.sublists'
--attribute [protected] nodup.sublists nodup.sublists'
theorem nodup_sublistsLen (n : ℕ) {l : List α} (h : Nodup l) : (sublistsLen n l).Nodup := by
- have : Pairwise (. ≠ .) l.sublists' := Pairwise.imp
+ have : Pairwise (· ≠ ·) l.sublists' := Pairwise.imp
(fun h => Lex.to_ne (by convert h using 3; simp [swap, eq_comm])) h.sublists'
exact this.sublist (sublistsLen_sublist_sublists' _ _)
#align list.nodup_sublists_len List.nodup_sublistsLen
@@ -2,15 +2,12 @@
Copyright (c) 2019 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-
-! This file was ported from Lean 3 source module data.list.sublists
-! leanprover-community/mathlib commit ccad6d5093bd2f5c6ca621fc74674cce51355af6
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Data.Nat.Choose.Basic
import Mathlib.Data.List.Perm
+#align_import data.list.sublists from "leanprover-community/mathlib"@"ccad6d5093bd2f5c6ca621fc74674cce51355af6"
+
/-! # sublists
`List.Sublists` gives a list of all (not necessarily contiguous) sublists of a list.
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.
@@ -65,8 +65,8 @@ theorem sublists'_eq_sublists'Aux (l : List α) :
simp only [sublists', sublists'Aux_eq_array_foldl]
dsimp only
rw [← List.foldr_hom Array.toList]
- . rfl
- . intros _ _; congr <;> simp
+ · rfl
+ · intros _ _; congr <;> simp
theorem sublists'Aux_eq_map (a : α) (r₁ : List (List α)) : ∀ (r₂ : List (List α)),
sublists'Aux a r₁ r₂ = r₂ ++ map (cons a) r₁ :=
@@ -143,8 +143,8 @@ theorem sublists_eq_sublistsAux (l : List α) :
sublists l = l.foldr sublistsAux [[]] := by
simp only [sublists, sublistsAux_eq_array_foldl, Array.foldr_eq_foldr_data]
rw [← foldr_hom Array.toList]
- . rfl
- . intros _ _; congr <;> simp
+ · rfl
+ · intros _ _; congr <;> simp
#noalign list.sublists_aux₁_eq_sublists_aux
#noalign list.sublists_aux_cons_eq_sublists_aux₁
@@ -160,8 +160,8 @@ theorem sublists_append (l₁ l₂ : List α) :
sublists (l₁ ++ l₂) = (sublists l₂) >>= (fun x => (sublists l₁).map (. ++ x)) := by
simp only [sublists_eq_sublistsAux, foldr_append, sublistsAux_eq_bind]
induction l₁
- . case nil => simp
- . case cons a l₁ ih =>
+ · case nil => simp
+ · case cons a l₁ ih =>
rw [foldr_cons, ih]
simp [List.bind, join_join, Function.comp]
#align list.sublists_append List.sublists_append
@@ -430,10 +430,10 @@ theorem sublists_cons_perm_append (a : α) (l : List α) :
theorem revzip_sublists (l : List α) : ∀ l₁ l₂, (l₁, l₂) ∈ revzip l.sublists → l₁ ++ l₂ ~ l := by
rw [revzip]
induction' l using List.reverseRecOn with l' a ih
- . intro l₁ l₂ h
+ · intro l₁ l₂ h
simp at h
simp [h]
- . intro l₁ l₂ h
+ · intro l₁ l₂ h
rw [sublists_concat, reverse_append, zip_append, ← map_reverse, zip_map_right,
zip_map_left] at * <;> [skip; simp]
simp only [Prod.mk.inj_iff, mem_map, mem_append, Prod.map_mk, Prod.exists] at h
@@ -46,7 +46,7 @@ theorem sublists'_singleton (a : α) : sublists' [a] = [[], [a]] :=
#noalign list.sublists'_aux_eq_sublists'
--Porting note: Not the same as `sublists'_aux` from Lean3
-/-- Auxiliary helper definiiton for `sublists'` -/
+/-- Auxiliary helper definition for `sublists'` -/
def sublists'Aux (a : α) (r₁ r₂ : List (List α)) : List (List α) :=
r₁.foldl (init := r₂) fun r l => r ++ [a :: l]
#align list.sublists'_aux List.sublists'Aux
I ran codespell Mathlib
and got tired halfway through the suggestions.
@@ -46,7 +46,7 @@ theorem sublists'_singleton (a : α) : sublists' [a] = [[], [a]] :=
#noalign list.sublists'_aux_eq_sublists'
--Porting note: Not the same as `sublists'_aux` from Lean3
-/-- Auxilary helper definiiton for `sublists'` -/
+/-- Auxiliary helper definiiton for `sublists'` -/
def sublists'Aux (a : α) (r₁ r₂ : List (List α)) : List (List α) :=
r₁.foldl (init := r₂) fun r l => r ++ [a :: l]
#align list.sublists'_aux List.sublists'Aux
@@ -114,7 +114,7 @@ theorem sublists_singleton (a : α) : sublists [a] = [[], [a]] :=
#align list.sublists_singleton List.sublists_singleton
--Porting note: Not the same as `sublists_aux` from Lean3
-/-- Auxilary helper function for `sublists` -/
+/-- Auxiliary helper function for `sublists` -/
def sublistsAux (a : α) (r : List (List α)) : List (List α) :=
r.foldl (init := []) fun r l => r ++ [l, a :: l]
#align list.sublists_aux List.sublistsAux
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.
@@ -181,7 +181,7 @@ theorem sublists_concat (l : List α) (a : α) :
#align list.sublists_concat List.sublists_concat
theorem sublists_reverse (l : List α) : sublists (reverse l) = map reverse (sublists' l) := by
- induction' l with hd tl ih <;> [rfl,
+ induction' l with hd tl ih <;> [rfl;
simp only [reverse_cons, sublists_append, sublists'_cons, map_append, ih, sublists_singleton,
map_eq_map, bind_eq_bind, map_map, cons_bind, append_nil, nil_bind, (· ∘ ·)]]
#align list.sublists_reverse List.sublists_reverse
@@ -434,9 +434,8 @@ theorem revzip_sublists (l : List α) : ∀ l₁ l₂, (l₁, l₂) ∈ revzip l
simp at h
simp [h]
. intro l₁ l₂ h
- rw [sublists_concat, reverse_append, zip_append, ← map_reverse, zip_map_right, zip_map_left] at
- * <;>
- [skip, · simp]
+ rw [sublists_concat, reverse_append, zip_append, ← map_reverse, zip_map_right,
+ zip_map_left] at * <;> [skip; simp]
simp only [Prod.mk.inj_iff, mem_map, mem_append, Prod.map_mk, Prod.exists] at h
rcases h with (⟨l₁, l₂', h, rfl, rfl⟩ | ⟨l₁', l₂, h, rfl, rfl⟩)
· rw [← append_assoc]
@@ -452,8 +451,8 @@ theorem revzip_sublists' (l : List α) : ∀ l₁ l₂, (l₁, l₂) ∈ revzip
induction' l with a l IH <;> intro l₁ l₂ h
· simp at h
simp [h]
- · rw [sublists'_cons, reverse_append, zip_append, ← map_reverse, zip_map_right, zip_map_left] at
- * <;> [simp at h, simp]
+ · rw [sublists'_cons, reverse_append, zip_append, ← map_reverse, zip_map_right, zip_map_left] at *
+ <;> [simp at h; simp]
rcases h with (⟨l₁, l₂', h, rfl, rfl⟩ | ⟨l₁', h, rfl⟩)
· exact perm_middle.trans ((IH _ _ h).cons _)
· exact (IH _ _ h).cons _
by
s! (#3825)
This PR puts, with one exception, every single remaining by
that lies all by itself on its own line to the previous line, thus matching the current behaviour of start-port.sh
. The exception is when the by
begins the second or later argument to a tuple or anonymous constructor; see https://github.com/leanprover-community/mathlib4/pull/3825#discussion_r1186702599.
Essentially this is s/\n *by$/ by/g
, but with manual editing to satisfy the linter's max-100-char-line requirement. The Python style linter is also modified to catch these "isolated by
s".
@@ -82,8 +82,7 @@ theorem sublists'_cons (a : α) (l : List α) :
#align list.sublists'_cons List.sublists'_cons
@[simp]
-theorem mem_sublists' {s t : List α} : s ∈ sublists' t ↔ s <+ t :=
- by
+theorem mem_sublists' {s t : List α} : s ∈ sublists' t ↔ s <+ t := by
induction' t with a t IH generalizing s
· simp only [sublists'_nil, mem_singleton]
exact ⟨fun h => by rw [h], eq_nil_of_sublist_nil⟩
@@ -297,8 +296,7 @@ theorem sublistsLen_sublist_sublists' {α : Type _} :
#align list.sublists_len_sublist_sublists' List.sublistsLen_sublist_sublists'
theorem sublistsLen_sublist_of_sublist {α : Type _} (n) {l₁ l₂ : List α} (h : l₁ <+ l₂) :
- sublistsLen n l₁ <+ sublistsLen n l₂ :=
- by
+ sublistsLen n l₁ <+ sublistsLen n l₂ := by
induction' n with n IHn generalizing l₁ l₂; · simp
induction' h with l₁ l₂ a _ IH l₁ l₂ a s IH; · rfl
· refine' IH.trans _
@@ -319,8 +317,7 @@ theorem length_of_sublistsLen {α : Type _} :
#align list.length_of_sublists_len List.length_of_sublistsLen
theorem mem_sublistsLen_self {α : Type _} {l l' : List α} (h : l' <+ l) :
- l' ∈ sublistsLen (length l') l :=
- by
+ l' ∈ sublistsLen (length l') l := by
induction' h with l₁ l₂ a s IH l₁ l₂ a s IH
· simp
· cases' l₁ with b l₁
@@ -367,8 +364,7 @@ theorem Pairwise.sublists' {R} :
#align list.pairwise.sublists' List.Pairwise.sublists'
theorem pairwise_sublists {R} {l : List α} (H : Pairwise R l) :
- Pairwise (fun l₁ l₂ => Lex R (reverse l₁) (reverse l₂)) (sublists l) :=
- by
+ Pairwise (fun l₁ l₂ => Lex R (reverse l₁) (reverse l₂)) (sublists l) := by
have := (pairwise_reverse.2 H).sublists'
rwa [sublists'_reverse, pairwise_map] at this
#align list.pairwise_sublists List.pairwise_sublists
This PR fixes two things:
align
statements for definitions and theorems and instances that are separated by two newlines from the relevant declaration (s/\n\n#align/\n#align
). This is often seen in the mathport output after ending calc
blocks.#align
statements. (This was needed for a script I wrote for #3630.)@@ -399,7 +399,6 @@ theorem nodup_sublistsLen (n : ℕ) {l : List α} (h : Nodup l) : (sublistsLen n
have : Pairwise (. ≠ .) l.sublists' := Pairwise.imp
(fun h => Lex.to_ne (by convert h using 3; simp [swap, eq_comm])) h.sublists'
exact this.sublist (sublistsLen_sublist_sublists' _ _)
-
#align list.nodup_sublists_len List.nodup_sublistsLen
--Porting note: new theorem
congr!
and improvement to convert
(#2566)
This introduces a tactic congr!
that is an analogue to mathlib 3's congr'
. It is a more insistent version of congr
that makes use of more congruence lemmas (including user congruence lemmas), propext
, funext
, and Subsingleton
instances. It also has a feature to lift reflexive relations to equalities. Along with funext
, the tactic does intros
, allowing congr!
to get access to function bodies; the introduced variables can be named using rename_i
if needed.
This also modifies convert
to use congr!
rather than congr
, which makes it work more like the mathlib3 version of the tactic.
@@ -397,7 +397,7 @@ alias nodup_sublists' ↔ nodup.of_sublists' nodup.sublists'
theorem nodup_sublistsLen (n : ℕ) {l : List α} (h : Nodup l) : (sublistsLen n l).Nodup := by
have : Pairwise (. ≠ .) l.sublists' := Pairwise.imp
- (fun h => Lex.to_ne (by convert h; funext _ _; simp[swap, eq_comm])) h.sublists'
+ (fun h => Lex.to_ne (by convert h using 3; simp [swap, eq_comm])) h.sublists'
exact this.sublist (sublistsLen_sublist_sublists' _ _)
#align list.nodup_sublists_len List.nodup_sublistsLen
This PR is the result of a slight variant on the following "algorithm"
_
and make all uppercase letters into lowercase_
and make all uppercase letters into lowercase(original_lean3_name, OriginalLean4Name)
#align
statement just before the next empty line#align
statement to have been inserted too early)@@ -49,6 +49,7 @@ theorem sublists'_singleton (a : α) : sublists' [a] = [[], [a]] :=
/-- Auxilary helper definiiton for `sublists'` -/
def sublists'Aux (a : α) (r₁ r₂ : List (List α)) : List (List α) :=
r₁.foldl (init := r₂) fun r l => r ++ [a :: l]
+#align list.sublists'_aux List.sublists'Aux
theorem sublists'Aux_eq_array_foldl (a : α) : ∀ (r₁ r₂ : List (List α)),
sublists'Aux a r₁ r₂ = ((r₁.toArray).foldl (init := r₂.toArray)
@@ -117,6 +118,7 @@ theorem sublists_singleton (a : α) : sublists [a] = [[], [a]] :=
/-- Auxilary helper function for `sublists` -/
def sublistsAux (a : α) (r : List (List α)) : List (List α) :=
r.foldl (init := []) fun r l => r ++ [l, a :: l]
+#align list.sublists_aux List.sublistsAux
theorem sublistsAux_eq_array_foldl :
sublistsAux = fun (a : α) (r : List (List α)) =>
The unported dependencies are