Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(order/game_add): move
game_add
to its own file (#15885)
We move `game_add` from the `logic/hydra` file to a new `order/game_add` file, and move it in the `prod` namespace in preparation for a future PR that will add `sym2.game_add`.
- Loading branch information
Showing
2 changed files
with
80 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/- | ||
Copyright (c) 2022 Junyan Xu. All rights reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Authors: Junyan Xu | ||
-/ | ||
|
||
import logic.relation | ||
import order.basic | ||
|
||
/-! | ||
# Game addition relation | ||
This file defines, given relations `rα : α → α → Prop` and `rβ : β → β → Prop`, a relation | ||
`prod.game_add` on pairs, such that `game_add rα rβ x y` iff `x` can be reached from `y` by | ||
decreasing either entry (with respect to `rα` and `rβ`). It is so called since it models the | ||
subsequency relation on the addition of combinatorial games. | ||
## Main definitions and results | ||
- `prod.game_add`: the game addition relation on ordered pairs. | ||
- `well_founded.game_add`: formalizes induction on ordered pairs, where exactly one entry decreases | ||
at a time. | ||
## Todo | ||
- Add custom `induction` and `fix` lemmas. | ||
- Define `sym2.game_add`. | ||
-/ | ||
|
||
variables {α β : Type*} (rα : α → α → Prop) (rβ : β → β → Prop) | ||
|
||
namespace prod | ||
|
||
/-- The "addition of games" relation in combinatorial game theory, on the product type: if | ||
`rα a' a` means that `a ⟶ a'` is a valid move in game `α`, and `rβ b' b` means that `b ⟶ b'` | ||
is a valid move in game `β`, then `game_add rα rβ` specifies the valid moves in the juxtaposition | ||
of `α` and `β`: the player is free to choose one of the games and make a move in it, | ||
while leaving the other game unchanged. -/ | ||
inductive game_add : α × β → α × β → Prop | ||
| fst {a' a b} : rα a' a → game_add (a',b) (a,b) | ||
| snd {a b' b} : rβ b' b → game_add (a,b') (a,b) | ||
|
||
/-- `game_add` is a `subrelation` of `prod.lex`. -/ | ||
lemma game_add_le_lex : game_add rα rβ ≤ prod.lex rα rβ := | ||
λ _ _ h, h.rec (λ _ _ b, prod.lex.left b b) (λ a _ _, prod.lex.right a) | ||
|
||
/-- `prod.rprod` is a subrelation of the transitive closure of `game_add`. -/ | ||
lemma rprod_le_trans_gen_game_add : prod.rprod rα rβ ≤ relation.trans_gen (game_add rα rβ) := | ||
λ _ _ h, h.rec begin | ||
intros _ _ _ _ hα hβ, | ||
exact relation.trans_gen.tail (relation.trans_gen.single $ game_add.fst hα) (game_add.snd hβ), | ||
end | ||
|
||
end prod | ||
|
||
variables {rα rβ} | ||
|
||
/-- If `a` is accessible under `rα` and `b` is accessible under `rβ`, then `(a, b)` is | ||
accessible under `prod.game_add rα rβ`. Notice that `prod.lex_accessible` requires the | ||
stronger condition `∀ b, acc rβ b`. -/ | ||
lemma acc.prod_game_add {a b} (ha : acc rα a) (hb : acc rβ b) : acc (prod.game_add rα rβ) (a, b) := | ||
begin | ||
induction ha with a ha iha generalizing b, | ||
induction hb with b hb ihb, | ||
refine acc.intro _ (λ h, _), | ||
rintro (⟨_,_,_,ra⟩|⟨_,_,_,rb⟩), | ||
exacts [iha _ ra (acc.intro b hb), ihb _ rb], | ||
end | ||
|
||
/-- The sum of two well-founded games is well-founded. -/ | ||
lemma well_founded.prod_game_add (hα : well_founded rα) (hβ : well_founded rβ) : | ||
well_founded (prod.game_add rα rβ) := ⟨λ ⟨a,b⟩, (hα.apply a).prod_game_add (hβ.apply b)⟩ |