Built with Alectryon, running Coq+SerAPI v8.18.0+0.18.3. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑ Ctrl+↓ to navigate, Ctrl+🖱️ to focus. On Mac, use instead of Ctrl.
(* -*- mode: coq; mode: visual-line -*- *)
(** * Theorems about the unit type *)

[Loading ML file number_string_notation_plugin.cmxs (using legacy method) ... done]
Local Open Scope path_scope. Local Set Universe Minimization ToSet. Generalizable Variables A. (** ** Eta conversion *) Definition eta_unit (z : Unit) : tt = z := match z with tt => 1 end. (** ** Paths *) (* This is all kind of ridiculous, but it fits the pattern. *) Definition path_unit_uncurried (z z' : Unit) : Unit -> z = z' := fun _ => match z, z' with tt, tt => 1 end. Definition path_unit (z z' : Unit) : z = z' := path_unit_uncurried z z' tt.
z, z': Unit
p: z = z'

path_unit z z' = p
z, z': Unit
p: z = z'

path_unit z z' = p
z: Unit

path_unit z z = 1

path_unit tt tt = 1
reflexivity. Defined.
z, z': Unit

IsEquiv (path_unit_uncurried z z')
z, z': Unit

IsEquiv (path_unit_uncurried z z')
z, z': Unit

forall x : Unit, match path_unit_uncurried z z' x as p in (_ = z') return (path_unit_uncurried z z' tt = p) with | 1 => match z return (path_unit_uncurried z z tt = 1) with | tt => 1 end end = ap (path_unit_uncurried z z') match x as x0 return (tt = x0) with | tt => 1 end
intros []; destruct z, z'; reflexivity. Defined. Definition equiv_path_unit (z z' : Unit) : Unit <~> (z = z') := Build_Equiv _ _ (path_unit_uncurried z z') _. (** ** Transport *) (** Is a special case of transporting in a constant fibration. *) (** ** Universal mapping properties *) (* The positive universal property *) Arguments Unit_ind [A] a u : rename. Global Instance isequiv_unit_ind `{Funext} (A : Unit -> Type) : IsEquiv (@Unit_ind A) | 0 := isequiv_adjointify _ (fun f : forall u:Unit, A u => f tt) (fun f : forall u:Unit, A u => path_forall (@Unit_ind A (f tt)) f (fun x => match x with tt => 1 end)) (fun _ => 1). Global Instance isequiv_unit_rec `{Funext} (A : Type) : IsEquiv (@Unit_ind (fun _ => A)) | 0 := isequiv_unit_ind (fun _ => A). #[local] Hint Extern 4 => progress (cbv beta iota) : typeclass_instances. Definition equiv_unit_rec `{Funext} (A : Type) : A <~> (Unit -> A) := (Build_Equiv _ _ (@Unit_ind (fun _ => A)) _). (* For various reasons, it is typically more convenient to define functions out of the unit as constant maps, rather than [Unit_ind]. *) Notation unit_name x := (fun (_ : Unit) => x).
H: Funext
A: Type

IsEquiv (fun a : A => unit_name a)
H: Funext
A: Type

IsEquiv (fun a : A => unit_name a)
H: Funext
A: Type

(fun x : Unit -> A => unit_name (x tt)) == idmap
H: Funext
A: Type
idmap == idmap
H: Funext
A: Type

(fun x : Unit -> A => unit_name (x tt)) == idmap
H: Funext
A: Type
f: Unit -> A
x: Unit

f tt = f x
apply ap@{i i}, path_unit.
H: Funext
A: Type

idmap == idmap
intros a; reflexivity. Defined. (* The negative universal property *) Definition unit_coind {A : Type} : Unit -> (A -> Unit) := fun _ _ => tt.
H: Funext
A: Type

IsEquiv unit_coind
H: Funext
A: Type

IsEquiv unit_coind
H: Funext
A: Type

(fun _ : A -> Unit => unit_coind tt) == idmap
H: Funext
A: Type
unit_name tt == idmap
H: Funext
A: Type

(fun _ : A -> Unit => unit_coind tt) == idmap
H: Funext
A: Type
f: A -> Unit

unit_coind tt = f
apply path_forall; intros x; apply path_unit.
H: Funext
A: Type

unit_name tt == idmap
intro x; destruct x; reflexivity. Defined. Definition equiv_unit_coind `{Funext} (A : Type) : Unit <~> (A -> Unit) := Build_Equiv _ _ (@unit_coind A) _. (** ** Truncation *) (* The Unit type is contractible *) Global Instance contr_unit : Contr Unit | 0 := Build_Contr _ tt (fun t : Unit => match t with tt => 1 end). (** ** Equivalences *) (** A contractible type is equivalent to [Unit]. *) Definition equiv_contr_unit `{Contr A} : A <~> Unit := equiv_contr_contr. (* Conversely, a type equivalent to [Unit] is contractible. We don't make this an instance because Coq would have to guess the equivalence. And when it has a map in mind, it would try to use [isequiv_contr_contr], which would cause a cycle. *) Definition contr_equiv_unit (A : Type) (f : A <~> Unit) : Contr A := contr_equiv' Unit f^-1%equiv. (** The constant map to [Unit]. We define this so we can get rid of an unneeded universe variable that Coq generates when [const tt] is used in a context that doesn't have [Universe Minimization ToSet] as this file does. If we ever set that globally, then we could get rid of this and remove some imports of this file. *) Definition const_tt (A : Type) := @const A Unit tt.