mathlib3 documentation

data.list.func

Lists as Functions #

THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.

Definitions for using lists as finite representations of finitely-supported functions with domain ℕ.

These include pointwise operations on lists, as well as get and set operations.

Notations #

An index notation is introduced in this file for setting a particular element of a list. With as as a list m as an index, and a as a new element, the notation is as {m ↦ a}.

So, for example [1, 3, 5] {1 ↦ 9} would result in [1, 9, 5]

This notation is in the locale list.func.

def list.func.neg {α : Type u} [has_neg α] (as : list α) :
list α

Elementwise negation of a list

Equations
@[simp]
def list.func.set {α : Type u} [inhabited α] (a : α) :

Update element of a list by index. If the index is out of range, extend the list with default elements

Equations
@[simp]
def list.func.get {α : Type u} [inhabited α] :
list α α

Get element of a list by index. If the index is out of range, return the default element

Equations
def list.func.equiv {α : Type u} [inhabited α] (as1 as2 : list α) :
Prop

Pointwise equality of lists. If lists are different lengths, compare with the default element.

Equations
@[simp]
def list.func.pointwise {α : Type u} {β : Type v} {γ : Type w} [inhabited α] [inhabited β] (f : α β γ) :
list α list β list γ

Pointwise operations on lists. If lists are different lengths, use the default element.

Equations
def list.func.add {α : Type u} [has_zero α] [has_add α] :
list α list α list α

Pointwise addition on lists. If lists are different lengths, use zero.

Equations
def list.func.sub {α : Type u} [has_zero α] [has_sub α] :
list α list α list α

Pointwise subtraction on lists. If lists are different lengths, use zero.

Equations
theorem list.func.length_set {α : Type u} {a : α} [inhabited α] {m : } {as : list α} :
@[simp]
theorem list.func.get_set {α : Type u} [inhabited α] {a : α} {k : } {as : list α} :
theorem list.func.eq_get_of_mem {α : Type u} [inhabited α] {a : α} {as : list α} :
a as ( (n : ), α a = list.func.get n as)
theorem list.func.mem_get_of_le {α : Type u} [inhabited α] {n : } {as : list α} :
theorem list.func.get_set_eq_of_ne {α : Type u} [inhabited α] {a : α} {as : list α} (k m : ) :
theorem list.func.get_map {α : Type u} {β : Type v} [inhabited α] [inhabited β] {f : α β} {n : } {as : list α} :
theorem list.func.get_map' {α : Type u} {β : Type v} [inhabited α] [inhabited β] {f : α β} {n : } {as : list α} :
theorem list.func.forall_val_of_forall_mem {α : Type u} [inhabited α] {as : list α} {p : α Prop} :
p inhabited.default ( (x : α), x as p x) (n : ), p (list.func.get n as)
theorem list.func.equiv_refl {α : Type u} {as : list α} [inhabited α] :
theorem list.func.equiv_symm {α : Type u} {as1 as2 : list α} [inhabited α] :
theorem list.func.equiv_trans {α : Type u} {as1 as2 as3 : list α} [inhabited α] :
theorem list.func.equiv_of_eq {α : Type u} {as1 as2 : list α} [inhabited α] :
as1 = as2 list.func.equiv as1 as2
theorem list.func.eq_of_equiv {α : Type u} [inhabited α] {as1 as2 : list α} :
as1.length = as2.length list.func.equiv as1 as2 as1 = as2
@[simp]
theorem list.func.get_neg {α : Type u} [add_group α] {k : } {as : list α} :
@[simp]
theorem list.func.length_neg {α : Type u} [has_neg α] (as : list α) :
theorem list.func.nil_pointwise {α : Type u} {β : Type v} {γ : Type w} [inhabited α] [inhabited β] {f : α β γ} (bs : list β) :
theorem list.func.pointwise_nil {α : Type u} {β : Type v} {γ : Type w} [inhabited α] [inhabited β] {f : α β γ} (as : list α) :
theorem list.func.get_pointwise {α : Type u} {β : Type v} {γ : Type w} [inhabited α] [inhabited β] [inhabited γ] {f : α β γ} (h1 : f inhabited.default inhabited.default = inhabited.default) (k : ) (as : list α) (bs : list β) :
theorem list.func.length_pointwise {α : Type u} {β : Type v} {γ : Type w} [inhabited α] [inhabited β] {f : α β γ} {as : list α} {bs : list β} :
@[simp]
theorem list.func.get_add {α : Type u} [add_monoid α] {k : } {xs ys : list α} :
@[simp]
theorem list.func.length_add {α : Type u} [has_zero α] [has_add α] {xs ys : list α} :
@[simp]
theorem list.func.nil_add {α : Type u} [add_monoid α] (as : list α) :
@[simp]
theorem list.func.add_nil {α : Type u} [add_monoid α] (as : list α) :
theorem list.func.map_add_map {α : Type u} [add_monoid α] (f g : α α) {as : list α} :
list.func.add (list.map f as) (list.map g as) = list.map (λ (x : α), f x + g x) as
@[simp]
theorem list.func.get_sub {α : Type u} [add_group α] {k : } {xs ys : list α} :
@[simp]
theorem list.func.length_sub {α : Type u} [has_zero α] [has_sub α] {xs ys : list α} :
@[simp]
theorem list.func.nil_sub {α : Type u_1} [add_group α] (as : list α) :
@[simp]
theorem list.func.sub_nil {α : Type u_1} [add_group α] (as : list α) :