Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ssrZ library #26

Merged
merged 4 commits into from
Sep 30, 2021
Merged

Add the ssrZ library #26

merged 4 commits into from
Sep 30, 2021

Conversation

pi8027
Copy link
Member

@pi8027 pi8027 commented Sep 28, 2021

that provides

  • some structure instances for Z and
  • Z_of_int : int -> Z and int_of_Z : Z -> int ring morphisms.

Another point of this PR is that it will allow us to remove some code from Algebra Tactics.

Close #20

@pi8027
Copy link
Member Author

pi8027 commented Sep 29, 2021

I think that some others have their own MathComp style libraries to reason about Z, and it would be nice to standardize such the library at some point. Any opinion? CC: @affeldt-aist @CohenCyril

@affeldt-aist
Copy link
Member

I was wondering the same question.
We have been considering isolating the ssrR.v and ssrZ.v files from infotheo following the request of a user,
see affeldt-aist/monae#56
They are two files that provide a renaming of the lemmas of the standard library a la MathComp
but they are a bit ad hoc.

that provides Z <-> int conversion and some structure instances for Z
@pi8027
Copy link
Member Author

pi8027 commented Sep 29, 2021

@affeldt-aist Could you remind me why infotheo had to use Z rather than int? Is there something to do (e.g., getting rid of Z) on this point?

@affeldt-aist
Copy link
Member

affeldt-aist commented Sep 29, 2021

infotheo has been using R from the standard library and did a bit of real analysis in which it uses flooring and ceiling functions which led to the use of Z
we now plan to limit the use of Z in monae (which depends on infotheo) and think of getting rid of R and Z in infotheo because soon there will be enough material in mathcomp-analysis to make this possible

@pi8027
Copy link
Member Author

pi8027 commented Sep 29, 2021

Good! I hope we will limit the use of Z to the case we need efficient computation on integers.

@affeldt-aist
Copy link
Member

Good! I hope we will limit the use of Z to the case we need efficient computation on integers.

I've issued myself to do just that, it is only a matter of finding the time, I'll try to do it by mid-october and report to you by then

Comment on lines +22 to +26
Definition Z_of_int (n : int) : Z :=
match n with
| Posz n => Z.of_nat n
| Negz n' => Z.opp (Z.of_nat (n' + 1))
end.
Copy link
Member Author

Choose a reason for hiding this comment

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

It would be nice to redefine this with Z_of_int n := n%:~R (see Lemma Z_of_intE below). But, it requires the ringType instance of Z, and Z_of_int and int_of_Z are required to define the choiceType and countType instances of Z. There is some sort of circular dependency here.

theories/ssrZ.v Outdated
Canonical Z_normedZmodType := NormedZmodType Z Z Mixin.
Canonical Z_realDomainType := [realDomainType of Z].

Lemma Z_of_intE (n : int) : Z_of_int n = (n%:~R)%R.
Copy link
Member Author

Choose a reason for hiding this comment

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

Here.

@pi8027
Copy link
Member Author

pi8027 commented Sep 30, 2021

Anyway, I'm merging this PR now. I hope we will continue to discuss standardizing the ssrZ library.

@pi8027 pi8027 merged commit 8887210 into master Sep 30, 2021
@pi8027 pi8027 deleted the ssrZ branch September 30, 2021 03:17
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.

Z <-> int correspondence, structure instances for Z, and bridging ssralg to ring/field tactics
2 participants