]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/dama/dama/cprop_connectives.ma
9e0e4b5fbb8e19c245c707d29f931923e91f2579
[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
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 And (A,B:CProp) : CProp ≝
24  | Conj : A → B → And A B.
25  
26 interpretation "constructive and" 'and x y = (And x y).
27
28 inductive And3 (A,B,C:CProp) : CProp ≝
29  | Conj3 : A → B → C → And3 A B C.
30
31 notation < "a ∧ b ∧ c" left associative with precedence 35 for @{'and3 $a $b $c}.
32  
33 interpretation "constructive ternary and" 'and3 x y z = (Conj3 x y z).
34
35 inductive And4 (A,B,C,D:CProp) : CProp ≝
36  | Conj4 : A → B → C → D → And4 A B C D.
37
38 notation < "a ∧ b ∧ c ∧ d" left associative with precedence 35 for @{'and4 $a $b $c $d}.
39  
40 interpretation "constructive quaternary and" 'and4 x y z t = (Conj4 x y z t).
41
42 coinductive product (A,B:Type) : Type ≝ pair : ∀a:A.∀b:B.product A B.
43
44 notation "a \times b" left associative with precedence 70 for @{'product $a $b}.
45 interpretation "prod" 'product a b = (product a b).
46  
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].
49
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).
56
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).
59
60 inductive exT (A:Type) (P:A→CProp) : CProp ≝
61   ex_introT: ∀w:A. P w → exT A P.
62
63 interpretation "CProp exists" 'exists \eta.x = (exT _ x).
64 interpretation "dependent pair" 'pair a b = (ex_introT _ _ a b).
65
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}.
72
73 definition pi1exT ≝ λA,P.λx:exT A P.match x with [ex_introT x _ ⇒ x].
74 definition pi2exT ≝ 
75   λA,P.λx:exT A P.match x return λx.P (pi1exT ?? x) with [ex_introT _ p ⇒ p].
76
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).
83
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.
86
87 definition pi1exT23 ≝
88   λA,P,Q,R.λx:exT23 A P Q R.match x with [ex_introT23 x _ _ _ _ ⇒ x].
89 definition pi2exT23 ≝
90   λA,P,Q,R.λx:exT23 A P Q R.match x with [ex_introT23 _ x _ _ _ ⇒ x].
91
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).
98
99 definition Not : CProp → Prop ≝ λx:CProp.x → False.
100
101 interpretation "constructive not" 'not x = (Not x).
102   
103 definition cotransitive ≝
104  λC:Type.λlt:C→C→CProp.∀x,y,z:C. lt x y → lt x z ∨ lt z y. 
105
106 definition coreflexive ≝ λC:Type.λlt:C→C→CProp. ∀x:C. ¬ (lt x x).
107
108 definition symmetric ≝ λC:Type.λlt:C→C→CProp. ∀x,y:C.lt x y → lt y x.
109
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.
111
112 definition reflexive ≝ λA:Type.λR:A→A→CProp.∀x:A.R x x.
113
114 definition transitive ≝ λA:Type.λR:A→A→CProp.∀x,y,z:A.R x y → R y z → R x z.