Lean / Reader
Lean reader

ParityPalettes.lean

23 lines5 declarationsno sorryimports SharedColour

Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports SharedColour, which it does not have: you can read it there, but it will not check. Build the project itself to check it.

  1. import SharedColour
  2. namespace ParityPalettes
  3. def globalColour (w i : Nat) := (w >>> (3*i)) % 8
  4. def validWord (w n : Nat) : Bool :=
  5. (List.range n).all fun s => (List.range ((n-1-s)/3)).all fun j =>
  6. let d := j+1
  7. differentThree (globalColour w s) (globalColour w (s+d))
  8. (globalColour w (s+2*d)) (globalColour w (s+3*d))
  9. def respects (w n : Nat) (left right : List Nat) : Bool :=
  10. (List.range n).all fun i => (if i%2=0 then left else right).contains (globalColour w i)
  11. theorem witness34 : ∃ w : Nat, validWord w 34 = true ∧ respects w 34 [0, 1, 2, 3] [0, 4, 5, 6] = true := by
  12. exact ⟨4022860443791501417479137340001, by decide +kernel, by decide +kernel⟩
  13. theorem witness36 : ∃ w : Nat, validWord w 36 = true ∧ respects w 36 [0, 1, 2, 3] [4, 5, 6, 7] = true := by
  14. exact ⟨297949488540913504895719722060384, by decide +kernel, by decide +kernel⟩
  15. end ParityPalettes