-
Notifications
You must be signed in to change notification settings - Fork 1
/
Geoconstruct.v
294 lines (280 loc) · 5.63 KB
/
Geoconstruct.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
Require Import Complex Geobase Geoline GeoParallel.
SearchAbout (_ < _ )%C.
Lemma Total_orderC ( a b : Complex ) : ({ a < b } + { a = b } + { b < a })%C.
Proof.
rewrite Cdecompose with (z:=a).
rewrite Cdecompose with (z:=b).
unfold Clt.
destruct ( total_order_T (real_p a) (real_p b) ).
destruct ( total_order_T (imag_p a) (imag_p b) ).
destruct s0.
left.
left.
destruct ( Real_eq_dec (real_p a) (real_p b) ).
auto.
destruct s.
auto.
contradiction.
destruct ( Real_eq_dec (real_p a) (real_p b) ).
left; right.
rewrite e,e0.
auto.
destruct s.
auto.
contradiction.
destruct s.
destruct ( Real_eq_dec (real_p a) (real_p b) ).
rewrite e in r0.
apply Rlt_irrefl in r0.
contradiction.
auto.
destruct ( Real_eq_dec (real_p b) (real_p a) ).
auto.
apply eq_sym in e.
contradiction.
destruct ( Real_eq_dec (real_p b) (real_p a) ).
rewrite e in r.
apply Rlt_irrefl in r.
contradiction.
auto.
Qed.
Lemma Ceq_dec : forall a b : Complex , { a = b } + { a <> b }.
Proof.
intros.
destruct (Total_orderC a b ).
destruct s.
apply Cineq_eq in c.
auto.
auto.
apply Cineq_eq in c.
auto.
Qed.
Lemma Cabs_inv : forall z : Complex , z <> C0 -> Cabs (/z)%C = (/Cabs(z))%R.
Proof.
intros.
assert ( forall a b : R , b <> 0 -> a * b = 1 -> a = / b )%R.
intros.
field [ H1 ].
auto.
apply H0.
intros fk.
apply Cabs0z0 in fk.
apply H.
auto.
rewrite abs_mult.
replace (/ z * z)%C with C1 ; [ idtac | field ].
unfold C1.
unfold Cabs.
simpl.
rewrite <- sqrt_1.
f_equal.
rewrite sqrt_1.
ring.
auto.
Qed.
Lemma CabsC0 : Cabs C0 = 0%R.
Proof.
intros.
unfold C0.
unfold Cabs.
rewrite <- sqrt_0.
f_equal.
rewrite sqrt_0.
simpl.
ring.
Qed.
Lemma Cabs_pos : forall z : Complex , (Cabs z >= 0)%R.
Proof.
intros.
destruct (Ceq_dec z C0).
right.
rewrite e.
apply CabsC0.
left.
apply Cneq0abs.
auto.
Qed.
Lemma Carg_ineq0 : forall z : Complex , z <> C0 -> (- PI / 2 < Carg z <= PI / 2)%R -> (C0 < z)%C.
Proof.
intros.
destruct H0.
case H1.
intros.
unfold C0.
rewrite Cdecompose.
unfold Clt.
assert ( 0 < real_p z )%R.
rewrite Creal_arg.
apply Rmult_lt_0_compat.
apply Cneq0abs.
auto.
apply cos_gt_0.
rewrite <- Ropp_div.
auto.
auto.
destruct ( Real_eq_dec 0 (real_p z) ).
assert ( 0%R <> real_p z ).
auto with real.
contradiction.
auto.
intros.
assert ( 0 = real_p z )%R.
rewrite Creal_arg.
rewrite H2.
rewrite cos_PI2.
ring.
unfold C0.
rewrite Cdecompose.
unfold Clt.
destruct ( Real_eq_dec 0 (real_p z) ).
rewrite Cimag_arg.
rewrite H2.
rewrite sin_PI2.
ring_simplify.
apply Cneq0abs.
auto.
contradiction.
Qed.
Lemma argneg0 : -^ 0%R = 0%R.
Proof.
intros.
unfold argneg.
destruct ( Real_eq_dec 0 PI ).
rewrite e.
auto.
ring.
Qed.
Definition preLine2P ( a b : Complex ) : {x : Line | on_line a x /\ on_line b x }.
Proof.
destruct (Total_orderC a b).
destruct s.
remember ((b-a)/(Cabs(b-a),0%R))%C as t.
assert ( Cabs t = 1%R ) as Lshib_len1.
rewrite Heqt.
unfold Cdiv.
rewrite <- abs_mult.
rewrite Cabs_inv.
rewrite Cabs_R.
rewrite Rabs_right.
field.
apply Cineq_eq in c.
intros fk.
apply Cabs0z0 in fk.
apply Ceq_side in fk.
auto.
apply Cabs_pos.
apply Cneq0.
rewrite Cabs_R.
rewrite Rabs_right.
apply Cineq_eq in c.
intros fk.
apply Cabs0z0 in fk.
apply Ceq_side in fk.
auto.
apply Cabs_pos.
assert ( C0 < t )%C as Lshib_gt_C0.
apply Carg_ineq0.
apply Cneq0.
rewrite Lshib_len1.
auto with real.
rewrite Heqt.
rewrite <- argminusdiv.
rewrite Carg_R.
unfold argminus.
rewrite argneg0.
rewrite argplus_comm.
rewrite argplus0.
apply Cineq0_arg.
replace C0 with (a-a)%C ; [ idtac | ring ].
apply Cineq_plus.
auto.
apply Carg_def.
apply Cneq0abs.
apply Cineq_eq in c.
intros fk.
apply Ceq_side in fk.
apply c.
auto.
apply Cineq_eq in c.
intros fk.
apply Ceq_side in fk.
apply c.
auto.
apply Cneq0.
rewrite Cabs_R.
rewrite Rabs_right.
intros fk.
apply Cineq_eq in c.
apply c.
apply Cabs0z0 in fk.
apply eq_sym.
apply Ceq_side.
auto.
apply Cabs_pos.
remember ( t * a + Ccoj ( t * a ) )%C as az.
exists {|
Larz := real_p az;
Lshib := t;
Lshib_len1 := Lshib_len1;
Lshib_gt_C0 := Lshib_gt_C0 |}.
unfold on_line.
split.
simpl.
replace ((real_p t * real_p a - - imag_p t * - imag_p a)%R,
(real_p t * - imag_p a + - imag_p t * real_p a)%R) with ( Ccoj (t*a)%C ).
rewrite <- Heqaz.
replace (0%R) with (imag_p az).
apply Cdecompose.
rewrite Heqaz.
remember (t*a)%C as g.
rewrite Cdecompose with (z:=g).
simpl.
ring.
rewrite Cdecompose with (z:=t).
rewrite Cdecompose with (z:=a).
simpl.
unfold Ccoj.
simpl.
apply injective_projections.
simpl.
ring.
simpl.
ring.
unfold Larz.
unfold Lshib.
apply injective_projections.
rewrite Cdecompose with (z:=t).
rewrite Cdecompose with (z:=b).
simpl.
(* bikhial *)
Admitted.
Definition Line2P x y := let (v, _) := preLine2P x y in v.
Lemma Line2P_def : forall a b : Complex , on_line a (Line2P a b) /\ on_line b (Line2P a b).
Proof.
intros.
unfold Line2P.
destruct preLine2P as [m H1].
auto.
Qed.
Definition LineParP ( x : Complex ) ( l : Line ) :=
{|
Larz := real_p (l*x+Ccoj(l*x))%C;
Lshib := l;
Lshib_len1 := Lshib_len1 l;
Lshib_gt_C0 := Lshib_gt_C0 l |}.
Lemma LineParP_def ( x : Complex ) ( l : Line ) : LineParP x l ||| l /\ on_line x (LineParP x l).
Proof.
intros.
split.
split.
unfold LineParP.
unfold on_line.
rewrite Ccojmult.
simpl.
remember (l*x)%C as f.
replace 0%R with (imag_p ( f + Ccoj f )%C ).
apply Cdecompose.
rewrite Cdecompose with (z:=f).
simpl.
ring.
Qed.