A monoid is a
A group is a monoid
Let
The element
The set of units
Theorem. The set of units of a monoid carries a group structure.
Let
A monoid
Given a monoid
We say that
Divides. In a monoid, for all
Irreducible. In a cancellation monoid, an element
Prime. In a cancellation monoid, an element
In a cancellation monoid, let
Decidable equality implies that denial inequality is a tight apartness.
Let
In the real numbers it holds:
Traditional mathematics: Other people will confirm if your proof is correct.
Problem: Needs time, effort and people who are willing to check your proof.
Solution: Take your proof and write it in a proof assistant to see if it is correct.
Lean: Programming language with strong type checking capabilities, making it possibile to use it as a proof assistant.
Seminar: We formalised the definition of monoids, units, groups as well as prime and irreducible elements.
Simplify your life, use simp
.
Sometimes your goal is near, it is exact
.
What do I want to prove? intro
your assumptions.
structure Monoid where -- Implementation: 5-tuple ("set", multiplication, 1, associativity, neutral property)
carrier : Type
op : carrier → carrier → carrier
neutral_elt : carrier
op_assoc : ∀ a b c : carrier, op (op a b) c = op a (op b c)
neutral_ppty : ∀ a : carrier, op one a = a ∧ op a one = a
structure InvElts (M : Monoid) : Type 0 where -- Triple (element, inverse, property of inverse)
elt : M.carrier
inv : M.carrier
isInv : M.op elt inv = M.neutral_elt ∧ M.op inv elt = M.neutral_elt
def invMap (M : Monoid) : InvElts M → InvElts M := -- sends an element in InvElts to its "inverse"
fun ⟨x, y, p⟩ ↦ ⟨y, x, by constructor; exact p.2; exact p.1⟩ -- we need to construct the third term
-- which is a proof of the proposition `M.op y x = M.neutral_elt ∧ M.op x y = M.neutral_elt`
--definition unit
def unit (n : Nat) : Prop :=
∃ m : Nat, m * n = 1 ∧ n * m = 1
--definition irreducible
def irred (n : Nat) : Prop :=
∀ a b : Nat, n = a * b → unit a ∨ unit b
-- definition prime
def prime (p : Nat) : Prop :=
(∀ a b : Nat, p ∣ (a * b) → p ∣ a ∨ p ∣ b) ∧ (0 < p)
Let us look at the code.