]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/dama/dama/cprop_connectives.ma
notation factored, coercion commant taking terms and not only URI
[helm.git] / helm / software / matita / contribs / dama / dama / 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/equality.ma".
16 include "datatypes/constructors.ma".
17
18 inductive Or (A,B:CProp) : CProp ≝
19  | Left : A → Or A B
20  | Right : B → Or A B.
21
22 interpretation "constructive or" 'or x y = (Or x y).
23
24 inductive And (A,B:CProp) : CProp ≝
25  | Conj : A → B → And A B.
26  
27 interpretation "constructive and" 'and x y = (And x y).
28
29 inductive And3 (A,B,C:CProp) : CProp ≝
30  | Conj3 : A → B → C → And3 A B C.
31
32 notation < "a ∧ b ∧ c" with precedence 35 for @{'and3 $a $b $c}.
33  
34 interpretation "constructive ternary and" 'and3 x y z = (Conj3 x y z).
35
36 inductive And4 (A,B,C,D:CProp) : CProp ≝
37  | Conj4 : A → B → C → D → And4 A B C D.
38
39 notation < "a ∧ b ∧ c ∧ d" with precedence 35 for @{'and4 $a $b $c $d}.
40  
41 interpretation "constructive quaternary and" 'and4 x y z t = (Conj4 x y z t).
42
43 inductive exT (A:Type) (P:A→CProp) : CProp ≝
44   ex_introT: ∀w:A. P w → exT A P.
45
46 interpretation "CProp exists" 'exists \eta.x = (exT _ x).
47 interpretation "dependent pair" 'pair a b = (ex_introT _ _ a b).
48
49 definition pi1exT ≝ λA,P.λx:exT A P.match x with [ex_introT x _ ⇒ x].
50 definition pi2exT ≝ 
51   λA,P.λx:exT A P.match x return λx.P (pi1exT ?? x) with [ex_introT _ p ⇒ p].
52
53 interpretation "exT \fst" 'pi1 = (pi1exT _ _).
54 interpretation "exT \fst" 'pi1a x = (pi1exT _ _ x).
55 interpretation "exT \fst" 'pi1b x y = (pi1exT _ _ x y).
56 interpretation "exT \snd" 'pi2 = (pi2exT _ _).
57 interpretation "exT \snd" 'pi2a x = (pi2exT _ _ x).
58 interpretation "exT \snd" 'pi2b x y = (pi2exT _ _ x y).
59
60 inductive exT23 (A:Type) (P:A→CProp) (Q:A→CProp) (R:A→A→CProp) : CProp ≝
61   ex_introT23: ∀w,p:A. P w → Q p → R w p → exT23 A P Q R.
62
63 definition pi1exT23 ≝
64   λA,P,Q,R.λx:exT23 A P Q R.match x with [ex_introT23 x _ _ _ _ ⇒ x].
65 definition pi2exT23 ≝
66   λA,P,Q,R.λx:exT23 A P Q R.match x with [ex_introT23 _ x _ _ _ ⇒ x].
67
68 interpretation "exT2 \fst" 'pi1 = (pi1exT23 _ _ _ _).
69 interpretation "exT2 \snd" 'pi2 = (pi2exT23 _ _ _ _).   
70 interpretation "exT2 \fst" 'pi1a x = (pi1exT23 _ _ _ _ x).
71 interpretation "exT2 \snd" 'pi2a x = (pi2exT23 _ _ _ _ x).
72 interpretation "exT2 \fst" 'pi1b x y = (pi1exT23 _ _ _ _ x y).
73 interpretation "exT2 \snd" 'pi2b x y = (pi2exT23 _ _ _ _ x y).
74
75 definition Not : CProp → Prop ≝ λx:CProp.x → False.
76
77 interpretation "constructive not" 'not x = (Not x).
78   
79 definition cotransitive ≝
80  λC:Type.λlt:C→C→CProp.∀x,y,z:C. lt x y → lt x z ∨ lt z y. 
81
82 definition coreflexive ≝ λC:Type.λlt:C→C→CProp. ∀x:C. ¬ (lt x x).
83
84 definition symmetric ≝ λC:Type.λlt:C→C→CProp. ∀x,y:C.lt x y → lt y x.
85
86 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.
87
88 definition reflexive ≝ λA:Type.λR:A→A→CProp.∀x:A.R x x.
89
90 definition transitive ≝ λA:Type.λR:A→A→CProp.∀x,y,z:A.R x y → R y z → R x z.