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.
All elements of Fin n, from 0 to n-1. The corresponding finset is Finset.univ.
Equations
- List.finRange n = List.pmap Fin.mk (List.range n) ⋯
Instances For
A variant of sum_range_succ which pulls off the first term in the sum rather than the last.
A variant of prod_range_succ which pulls off the first
term in the product rather than the last.
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
- List.ranges [] = []
- List.ranges (a :: l) = List.range a :: List.map (List.map fun (x : ℕ) => a + x) (List.ranges l)
Instances For
The members of l.ranges are pairwise disjoint
The lengths of the members of l.ranges are those given by l
The members of l.ranges have no duplicate