Skip to content

feat(Counterexamples): the Vitali set is non-measurable#20722

Draft
ctchou wants to merge 13 commits intomasterfrom
ctchou/vitali-set
Draft

feat(Counterexamples): the Vitali set is non-measurable#20722
ctchou wants to merge 13 commits intomasterfrom
ctchou/vitali-set

Conversation

@ctchou
Copy link
Copy Markdown
Collaborator

@ctchou ctchou commented Jan 14, 2025


Open in Gitpod

@github-actions github-actions bot added the new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! label Jan 14, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 14, 2025

PR summary c0ec16697f

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.MeasureTheory.Measure.NullMeasurable 1343 1344 +1 (+0.07%)
Import changes for all files
Files Import difference
Mathlib.MeasureTheory.Measure.MeasureSpace Mathlib.MeasureTheory.Measure.NullMeasurable 1

Declarations diff

+ Icc_subset_vitaliUnion
+ biUnion_volume
+ measure_union_null
+ not_measurableSet_vitaliSet
+ not_nullMeasurableSet_vitaliSet
+ nullMeasurableSet_image_of_measure_eq
+ nullmeasurable_measurable_null
+ shift_nullmeasurable
+ symmDiff
+ vI_infinite
+ vitaliSet
+ vitaliSet_subset_Icc
+ vitaliSetoid
+ vitaliShift
+ vitaliType
+ vitaliUnion
+ vitaliUnion_subset_Icc
+ vitali_pairwise_disjoint
+ volume_vitaliShift
+ volume_vitaliUnion
+ volume_vitaliUnion_mem

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).

@grunweg grunweg changed the title feat: Add Counterexamples/VitaliSetNotMeasurable.lean feat(Counterexamples): the Vitali set is non-measurable Jan 14, 2025
@grunweg grunweg added the t-measure-probability Measure theory / Probability theory label Jan 14, 2025
Copy link
Copy Markdown
Contributor

@grunweg grunweg left a comment

Choose a reason for hiding this comment

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

Thanks for your pull request, and welcome to mathlib! I took a first look at your PR.
There are a number of places where your code can be written more compactly (i.e., doing the same thing, but being shorter). Such is completely normal for a first pull request. I have left some comments to get you started.

A number of comments occur several times: when addressing it once, please try to go over the file and fix all instances of it. If you're unsure, feel free to ask here (or on zulip)!

/-- We first derive the measure theoretic results that we need from
the more general theorems in Mathlib. -/

example {a b : ℝ} : volume (Icc a b) = ENNReal.ofReal (b - a) :=
Copy link
Copy Markdown
Contributor

@grunweg grunweg Jan 14, 2025

Choose a reason for hiding this comment

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

Do you need this result in the final file? (It's fine if this was helpful during development, but we'd like to merge a polished version into mathlib.) In other words: I think it's better to simply delete this.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I prefer to enumerate explicitly all the measure theoretic results that are involved, because I want to make clear exactly which properties of measurability and the volume measure are used in the proof. I have updated the comment to make this point.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe this characterization can be part of the module docs instead? Listing results like this is quite nonconventional.

example {a b : ℝ} : volume (Icc a b) = ENNReal.ofReal (b - a) :=
volume_Icc

lemma volume_mono {s t : Set ℝ} (h : s ⊆ t) : volume s ≤ volume t := by
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can probably "inline" this lemma (i.e., replace every time you want to you volume_mono h by OuterMeasureclass.measure_mono volume h). Can you do so, please?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

See my reply above.

lemma volume_mono {s t : Set ℝ} (h : s ⊆ t) : volume s ≤ volume t := by
exact OuterMeasureClass.measure_mono volume h

lemma measurable_nullmeasurable {s : Set ℝ} (h : MeasurableSet s) : NullMeasurableSet s volume :=
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A similar comment applies here. (Using dot notation, you can even write h.nullMeasurableSet.)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

See my reply above. I did change to the dot-notation.

