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

[Merged by Bors] - feat(data/equiv/encodable): ulower lowers countable types to Type 0 #2574

Closed
wants to merge 4 commits into from

Conversation

gebner
Copy link
Member

@gebner gebner commented Apr 30, 2020

Given a type α : Type u, we can lift it into a higher universe using ulift α : Type (max u v). This PR introduces an analogous construction going in the other direction. Given an encodable (= countable) type α : Type u, we can lower it to the very bottom using ulower α : Type 0. The equivalence is primitive recursive if the type is primcodable.

The definition of the equivalence was already present as encodable.equiv_range_encode. However it is very inconvenient to use since it requires decidability instances (encodable.decidable_range_encode) that are not enabled by default because they would introduce overlapping instances that are not definitionally equal.

@gebner
Copy link
Member Author

gebner commented Apr 30, 2020

I plan to use this type to refactor the many-one degrees so that there is only one many_one_degree : Type instead of many_one_degree (α : Type u) : Type u.
https://github.com/leanprover-community/mathlib/compare/bundled_degrees

@gebner gebner changed the title feat(data/equiv/encodable): introduce ulower feat(data/equiv/encodable): ulower lowers countable types to Type 0 Apr 30, 2020
@urkud
Copy link
Member

urkud commented Apr 30, 2020

data/equiv/encodable part LGTM. I have no clue about computability/.

@gebner gebner added the awaiting-review The author would like community review of the PR label May 1, 2020
Copy link
Member

@digama0 digama0 left a comment

Choose a reason for hiding this comment

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

LGTM

bors r+

@github-actions github-actions bot added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-review The author would like community review of the PR labels May 7, 2020
bors bot pushed a commit that referenced this pull request May 7, 2020
…0` (#2574)

Given a type `α : Type u`, we can lift it into a higher universe using `ulift α : Type (max u v)`.  This PR introduces an analogous construction going in the other direction.  Given an encodable (= countable) type `α : Type u`, we can lower it to the very bottom using `ulower α : Type 0`.  The equivalence is primitive recursive if the type is primcodable.

The definition of the equivalence was already present as `encodable.equiv_range_encode`.  However it is very inconvenient to use since it requires decidability instances (`encodable.decidable_range_encode`) that are not enabled by default because they would introduce overlapping instances that are not definitionally equal.
@bors
Copy link

bors bot commented May 8, 2020

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(data/equiv/encodable): ulower lowers countable types to Type 0 [Merged by Bors] - feat(data/equiv/encodable): ulower lowers countable types to Type 0 May 8, 2020
@bors bors bot closed this May 8, 2020
@bors bors bot deleted the ulower branch May 8, 2020 01:30
anrddh pushed a commit to anrddh/mathlib that referenced this pull request May 15, 2020
…0` (leanprover-community#2574)

Given a type `α : Type u`, we can lift it into a higher universe using `ulift α : Type (max u v)`.  This PR introduces an analogous construction going in the other direction.  Given an encodable (= countable) type `α : Type u`, we can lower it to the very bottom using `ulower α : Type 0`.  The equivalence is primitive recursive if the type is primcodable.

The definition of the equivalence was already present as `encodable.equiv_range_encode`.  However it is very inconvenient to use since it requires decidability instances (`encodable.decidable_range_encode`) that are not enabled by default because they would introduce overlapping instances that are not definitionally equal.
anrddh pushed a commit to anrddh/mathlib that referenced this pull request May 16, 2020
…0` (leanprover-community#2574)

Given a type `α : Type u`, we can lift it into a higher universe using `ulift α : Type (max u v)`.  This PR introduces an analogous construction going in the other direction.  Given an encodable (= countable) type `α : Type u`, we can lower it to the very bottom using `ulower α : Type 0`.  The equivalence is primitive recursive if the type is primcodable.

The definition of the equivalence was already present as `encodable.equiv_range_encode`.  However it is very inconvenient to use since it requires decidability instances (`encodable.decidable_range_encode`) that are not enabled by default because they would introduce overlapping instances that are not definitionally equal.
bors bot pushed a commit that referenced this pull request Jan 13, 2021
…eter (#2630)

The file `reduce.lean` defines many-one degrees for computable reductions.  At the moment every primcodable type `α` has a separate type of degrees `many_one_degree α`.  This is completely antithetical to the notion of degrees, which are introduced to classify problems up to many-one equivalence.

This PR defines a single `many_one_degree` type that lives in `Type 0`.  We use the `ulower` infrastructure from #2574 which shows that every type is computably equivalent to a subset of natural numbers.  The function `many_one_degree.of` which assigns to every set of a primcodable type a degree is still universe polymorphic.  In particular, we show that `of p = of q ↔ many_one_equiv p q`, etc. in maximal generality, where `p` and `q` are subsets of different types in different universes.

See previous discussion at #1203.
b-mehta pushed a commit that referenced this pull request Jan 16, 2021
…eter (#2630)

The file `reduce.lean` defines many-one degrees for computable reductions.  At the moment every primcodable type `α` has a separate type of degrees `many_one_degree α`.  This is completely antithetical to the notion of degrees, which are introduced to classify problems up to many-one equivalence.

This PR defines a single `many_one_degree` type that lives in `Type 0`.  We use the `ulower` infrastructure from #2574 which shows that every type is computably equivalent to a subset of natural numbers.  The function `many_one_degree.of` which assigns to every set of a primcodable type a degree is still universe polymorphic.  In particular, we show that `of p = of q ↔ many_one_equiv p q`, etc. in maximal generality, where `p` and `q` are subsets of different types in different universes.

See previous discussion at #1203.
cipher1024 pushed a commit to cipher1024/mathlib that referenced this pull request Mar 15, 2022
…0` (leanprover-community#2574)

Given a type `α : Type u`, we can lift it into a higher universe using `ulift α : Type (max u v)`.  This PR introduces an analogous construction going in the other direction.  Given an encodable (= countable) type `α : Type u`, we can lower it to the very bottom using `ulower α : Type 0`.  The equivalence is primitive recursive if the type is primcodable.

The definition of the equivalence was already present as `encodable.equiv_range_encode`.  However it is very inconvenient to use since it requires decidability instances (`encodable.decidable_range_encode`) that are not enabled by default because they would introduce overlapping instances that are not definitionally equal.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants