Skip to content

feat(ConnectedComponents): new proofs#28

Open
jjdishere wants to merge 5 commits intomasterfrom
connected_component
Open

feat(ConnectedComponents): new proofs#28
jjdishere wants to merge 5 commits intomasterfrom
connected_component

Conversation

@jjdishere
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Collaborator Author

@jjdishere jjdishere left a comment

Choose a reason for hiding this comment

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

Review of feat(ConnectedComponents): new proofs

The PR fills 3 sorry placeholders across 2 files. The mathematical content is correct — Prespectral.of_profinite, t2Space_connectedComponent, and lift_bijective_of_isPullback all follow sound proof strategies.

Main suggestions:

  1. Several have blocks can be shortened significantly (see inline comments)
  2. lift_bijective_of_isPullback at ~157 lines should be decomposed into helper lemmas
  3. Check whether open Limits is actually needed
  4. Commit message "AI progress" should be more descriptive

Overall the mathematics is solid — the style just needs tightening.

Comment thread Proetale/Topology/Preliminaries/Profinite.lean
Comment thread Proetale/Topology/SpectralSpace/ConnectedComponent.lean Outdated
Comment thread Proetale/Topology/SpectralSpace/ConnectedComponent.lean Outdated
Comment thread Proetale/Topology/SpectralSpace/ConnectedComponent.lean Outdated
Comment thread Proetale/Topology/SpectralSpace/ConnectedComponent.lean Outdated
Comment thread Proetale/Topology/SpectralSpace/ConnectedComponent.lean
Comment thread Proetale/Topology/SpectralSpace/ConnectedComponent.lean
SpectralSpace Y := pb.spectralSpace

omit [SpectralSpace X] in
theorem ConnectedComponents.lift_bijective_of_isPullback {Y T : Type u} [TopologicalSpace Y]
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.

This proof is ~157 lines, well past the 100-line guideline. Consider extracting standalone helper lemmas:

  1. hg_surj → a lemma like Function.Surjective_fst_of_isPullback (surjectivity of g from the pullback structure)
  2. hFib → a lemma like IsPreconnected_fiber_of_isPullback (preconnectedness of fibers of g)

This would make the main proof much more readable and the helpers independently reusable.

Comment thread Proetale/Topology/SpectralSpace/ConnectedComponent.lean Outdated
Comment thread Proetale/Topology/SpectralSpace/ConnectedComponent.lean Outdated
- Shorten hxdata using `by ext z; simp`
- Shorten hxU0/hyU0 using Set.mem_iInter₂
- Clean up inline `by simpa` in isClosed_and_iUnion_connectedComponent_eq_iff
- Extract surjective_fst_of_isPullback and isPreconnected_fiber_of_isPullback
  as standalone helper lemmas from the 157-line lift_bijective_of_isPullback
- Simplify φ definition and hsetY proof

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread Proetale/Topology/SpectralSpace/ConnectedComponent.lean Outdated
Comment thread Proetale/Topology/SpectralSpace/ConnectedComponent.lean Outdated
Comment on lines +169 to +170
have : x ∈ T := (hSat z hxz) hxmem
exact hxT 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.

merge these in one line

