Skip to content

Commit e5727b3

Browse files
committed
Removing default lmodType on complex, and adding Rcomplex
1 parent 12a7240 commit e5727b3

File tree

1 file changed

+53
-51
lines changed

1 file changed

+53
-51
lines changed

theories/complex.v

+53-51
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ Definition ltc (x y : R[i]) :=
244244
let: a +i* b := x in let: c +i* d := y in
245245
(d == b) && (a < c).
246246

247+
(* TODO: when Pythagorean Fields are added, weaken to Pythagorean Field *)
247248
Definition normc (x : R[i]) : R :=
248249
let: a +i* b := x in sqrtr (a ^+ 2 + b ^+ 2).
249250

@@ -327,24 +328,27 @@ Definition complex_numMixin := NumMixin lec_normD ltc0_add eq0_normC
327328
ge0_lec_total normCM lec_def ltc_def.
328329
Canonical complex_porderType := POrderType ring_display R[i] complex_numMixin.
329330
Canonical complex_numDomainType := NumDomainType R[i] complex_numMixin.
331+
Canonical complex_numFieldType := [numFieldType of R[i]].
330332
Canonical complex_normedZmodType :=
331333
NormedZmodType R[i] R[i] complex_numMixin.
332334

333335
End ComplexField.
334336
End ComplexField.
335337

336338
Canonical ComplexField.complex_zmodType.
337-
Canonical ComplexField.complex_lmodType.
339+
(* we do not export the canonical structure of lmodType on purpose *)
340+
(* i.e. no: Canonical ComplexField.complex_lmodType. *)
341+
(* indeed, this would prevent C fril having a normed module over C *)
338342
Canonical ComplexField.complex_ringType.
339343
Canonical ComplexField.complex_comRingType.
340344
Canonical ComplexField.complex_unitRingType.
341345
Canonical ComplexField.complex_comUnitRingType.
342346
Canonical ComplexField.complex_idomainType.
343347
Canonical ComplexField.complex_fieldType.
344348
Canonical ComplexField.complex_porderType.
345-
Canonical ComplexField.complex_numDomainType.
346349
Canonical ComplexField.complex_normedZmodType.
347-
Canonical complex_numFieldType (R : rcfType) := [numFieldType of complex R].
350+
Canonical ComplexField.complex_numDomainType.
351+
Canonical ComplexField.complex_numFieldType.
348352
Canonical ComplexField.real_complex_rmorphism.
349353
Canonical ComplexField.real_complex_additive.
350354
Canonical ComplexField.Re_additive.
@@ -373,49 +377,46 @@ Ltac simpc := do ?
373377
Section ComplexTheory.
374378

375379
Variable R : rcfType.
380+
Implicit Types (k : R) (x y z : R[i]).
376381

