-
Notifications
You must be signed in to change notification settings - Fork 193
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
Basics of (oo,n)-categories #1302
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,7 +169,7 @@ Notation "x .2" := (pr2 x) : fibration_scope. | |
|
||
Definition uncurry {A B C} (f : A -> B -> C) (p : A * B) : C := f (fst p) (snd p). | ||
|
||
(** Composition of functions. *) | ||
(** *** Composition of functions. *) | ||
|
||
Notation compose := (fun g f x => g (f x)). | ||
|
||
|
@@ -694,6 +694,8 @@ Class Irreflexive {A} (R : Relation A) := | |
Class Asymmetric {A} (R : Relation A) := | ||
asymmetry : forall {x y}, R x y -> (complement R y x : Type). | ||
|
||
(** *** Unit type *) | ||
|
||
(** Likewise, we put [Unit] here, instead of in [Unit.v], because [Trunc] uses it. *) | ||
Inductive Unit : Type0 := | ||
tt : Unit. | ||
|
@@ -705,6 +707,90 @@ Definition Unit_rect := Unit_ind. | |
(** A [Unit] goal should be resolved by [auto] and [trivial]. *) | ||
Hint Resolve tt : core. | ||
|
||
(** ** Natural numbers *) | ||
|
||
(** The natural numbers are defined in [Coq.Init.Datatypes] (we weren't able to excise them from the stdlib), and studied further in [Spaces.Nat]. But her we give some basic definitions. *) | ||
|
||
Definition pred (n : nat) : nat | ||
:= match n with | ||
| 0 => 0 | ||
| S n => n | ||
end. | ||
|
||
Notation "n .-1" := (pred n) : nat_scope. | ||
|
||
(** *** Booleans *) | ||
|
||
(* coq calls it "bool", we call it "Bool" *) | ||
Local Unset Elimination Schemes. | ||
Inductive Bool : Type0 := | ||
| true : Bool | ||
| false : Bool. | ||
Scheme Bool_ind := Induction for Bool Sort Type. | ||
Scheme Bool_rec := Minimality for Bool Sort Type. | ||
(* For compatibility with Coq's [induction] *) | ||
Definition Bool_rect := Bool_ind. | ||
|
||
Add Printing If Bool. | ||
|
||
Declare Scope bool_scope. | ||
|
||
Delimit Scope bool_scope with Bool. | ||
|
||
Bind Scope bool_scope with Bool. | ||
|
||
(** ** Coinductive streams *) | ||
|
||
CoInductive Stream (A : Type) := scons | ||
{ | ||
head : A ; | ||
tail : Stream A | ||
}. | ||
|
||
Arguments scons {A} _ _. | ||
Arguments head {A} _. | ||
Arguments tail {A} _. | ||
|
||
CoFixpoint const_stream {A} (a : A) : Stream A | ||
:= scons a (const_stream a). | ||
|
||
|
||
(** *** Typeclasses for case analysis *) | ||
|
||
(** Versions of [n = 0] and [n > 0] that are typeclasses and can be found automatically. *) | ||
Definition IsZeroNat (n : nat) : Type := | ||
match n with | ||
| O => Unit | ||
| S _ => Empty | ||
end. | ||
Existing Class IsZeroNat. | ||
Global Instance iszeronat : IsZeroNat 0 := tt. | ||
|
||
Definition IsPosNat (n : nat) : Type := | ||
match n with | ||
| O => Empty | ||
| S _ => Unit | ||
end. | ||
Existing Class IsPosNat. | ||
Global Instance isposnat (n : nat) : IsPosNat (S n) := tt. | ||
Comment on lines
+760
to
+775
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it might make more sense have these be aliases for |
||
|
||
Definition IsTrue (b : Bool) : Type := | ||
match b with | ||
| true => Unit | ||
| false => Empty | ||
end. | ||
Existing Class IsTrue. | ||
Global Instance istrue : IsTrue true := tt. | ||
|
||
Definition IsFalse (b : Bool) : Type := | ||
match b with | ||
| true => Empty | ||
| false => Unit | ||
end. | ||
Existing Class IsFalse. | ||
Global Instance isfalse : IsFalse false := tt. | ||
|
||
|
||
(** *** Pointed types *) | ||
|
||
(** A space is pointed if that space has a point. *) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,6 +133,15 @@ Defined. | |
Notation "n '.-1'" := (trunc_index_pred n) : trunc_scope. | ||
Notation "n '.-2'" := (n.-1.-1) : trunc_scope. | ||
|
||
(** A version of [n = -2] that's a typeclass. *) | ||
Definition IsMinusTwo (n : trunc_index) : Type := | ||
match n with | ||
| minus_two => Unit | ||
| trunc_S _ => Empty | ||
end. | ||
Existing Class IsMinusTwo. | ||
Global Instance isminustwo : IsMinusTwo (-2) := tt. | ||
|
||
Comment on lines
+136
to
+144
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, maybe we want to go through a boolean equality on trunc_index? |
||
Definition trunc_index_leq_minus_two {n} | ||
: n <= -2 -> n = -2. | ||
Proof. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
Also, I think this is no longer true as of #1429