| ← Matrices | Index |
Key points. A ring bundles an additive CommGroup with a
multiplicative monoid and two distributive laws, left_distrib and
right_distrib genuinely independent since mul need not commute. A
finite carrier (Fin 3) lets every axiom be checked by decide; an
infinite one (Int, matrices over Int) needs a real proof, or a
computed counterexample (#eval) to refute commutativity outright.
Socratic questions.
Ringhas nomul_commfield, yetintRingandfin3Ringare both commutative in practice. Is the missing field a gap in the definition? No —Ringdeliberately states only what every ring must satisfy.IntandFin 3happen to commute, as a fact provable from their specificmul, not as somethingRingassumes on their behalf.mat2Ringis the proof that a genuineRingneed not commute at all.mat2Ring’smul_assocneeded a twelve-line proof;intRing’s needed one. Both are proving associativity — why such different effort?Int.mul_associs a single already-proved core-library fact to cite. Matrix multiplication’s associativity is not a citation away; each entry of $(XY)Z$ expands to four cross-terms that must be regrouped to match $X(YZ)$’s four cross-terms, entry by entry — the content being proved is bigger, not just the notation.-
decideclosed every axiom forfin3Ringbut cannot touch a single axiom ofintRing. What property of the carrier decides which side of that line a ring falls on? Finiteness (and decidable equality) of the carrier, not the ring axioms themselves —by decidebrute-forces every combination of finitely many elements, which is only possible when there are finitely many to try.Inthas none of that; a real argument is the only way in. - Build
boolAndOrRing. This is surprisingly difficult: is there a natural ring structure onBool? (Hint: think ofBoolas $\mathbb{Z}/2\mathbb{Z}$ — addition is XOR, multiplication is AND. BuildintAddGroupMod2 : CommGroup Boolwithop := Bool.xor, then aRing Boolusingmul := Bool.and,one := true.) - State (in words, no Lean needed yet) why we needed both
left_distribandright_distribas separate axioms, tying it back to not assumingmulis commutative. - Using the witness pair
(X, Y)computed above, state and provetheorem mat2_not_comm : ∃ X Y : Mat2, Mat2.mul X Y ≠ Mat2.mul Y X. Note thatby decidedoes not work directly here —Mat2has noDecidableEqinstance, so equality of twoMat2terms is not somethingdecidecan evaluate out of the box (check the error message it gives; this is exactly the “read the failure” habit from Chapter 4). Instead, assumeh : Mat2.mul X Y = Mat2.mul Y X, useMat2.mk.injEqto turnhinto a conjunction ofIntequalities, and deriveFalsefrom the first (false) one withby decideat theInt-equality level, where aDecidableEqinstance really does exist.
Solutions: Appendix, Chapter 8.
Next
Continue to Chapter 9: Ring examples and basic theorems.
| ← Matrices | Index | Table of contents | Ch. 9: Ring Theorems → |