(* This program is free software; you can redistribute it and/or      *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1   *)
(* of the License, or (at your option) any later version.             *)
(*                                                                    *)
(* This program is distributed in the hope that it will be useful,    *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of     *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *)
(* GNU General Public License for more details.                       *)
(*                                                                    *)
(* You should have received a copy of the GNU Lesser General Public   *)
(* License along with this program; if not, write to the Free         *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA                                                     *)
(*****************)
(** * Universes  *)
(*****************)
(** In what follows, we will work with explicit universes rather than with Coq-style implicit universes.  For that, we define two universes Typ1 and Typ2 as shorthands for the generic universe Type by enforcing the constraint Typ1 : Typ2 so that Coq knows that the implicit index associated to Typ1 is smaller than the implicit index associated to Typ2. *)
Definition Typ2 := Type.
Definition Typ1 : Typ2 := Type. (* enforce Typ1 : Typ2 *)
(** Intuitively:  - Typ1 is the universe of small types, which contains the type Prop of propositions, and is closed under dependent product.  - Typ2 is the top-universe of large types, which contains the universe Typ1, and is closed under dependent product again.  In the following, small types (i.e. the inhabitants of Typ1) will be used as the carriers of pointed graphs (for representing sets). *)
(** The type of binary relations: *)
Definition Rel (X : Typ1) : Typ1 := X -> X -> Prop.
(***************************)
(** * Logical connectives  *)
(***************************)
(** To avoid the use of Coq-style inductive definitions, we redefine all the logical connectives from their second-order encoding and give their introduction rules.  Except in a few cases, it is not necessary to give the corresponding elimination rules whose behaviour is mimicked by using the tactic [Apply H] (instead of [Elim H]) in the subsequent proof-scripts. *)
(** ** Truth and falsity **)
Definition top : Prop := forall E : Prop, E -> E.
Proof fun E e => e.
Definition bot : Prop := forall E : Prop, E.
(** ** Conjunction **)
Definition and (A B : Prop) : Prop := forall E : Prop, (A -> B -> E) -> E.
Proof fun A B a b E f => f a b.

Lemma and_fst : forall A B : Prop, and A B -> A.