Finite weight pushforward and realized evaluation profiles
DefinitionAPFPaper1_ProbabilityTransportFor a finite atom set and a map to a target set, the transported weight at a target point is the sum of the original weights in its fiber. Weights may be arbitrary real numbers; nonnegativity and normalization are not built into this definition. For a tested real-valued table, the realized profile space is the range of the atom-to-column map, and profile evaluation returns a column coordinate. The profile space receives a finite enumeration whenever the original atom space is finite. Empty sets and zero weights are included.
import Mathlib.Data.Real.Basic
import Mathlib.Data.Set.Finite.Range
import Mathlib.Algebra.BigOperators.Group.Finset.Basic
set_option autoImplicit false
open scoped BigOperators
namespace APFPaper1
noncomputable def pushWeights {A B : Type} [Fintype A]
(q : A → B) (p : A → ℝ) : B → ℝ := by
classical
exact fun b => ∑ a, if q a = b then p a else 0
def Profiles {W A : Type} (ρ : W → A → ℝ) :=
Set.range (fun a : A => fun w : W => ρ w a)
noncomputable instance profilesFintype {W A : Type} [Fintype A]
(ρ : W → A → ℝ) : Fintype (Profiles ρ) :=
Fintype.ofFinite (Set.range (fun a : A => fun w : W => ρ w a))
def profileMap {W A : Type} (ρ : W → A → ℝ) (a : A) : Profiles ρ :=
⟨fun w => ρ w a, ⟨a, rfl⟩⟩
def profileValue {W A : Type} (ρ : W → A → ℝ)
(w : W) (b : Profiles ρ) : ℝ := b.val w
end APFPaper1
Read-back
What the Lean code literally says, in plain math · Codex (GPT-6)
pushWeights. For arbitrary types and , a specified finite enumeration of , any function , and any real-valued function , this noncomputable definition gives the function whose value at every is , equivalently the sum of over the fiber of . There is no finiteness requirement on , no nonnegativity or normalization requirement on , and no injectivity or surjectivity requirement on . Empty fibers have value zero; if is empty, every value is zero. Both types may be empty, subject to the existence of the supplied function ; a function to an empty can be supplied only when is empty.
Profiles. For arbitrary types and and any function , this definition gives the set of functions for which there exists such that for every . Neither type is assumed finite or nonempty, and has no additional restrictions. Elements of giving the same function on all of contribute a single element to this set. If is empty the set is empty; if is empty and is nonempty, the set contains precisely the unique function from the empty type to .
profilesFintype. For arbitrary types and , a specified finite enumeration of , and any function , this noncomputable instance supplies a finite enumeration of the type of functions equipped with membership in the set . The enumeration is obtained from the finiteness of this range; it enumerates the distinct functions in the range, not their possibly multiple representatives in , and specifies no order. There is no finiteness or nonemptiness requirement on and no further restriction on . If is empty, this enumerated type is empty; if is empty and is nonempty, it has exactly one element.
profileMap. For arbitrary types and , any function , and each supplied element , this definition gives the element of the set whose underlying function is , with membership witnessed by itself. No finiteness, nonnegativity, normalization, or distinction between the functions arising from different elements of is assumed. If is empty there is no element at which to evaluate this map; if is empty, every supplied maps to the unique function on the empty type.
profileValue. For arbitrary types and , any function , each supplied , and each supplied function equipped with a witness that it equals for some , this definition returns the real number by evaluating the underlying function of at . It does not select a representative and imposes no finiteness or numerical restrictions. If is empty, no such exists; if is empty, no argument exists, even when the set of these functions has an element.