Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

feat(algebraic_topology): basics on simplicial sets and singular chain complex#144

Closed
jcommelin wants to merge 25 commits intoleanprover-community:masterfrom
jcommelin:simplicial
Closed

feat(algebraic_topology): basics on simplicial sets and singular chain complex#144
jcommelin wants to merge 25 commits intoleanprover-community:masterfrom
jcommelin:simplicial

Conversation

@jcommelin
Copy link
Member

I have tried to follow the style guides. However, the proofs are probably not up to par. I have no idea how to improve them. All help appreciated.

@spl
Copy link
Collaborator

spl commented May 28, 2018

You should check all your files for commented code that is no longer needed and remove it.

@jcommelin
Copy link
Member Author

jcommelin commented May 28, 2018

Well, there is some commented code, but that are short hints on how would have liked to improve the code. Maybe I could have been a bit more explicit about that...
Of course I will remove it once the code is ready for merging. But that seems unlikely atm...


lemma δ_monotone (i : [n+1]) : monotone (δ i) :=
begin
unfold monotone,
Copy link
Collaborator

Choose a reason for hiding this comment

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

the part between begin and end is always indented by 2 spaces.

le_refl := λ x, le_refl x,
le_trans := λ x y z, le_trans,
le_antisymm := λ x y hx hy, subtype.eq $ le_antisymm hx hy,
le_antisymm := λ x y hx hy, .eq $ le_antisymm hx hy,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess this doesn't compile?

Copy link
Member Author

Choose a reason for hiding this comment

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

Huh, how did that end up happening? I don't recall ever opening that file...

