Documentation

APAP.Prereqs.Convolution.Discrete.Basic

Convolution #

This file defines several versions of the discrete convolution of functions.

Main declarations #

Notation #

Notes #

Some lemmas could technically be generalised to a non-commutative semiring domain. Doesn't seem very useful given that the codomain in applications is either , ℝ≥0 or .

Similarly we could drop the commutativity assumption on the domain, but this is unneeded at this point in time.

TODO #

Multiplicativise? Probably ugly and not very useful.

Convolution of functions #

In this section, we define the convolution f ∗ᵈ g and difference convolution f ○ᵈ g of functions f g : G → R, and show how they interact.

theorem indicator_one_ddconv_indicator_one_eq_sum {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [CommSemiring R] (s t : Finset G) (a : G) :
(((↑s).indicator fun (x : G) => 1) ∗ᵈ (↑t).indicator fun (x : G) => 1) a = {xs ×ˢ t | x.1 + x.2 = a}.card
theorem indicator_one_ddconv {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [CommSemiring R] (s : Finset G) (f : GR) :
((↑s).indicator fun (x : G) => 1) ∗ᵈ f = as, translate a f
theorem ddconv_indicator_one {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [CommSemiring R] (f : GR) (s : Finset G) :
(f ∗ᵈ (↑s).indicator fun (x : G) => 1) = as, translate a f
theorem indicator_one_ddconv_indicator_one_eq_card_vadd_inter_neg {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [CommSemiring R] (s t : Finset G) (a : G) :
(((↑s).indicator fun (x : G) => 1) ∗ᵈ (↑t).indicator fun (x : G) => 1) a = ((-a +ᵥ s) -t).card
theorem indicator_one_dddconv_Set.indicator_apply {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [CommSemiring R] [StarRing R] (s t : Finset G) (a : G) :
(((↑s).indicator fun (x : G) => 1) ○ᵈ (↑t).indicator fun (x : G) => 1) a = {xs ×ˢ t | x.1 - x.2 = a}.card
theorem indicator_one_dddconv {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [CommSemiring R] [StarRing R] (s : Finset G) (f : GR) :
((↑s).indicator fun (x : G) => 1) ○ᵈ f = as, translate a (conjneg f)
theorem dddconv_indicator_one {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [CommSemiring R] [StarRing R] (f : GR) (s : Finset G) :
(f ○ᵈ (↑s).indicator fun (x : G) => 1) = as, translate (-a) f
theorem mu_ddconv {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [Semifield R] (s : Finset G) (f : GR) :
mu s ∗ᵈ f = (↑s.card)⁻¹ as, translate a f
theorem ddconv_mu {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [Semifield R] (f : GR) (s : Finset G) :
f ∗ᵈ mu s = (↑s.card)⁻¹ as, translate a f
theorem mu_dddconv {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [Semifield R] [StarRing R] (s : Finset G) (f : GR) :
mu s ○ᵈ f = (↑s.card)⁻¹ as, translate a (conjneg f)
theorem dddconv_mu {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [Semifield R] [StarRing R] (f : GR) (s : Finset G) :
f ○ᵈ mu s = (↑s.card)⁻¹ as, translate (-a) f
theorem expect_ddconv {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [Semifield R] [CharZero R] (f g : GR) :
(Finset.univ.expect fun (a : G) => (f ∗ᵈ g) a) = (∑ a : G, f a) * Finset.univ.expect fun (a : G) => g a
theorem expect_ddconv' {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [Semifield R] [CharZero R] (f g : GR) :
(Finset.univ.expect fun (a : G) => (f ∗ᵈ g) a) = (Finset.univ.expect fun (a : G) => f a) * a : G, g a
theorem expect_dddconv {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [Semifield R] [CharZero R] [StarRing R] (f g : GR) :
(Finset.univ.expect fun (a : G) => (f ○ᵈ g) a) = (∑ a : G, f a) * Finset.univ.expect fun (a : G) => (starRingEnd R) (g a)
theorem expect_dddconv' {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [Semifield R] [CharZero R] [StarRing R] (f g : GR) :
(Finset.univ.expect fun (a : G) => (f ○ᵈ g) a) = (Finset.univ.expect fun (a : G) => f a) * a : G, (starRingEnd R) (g a)
@[simp]
theorem balance_ddconv {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [Field R] [CharZero R] (f g : GR) :
@[simp]
theorem balance_dddconv {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [Field R] [CharZero R] [StarRing R] (f g : GR) :

Iterated convolution #

theorem indicator_one_iterConv_apply {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [CommSemiring R] (s : Finset G) (n : ) (a : G) :
(((↑s).indicator fun (x : G) => 1) ∗ᵈ^ n) a = {xFintype.piFinset fun (x : Fin n) => s | i : Fin n, x i = a}.card
theorem indicator_one_iterConv_ddconv {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [CommSemiring R] (s : Finset G) (n : ) (f : GR) :
((↑s).indicator fun (x : G) => 1) ∗ᵈ^ n ∗ᵈ f = aFintype.piFinset fun (x : Fin n) => s, translate (∑ i : Fin n, a i) f
theorem ddconv_indicator_one_iterConv {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [CommSemiring R] (f : GR) (s : Finset G) (n : ) :
f ∗ᵈ ((↑s).indicator fun (x : G) => 1) ∗ᵈ^ n = aFintype.piFinset fun (x : Fin n) => s, translate (∑ i : Fin n, a i) f
theorem indicator_one_iterConv_dddconv {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [CommSemiring R] [StarRing R] (s : Finset G) (n : ) (f : GR) :
((↑s).indicator fun (x : G) => 1) ∗ᵈ^ n ○ᵈ f = aFintype.piFinset fun (x : Fin n) => s, translate (∑ i : Fin n, a i) (conjneg f)
theorem dddconv_indicator_one_iterConv {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [CommSemiring R] [StarRing R] (f : GR) (s : Finset G) (n : ) :
f ○ᵈ ((↑s).indicator fun (x : G) => 1) ∗ᵈ^ n = aFintype.piFinset fun (x : Fin n) => s, translate (-i : Fin n, a i) f
theorem mu_iterConv_ddconv {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [Semifield R] [CharZero R] (s : Finset G) (n : ) (f : GR) :
mu s ∗ᵈ^ n ∗ᵈ f = (Fintype.piFinset fun (x : Fin n) => s).expect fun (a : Fin nG) => translate (∑ i : Fin n, a i) f
theorem ddconv_mu_iterConv {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [Semifield R] [CharZero R] (f : GR) (s : Finset G) (n : ) :
f ∗ᵈ mu s ∗ᵈ^ n = (Fintype.piFinset fun (x : Fin n) => s).expect fun (a : Fin nG) => translate (∑ i : Fin n, a i) f
theorem mu_iterConv_dddconv {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [Semifield R] [CharZero R] [StarRing R] (s : Finset G) (n : ) (f : GR) :
mu s ∗ᵈ^ n ○ᵈ f = (Fintype.piFinset fun (x : Fin n) => s).expect fun (a : Fin nG) => translate (∑ i : Fin n, a i) (conjneg f)
theorem dddconv_mu_iterConv {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [Semifield R] [CharZero R] [StarRing R] (f : GR) (s : Finset G) (n : ) :
f ○ᵈ mu s ∗ᵈ^ n = (Fintype.piFinset fun (x : Fin n) => s).expect fun (a : Fin nG) => translate (-i : Fin n, a i) f
@[simp]
theorem balance_iterConv {G : Type u_1} {R : Type u_2} [Fintype G] [DecidableEq G] [AddCommGroup G] [Field R] [CharZero R] (f : GR) {n : } :