1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "logic/equality.ma".
17 inductive Or (A,B:CProp) : CProp ≝
21 interpretation "constructive or" 'or x y = (Or x y).
23 inductive And (A,B:CProp) : CProp ≝
24 | Conj : A → B → And A B.
26 interpretation "constructive and" 'and x y = (And x y).
28 inductive And3 (A,B,C:CProp) : CProp ≝
29 | Conj3 : A → B → C → And3 A B C.
31 notation < "a ∧ b ∧ c" left associative with precedence 35 for @{'and3 $a $b $c}.
33 interpretation "constructive ternary and" 'and3 x y z = (Conj3 x y z).
35 inductive And4 (A,B,C,D:CProp) : CProp ≝
36 | Conj4 : A → B → C → D → And4 A B C D.
38 notation < "a ∧ b ∧ c ∧ d" left associative with precedence 35 for @{'and4 $a $b $c $d}.
40 interpretation "constructive quaternary and" 'and4 x y z t = (Conj4 x y z t).
42 coinductive product (A,B:Type) : Type ≝ pair : ∀a:A.∀b:B.product A B.
44 notation "a \times b" left associative with precedence 70 for @{'product $a $b}.
45 interpretation "prod" 'product a b = (product a b).
47 definition first : ∀A.∀P.A × P → A ≝ λA,P,s.match s with [pair x _ ⇒ x].
48 definition second : ∀A.∀P.A × P → P ≝ λA,P,s.match s with [pair _ y ⇒ y].
50 interpretation "pair pi1" 'pi1 = (first _ _).
51 interpretation "pair pi2" 'pi2 = (second _ _).
52 interpretation "pair pi1" 'pi1a x = (first _ _ x).
53 interpretation "pair pi2" 'pi2a x = (second _ _ x).
54 interpretation "pair pi1" 'pi1b x y = (first _ _ x y).
55 interpretation "pair pi2" 'pi2b x y = (second _ _ x y).
57 notation "hvbox(\langle a, break b\rangle)" left associative with precedence 70 for @{ 'pair $a $b}.
58 interpretation "pair" 'pair a b = (pair _ _ a b).
60 inductive exT (A:Type) (P:A→CProp) : CProp ≝
61 ex_introT: ∀w:A. P w → exT A P.
63 interpretation "CProp exists" 'exists \eta.x = (exT _ x).
64 interpretation "dependent pair" 'pair a b = (ex_introT _ _ a b).
66 notation < "'fst' \nbsp x" non associative with precedence 90 for @{'pi1a $x}.
67 notation < "'snd' \nbsp x" non associative with precedence 90 for @{'pi2a $x}.
68 notation < "'fst' \nbsp x \nbsp y" non associative with precedence 90 for @{'pi1b $x $y}.
69 notation < "'snd' \nbsp x \nbsp y" non associative with precedence 90 for @{'pi2b $x $y}.
70 notation > "'fst'" non associative with precedence 90 for @{'pi1}.
71 notation > "'snd'" non associative with precedence 90 for @{'pi2}.
73 definition pi1exT ≝ λA,P.λx:exT A P.match x with [ex_introT x _ ⇒ x].
75 λA,P.λx:exT A P.match x return λx.P (pi1exT ?? x) with [ex_introT _ p ⇒ p].
77 interpretation "exT fst" 'pi1 = (pi1exT _ _).
78 interpretation "exT fst" 'pi1a x = (pi1exT _ _ x).
79 interpretation "exT fst" 'pi1b x y = (pi1exT _ _ x y).
80 interpretation "exT snd" 'pi2 = (pi2exT _ _).
81 interpretation "exT snd" 'pi2a x = (pi2exT _ _ x).
82 interpretation "exT snd" 'pi2b x y = (pi2exT _ _ x y).
84 inductive exT23 (A:Type) (P:A→CProp) (Q:A→CProp) (R:A→A→CProp) : CProp ≝
85 ex_introT23: ∀w,p:A. P w → Q p → R w p → exT23 A P Q R.
88 λA,P,Q,R.λx:exT23 A P Q R.match x with [ex_introT23 x _ _ _ _ ⇒ x].
90 λA,P,Q,R.λx:exT23 A P Q R.match x with [ex_introT23 _ x _ _ _ ⇒ x].
92 interpretation "exT2 fst" 'pi1 = (pi1exT23 _ _ _ _).
93 interpretation "exT2 snd" 'pi2 = (pi2exT23 _ _ _ _).
94 interpretation "exT2 fst" 'pi1a x = (pi1exT23 _ _ _ _ x).
95 interpretation "exT2 snd" 'pi2a x = (pi2exT23 _ _ _ _ x).
96 interpretation "exT2 fst" 'pi1b x y = (pi1exT23 _ _ _ _ x y).
97 interpretation "exT2 snd" 'pi2b x y = (pi2exT23 _ _ _ _ x y).
99 definition Not : CProp → Prop ≝ λx:CProp.x → False.
101 interpretation "constructive not" 'not x = (Not x).
103 definition cotransitive ≝
104 λC:Type.λlt:C→C→CProp.∀x,y,z:C. lt x y → lt x z ∨ lt z y.
106 definition coreflexive ≝ λC:Type.λlt:C→C→CProp. ∀x:C. ¬ (lt x x).
108 definition symmetric ≝ λC:Type.λlt:C→C→CProp. ∀x,y:C.lt x y → lt y x.
110 definition antisymmetric ≝ λA:Type.λR:A→A→CProp.λeq:A→A→Prop.∀x:A.∀y:A.R x y→R y x→eq x y.
112 definition reflexive ≝ λA:Type.λR:A→A→CProp.∀x:A.R x x.
114 definition transitive ≝ λA:Type.λR:A→A→CProp.∀x,y,z:A.R x y → R y z → R x z.