Debian Codegraph @

test-suite/bugs/bug_1507.v

raw
1 (*
2 Implementing reals a la Stolzenberg
3
4 Danko Ilik, March 2007
5
6 XField.v -- (unfinished) axiomatisation of the theories of real and
7 rational intervals.
8 *)
9
10 Definition associative (A:Type)(op:A->A->A) :=
11 forall x y z:A, op (op x y) z = op x (op y z).
12
13 Definition commutative (A:Type)(op:A->A->A) :=
14 forall x y:A, op x y = op y x.
15
16 Definition trichotomous (A:Type)(R:A->A->Prop) :=
17 forall x y:A, R x y \/ x=y \/ R y x.
18
19 Definition relation (A:Type) := A -> A -> Prop.
20 Definition reflexive (A:Type)(R:relation A) := forall x:A, R x x.
21 Definition transitive (A:Type)(R:relation A) :=
22 forall x y z:A, R x y -> R y z -> R x z.
23 Definition symmetric (A:Type)(R:relation A) := forall x y:A, R x y -> R y x.
24
25 Record interval (X:Set)(le:X->X->Prop) : Set :=
26 interval_make {
27 interval_left : X;
28 interval_right : X;
29 interval_nonempty : le interval_left interval_right
30 }.
31
32 Record I (grnd:Set)(le:grnd->grnd->Prop) : Type := Imake {
33 Icar := interval grnd le;
34 Iplus : Icar -> Icar -> Icar;
35 Imult : Icar -> Icar -> Icar;
36 Izero : Icar;
37 Ione : Icar;
38 Iopp : Icar -> Icar;
39 Iinv : Icar -> Icar;
40 Ic : Icar -> Icar -> Prop; (* consistency *)
41 (* monoids *)
42 Iplus_assoc : associative Icar Iplus;
43 Imult_assoc : associative Icar Imult;
44 (* abelian groups *)
45 Iplus_comm : commutative Icar Iplus;
46 Imult_comm : commutative Icar Imult;
47 Iplus_0_l : forall x:Icar, Ic (Iplus Izero x) x;
48 Iplus_0_r : forall x:Icar, Ic (Iplus x Izero) x;
49 Imult_0_l : forall x:Icar, Ic (Imult Ione x) x;
50 Imult_0_r : forall x:Icar, Ic (Imult x Ione) x;
51 Iplus_opp_r : forall x:Icar, Ic (Iplus x (Iopp x)) (Izero);
52 Imult_inv_r : forall x:Icar, ~(Ic x Izero) -> Ic (Imult x (Iinv x)) Ione;
53 (* distributive laws *)
54 Imult_plus_distr_l : forall x x' y y' z z' z'',
55 Ic x x' -> Ic y y' -> Ic z z' -> Ic z z'' ->
56 Ic (Imult (Iplus x y) z) (Iplus (Imult x' z') (Imult y' z''));
57 (* order and lattice structure *)
58 Ilt : Icar -> Icar -> Prop;
59 Ilc := fun (x y:Icar) => Ilt x y \/ Ic x y;
60 Isup : Icar -> Icar -> Icar;
61 Iinf : Icar -> Icar -> Icar;
62 Ilt_trans : transitive _ lt;
63 Ilt_trich : forall x y:Icar, Ilt x y \/ Ic x y \/ Ilt y x;
64 Isup_lub : forall x y z:Icar, Ilc x z -> Ilc y z -> Ilc (Isup x y) z;
65 Iinf_glb : forall x y z:Icar, Ilc x y -> Ilc x z -> Ilc x (Iinf y z);
66 (* order preserves operations? *)
67 (* properties of Ic *)
68 Ic_refl : reflexive _ Ic;
69 Ic_sym : symmetric _ Ic
70 }.
71
72 Definition interval_set (X:Set)(le:X->X->Prop) :=
73 (interval X le) -> Prop. (* can be Set as well *)
74 Check interval_set.
75 Check Ic.
76 Definition consistent (X:Set)(le:X->X->Prop)(TI:I X le)(p:interval_set X le) :=
77 forall I J:interval X le, p I -> p J -> (Ic X le TI) I J.
78 Check consistent.
79 (* define 'fine' *)
80
81 Record N (grnd:Set)(le:grnd->grnd->Prop)(grndI:I grnd le) : Type := Nmake {
82 Ncar := interval_set grnd le;
83 Nplus : Ncar -> Ncar -> Ncar;
84 Nmult : Ncar -> Ncar -> Ncar;
85 Nzero : Ncar;
86 None : Ncar;
87 Nopp : Ncar -> Ncar;
88 Ninv : Ncar -> Ncar;
89 Nc : Ncar -> Ncar -> Prop; (* Ncistency *)
90 (* monoids *)
91 Nplus_assoc : associative Ncar Nplus;
92 Nmult_assoc : associative Ncar Nmult;
93 (* abelian groups *)
94 Nplus_comm : commutative Ncar Nplus;
95 Nmult_comm : commutative Ncar Nmult;
96 Nplus_0_l : forall x:Ncar, Nc (Nplus Nzero x) x;
97 Nplus_0_r : forall x:Ncar, Nc (Nplus x Nzero) x;
98 Nmult_0_l : forall x:Ncar, Nc (Nmult None x) x;
99 Nmult_0_r : forall x:Ncar, Nc (Nmult x None) x;
100 Nplus_opp_r : forall x:Ncar, Nc (Nplus x (Nopp x)) (Nzero);
101 Nmult_inv_r : forall x:Ncar, ~(Nc x Nzero) -> Nc (Nmult x (Ninv x)) None;
102 (* distributive laws *)
103 Nmult_plus_distr_l : forall x x' y y' z z' z'',
104 Nc x x' -> Nc y y' -> Nc z z' -> Nc z z'' ->
105 Nc (Nmult (Nplus x y) z) (Nplus (Nmult x' z') (Nmult y' z''));
106 (* order and lattice structure *)
107 Nlt : Ncar -> Ncar -> Prop;
108 Nlc := fun (x y:Ncar) => Nlt x y \/ Nc x y;
109 Nsup : Ncar -> Ncar -> Ncar;
110 Ninf : Ncar -> Ncar -> Ncar;
111 Nlt_trans : transitive _ lt;
112 Nlt_trich : forall x y:Ncar, Nlt x y \/ Nc x y \/ Nlt y x;
113 Nsup_lub : forall x y z:Ncar, Nlc x z -> Nlc y z -> Nlc (Nsup x y) z;
114 Ninf_glb : forall x y z:Ncar, Nlc x y -> Nlc x z -> Nlc x (Ninf y z);
115 (* order preserves operations? *)
116 (* properties of Nc *)
117 Nc_refl : reflexive _ Nc;
118 Nc_sym : symmetric _ Nc
119 }.