Imports.agda 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. module Issue846.Imports where
  2. open import Data.Nat public using (ℕ; zero; suc; _≤_; _∸_)
  3. open import Data.List public using (List; []; _∷_)
  4. open import Data.Bool public using (Bool; true; false; not)
  5. open import Issue846.OldDivMod public using (_mod_)
  6. open import Data.Fin public using (Fin; toℕ; zero; suc)
  7. open import Relation.Binary.PropositionalEquality public using (_≡_; _≢_; cong)
  8. open import Relation.Binary public using (nonEmpty) -- this is the bad guy
  9. open import Issue846.DivModUtils public using (1'; lem-sub-p)
  10. record Move : Set where
  11. constructor pick
  12. field
  13. picked : ℕ
  14. 1≤n : 1 ≤ picked
  15. n≤6 : picked ≤ 6
  16. open Move using (picked)
  17. Strategy = ℕ → Move
  18. {-# TERMINATING #-}
  19. play : ℕ → Strategy → Strategy → List ℕ
  20. play 0 _ _ = []
  21. play n p1 p2 = n ∷ play (n ∸ picked (p1 n)) p2 p1
  22. postulate
  23. opt : Strategy
  24. evenList : {A : Set} → List A → Bool
  25. evenList [] = true
  26. evenList (_ ∷ xs) = not (evenList xs)
  27. winner : ℕ → Strategy → Strategy → Bool
  28. winner n p1 p2 = evenList (play n p1 p2)
  29. postulate
  30. opt-is-opt : ∀ n s → n mod 7 ≢ 1' → winner n opt s ≡ true