Skip to content

Conversation

fbarroero
Copy link
Collaborator

We add

lemma log_prod' {α : Type*} {s : Multiset α} {f : α → ℝ} (hf : ∀ x ∈ s, f x ≠ 0) :
    log (s.map f).prod = (s.map (fun x ↦ log (f x))).sum

which generalizes

theorem log_prod {α : Type*} {s : Finset α} {f : α → ℝ} (hf : ∀ x ∈ s, f x ≠ 0) :
    log (∏ i ∈ s, f i) = ∑ i ∈ s, log (f i) 

Open in Gitpod

Copy link

github-actions bot commented Oct 19, 2025

PR summary d95168ed4d

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ log_prod'

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.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

log (∏ i ∈ s, f i) = ∑ i ∈ s, log (f i) := by
induction s using Finset.cons_induction_on with
open Multiset in
lemma log_prod' {α : Type*} {s : Multiset α} {f : α → ℝ} (hf : ∀ x ∈ s, f x ≠ 0) :
Copy link
Member

@riccardobrasca riccardobrasca Oct 19, 2025

Choose a reason for hiding this comment

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

I am pretty sure the convention is that the bla_prod lemma refers to finsets (as here), and the multiset version is called something like bla_multiset_prod.

Copy link
Member

@eric-wieser eric-wieser left a comment

Choose a reason for hiding this comment

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

Could you add the List version while you're at it? The multiset version should be provable in one or two lines in terms of it.

induction s using Finset.cons_induction_on with
open Multiset in
lemma log_prod' {α : Type*} {s : Multiset α} {f : α → ℝ} (hf : ∀ x ∈ s, f x ≠ 0) :
log (s.map f).prod = (s.map (fun x ↦ log (f x))).sum := by
Copy link
Member

Choose a reason for hiding this comment

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

Or should this be the simpler

Suggested change
log (s.map f).prod = (s.map (fun x ↦ log (f x))).sum := by
log s.prod = (s.map log).sum := by

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants