Download lean/OAI/GameTheory/SnakyTwentyOne/Model.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.55 kB
-
https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/GameTheory/SnakyTwentyOne/Model.lean
- Command line
-
hf download hf://datasets/roseking/openAI-math-dataset/lean/OAI/GameTheory/SnakyTwentyOne/Model.lean
-
curl -L -o Model.lean https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/GameTheory/SnakyTwentyOne/Model.lean
1.55 kB
| import Mathlib | |
| namespace OAI | |
| namespace SnakyPrototype | |
| variable {α : Type*} [DecidableEq α] | |
| abbrev Cell := ℤ × ℤ | |
| def snaky : Finset Cell := {(0, 0), (1, 0), (2, 0), (3, 0), (3, 1), (4, 1)} | |
| def orient (r : Fin 8) (p : Cell) : Cell := | |
| match r.val with | |
| | 0 => (p.1, p.2) | |
| | 1 => (p.2, p.1) | |
| | 2 => (p.1, -p.2) | |
| | 3 => (-p.2, p.1) | |
| | 4 => (-p.1, p.2) | |
| | 5 => (p.2, -p.1) | |
| | 6 => (-p.1, -p.2) | |
| | _ => (-p.2, -p.1) | |
| def placement (r : Fin 8) (t p : Cell) : Cell := orient r p + t | |
| def HasSnaky (M : Finset Cell) : Prop := | |
| ∃ (r : Fin 8) (t : Cell), snaky.image (placement r t) ⊆ M | |
| end SnakyPrototype | |
| namespace SnakyPrototype.OrdinaryStrategy | |
| variable {α : Type*} [DecidableEq α] [Infinite α] | |
| abbrev Policy (α : Type*) := ℕ → Finset α → Finset α → α | |
| def playState (σ : Policy α) (N : ℕ) (β : ℕ → α) (M₀ B₀ : Finset α) : | |
| ℕ → Finset α × Finset α | |
| | 0 => (M₀, B₀) | |
| | k + 1 => | |
| let state := playState σ N β M₀ B₀ k | |
| (insert (σ (N - k) state.1 state.2) state.1, insert (β k) state.2) | |
| def makerAt (σ : Policy α) (N : ℕ) (β : ℕ → α) (M₀ B₀ : Finset α) (k : ℕ) : α := | |
| let state := playState σ N β M₀ B₀ k | |
| σ (N - k) state.1 state.2 | |
| def LegalRepliesBeforeFinal (σ : Policy α) (N : ℕ) (β : ℕ → α) | |
| (M₀ B₀ : Finset α) : Prop := | |
| ∀ k, k + 1 < N → | |
| β k ∉ insert (makerAt σ N β M₀ B₀ k) (playState σ N β M₀ B₀ k).1 ∧ | |
| β k ∉ (playState σ N β M₀ B₀ k).2 | |
| end SnakyPrototype.OrdinaryStrategy | |
| end OAI | |