@[protected]
def
fin2.cases'
{n : ℕ}
{C : fin2 n.succ → Sort u}
(H1 : C fin2.fz)
(H2 : Π (n_1 : fin2 n), C n_1.fs)
(i : fin2 n.succ) :
C i
Define a dependent function on fin2 (succ n)
by giving its value at
zero (H1
) and by giving a dependent function on the rest (H2
).
Equations
- fin2.cases' H1 H2 n_1.fs = H2 n_1
- fin2.cases' H1 H2 fin2.fz = H1
Ex falso. The dependent eliminator for the empty fin2 0
type.
insert_perm a
is a permutation of fin2 n
with the following properties:
insert_perm a i = i+1
ifi < a
insert_perm a a = 0
insert_perm a i = i
ifi > a
remap_left f k : fin2 (m + k) → fin2 (n + k)
applies the function
f : fin2 m → fin2 n
to inputs less than m
, and leaves the right part
on the right (that is, remap_left f k (m + i) = n + i
).
Equations
- fin2.remap_left f k.succ i.fs = (fin2.remap_left f k i).fs
- fin2.remap_left f k.succ fin2.fz = fin2.fz
- fin2.remap_left f 0 i = f i
@[class]
- h : m < n
This is a simple type class inference prover for proof obligations
of the form m < n
where m n : ℕ
.
Instances
@[protected, instance]
Equations
- fin2.is_lt.zero n = {h := _}
@[protected, instance]
Equations
- fin2.is_lt.succ m n = {h := _}
Use type class inference to infer the boundedness proof, so that we
can directly convert a nat
into a fin2 n
. This supports
notation like &1 : fin 3
.
Equations
- fin2.of_nat' m.succ = (fin2.of_nat' m).fs
- fin2.of_nat' 0 = fin2.fz
- fin2.of_nat' m = absurd h _
@[protected, instance]
Equations
- fin2.inhabited = {default := fin2.fz 0}