]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/dama/dama/cprop_connectives.ma
more work, but russell too slow
[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" 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" 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 term 19 a, break term 19 b\rangle)" 
58 with precedence 90 for @{ 'pair $a $b}.
59 interpretation "pair" 'pair a b = (pair _ _ a b).
60
61 inductive exT (A:Type) (P:A→CProp) : CProp ≝
62   ex_introT: ∀w:A. P w → exT A P.
63
64 interpretation "CProp exists" 'exists \eta.x = (exT _ x).
65 interpretation "dependent pair" 'pair a b = (ex_introT _ _ a b).
66
67 notation < "'fst' \nbsp x" non associative with precedence 90 for @{'pi1a $x}.
68 notation < "'snd' \nbsp x" non associative with precedence 90 for @{'pi2a $x}.
69 notation < "'fst' \nbsp x \nbsp y" non associative with precedence 90 for @{'pi1b $x $y}.
70 notation < "'snd' \nbsp x \nbsp y" non associative with precedence 90 for @{'pi2b $x $y}.
71 notation > "'fst'" non associative with precedence 90 for @{'pi1}.
72 notation > "'snd'" non associative with precedence 90 for @{'pi2}.
73
74 definition pi1exT ≝ λA,P.λx:exT A P.match x with [ex_introT x _ ⇒ x].
75 definition pi2exT ≝ 
76   λA,P.λx:exT A P.match x return λx.P (pi1exT ?? x) with [ex_introT _ p ⇒ p].
77
78 interpretation "exT fst" 'pi1 = (pi1exT _ _).
79 interpretation "exT fst" 'pi1a x = (pi1exT _ _ x).
80 interpretation "exT fst" 'pi1b x y = (pi1exT _ _ x y).
81 interpretation "exT snd" 'pi2 = (pi2exT _ _).
82 interpretation "exT snd" 'pi2a x = (pi2exT _ _ x).
83 interpretation "exT snd" 'pi2b x y = (pi2exT _ _ x y).
84
85 inductive exT23 (A:Type) (P:A→CProp) (Q:A→CProp) (R:A→A→CProp) : CProp ≝
86   ex_introT23: ∀w,p:A. P w → Q p → R w p → exT23 A P Q R.
87
88 definition pi1exT23 ≝
89   λA,P,Q,R.λx:exT23 A P Q R.match x with [ex_introT23 x _ _ _ _ ⇒ x].
90 definition pi2exT23 ≝
91   λA,P,Q,R.λx:exT23 A P Q R.match x with [ex_introT23 _ x _ _ _ ⇒ x].
92
93 interpretation "exT2 fst" 'pi1 = (pi1exT23 _ _ _ _).
94 interpretation "exT2 snd" 'pi2 = (pi2exT23 _ _ _ _).   
95 interpretation "exT2 fst" 'pi1a x = (pi1exT23 _ _ _ _ x).
96 interpretation "exT2 snd" 'pi2a x = (pi2exT23 _ _ _ _ x).
97 interpretation "exT2 fst" 'pi1b x y = (pi1exT23 _ _ _ _ x y).
98 interpretation "exT2 snd" 'pi2b x y = (pi2exT23 _ _ _ _ x y).
99
100 definition Not : CProp → Prop ≝ λx:CProp.x → False.
101
102 interpretation "constructive not" 'not x = (Not x).
103   
104 definition cotransitive ≝
105  λC:Type.λlt:C→C→CProp.∀x,y,z:C. lt x y → lt x z ∨ lt z y. 
106
107 definition coreflexive ≝ λC:Type.λlt:C→C→CProp. ∀x:C. ¬ (lt x x).
108
109 definition symmetric ≝ λC:Type.λlt:C→C→CProp. ∀x,y:C.lt x y → lt y x.
110
111 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
113 definition reflexive ≝ λA:Type.λR:A→A→CProp.∀x:A.R x x.
114
115 definition transitive ≝ λA:Type.λR:A→A→CProp.∀x,y,z:A.R x y → R y z → R x z.