jjdishere and others added 2 commits March 24, 2026 17:18
- Inline single-use term-mode `have`s (hEq, hxy, hTcomp, hVT, hyCpt)
- Fix `rw [show ... from ...]` → use named `have` instead
- Merge consecutive single-use term-mode `have`s where possible

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
theorem isClosed_and_iUnion_connectedComponent_eq_iff {T : Set X} :
(IsClosed T ∧ ∃ I : Set X, ⋃ x ∈ I, connectedComponent x = T) ↔
∃ J : Set ({U : Set X // IsClopen U}), ⋂ (U : J), U = T := by
classical
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.

is this needed?

Comment on lines +147 to +149
let J : Set ({U : Set X // IsClopen U}) := {U | T ⊆ U}
refine ⟨J, ?_⟩
refine Set.Subset.antisymm ?_ ?_
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.

Suggested change
let J : Set ({U : Set X // IsClopen U}) := {U | T ⊆ U}
refine ⟨J, ?_⟩
refine Set.Subset.antisymm ?_ ?_
refine ⟨{U | T ⊆ U}, Set.Subset.antisymm ?_ ?_⟩

· exact hx
· exact mem_connectedComponent
by_contra hxT
have hSat : ∀ z, z ∈ T → connectedComponent z ⊆ T := by
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.

This should be separated as a lemma

rw [(connectedComponent_eq hzw).symm]
intro u hu
simpa [hI] using (Set.mem_iUnion₂.mpr ⟨w, hwI, hu⟩ : u ∈ ⋃ x ∈ I, connectedComponent x)
have hdis : Disjoint (connectedComponent x) T := by
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.

This should be separated as a lemma

Comment on lines +165 to +166
let K : Type u := {U : Set X // IsClopen U ∧ x ∈ U}
have hInter : (⋂ U : K, (U : Set X)) = connectedComponent x :=
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.

This could also be a lemma

Comment on lines +168 to +175
have hcover : T ⊆ ⋃ U : K, (U : Set X)ᶜ := by
intro z hz
have hznot : z ∉ connectedComponent x := by
intro hz'
exact (Set.disjoint_left.mp hdis) hz' hz
have : z ∉ ⋂ U : K, (U : Set X) := by rwa [hInter]
simp only [Set.mem_iInter, not_forall] at this
exact Set.mem_iUnion.mpr 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.

instead of using have ... exact, you should use apply without using have.

Comment on lines +176 to +179
obtain ⟨s, hs⟩ :=
hT.isCompact.elim_finite_subcover
(U := fun U : K => (U : Set X)ᶜ)
(fun U => U.2.1.1.isOpen_compl) hcover
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.

these does not need to take 4 lines

Comment on lines +200 to +201
· have : IsClosed (⋂ U : J, (U : Set X)) := isClosed_iInter fun U => (U.1.2).1
simpa [hJ] using 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.

have a term proof, merge into one line

Comment on lines +202 to +204
· refine ⟨T, ?_⟩
refine Set.Subset.antisymm ?_ ?_
· intro z hz
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.

refine ⟨T, Set.Subset.antisymm (fun z hz \maspto ?) (fun z hz \maspto ?)⟩

- Extract connectedComponent_subset_of_iUnion_eq and
  disjoint_connectedComponent_of_not_mem as standalone lemmas
- Inline let J, merge consecutive refine calls
- Remove unnecessary classical
- Shorten hVcl, use apply instead of have...exact
- Merge refine ⟨T, ?_⟩ + refine Set.Subset.antisymm into one refine
- Inline hzInter as term-mode

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator Author

@jjdishere jjdishere left a comment

Choose a reason for hiding this comment

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

Second review pass (full style checklist)

Going through every item in the style/naming/quality checklist.

Issues found

1. by alone on its own line (L215-216)

    [PrespectralSpace X] : T2Space (ConnectedComponents X) :=
  by

Should be ... := by on one line.

2. Double space (L214)

instance t2Space_connectedComponent {X : Type u} [TopologicalSpace X]  [CompactSpace X]

Extra space before [CompactSpace X].

3. Lines exceeding 100 characters

  • L148 (101 chars): simpa [hI] using (Set.mem_iUnion₂.mpr ⟨w, hwI, hu⟩ : ...)
  • L231 (103 chars): comment -- Use compactness of ...
  • L422 (161 chars): (isHomeomorph_iff_continuous_bijective ...).mpr ⟨...⟩

4. show ... by ... inside simp (L398)

simp [fiberP, this, show (p : T × X).fst = t by simpa [FSt] using hp]

This is effectively the banned show ... from pattern. Extract as a named have.

Items that pass

  • No λ, no semicolons, no change, no open Classical, no show ... from in rw
  • No haveI, no unused let bindings, no unnecessary type annotations
  • Naming conventions followed (snake_case for propositions, UpperCamelCase for types)
  • Docstrings present on new helper lemmas
  • No sorry, no axiom, no set_option maxHeartbeats
  • Helper lemmas use weakest hypotheses (with omit for section vars)
  • No duplicate declarations

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.

1 participant