lemma measurable_nullmeasurable {s : Set ℝ} (h : MeasurableSet s) : NullMeasurableSet s volume :=
MeasurableSet.nullMeasurableSet h

lemma measurable_null_nullmeasurable {s t : Set ℝ}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also inline this one, please.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

See my reply above.

@grunweg grunweg added the awaiting-author A reviewer has asked the author a question or requested changes. label Jan 14, 2025
@ctchou
Copy link
Copy Markdown
Collaborator Author

ctchou commented Jan 14, 2025

Question: as I update the PR, should I collapse my successive commits into a single commit, or keep them separate? I'm keeping them separate for now, but I can also collapse them if that's the convention.

@grunweg
Copy link
Copy Markdown
Contributor

grunweg commented Jan 15, 2025

Indeed, different repositories have different conventions on this question. Adding separate comments is exactly right. When merging this pull request at the end, all commits are squashed into one (and the PR description is used to determine the final commit message).

@ctchou
Copy link
Copy Markdown
Collaborator Author

ctchou commented Jan 15, 2025

Thanks for replying. I've replied above why I don't want to make certain changes and asked for clarification on some other issues. What's the next step?

/-- We first derive the measure theoretic results that we need from
the more general theorems in Mathlib. -/

example {a b : ℝ} : volume (Icc a b) = ENNReal.ofReal (b - a) :=
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe this characterization can be part of the module docs instead? Listing results like this is quite nonconventional.

(hm : NullMeasurableSet s) (hn : volume t = 0) : NullMeasurableSet (s ∪ t) :=
NullMeasurableSet.union_null hm hn

lemma nullmeasurable_measurable_null {s : Set ℝ} (h : NullMeasurableSet s volume) :
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't think this result is needed, since t is just the set given by exists_measurable_subset_ae_eq and the conclusions follow from the (I imagine more useful) t =ᵐ[μ] s predicate.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, does your comment apply to the lemma measurable_null_nullmeasurable or the lemma nullmeasurable_measurable_null?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It applies to the latter, though I do agree with the other reviewer that the former shouldn't be duplicated here.

· exact measure_congr t_eq_s
· exact ae_le_set.mp t_eq_s.symm.le

lemma shift_volume (s : Set ℝ) (c : ℝ) : volume ((fun x ↦ x + c) '' s) = volume s := by
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You can write this as

Suggested change
lemma shift_volume (s : Set ℝ) (c : ℝ) : volume ((fun x ↦ x + c) '' s) = volume s := by
lemma shift_volume (s : Set ℝ) (c : ℝ) : volume ((· + c) '' s) = volume s := by

Still, I don't think we need to have this theorem. It can just be inlined, or even replaced by a simp call.

