Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat (Probability.Kernel): Add definitions and API for Kernel.fst' and snd' #15466

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

LorenzoLuccioli
Copy link
Collaborator

Define a Kernel α γ and a Kernel β γ from a Kernel (α × β) γ by taking the comap of fun a ↦ (a, b) and fun b ↦ (a, b) respectively.

  • Add definitions of Kernel.fst' and Kernel.snd'.
  • Add some API lemmas: fst'_apply, fst'_zero, comap_fst', fst'_prodMkLeft, fst'_prodMkRight and the equivalent lemmas for snd'.
  • Add instances for IsMarkovKernel, IsFiniteKernel, IsSFiniteKernel and NeZero.
  • Add fst'_swapRight and snd'_swapRight.
  • Add compProd_apply_eq_compProd_snd'.

Open in Gitpod

@LorenzoLuccioli LorenzoLuccioli added the t-measure-probability Measure theory / Probability theory label Aug 3, 2024
Copy link

github-actions bot commented Aug 3, 2024

PR summary 61c817e548

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ _root_.ProbabilityTheory.Kernel.compProd_apply_eq_compProd_snd'
+ comap_fst'
+ comap_snd'
+ fst'
+ fst'_apply
+ fst'_prodMkLeft
+ fst'_prodMkRight
+ fst'_swapRight
+ fst'_zero
+ instance (priority := 100) {κ : Kernel (α × β) γ} [∀ b, IsMarkovKernel (fst' κ b)] :
+ instance (priority := 100) {κ : Kernel (α × β) γ} [∀ b, IsMarkovKernel (snd' κ b)] :
+ instance (κ : Kernel (α × β) γ) (a : α) (b : β) [NeZero (κ (a, b))] : NeZero ((fst' κ b) a) := by
+ instance (κ : Kernel (α × β) γ) (a : α) (b : β) [NeZero (κ (a, b))] : NeZero ((snd' κ a) b) := by
+ instance (κ : Kernel (α × β) γ) (a : α) [IsFiniteKernel κ] : IsFiniteKernel (snd' κ a) := by
+ instance (κ : Kernel (α × β) γ) (a : α) [IsMarkovKernel κ] : IsMarkovKernel (snd' κ a) := by
+ instance (κ : Kernel (α × β) γ) (a : α) [IsSFiniteKernel κ] : IsSFiniteKernel (snd' κ a) := by
+ instance (κ : Kernel (α × β) γ) (b : β) [IsFiniteKernel κ] : IsFiniteKernel (fst' κ b) := by
+ instance (κ : Kernel (α × β) γ) (b : β) [IsMarkovKernel κ] : IsMarkovKernel (fst' κ b) := by
+ instance (κ : Kernel (α × β) γ) (b : β) [IsSFiniteKernel κ] : IsSFiniteKernel (fst' κ b) := by
+ snd'
+ snd'_apply
+ snd'_prodMkLeft
+ snd'_prodMkRight
+ snd'_swapRight
+ snd'_zero

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.

@LorenzoLuccioli
Copy link
Collaborator Author

The names are Kernel.fst' and Kernel.snd', since Kernel.fst and Kernel.snd are already taken for the case where the codomain is a product space. Suggestions for a better name are welcome.

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Aug 17, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Aug 17, 2024
@urkud
Copy link
Member

urkud commented Sep 5, 2024

About names: there are Function.Embedding.sectl and MonoidHom.inl. Probably, the former is closer to this case. Also, please ask on Zulip for other suggestions.


/-- Define a `Kernel α γ` from a `Kernel (α × β) γ` by taking the comap of `fun a ↦ (a, b)` for
a given `b : β`. -/
noncomputable def fst' (κ : Kernel (α × β) γ) (b : β) : Kernel α γ :=
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you rename that to

Suggested change
noncomputable def fst' (κ : Kernel (α × β) γ) (b : β) : Kernel α γ :=
noncomputable def domFst (κ : Kernel (α × β) γ) (b : β) : Kernel α γ :=

? Then Kernel.fst can be renamed to Kernel.codFst

@YaelDillies YaelDillies added the awaiting-author A reviewer has asked the author a question or requested changes label Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-author A reviewer has asked the author a question or requested changes t-measure-probability Measure theory / Probability theory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants