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

Reorganize files and prove equivalences of the many types of integers and rationals #404

Open
mortberg opened this issue Aug 27, 2020 · 8 comments
Labels
good first issue Good for newcomers

Comments

@mortberg
Copy link
Collaborator

The library contains a lot of different representations of the integers:

and the rationals:

It would be good to collect these in one place, maybe in a folder in Cubical.Algebra? No matter what the Data/HITs distinction doesn't really make sense. This reorganization should be done in a separate PR.

Once the files are in the same place we should have proofs that all of the different representations are equivalent. This might be easier for some representations than others, but once #400 is done we will then be able to transport the proof that the integers form a commutative ring to all of the other representations using the SIP. Doing one or more of these equivalences would be a good first PR for someone trying to learn Cubical Agda.

@mortberg mortberg added the good first issue Good for newcomers label Aug 27, 2020
@mortberg
Copy link
Collaborator Author

@mortberg
Copy link
Collaborator Author

@mchristianl I don't know why, but I can't assign you to this issue...

@mchristianl
Copy link
Contributor

That's strange. I got the notification email, so this should be the correct identifier at least

@mchristianl
Copy link
Contributor

mchristianl commented Oct 15, 2020

About the boolean-valuedness of decidable orders _<_: we do already have a type-valued order on ℕ:

_≤_ : Type₀
m ≤ n = Σ[ k ∈ ℕ ] k + m ≡ n
_<_ : Type₀
m < n = suc m ≤ n

and it is also defined likewise (as a relation) in the non-cubical standard library

data _≤_ : Rel ℕ 0ℓ where
  z≤n :  {n}                  zero  ≤ n
  s≤s :  {m n} (m≤n : m ≤ n)  suc m ≤ suc n

_<_ : Rel ℕ 0ℓ
m < n = suc m ≤ n

Which approach should we follow?

@knrafto
Copy link
Contributor

knrafto commented Oct 15, 2020

A point in favor of the first definition is that it works nicely for ints as well:

_≤_ : ℤ → ℤ → Type₀ 
m ≤ n = Σ[ k ∈ ℕ ] pos k + m ≡ n

@mortberg
Copy link
Collaborator Author

The question about boolean or non-boolean orders is orthogonal to this issue... But I personally like boolean tests that then get lifted to types using boolean reflection à la SSReflect. I don't know why other Agda libraries tend to not do this?

Btw, Egbert had a tweet about using boolean reflection for primality testing in Agda recently which illustrates why this technique is so powerful: https://twitter.com/EgbertRijke/status/1309072950797185033

@knrafto
Copy link
Contributor

knrafto commented Oct 15, 2020

I personally think of decidability as a "property" of a definition, rather than a definition itself. So I would rather define the order as proposition, and then prove that it's decidable, rather than take a boolean-valued function as a definition. And then you can use the technique that Egbert shows on this decidability proof

@xekoukou
Copy link
Contributor

To transport the structure of CommRIng from one Int into the other, one needs to reorganize the CommRingStr, split the raw structure from the Propositions : #552

I will give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants