Fresh PR: Integers as Higher Inductive Type implementation in Coq#41
Fresh PR: Integers as Higher Inductive Type implementation in Coq#41maxipetro wants to merge 25 commits into
Conversation
|
Now that we've merged the BiInv.v part, can you rebase on master and force push, so there is just one commit without that material? |
06cf313 to
f7607e4
Compare
|
You rebased on the previous version of master, I think. You probably need to pull in the latest master. |
f7607e4 to
5f0e4e3
Compare
I rebased on the updated master, the problem was the commit that I made in the other PR before it got merged. The changes of that commit were not made in this branch and so the rebasing caused a conflict. My merge editor then messed things up when I had to manually resolve the conflict. It should be fine now |
|
For the record, the previous PR is #32 . |
|
I've copied over the tasks list and updated it:
Edit: minor updates 2026/6/17. |
… BiInv.v, needs still clean-up
|
I made a few cleanups. I think similar proof simplifications could be made in other places, so look around for similar things. |
Co-authored-by: Dan Christensen <jdc@uwo.ca>
Add semi-additive categories infrastructure
|
@maxipetro Just checking on the status of this. |
- Remove the unused imports Categories.Additive.Biproducts and Classes.theory.groups. Nothing in the file refers to either: the monoid-morphism helpers (IsMonoidPreserving, id_monoid_morphism, compose_monoid_morphism, preserves_sg_op, ...) all come from abstract_algebra, which is already imported, and biproducts are reached transitively through SemiAdditive. - Rename inverse_morphism_unique to hom_moveL_1V, paralleling the group movement lemma grp_moveL_1V, and update its two uses. - Name the AdditiveFunctor fields consistently: the coercion is addfunctor and the monoid-preservation instance is ismonoidpreserving_addfunctor. - Remove the AdditiveFunctorLaws section; its three lemmas were direct applications of preserves_sg_op, preserves_mon_unit and preserves_inverse, which apply to an additive functor's action without a wrapper.
Add additive categories infrastructure
|
@jdchristensen I think now all the open issues are resolved. Regarding the bullet points in your list: The directions of pf, pf1 and pf2 are changed so I think we can tick this off. Some comments exceed the 80 character limit per line. Should I break them into two lines? I think we should rename I can start replacing the old |
Sounds good.
No, the style for comments is to have no line breaks at all.
I reworked this material (I'll push in a minute) but didn't adjust naming. I'm not exactly sure what is best. Maybe
Let's wait on this, as there are too many issues right now. I'll provide feedback in a minute. |
|
I just pushed eight commits. Please read them separately, as I was careful to only put related changes together, and some of the changes overlap so won't be understandable if you just look at the overall diff. Here's a summary from oldest to newest:
I only looked at a small portion of the file, but found tons of style errors. Please go through the file carefully checking the spacing, indentation, parenthesization, etc.
The
Various style things. In particular, notice that every definition in this section had a common argument
I removed an incorrect comment that said: "Since it is an Instance that biinvertible maps are equivalent to half-adjoint equivalences using type class search one could also use IntHIT_rec_biinv instead." Only one direction is an instance, and it's not the one that would allow us to use IntHIT_rec_biinv instead. But this raises the question of why we need the other one. I'll make a comment in the appropriate spot.
Minor.
They were separating related functions, so I moved them out of the way.
This is an important change. As originally defined,
Using the adjoint law, I was able to prove a simple induction principle |
| Let es' := eisretr_biinv e' : e' o s' == idmap. | ||
|
|
||
| Definition helper_r (pe : e' o f == g o e) : r' o g o e == f o r o e. | ||
| Definition helper_r : r' o g o e == f o r o e. |
There was a problem hiding this comment.
Are these helpers needed? Since they are one-liners and are used just once, couldn't they be inlined to where they are needed? If they are kept, they should be renamed to something less generic, or made Local.
| Definition helper_r (pe : e' o f == g o e) : r' o g o e == f o r o e. | ||
| Definition helper_r : r' o g o e == f o r o e. | ||
| Proof. | ||
| intro x. |
There was a problem hiding this comment.
Please use a or b, to help the reader know the type of this variable. (Not just here, everywhere that you use intro.)
| Definition IntHIT_ind_hprop {P : IntHIT -> Type} `{forall x, IsHProp (P x)} | ||
| (t0 : P zero_i) | ||
| (f : forall z : IntHIT, P z -> P (succ z)) | ||
| (g : forall z : IntHIT, P z -> P (pred z)) | ||
| : forall x, P x. |
There was a problem hiding this comment.
Inconsistent variable names: x in two places and z in two places. I think using z as a variable of type IntHIT is good. Again, not just here, but everywhere.
| Definition IntHIT_rec {P : Type} (t0 : P) | ||
| (f : P -> P) (g1 : P -> P) (g2 : P -> P) | ||
| (s : forall (t : P), g1 (f t) = t) | ||
| (r : forall (t : P), f (g2 t) = t) | ||
| : IntHIT -> P. |
There was a problem hiding this comment.
This and the corresponding beta laws should go in a Section, since they use the same variables.
| Definition uniquenessZ_two_fun_equiv | ||
| {P : Type} | ||
| (f : P -> P) | ||
| {e' : IsEquiv f} | ||
| (k1 : IntHIT -> P) | ||
| (k2 : IntHIT -> P) | ||
| (p0 : k1 zero_i = k2 zero_i) | ||
| (pf1 : forall (z : IntHIT), (k1 o succ) z = (f o k1) z) | ||
| (pf2 : forall (z : IntHIT), (k2 o succ) z = (f o k2) z) |
There was a problem hiding this comment.
Let's make argument lists more compact, like I did for the two results before this one. (Again, not just here, but in general.)
This is a fresh PR for the implementation of Integers as Higher Inductive Type implementation in Coq following [Altenkirch and Scoccola 2020].