Step 12 / 64

Middle school

Addition and multiplication together

A shared set of rules for two operations describes many different number worlds.

Start with a concrete example

Three bags, each with 2 apples and 4 pears, contain 3×(2+4)=18 fruits. Counting kinds separately gives 3×2+3×4=18 too. Rings preserve rules like this for addition and multiplication.

A small check: try the idea

Think with the concrete example above. You can try again.

Three bags each contain 2 apples and 4 pears. How many fruits in total?

Read the answer and reasoning

18. Multiply both kinds: 3×2+3×4=6+12=18. Multiplying only the apples misses two bags of pears.

Build the idea in three steps

  1. In the clock world, arithmetic has two operations on the same set of residues: addition and multiplication.
  2. A shared list of rules, such as (a + b) + c = a + (b + c) and a × (b + c) = a × b + a × c, fixes exactly what those operations must obey.
  3. A set carrying both operations under those rules is a ring. Lean names the commutative version CommRing, and the library records precisely that structure for the residues Fin n.

A small example

Taking remainders does not break the rules: for the 5-clock, 3 × (2 + 4) and (3 × 2) + (3 × 4) both become 3.

Lean definition · original excerpt

Mathlib · db584cd · Defs.lean

def instCommRing (n : ℕ) [NeZero n] : CommRing (Fin n) where  intCast n := Fin.intCast n

How to read this Lean

instCommRing states that the residue set Fin n carries a CommRing structure. The visible field intCast supplies how an ordinary integer lands inside it; the remaining rules are fields of the same structure.

Where this idea is used

2. The case of three5. The suspicious parcel7. The veterans’ cabinet12. The workshops agree13. Pip’s impossible quilt
I’m lost · Help

Mika’s help desk

Addition and multiplication together

One thing at a time

Read the three explanation steps first. The Lean source is there for a closer look afterwards; you do not have to read it first.

In simpler words

A shared set of rules for two operations describes many different number worlds.

Earlier ideas are listed under “Start with these ideas” on this page.

A small clue

Taking remainders does not break the rules: for the 5-clock, 3 × (2 + 4) and (3 × 2) + (3 × 4) both become 3.

Close this panel to return to the exact place you were reading. These are prepared hints for this page.

Start with the first small story →