# Ranges of naturals as lists #

This file shows basic results about List.iota, List.range, List.range' and defines List.finRange. finRange n is the list of elements of Fin n. iota n = [n, n - 1, ..., 1] and range n = [0, ..., n - 1] are basic list constructions used for tactics. range' a b = [a, ..., a + b - 1] is there to help prove properties about them. Actual maths should use List.Ico instead.

@[simp]
theorem List.range'_one {s : } {step : } :
List.range' s 1 step = [s]
theorem List.pairwise_lt_range' (s : ) (n : ) (step : ) :
autoParam (0 < step) _auto✝List.Pairwise (fun (x x_1 : ) => x < x_1) (List.range' s n step)
theorem List.nodup_range' (s : ) (n : ) (step : ) (h : autoParam (0 < step) _auto✝) :
(List.range' s n step).Nodup
@[simp]
theorem List.nthLe_range' {n : } {m : } {step : } (i : ) (H : i < (List.range' n m step).length) :
(List.range' n m step).nthLe i H = n + step * i
theorem List.nthLe_range'_1 {n : } {m : } (i : ) (H : i < ().length) :
().nthLe i H = n + i
theorem List.pairwise_lt_range (n : ) :
List.Pairwise (fun (x x_1 : ) => x < x_1) ()
theorem List.pairwise_le_range (n : ) :
List.Pairwise (fun (x x_1 : ) => x x_1) ()
theorem List.take_range (m : ) (n : ) :
theorem List.nodup_range (n : ) :
().Nodup
theorem List.chain'_range_succ (r : Prop) (n : ) :
List.Chain' r (List.range n.succ) m < n, r m m.succ
theorem List.chain_range_succ (r : Prop) (n : ) (a : ) :
List.Chain r a (List.range n.succ) r a 0 m < n, r m m.succ
theorem List.pairwise_gt_iota (n : ) :
List.Pairwise (fun (x x_1 : ) => x > x_1) ()
theorem List.nodup_iota (n : ) :
().Nodup
def List.finRange (n : ) :
List (Fin n)

All elements of Fin n, from 0 to n-1. The corresponding finset is Finset.univ.

Equations
Instances For
@[simp]
theorem List.finRange_zero :
= []
@[simp]
theorem List.mem_finRange {n : } (a : Fin n) :
theorem List.nodup_finRange (n : ) :
().Nodup
@[simp]
theorem List.length_finRange (n : ) :
().length = n
@[simp]
theorem List.finRange_eq_nil {n : } :
= [] n = 0
theorem List.pairwise_lt_finRange (n : ) :
List.Pairwise (fun (x x_1 : Fin n) => x < x_1) ()
theorem List.pairwise_le_finRange (n : ) :
List.Pairwise (fun (x x_1 : Fin n) => x x_1) ()
theorem List.enum_eq_zip_range {α : Type u} (l : List α) :
l.enum = (List.range l.length).zip l
@[simp]
theorem List.unzip_enum_eq_prod {α : Type u} (l : List α) :
l.enum.unzip = (List.range l.length, l)
theorem List.enumFrom_eq_zip_range' {α : Type u} (l : List α) {n : } :
= (List.range' n l.length).zip l
@[simp]
theorem List.unzip_enumFrom_eq_prod {α : Type u} (l : List α) {n : } :
().unzip = (List.range' n l.length, l)
@[simp]
theorem List.nthLe_range {n : } (i : ) (H : i < ().length) :
().nthLe i H = i
@[simp]
theorem List.get_finRange {n : } {i : } (h : i < ().length) :
().get i, h = i,
@[simp]
theorem List.finRange_map_get {α : Type u} (l : List α) :
List.map l.get (List.finRange l.length) = l
@[simp]
theorem List.nthLe_finRange {n : } {i : } (h : i < ().length) :
().nthLe i h = i,
@[simp]
theorem List.indexOf_finRange {k : } (i : Fin k) :
= i
def List.ranges :
List ()

From l : List ℕ, construct l.ranges : List (List ℕ) such that l.ranges.map List.length = l and l.ranges.join = range l.sum

• Example: [1,2,3].ranges = [[0],[1,2],[3,4,5]]
Equations
Instances For
theorem List.ranges_disjoint (l : ) :
List.Pairwise List.Disjoint l.ranges

The members of l.ranges are pairwise disjoint

theorem List.ranges_length (l : ) :
List.map List.length l.ranges = l

The lengths of the members of l.ranges are those given by l

theorem List.ranges_join' (l : ) :
l.ranges.join =

See List.ranges_join for the version about List.sum.

theorem List.mem_mem_ranges_iff_lt_natSum (l : ) {n : } :
(sl.ranges, n s) n <

Any entry of any member of l.ranges is strictly smaller than Nat.sum l. See List.mem_mem_ranges_iff_lt_sum for the version about List.sum.

theorem List.ranges_nodup {l : } {s : } (hs : s l.ranges) :
s.Nodup

The members of l.ranges have no duplicate