File: .lake/packages/lean4/src/lean/Init/Data/List/BasicAux.lean

full_name: List.get!
code: /--
Returns the `i`-th element in the list (zero-based).

If the index is out of bounds (`i ≥ as.length`), this function panics when executed, and returns
`default`. See `get?` and `getD` for safer alternatives.
-/
def get! [Inhabited α] : (as : List α) → (i : Nat) → α
  
goal: α

full_name: List.get!_nil
code: theorem get!_nil [Inhabited α] (n : Nat) : [].get! n = (default : α) 
goal: [].get! n = default

full_name: List.get!_cons_succ
code: theorem get!_cons_succ [Inhabited α] (l : List α) (a : α) (n : Nat) :
    (a::l).get! (n+1) = get! l n 
goal: (a :: l).get! (n + 1) = l.get! n

full_name: List.get!_cons_zero
code: theorem get!_cons_zero [Inhabited α] (l : List α) (a : α) : (a::l).get! 0 = a 
goal: (a :: l).get! 0 = a

full_name: List.getLast!
code: /--
Returns the last element in the list.

If the list is empty, this function panics when executed, and returns `default`.
See `getLast` and `getLastD` for safer alternatives.
-/
def getLast! [Inhabited α] : List α → α
  
goal: List α → α

full_name: List.head!
code: /--
Returns the first element in the list.

If the list is empty, this function panics when executed, and returns `default`.
See `head` and `headD` for safer alternatives.
-/
def head! [Inhabited α] : List α → α
  
goal: List α → α

full_name: List.tail!
code: /--
Drops the first element of the list.

If the list is empty, this function panics when executed, and returns the empty list.
See `tail` and `tailD` for safer alternatives.
-/
def tail! : List α → List α
  
goal: List α → List α

full_name: List.tail!_cons
code: @[simp] theorem tail!_cons : @tail! α (a::l) = l 
goal: (a :: l).tail! = l

full_name: List.partitionM
code: /--
Monadic generalization of `List.partition`.

This uses `Array.toList` and which isn't imported by `Init.Data.List.Basic` or `Init.Data.List.Control`.
```
def posOrNeg (x : Int) : Except String Bool :=
  if x > 0 then pure true
  else if x < 0 then pure false
  else throw "Zero is not positive or negative"

partitionM posOrNeg [-1, 2, 3] = Except.ok ([2, 3], [-1])
partitionM posOrNeg [0, 2, 3] = Except.error "Zero is not positive or negative"
```
-/
@[inline] def partitionM [Monad m] (p : α → m Bool) (l : List α) : m (List α × List α) 
goal: m (List α × List α)

full_name: List.partitionM.go
code: /--
Monadic generalization of `List.partition`.

This uses `Array.toList` and which isn't imported by `Init.Data.List.Basic` or `Init.Data.List.Control`.
```
def posOrNeg (x : Int) : Except String Bool :=
  if x > 0 then pure true
  else if x < 0 then pure false
  else throw "Zero is not positive or negative"

partitionM posOrNeg [-1, 2, 3] = Except.ok ([2, 3], [-1])
partitionM posOrNeg [0, 2, 3] = Except.error "Zero is not positive or negative"
```
-/
@[inline] def partitionM [Monad m] (p : α → m Bool) (l : List α) : m (List α × List α) 
goal: List α → Array α → Array α → m (List α × List α)

full_name: List.partitionMap.go
code: /--
Given a function `f : α → β ⊕ γ`, `partitionMap f l` maps the list by `f`
whilst partitioning the result into a pair of lists, `List β × List γ`,
partitioning the `.inl _` into the left list, and the `.inr _` into the right List.
```
partitionMap (id : Nat ⊕ Nat → Nat ⊕ Nat) [inl 0, inr 1, inl 2] = ([0, 2], [1])
```
-/
@[inline] def partitionMap (f : α → β ⊕ γ) (l : List α) : List β × List γ 
goal: List α → Array β → Array γ → List β × List γ

full_name: List.partitionMap
code: /--
Given a function `f : α → β ⊕ γ`, `partitionMap f l` maps the list by `f`
whilst partitioning the result into a pair of lists, `List β × List γ`,
partitioning the `.inl _` into the left list, and the `.inr _` into the right List.
```
partitionMap (id : Nat ⊕ Nat → Nat ⊕ Nat) [inl 0, inr 1, inl 2] = ([0, 2], [1])
```
-/
@[inline] def partitionMap (f : α → β ⊕ γ) (l : List α) : List β × List γ 
goal: List β × List γ

