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

Cardinality and Order #969

Merged
merged 33 commits into from
Sep 16, 2023
Merged

Cardinality and Order #969

merged 33 commits into from
Sep 16, 2023

Conversation

LuuBluum
Copy link
Contributor

@LuuBluum LuuBluum commented Dec 20, 2022

Expands upon the existing Poset structure, introducing other forms of orderings to define a preorder over cardinalities. Also includes proofs of Cantor's theorem, for both the general (no surjection into the power set) and the set-specific (an embedding into the power set).

Notably, this includes the definition of an apartness relation, which would be useful for #575 .

@felixwellen
Copy link
Collaborator

Let me know when it is ready for review (I'm asking because you added commits after marking it ready).

@felixwellen
Copy link
Collaborator

Interesting stuff!

@felixwellen
Copy link
Collaborator

I think merging master is a good idea.

@LuuBluum
Copy link
Contributor Author

LuuBluum commented Feb 2, 2023

I think it should be good for review now. Just trying to square away all the names to make sure it's all consistent.

@maxsnew
Copy link
Collaborator

maxsnew commented Mar 10, 2023

Is this ready? I have a project that uses preorders and might want to base it off of this but don't want to port anything until this is stable

@LuuBluum
Copy link
Contributor Author

Is this ready? I have a project that uses preorders and might want to base it off of this but don't want to port anything until this is stable

Yeah, there's nothing really else for me to add here.

@felixwellen
Copy link
Collaborator

Next week I should finally have enough time to merge this - sorry for the long wait.

@LuuBluum
Copy link
Contributor Author

Heh, no worries. Didn't help that I kept making changes and that this is a rather sizable PR as it is.

Copy link
Collaborator

@felixwellen felixwellen left a comment

Choose a reason for hiding this comment

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

Very nice and useful additions to the library - thanks for that!
Sorry for throwing so much bureaucracy at you, but following conventions and describing things makes it all the more useful for everyone else. Feel free to ignore my request to use more qualified imports if those turn out to be work.
The actual content looks all good to me!

Cubical/Data/Cardinality/Base.agda Show resolved Hide resolved
@@ -20,7 +20,7 @@ open import Cubical.Data.Nat
renaming (_+_ to _+ℕ_) hiding (elim)
open import Cubical.Data.Unit
open import Cubical.Data.Empty as Empty
open import Cubical.Data.Sum
open import Cubical.Data.Sum renaming (⊎-IdR-⊥-≃ to ⊎-⊥-≃)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use a qualified import, e.g. "..Sum as Sum" unless there is a good reason not to.

@@ -17,7 +17,7 @@ open import Cubical.Data.Nat.Order
import Cubical.Data.Fin as Fin
import Cubical.Data.Fin.LehmerCode as LehmerCode
open import Cubical.Data.SumFin.Base as SumFin
open import Cubical.Data.Sum
open import Cubical.Data.Sum renaming (map to map-⊎; ⊎-IdR-⊥-≃ to ⊎-⊥-≃)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Qualified import?

@@ -91,3 +100,29 @@ compSurjection (f , sur-f) (g , sur-g) =
λ c → PT.rec isPropPropTrunc
(λ (b , gb≡c) → PT.rec isPropPropTrunc (λ (a , fa≡b) → ∣ a , (cong g fa≡b ∙ gb≡c) ∣₁) (sur-f b))
(sur-g c)

-- A slightly more specific form of Lawvere's fixed point theorem
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 the "more specific".

open import Cubical.HITs.SetQuotients.Base
open import Cubical.HITs.PropositionalTruncation.Base
open import Cubical.HITs.PropositionalTruncation renaming (rec to ∥₁-rec ; map to ∥₁-map)
Copy link
Collaborator

Choose a reason for hiding this comment

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

qualified import?


open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Equiv.HalfAdjoint
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unused imports?

Cubical/Algebra/CommSemiring/Base.agda Outdated Show resolved Hide resolved
@timorl
Copy link
Contributor

timorl commented Jun 30, 2023

Hi! This PR seems to be a bit dead and I would like this to eventually get merged, because I would like to have #286 for some personal work. Thus I'm planning to try dissecting it into a couple smaller PRs and submitting these with the issues from the above comments resolved and more comments in the code (I will be trying to understand everything that is going on myself, so writing down what I figure out shouldn't be too much effort).

I should be able to preserve authorship, but I would still like to know whether @LuuBluum is fine with that or perhaps just wants to finish the PR? So please let me know whether this is a problem.

You probably have quite some time, I have no idea when I'll actually manage to prepare even the first PR.

@LuuBluum
Copy link
Contributor Author

Oh, sorry about that; I should be able to get around to fixing the issues with this. Was just a bit busy with other stuff as of late.

@felixwellen
Copy link
Collaborator

You have to rebase onto current master (or merge master into your branch) to resolve the conflicts, let me know if you need help doing that (don't know what your background is). I recommend rebasing before you resolve any other problem.

@LuuBluum
Copy link
Contributor Author

Alright, finally taking a look at this again.

@LuuBluum
Copy link
Contributor Author

Cleaned up the comments.

Copy link
Collaborator

@felixwellen felixwellen left a comment

Choose a reason for hiding this comment

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

Thanks!

@felixwellen felixwellen merged commit 85f8a71 into agda:master Sep 16, 2023
1 check passed
LuuBluum added a commit to LuuBluum/cubical that referenced this pull request Oct 29, 2023
* Proof that embeddings are monotone over sums

Also cleaned up several aspects of things.

* Embeddings are monotone over products

* Define cardinal exponentiation

* Minor formatting clean-up

* Removal of some excessive imports

* Renamed annihiliation by 0 to be less vague

* Renamed Cantor's Theorem results

* Cleaned up order property definitions

* Replace renaming

* Require preordering for order properties

* Remove extra level variable that's unused

* Removed redundant implicit level term

* Replace type families with embeddings as subtypes

More consistent with the idea of a "subset" and
also makes reasoning easier by keeping the sigma
types out of the type signatures.

* Cleaned up types for embeddings in order props

* Added function in Embedding to simplify constructs

Sigma-types where the type family is always a prop
embed into the first argument's type

* Minor clean-up

* Better respecting camel case

* Name-cleaning and removing unused imports

* Reintroduce erroneously-removed newline

* Renamed loset to toset, strict loset to loset

Also required losets to be weakly linear

* Fixed paths in top-level file

* Defined induced relations over embeddings

* Better capitalization

* Renamed one more detail

* Moved order properties into their own folders

* Reduced imports for cardinals

* Removed unused apartness import

* Changed capitalization back for conversions

* Proved induced relations preserve order properties

* Loosened embedding to mere function for bounds

* Fixed whitespace

* Fix rebase issues

* Resolve PR comments
@LuuBluum LuuBluum deleted the Order branch October 29, 2023 06:06
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.

4 participants