@@ -26,6 +26,7 @@ open function pgame
26
26
universes u
27
27
28
28
local infix ` ≈ ` := pgame.equiv
29
+ local infix ` ⧏ `:50 := pgame.lf
29
30
local infix ` ≡r `:50 := pgame.relabelling
30
31
31
32
instance pgame.setoid : setoid pgame :=
@@ -501,8 +502,15 @@ inductive inv_ty (l r : Type u) : bool → Type u
501
502
| right₁ : l → inv_ty ff → inv_ty tt
502
503
| right₂ : r → inv_ty tt → inv_ty tt
503
504
505
+ instance (l r : Type u) [is_empty l] [is_empty r] : is_empty (inv_ty l r tt) :=
506
+ ⟨by rintro (_|_|_|a|a); exact is_empty_elim a⟩
507
+
504
508
instance (l r : Type u) : inhabited (inv_ty l r ff) := ⟨inv_ty.zero⟩
505
509
510
+ instance unique_inv_ty (l r : Type u) [is_empty l] [is_empty r] : unique (inv_ty l r ff) :=
511
+ { uniq := by { rintro (a|a|a), refl, all_goals { exact is_empty_elim a } },
512
+ ..inv_ty.inhabited l r }
513
+
506
514
/-- Because the two halves of the definition of `inv` produce more elements
507
515
of each side, we have to define the two families inductively.
508
516
This is the function part, defined by recursion on `inv_ty`. -/
@@ -514,6 +522,14 @@ def inv_val {l r} (L : l → pgame) (R : r → pgame)
514
522
| _ (inv_ty.right₁ i j) := (1 + (L i - mk l r L R) * inv_val j) * IHl i
515
523
| _ (inv_ty.right₂ i j) := (1 + (R i - mk l r L R) * inv_val j) * IHr i
516
524
525
+ @[simp] theorem inv_val_is_empty {l r : Type u} {b} (L R IHl IHr) (i : inv_ty l r b)
526
+ [is_empty l] [is_empty r] : inv_val L R IHl IHr i = 0 :=
527
+ begin
528
+ cases i with a _ a _ a _ a,
529
+ { refl },
530
+ all_goals { exact is_empty_elim a }
531
+ end
532
+
517
533
/-- The inverse of a positive surreal number `x = {L | R}` is
518
534
given by `x⁻¹ = {0,
519
535
(1 + (R - x) * x⁻¹L) * R, (1 + (L - x) * x⁻¹R) * L |
@@ -529,10 +545,56 @@ def inv' : pgame → pgame
529
545
⟨inv_ty l' r ff, inv_ty l' r tt,
530
546
inv_val L' R IHl' IHr, inv_val L' R IHl' IHr⟩
531
547
532
- /-- The inverse of a surreal number in terms of the inverse on positive surreals. -/
548
+ theorem zero_lf_inv' : ∀ (x : pgame), 0 ⧏ inv' x
549
+ | ⟨xl, xr, xL, xR⟩ := by { convert lf_mk _ _ inv_ty.zero, refl }
550
+
551
+ /-- `inv' 0` has exactly the same moves as `1`. -/
552
+ def inv'_zero : inv' 0 ≡r 1 :=
553
+ begin
554
+ change mk _ _ _ _ ≡r 1 ,
555
+ refine ⟨_, _, λ i, _, is_empty_elim⟩; dsimp,
556
+ { apply equiv.equiv_punit },
557
+ { apply equiv.equiv_pempty },
558
+ { simp }
559
+ end
560
+
561
+ theorem inv'_zero_equiv : inv' 0 ≈ 1 := inv'_zero.equiv
562
+
563
+ /-- `inv' 1` has exactly the same moves as `1`. -/
564
+ def inv'_one : inv' 1 ≡r (1 : pgame.{u}) :=
565
+ begin
566
+ change relabelling (mk _ _ _ _) 1 ,
567
+ haveI : is_empty {i : punit.{u+1 } // (0 : pgame.{u}) < 0 },
568
+ { rw lt_self_iff_false, apply_instance },
569
+ refine ⟨_, _, λ i, _, is_empty_elim⟩; dsimp,
570
+ { apply equiv.equiv_punit },
571
+ { apply equiv.equiv_pempty },
572
+ { simp }
573
+ end
574
+
575
+ theorem inv'_one_equiv : inv' 1 ≈ 1 := inv'_one.equiv
576
+
577
+ /-- The inverse of a pre-game in terms of the inverse on positive pre-games. -/
533
578
noncomputable instance : has_inv pgame :=
534
- ⟨by { classical, exact λ x, if x = 0 then 0 else if 0 < x then inv' x else inv' (-x) }⟩
579
+ ⟨by { classical, exact λ x, if x ≈ 0 then 0 else if 0 < x then inv' x else - inv' (-x) }⟩
535
580
536
581
noncomputable instance : has_div pgame := ⟨λ x y, x * y⁻¹⟩
537
582
583
+ theorem inv_eq_of_equiv_zero {x : pgame} (h : x ≈ 0 ) : x⁻¹ = 0 := if_pos h
584
+
585
+ @[simp] theorem inv_zero : (0 : pgame)⁻¹ = 0 :=
586
+ inv_eq_of_equiv_zero (equiv_refl _)
587
+
588
+ theorem inv_eq_of_pos {x : pgame} (h : 0 < x) : x⁻¹ = inv' x :=
589
+ (if_neg h.lf.not_equiv').trans (if_pos h)
590
+
591
+ theorem inv_eq_of_lf_zero {x : pgame} (h : x ⧏ 0 ) : x⁻¹ = -inv' (-x) :=
592
+ (if_neg h.not_equiv).trans (if_neg h.not_gt)
593
+
594
+ /-- `1⁻¹` has exactly the same moves as `1`. -/
595
+ def inv_one : 1 ⁻¹ ≡r 1 :=
596
+ by { rw inv_eq_of_pos zero_lt_one, exact inv'_one }
597
+
598
+ theorem inv_one_equiv : 1 ⁻¹ ≈ 1 := inv_one.equiv
599
+
538
600
end pgame
0 commit comments