intros a b H,
unfold δ,
by_cases ha : (i.val ≤ a.val),
{ rw [dif_pos ha],
Copy link
Collaborator

Choose a reason for hiding this comment

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

You have a lot of by_cases and rw with if_pos or similar. You can use Gabriels new split_ifs tactic.


lemma σ_monotone (i : [n]) : monotone (σ i) :=
begin
unfold monotone,
Copy link
Collaborator

Choose a reason for hiding this comment

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

You don't need to unfold monotone, intros will do it for you.

have hia' : ((fin.raise i).val ≤ (fin.raise a).val) :=
begin
unfold fin.raise,
exact hia
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you sure that unfold and then exact is necessary? The unfold looks unnecessary.


lemma simplicial_identity₁ {i j : [n+1]} (H : i ≤ j) : δ j.succ ∘ δ i = δ i.raise ∘ δ j :=
begin
apply funext,
Copy link
Collaborator

Choose a reason for hiding this comment

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

funext a or ext a

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, I don't understand this comment.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of apply funext, intro a, ... you can use funext a, ... or ext a, ....
ext is a more general version which uses a database of extensionality theorems.

@johoelzl
Copy link
Collaborator

General comment on style:
The form for lemma and definition is:

lemma name (a : A) (b : B) : stmt :=
-- or
lemma name (a : A) (b : B) :
  stmt :=
-- or
lemma name
  (a : A)
  (b : B) :
  stmt :=
_

The : and := are at the end of the previous line. The statement is indented by 2 spaces, and when you need to add a line break for the parameters also indent them by 2 spaces.

@johoelzl
Copy link
Collaborator

For the proofs it gets harder.

I have a couple of ideas:

  • some of your statements might be easier to proof using an abstracted version instead of univ use a s : finset A (where A is a type). Some proofs get a lot easier.
  • When you have a long chain of rw A, rw B, rw C you can write it in one list rw [A, B, C] but even bettr: use the simplifer!
  • When you start adding rules to the simplifier it gets very powerful, but it needs guidance. One solution is to use a more declarative style. Instead of starting to just destruct your goal (using tactics like intros, unfold etc) you might tell him what you actually want. Use for example calc or have to state your intermediate steps.
  • Look at other proofs: e.g. topological_space.induced_comp, how are the other proofs done? Maybe you want to follow this style.

end typepown

/-- The n-th standard topological simplex: Δ_n = { x ∈ ℝ^{n+1} | ∀ i, x_i ≥ 0, and ∑ x_i = 1 } -/
definition standard_topological_simplex (n : ℕ) : set (ℝ≥0^(n+1)) :=
Copy link
Collaborator

Choose a reason for hiding this comment

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

I added probability mass functions, you can use them instead of this construction.

Copy link
Member Author

Choose a reason for hiding this comment

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

A search in VScode didn't show up anything. Where did you define those?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Aah, sorry, I didn't read "I added ..." as something you did today. My bad I didn't check the latest commits.

Copy link
Member Author

Choose a reason for hiding this comment

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

@johoelzl I think I understand what those probability mass functions are doing. But I prefer to continue using fin n. Within this theory of simplicial sets etc, the simplex category plays quite an important role: you want to look at monotone functions fin m \to fin n. If I start using these probability mass functions, I fear losing access to those monotone functions. (Or at least their role in the theory it becomes a lot less apparent to me.)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand?! You still use fin n: you would use pmf (fin (n + 1)) to define standard_topological_simplex n. Then you use pmf.map to map your vertices.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, then I didn't understand pmf correctly. Let me see again.

⟨assume ⟨t, ht, heq⟩, ⟨-t, by simp; assumption, by simp [preimage_compl, heq.symm]⟩,
assume ⟨t, ht, heq⟩, ⟨-t, ht, by simp [preimage_compl, heq.symm]⟩⟩

lemma induced_comp {α β γ : Type*} (f : α → β) (g : β → γ) :
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this already induced_compose, up to minor details?

Copy link
Member Author

@jcommelin jcommelin Jun 1, 2018

Choose a reason for hiding this comment

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

I guess it is. And in fact, I don't need this lemma anymore. So I will remove it. Thanks for spotting this!

-- instance ring_hom_is_add_group_hom [ring α] [ring β] (f : α → β) [is_ring_hom f] : is_add_group_hom f :=
-- ⟨λ _ _, is_ring_hom.map_add f⟩

theorem zero {α β : Type*} [add_group α] [add_group β] (f : α → β) [hf : is_add_group_hom f] :
Copy link
Member

Choose a reason for hiding this comment

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

Should this be a simp lemma?

Copy link
Collaborator

Choose a reason for hiding this comment

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

This can't be a simp lemma as the head of the left-hand side is just f which is a variable. The simplifier cannot work with such cases.

continuous_supr_rng $ assume i, continuous_induced_rng $ h i

lemma continuous_apply [topological_space α] [∀i, topological_space (π i)] (i : ι) :
lemma continuous_apply [∀i, topological_space (π i)] (i : ι) :
Copy link
Collaborator

Choose a reason for hiding this comment

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

This was fixed in fba4d89 (#157). Can you rebase or merge in master?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@rwbarton
Copy link
Collaborator

Now that categories are in mathlib, we could consider splitting up this construction into smaller pieces, namely:

  1. The simplex category, and simplicial sets as a category of presheaves.
  2. The "standard topological simplices" as a functor from the simplex category to Top.
  3. Using the previous item, obtain the Sing functor from Top to simplicial sets by a standard construction ("restricted Yoneda embedding"), though maybe it would be more natural to do it when we can also define the left adjoint (geometric realization) at the same time, using colimits.
  4. If modules are in a good state, define the category of R-modules. If not yet, just define the category of abelian groups for now.
  5. Define the "free R-module" (or "free abelian group") functor and apply it to Sing X to get the simplicial R-module of chains on X. (If/when we have adjunctions, prove that the free R-module functor is left adjoint to the forgetful functor.)
  6. Define chain complexes (in R-modules for now, or abelian groups), the unnormalized chain complex functor from simplicial modules to chain complexes of modules, and the homology functors on chain complexes.

At least the first two items could be done right now, and none of the items are far from being doable in some version (depending on the status of modules and (co)limits).

@PatrickMassot
Copy link
Member

This all sounds very nice. I think we should wait for the module refactor and some progress in the category theory PR, and then try to make one big push. This would be a really nice test for all those new features.

@johoelzl
Copy link
Collaborator

@jcommelin is it OK to close this PR?

@jcommelin
Copy link
Member Author

Yes. Let's close this for now. I hope to return to it in the future!

@johoelzl johoelzl closed this Jan 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants