Finite functions #
Given types α and β, and assuming that β has a Zero element,
a FinFun α β is a function from α to β where only a finite number of elements
in α are mapped to non-zero elements.
A FinFun is a function fn with a finite support.
This is similar to Finsupp in Mathlib, but definitions are computable.
Equations
- Cslib.FinFun.«term_→₀_» = Lean.ParserDescr.trailingNode `Cslib.FinFun.«term_→₀_» 25 26 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " →₀ ") (Lean.ParserDescr.cat `term 25))
Instances For
Constructs a FinFun by restricting a function to a given support, filtering out all elements
not mapped to 0 in the support.
Equations
- Cslib.FinFun.«term_↾₀_» = Lean.ParserDescr.trailingNode `Cslib.FinFun.«term_↾₀_» 1022 25 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "↾₀") (Lean.ParserDescr.cat `term 51))
Instances For
Equations
- Cslib.FinFun.instFunLike = { coe := fun (f : Cslib.FinFun α β) => f.fn, coe_injective' := ⋯ }
theorem
Cslib.FinFun.fromFun_eq
{β : Type u_1}
{α : Type u_2}
[Zero β]
[DecidableEq α]
[(y : β) → Decidable (y = 0)]
(f : α → β)
(support : Finset α)
(h : ∀ a ∉ support, f a = 0)
:
theorem
Cslib.FinFun.fromFun_support
{β : Type u_1}
{α : Type u_2}
[Zero β]
[DecidableEq α]
[(y : β) → Decidable (y = 0)]
(f : α → β)
(support : Finset α)
:
theorem
Cslib.FinFun.fromFun_idem
{β : Type u_1}
{α : Type u_2}
[Zero β]
[DecidableEq α]
[(y : β) → Decidable (y = 0)]
{f : α → β}
{support : Finset α}
:
Cslib.FinFun.fromFun✝ (⇑(Cslib.FinFun.fromFun✝¹ f support)) support = Cslib.FinFun.fromFun✝² f support
Restricting a function twice to the same support is idempotent.
theorem
Cslib.FinFun.coe_fromFun_id
{β : Type u_1}
{α : Type u_2}
[Zero β]
[DecidableEq α]
[(y : β) → Decidable (y = 0)]
{f : FinFun α β}
:
Restricting a FinFun to its own support is the identity.
theorem
Cslib.FinFun.fromFun_inter
{β : Type u_1}
{α : Type u_2}
[Zero β]
[DecidableEq α]
[(y : β) → Decidable (y = 0)]
{f : α → β}
{support1 support2 : Finset α}
:
Cslib.FinFun.fromFun✝ (⇑(Cslib.FinFun.fromFun✝¹ f support1)) support2 = Cslib.FinFun.fromFun✝² f (support1 ∩ support2)
Restricting a function twice to two supports is equal to restricting to their intersection.
theorem
Cslib.FinFun.fromFun_comm
{β : Type u_1}
{α : Type u_2}
[Zero β]
[DecidableEq α]
[(y : β) → Decidable (y = 0)]
{f : α → β}
{support1 support2 : Finset α}
:
Cslib.FinFun.fromFun✝ (⇑(Cslib.FinFun.fromFun✝¹ f support1)) support2 = Cslib.FinFun.fromFun✝² (⇑(Cslib.FinFun.fromFun✝³ f support2)) support1
Restricting a function is commutative.