Skip to content

Commit

Permalink
feat: port Data.List.Sublists (#1494)
Browse files Browse the repository at this point in the history
Co-authored-by: qawbecrdtey <qawbecrdtey@kaist.ac.kr>
Co-authored-by: ChrisHughes24 <chrishughes24@gmail.com>
  • Loading branch information
3 people committed Jan 13, 2023
1 parent 6d0f7fe commit fb6c6c4
Show file tree
Hide file tree
Showing 4 changed files with 487 additions and 8 deletions.
1 change: 1 addition & 0 deletions Mathlib.lean
Expand Up @@ -280,6 +280,7 @@ import Mathlib.Data.List.Range
import Mathlib.Data.List.Rdrop
import Mathlib.Data.List.Sections
import Mathlib.Data.List.Sigma
import Mathlib.Data.List.Sublists
import Mathlib.Data.List.TFAE
import Mathlib.Data.List.Zip
import Mathlib.Data.Multiset.Basic
Expand Down
8 changes: 0 additions & 8 deletions Mathlib/Data/List/Defs.lean
Expand Up @@ -215,14 +215,6 @@ end mapIdxM
#align list.sublists List.sublists
#align list.forall₂ List.Forall₂

/-- Definition of a `sublists` function with an explicit list construction function
Used in `Data.Lists.Sublists`: TODO: move there when ported.
-/
def sublistsAux₁ : List α → (List α → List β) → List β
| [], _ => []
| a :: l, f => f [a] ++ sublistsAux₁ l fun ys => f ys ++ f (a :: ys)
#align list.sublists_aux₁ List.sublistsAux₁

/-- `l.all₂ p` is equivalent to `∀ a ∈ l, p a`, but unfolds directly to a conjunction, i.e.
`list.all₂ p [0, 1, 2] = p 0 ∧ p 1 ∧ p 2`. -/
@[simp]
Expand Down
4 changes: 4 additions & 0 deletions Mathlib/Data/List/Range.lean
Expand Up @@ -359,6 +359,10 @@ theorem get_finRange {n : ℕ} {i : ℕ} (h) :
(finRange n).get ⟨i, h⟩ = ⟨i, length_finRange n ▸ h⟩ := by
simp only [finRange, get_range, get_pmap]

--Porting note: new theorem
theorem finRange_map_get (l : List α) : (finRange l.length).map l.get = l :=
List.ext_get (by simp) (by simp)

set_option linter.deprecated false in
@[simp]
theorem nthLe_finRange {n : ℕ} {i : ℕ} (h) :
Expand Down

0 comments on commit fb6c6c4

Please sign in to comment.