Mathlib.Data.Fin.Tuple.Reflection
25 declarations. Mathlib docs · Source
Lemmas for tuples Fin m → α
This file contains alternative definitions of common operators on vectors which expand
definitionally to the expected expression when evaluated on ![] notation.
This allows "proof by reflection", where we prove f = ![f 0, f 1] by defining
FinVec.etaExpand f to be equal to the RHS definitionally, and then prove that
f = etaExpand f.
The definitions in this file should normally not be used directly; the intent is for the
corresponding *_eq lemmas to be used in a place where they are definitionally unfolded.
Main definitions
FinVec.seqFinVec.mapFinVec.sumFinVec.etaExpand
theorem FinVec.seq.match_1.congr_eq_2 E1 #
∀ {α : Type u_2} {β : Type u_3} (motive : (x : ℕ) → (Fin x → α → β) → (Fin x → α) → Sort u_1) (x : ℕ)
(x_1 : Fin x → α → β) (x_2 : Fin x → α) (h_1 : (x : Fin 0 → α → β) → (x_3 : Fin 0 → α) → motive 0 x x_3)
(h_2 : (n : ℕ) → (f : Fin (n + 1) → α → β) → (v : Fin (n + 1) → α) → motive n.succ f v) (n : ℕ)
(f : Fin (n + 1) → α → β) (v : Fin (n + 1) → α),
x = n.succ →
x_1 ≍ f →
x_2 ≍ v →
(match x, x_1, x_2 with
| 0, x, x_3 => h_1 x x_3
| n.succ, f, v => h_2 n f v) ≍
h_2 n f v
theorem FinVec.Forall.match_1.congr_eq_1 E1 #
∀ {α : Type u_2} (motive : (x : ℕ) → ((Fin x → α) → Prop) → Sort u_1) (x : ℕ) (x_1 : (Fin x → α) → Prop)
(h_1 : (P : (Fin 0 → α) → Prop) → motive 0 P) (h_2 : (n : ℕ) → (P : (Fin (n + 1) → α) → Prop) → motive n.succ P)
(P : (Fin 0 → α) → Prop),
x = 0 →
x_1 ≍ P →
(match x, x_1 with
| 0, P => h_1 P
| n.succ, P => h_2 n P) ≍
h_1 P
theorem FinVec.sum.match_1.congr_eq_3 E1 #
∀ {α : Type u_2} (motive : (x : ℕ) → (Fin x → α) → Sort u_1) (x : ℕ) (x_1 : Fin x → α)
(h_1 : (x : Fin 0 → α) → motive 0 x) (h_2 : (v : Fin 1 → α) → motive 1 v)
(h_3 : (n : ℕ) → (v : Fin (n + 2) → α) → motive n.succ.succ v) (n : ℕ) (v : Fin (n + 2) → α),
x = n.succ.succ →
x_1 ≍ v →
(match x, x_1 with
| 0, x => h_1 x
| 1, v => h_2 v
| n.succ.succ, v => h_3 n v) ≍
h_3 n v
theorem FinVec.seq.match_1.congr_eq_1 E1 #
∀ {α : Type u_2} {β : Type u_3} (motive : (x : ℕ) → (Fin x → α → β) → (Fin x → α) → Sort u_1) (x : ℕ)
(x_1 : Fin x → α → β) (x_2 : Fin x → α) (h_1 : (x : Fin 0 → α → β) → (x_3 : Fin 0 → α) → motive 0 x x_3)
(h_2 : (n : ℕ) → (f : Fin (n + 1) → α → β) → (v : Fin (n + 1) → α) → motive n.succ f v) (x_3 : Fin 0 → α → β)
(x_4 : Fin 0 → α),
x = 0 →
x_1 ≍ x_3 →
x_2 ≍ x_4 →
(match x, x_1, x_2 with
| 0, x, x_5 => h_1 x x_5
| n.succ, f, v => h_2 n f v) ≍
h_1 x_3 x_4
theorem FinVec.Forall.match_1.congr_eq_2 E1 #
∀ {α : Type u_2} (motive : (x : ℕ) → ((Fin x → α) → Prop) → Sort u_1) (x : ℕ) (x_1 : (Fin x → α) → Prop)
(h_1 : (P : (Fin 0 → α) → Prop) → motive 0 P) (h_2 : (n : ℕ) → (P : (Fin (n + 1) → α) → Prop) → motive n.succ P)
(n : ℕ) (P : (Fin (n + 1) → α) → Prop),
x = n.succ →
x_1 ≍ P →
(match x, x_1 with
| 0, P => h_1 P
| n.succ, P => h_2 n P) ≍
h_2 n P
theorem FinVec.sum.match_1.congr_eq_1 E1 #
∀ {α : Type u_2} (motive : (x : ℕ) → (Fin x → α) → Sort u_1) (x : ℕ) (x_1 : Fin x → α)
(h_1 : (x : Fin 0 → α) → motive 0 x) (h_2 : (v : Fin 1 → α) → motive 1 v)
(h_3 : (n : ℕ) → (v : Fin (n + 2) → α) → motive n.succ.succ v) (x_2 : Fin 0 → α),
x = 0 →
x_1 ≍ x_2 →
(match x, x_1 with
| 0, x => h_1 x
| 1, v => h_2 v
| n.succ.succ, v => h_3 n v) ≍
h_1 x_2
theorem FinVec.sum.match_1.congr_eq_2 E1 #
∀ {α : Type u_2} (motive : (x : ℕ) → (Fin x → α) → Sort u_1) (x : ℕ) (x_1 : Fin x → α)
(h_1 : (x : Fin 0 → α) → motive 0 x) (h_2 : (v : Fin 1 → α) → motive 1 v)
(h_3 : (n : ℕ) → (v : Fin (n + 2) → α) → motive n.succ.succ v) (v : Fin 1 → α),
x = 1 →
x_1 ≍ v →
(match x, x_1 with
| 0, x => h_1 x
| 1, v => h_2 v
| n.succ.succ, v => h_3 n v) ≍
h_2 v
def FinVec.seq E3 #
{α : Type u_1} → {β : Type u_2} → {m : ℕ} → (Fin m → α → β) → (Fin m → α) → Fin m → β
Evaluate FinVec.seq f v = ![(f 0) (v 0), (f 1) (v 1), ...]
theorem FinVec.seq_eq E0 #
∀ {α : Type u_1} {β : Type u_2} {m : ℕ} (f : Fin m → α → β) (v : Fin m → α), FinVec.seq f v = fun i ↦ f i (v i)
def FinVec.map E3 #
{α : Type u_1} → {β : Type u_2} → (α → β) → {m : ℕ} → (Fin m → α) → Fin m → β
FinVec.map f v = ![f (v 0), f (v 1), ...]
theorem FinVec.map_eq E0 #
∀ {α : Type u_1} {β : Type u_2} (f : α → β) {m : ℕ} (v : Fin m → α), FinVec.map f v = f ∘ v
This can be used to prove
example {f : α → β} (a₁ a₂ : α) : f ∘ ![a₁, a₂] = ![f a₁, f a₂] :=
(map_eq _ _).symm
def FinVec.etaExpand E3 #
{α : Type u_1} → {m : ℕ} → (Fin m → α) → Fin m → α
Expand v to ![v 0, v 1, ...]
theorem FinVec.etaExpand_eq E0 #
∀ {α : Type u_1} {m : ℕ} (v : Fin m → α), FinVec.etaExpand v = v
This can be used to prove
example (a : Fin 2 → α) : a = ![a 0, a 1] :=
(etaExpand_eq _).symm
def FinVec.Forall E1 #
{α : Type u_1} → {m : ℕ} → ((Fin m → α) → Prop) → Prop
∀ with better defeq for ∀ x : Fin m → α, P x.
theorem FinVec.forall_iff E0 #
∀ {α : Type u_1} {m : ℕ} (P : (Fin m → α) → Prop), FinVec.Forall P ↔ ∀ (x : Fin m → α), P x
This can be used to prove
example (P : (Fin 2 → α) → Prop) : (∀ f, P f) ↔ ∀ a₀ a₁, P ![a₀, a₁] :=
(forall_iff _).symm
def FinVec.Exists E1 #
{α : Type u_1} → {m : ℕ} → ((Fin m → α) → Prop) → Prop
∃ with better defeq for ∃ x : Fin m → α, P x.
theorem FinVec.exists_iff E0 #
∀ {α : Type u_1} {m : ℕ} (P : (Fin m → α) → Prop), FinVec.Exists P ↔ ∃ x, P x
This can be used to prove
example (P : (Fin 2 → α) → Prop) : (∃ f, P f) ↔ ∃ a₀ a₁, P ![a₀, a₁] :=
(exists_iff _).symm
def FinVec.sum E3 #
{α : Type u_1} → [Add α] → [Zero α] → {m : ℕ} → (Fin m → α) → α
Finset.univ.sum with better defeq for Fin.
def FinVec.prod E1 #
{α : Type u_1} → [Mul α] → [One α] → {m : ℕ} → (Fin m → α) → α
Finset.univ.prod with better defeq for Fin.
theorem FinVec.prod_eq E0 #
∀ {α : Type u_1} [inst : CommMonoid α] {m : ℕ} (a : Fin m → α), FinVec.prod a = ∏ i, a i
This can be used to prove
example [CommMonoid α] (a : Fin 3 → α) : ∏ i, a i = a 0 * a 1 * a 2 :=
(prod_eq _).symm
theorem FinVec.sum_eq E0 #
∀ {α : Type u_1} [inst : AddCommMonoid α] {m : ℕ} (a : Fin m → α), FinVec.sum a = ∑ i, a i
This can be used to prove
example [AddCommMonoid α] (a : Fin 3 → α) : ∑ i, a i = a 0 + a 1 + a 2 :=
(sum_eq _).symm
def FinVec.mkProdEqQ E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
(inst : Q(CommMonoid «$α»)) →
(n : ℕ) → (f : Q(Fin «$n» → «$α»)) → Lean.MetaM ((val : Q(«$α»)) × Q(∏ i, «$f» i = «$val»))
Produce a term of the form f 0 * f 1 * ... * f (n - 1) and an application of FinVec.prod_eq
that shows it is equal to ∏ i, f i.
def FinVec.mkSumEqQ E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
(inst : Q(AddCommMonoid «$α»)) →
(n : ℕ) → (f : Q(Fin «$n» → «$α»)) → Lean.MetaM ((val : Q(«$α»)) × Q(∑ i, «$f» i = «$val»))
Produce a term of the form f 0 + f 1 + ... + f (n - 1) and an application of FinVec.sum_eq
that shows it is equal to ∑ i, f i.
def Fin.prod_univ_ofNat E1 #
Lean.Meta.Simp.Simproc
Rewrites ∏ i : Fin n, f i as f 0 * f 1 * ... * f (n - 1) when n is a numeral.
def Fin.sum_univ_ofNat E1 #
Lean.Meta.Simp.Simproc
Rewrites ∑ i : Fin n, f i as f 0 + f 1 + ... + f (n - 1) when n is a numeral.