Games.Examples
Martin Escardo, Paulo Oliva, 2-27 July 2021 Examples of type trees.{-# OPTIONS --safe --without-K #-} module Games.Examples where open import MLTT.Spartan hiding (J) open import MLTT.Fin open import Games.TypeTrees open import MonadOnTypes.J open import MonadOnTypes.K module permutations where no-repetitions : β β π€ Μ β π» {π€} no-repetitions 0 X = [] no-repetitions (succ n) X = X β· Ξ» (x : X) β no-repetitions n (Ξ£ y κ X , y β x) Permutations : β β π€β Μ Permutations n = Path (no-repetitions n (Fin n)) example-permutation2 : Permutations 2 example-permutation2 = π :: ((π , (Ξ» ())) :: β¨β©) example-permutation3 : Permutations 3 example-permutation3 = π :: ((π :: (Ξ» ())) :: (((π , (Ξ» ())) , (Ξ» ())) :: β¨β©))open import UF.FunExt module search (fe : Fun-Ext) where open import MLTT.Athenian open import Games.FiniteHistoryDependent {π€β} {π€β} Bool open J-definitions Bool Ξ΅β : J Bool Ξ΅β p = p true h : β β π» h 0 = [] h (succ n) = Bool β· Ξ» _ β h n Ξ΅s : (n : β) β π (h n) Ξ΅s 0 = β¨β© Ξ΅s (succ n) = Ξ΅β :: Ξ» _ β Ξ΅s n Ξ΅ : (n : β) β J (Path (h n)) Ξ΅ n = sequenceα΄Ά (Ξ΅s n) qq : (n : β) β Path (h n) β Bool qq 0 β¨β© = true qq (succ n) (x :: xs) = not x && qq n xs test : (n : β) β Path (h n) test n = Ξ΅ n (qq n)module another-game-representation {π€ π¦β : Universe} (R : π¦β Μ ) where open K-definitions R data GameK {π€ : Universe} : π€ βΊ β π¦β Μ where leaf : R β GameK {π€} branch : (X : π€ Μ ) (Xf : X β GameK {π€}) (Ο : K X) β GameKTODO. GameK β Game and we have a map GameJ β GameK. TODO. Define game isomorphism (and possibly homomorphism more generally).data π»' (X : π€ Μ ) : π€ βΊ Μ where [] : π»' X _β·_ : (A : X β π€ Μ ) (Xf : (x : X) β A x β π»' X) β π»' X record Gameβ» {π€ : Universe} : π€ βΊ β π¦β Μ where constructor gameβ» field Xt : π» {π€} q : Path Xt β RTODO. Gameβ» β (Ξ£ R : ? Μ , π»' R). In Gameβ», we know how to play the game, but we don't know what the objective of the game is.