]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/library/logic/cprop_connectives.ma
minor changes to make the library compile after wilmers new exists.
[helm.git] / helm / software / matita / library / logic / cprop_connectives.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "logic/connectives.ma".
16
17 inductive Or (A,B:CProp) : CProp ≝
18  | Left : A → Or A B
19  | Right : B → Or A B.
20
21 interpretation "constructive or" 'or x y = (Or x y).
22
23 inductive Or3 (A,B,C:CProp) : CProp ≝
24  | Left3 : A → Or3 A B C
25  | Middle3 : B → Or3 A B C
26  | Right3 : C → Or3 A B C.
27
28 interpretation "constructive ternary or" 'or3 x y z= (Or3 x y z).
29
30 notation < "hvbox(a break ∨ b break ∨ c)" with precedence 35 for @{'or3 $a $b $c}.
31
32 inductive Or4 (A,B,C,D:CProp) : CProp ≝
33  | Left3 : A → Or4 A B C D
34  | Middle3 : B → Or4 A B C D
35  | Right3 : C → Or4 A B C D
36  | Extra3: D → Or4 A B C D.
37
38 interpretation "constructive ternary or" 'or4 x y z t = (Or4 x y z t).
39
40 notation < "hvbox(a break ∨ b break ∨ c break ∨ d)" with precedence 35 for @{'or4 $a $b $c $d}.
41
42 inductive And (A,B:CProp) : CProp ≝
43  | Conj : A → B → And A B.
44  
45 interpretation "constructive and" 'and x y = (And x y).
46
47 inductive And3 (A,B,C:CProp) : CProp ≝
48  | Conj3 : A → B → C → And3 A B C.
49
50 notation < "hvbox(a break ∧ b break ∧ c)" with precedence 35 for @{'and3 $a $b $c}.
51  
52 interpretation "constructive ternary and" 'and3 x y z = (And3 x y z).
53
54 inductive And4 (A,B,C,D:CProp) : CProp ≝
55  | Conj4 : A → B → C → D → And4 A B C D.
56
57 notation < "hvbox(a break ∧ b break ∧ c break ∧ d)" with precedence 35 for @{'and4 $a $b $c $d}.
58  
59 interpretation "constructive quaternary and" 'and4 x y z t = (And4 x y z t).
60
61 record Iff (A,B:CProp) : CProp ≝
62  { if: A → B;
63    fi: B → A
64  }.
65  
66 record Iff1 (A,B:CProp) : CProp ≝
67  { if1: A → B;
68    fi1: B → A
69  }.
70  
71 interpretation "logical iff" 'iff x y = (Iff x y).
72
73 notation "hvbox(a break ⇔ b)" right associative with precedence 25 for @{'iff1 $a $b}.
74 interpretation "logical iff type1" 'iff1 x y = (Iff1 x y).
75
76 inductive exT (A:Type) (P:A→CProp) : CProp ≝
77   ex_introT: ∀w:A. P w → exT A P.
78   
79 notation "\ll term 19 a, break term 19 b \gg" 
80 with precedence 90 for @{'dependent_pair $a $b}.
81 interpretation "dependent pair" 'dependent_pair a b = 
82   (ex_introT _ _ a b).
83
84 interpretation "CProp exists" 'exists \eta.x = (exT _ x).
85
86 notation "\ll term 19 a, break term 19 b \gg" 
87 with precedence 90 for @{'dependent_pair $a $b}.
88 interpretation "dependent pair" 'dependent_pair a b = 
89   (ex_introT _ _ a b).
90
91
92 definition pi1exT ≝ λA,P.λx:exT A P.match x with [ex_introT x _ ⇒ x].
93 definition pi2exT ≝ 
94   λA,P.λx:exT A P.match x return λx.P (pi1exT ?? x) with [ex_introT _ p ⇒ p].
95
96 interpretation "exT \fst" 'pi1 = (pi1exT _ _).
97 interpretation "exT \fst" 'pi1a x = (pi1exT _ _ x).
98 interpretation "exT \fst" 'pi1b x y = (pi1exT _ _ x y).
99 interpretation "exT \snd" 'pi2 = (pi2exT _ _).
100 interpretation "exT \snd" 'pi2a x = (pi2exT _ _ x).
101 interpretation "exT \snd" 'pi2b x y = (pi2exT _ _ x y).
102
103 inductive exP (A:Type) (P:A→Prop) : CProp ≝
104   ex_introP: ∀w:A. P w → exP A P.
105   
106 interpretation "dependent pair for Prop" 'dependent_pair a b = 
107   (ex_introP _ _ a b).
108
109 interpretation "CProp exists for Prop" 'exists \eta.x = (exP _ x).
110
111 definition pi1exP ≝ λA,P.λx:exP A P.match x with [ex_introP x _ ⇒ x].
112 definition pi2exP ≝ 
113   λA,P.λx:exP A P.match x return λx.P (pi1exP ?? x) with [ex_introP _ p ⇒ p].
114
115 interpretation "exP \fst" 'pi1 = (pi1exP _ _).
116 interpretation "exP \fst" 'pi1a x = (pi1exP _ _ x).
117 interpretation "exP \fst" 'pi1b x y = (pi1exP _ _ x y).
118 interpretation "exP \snd" 'pi2 = (pi2exP _ _).
119 interpretation "exP \snd" 'pi2a x = (pi2exP _ _ x).
120 interpretation "exP \snd" 'pi2b x y = (pi2exP _ _ x y).
121
122
123 inductive exT23 (A:Type) (P:A→CProp) (Q:A→CProp) (R:A→A→CProp) : CProp ≝
124   ex_introT23: ∀w,p:A. P w → Q p → R w p → exT23 A P Q R.
125
126 definition pi1exT23 ≝
127   λA,P,Q,R.λx:exT23 A P Q R.match x with [ex_introT23 x _ _ _ _ ⇒ x].
128 definition pi2exT23 ≝
129   λA,P,Q,R.λx:exT23 A P Q R.match x with [ex_introT23 _ x _ _ _ ⇒ x].
130
131 interpretation "exT2 \fst" 'pi1 = (pi1exT23 _ _ _ _).
132 interpretation "exT2 \snd" 'pi2 = (pi2exT23 _ _ _ _).   
133 interpretation "exT2 \fst" 'pi1a x = (pi1exT23 _ _ _ _ x).
134 interpretation "exT2 \snd" 'pi2a x = (pi2exT23 _ _ _ _ x).
135 interpretation "exT2 \fst" 'pi1b x y = (pi1exT23 _ _ _ _ x y).
136 interpretation "exT2 \snd" 'pi2b x y = (pi2exT23 _ _ _ _ x y).
137
138 inductive exT2 (A:Type) (P,Q:A→CProp) : CProp ≝
139   ex_introT2: ∀w:A. P w → Q w → exT2 A P Q.
140
141 definition Not : CProp → Prop ≝ λx:CProp.x → False.
142
143 interpretation "constructive not" 'not x = (Not x).
144   
145 definition cotransitive ≝
146  λC:Type.λlt:C→C→CProp.∀x,y,z:C. lt x y → lt x z ∨ lt z y. 
147
148 definition coreflexive ≝ λC:Type.λlt:C→C→CProp. ∀x:C. ¬ (lt x x).
149
150 definition symmetric ≝ λC:Type.λlt:C→C→CProp. ∀x,y:C.lt x y → lt y x.
151
152 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.
153
154 definition reflexive ≝ λA:Type.λR:A→A→CProp.∀x:A.R x x.
155
156 definition transitive ≝ λA:Type.λR:A→A→CProp.∀x,y,z:A.R x y → R y z → R x z.
157