Zulip Chat Archive
Stream: Is there code for X?
Topic: Applying a function to a distribution
Frédéric Dupuis (Nov 13 2023 at 03:31):
Is something like the following somewhere in mathlib?
open Finset in
def AddMonoid.domain_apply {α β E : Type*} [Fintype α] [DecidableEq β] [AddCommMonoid E]
(f : α → β) (g : α → E) : β → E :=
fun x => ∑ z in filter (fun y => f y = x) univ, g z
I'm not too sure what to call this, but this is the operation that happens when e.g. g x
is a quantum state that depends on a classical label x
, and we apply a function to the classical label.
Bhavik Mehta (Nov 13 2023 at 17:12):
Not directly, but there's a few lemmas about functions like this that might be useful to you, usually with the name 'fiberwise' in there somewhere
Junyan Xu (Nov 15 2023 at 08:09):
Actually, there is docs#Finsupp.mapDomain
Frédéric Dupuis (Nov 15 2023 at 14:54):
Great, thanks!
Junyan Xu (Nov 15 2023 at 15:15):
You may want to combine it with docs#Finsupp.equivFunOnFinite :)
Last updated: Dec 20 2023 at 11:08 UTC