-
Notifications
You must be signed in to change notification settings - Fork 201
Smallness #1867
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
Merged
Smallness #1867
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
8a786e7
Smallness
Alizter e839d96
Merge branch 'master' into ps/branch/smallness
Alizter dd88db7
move ObjectClassifier.v to Universes/
Alizter bc23ce5
move DProp.v to Universes/
Alizter 446abbc
move HProp.v to Universes/
Alizter 1361729
move HSet.v to Universes/
Alizter 2cf1be3
move UniverseLevel.v to Universes/
Alizter ade8699
move TruncType.v to Universes
Alizter c6cd3d4
STYLE.md: update to reflect new Universes/ folder
jdchristensen 9e2c076
Merge branch 'master' into ps/branch/smallness
Alizter c79bebf
use smallness in PropResizing
Alizter 17a2823
make IsSmall cumulative
Alizter a32acae
fit things in margin
Alizter 83cf95d
reformat record
Alizter 0bf9633
move homeless lemmas from Smallness to PropResizing
Alizter 194ac26
remove stale comments
Alizter 6118f28
move Smallness.v to Universes
Alizter 067631b
Smallness, PropResizing: use "islocallysmall" and "issmall" consistently
jdchristensen dd53e48
PropResizing: clarify comment about universes, now that we have cumul…
jdchristensen 82d6460
move IsSmall to Overture.v
Alizter 7e80dc0
move extra prop resizing lemmas back to Smallness.v
Alizter 1af5422
refine imports for PropResizing
Alizter 13cf546
add todos for Smallness.v
Alizter 9fa3101
fix order of universe vars
Alizter 12fd26a
remove todos from PropResizing about inlining
Alizter f817791
move trunc_index_to_nat and refine requires
Alizter f6af27f
make IsSmall a typeclass
Alizter ad8e561
remove equiv_resize_hprop
Alizter f8778c0
remove resize_hprop and replace with smalltype
Alizter 824e536
remove ishprop_resize_hprop
Alizter 9eb3553
inline PropResizing.v in Overture.v
Alizter fb82214
update comments add instances
Alizter 3ff42f4
update STYLE.md
Alizter 2ec2f24
clarify Smallness require
Alizter 7f93879
STYLE.md: fix typo
jdchristensen 877d213
make IsLocallySmall a typeclass
Alizter 291a203
move PropResizing/ contents to Metatheory/
Alizter 151ae53
include PropResizing axiom
Alizter 96d178b
move Spaces/Universe.v to Universes/
Alizter 4c16049
move BAut.v to Universes/
Alizter 4e37926
rename Universes.Universe -> Universes.Automorphisms
Alizter 872aae3
move BAut/Rigid.v to Universes/
Alizter 3a6190e
STYLE.md: update to match current situation
jdchristensen 92483c1
Types/Equiv, Smallness: minor cleanups
jdchristensen 18c6a48
fix universe variance in IsSmall
Alizter 9941271
Revert "fix universe variance in IsSmall"
Alizter 0011284
Make universe i invariant in IsSmall; simplify lots elsewhere
jdchristensen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,240 @@ | ||
| Require Import Basics Types.Unit Types.Sigma Types.Universe Types.Equiv. | ||
| Require Import HFiber Truncations Pointed.Core Pointed.Loops. | ||
| Require Import PropResizing. | ||
|
|
||
| (** * Facts about "small" types *) | ||
|
|
||
| (** This closely follows Section 2 of the paper "Non-accessible localizations", by Dan Christensen, https://arxiv.org/abs/2109.06670 *) | ||
|
|
||
| (* TODO: be consistent about "issmall" vs "small", "islocally" vs "locally". | ||
| Also, should it be "islocally_small" or "islocallysmall"? *) | ||
| (* Require Import Conn. *) | ||
| (* Require Import misc. *) | ||
|
|
||
| Open Scope trunc_scope. | ||
|
|
||
| (** Universe variables: we most often use a subset of [i j k u]. We think of [Type@{i}] as containing the "small" types and [Type@{j}] the "large" types. In some early results, there are no constraints between [i] and [j], and in others we require that [i <= j], as expected. While the case [i = j] isn't particularly interesting, we put some effort into ensuring that it is permitted as well, as there is no semantic reason to exclude it. The universe variable [k] should be thought of as max(i+1,j), and it is generally required to satisfy [i < k] and [j <= k]. If we assume that [i < j], then we can take [k = j], but we include [k] so that we also allow the case [i = j]. The universe variable [u] is only present because we occasionally use Univalence in [Type@{k}], so the equality types need a larger universe to live in. Because of this, most results require [k < u]. | ||
|
|
||
| Summary of the most common situation: [i < k < u, j <= k], where [i] is for the small types, [j] is for the large types, [k = max(i+1,j)] and [u] is an ambient universe for Univalence. | ||
|
|
||
| We include universe annotations when they clarify the meaning (e.g. in [IsSmall] and when using [PropResizing]), and also when it is required in order to keep control of the universe variables. *) | ||
|
|
||
| (** We say that [X : Type@{j}] is small (relative to Type@{i}) if it is equivalent to a type in [Type@{i}]. We use a record to avoid an extra universe variable. This version has no constraints on [i] and [j]. It lands in [max(i+1,j)], as expected. *) | ||
| Record IsSmall@{i j | } (X : Type@{j}) := | ||
| { smalltype : Type@{i} ; | ||
| equiv_smalltype : smalltype <~> X | ||
| }. | ||
| Arguments smalltype {X} _. | ||
| Arguments equiv_smalltype {X} _. | ||
|
|
||
| (** Note: making [IsSmall] Cumulative makes the following two not necessary, but also means that Coq can't guess universe variables as well in other spots in the file. *) | ||
| (* TODO: try cumulativity again? *) | ||
| Definition lift_issmall@{i j1 j2 | j1 <= j2} | ||
| (X : Type@{j1}) | ||
| (sX : IsSmall@{i j1} X) | ||
| : IsSmall@{i j2} X | ||
| := Build_IsSmall X (smalltype sX) (equiv_smalltype sX). | ||
|
|
||
| Definition lower_issmall@{i j1 j2 | j1 <= j2} | ||
| (X : Type@{j1}) | ||
| (sX : IsSmall@{i j2} X) | ||
| : IsSmall@{i j1} X | ||
| := Build_IsSmall X (smalltype sX) (equiv_smalltype sX). | ||
|
|
||
| Global Instance ishprop_issmall@{i j k | i < k, j <= k} `{Univalence} (X : Type@{j}) | ||
| : IsHProp (IsSmall@{i j} X). | ||
| Proof. | ||
| apply hprop_inhabited_contr. | ||
| intros [Z e]. | ||
| (* [IsSmall X] is equivalent to [IsSmall Z], which is contractible since it is a based path space. *) | ||
| rapply (istrunc_equiv_istrunc { Y : Type@{i} & Y <~> Z } _). | ||
| equiv_via (sig@{k k} (fun Y : Type@{i} => Y <~> X)). | ||
| 2: issig. | ||
| apply equiv_functor_sigma_id. | ||
| intro Y. | ||
| exact (equiv_functor_postcompose_equiv Y e). | ||
| Defined. | ||
|
|
||
| (** A type in [Type@{i}] is clearly small. Make this a Global Instance? *) | ||
| Definition issmall_in@{i j | i <= j} (X : Type@{i}) : IsSmall@{i j} X | ||
| := Build_IsSmall X X equiv_idmap. | ||
|
|
||
| (** The small types are closed under equivalence. *) | ||
| Definition issmall_equiv_issmall@{i j1 j2 | } {A : Type@{j1}} {B : Type@{j2}} | ||
| (e : A <~> B) (sA : IsSmall@{i j1} A) | ||
| : IsSmall@{i j2} B. | ||
| Proof. | ||
| exists (smalltype sA). | ||
| exact (e oE (equiv_smalltype sA)). | ||
| Defined. | ||
|
|
||
| (** The small types are closed under dependent sums. *) | ||
| Definition sigma_closed_issmall@{i j | } {A : Type@{j}} | ||
| (B : A -> Type@{j}) (sA : IsSmall@{i j} A) | ||
| (sB : forall a, IsSmall@{i j} (B a)) | ||
| : IsSmall@{i j} { a : A & B a }. | ||
| Proof. | ||
| exists { a : (smalltype sA) & (smalltype (sB (equiv_smalltype sA a))) }. | ||
| snrapply equiv_functor_sigma'; intros; apply equiv_smalltype. | ||
| Defined. | ||
|
|
||
| (** If a map has small codomain and fibers, then the domain is small. *) | ||
| Definition issmall_codomain_fibers_small@{i j | } {X Y : Type@{j}} | ||
| (f : X -> Y) | ||
| (sY : IsSmall@{i j} Y) | ||
| (sF : forall y : Y, IsSmall@{i j} (hfiber f y)) | ||
| : IsSmall@{i j} X. | ||
| Proof. | ||
| nrapply issmall_equiv_issmall. | ||
| - exact (equiv_fibration_replacement f)^-1%equiv. | ||
| - apply sigma_closed_issmall; assumption. | ||
| Defined. | ||
|
|
||
| (** Propositional resizing says that every (-1)-truncated type is small. *) | ||
| Definition issmall_hprop@{i j | } `{PropResizing} (X : Type@{j}) (T : IsTrunc (-1) X) | ||
| : IsSmall@{i j} X. | ||
| Proof. | ||
| exists (resize_hprop@{j i} X). | ||
| apply (equiv_resize_hprop X)^-1%equiv. | ||
| Defined. | ||
|
|
||
| (** Every contractible type is small. *) | ||
| Definition issmall_contr@{i j| } (X : Type@{j}) (T : IsTrunc (-2) X): IsSmall@{i j} X. | ||
| Proof. | ||
| refine (issmall_equiv_issmall (equiv_contr_unit)^-1 _). | ||
| apply issmall_in. | ||
| Defined. | ||
|
|
||
| (** If we can show that [X] is small when it is inhabited, then it is in fact small. This isn't yet in the paper. It lets us simplify the statement of Proposition 2.8. Note that this implies propositional resizing, so the [PropResizing] assumption is necessary. *) | ||
| Definition issmall_inhabited_issmall@{i j k | i < k, j <= k} `{PropResizing} `{Univalence} | ||
| (X : Type@{j}) | ||
| (isX : X -> IsSmall@{i j} X) | ||
| : IsSmall@{i j} X. | ||
| Proof. | ||
| (* Since IsSmall@{i j} lives in a universe larger than [i] and we're not assuming [i <= j], we have to pass through universe [k], which we think of as max(i+1,j). *) | ||
| apply lower_issmall@{i j k}. | ||
| (* Now the goal is IsSmall@{i k} X. *) | ||
| apply (issmall_codomain_fibers_small isX). | ||
| - rapply issmall_hprop. | ||
| - intro sX. | ||
| apply sigma_closed_issmall. | ||
| 1: apply (lift_issmall _ sX). | ||
| intro x. | ||
| rapply issmall_contr. | ||
| Defined. | ||
|
|
||
| (** * Locally small types *) | ||
|
|
||
| (** We say that a type [X] is 0-locally small if it is small, and (n+1)-locally small if its identity types are n-locally small. *) | ||
| (* TODO: Can I make this an inductive type and avoid the extra universe variable [k]? *) | ||
| Fixpoint IsLocallySmall@{i j k | i < k, j <= k} (n : nat) (X : Type@{j}) : Type@{k} | ||
| := match n with | ||
| | 0%nat => IsSmall@{i j} X | ||
| | S m => forall x y : X, IsLocallySmall m (x = y) | ||
| end. | ||
|
|
||
| Global Instance ishprop_islocally_small@{i j k | i < k, j <= k} `{Univalence} | ||
| (n : nat) (X : Type@{j}) | ||
| : IsHProp@{k} (IsLocallySmall@{i j k} n X). | ||
| Proof. | ||
| (* Here and later we use [simple_induction] to control the universe variable. *) | ||
| revert X; simple_induction n n IHn; exact _. | ||
| Defined. | ||
|
|
||
| (** A small type is n-locally small for all [n]. *) | ||
| Definition islocally_small_in@{i j k | i <= j, j <= k, i < k} (n : nat) (X : Type@{i}) | ||
| : IsLocallySmall@{i j k} n X. | ||
| Proof. | ||
| revert X. | ||
| induction n; intro X. | ||
| - apply issmall_in. | ||
| - intros x y. | ||
| exact (IHn (x = y)). | ||
| Defined. | ||
|
|
||
| (** The n-locally small types are closed under equivalence. *) | ||
| Definition islocally_small_equiv_islocally_small@{i j1 j2 k | i < k, j1 <= k, j2 <= k} | ||
| (n : nat) {A : Type@{j1}} {B : Type@{j2}} | ||
| (e : A <~> B) (lsA : IsLocallySmall@{i j1 k} n A) | ||
| : IsLocallySmall@{i j2 k} n B. | ||
| Proof. | ||
| revert A B e lsA. | ||
| simple_induction n n IHn. | ||
| - exact @issmall_equiv_issmall. | ||
| - intros A B e lsA b b'. | ||
| nrapply IHn. | ||
| * exact (equiv_ap' (e^-1%equiv) b b')^-1%equiv. | ||
| * apply lsA. | ||
| Defined. | ||
|
|
||
| (** A small type is n-locally small for all n. *) | ||
| Definition islocally_small_small@{i j k | i < k, j <= k} (n : nat) | ||
| (X : Type@{j}) (sX : IsSmall@{i j} X) | ||
| : IsLocallySmall@{i j k} n X. | ||
| Proof. | ||
| apply (islocally_small_equiv_islocally_small n (equiv_smalltype sX)). | ||
| apply islocally_small_in. | ||
| Defined. | ||
|
|
||
| (** If a type is n-locally small, then it is (n+1)-locally small. *) | ||
| Definition islocally_small_succ@{i j k | i < k, j <= k} (n : nat) | ||
| (X : Type@{j}) (lsX : IsLocallySmall@{i j k} n X) | ||
| : IsLocallySmall@{i j k} n.+1 X. | ||
| Proof. | ||
| revert X lsX; simple_induction n n IHn; intros X. | ||
| - apply islocally_small_small. | ||
| - intro lsX. | ||
| intros x y. | ||
| apply IHn, lsX. | ||
| Defined. | ||
|
|
||
| (** The n-locally small types are closed under dependent sums. *) | ||
| Definition sigma_closed_islocally_small@{i j k | i < k, j <= k} | ||
| (n : nat) {A : Type@{j}} (B : A -> Type@{j}) | ||
| (lsA : IsLocallySmall@{i j k} n A) | ||
| (lsB : forall a, IsLocallySmall@{i j k} n (B a)) | ||
| : IsLocallySmall@{i j k} n { a : A & B a }. | ||
| Proof. | ||
| revert A B lsA lsB. | ||
| simple_induction n n IHn. | ||
| - exact @sigma_closed_issmall. | ||
| - intros A B lsA lsB x y. | ||
| apply (islocally_small_equiv_islocally_small n (equiv_path_sigma _ x y)). | ||
| apply IHn. | ||
| * apply lsA. | ||
| * intro p. | ||
| apply lsB. | ||
| Defined. | ||
|
|
||
| (** If a map has n-locally small codomain and fibers, then the domain is n-locally small. *) | ||
| Definition islocally_small_codomain_fibers_locally_small@{i j k | i < k, j <= k} | ||
| (n : nat) {X Y : Type@{j}} (f : X -> Y) | ||
| (sY : IsLocallySmall@{i j k} n Y) | ||
| (sF : forall y : Y, IsLocallySmall@{i j k} n (hfiber f y)) | ||
| : IsLocallySmall@{i j k} n X. | ||
| Proof. | ||
| nrapply islocally_small_equiv_islocally_small. | ||
| - exact (equiv_fibration_replacement f)^-1%equiv. | ||
| - apply sigma_closed_islocally_small; assumption. | ||
| Defined. | ||
|
|
||
| (** Sends a trunc_index [n] to the natural number [n+2]. *) | ||
| Fixpoint trunc_index_to_nat (n : trunc_index) : nat | ||
| := match n with | ||
| | minus_two => 0 | ||
| | n'.+1 => (trunc_index_to_nat n').+1 | ||
| end. | ||
|
|
||
| Notation "n ..+2" := (trunc_index_to_nat n) (at level 2) : trunc_scope. | ||
|
|
||
| (** Under propositional resizing, every (n+1)-truncated type is (n+2)-locally small. This is Lemma 2.3 in the paper. *) | ||
| Definition islocally_small_trunc@{i j k | i < k, j <= k} `{PropResizing} | ||
| (n : trunc_index) (X : Type@{j}) (T : IsTrunc n.+1 X) | ||
| : IsLocallySmall@{i j k} n..+2 X. | ||
| Proof. | ||
| revert n X T. | ||
| simple_induction n n IHn; cbn. | ||
| - nrapply issmall_hprop. | ||
| - intros X T x y. | ||
| rapply IHn. | ||
| Defined. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.