Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat: define PGame.identical PGame.memₗ PGame.memᵣ #17122

Closed
wants to merge 9 commits into from
38 changes: 18 additions & 20 deletions Mathlib/SetTheory/Game/PGame.lean
Original file line number Diff line number Diff line change
Expand Up @@ -350,24 +350,13 @@ instance isEmpty_one_rightMoves : IsEmpty (RightMoves 1) :=
/-- Two pre-games are identical if their left and right sets are identical.
That is, `Identical x y` if every left move of `x` is identical to some left move of `y`,
every right move of `x` is identical to some right move of `y`, and vice versa. -/
def Identical : ∀ (_ _ : PGame.{u}), Prop
def Identical : ∀ _ _ : PGame.{u}, Prop
FR-vdash-bot marked this conversation as resolved.
Show resolved Hide resolved
| mk _ _ xL xR, mk _ _ yL yR =>
Relator.BiTotal (fun i j ↦ Identical (xL i) (yL j)) ∧
Relator.BiTotal (fun i j ↦ Identical (xR i) (yR j))

@[inherit_doc] scoped infix:50 " ≡ " => PGame.Identical

/-- `x ∈ₗ y` if `x` is identical to some left move of `y`. -/
def memₗ (x y : PGame.{u}) : Prop := ∃ b, x ≡ y.moveLeft b

/-- `x ∈ᵣ y` if `x` is identical to some right move of `y`. -/
def memᵣ (x y : PGame.{u}) : Prop := ∃ b, x ≡ y.moveRight b

@[inherit_doc] scoped infix:50 " ∈ₗ " => PGame.memₗ
@[inherit_doc] scoped infix:50 " ∈ᵣ " => PGame.memᵣ
@[inherit_doc PGame.memₗ] binder_predicate x " ∈ₗ " y:term => `($x ∈ₗ $y)
@[inherit_doc PGame.memᵣ] binder_predicate x " ∈ᵣ " y:term => `($x ∈ᵣ $y)

theorem identical_iff : ∀ {x y : PGame}, x ≡ y ↔
Relator.BiTotal (x.moveLeft · ≡ y.moveLeft ·) ∧ Relator.BiTotal (x.moveRight · ≡ y.moveRight ·)
| mk _ _ _ _, mk _ _ _ _ => Iff.rfl
Expand All @@ -387,6 +376,22 @@ theorem identical_comm {x y} : x ≡ y ↔ y ≡ x :=
| mk _ _ _ _, mk _ _ _ _, mk _ _ _ _, ⟨hL₁, hR₁⟩, ⟨hL₂, hR₂⟩ =>
⟨hL₁.trans (fun _ _ _ h₁ h₂ ↦ h₁.trans h₂) hL₂, hR₁.trans (fun _ _ _ h₁ h₂ ↦ h₁.trans h₂) hR₂⟩

/-- `x ∈ₗ y` if `x` is identical to some left move of `y`. -/
def memₗ (x y : PGame.{u}) : Prop := ∃ b, x ≡ y.moveLeft b

/-- `x ∈ᵣ y` if `x` is identical to some right move of `y`. -/
def memᵣ (x y : PGame.{u}) : Prop := ∃ b, x ≡ y.moveRight b

@[inherit_doc] scoped infix:50 " ∈ₗ " => PGame.memₗ
@[inherit_doc] scoped infix:50 " ∈ᵣ " => PGame.memᵣ
@[inherit_doc PGame.memₗ] binder_predicate x " ∈ₗ " y:term => `($x ∈ₗ $y)
@[inherit_doc PGame.memᵣ] binder_predicate x " ∈ᵣ " y:term => `($x ∈ᵣ $y)

theorem memₗ_def {x y : PGame} : x ∈ₗ y ↔ ∃ b, x ≡ y.moveLeft b := .rfl
theorem memᵣ_def {x y : PGame} : x ∈ᵣ y ↔ ∃ b, x ≡ y.moveRight b := .rfl
theorem moveLeft_memₗ (x : PGame) (b) : x.moveLeft b ∈ₗ x := ⟨_, .rfl⟩
theorem moveRight_memᵣ (x : PGame) (b) : x.moveRight b ∈ᵣ x := ⟨_, .rfl⟩

theorem identical_of_is_empty (x y : PGame)
FR-vdash-bot marked this conversation as resolved.
Show resolved Hide resolved
[IsEmpty x.LeftMoves] [IsEmpty x.RightMoves]
[IsEmpty y.LeftMoves] [IsEmpty y.RightMoves] : x ≡ y :=
Expand Down Expand Up @@ -423,6 +428,7 @@ lemma Identical.moveRight_symm : ∀ {x y}, x ≡ y →
∀ i, ∃ j, x.moveRight j ≡ y.moveRight i
| mk _ _ _ _, mk _ _ _ _, ⟨_, hr⟩, i => hr.2 i

/-- Uses `∈ₗ` `∈ᵣ` instead of `≡`. -/
FR-vdash-bot marked this conversation as resolved.
Show resolved Hide resolved
theorem identical_iff' : ∀ {x y : PGame}, x ≡ y ↔
FR-vdash-bot marked this conversation as resolved.
Show resolved Hide resolved
((∀ i, x.moveLeft i ∈ₗ y) ∧ (∀ j, y.moveLeft j ∈ₗ x)) ∧
((∀ i, x.moveRight i ∈ᵣ y) ∧ (∀ j, y.moveRight j ∈ᵣ x))
Expand All @@ -432,14 +438,6 @@ theorem identical_iff' : ∀ {x y : PGame}, x ≡ y ↔
congr! <;>
exact exists_congr <| fun _ ↦ identical_comm

theorem memₗ_def {x y : PGame} : x ∈ₗ y ↔ ∃ b, x ≡ y.moveLeft b := .rfl

theorem memᵣ_def {x y : PGame} : x ∈ᵣ y ↔ ∃ b, x ≡ y.moveRight b := .rfl

theorem moveLeft_memₗ (x : PGame) (b) : x.moveLeft b ∈ₗ x := ⟨_, .rfl⟩

theorem moveRight_memᵣ (x : PGame) (b) : x.moveRight b ∈ᵣ x := ⟨_, .rfl⟩

theorem memₗ.congr_right : ∀ {x y : PGame},
x ≡ y → (∀ {w : PGame}, w ∈ₗ x ↔ w ∈ₗ y)
| mk _ _ _ _, mk _ _ _ _, ⟨⟨h₁, h₂⟩, _⟩, _w =>
Expand Down
Loading