full_name: _private.«.lake».packages.lean4.src.lean.Init.Data.List.BasicAux.0.List.mapMonoMImp
code: @[specialize] private unsafe def mapMonoMImp [Monad m] (as : List α) (f : α → m α) : m (List α) 
goal: m (List α)

full_name: List.mapMonoM
code: /--
Monomorphic `List.mapM`. The internal implementation uses pointer equality, and does not allocate a new list
if the result of each `f a` is a pointer equal value `a`.
-/
@[implemented_by mapMonoMImp] def mapMonoM [Monad m] (as : List α) (f : α → m α) : m (List α) 
goal: m (List α)

full_name: List.mapMono
code: def mapMono (as : List α) (f : α → α) : List α 
goal: List α

full_name: List.getElem_append_left
code: theorem getElem_append_left (as bs : List α) (h : i < as.length) {h'} : (as ++ bs)[i] = as[i] 
goal: (as ++ bs)[i] = as[i]

full_name: List.getElem_append_right
code: theorem getElem_append_right (as bs : List α) (h : ¬ i < as.length) {h' h''} : (as ++ bs)[i]'h' = bs[i - as.length]'h'' 
goal: (as ++ bs)[i] = bs[i - as.length]

full_name: List.get_last
code: theorem get_last {as : List α} {i : Fin (length (as ++ [a]))} (h : ¬ i.1 < as.length) : (as ++ [a] : List _).get i = a 
goal: (as ++ [a]).get i = a

full_name: List.sizeOf_lt_of_mem
code: theorem sizeOf_lt_of_mem [SizeOf α] {as : List α} (h : a ∈ as) : sizeOf a < sizeOf as 
goal: sizeOf a < sizeOf as

full_name: List.«_aux_.lake_packages_lean4_src_lean_Init_Data_List_BasicAux___macroRules_List_tacticSizeOf_list_dec_1»
code: macro "sizeOf_list_dec" : tactic =>
  `(tactic| first
    | with_reducible apply sizeOf_lt_of_mem; assumption; done
    | with_reducible
        apply Nat.lt_trans (sizeOf_lt_of_mem ?h)
        case' h => assumption
      simp_arith)
goal: Lean.Macro

full_name: List.tacticSizeOf_list_dec
code: macro "sizeOf_list_dec" : tactic =>
  `(tactic| first
    | with_reducible apply sizeOf_lt_of_mem; assumption; done
    | with_reducible
        apply Nat.lt_trans (sizeOf_lt_of_mem ?h)
        case' h => assumption
      simp_arith)
goal: Lean.ParserDescr

full_name: List.«_aux_.lake_packages_lean4_src_lean_Init_Data_List_BasicAux___macroRules_tacticDecreasing_trivial_1»
code: macro_rules | `(tactic| decreasing_trivial) => `(tactic| sizeOf_list_dec)
goal: Lean.Macro

full_name: List.append_cancel_left
code: theorem append_cancel_left {as bs cs : List α} (h : as ++ bs = as ++ cs) : bs = cs 
goal: bs = cs

full_name: List.append_cancel_right
code: theorem append_cancel_right {as bs cs : List α} (h : as ++ bs = cs ++ bs) : as = cs 
goal: as = cs

full_name: List.append_cancel_left_eq
code: @[simp] theorem append_cancel_left_eq (as bs cs : List α) : (as ++ bs = as ++ cs) = (bs = cs) 
goal: (as ++ bs = as ++ cs) = (bs = cs)

full_name: List.append_cancel_right_eq
code: @[simp] theorem append_cancel_right_eq (as bs cs : List α) : (as ++ bs = cs ++ bs) = (as = cs) 
goal: (as ++ bs = cs ++ bs) = (as = cs)

full_name: List.sizeOf_get
code: @[simp] theorem sizeOf_get [SizeOf α] (as : List α) (i : Fin as.length) : sizeOf (as.get i) < sizeOf as 
goal: sizeOf (as.get i) < sizeOf as

full_name: List.le_antisymm
code: theorem le_antisymm [LT α] [s : Antisymm (¬ · < · : α → α → Prop)] {as bs : List α} (h₁ : as ≤ bs) (h₂ : bs ≤ as) : as = bs 
goal: as = bs

full_name: List.«instAntisymmLeOfNotLt_.lake»
code: instance [LT α] [Antisymm (¬ · < · : α → α → Prop)] : Antisymm (· ≤ · : List α → List α → Prop) 
goal: Antisymm fun x x_1 => x ≤ x_1