l3lab/ntp-mathlib huggingface dataset:
/-- The equivalence between `leftMoves` for a `PGame` constructed using `ofStateAux _ s _`, and
`L s`. -/
def leftMovesOfStateAux (n : ℕ) {s : S} (h : turnBound s ≤ n) :
    LeftMoves (ofStateAux n s h) ≃ { t // t ∈ l s } := by 

Proof state:
S : Type u
inst✝ : State S
n : ℕ
s : S
h : turnBound s ≤ n
⊢ LeftMoves (ofStateAux n s h) ≃ { t // t ∈ l s }

Next tactic:
induction n
/-- The equivalence between `leftMoves` for a `PGame` constructed using `ofStateAux _ s _`, and
`L s`. -/
def leftMovesOfStateAux (n : ℕ) {s : S} (h : turnBound s ≤ n) :
    LeftMoves (ofStateAux n s h) ≃ { t // t ∈ l s } := by induction n <;> 

Proof state:
case zero
S : Type u
inst✝ : State S
s : S
h : turnBound s ≤ Nat.zero
⊢ LeftMoves (ofStateAux Nat.zero s h) ≃ { t // t ∈ l s }

Next tactic:
rfl
/-- The equivalence between `leftMoves` for a `PGame` constructed using `ofStateAux _ s _`, and
`L s`. -/
def leftMovesOfStateAux (n : ℕ) {s : S} (h : turnBound s ≤ n) :
    LeftMoves (ofStateAux n s h) ≃ { t // t ∈ l s } := by induction n <;> 

Proof state:
case succ
S : Type u
inst✝ : State S
s : S
n✝ : ℕ
n_ih✝ : (h : turnBound s ≤ n✝) → LeftMoves (ofStateAux n✝ s h) ≃ { t // t ∈ l s }
h : turnBound s ≤ Nat.succ n✝
⊢ LeftMoves (ofStateAux (Nat.succ n✝) s h) ≃ { t // t ∈ l s }

Next tactic:
rfl
/-- The equivalence between `rightMoves` for a `PGame` constructed using `ofStateAux _ s _`, and
`R s`. -/
def rightMovesOfStateAux (n : ℕ) {s : S} (h : turnBound s ≤ n) :
    RightMoves (ofStateAux n s h) ≃ { t // t ∈ r s } := by 

Proof state:
S : Type u
inst✝ : State S
n : ℕ
s : S
h : turnBound s ≤ n
⊢ RightMoves (ofStateAux n s h) ≃ { t // t ∈ r s }

Next tactic:
induction n
/-- The equivalence between `rightMoves` for a `PGame` constructed using `ofStateAux _ s _`, and
`R s`. -/
def rightMovesOfStateAux (n : ℕ) {s : S} (h : turnBound s ≤ n) :
    RightMoves (ofStateAux n s h) ≃ { t // t ∈ r s } := by induction n <;> 

Proof state:
case zero
S : Type u
inst✝ : State S
s : S
h : turnBound s ≤ Nat.zero
⊢ RightMoves (ofStateAux Nat.zero s h) ≃ { t // t ∈ r s }

Next tactic:
rfl
/-- The equivalence between `rightMoves` for a `PGame` constructed using `ofStateAux _ s _`, and
`R s`. -/
def rightMovesOfStateAux (n : ℕ) {s : S} (h : turnBound s ≤ n) :
    RightMoves (ofStateAux n s h) ≃ { t // t ∈ r s } := by induction n <;> 

Proof state:
case succ
S : Type u
inst✝ : State S
s : S
n✝ : ℕ
n_ih✝ : (h : turnBound s ≤ n✝) → RightMoves (ofStateAux n✝ s h) ≃ { t // t ∈ r s }
h : turnBound s ≤ Nat.succ n✝
⊢ RightMoves (ofStateAux (Nat.succ n✝) s h) ≃ { t // t ∈ r s }

Next tactic:
rfl
/-- The relabelling showing `moveLeft` applied to a game constructed using `ofStateAux`
has itself been constructed using `ofStateAux`.
-/
def relabellingMoveLeftAux (n : ℕ) {s : S} (h : turnBound s ≤ n)
    (t : LeftMoves (ofStateAux n s h)) :
    Relabelling (moveLeft (ofStateAux n s h) t)
      (ofStateAux (n - 1) ((leftMovesOfStateAux n h) t : S)
        (turnBound_of_left ((leftMovesOfStateAux n h) t).2 (n - 1)
          (Nat.le_trans h le_tsub_add))) := by
  

Proof state:
S : Type u
inst✝ : State S
n : ℕ
s : S
h : turnBound s ≤ n
t : LeftMoves (ofStateAux n s h)
⊢ moveLeft (ofStateAux n s h) t ≡r
    ofStateAux (n - 1) ↑((leftMovesOfStateAux n h) t) (_ : turnBound ↑((leftMovesOfStateAux n h) t) ≤ n - 1)

Next tactic:
induction n
/-- The relabelling showing `moveLeft` applied to a game constructed using `ofStateAux`
has itself been constructed using `ofStateAux`.
-/
def relabellingMoveLeftAux (n : ℕ) {s : S} (h : turnBound s ≤ n)
    (t : LeftMoves (ofStateAux n s h)) :
    Relabelling (moveLeft (ofStateAux n s h) t)
      (ofStateAux (n - 1) ((leftMovesOfStateAux n h) t : S)
        (turnBound_of_left ((leftMovesOfStateAux n h) t).2 (n - 1)
          (Nat.le_trans h le_tsub_add))) := by
  induction n
  · 

Proof state:
case zero
S : Type u
inst✝ : State S
s : S
h : turnBound s ≤ Nat.zero
t : LeftMoves (ofStateAux Nat.zero s h)
⊢ moveLeft (ofStateAux Nat.zero s h) t ≡r
    ofStateAux (Nat.zero - 1) ↑((leftMovesOfStateAux Nat.zero h) t)
      (_ : turnBound ↑((leftMovesOfStateAux Nat.zero h) t) ≤ Nat.zero - 1)

Next tactic:
have t' := (leftMovesOfStateAux 0 h) t
/-- The relabelling showing `moveLeft` applied to a game constructed using `ofStateAux`
has itself been constructed using `ofStateAux`.
-/
def relabellingMoveLeftAux (n : ℕ) {s : S} (h : turnBound s ≤ n)
    (t : LeftMoves (ofStateAux n s h)) :
    Relabelling (moveLeft (ofStateAux n s h) t)
      (ofStateAux (n - 1) ((leftMovesOfStateAux n h) t : S)
        (turnBound_of_left ((leftMovesOfStateAux n h) t).2 (n - 1)
          (Nat.le_trans h le_tsub_add))) := by
  induction n
  · have t' := (leftMovesOfStateAux 0 h) t
    

Proof state:
case zero
S : Type u
inst✝ : State S
s : S
h : turnBound s ≤ Nat.zero
t : LeftMoves (ofStateAux Nat.zero s h)
t' : { t // t ∈ l s }
⊢ moveLeft (ofStateAux Nat.zero s h) t ≡r
    ofStateAux (Nat.zero - 1) ↑((leftMovesOfStateAux Nat.zero h) t)
      (_ : turnBound ↑((leftMovesOfStateAux Nat.zero h) t) ≤ Nat.zero - 1)

Next tactic:
exfalso
/-- The relabelling showing `moveLeft` applied to a game constructed using `ofStateAux`
has itself been constructed using `ofStateAux`.
-/
def relabellingMoveLeftAux (n : ℕ) {s : S} (h : turnBound s ≤ n)
    (t : LeftMoves (ofStateAux n s h)) :
    Relabelling (moveLeft (ofStateAux n s h) t)
      (ofStateAux (n - 1) ((leftMovesOfStateAux n h) t : S)
        (turnBound_of_left ((leftMovesOfStateAux n h) t).2 (n - 1)
          (Nat.le_trans h le_tsub_add))) := by
  induction n
  · have t' := (leftMovesOfStateAux 0 h) t
    exfalso; 

Proof state:
case zero.h
S : Type u
inst✝ : State S
s : S
h : turnBound s ≤ Nat.zero
t : LeftMoves (ofStateAux Nat.zero s h)
t' : { t // t ∈ l s }
⊢ False

Next tactic:
exact turnBound_ne_zero_of_left_move t'.2 (nonpos_iff_eq_zero.mp h)
/-- The relabelling showing `moveLeft` applied to a game constructed using `ofStateAux`
has itself been constructed using `ofStateAux`.
-/
def relabellingMoveLeftAux (n : ℕ) {s : S} (h : turnBound s ≤ n)
    (t : LeftMoves (ofStateAux n s h)) :
    Relabelling (moveLeft (ofStateAux n s h) t)
      (ofStateAux (n - 1) ((leftMovesOfStateAux n h) t : S)
        (turnBound_of_left ((leftMovesOfStateAux n h) t).2 (n - 1)
          (Nat.le_trans h le_tsub_add))) := by
  induction n
  · have t' := (leftMovesOfStateAux 0 h) t
    exfalso; exact turnBound_ne_zero_of_left_move t'.2 (nonpos_iff_eq_zero.mp h)
  · 

Proof state:
case succ
S : Type u
inst✝ : State S
s : S
n✝ : ℕ
n_ih✝ :
  (h : turnBound s ≤ n✝) →
    (t : LeftMoves (ofStateAux n✝ s h)) →
      moveLeft (ofStateAux n✝ s h) t ≡r
        ofStateAux (n✝ - 1) ↑((leftMovesOfStateAux n✝ h) t) (_ : turnBound ↑((leftMovesOfStateAux n✝ h) t) ≤ n✝ - 1)
h : turnBound s ≤ Nat.succ n✝
t : LeftMoves (ofStateAux (Nat.succ n✝) s h)
⊢ moveLeft (ofStateAux (Nat.succ n✝) s h) t ≡r
    ofStateAux (Nat.succ n✝ - 1) ↑((leftMovesOfStateAux (Nat.succ n✝) h) t)
      (_ : turnBound ↑((leftMovesOfStateAux (Nat.succ n✝) h) t) ≤ Nat.succ n✝ - 1)

Next tactic:
rfl
/-- The relabelling showing `moveLeft` applied to a game constructed using `of`
has itself been constructed using `of`.
-/
def relabellingMoveLeft (s : S) (t : LeftMoves (ofState s)) :
    Relabelling (moveLeft (ofState s) t) (ofState ((leftMovesOfState s).toFun t : S)) := by
  

Proof state:
S : Type u
inst✝ : State S
s : S
t : LeftMoves (ofState s)
⊢ moveLeft (ofState s) t ≡r ofState ↑(Equiv.toFun (leftMovesOfState s) t)

Next tactic:
trans
/-- The relabelling showing `moveLeft` applied to a game constructed using `of`
has itself been constructed using `of`.
-/
def relabellingMoveLeft (s : S) (t : LeftMoves (ofState s)) :
    Relabelling (moveLeft (ofState s) t) (ofState ((leftMovesOfState s).toFun t : S)) := by
  trans
  

Proof state:
S : Type u
inst✝ : State S
s : S
t : LeftMoves (ofState s)
⊢ moveLeft (ofState s) t ≡r ?m.9338
S : Type u
inst✝ : State S
s : S
t : LeftMoves (ofState s)
⊢ ?m.9338 ≡r ofState ↑(Equiv.toFun (leftMovesOfState s) t)
S : Type u inst✝ : State S s : S t : LeftMoves (ofState s) ⊢ PGame

Next tactic:
apply relabellingMoveLeftAux
/-- The relabelling showing `moveLeft` applied to a game constructed using `of`
has itself been constructed using `of`.
-/
def relabellingMoveLeft (s : S) (t : LeftMoves (ofState s)) :
    Relabelling (moveLeft (ofState s) t) (ofState ((leftMovesOfState s).toFun t : S)) := by
  trans
  apply relabellingMoveLeftAux
  

Proof state:
S : Type u
inst✝ : State S
s : S
t : LeftMoves (ofState s)
⊢ ofStateAux (turnBound s - 1) ↑((leftMovesOfStateAux (turnBound s) (_ : turnBound s ≤ turnBound s)) t)
      (_ : turnBound ↑((leftMovesOfStateAux (turnBound s) (_ : turnBound s ≤ turnBound s)) t) ≤ turnBound s - 1) ≡r
    ofState ↑(Equiv.toFun (leftMovesOfState s) t)

Next tactic:
apply ofStateAuxRelabelling
/-- The relabelling showing `moveRight` applied to a game constructed using `ofStateAux`
has itself been constructed using `ofStateAux`.
-/
def relabellingMoveRightAux (n : ℕ) {s : S} (h : turnBound s ≤ n)
    (t : RightMoves (ofStateAux n s h)) :
    Relabelling (moveRight (ofStateAux n s h) t)
      (ofStateAux (n - 1) ((rightMovesOfStateAux n h) t : S)
        (turnBound_of_right ((rightMovesOfStateAux n h) t).2 (n - 1)
          (Nat.le_trans h le_tsub_add))) := by
  

Proof state:
S : Type u
inst✝ : State S
n : ℕ
s : S
h : turnBound s ≤ n
t : RightMoves (ofStateAux n s h)
⊢ moveRight (ofStateAux n s h) t ≡r
    ofStateAux (n - 1) ↑((rightMovesOfStateAux n h) t) (_ : turnBound ↑((rightMovesOfStateAux n h) t) ≤ n - 1)

Next tactic:
induction n
/-- The relabelling showing `moveRight` applied to a game constructed using `ofStateAux`
has itself been constructed using `ofStateAux`.
-/
def relabellingMoveRightAux (n : ℕ) {s : S} (h : turnBound s ≤ n)
    (t : RightMoves (ofStateAux n s h)) :
    Relabelling (moveRight (ofStateAux n s h) t)
      (ofStateAux (n - 1) ((rightMovesOfStateAux n h) t : S)
        (turnBound_of_right ((rightMovesOfStateAux n h) t).2 (n - 1)
          (Nat.le_trans h le_tsub_add))) := by
  induction n
  · 

Proof state:
case zero
S : Type u
inst✝ : State S
s : S
h : turnBound s ≤ Nat.zero
t : RightMoves (ofStateAux Nat.zero s h)
⊢ moveRight (ofStateAux Nat.zero s h) t ≡r
    ofStateAux (Nat.zero - 1) ↑((rightMovesOfStateAux Nat.zero h) t)
      (_ : turnBound ↑((rightMovesOfStateAux Nat.zero h) t) ≤ Nat.zero - 1)

Next tactic:
have t' := (rightMovesOfStateAux 0 h) t
/-- The relabelling showing `moveRight` applied to a game constructed using `ofStateAux`
has itself been constructed using `ofStateAux`.
-/
def relabellingMoveRightAux (n : ℕ) {s : S} (h : turnBound s ≤ n)
    (t : RightMoves (ofStateAux n s h)) :
    Relabelling (moveRight (ofStateAux n s h) t)
      (ofStateAux (n - 1) ((rightMovesOfStateAux n h) t : S)
        (turnBound_of_right ((rightMovesOfStateAux n h) t).2 (n - 1)
          (Nat.le_trans h le_tsub_add))) := by
  induction n
  · have t' := (rightMovesOfStateAux 0 h) t
    

Proof state:
case zero
S : Type u
inst✝ : State S
s : S
h : turnBound s ≤ Nat.zero
t : RightMoves (ofStateAux Nat.zero s h)
t' : { t // t ∈ r s }
⊢ moveRight (ofStateAux Nat.zero s h) t ≡r
    ofStateAux (Nat.zero - 1) ↑((rightMovesOfStateAux Nat.zero h) t)
      (_ : turnBound ↑((rightMovesOfStateAux Nat.zero h) t) ≤ Nat.zero - 1)

Next tactic:
exfalso
/-- The relabelling showing `moveRight` applied to a game constructed using `ofStateAux`
has itself been constructed using `ofStateAux`.
-/
def relabellingMoveRightAux (n : ℕ) {s : S} (h : turnBound s ≤ n)
    (t : RightMoves (ofStateAux n s h)) :
    Relabelling (moveRight (ofStateAux n s h) t)
      (ofStateAux (n - 1) ((rightMovesOfStateAux n h) t : S)
        (turnBound_of_right ((rightMovesOfStateAux n h) t).2 (n - 1)
          (Nat.le_trans h le_tsub_add))) := by
  induction n
  · have t' := (rightMovesOfStateAux 0 h) t
    exfalso; 

Proof state:
case zero.h
S : Type u
inst✝ : State S
s : S
h : turnBound s ≤ Nat.zero
t : RightMoves (ofStateAux Nat.zero s h)
t' : { t // t ∈ r s }
⊢ False

Next tactic:
exact turnBound_ne_zero_of_right_move t'.2 (nonpos_iff_eq_zero.mp h)
/-- The relabelling showing `moveRight` applied to a game constructed using `ofStateAux`
has itself been constructed using `ofStateAux`.
-/
def relabellingMoveRightAux (n : ℕ) {s : S} (h : turnBound s ≤ n)
    (t : RightMoves (ofStateAux n s h)) :
    Relabelling (moveRight (ofStateAux n s h) t)
      (ofStateAux (n - 1) ((rightMovesOfStateAux n h) t : S)
        (turnBound_of_right ((rightMovesOfStateAux n h) t).2 (n - 1)
          (Nat.le_trans h le_tsub_add))) := by
  induction n
  · have t' := (rightMovesOfStateAux 0 h) t
    exfalso; exact turnBound_ne_zero_of_right_move t'.2 (nonpos_iff_eq_zero.mp h)
  · 

Proof state:
case succ
S : Type u
inst✝ : State S
s : S
n✝ : ℕ
n_ih✝ :
  (h : turnBound s ≤ n✝) →
    (t : RightMoves (ofStateAux n✝ s h)) →
      moveRight (ofStateAux n✝ s h) t ≡r
        ofStateAux (n✝ - 1) ↑((rightMovesOfStateAux n✝ h) t) (_ : turnBound ↑((rightMovesOfStateAux n✝ h) t) ≤ n✝ - 1)
h : turnBound s ≤ Nat.succ n✝
t : RightMoves (ofStateAux (Nat.succ n✝) s h)
⊢ moveRight (ofStateAux (Nat.succ n✝) s h) t ≡r
    ofStateAux (Nat.succ n✝ - 1) ↑((rightMovesOfStateAux (Nat.succ n✝) h) t)
      (_ : turnBound ↑((rightMovesOfStateAux (Nat.succ n✝) h) t) ≤ Nat.succ n✝ - 1)

Next tactic:
rfl
/-- The relabelling showing `moveRight` applied to a game constructed using `of`
has itself been constructed using `of`.
-/
def relabellingMoveRight (s : S) (t : RightMoves (ofState s)) :
    Relabelling (moveRight (ofState s) t) (ofState ((rightMovesOfState s).toFun t : S)) := by
  

Proof state:
S : Type u
inst✝ : State S
s : S
t : RightMoves (ofState s)
⊢ moveRight (ofState s) t ≡r ofState ↑(Equiv.toFun (rightMovesOfState s) t)

Next tactic:
trans
/-- The relabelling showing `moveRight` applied to a game constructed using `of`
has itself been constructed using `of`.
-/
def relabellingMoveRight (s : S) (t : RightMoves (ofState s)) :
    Relabelling (moveRight (ofState s) t) (ofState ((rightMovesOfState s).toFun t : S)) := by
  trans
  

Proof state:
S : Type u
inst✝ : State S
s : S
t : RightMoves (ofState s)
⊢ moveRight (ofState s) t ≡r ?m.11218
S : Type u
inst✝ : State S
s : S
t : RightMoves (ofState s)
⊢ ?m.11218 ≡r ofState ↑(Equiv.toFun (rightMovesOfState s) t)
S : Type u inst✝ : State S s : S t : RightMoves (ofState s) ⊢ PGame

Next tactic:
apply relabellingMoveRightAux
/-- The relabelling showing `moveRight` applied to a game constructed using `of`
has itself been constructed using `of`.
-/
def relabellingMoveRight (s : S) (t : RightMoves (ofState s)) :
    Relabelling (moveRight (ofState s) t) (ofState ((rightMovesOfState s).toFun t : S)) := by
  trans
  apply relabellingMoveRightAux
  

Proof state:
S : Type u
inst✝ : State S
s : S
t : RightMoves (ofState s)
⊢ ofStateAux (turnBound s - 1) ↑((rightMovesOfStateAux (turnBound s) (_ : turnBound s ≤ turnBound s)) t)
      (_ : turnBound ↑((rightMovesOfStateAux (turnBound s) (_ : turnBound s ≤ turnBound s)) t) ≤ turnBound s - 1) ≡r
    ofState ↑(Equiv.toFun (rightMovesOfState s) t)

Next tactic:
apply ofStateAuxRelabelling
instance fintypeLeftMovesOfStateAux (n : ℕ) (s : S) (h : turnBound s ≤ n) :
    Fintype (LeftMoves (ofStateAux n s h)) := by
  

Proof state:
S : Type u
inst✝ : State S
n : ℕ
s : S
h : turnBound s ≤ n
⊢ Fintype (LeftMoves (ofStateAux n s h))

Next tactic:
apply Fintype.ofEquiv _ (leftMovesOfStateAux _ _).symm
instance fintypeRightMovesOfStateAux (n : ℕ) (s : S) (h : turnBound s ≤ n) :
    Fintype (RightMoves (ofStateAux n s h)) := by
  

Proof state:
S : Type u
inst✝ : State S
n : ℕ
s : S
h : turnBound s ≤ n
⊢ Fintype (RightMoves (ofStateAux n s h))

Next tactic:
apply Fintype.ofEquiv _ (rightMovesOfStateAux _ _).symm
instance shortOfStateAux : ∀ (n : ℕ) {s : S} (h : turnBound s ≤ n), Short (ofStateAux n s h)
  | 0, s, h =>
    Short.mk'
      (fun i => by
        

Proof state:
S : Type u
inst✝ : State S
s : S
h : turnBound s ≤ 0
i : LeftMoves (ofStateAux 0 s h)
⊢ Short (moveLeft (ofStateAux 0 s h) i)

Next tactic:
have i := (leftMovesOfStateAux _ _).toFun i
instance shortOfStateAux : ∀ (n : ℕ) {s : S} (h : turnBound s ≤ n), Short (ofStateAux n s h)
  | 0, s, h =>
    Short.mk'
      (fun i => by
        have i := (leftMovesOfStateAux _ _).toFun i
        

Proof state:
S : Type u
inst✝ : State S
s : S
h : turnBound s ≤ 0
i✝ : LeftMoves (ofStateAux 0 s h)
i : { t // t ∈ l s }
⊢ Short (moveLeft (ofStateAux 0 s h) i✝)

Next tactic:
exfalso
instance shortOfStateAux : ∀ (n : ℕ) {s : S} (h : turnBound s ≤ n), Short (ofStateAux n s h)
  | 0, s, h =>
    Short.mk'
      (fun i => by
        have i := (leftMovesOfStateAux _ _).toFun i
        exfalso
        

Proof state:
case h
S : Type u
inst✝ : State S
s : S
h : turnBound s ≤ 0
i✝ : LeftMoves (ofStateAux 0 s h)
i : { t // t ∈ l s }
⊢ False

Next tactic:
exact turnBound_ne_zero_of_left_move i.2 (nonpos_iff_eq_zero.mp h)
instance shortOfStateAux : ∀ (n : ℕ) {s : S} (h : turnBound s ≤ n), Short (ofStateAux n s h)
  | 0, s, h =>
    Short.mk'
      (fun i => by
        have i := (leftMovesOfStateAux _ _).toFun i
        exfalso
        exact turnBound_ne_zero_of_left_move i.2 (nonpos_iff_eq_zero.mp h))
      fun j => by
      

Proof state:
S : Type u
inst✝ : State S
s : S
h : turnBound s ≤ 0
j : RightMoves (ofStateAux 0 s h)
⊢ Short (moveRight (ofStateAux 0 s h) j)

Next tactic:
have j := (rightMovesOfStateAux _ _).toFun j
instance shortOfStateAux : ∀ (n : ℕ) {s : S} (h : turnBound s ≤ n), Short (ofStateAux n s h)
  | 0, s, h =>
    Short.mk'
      (fun i => by
        have i := (leftMovesOfStateAux _ _).toFun i
        exfalso
        exact turnBound_ne_zero_of_left_move i.2 (nonpos_iff_eq_zero.mp h))
      fun j => by
      have j := (rightMovesOfStateAux _ _).toFun j
      

Proof state:
S : Type u
inst✝ : State S
s : S
h : turnBound s ≤ 0
j✝ : RightMoves (ofStateAux 0 s h)
j : { t // t ∈ r s }
⊢ Short (moveRight (ofStateAux 0 s h) j✝)

Next tactic:
exfalso
instance shortOfStateAux : ∀ (n : ℕ) {s : S} (h : turnBound s ≤ n), Short (ofStateAux n s h)
  | 0, s, h =>
    Short.mk'
      (fun i => by
        have i := (leftMovesOfStateAux _ _).toFun i
        exfalso
        exact turnBound_ne_zero_of_left_move i.2 (nonpos_iff_eq_zero.mp h))
      fun j => by
      have j := (rightMovesOfStateAux _ _).toFun j
      exfalso
      

Proof state:
case h
S : Type u
inst✝ : State S
s : S
h : turnBound s ≤ 0
j✝ : RightMoves (ofStateAux 0 s h)
j : { t // t ∈ r s }
⊢ False

Next tactic:
exact turnBound_ne_zero_of_right_move j.2 (nonpos_iff_eq_zero.mp h)
instance shortOfState (s : S) : Short (ofState s) := by
  

Proof state:
S : Type u
inst✝ : State S
s : S
⊢ Short (ofState s)

Next tactic:
dsimp [PGame.ofState]
instance shortOfState (s : S) : Short (ofState s) := by
  dsimp [PGame.ofState]
  

Proof state:
S : Type u
inst✝ : State S
s : S
⊢ Short (ofStateAux (turnBound s) s (_ : turnBound s ≤ turnBound s))

Next tactic:
infer_instance
protected theorem id : Nat.Primrec id :=
  (left.pair right).of_eq fun n => by 

Proof state:
n : ℕ
⊢ Nat.pair (unpair n).1 (unpair n).2 = id n

Next tactic:
simp
theorem prec1 {f} (m : ℕ) (hf : Nat.Primrec f) :
    Nat.Primrec fun n => n.rec m fun y IH => f <| Nat.pair y IH :=
  ((prec (const m) (hf.comp right)).comp (zero.pair Primrec.id)).of_eq fun n => by 

Proof state:
f : ℕ → ℕ
m : ℕ
hf : Nat.Primrec f
n : ℕ
⊢ unpaired (fun z n => Nat.rec m (fun y IH => f (unpair (Nat.pair z (Nat.pair y IH))).2) n) (Nat.pair 0 (id n)) =
    Nat.rec m (fun y IH => f (Nat.pair y IH)) n

Next tactic:
simp
theorem casesOn1 {f} (m : ℕ) (hf : Nat.Primrec f) : Nat.Primrec (Nat.casesOn · m f) :=
  (prec1 m (hf.comp left)).of_eq <| by 

Proof state:
f : ℕ → ℕ
m : ℕ
hf : Nat.Primrec f
⊢ ∀ (n : ℕ), Nat.rec m (fun y IH => f (unpair (Nat.pair y IH)).1) n = Nat.casesOn n m f

Next tactic:
simp
theorem casesOn' {f g} (hf : Nat.Primrec f) (hg : Nat.Primrec g) :
    Nat.Primrec (unpaired fun z n => n.casesOn (f z) fun y => g <| Nat.pair z y) :=
  (prec hf (hg.comp (pair left (left.comp right)))).of_eq <| fun n => by 

Proof state:
f g : ℕ → ℕ
hf : Nat.Primrec f
hg : Nat.Primrec g
n : ℕ
⊢ unpaired
      (fun z n =>
        Nat.rec (f z)
          (fun y IH =>
            g (Nat.pair (unpair (Nat.pair z (Nat.pair y IH))).1 (unpair (unpair (Nat.pair z (Nat.pair y IH))).2).1))
          n)
      n =
    unpaired (fun z n => Nat.casesOn n (f z) fun y => g (Nat.pair z y)) n

Next tactic:
simp
protected theorem swap : Nat.Primrec (unpaired (swap Nat.pair)) :=
  (pair right left).of_eq fun n => by 

Proof state:
n : ℕ
⊢ Nat.pair (unpair n).2 (unpair n).1 = unpaired (swap Nat.pair) n

Next tactic:
simp
theorem swap' {f} (hf : Nat.Primrec (unpaired f)) : Nat.Primrec (unpaired (swap f)) :=
  (hf.comp .swap).of_eq fun n => by 

Proof state:
f : ℕ → ℕ → ℕ
hf : Nat.Primrec (unpaired f)
n : ℕ
⊢ unpaired f (unpaired (swap Nat.pair) n) = unpaired (swap f) n

Next tactic:
simp
theorem pred : Nat.Primrec pred :=
  (casesOn1 0 Primrec.id).of_eq fun n => by 

Proof state:
n : ℕ
⊢ Nat.casesOn n 0 id = Nat.pred n

Next tactic:
cases n
theorem pred : Nat.Primrec pred :=
  (casesOn1 0 Primrec.id).of_eq fun n => by cases n <;> 

Proof state:
case zero
⊢ Nat.casesOn Nat.zero 0 id = Nat.pred Nat.zero

Next tactic:
simp [*]
theorem pred : Nat.Primrec pred :=
  (casesOn1 0 Primrec.id).of_eq fun n => by cases n <;> 

Proof state:
case succ
n✝ : ℕ
⊢ Nat.casesOn (succ n✝) 0 id = Nat.pred (succ n✝)

Next tactic:
simp [*]
theorem add : Nat.Primrec (unpaired (· + ·)) :=
  (prec .id ((Primrec.succ.comp right).comp right)).of_eq fun p => by
    

Proof state:
p : ℕ
⊢ unpaired (fun z n => Nat.rec (id z) (fun y IH => succ (unpair (unpair (Nat.pair z (Nat.pair y IH))).2).2) n) p =
    unpaired (fun x x_1 => x + x_1) p

Next tactic:
simp
theorem add : Nat.Primrec (unpaired (· + ·)) :=
  (prec .id ((Primrec.succ.comp right).comp right)).of_eq fun p => by
    simp; 

Proof state:
p : ℕ
⊢ Nat.rec (unpair p).1 (fun y IH => succ IH) (unpair p).2 = (unpair p).1 + (unpair p).2

Next tactic:
induction p.unpair.2
theorem add : Nat.Primrec (unpaired (· + ·)) :=
  (prec .id ((Primrec.succ.comp right).comp right)).of_eq fun p => by
    simp; induction p.unpair.2 <;> 

Proof state:
case zero
p : ℕ
⊢ Nat.rec (unpair p).1 (fun y IH => succ IH) Nat.zero = (unpair p).1 + Nat.zero

Next tactic:
simp [*, add_succ]
theorem add : Nat.Primrec (unpaired (· + ·)) :=
  (prec .id ((Primrec.succ.comp right).comp right)).of_eq fun p => by
    simp; induction p.unpair.2 <;> 

Proof state:
case succ
p n✝ : ℕ
n_ih✝ : Nat.rec (unpair p).1 (fun y IH => succ IH) n✝ = (unpair p).1 + n✝
⊢ Nat.rec (unpair p).1 (fun y IH => succ IH) (succ n✝) = (unpair p).1 + succ n✝

Next tactic:
simp [*, add_succ]
theorem sub : Nat.Primrec (unpaired (· - ·)) :=
  (prec .id ((pred.comp right).comp right)).of_eq fun p => by
    

Proof state:
p : ℕ
⊢ unpaired (fun z n => Nat.rec (id z) (fun y IH => Nat.pred (unpair (unpair (Nat.pair z (Nat.pair y IH))).2).2) n) p =
    unpaired (fun x x_1 => x - x_1) p

Next tactic:
simp
theorem sub : Nat.Primrec (unpaired (· - ·)) :=
  (prec .id ((pred.comp right).comp right)).of_eq fun p => by
    simp; 

Proof state:
p : ℕ
⊢ Nat.rec (unpair p).1 (fun y IH => Nat.pred IH) (unpair p).2 = (unpair p).1 - (unpair p).2

Next tactic:
induction p.unpair.2
theorem sub : Nat.Primrec (unpaired (· - ·)) :=
  (prec .id ((pred.comp right).comp right)).of_eq fun p => by
    simp; induction p.unpair.2 <;> 

Proof state:
case zero
p : ℕ
⊢ Nat.rec (unpair p).1 (fun y IH => Nat.pred IH) Nat.zero = (unpair p).1 - Nat.zero

Next tactic:
simp [*, sub_succ]
theorem sub : Nat.Primrec (unpaired (· - ·)) :=
  (prec .id ((pred.comp right).comp right)).of_eq fun p => by
    simp; induction p.unpair.2 <;> 

Proof state:
case succ
p n✝ : ℕ
n_ih✝ : Nat.rec (unpair p).1 (fun y IH => Nat.pred IH) n✝ = (unpair p).1 - n✝
⊢ Nat.rec (unpair p).1 (fun y IH => Nat.pred IH) (succ n✝) = (unpair p).1 - succ n✝

Next tactic:
simp [*, sub_succ]
theorem mul : Nat.Primrec (unpaired (· * ·)) :=
  (prec zero (add.comp (pair left (right.comp right)))).of_eq fun p => by
    

Proof state:
p : ℕ
⊢ unpaired
      (fun z n =>
        Nat.rec 0
          (fun y IH =>
            unpaired (fun x x_1 => x + x_1)
              (Nat.pair (unpair (Nat.pair z (Nat.pair y IH))).1 (unpair (unpair (Nat.pair z (Nat.pair y IH))).2).2))
          n)
      p =
    unpaired (fun x x_1 => x * x_1) p

Next tactic:
simp