File: Mathlib/Data/Fin/Fin2.lean

full_name: Fin2.fs
code: /-- An alternate definition of `Fin n` defined as an inductive type instead of a subtype of `ℕ`. -/
inductive Fin2 : ℕ → Type
  /-- `0` as a member of `Fin (n + 1)` (`Fin 0` is empty) -/
  | fz {n} : Fin2 (n + 1)
  /-- `n` as a member of `Fin (n + 1)` -/
  | fs {n} : Fin2 n → Fin2 (n + 1)
goal: Fin2 n → Fin2 (n + 1)

full_name: Fin2.fz
code: /-- An alternate definition of `Fin n` defined as an inductive type instead of a subtype of `ℕ`. -/
inductive Fin2 : ℕ → Type
  /-- `0` as a member of `Fin (n + 1)` (`Fin 0` is empty) -/
  | fz {n} : Fin2 (n + 1)
  /-- `n` as a member of `Fin (n + 1)` -/
  | fs {n} : Fin2 n → Fin2 (n + 1)
goal: Fin2 (n + 1)

full_name: Fin2
code: /-- An alternate definition of `Fin n` defined as an inductive type instead of a subtype of `ℕ`. -/
inductive Fin2 : ℕ → Type
  /-- `0` as a member of `Fin (n + 1)` (`Fin 0` is empty) -/
  | fz {n} : Fin2 (n + 1)
  /-- `n` as a member of `Fin (n + 1)` -/
  | fs {n} : Fin2 n → Fin2 (n + 1)
goal: ℕ → Type

full_name: Fin2.cases'
code: /-- 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`). -/
@[elab_as_elim]
protected def cases' {n} {C : Fin2 (succ n) → Sort u} (H1 : C fz) (H2 : ∀ n, C (fs n)) :
    ∀ i : Fin2 (succ n), C i
  
goal: C i

full_name: Fin2.elim0
code: /-- Ex falso. The dependent eliminator for the empty `Fin2 0` type. -/
def elim0 {C : Fin2 0 → Sort u} : ∀ i : Fin2 0, C i 
goal: C i

full_name: Fin2.toNat
code: /-- Converts a `Fin2` into a natural. -/
def toNat : ∀ {n}, Fin2 n → ℕ
  
goal: Fin2 n → ℕ

full_name: Fin2.optOfNat
code: /-- Converts a natural into a `Fin2` if it is in range -/
def optOfNat : ∀ {n}, ℕ → Option (Fin2 n)
  
goal: ℕ → Option (Fin2 n)

full_name: Fin2.add
code: /-- `i + k : Fin2 (n + k)` when `i : Fin2 n` and `k : ℕ` -/
def add {n} (i : Fin2 n) : ∀ k, Fin2 (n + k)
  
goal: Fin2 (n + k)

full_name: Fin2.left
code: /-- `left k` is the embedding `Fin2 n → Fin2 (k + n)` -/
def left (k) : ∀ {n}, Fin2 n → Fin2 (k + n)
  
goal: Fin2 n → Fin2 (k + n)

full_name: Fin2.insertPerm
code: /-- `insertPerm a` is a permutation of `Fin2 n` with the following properties:
  * `insertPerm a i = i+1` if `i < a`
  * `insertPerm a a = 0`
  * `insertPerm a i = i` if `i > a` -/
def insertPerm : ∀ {n}, Fin2 n → Fin2 n → Fin2 n
  
goal: Fin2 n → Fin2 n → Fin2 n

full_name: Fin2.remapLeft
code: /-- `remapLeft 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, `remapLeft f k (m + i) = n + i`). -/
def remapLeft {m n} (f : Fin2 m → Fin2 n) : ∀ k, Fin2 (m + k) → Fin2 (n + k)
  
goal: Fin2 (m + k) → Fin2 (n + k)

full_name: Fin2.IsLT
code: /-- This is a simple type class inference prover for proof obligations
  of the form `m < n` where `m n : ℕ`. -/
class IsLT (m n : ℕ) : Prop where
  /-- The unique field of `Fin2.IsLT`, a proof that `m < n`. -/
  h : m < n
goal: Prop

full_name: Fin2.IsLT.h
code: /-- This is a simple type class inference prover for proof obligations
  of the form `m < n` where `m n : ℕ`. -/
class IsLT (m n : ℕ) : Prop where
  /-- The unique field of `Fin2.IsLT`, a proof that `m < n`. -/
  h : m < n
goal: m < n

full_name: Fin2.IsLT.zero
code: instance IsLT.zero (n) : IsLT 0 (succ n) 
goal: Fin2.IsLT 0 n.succ

full_name: Fin2.IsLT.succ
code: instance IsLT.succ (m n) [l : IsLT m n] : IsLT (succ m) (succ n) 
goal: Fin2.IsLT m.succ n.succ

full_name: Fin2.ofNat'
code: /-- 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`. -/
def ofNat' : ∀ {n} (m) [IsLT m n], Fin2 n
  
goal: Fin2 n

full_name: Fin2.castSucc
code: /-- `castSucc i` embeds `i : Fin2 n` in `Fin2 (n+1)`. -/
def castSucc {n} : Fin2 n → Fin2 (n + 1)
  
goal: Fin2 n → Fin2 (n + 1)

full_name: Fin2.last
code: /-- The greatest value of `Fin2 (n+1)`. -/
def last : {n : Nat} → Fin2 (n+1)
  
goal: Fin2 (n + 1)

full_name: Fin2.rev
code: /-- Maps `0` to `n-1`, `1` to `n-2`, ..., `n-1` to `0`. -/
def rev {n : Nat} : Fin2 n → Fin2 n
  
goal: Fin2 n → Fin2 n

full_name: Fin2.rev_last
code: @[simp] lemma rev_last {n} : rev (@last n) = fz 
goal: Fin2.last.rev = Fin2.fz

full_name: Fin2.rev_castSucc
code: @[simp] lemma rev_castSucc {n} (i : Fin2 n) : rev (castSucc i) = fs (rev i) 
goal: i.castSucc.rev = i.rev.fs

full_name: Fin2.rev_rev
code: @[simp] lemma rev_rev {n} (i : Fin2 n) : i.rev.rev = i 
goal: i.rev.rev = i

full_name: Fin2.rev_involutive
code: theorem rev_involutive {n} : Function.Involutive (@rev n) 
goal: Function.Involutive Fin2.rev

full_name: Fin2.«_aux_Mathlib_Data_Fin_Fin2___macroRules_Fin2_term&__1»
code: @[inherit_doc] local prefix:arg "&" => ofNat'
goal: Lean.Macro

full_name: Fin2._aux_Mathlib_Data_Fin_Fin2___unexpand_Fin2_ofNat'_1
code: @[inherit_doc] local prefix:arg "&" => ofNat'
goal: Lean.PrettyPrinter.Unexpander

full_name: Fin2.instInhabitedOfNatNat
code: instance : Inhabited (Fin2 1) 
goal: Inhabited (Fin2 1)

full_name: Fin2.instFintype
code: instance instFintype : ∀ n, Fintype (Fin2 n)
  
goal: Fintype (Fin2 n)