377-
Lemma ReiNIm : forall x : R[i], Re (x * 'i%C) = - Im x.
382+
Lemma ReiNIm : forall x, Re (x * 'i%C) = - Im x.
378383
Proof. by case=> a b; simpc. Qed.
379384

380-
Lemma ImiRe : forall x : R[i], Im (x * 'i%C) = Re x.
385+
Lemma ImiRe : forall x, Im (x * 'i%C) = Re x.
381386
Proof. by case=> a b; simpc. Qed.
382387

383388
Lemma complexE x : x = (Re x)%:C + 'i%C * (Im x)%:C :> R[i].
384389
Proof. by case: x => *; simpc. Qed.
385390

386-
Lemma real_complexE x : x%:C = x +i* 0 :> R[i]. Proof. done. Qed.
391+
Lemma real_complexE k : k%:C = k +i* 0 :> R[i]. Proof. done. Qed.
387392

388393
Lemma sqr_i : 'i%C ^+ 2 = -1 :> R[i].
389394
Proof. by rewrite exprS; simpc; rewrite -real_complexE rmorphN. Qed.
390395

391396
Lemma complexI : injective (real_complex R). Proof. by move=> x y []. Qed.
392397

393-
Lemma ler0c (x : R) : (0 <= x%:C) = (0 <= x). Proof. by simpc. Qed.
398+
Lemma ler0c k : (0 <= k%:C) = (0 <= k). Proof. by simpc. Qed.
394399

395-
Lemma lecE : forall x y : R[i], (x <= y) = (Im y == Im x) && (Re x <= Re y).
400+
Lemma lecE : forall x y, (x <= y) = (Im y == Im x) && (Re x <= Re y).
396401
Proof. by move=> [a b] [c d]. Qed.
397402

398-
Lemma ltcE : forall x y : R[i], (x < y) = (Im y == Im x) && (Re x < Re y).
403+
Lemma ltcE : forall x y, (x < y) = (Im y == Im x) && (Re x < Re y).
399404
Proof. by move=> [a b] [c d]. Qed.
400405

401-
Lemma lecR : forall x y : R, (x%:C <= y%:C) = (x <= y).
402-
Proof. by move=> x y; simpc. Qed.
406+
Lemma lecR : forall k k', (k%:C <= k'%:C) = (k <= k').
407+
Proof. by move=> k k'; simpc. Qed.
403408

404-
Lemma ltcR : forall x y : R, (x%:C < y%:C) = (x < y).
405-
Proof. by move=> x y; simpc. Qed.
409+
Lemma ltcR : forall k k', (k%:C < k'%:C) = (k < k').
410+
Proof. by move=> k k'; simpc. Qed.
406411

407412
Lemma conjc_is_rmorphism : rmorphism (@conjc R).
408413
Proof.
409414
split=> [[a b] [c d]|] /=; first by simpc; rewrite [d - _]addrC.
410415
by split=> [[a b] [c d]|] /=; simpc.
411416
Qed.
412417

413-
Lemma conjc_is_scalable : scalable (@conjc R).
414-
Proof. by move=> a [b c]; simpc. Qed.
415-
416418
Canonical conjc_rmorphism := RMorphism conjc_is_rmorphism.
417419
Canonical conjc_additive := Additive conjc_is_rmorphism.
418-
Canonical conjc_linear := AddLinear conjc_is_scalable.
419420

420421
Lemma conjcK : involutive (@conjc R).
421422
Proof. by move=> [a b] /=; rewrite opprK. Qed.
@@ -448,7 +449,7 @@ Proof. by move: x=> [a b] /=; simpc => /andP [/eqP]. Qed.
448449
(* Todo : extend theory of : *)
449450
(* - signed exponents *)
450451

451-
Lemma conj_ge0 : forall x : R[i], (0 <= x ^*) = (0 <= x).
452+
Lemma conj_ge0 : forall x, (0 <= x ^*) = (0 <= x).
452453
Proof. by move=> [a b] /=; simpc; rewrite oppr_eq0. Qed.
453454

454455
Lemma conjc_nat : forall n, (n%:R : R[i])^* = n%:R.
@@ -460,10 +461,10 @@ Proof. exact: (conjc_nat 0). Qed.
460461
Lemma conjc1 : (1 : R[i]) ^* = 1.
461462
Proof. exact: (conjc_nat 1). Qed.
462463

463-
Lemma conjc_eq0 : forall x : R[i], (x ^* == 0) = (x == 0).
464+
Lemma conjc_eq0 : forall x, (x ^* == 0) = (x == 0).
464465
Proof. by move=> [a b]; rewrite !eq_complex /= eqr_oppLR oppr0. Qed.
465466

466-
Lemma conjc_inv: forall x : R[i], (x^-1)^* = (x^*%C )^-1.
467+
Lemma conjc_inv: forall x, (x^-1)^* = (x^*%C )^-1.
467468
Proof. exact: fmorphV. Qed.
468469

469470
Lemma complex_root_conj (p : {poly R[i]}) (x : R[i]) :
@@ -474,7 +475,7 @@ Lemma complex_algebraic_trans (T : comRingType) (toR : {rmorphism T -> R}) :
474475
integralRange toR -> integralRange (real_complex R \o toR).
475476
Proof.
476477
set f := _ \o _ => R_integral [a b].
477-
have integral_real x : integralOver f (x%:C) by apply: integral_rmorph.
478+
have integral_real k : integralOver f (k%:C) by apply: integral_rmorph.
478479
rewrite [_ +i* _]complexE.
479480
apply: integral_add => //; apply: integral_mul => //=.
480481
exists ('X^2 + 1).
@@ -503,20 +504,48 @@ rewrite realE; simpc; rewrite [0 == _]eq_sym.
503504
by have [] := ltrgtP 0 a; rewrite ?(andbF, andbT, orbF, orbb).
504505
Qed.
505506

506-
Lemma complex_realP (x : R[i]) : reflect (exists y, x = y%:C) (x \is Num.real).
507+
Lemma complex_realP x : reflect (exists k, x = k%:C) (x \is Num.real).
507508
Proof.
508509
case: x=> [a b] /=; rewrite complex_real.
509510
by apply: (iffP eqP) => [->|[c []//]]; exists a.
510511
Qed.
511512

512-
Lemma RRe_real (x : R[i]) : x \is Num.real -> (Re x)%:C = x.
513+
Lemma RRe_real x : x \is Num.real -> (Re x)%:C = x.
513514
Proof. by move=> /complex_realP [y ->]. Qed.
514515

515-
Lemma RIm_real (x : R[i]) : x \is Num.real -> (Im x)%:C = 0.
516+
Lemma RIm_real x : x \is Num.real -> (Im x)%:C = 0.
516517
Proof. by move=> /complex_realP [y ->]. Qed.
517518

518519
End ComplexTheory.
519520

521+
Definition Rcomplex := complex.
522+
Canonical Rcomplex_eqType (R : eqType) := [eqType of Rcomplex R].
523+
Canonical Rcomplex_countType (R : countType) := [countType of Rcomplex R].
524+
Canonical Rcomplex_choiceType (R : choiceType) := [choiceType of Rcomplex R].
525+
Canonical Rcomplex_zmodType (R : rcfType) := [zmodType of Rcomplex R].
526+
Canonical Rcomplex_ringType (R : rcfType) := [ringType of Rcomplex R].
527+
Canonical Rcomplex_comRingType (R : rcfType) := [comRingType of Rcomplex R].
528+
Canonical Rcomplex_unitRingType (R : rcfType) := [unitRingType of Rcomplex R].
529+
Canonical Rcomplex_comUnitRingType (R : rcfType) := [comUnitRingType of Rcomplex R].
530+
Canonical Rcomplex_idomainType (R : rcfType) := [idomainType of Rcomplex R].
531+
Canonical Rcomplex_fieldType (R : rcfType) := [fieldType of Rcomplex R].
532+
Canonical Rcomplex_lmodType (R : rcfType) :=
533+
LmodType R (Rcomplex R) (ComplexField.complex_lmodMixin R).
534+
535+
Module RComplexLMod.
536+
Section RComplexLMod.
537+
Variable R : rcfType.
538+
Implicit Types (k : R) (x y z : Rcomplex R).
539+
Canonical ComplexField.complex_lmodType.
540+
541+
Lemma conjc_is_scalable : scalable (conjc : Rcomplex R -> Rcomplex R).
542+
Proof. by move=> a [b c]; simpc. Qed.
543+
Canonical conjc_linear := AddLinear conjc_is_scalable.
544+
545+
End RComplexLMod.
546+
End RComplexLMod.
547+
Canonical RComplexLMod.conjc_linear.
548+
520549
(* Section RcfDef. *)
521550

522551
(* Variable R : realFieldType. *)
@@ -1182,33 +1211,6 @@ End Paper_HarmDerksen.
11821211

11831212
End ComplexClosed.
11841213

1185-
(* End ComplexInternal. *)
1186-
1187-
(* Canonical ComplexInternal.complex_eqType. *)
1188-
(* Canonical ComplexInternal.complex_choiceType. *)
1189-
(* Canonical ComplexInternal.complex_countType. *)
1190-
(* Canonical ComplexInternal.complex_ZmodType. *)
1191-
(* Canonical ComplexInternal.complex_Ring. *)
1192-
(* Canonical ComplexInternal.complex_comRing. *)
1193-
(* Canonical ComplexInternal.complex_unitRing. *)
1194-
(* Canonical ComplexInternal.complex_comUnitRing. *)
1195-
(* Canonical ComplexInternal.complex_iDomain. *)
1196-
(* Canonical ComplexInternal.complex_fieldType. *)
1197-
(* Canonical ComplexInternal.ComplexField.real_complex_rmorphism. *)
1198-
(* Canonical ComplexInternal.ComplexField.real_complex_additive. *)
1199-
(* Canonical ComplexInternal.ComplexField.Re_additive. *)
1200-
(* Canonical ComplexInternal.ComplexField.Im_additive. *)
1201-
(* Canonical ComplexInternal.complex_numDomainType. *)
1202-
(* Canonical ComplexInternal.complex_normedZmodType. *)
1203-
(* Canonical ComplexInternal.complex_numFieldType. *)
1204-
(* Canonical ComplexInternal.conjc_rmorphism. *)
1205-
(* Canonical ComplexInternal.conjc_additive. *)
1206-
(* Canonical ComplexInternal.complex_decField. *)
1207-
(* Canonical ComplexInternal.complex_closedField. *)
1208-
(* Canonical ComplexInternal.complex_numClosedFieldType. *)
1209-
1210-
(* Definition complex_algebraic_trans := ComplexInternal.complex_algebraic_trans. *)
1211-
12121214
Section ComplexClosedTheory.
12131215

12141216
Variable R : rcfType.

0 commit comments

Comments
 (0)