Skip to content
LeanLearn
Level 3~30 minLean 4

Cube Quest 2 · Formalize: the cube as a Lean structure

Turn the specification into Lean: a structure with five lists, a solved state, and invariants you can compute. Then prove your first facts about cubes.

You will be able to
  • Read the Lean structure Cube: which field stores what.
  • Explain why corner twists are counted mod 3 and edge flips mod 2.
  • Prove concrete facts about cube states by computation (decide).

Recommended first: Cube Quest 1 · Specify: what is a cube?. You can start anyway. Nothing is locked.

EncounterActivity 1 of 6

Encounter

A cube state is five lists of natural numbers:

fieldlengthmeaning
cp8cp[i] = which corner sits in corner slot i
co8its twist: 0, 1 or 2 (a third of a turn each)
ep12which edge sits in edge slot i
eo12its flip: 0 or 1
ctr6which centre is on each face (slices move them)

Slots have names: corners URF UFL ULB UBR DFR DLF DBL DRB (0–7), edges UR UF UL UB DR DF DL DB FR FL BL BR (0–11). The solved cube is cp = [0, 1, …, 7], every twist and flip 0. In Lean it is written 1, because, as you will see, cubes multiply.