(************************************************************************)
(*         *      The Rocq Prover / The Rocq Development Team           *)
(*  v      *         Copyright INRIA, CNRS and contributors             *)
(* <O___,, * (see version control and CREDITS file for authors & dates) *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)
(** The first three levels of homotopy type theory: homotopy propositions, homotopy sets and homotopy one types. For more information, https://github.com/HoTT/HoTT and https://homotopytypetheory.org/book  Univalence is not assumed here, and equality is Coq's usual inductive type eq in sort Prop. This is a little different from HoTT, where sort Prop does not exist and equality is directly in sort Type. *)
(* It is almost impossible to prove that a type is a homotopy proposition without funext, so we assume it here. *)
(* A homotopy proposition is a type that has at most one element. Its unique inhabitant, when it exists, is to be interpreted as the proof of the homotopy proposition. Homotopy propositions are therefore an alternative to the sort Prop, to select which types represent mathematical propositions. *)
Definition IsHProp (P : Type) : Prop
:= forall p q : P, p = q.
(* A homotopy set is a type such as each equality type x = y is a homotopy proposition. For example, any type which equality is decidable in sort Prop is a homotopy set, as shown in file Stdlib.Logic.Eqdep_dec.v. *)
Definition IsHSet (X : Type) : Prop
:= forall (x y : X) (p q : x = y), p = q.
Definition IsHOneType (X : Type) : Prop
:= forall (x y : X) (p q : x = y) (r s : p = q), r = s.

(* Homotopy propositions are stable by conjunction, but not by disjunction, which can have a proof by the left and another proof by the right. *)
Lemma and_hprop : forall P Q : Prop,
IsHProp P -> IsHProp Q -> IsHProp (P /\ Q).