-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcommutative_ring.v
More file actions
977 lines (790 loc) · 22.5 KB
/
commutative_ring.v
File metadata and controls
977 lines (790 loc) · 22.5 KB
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
(**
This module defines the commutative_ring record type which
represents algebraic commutative rings and provides a collection
of axioms and theorems describing them.
Copyright (C) 2018 Larry D. Lee Jr. <llee454@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this program. If not, see
<https://www.gnu.org/licenses/>.
*)
Require Import Description.
Require Import FunctionalExtensionality.
Require Import base.
Require Import function.
Require Import monoid.
Require Import group.
Require Import abelian_group.
Require Import ring.
Module Commutative_Ring.
(** Represents algebraic commutative rings. *)
Structure Commutative_Ring : Type := commutative_ring {
(** Represents the set of ring elements. *)
E : Set;
(** Represents 0 - the additive identity. *)
E_0 : E;
(** Represents 1 - the multiplicative identity. *)
E_1 : E;
(** Represents addition. *)
sum : E -> E -> E;
(** Represents multiplication. *)
prod : E -> E -> E;
(** Asserts that 0 /= 1. *)
distinct_0_1: E_0 <> E_1;
(** Asserts that addition is associative. *)
sum_is_assoc : Monoid.is_assoc E sum;
(** Asserts that addition is commutative. *)
sum_is_comm : Abelian_Group.is_comm E sum;
(** Asserts that 0 is the left identity element. *)
sum_id_l : Monoid.is_id_l E sum E_0;
(**
Asserts that every element has an additive
inverse.
*)
sum_inv_l_ex : forall x : E, exists y : E, sum y x = E_0;
(** Asserts that multiplication is associative. *)
prod_is_assoc : Monoid.is_assoc E prod;
(** Asserts that multiplication is commutative. *)
prod_is_comm : Abelian_Group.is_comm E prod;
(** Asserts that 1 is the left identity element. *)
prod_id_l : Monoid.is_id_l E prod E_1;
(**
Asserts that multiplication is left distributive
over addition.
*)
prod_sum_distrib_l : Ring.is_distrib_l E prod sum
}.
(**
Enable implicit arguments for commutative
ring properties.
*)
Arguments E_0 {c}.
Arguments E_1 {c}.
Arguments sum {c} x y.
Arguments prod {c} x y.
Arguments distinct_0_1 {c} _.
Arguments sum_is_assoc {c} x y z.
Arguments sum_is_comm {c} x y.
Arguments sum_id_l {c} x.
Arguments sum_inv_l_ex {c} x.
Arguments prod_is_assoc {c} x y z.
Arguments prod_id_l {c} x.
Arguments prod_sum_distrib_l {c} x y z.
Arguments prod_is_comm {c} x y.
(** Define notations for ring properties. *)
Notation "0" := E_0 : commutative_ring_scope.
Notation "1" := E_1 : commutative_ring_scope.
Notation "x + y" := (sum x y) (at level 50, left associativity) : commutative_ring_scope.
Notation "{+}" := sum : commutative_ring_scope.
Notation "x # y" := (prod x y) (at level 50, left associativity) : commutative_ring_scope.
Notation "{#}" := prod : commutative_ring_scope.
Open Scope commutative_ring_scope.
Section Theorems.
(**
Represents an arbitrary commutative ring.
Note: we use Variable rather than Parameter
to ensure that the following theorems are
generalized w.r.t r.
*)
Variable r : Commutative_Ring.
(**
Represents the set of group elements.
Note: We use Let to define E as a
local abbreviation.
*)
Let E := E r.
(**
Accepts one ring element, x, and asserts
that x is the left identity element.
*)
Definition sum_is_id_l := Monoid.is_id_l E {+}.
(**
Accepts one ring element, x, and asserts
that x is the right identity element.
*)
Definition sum_is_id_r := Monoid.is_id_r E {+}.
(**
Accepts one ring element, x, and asserts
that x is the identity element.
*)
Definition sum_is_id := Monoid.is_id E {+}.
(**
Accepts one ring element, x, and asserts
that x is the left identity element.
*)
Definition prod_is_id_l := Monoid.is_id_l E {#}.
(**
Accepts one ring element, x, and asserts
that x is the right identity element.
*)
Definition prod_is_id_r := Monoid.is_id_r E {#}.
(**
Accepts one ring element, x, and asserts
that x is the identity element.
*)
Definition prod_is_id := Monoid.is_id E {#}.
(** Proves that 1 is the right identity element. *)
Theorem prod_id_r
: prod_is_id_r 1.
Proof
fun x : E
=> eq_ind_r
(fun a => a = x)
(prod_id_l x)
(prod_is_comm x 1).
(**
Proves that multiplication is right distributive
over addition.
*)
Theorem prod_sum_distrib_r
: Ring.is_distrib_r E {#} {+}.
Proof
fun x y z : E
=> prod_sum_distrib_l x y z
|| x # (y + z) = a + (x # z) @a by <- prod_is_comm x y
|| x # (y + z) = (y # x) + a @a by <- prod_is_comm x z
|| a = (y # x) + (z # x) @a by <- prod_is_comm x (y + z).
(**
Represents the non-commutative ring formed
by addition and multiplication over E.
*)
Definition ring := Ring.ring E 0 1 {+} {#} distinct_0_1 sum_is_assoc sum_is_comm sum_id_l sum_inv_l_ex prod_is_assoc prod_id_l prod_id_r prod_sum_distrib_l prod_sum_distrib_r.
(**
Represents the abelian group formed by
addition over E.
*)
Definition sum_abelian_group := Ring.sum_abelian_group ring.
(**
Represents the group formed by addition
over E.
*)
Definition sum_group := Ring.sum_group ring.
(**
Represents the monoid formed by addition
over E.
*)
Definition sum_monoid := Ring.sum_monoid ring.
(**
Represents the monoid formed by
multiplication over E.
*)
Definition prod_monoid := Ring.prod_monoid ring.
(** Proves that 1 <> 0. *)
Theorem distinct_1_0
: E_1 (c := r) <> E_0 (c := r).
Proof
fun H : E_1 = E_0
=> distinct_0_1 (eq_sym H).
(**
A predicate that accepts one element, x,
and asserts that x is nonzero.
*)
Definition nonzero
: E -> Prop
:= Ring.nonzero ring.
(** Proves that 0 is the right identity element. *)
Theorem sum_id_r
: sum_is_id_r 0.
Proof Ring.sum_id_r ring.
(** Proves that 0 is the identity element. *)
Theorem sum_id
: sum_is_id 0.
Proof Ring.sum_id ring.
(**
Accepts two elements, x and y, and
asserts that y is x's left inverse.
*)
Definition sum_is_inv_l
:= Ring.sum_is_inv_l ring.
(**
Accepts two elements, x and y, and
asserts that y is x's right inverse.
*)
Definition sum_is_inv_r
:= Ring.sum_is_inv_r ring.
(**
Accepts two elements, x and y, and
asserts that y is x's inverse.
*)
Definition sum_is_inv
:= Ring.sum_is_inv ring.
(**
Accepts one argument, x, and asserts that
x has a left inverse.
*)
Definition sum_has_inv_l := Ring.sum_has_inv_l ring.
(**
Accepts one argument, x, and asserts that
x has a right inverse.
*)
Definition sum_has_inv_r := Ring.sum_has_inv_r ring.
(**
Accepts one argument, x, and asserts that
x has an inverse.
*)
Definition sum_has_inv := Ring.sum_has_inv ring.
(** Asserts that every element has a right inverse. *)
Theorem sum_inv_r_ex
: forall x : E, exists y : E, sum_is_inv_r x y.
Proof Ring.sum_inv_r_ex ring.
(** Proves that the left identity element is unique. *)
Theorem sum_id_l_uniq
: forall x : E, Monoid.is_id_l E {+} x -> x = 0.
Proof Ring.sum_id_l_uniq ring.
(** Proves that the right identity element is unique. *)
Theorem sum_id_r_uniq
: forall x : E, Monoid.is_id_r E {+} x -> x = 0.
Proof Ring.sum_id_r_uniq ring.
(** Proves that the identity element is unique. *)
Theorem sum_id_uniq
: forall x : E, Monoid.is_id E {+} x -> x = 0.
Proof Ring.sum_id_uniq ring.
(**
Proves that for every group element, x,
its left and right inverses are equal.
*)
Theorem sum_inv_l_r_eq
: forall x y : E, sum_is_inv_l x y -> forall z : E, sum_is_inv_r x z -> y = z.
Proof Ring.sum_inv_l_r_eq ring.
(**
Proves that the inverse relation is
symmetrical.
*)
Theorem sum_inv_sym
: forall x y : E, sum_is_inv x y <-> sum_is_inv y x.
Proof Ring.sum_inv_sym ring.
(** Proves that an element's inverse is unique. *)
Theorem sum_inv_uniq
: forall x y z : E, sum_is_inv x y -> sum_is_inv x z -> z = y.
Proof Ring.sum_inv_uniq ring.
(** Proves that every element has an inverse. *)
Theorem sum_inv_ex
: forall x : E, exists y : E, sum_is_inv x y.
Proof Ring.sum_inv_ex ring.
(**
Proves explicitly that every element has a
unique inverse.
*)
Theorem sum_inv_uniq_ex
: forall x : E, exists! y : E, sum_is_inv x y.
Proof Ring.sum_inv_uniq_ex ring.
(** Proves the left introduction rule. *)
Theorem sum_intro_l
: forall x y z : E, x = y -> z + x = z + y.
Proof Ring.sum_intro_l ring.
(** Proves the right introduction rule. *)
Theorem sum_intro_r
: forall x y z : E, x = y -> x + z = y + z.
Proof Ring.sum_intro_r ring.
(** Proves the left cancellation rule. *)
Theorem sum_cancel_l
: forall x y z : E, z + x = z + y -> x = y.
Proof Ring.sum_cancel_l ring.
(** Proves the right cancellation rule. *)
Theorem sum_cancel_r
: forall x y z : E, x + z = y + z -> x = y.
Proof Ring.sum_cancel_r ring.
(**
Proves that an element's left inverse
is unique.
*)
Theorem sum_inv_l_uniq
: forall x y z : E, sum_is_inv_l x y -> sum_is_inv_l x z -> z = y.
Proof Ring.sum_inv_l_uniq ring.
(**
Proves that an element's right inverse
is unique.
*)
Theorem sum_inv_r_uniq
: forall x y z : E, sum_is_inv_r x y -> sum_is_inv_r x z -> z = y.
Proof Ring.sum_inv_r_uniq ring.
(**
Proves that 0 is its own left additive
inverse.
*)
Theorem sum_0_inv_l
: sum_is_inv_l 0 0.
Proof Ring.sum_0_inv_l ring.
(**
Proves that 0 is its own right additive
inverse.
*)
Theorem sum_0_inv_r
: sum_is_inv_r 0 0.
Proof Ring.sum_0_inv_r ring.
(** Proves that 0 is it's own additive inverse. *)
Theorem sum_0_inv
: sum_is_inv 0 0.
Proof Ring.sum_0_inv ring.
(**
Proves that the identity element has a
left inverse.
*)
Theorem sum_has_inv_l_0
: sum_has_inv_l 0.
Proof Ring.sum_has_inv_l_0 ring.
(**
Proves that the identity element has a
right inverse.
*)
Theorem sum_has_inv_r_0
: sum_has_inv_r 0.
Proof Ring.sum_has_inv_r_0 ring.
(**
Proves that the identity element has an
inverse.
*)
Theorem sum_has_inv_0
: sum_has_inv 0.
Proof Ring.sum_has_inv_0 ring.
(**
Proves that if an element's, x, inverse
equals 0, x equals 0.
*)
Theorem sum_inv_0_eq_0
: forall x : E, sum_is_inv x 0 -> x = 0.
Proof Ring.sum_inv_0_eq_0 ring.
(**
Proves that 0 is the only element whose
additive inverse is 0.
*)
Theorem sum_inv_0_uniq
: unique (fun x => sum_is_inv x 0) 0.
Proof Ring.sum_inv_0_uniq ring.
(** Represents strongly-specified negation. *)
Definition sum_neg_strong
: forall x : E, { y | sum_is_inv x y }
:= Ring.sum_neg_strong ring.
(** Represents negation. *)
Definition sum_neg
: E -> E
:= Ring.sum_neg ring.
Notation "{-}" := (sum_neg) : commutative_ring_scope.
Notation "- x" := (sum_neg x) : commutative_ring_scope.
(**
Asserts that the negation returns the inverse
of its argument.
*)
Definition sum_neg_def
: forall x : E, sum_is_inv x (- x)
:= Ring.sum_neg_def ring.
(** Proves that negation is one-to-one *)
Theorem sum_neg_inj
: is_injective E E sum_neg.
Proof Ring.sum_neg_inj ring.
(** Proves the cancellation property for negation. *)
Theorem sum_cancel_neg
: forall x : E, sum_neg (- x) = x.
Proof Ring.sum_cancel_neg ring.
(** Proves that negation is onto *)
Theorem sum_neg_onto
: is_onto E E sum_neg.
Proof Ring.sum_neg_onto ring.
(** Proves that negation is surjective *)
Theorem sum_neg_bijective
: is_bijective E E sum_neg.
Proof Ring.sum_neg_bijective ring.
(** Proves that neg x = y -> neg y = x *)
Theorem sum_neg_rev
: forall x y : E, - x = y -> - y = x.
Proof Ring.sum_neg_rev ring.
(**
Proves that the left inverse of x + y is -y + -x.
*)
Theorem sum_neg_distrib_inv_l
: forall x y : E, sum_is_inv_l (x + y) (- y + - x).
Proof Ring.sum_neg_distrib_inv_l ring.
(**
Proves that the right inverse of x + y is -y + -x.
*)
Theorem sum_neg_distrib_inv_r
: forall x y : E, sum_is_inv_r (x + y) (- y + - x).
Proof Ring.sum_neg_distrib_inv_r ring.
(**
Proves that the inverse of x + y is -y + -x.
*)
Theorem sum_neg_distrib_inv
: forall x y : E, sum_is_inv (x + y) (- y + - x).
Proof Ring.sum_neg_distrib_inv ring.
(**
Proves that negation is distributive: i.e.
-(x + y) = -y + -x.
*)
Theorem sum_neg_distrib
: forall x y : E, - (x + y) = - y + - x.
Proof Ring.sum_neg_distrib ring.
(** Proves that 0's negation is 0. *)
Theorem sum_0_neg
: - 0 = 0.
Proof Ring.sum_0_neg ring.
(**
Proves that if an element's, x, negation
equals 0, x must equal 0.
*)
Theorem sum_neg_0
: forall x : E, - x = 0 -> x = 0.
Proof Ring.sum_neg_0 ring.
(**
Prove that 0 is the only element whose additive
inverse (negation) equals 0.
*)
Theorem sum_neg_0_uniq
: unique (fun x => - x = 0) 0.
Proof Ring.sum_neg_0_uniq ring.
(**
Accepts one element, x, and asserts
that x is the identity element.
*)
Theorem prod_id
: prod_is_id 1.
Proof Ring.prod_id ring.
(** Proves that the left identity element is unique. *)
Theorem prod_id_l_uniq
: forall x : E, (Monoid.is_id_l E {#} x) -> x = 1.
Proof Ring.prod_id_l_uniq ring.
(** Proves that the right identity element is unique. *)
Theorem prod_id_r_uniq
: forall x : E, (Monoid.is_id_r E {#} x) -> x = 1.
Proof Ring.prod_id_r_uniq ring.
(** Proves that the identity element is unique. *)
Theorem prod_id_uniq
: forall x : E, (Monoid.is_id E {#} x) -> x = 1.
Proof Ring.prod_id_uniq ring.
(** Proves the left introduction rule. *)
Theorem prod_intro_l
: forall x y z : E, x = y -> z # x = z # y.
Proof Ring.prod_intro_l ring.
(** Proves the right introduction rule. *)
Theorem prod_intro_r
: forall x y z : E, x = y -> x # z = y # z.
Proof Ring.prod_intro_r ring.
(**
Accepts two elements, x and y, and
asserts that y is x's left inverse.
*)
Definition prod_is_inv_l := Ring.prod_is_inv_l ring.
(**
Accepts two elements, x and y, and
asserts that y is x's right inverse.
*)
Definition prod_is_inv_r := Ring.prod_is_inv_r ring.
(**
Accepts two elements, x and y, and
asserts that y is x's inverse.
*)
Definition prod_is_inv := Ring.prod_is_inv ring.
(**
Accepts one argument, x, and asserts that
x has a left inverse.
*)
Definition prod_has_inv_l := Ring.prod_has_inv_l ring.
(**
Accepts one argument, x, and asserts that
x has a right inverse.
*)
Definition prod_has_inv_r := Ring.prod_has_inv_r ring.
(**
Accepts one argument, x, and asserts that
x has an inverse.
*)
Definition prod_has_inv := Ring.prod_has_inv ring.
(**
Proves that every left inverse must also
be a right inverse.
*)
Theorem prod_is_inv_lr
: forall x y : E, prod_is_inv_l x y -> prod_is_inv_r x y.
Proof
fun x y H
=> H || a = 1 @a by prod_is_comm x y.
(**
Proves that the left and right inverses of
an element must be equal.
*)
Theorem prod_inv_l_r_eq
: forall x y : E, prod_is_inv_l x y -> forall z : E, prod_is_inv_r x z -> y = z.
Proof Ring.prod_inv_l_r_eq ring.
(**
Proves that the inverse relationship is
symmetric.
*)
Theorem prod_inv_sym
: forall x y : E, prod_is_inv x y <-> prod_is_inv y x.
Proof Ring.prod_inv_sym ring.
(**
Proves the left cancellation law for elements
possessing a left inverse.
*)
Theorem prod_cancel_l
: forall x y z : E, prod_has_inv_l z -> z # x = z # y -> x = y.
Proof Ring.prod_cancel_l ring.
(**
Proves the right cancellation law for
elements possessing a right inverse.
*)
Theorem prod_cancel_r
: forall x y z : E, prod_has_inv_r z -> x # z = y # z -> x = y.
Proof Ring.prod_cancel_r ring.
(**
Proves that an element's left inverse
is unique.
*)
Theorem prod_inv_l_uniq
: forall x : E, prod_has_inv_r x -> forall y z : E, prod_is_inv_l x y -> prod_is_inv_l x z -> z = y.
Proof Ring.prod_inv_l_uniq ring.
(**
Proves that an element's right inverse
is unique.
*)
Theorem prod_inv_r_uniq
: forall x : E, prod_has_inv_l x -> forall y z : E, prod_is_inv_r x y -> prod_is_inv_r x z -> z = y.
Proof Ring.prod_inv_r_uniq ring.
(**
Proves that an element's inverse is unique.
Note: the field module depends on this proof
being transparent.
*)
Definition prod_inv_uniq
: forall x y z : E, prod_is_inv x y -> prod_is_inv x z -> z = y
:= Ring.prod_inv_uniq ring.
(**
Proves that the identity element is its own
left inverse.
*)
Theorem prod_inv_1_l
: prod_is_inv_l 1 1.
Proof Ring.prod_inv_1_l ring.
(**
Proves that the identity element is its own
right inverse.
*)
Theorem prod_inv_1_r
: prod_is_inv_r 1 1.
Proof Ring.prod_inv_1_l ring.
(**
Proves that the identity element is its own
inverse.
*)
Theorem prod_inv_1
: prod_is_inv 1 1.
Proof Ring.prod_inv_1 ring.
(** Proves that 1 has a left multiplicative inverse. *)
Theorem prod_has_inv_l_1
: prod_has_inv_l 1.
Proof Ring.prod_has_inv_l_1 ring.
(** Proves that 1 has a right multiplicative inverse. *)
Theorem prod_has_inv_r_1
: prod_has_inv_r 1.
Proof Ring.prod_has_inv_r_1 ring.
(** Proves that 1 has a reciprical *)
Theorem prod_has_inv_1
: prod_has_inv 1.
Proof Ring.prod_has_inv_1 ring.
(**
Proves that if an element's, x, inverse
equals 0, x equals 0.
*)
Theorem prod_inv_1_eq_1
: forall x : E, prod_is_inv x 1 -> x = 1.
Proof Ring.prod_inv_1_eq_1 ring.
(**
Proves that 0 is the only element whose
inverse is 0.
*)
Theorem prod_inv_1_uniq
: unique (fun x => prod_is_inv x 1) 1.
Proof Ring.prod_inv_1_uniq ring.
(** Proves that 1 is its own left multiplicative inverse. *)
Theorem recipr_1_l
: prod_is_inv_l 1 1.
Proof Ring.recipr_1_l ring.
(** Proves that 1 is its own right multiplicative inverse. *)
Theorem recipr_1_r
: prod_is_inv_r 1 1.
Proof Ring.recipr_1_r ring.
(** Proves that 1 is its own recriprical. *)
Theorem recipr_1
: prod_is_inv 1 1.
Proof Ring.recipr_1 ring.
(**
Asserts that multiplication is
distributive over addition.
*)
Theorem prod_sum_distrib
: Ring.is_distrib E {#} {+}.
Proof Ring.prod_sum_distrib ring.
(**
Proves that 0 times every number equals 0.
0 x = 0 x
(0 + 0) x = 0 x
0 x + 0 x = 0 x
0 x = 0
*)
Theorem prod_0_l
: forall x : E, 0 # x = 0.
Proof Ring.prod_0_l ring.
(** Proves that 0 times every number equals 0. *)
Theorem prod_0_r
: forall x : E, x # 0 = 0.
Proof Ring.prod_0_r ring.
(** Proves that 0 does not have a left multiplicative inverse. *)
Theorem prod_0_inv_l
: ~ prod_has_inv_l 0.
Proof Ring.prod_0_inv_l ring.
(** Proves that 0 does not have a right multiplicative inverse. *)
Theorem prod_0_inv_r
: ~ prod_has_inv_r 0.
Proof Ring.prod_0_inv_r ring.
(**
Proves that 0 does not have a multiplicative
inverse - I.E. 0 does not have a
reciprocal.
*)
Theorem prod_0_inv
: ~ prod_has_inv 0.
Proof Ring.prod_0_inv ring.
(**
Proves that multiplicative inverses, when
they exist are always nonzero.
*)
Theorem prod_inv_0
: forall x y : E, prod_is_inv x y -> nonzero y.
Proof Ring.prod_inv_0 ring.
(** Represents -1 and proves that it exists. *)
Definition E_n1_strong
: { x : E | sum_is_inv 1 x }
:= Ring.E_n1_strong ring.
(** Represents -1. *)
Definition E_n1 : E := Ring.E_n1 ring.
(**
Defines a symbolic representation for -1
Note: here we represent the inverse of 1
rather than the negation of 1. Letter we prove
that the negation equals the inverse.
Note: brackets are needed to ensure Coq parses
the symbol as a single token instead of a
prefixed function call.
*)
Notation "{-1}" := E_n1 : commutative_ring_scope.
(** Asserts that -1 is the additive inverse of 1. *)
Definition E_n1_def
: sum_is_inv 1 {-1}
:= Ring.E_n1_def ring.
(** Asserts that -1 is the left inverse of 1. *)
Theorem E_n1_inv_l
: sum_is_inv_l 1 {-1}.
Proof Ring.E_n1_inv_l ring.
(** Asserts that -1 is the right inverse of 1. *)
Theorem E_n1_inv_r
: sum_is_inv_r 1 {-1}.
Proof Ring.E_n1_inv_r ring.
(**
Asserts that every additive inverse
of 1 must be equal to -1.
*)
Theorem E_n1_uniq
: forall x : E, sum_is_inv 1 x -> x = {-1}.
Proof Ring.E_n1_uniq ring.
(**
Proves that -1 * x equals the multiplicative
inverse of x.
-1 x + x = 0
-1 x + 1 x = 0
(-1 + 1) x = 0
0 x = 0
0 = 0
*)
Theorem prod_n1_x_inv_l
: forall x : E, sum_is_inv_l x ({-1} # x).
Proof Ring.prod_n1_x_inv_l ring.
(**
Proves that x * -1 equals the multiplicative
inverse of x.
x -1 + x = 0
*)
Theorem prod_x_n1_inv_l
: forall x : E, sum_is_inv_l x (x # {-1}).
Proof Ring.prod_x_n1_inv_l ring.
(** Proves that x + -1 x = 0. *)
Theorem prod_n1_x_inv_r
: forall x : E, sum_is_inv_r x ({-1} # x).
Proof Ring.prod_n1_x_inv_r ring.
(** Proves that x + x -1 = 0. *)
Theorem prod_x_n1_inv_r
: forall x : E, sum_is_inv_r x (x # {-1}).
Proof Ring.prod_x_n1_inv_r ring.
(** Proves that -1 x is the additive inverse of x. *)
Theorem prod_n1_x_inv
: forall x : E, sum_is_inv x ({-1} # x).
Proof Ring.prod_n1_x_inv ring.
(** Proves that x -1 is the additive inverse of x. *)
Theorem prod_x_n1_inv
: forall x : E, sum_is_inv x (x # {-1}).
Proof Ring.prod_x_n1_inv ring.
(**
Proves that multiplying by -1 is equivalent
to negation.
*)
Theorem prod_n1_neg
: {#} {-1} = sum_neg.
Proof Ring.prod_n1_neg ring.
(**
Accepts one element, x, and proves that
x -1 equals the additive negation of x.
*)
Theorem prod_x_n1_neg
: forall x : E, x # {-1} = - x.
Proof Ring.prod_x_n1_neg ring.
(**
Accepts one element, x, and proves that
-1 x equals the additive negation of x.
*)
Theorem prod_n1_x_neg
: forall x : E, {-1} # x = - x.
Proof Ring.prod_n1_x_neg ring.
(** Proves that -1 x = x -1. *)
Theorem prod_n1_eq
: forall x : E, {-1} # x = x # {-1} .
Proof Ring.prod_n1_eq ring.
(** Proves that the additive negation of 1 equals -1. *)
Theorem neg_1
: {-} 1 = {-1}.
Proof Ring.neg_1 ring.
(** Proves that the additive negation of -1 equals 1. *)
Theorem neg_n1
: sum_neg {-1} = 1.
Proof Ring.neg_n1 ring.
(**
Proves that -1 * -1 = 1.
-1 * -1 = -1 * -1
-1 * -1 = prod -1 -1
-1 * -1 = sum_neg -1
-1 * -1 = 1
*)
Theorem prod_n1_n1
: {-1} # {-1} = 1.
Proof Ring.prod_n1_n1 ring.
(**
Proves that -1 is its own multiplicative
inverse.
*)
Theorem E_n1_inv
: prod_is_inv {-1} {-1}.
Proof Ring.E_n1_inv ring.
End Theorems.
End Commutative_Ring.
Notation "0" := (Commutative_Ring.E_0) : commutative_ring_scope.
Notation "1" := (Commutative_Ring.E_1) : commutative_ring_scope.
Notation "x + y" := (Commutative_Ring.sum x y) (at level 50, left associativity) : commutative_ring_scope.
Notation "{+}" := (Commutative_Ring.sum) : commutative_ring_scope.
Notation "{-}" := (Commutative_Ring.sum_neg _) : commutative_ring_scope.
Notation "- x" := (Commutative_Ring.sum_neg _ x) : commutative_ring_scope.
Notation "x # y" := (Commutative_Ring.prod x y) (at level 50, left associativity) : commutative_ring_scope.
Notation "{#}" := (Commutative_Ring.prod) : commutative_ring_scope.