Documentation

CslibFrontier.Foundations.Data.Fin.Decode

Partial decoding into a finite type #

Fin.ofNat? n x decodes x as an element of Fin n when it is in range and returns none otherwise.

Main definitions #

Main results #

References #

This elementary decoder is original to this module.

def Fin.ofNat? (n x : ℕ) :

Decode a natural number as an element of Fin n, rejecting out-of-range values.

@[simp]
theorem Fin.ofNat?_eq_some_of_lt (n x : ℕ) (h : x < n) :
@[simp]
theorem Fin.ofNat?_eq_none_of_not_lt (n x : ℕ) (h : ¬x < n) :