rw [vitaliSet', shift_volume]

/-- vI is an infinite set. -/
lemma vI_infinite : vI.Infinite := by
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This should follow more easily from Set.Icc_infinite.

/-- The following theorems are the main results.

vitaliSet is not null-measurable. -/
theorem vitaliSet_not_nullmeasurable : ¬ (NullMeasurableSet vitaliSet volume) := by
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think you can prove (and add to Mathlib) an auxiliary theorem for this: a sum Σ i : I, x for an infinite type I is either 0 or .

@vihdzp
Copy link
Copy Markdown
Collaborator

vihdzp commented Jan 20, 2025

I think it's going to be really hard to convince the reviewers to have 30-odd extra lines of code listing specific dependencies of your proof. First of all, you're not even making the formal guarantee that these are sufficient conditions for the theorem to hold (and if you did, you'd likely end up with a much uglier and unwieldy statement). And second, there's no guarantee someone else couldn't come to this file later on and add or switch out these dependencies.

The archive is meant as a showcase of good proofs, which doesn't always overlap with a good mathematical presentation. I really don't think we need to go over the basics of measure theory here.

Copy link
Copy Markdown
Contributor

@grunweg grunweg left a comment

Choose a reason for hiding this comment

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

I left a few more comments about how this can be written more concisely.

(hs : I.Countable) : volume (⋃ i ∈ I, f i) = 0 ↔ ∀ i ∈ I, volume (f i) = 0 :=
measure_biUnion_null_iff hs

lemma biUnion_volume {ι : Type*} {I : Set ι} {s : ι → Set ℝ}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Every measure is countable additive - this result should be in mathlib, right? (If not, can you please add it there?)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the distinction here is that the sets are null-measurable rather than just measurable. I'm not a measure theory expert, but the (outer) measures on both the initial space and its completion coincide, right? If so, then this result should be an easy consequence of that.

Copy link
Copy Markdown
Collaborator Author

@ctchou ctchou Jan 22, 2025

Choose a reason for hiding this comment

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

I would be very interested if you can find a simpler proof. I was not able to.

But I suspect the intermediate result:
have h_st : ⋃ i ∈ I, s i = (⋃ i ∈ I, t i) ∪ (⋃ i ∈ I, (s i \ t i))
should have a simpler proof than the monstrosity I produced.

(hs : I.Countable) : volume (⋃ i ∈ I, f i) = 0 ↔ ∀ i ∈ I, volume (f i) = 0 :=
measure_biUnion_null_iff hs

lemma biUnion_volume {ι : Type*} {I : Set ι} {s : ι → Set ℝ}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the distinction here is that the sets are null-measurable rather than just measurable. I'm not a measure theory expert, but the (outer) measures on both the initial space and its completion coincide, right? If so, then this result should be an easy consequence of that.

@ctchou ctchou added the please-adopt Inactive PR (would be valuable to adopt) label Jan 22, 2025
@ctchou
Copy link
Copy Markdown
Collaborator Author

ctchou commented Jan 22, 2025

I added the label "please-adopt" to this PR. Please feel free to make modifications needed for inclusion in mathlib. Thanks!

Zulip thread: https://leanprover.zulipchat.com/#narrow/channel/116395-maths/topic/The.20nonmeasurability.20of.20the.20Vitali.20set

@ctchou
Copy link
Copy Markdown
Collaborator Author

ctchou commented Jan 22, 2025

@vihdzp: In the first version of this proof, I proved only that ¬ (MeasurableSet vitaliSet). Then Floris van Doorn pointed out that. MeasurableSet means Borel measurability and I need to prove ¬ (NullMeasurableSet vitaliSet volume) for Lebesgue measurability, which is what I did in the version here.

https://leanprover.zulipchat.com/#narrow/channel/116395-maths/topic/The.20nonmeasurability.20of.20the.20Vitali.20set/near/489212000

@ctchou
Copy link
Copy Markdown
Collaborator Author

ctchou commented Jan 22, 2025

Practically speaking, a set is a NullMeasurableSet if it differs from a MeasurableSet by a set of measure zero, which is spelled out in the lemma nullmeasurable_measurable_null. (Of course, my lemma is not the only way to state this fact.) Most of the nontrivial measure theoretic lemmas in my proof basically use this fact to lift results about MeasurableSet to being about NullMeasurableSet.

@vihdzp vihdzp self-assigned this Jan 23, 2025
@vihdzp
Copy link
Copy Markdown
Collaborator

vihdzp commented Jan 23, 2025

I'll adopt this PR. I'll leave it as a draft until I've done all the changes I think are appropriate (hopefully in the next few days).

@vihdzp vihdzp marked this pull request as draft January 23, 2025 01:42
@mathlib4-merge-conflict-bot mathlib4-merge-conflict-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 16, 2025
@mathlib4-merge-conflict-bot
Copy link
Copy Markdown
Collaborator

This pull request has conflicts, please merge master and resolve them.

@vihdzp
Copy link
Copy Markdown
Collaborator

vihdzp commented Aug 16, 2025

Oh darn, I kind of forgot about this. I'm really busy with other Lean stuff, but I'll see if I can come back to this during the week.

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. merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! please-adopt Inactive PR (would be valuable to adopt) t-measure-probability Measure theory / Probability theory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants