Built with Alectryon, running Coq+SerAPI v8.19.0+0.19.3. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑Ctrl+↓ to navigate, Ctrl+🖱️ to focus. On Mac, use ⌘ instead of Ctrl.
[Loading ML file number_string_notation_plugin.cmxs (using legacy method) ... done]
Require Import HoTT.Spaces.No.Core HoTT.Spaces.No.Negation.LocalOpen Scope path_scope.LocalOpen Scope surreal_scope.(** * Addition of surreal numbers *)(** Addition requires the option sorts to be closed under finite sums. *)ClassHasAddition (S : OptionSort) :=
{ empty_options :: InSort S Empty Empty
; sum_options :: forallLRL'R',
InSort S L R -> InSort S L' R' -> InSort S (L + L') (R + R')
}.Instancehasaddition_maxsort : HasAddition MaxSort
:= { empty_options := tt ;
sum_options := fun______ => tt }.Instancehasaddition_ordsort : HasAddition OrdSort
:= { empty_options := idmap ;
sum_options := fun____fg => sum_ind _ f g }.
HasAddition DecSort
HasAddition DecSort
InSort DecSort Empty Empty
forallLRL'R' : Type,
InSort DecSort L R ->
InSort DecSort L' R' ->
InSort DecSort (L + L') (R + R')
InSort DecSort Empty Empty
exact insort_decsort.
forallLRL'R' : Type,
InSort DecSort L R ->
InSort DecSort L' R' ->
InSort DecSort (L + L') (R + R')
intros L R L' R' [? ?] [? ?]; split; exact _.Qed.SectionAddition.Context `{Univalence}.Universei.Context {S : OptionSort@{i}} `{HasAddition S}.LetNo := GenNo S.SectionInner.Context {LR : Type@{i} } {Sx : InSort S L R}
(xL : L -> No) (xR : R -> No)
(xcut : forall (l : L) (r : R), xL l < xR r).LetA := {g : No -> No &
(forallxy : No, x <= y -> g x <= g y) *
(forallxy : No, x < y -> g x < g y)}.Context (xL_plus : L -> A) (xR_plus : R -> A)
(xL_lt_xR_plus : forall (l : L) (r : R) (x : No),
(xL_plus l).1 x < (xR_plus r).1 x).
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type L, R: Type Sx: InSort S L R xL: L -> No xR: R -> No xcut: forall (l : L) (r : R), xL l < xR r A:= {g : No -> No &
(forallxy : No, x <= y -> g x <= g y) *
(forallxy : No, x < y -> g x < g y)}: Type xL_plus: L -> A xR_plus: R -> A xL_lt_xR_plus: forall (l : L) (r : R) (x : No),
(xL_plus l).1 x < (xR_plus r).1 x
{g
: forally : No,
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y < x_plus_y) *
(forallr : R, x_plus_y < (xR_plus r).1 y)} &
(forallyz : No, y <= z -> (g y).1 <= (g z).1) *
(forallyz : No, y < z -> (g y).1 < (g z).1)}
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type L, R: Type Sx: InSort S L R xL: L -> No xR: R -> No xcut: forall (l : L) (r : R), xL l < xR r A:= {g : No -> No &
(forallxy : No, x <= y -> g x <= g y) *
(forallxy : No, x < y -> g x < g y)}: Type xL_plus: L -> A xR_plus: R -> A xL_lt_xR_plus: forall (l : L) (r : R) (x : No),
(xL_plus l).1 x < (xR_plus r).1 x
{g
: forally : No,
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y < x_plus_y) *
(forallr : R, x_plus_y < (xR_plus r).1 y)} &
(forallyz : No, y <= z -> (g y).1 <= (g z).1) *
(forallyz : No, y < z -> (g y).1 < (g z).1)}
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type L, R: Type Sx: InSort S L R xL: L -> No xR: R -> No xcut: forall (l : L) (r : R), xL l < xR r A:= {g : No -> No &
(forallxy : No, x <= y -> g x <= g y) *
(forallxy : No, x < y -> g x < g y)}: Type xL_plus: L -> A xR_plus: R -> A xL_lt_xR_plus: forall (l : L) (r : R) (x : No),
(xL_plus l).1 x < (xR_plus r).1 x
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type L, R: Type Sx: InSort S L R xL: L -> No xR: R -> No xcut: forall (l : L) (r : R), xL l < xR r A:= {g : No -> No &
(forallxy : No, x <= y -> g x <= g y) *
(forallxy : No, x < y -> g x < g y)}: Type xL_plus: L -> A xR_plus: R -> A xL_lt_xR_plus: forall (l : L) (r : R) (x : No),
(xL_plus l).1 x < (xR_plus r).1 x
forall (xy : GenNo S)
(a : (funy0 : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y0 < x_plus_y) *
(forallr : R, x_plus_y < (xR_plus r).1 y0)}) x)
(b : (funy0 : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y0 < x_plus_y) *
(forallr : R, x_plus_y < (xR_plus r).1 y0)}) y)
(p : x <= y) (q : y <= x),
(fun (x0y0 : GenNo S) (_ : x0 <= y0)
(z : (funy1 : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y1 < x_plus_y) *
(forallr : R, x_plus_y < (xR_plus r).1 y1)})
x0)
(w : (funy1 : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y1 < x_plus_y) *
(forallr : R, x_plus_y < (xR_plus r).1 y1)})
y0) => z.1 <= w.1) x y p a b ->
(fun (x0y0 : GenNo S) (_ : x0 <= y0)
(z : (funy1 : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y1 < x_plus_y) *
(forallr : R, x_plus_y < (xR_plus r).1 y1)})
x0)
(w : (funy1 : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y1 < x_plus_y) *
(forallr : R, x_plus_y < (xR_plus r).1 y1)})
y0) => z.1 <= w.1) y x q b a ->
transport
(funy0 : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y0 < x_plus_y) *
(forallr : R, x_plus_y < (xR_plus r).1 y0)})
(path_No x y p q) a = b
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type L, R: Type Sx: InSort S L R xL: L -> No xR: R -> No xcut: forall (l : L) (r : R), xL l < xR r A:= {g : No -> No &
(forallxy : No, x <= y -> g x <= g y) *
(forallxy : No, x < y -> g x < g y)}: Type xL_plus: L -> A xR_plus: R -> A xL_lt_xR_plus: forall (l : L) (r : R) (x : No),
(xL_plus l).1 x < (xR_plus r).1 x
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type L, R: Type Sx: InSort S L R xL: L -> No xR: R -> No xcut: forall (l : L) (r : R), xL l < xR r A:= {g : No -> No &
(forallxy : No, x <= y -> g x <= g y) *
(forallxy : No, x < y -> g x < g y)}: Type xL_plus: L -> A xR_plus: R -> A xL_lt_xR_plus: forall (l : L) (r : R) (x : No),
(xL_plus l).1 x < (xR_plus r).1 x
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type L, R: Type Sx: InSort S L R xL: L -> No xR: R -> No xcut: forall (l : L) (r : R), xL l < xR r A:= {g : No -> No &
(forallxy : No, x <= y -> g x <= g y) *
(forallxy : No, x < y -> g x < g y)}: Type xL_plus: L -> A xR_plus: R -> A xL_lt_xR_plus: forall (l : L) (r : R) (x : No),
(xL_plus l).1 x < (xR_plus r).1 x
forall (L0R0 : Type) (s : InSort S L0 R0)
(xL0 : L0 -> GenNo S) (xR0 : R0 -> GenNo S)
(xcut0 : forall (l : L0) (r : R0), xL0 l < xR0 r)
(fxL : foralll : L0,
(funy : GenNo S =>
{x_plus_y : No &
(foralll0 : L, (xL_plus l0).1 y < x_plus_y) *
(forallr : R, x_plus_y < (xR_plus r).1 y)})
(xL0 l))
(fxR : forallr : R0,
(funy : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y < x_plus_y) *
(forallr0 : R, x_plus_y < (xR_plus r0).1 y)})
(xR0 r))
(fxcut : forall (l : L0)
(r : R0),
(fun (xy : GenNo S)
(_ : x < y)
(z : (funy0 : GenNo S =>
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y0 < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 y0)}) x)
(w : (funy0 : GenNo S =>
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y0 < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 y0)}) y)
=> z.1 < w.1) (xL0 l)
(xR0 r) (xcut0 l r)
(fxL l) (fxR r))
(L'R' : Type) (s' : InSort S L' R')
(yL : L' -> GenNo S) (yR : R' -> GenNo S)
(ycut : forall (l : L') (r : R'), yL l < yR r)
(fyL : foralll : L',
(funy : GenNo S =>
{x_plus_y : No &
(foralll0 : L, (xL_plus l0).1 y < x_plus_y) *
(forallr : R, x_plus_y < (xR_plus r).1 y)})
(yL l))
(fyR : forallr : R',
(funy : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y < x_plus_y) *
(forallr0 : R, x_plus_y < (xR_plus r0).1 y)})
(yR r))
(fycut : forall (l : L')
(r : R'),
(fun (xy : GenNo S)
(_ : x < y)
(z : (funy0 : GenNo S =>
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y0 < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 y0)}) x)
(w : (funy0 : GenNo S =>
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y0 < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 y0)}) y)
=> z.1 < w.1) (yL l)
(yR r) (ycut l r)
(fyL l) (fyR r))
(r : R0) (p : xR0 r <= {{ yL | yR//ycut }}),
(fun (xy : GenNo S) (_ : x <= y)
(z : (funy0 : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y0 < x_plus_y) *
(forallr0 : R, x_plus_y < (xR_plus r0).1 y0)})
x)
(w : (funy0 : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y0 < x_plus_y) *
(forallr0 : R, x_plus_y < (xR_plus r0).1 y0)})
y) => z.1 <= w.1)
(xR0 r) {{ yL | yR//ycut }} p
(fxR r) (?dcut L' R' s' yL yR ycut fyL fyR fycut) ->
(fun (xy : GenNo S) (_ : x < y)
(z : (funy0 : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y0 < x_plus_y) *
(forallr0 : R, x_plus_y < (xR_plus r0).1 y0)})
x)
(w : (funy0 : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y0 < x_plus_y) *
(forallr0 : R, x_plus_y < (xR_plus r0).1 y0)})
y) => z.1 < w.1) {{ xL0 | xR0//xcut0 }}
{{ yL | yR//ycut }}
(lt_r xL0 xR0 xcut0 yL yR ycut r p)
(?dcut L0 R0 s xL0 xR0 xcut0 fxL fxR fxcut)
(?dcut L' R' s' yL yR ycut fyL fyR fycut)
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type L, R: Type Sx: InSort S L R xL: L -> No xR: R -> No xcut: forall (l : L) (r : R), xL l < xR r A:= {g : No -> No &
(forallxy : No, x <= y -> g x <= g y) *
(forallxy : No, x < y -> g x < g y)}: Type xL_plus: L -> A xR_plus: R -> A xL_lt_xR_plus: forall (l : L) (r : R) (x : No),
(xL_plus l).1 x < (xR_plus r).1 x
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type L, R: Type Sx: InSort S L R xL: L -> No xR: R -> No xcut: forall (l : L) (r : R), xL l < xR r A:= {g : No -> No &
(forallxy : No, x <= y -> g x <= g y) *
(forallxy : No, x < y -> g x < g y)}: Type xL_plus: L -> A xR_plus: R -> A xL_lt_xR_plus: forall (l : L) (r : R) (x : No),
(xL_plus l).1 x < (xR_plus r).1 x L', R': Type s: InSort S L' R' yL: L' -> GenNo S yR: R' -> GenNo S ycut: forall (l : L') (r : R'), yL l < yR r x_plus_yL: foralll : L',
(funy : GenNo S =>
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y < x_plus_y) *
(forallr : R, x_plus_y < (xR_plus r).1 y)})
(yL l) x_plus_yR: forallr : R',
(funy : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 y)})
(yR r) x_plus_yL_lt_yR: forall (l : L') (r : R'),
(fun (xy : GenNo S) (_ : x < y)
(z : (funy0 : GenNo S =>
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y0 <
x_plus_y) *
(forallr0 : R,
x_plus_y <
(xR_plus r0).1 y0)}) x)
(w : (funy0 : GenNo S =>
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y0 <
x_plus_y) *
(forallr0 : R,
x_plus_y <
(xR_plus r0).1 y0)}) y) =>
z.1 < w.1) (yL l) (yR r)
(ycut l r) (x_plus_yL l)
(x_plus_yR r) L'':= L + L': Type
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type L, R: Type Sx: InSort S L R xL: L -> No xR: R -> No xcut: forall (l : L) (r : R), xL l < xR r A:= {g : No -> No &
(forallxy : No, x <= y -> g x <= g y) *
(forallxy : No, x < y -> g x < g y)}: Type xL_plus: L -> A xR_plus: R -> A xL_lt_xR_plus: forall (l : L) (r : R) (x : No),
(xL_plus l).1 x < (xR_plus r).1 x L', R': Type s: InSort S L' R' yL: L' -> GenNo S yR: R' -> GenNo S ycut: forall (l : L') (r : R'), yL l < yR r x_plus_yL: foralll : L',
(funy : GenNo S =>
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y < x_plus_y) *
(forallr : R, x_plus_y < (xR_plus r).1 y)})
(yL l) x_plus_yR: forallr : R',
(funy : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 y)})
(yR r) x_plus_yL_lt_yR: forall (l : L') (r : R'),
(fun (xy : GenNo S) (_ : x < y)
(z : (funy0 : GenNo S =>
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y0 <
x_plus_y) *
(forallr0 : R,
x_plus_y <
(xR_plus r0).1 y0)}) x)
(w : (funy0 : GenNo S =>
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y0 <
x_plus_y) *
(forallr0 : R,
x_plus_y <
(xR_plus r0).1 y0)}) y) =>
z.1 < w.1) (yL l) (yR r)
(ycut l r) (x_plus_yL l)
(x_plus_yR r) L'':= L + L': Type R'':= R + R': Type
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type L, R: Type Sx: InSort S L R xL: L -> No xR: R -> No xcut: forall (l : L) (r : R), xL l < xR r A:= {g : No -> No &
(forallxy : No, x <= y -> g x <= g y) *
(forallxy : No, x < y -> g x < g y)}: Type xL_plus: L -> A xR_plus: R -> A xL_lt_xR_plus: forall (l : L) (r : R) (x : No),
(xL_plus l).1 x < (xR_plus r).1 x
forall (xy : GenNo S)
(a : (funy0 : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y0 < x_plus_y) *
(forallr : R, x_plus_y < (xR_plus r).1 y0)}) x)
(b : (funy0 : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y0 < x_plus_y) *
(forallr : R, x_plus_y < (xR_plus r).1 y0)}) y)
(p : x <= y) (q : y <= x),
(fun (x0y0 : GenNo S) (_ : x0 <= y0)
(z : (funy1 : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y1 < x_plus_y) *
(forallr : R, x_plus_y < (xR_plus r).1 y1)})
x0)
(w : (funy1 : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y1 < x_plus_y) *
(forallr : R, x_plus_y < (xR_plus r).1 y1)})
y0) => z.1 <= w.1) x y p a b ->
(fun (x0y0 : GenNo S) (_ : x0 <= y0)
(z : (funy1 : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y1 < x_plus_y) *
(forallr : R, x_plus_y < (xR_plus r).1 y1)})
x0)
(w : (funy1 : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y1 < x_plus_y) *
(forallr : R, x_plus_y < (xR_plus r).1 y1)})
y0) => z.1 <= w.1) y x q b a ->
transport
(funy0 : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y0 < x_plus_y) *
(forallr : R, x_plus_y < (xR_plus r).1 y0)})
(path_No x y p q) a = b
abstract (
intros x y [a ?] [b ?] p q r s;
rewrite transport_sigma; cbnin *;
apply path_sigma_hprop, path_No; cbn;
rewrite transport_const; assumption).
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type L, R: Type Sx: InSort S L R xL: L -> No xR: R -> No xcut: forall (l : L) (r : R), xL l < xR r A:= {g : No -> No &
(forallxy : No, x <= y -> g x <= g y) *
(forallxy : No, x < y -> g x < g y)}: Type xL_plus: L -> A xR_plus: R -> A xL_lt_xR_plus: forall (l : L) (r : R) (x : No),
(xL_plus l).1 x < (xR_plus r).1 x
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type L, R: Type Sx: InSort S L R xL: L -> No xR: R -> No xcut: forall (l : L) (r : R), xL l < xR r A:= {g : No -> No &
(forallxy : No, x <= y -> g x <= g y) *
(forallxy : No, x < y -> g x < g y)}: Type xL_plus: L -> A xR_plus: R -> A xL_lt_xR_plus: forall (l : L) (r : R) (x : No),
(xL_plus l).1 x < (xR_plus r).1 x
abstract (
intros L' R' ? yL yR ycut x_plus_yL x_plus_yR x_plus_yL_lt_yR
L'' R'' ? zL zR zcut x_plus_zL x_plus_zR x_plus_zL_lt_zR
l y_le_zL x_plus_y_le_zL; cbn;
apply lt_l with (inr l);
exact x_plus_y_le_zL ).
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type L, R: Type Sx: InSort S L R xL: L -> No xR: R -> No xcut: forall (l : L) (r : R), xL l < xR r A:= {g : No -> No &
(forallxy : No, x <= y -> g x <= g y) *
(forallxy : No, x < y -> g x < g y)}: Type xL_plus: L -> A xR_plus: R -> A xL_lt_xR_plus: forall (l : L) (r : R) (x : No),
(xL_plus l).1 x < (xR_plus r).1 x
abstract (
intros L' R' ? yL yR ycut x_plus_yL x_plus_yR x_plus_yL_lt_yR
L'' R'' ? zL zR zcut x_plus_zL x_plus_zR x_plus_zL_lt_zR
r yR_le_z x_plus_yR_le_z; cbn;
apply lt_r with (inr r);
exact x_plus_yR_le_z).Defined.(** We now prove a computation law for [plus_inner]. It holds definitionally, so we would like to prove it with just [:= 1] and then rewrite along it later, as we did above. However, there is a subtlety in that the output should be a surreal defined by a cut, which in particular includes a proof of cut-ness, and that proof is rather long, so we would not like to see it in the type of this lemma. Thus, instead we assert only that there *exists* some proof of cut-ness and an equality. *)
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type L, R: Type Sx: InSort S L R xL: L -> No xR: R -> No xcut: forall (l : L) (r : R), xL l < xR r A:= {g : No -> No &
(forallxy : No, x <= y -> g x <= g y) *
(forallxy : No, x < y -> g x < g y)}: Type xL_plus: L -> A xR_plus: R -> A xL_lt_xR_plus: forall (l : L) (r : R) (x : No),
(xL_plus l).1 x < (xR_plus r).1 x L', R': Type Sy: InSort S L' R' yL: L' -> No yR: R' -> No ycut: forall (l : L') (r : R'), yL l < yR r
letL'' := L + L' inletR'' := R + R' inletzL :=
sum_ind (fun_ : L + L' => No)
(funl : L => (xL_plus l).1 {{ yL | yR//ycut }})
(funl : L' => (plus_inner.1 (yL l)).1) inletzR :=
sum_ind (fun_ : R + R' => No)
(funr : R => (xR_plus r).1 {{ yL | yR//ycut }})
(funr : R' => (plus_inner.1 (yR r)).1) inletSz := sum_options L R L' R' Sx Sy in
{zcut : forall (l : L'') (r : R''), zL l < zR r &
(plus_inner.1 {{ yL | yR//ycut }}).1 =
{{ zL | zR//zcut }}}
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type L, R: Type Sx: InSort S L R xL: L -> No xR: R -> No xcut: forall (l : L) (r : R), xL l < xR r A:= {g : No -> No &
(forallxy : No, x <= y -> g x <= g y) *
(forallxy : No, x < y -> g x < g y)}: Type xL_plus: L -> A xR_plus: R -> A xL_lt_xR_plus: forall (l : L) (r : R) (x : No),
(xL_plus l).1 x < (xR_plus r).1 x L', R': Type Sy: InSort S L' R' yL: L' -> No yR: R' -> No ycut: forall (l : L') (r : R'), yL l < yR r
letL'' := L + L' inletR'' := R + R' inletzL :=
sum_ind (fun_ : L + L' => No)
(funl : L => (xL_plus l).1 {{ yL | yR//ycut }})
(funl : L' => (plus_inner.1 (yL l)).1) inletzR :=
sum_ind (fun_ : R + R' => No)
(funr : R => (xR_plus r).1 {{ yL | yR//ycut }})
(funr : R' => (plus_inner.1 (yR r)).1) inletSz := sum_options L R L' R' Sx Sy in
{zcut : forall (l : L'') (r : R''), zL l < zR r &
(plus_inner.1 {{ yL | yR//ycut }}).1 =
{{ zL | zR//zcut }}}
(** Now we tell Coq that we want the equality to be definitional, and let it figure out what the proof of cut-ness has to be. *)
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type L, R: Type Sx: InSort S L R xL: L -> No xR: R -> No xcut: forall (l : L) (r : R), xL l < xR r A:= {g : No -> No &
(forallxy : No, x <= y -> g x <= g y) *
(forallxy : No, x < y -> g x < g y)}: Type xL_plus: L -> A xR_plus: R -> A xL_lt_xR_plus: forall (l : L) (r : R) (x : No),
(xL_plus l).1 x < (xR_plus r).1 x L', R': Type Sy: InSort S L' R' yL: L' -> No yR: R' -> No ycut: forall (l : L') (r : R'), yL l < yR r
(** Adding [rel_hnf] here speeds things up considerably, possibly because it puts the terms in a form where the evar can be instantiated without unfolding or reduction, preventing backtracking across the evar instantiation. *)
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type L, R: Type Sx: InSort S L R xL: L -> No xR: R -> No xcut: forall (l : L) (r : R), xL l < xR r A:= {g : No -> No &
(forallxy : No, x <= y -> g x <= g y) *
(forallxy : No, x < y -> g x < g y)}: Type xL_plus: L -> A xR_plus: R -> A xL_lt_xR_plus: forall (l : L) (r : R) (x : No),
(xL_plus l).1 x < (xR_plus r).1 x L', R': Type Sy: InSort S L' R' yL: L' -> No yR: R' -> No ycut: forall (l : L') (r : R'), yL l < yR r
{|
game_of :=
opt (L + L') (R + R')
(sum_options L R L' R' Sx Sy)
(funx : L + L' =>
game_of
(sum_ind (fun_ : L + L' => No)
(funl : L =>
(xL_plus l).1
{{ funl0 : L' =>
{|
game_of := game_of (yL l0);
isno_game_of :=
isno_game_of (yL l0)
|} | (funr : R' =>
{|
game_of := game_of (yR r);
isno_game_of :=
isno_game_of (yR r)
|})//ycut }})
(funl : L' =>
(Core.Surreals.No_ind_internal
(funy : GenNo S =>
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y < x_plus_y) *
(forallr : R,
x_plus_y < (xR_plus r).1 y)})
(fun (x0y : GenNo S) (_ : x0 <= y)
(z : {x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 x0 < x_plus_y) *
(forallr : R,
x_plus_y < (xR_plus r).1 x0)})
(w : {x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y < x_plus_y) *
(forallr : R,
x_plus_y < (xR_plus r).1 y)})
=> z.1 <= w.1)
(fun (x0y : GenNo S) (_ : x0 < y)
(z : {x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 x0 < x_plus_y) *
(forallr : R,
x_plus_y < (xR_plus r).1 x0)})
(w : {x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y < x_plus_y) *
(forallr : R,
x_plus_y < (xR_plus r).1 y)})
=> z.1 < w.1)
(fun (L'R' : Type)
(s : InSort S L' R')
(yL : L' -> GenNo S)
(yR : R' -> GenNo S)
(ycut : forall (l0 : L') (r : R'),
yL l0 < yR r)
(x_plus_yL : foralll0 : L',
{x_plus_y : No &
(foralll1 : L,
(xL_plus l1).1
(yL l0) < x_plus_y) *
(forallr : R,
x_plus_y <
(xR_plus r).1 (yL l0))})
(x_plus_yR : forallr : R',
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 (yR r) <
x_plus_y) *
(forallr0 : R,
x_plus_y <
(xR_plus r0).1 (yR r))})
(x_plus_yL_lt_yR : forall (l0 : L')
(r : R'),
(x_plus_yL l0).1 <
(x_plus_yR r).1)
=>
letL'' := L + L' inletR'' := R + R' inletzL :=
sum_ind (fun_ : L + L' => No)
(funl0 : L =>
(xL_plus l0).1
{{ yL | yR//ycut }})
(funl0 : L' => (x_plus_yL l0).1)
inletzR :=
sum_ind (fun_ : R + R' => No)
(funr : R =>
(xR_plus r).1
{{ yL | yR//ycut }})
(funr : R' => (x_plus_yR r).1)
inletzcut :=
plus_inner_subproof L' R' s yL yR
ycut x_plus_yL x_plus_yR
x_plus_yL_lt_yR inletX := sum_options L R L' R' Sx s
in
({{ zL | zR//zcut }};
(funl0 : L =>
lt_lopt zL zR zcut (...),
funr : R => lt_ropt zL zR zcut (...))))
plus_inner_subproof0
plus_inner_subproof1
plus_inner_subproof2
plus_inner_subproof3 (game_of (yL l))
(isno_game_of (yL l))).1) x))
(funx : R + R' =>
game_of
(sum_ind (fun_ : R + R' => No)
(funr : R =>
(xR_plus r).1
{{ funl : L' =>
{|
game_of := game_of (yL l);
isno_game_of :=
isno_game_of (yL l)
|} | (funr0 : R' =>
{|
game_of := game_of (yR r0);
isno_game_of :=
isno_game_of (yR r0)
|})//ycut }})
(funr : R' =>
(Core.Surreals.No_ind_internal
(funy : GenNo S =>
{x_plus_y : No &
(foralll : L,
(xL_plus l).1 y < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 y)})
(fun (x0y : GenNo S) (_ : x0 <= y)
(z : {x_plus_y : No &
(foralll : L,
(xL_plus l).1 x0 < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 x0)})
(w : {x_plus_y : No &
(foralll : L,
(xL_plus l).1 y < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 y)})
=> z.1 <= w.1)
(fun (x0y : GenNo S) (_ : x0 < y)
(z : {x_plus_y : No &
(foralll : L,
(xL_plus l).1 x0 < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 x0)})
(w : {x_plus_y : No &
(foralll : L,
(xL_plus l).1 y < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 y)})
=> z.1 < w.1)
(fun (L'R' : Type)
(s : InSort S L' R')
(yL : L' -> GenNo S)
(yR : R' -> GenNo S)
(ycut : forall (l : L') (r0 : R'),
yL l < yR r0)
(x_plus_yL : foralll : L',
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 (yL l) <
x_plus_y) *
(forallr0 : R,
x_plus_y <
(xR_plus r0).1 (yL l))})
(x_plus_yR : forallr0 : R',
{x_plus_y : No &
(foralll : L,
(xL_plus l).1 (yR r0) <
x_plus_y) *
(forallr1 : R,
x_plus_y <
(xR_plus r1).1
(yR r0))})
(x_plus_yL_lt_yR : forall (l : L')
(r0 : R'),
(x_plus_yL l).1 <
(x_plus_yR r0).1)
=>
letL'' := L + L' inletR'' := R + R' inletzL :=
sum_ind (fun_ : L + L' => No)
(funl : L =>
(xL_plus l).1
{{ yL | yR//ycut }})
(funl : L' => (x_plus_yL l).1)
inletzR :=
sum_ind (fun_ : R + R' => No)
(funr0 : R =>
(xR_plus r0).1
{{ yL | yR//ycut }})
(funr0 : R' => (x_plus_yR r0).1)
inletzcut :=
plus_inner_subproof L' R' s yL yR
ycut x_plus_yL x_plus_yR
x_plus_yL_lt_yR inletX := sum_options L R L' R' Sx s
in
({{ zL | zR//zcut }};
(funl : L =>
lt_lopt zL zR zcut (...),
funr0 : R =>
lt_ropt zL zR zcut (...))))
plus_inner_subproof0
plus_inner_subproof1
plus_inner_subproof2
plus_inner_subproof3 (game_of (yR r))
(isno_game_of (yR r))).1) x));
isno_game_of :=
isno (L + L') (R + R')
(sum_options L R L' R' Sx Sy)
(funx : L + L' =>
game_of
(sum_ind (fun_ : L + L' => No)
(funl : L =>
(xL_plus l).1
{{ funl0 : L' =>
{|
game_of := game_of (yL l0);
isno_game_of :=
isno_game_of (yL l0)
|} | (funr : R' =>
{|
game_of := game_of (yR r);
isno_game_of :=
isno_game_of (yR r)
|})//ycut }})
(funl : L' =>
(Core.Surreals.No_ind_internal
(funy : GenNo S =>
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y < x_plus_y) *
(forallr : R,
x_plus_y < (xR_plus r).1 y)})
(fun (x0y : GenNo S) (_ : x0 <= y)
(z : {x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 x0 < x_plus_y) *
(forallr : R,
x_plus_y < (xR_plus r).1 x0)})
(w : {x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y < x_plus_y) *
(forallr : R,
x_plus_y < (xR_plus r).1 y)})
=> z.1 <= w.1)
(fun (x0y : GenNo S) (_ : x0 < y)
(z : {x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 x0 < x_plus_y) *
(forallr : R,
x_plus_y < (xR_plus r).1 x0)})
(w : {x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y < x_plus_y) *
(forallr : R,
x_plus_y < (xR_plus r).1 y)})
=> z.1 < w.1)
(fun (L'R' : Type)
(s : InSort S L' R')
(yL : L' -> GenNo S)
(yR : R' -> GenNo S)
(ycut : forall (l0 : L') (r : R'),
yL l0 < yR r)
(x_plus_yL : foralll0 : L',
{x_plus_y : No &
(foralll1 : L,
(xL_plus l1).1
(yL l0) < x_plus_y) *
(forallr : R,
x_plus_y <
(xR_plus r).1 (yL l0))})
(x_plus_yR : forallr : R',
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 (yR r) <
x_plus_y) *
(forallr0 : R,
x_plus_y <
(xR_plus r0).1 (yR r))})
(x_plus_yL_lt_yR : forall (l0 : L')
(r : R'),
(x_plus_yL l0).1 <
(x_plus_yR r).1)
=>
letL'' := L + L' inletR'' := R + R' inletzL :=
sum_ind (fun_ : L + L' => No)
(funl0 : L =>
(xL_plus l0).1
{{ yL | yR//ycut }})
(funl0 : L' => (x_plus_yL l0).1)
inletzR :=
sum_ind (fun_ : R + R' => No)
(funr : R =>
(xR_plus r).1
{{ yL | yR//ycut }})
(funr : R' => (x_plus_yR r).1)
inletzcut :=
plus_inner_subproof L' R' s yL yR
ycut x_plus_yL x_plus_yR
x_plus_yL_lt_yR inletX := sum_options L R L' R' Sx s
in
({{ zL | zR//zcut }};
(funl0 : L =>
lt_lopt zL zR zcut (...),
funr : R => lt_ropt zL zR zcut (...))))
plus_inner_subproof0
plus_inner_subproof1
plus_inner_subproof2
plus_inner_subproof3 (game_of (yL l))
(isno_game_of (yL l))).1) x))
(funx : R + R' =>
game_of
(sum_ind (fun_ : R + R' => No)
(funr : R =>
(xR_plus r).1
{{ funl : L' =>
{|
game_of := game_of (yL l);
isno_game_of :=
isno_game_of (yL l)
|} | (funr0 : R' =>
{|
game_of := game_of (yR r0);
isno_game_of :=
isno_game_of (yR r0)
|})//ycut }})
(funr : R' =>
(Core.Surreals.No_ind_internal
(funy : GenNo S =>
{x_plus_y : No &
(foralll : L,
(xL_plus l).1 y < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 y)})
(fun (x0y : GenNo S) (_ : x0 <= y)
(z : {x_plus_y : No &
(foralll : L,
(xL_plus l).1 x0 < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 x0)})
(w : {x_plus_y : No &
(foralll : L,
(xL_plus l).1 y < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 y)})
=> z.1 <= w.1)
(fun (x0y : GenNo S) (_ : x0 < y)
(z : {x_plus_y : No &
(foralll : L,
(xL_plus l).1 x0 < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 x0)})
(w : {x_plus_y : No &
(foralll : L,
(xL_plus l).1 y < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 y)})
=> z.1 < w.1)
(fun (L'R' : Type)
(s : InSort S L' R')
(yL : L' -> GenNo S)
(yR : R' -> GenNo S)
(ycut : forall (l : L') (r0 : R'),
yL l < yR r0)
(x_plus_yL : foralll : L',
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 (yL l) <
x_plus_y) *
(forallr0 : R,
x_plus_y <
(xR_plus r0).1 (yL l))})
(x_plus_yR : forallr0 : R',
{x_plus_y : No &
(foralll : L,
(xL_plus l).1 (yR r0) <
x_plus_y) *
(forallr1 : R,
x_plus_y <
(xR_plus r1).1
(yR r0))})
(x_plus_yL_lt_yR : forall (l : L')
(r0 : R'),
(x_plus_yL l).1 <
(x_plus_yR r0).1)
=>
letL'' := L + L' inletR'' := R + R' inletzL :=
sum_ind (fun_ : L + L' => No)
(funl : L =>
(xL_plus l).1
{{ yL | yR//ycut }})
(funl : L' => (x_plus_yL l).1)
inletzR :=
sum_ind (fun_ : R + R' => No)
(funr0 : R =>
(xR_plus r0).1
{{ yL | yR//ycut }})
(funr0 : R' => (x_plus_yR r0).1)
inletzcut :=
plus_inner_subproof L' R' s yL yR
ycut x_plus_yL x_plus_yR
x_plus_yL_lt_yR inletX := sum_options L R L' R' Sx s
in
({{ zL | zR//zcut }};
(funl : L =>
lt_lopt zL zR zcut (...),
funr0 : R =>
lt_ropt zL zR zcut (...))))
plus_inner_subproof0
plus_inner_subproof1
plus_inner_subproof2
plus_inner_subproof3 (game_of (yR r))
(isno_game_of (yR r))).1) x))
(funx : L + L' =>
isno_game_of
(sum_ind (fun_ : L + L' => No)
(funl : L =>
(xL_plus l).1
{{ funl0 : L' =>
{|
game_of := game_of (yL l0);
isno_game_of :=
isno_game_of (yL l0)
|} | (funr : R' =>
{|
game_of := game_of (yR r);
isno_game_of :=
isno_game_of (yR r)
|})//ycut }})
(funl : L' =>
(Core.Surreals.No_ind_internal
(funy : GenNo S =>
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y < x_plus_y) *
(forallr : R,
x_plus_y < (xR_plus r).1 y)})
(fun (x0y : GenNo S) (_ : x0 <= y)
(z : {x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 x0 < x_plus_y) *
(forallr : R,
x_plus_y < (xR_plus r).1 x0)})
(w : {x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y < x_plus_y) *
(forallr : R,
x_plus_y < (xR_plus r).1 y)})
=> z.1 <= w.1)
(fun (x0y : GenNo S) (_ : x0 < y)
(z : {x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 x0 < x_plus_y) *
(forallr : R,
x_plus_y < (xR_plus r).1 x0)})
(w : {x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y < x_plus_y) *
(forallr : R,
x_plus_y < (xR_plus r).1 y)})
=> z.1 < w.1)
(fun (L'R' : Type)
(s : InSort S L' R')
(yL : L' -> GenNo S)
(yR : R' -> GenNo S)
(ycut : forall (l0 : L') (r : R'),
yL l0 < yR r)
(x_plus_yL : foralll0 : L',
{x_plus_y : No &
(foralll1 : L,
(xL_plus l1).1
(yL l0) < x_plus_y) *
(forallr : R,
x_plus_y <
(xR_plus r).1 (yL l0))})
(x_plus_yR : forallr : R',
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 (yR r) <
x_plus_y) *
(forallr0 : R,
x_plus_y <
(xR_plus r0).1 (yR r))})
(x_plus_yL_lt_yR : forall (l0 : L')
(r : R'),
(x_plus_yL l0).1 <
(x_plus_yR r).1)
=>
letL'' := L + L' inletR'' := R + R' inletzL :=
sum_ind (fun_ : L + L' => No)
(funl0 : L =>
(xL_plus l0).1
{{ yL | yR//ycut }})
(funl0 : L' => (x_plus_yL l0).1)
inletzR :=
sum_ind (fun_ : R + R' => No)
(funr : R =>
(xR_plus r).1
{{ yL | yR//ycut }})
(funr : R' => (x_plus_yR r).1)
inletzcut :=
plus_inner_subproof L' R' s yL yR
ycut x_plus_yL x_plus_yR
x_plus_yL_lt_yR inletX := sum_options L R L' R' Sx s
in
({{ zL | zR//zcut }};
(funl0 : L =>
lt_lopt zL zR zcut (...),
funr : R => lt_ropt zL zR zcut (...))))
plus_inner_subproof0
plus_inner_subproof1
plus_inner_subproof2
plus_inner_subproof3 (game_of (yL l))
(isno_game_of (yL l))).1) x))
(funx : R + R' =>
isno_game_of
(sum_ind (fun_ : R + R' => No)
(funr : R =>
(xR_plus r).1
{{ funl : L' =>
{|
game_of := game_of (yL l);
isno_game_of :=
isno_game_of (yL l)
|} | (funr0 : R' =>
{|
game_of := game_of (yR r0);
isno_game_of :=
isno_game_of (yR r0)
|})//ycut }})
(funr : R' =>
(Core.Surreals.No_ind_internal
(funy : GenNo S =>
{x_plus_y : No &
(foralll : L,
(xL_plus l).1 y < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 y)})
(fun (x0y : GenNo S) (_ : x0 <= y)
(z : {x_plus_y : No &
(foralll : L,
(xL_plus l).1 x0 < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 x0)})
(w : {x_plus_y : No &
(foralll : L,
(xL_plus l).1 y < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 y)})
=> z.1 <= w.1)
(fun (x0y : GenNo S) (_ : x0 < y)
(z : {x_plus_y : No &
(foralll : L,
(xL_plus l).1 x0 < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 x0)})
(w : {x_plus_y : No &
(foralll : L,
(xL_plus l).1 y < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 y)})
=> z.1 < w.1)
(fun (L'R' : Type)
(s : InSort S L' R')
(yL : L' -> GenNo S)
(yR : R' -> GenNo S)
(ycut : forall (l : L') (r0 : R'),
yL l < yR r0)
(x_plus_yL : foralll : L',
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 (yL l) <
x_plus_y) *
(forallr0 : R,
x_plus_y <
(xR_plus r0).1 (yL l))})
(x_plus_yR : forallr0 : R',
{x_plus_y : No &
(foralll : L,
(xL_plus l).1 (yR r0) <
x_plus_y) *
(forallr1 : R,
x_plus_y <
(xR_plus r1).1
(yR r0))})
(x_plus_yL_lt_yR : forall (l : L')
(r0 : R'),
(x_plus_yL l).1 <
(x_plus_yR r0).1)
=>
letL'' := L + L' inletR'' := R + R' inletzL :=
sum_ind (fun_ : L + L' => No)
(funl : L =>
(xL_plus l).1
{{ yL | yR//ycut }})
(funl : L' => (x_plus_yL l).1)
inletzR :=
sum_ind (fun_ : R + R' => No)
(funr0 : R =>
(xR_plus r0).1
{{ yL | yR//ycut }})
(funr0 : R' => (x_plus_yR r0).1)
inletzcut :=
plus_inner_subproof L' R' s yL yR
ycut x_plus_yL x_plus_yR
x_plus_yL_lt_yR inletX := sum_options L R L' R' Sx s
in
({{ zL | zR//zcut }};
(funl : L =>
lt_lopt zL zR zcut (...),
funr0 : R =>
lt_ropt zL zR zcut (...))))
plus_inner_subproof0
plus_inner_subproof1
plus_inner_subproof2
plus_inner_subproof3 (game_of (yR r))
(isno_game_of (yR r))).1) x))
(plus_inner_subproof L' R' Sy
(funl : L' =>
{|
game_of := game_of (yL l);
isno_game_of := isno_game_of (yL l)
|})
(funr : R' =>
{|
game_of := game_of (yR r);
isno_game_of := isno_game_of (yR r)
|}) ycut
(funl : L' =>
Core.Surreals.No_ind_internal
(funy : GenNo S =>
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y < x_plus_y) *
(forallr : R, x_plus_y < (xR_plus r).1 y)})
(fun (xy : GenNo S) (_ : x <= y)
(z : {x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 x < x_plus_y) *
(forallr : R,
x_plus_y < (xR_plus r).1 x)})
(w : {x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y < x_plus_y) *
(forallr : R,
x_plus_y < (xR_plus r).1 y)}) =>
z.1 <= w.1)
(fun (xy : GenNo S) (_ : x < y)
(z : {x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 x < x_plus_y) *
(forallr : R,
x_plus_y < (xR_plus r).1 x)})
(w : {x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y < x_plus_y) *
(forallr : R,
x_plus_y < (xR_plus r).1 y)}) =>
z.1 < w.1)
(fun (L'R' : Type) (s : InSort S L' R')
(yL : L' -> GenNo S)
(yR : R' -> GenNo S)
(ycut : forall (l0 : L') (r : R'),
yL l0 < yR r)
(x_plus_yL : foralll0 : L',
{x_plus_y : No &
(foralll1 : L,
(xL_plus l1).1 (yL l0) <
x_plus_y) *
(forallr : R,
x_plus_y <
(xR_plus r).1 (yL l0))})
(x_plus_yR : forallr : R',
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 (yR r) <
x_plus_y) *
(forallr0 : R,
x_plus_y <
(xR_plus r0).1 (yR r))})
(x_plus_yL_lt_yR : forall (l0 : L')
(r : R'),
(x_plus_yL l0).1 <
(x_plus_yR r).1) =>
letL'' := L + L' inletR'' := R + R' inletzL :=
sum_ind (fun_ : L + L' => No)
(funl0 : L =>
(xL_plus l0).1 {{ yL | yR//ycut }})
(funl0 : L' => (x_plus_yL l0).1) inletzR :=
sum_ind (fun_ : R + R' => No)
(funr : R =>
(xR_plus r).1 {{ yL | yR//ycut }})
(funr : R' => (x_plus_yR r).1) inletzcut :=
plus_inner_subproof L' R' s yL yR ycut
x_plus_yL x_plus_yR x_plus_yL_lt_yR
inletX := sum_options L R L' R' Sx s in
({{ zL | zR//zcut }};
(funl0 : L =>
lt_lopt zL zR zcut (inl l0),
funr : R => lt_ropt zL zR zcut (inl r))))
plus_inner_subproof0 plus_inner_subproof1
plus_inner_subproof2 plus_inner_subproof3
(game_of (yL l)) (isno_game_of (yL l)))
(funr : R' =>
Core.Surreals.No_ind_internal
(funy : GenNo S =>
{x_plus_y : No &
(foralll : L, (xL_plus l).1 y < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 y)})
(fun (xy : GenNo S) (_ : x <= y)
(z : {x_plus_y : No &
(foralll : L,
(xL_plus l).1 x < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 x)})
(w : {x_plus_y : No &
(foralll : L,
(xL_plus l).1 y < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 y)}) =>
z.1 <= w.1)
(fun (xy : GenNo S) (_ : x < y)
(z : {x_plus_y : No &
(foralll : L,
(xL_plus l).1 x < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 x)})
(w : {x_plus_y : No &
(foralll : L,
(xL_plus l).1 y < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 y)}) =>
z.1 < w.1)
(fun (L'R' : Type) (s : InSort S L' R')
(yL : L' -> GenNo S)
(yR : R' -> GenNo S)
(ycut : forall (l : L') (r0 : R'),
yL l < yR r0)
(x_plus_yL : foralll : L',
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 (yL l) <
x_plus_y) *
(forallr0 : R,
x_plus_y <
(xR_plus r0).1 (yL l))})
(x_plus_yR : forallr0 : R',
{x_plus_y : No &
(foralll : L,
(xL_plus l).1 (yR r0) <
x_plus_y) *
(forallr1 : R,
x_plus_y <
(xR_plus r1).1 (yR r0))})
(x_plus_yL_lt_yR : forall (l : L')
(r0 : R'),
(x_plus_yL l).1 <
(x_plus_yR r0).1) =>
letL'' := L + L' inletR'' := R + R' inletzL :=
sum_ind (fun_ : L + L' => No)
(funl : L =>
(xL_plus l).1 {{ yL | yR//ycut }})
(funl : L' => (x_plus_yL l).1) inletzR :=
sum_ind (fun_ : R + R' => No)
(funr0 : R =>
(xR_plus r0).1 {{ yL | yR//ycut }})
(funr0 : R' => (x_plus_yR r0).1) inletzcut :=
plus_inner_subproof L' R' s yL yR ycut
x_plus_yL x_plus_yR x_plus_yL_lt_yR
inletX := sum_options L R L' R' Sx s in
({{ zL | zR//zcut }};
(funl : L => lt_lopt zL zR zcut (inl l),
funr0 : R => lt_ropt zL zR zcut (inl r0))))
plus_inner_subproof0 plus_inner_subproof1
plus_inner_subproof2 plus_inner_subproof3
(game_of (yR r)) (isno_game_of (yR r)))
(fun (l : L') (r : R') =>
match
No_Empty_admitted
return
((Core.Surreals.No_ind_internal
(funy : GenNo S =>
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 y)})
(fun (xy : GenNo S) (_ : x <= y)
(z : {x_plus_y : No &
(foralll0 : L,
....1 x < x_plus_y) *
(forallr0 : R,
x_plus_y < ....1 x)})
(w : {x_plus_y : No &
(foralll0 : L,
....1 y < x_plus_y) *
(forallr0 : R,
x_plus_y < ....1 y)}) =>
z.1 <= w.1)
(fun (xy : GenNo S) (_ : x < y)
(z : {x_plus_y : No &
(foralll0 : L,
....1 x < x_plus_y) *
(forallr0 : R,
x_plus_y < ....1 x)})
(w : {x_plus_y : No &
(foralll0 : L,
....1 y < x_plus_y) *
(forallr0 : R,
x_plus_y < ....1 y)}) =>
z.1 < w.1)
(fun (L'R' : Type)
(s : InSort S L' R')
(yL : L' -> GenNo S)
(yR : R' -> GenNo S)
(ycut : forall (l0 : L')
(r0 : R'), yL l0 < yR r0)
(x_plus_yL : foralll0 : L',
{x_plus_y : No &
(foralll1 : L,
... < x_plus_y) *
(forallr0 : R,
x_plus_y < ...)})
(x_plus_yR : forallr0 : R',
{x_plus_y : No &
(foralll0 : L,
... < x_plus_y) *
(forallr1 : R,
x_plus_y < ...)})
(x_plus_yL_lt_yR : forall
(l0 : L')
(r0 : R'),
(x_plus_yL l0).1 <
(x_plus_yR r0).1)
=>
letL'' := L + L' inletR'' := R + R' inletzL :=
sum_ind (fun ... => No)
(fun ... =>
....1 {{ yL | yR//ycut }})
(fun ... => (...).1) inletzR :=
sum_ind (... => No) (... => ...)
(... => ....1) inletzcut :=
plus_inner_subproof L' R' s yL yR
ycut x_plus_yL x_plus_yR
x_plus_yL_lt_yR inletX := sum_options L R L' R' Sx s
in
({{ zL | zR//zcut }}; (..., ...)))
plus_inner_subproof0
plus_inner_subproof1
plus_inner_subproof2
plus_inner_subproof3
(game_of (yL l))
(isno_game_of (yL l))).1 <
(Core.Surreals.No_ind_internal
(funy : GenNo S =>
{x_plus_y : No &
(foralll0 : L,
(xL_plus l0).1 y < x_plus_y) *
(forallr0 : R,
x_plus_y < (xR_plus r0).1 y)})
(fun (xy : GenNo S) (_ : x <= y)
(z : {x_plus_y : No &
(foralll0 : L,
....1 x < x_plus_y) *
(forallr0 : R,
x_plus_y < ....1 x)})
(w : {x_plus_y : No &
(foralll0 : L,
....1 y < x_plus_y) *
(forallr0 : R,
x_plus_y < ....1 y)}) =>
z.1 <= w.1)
(fun (xy : GenNo S) (_ : x < y)
(z : {x_plus_y : No &
(foralll0 : L,
....1 x < x_plus_y) *
(forallr0 : R,
x_plus_y < ....1 x)})
(w : {x_plus_y : No &
(foralll0 : L,
....1 y < x_plus_y) *
(forallr0 : R,
x_plus_y < ....1 y)}) =>
z.1 < w.1)
(fun (L'R' : Type)
(s : InSort S L' R')
(yL : L' -> GenNo S)
(yR : R' -> GenNo S)
(ycut : forall (l0 : L')
(r0 : R'), yL l0 < yR r0)
(x_plus_yL : foralll0 : L',
{x_plus_y : No &
(foralll1 : L,
... < x_plus_y) *
(forallr0 : R,
x_plus_y < ...)})
(x_plus_yR : forallr0 : R',
{x_plus_y : No &
(foralll0 : L,
... < x_plus_y) *
(forallr1 : R,
x_plus_y < ...)})
(x_plus_yL_lt_yR : forall
(l0 : L')
(r0 : R'),
(x_plus_yL l0).1 <
(x_plus_yR r0).1)
=>
letL'' := L + L' inletR'' := R + R' inletzL :=
sum_ind (fun ... => No)
(fun ... =>
....1 {{ yL | yR//ycut }})
(fun ... => (...).1) inletzR :=
sum_ind (... => No) (... => ...)
(... => ....1) inletzcut :=
plus_inner_subproof L' R' s yL yR
ycut x_plus_yL x_plus_yR
x_plus_yL_lt_yR inletX := sum_options L R L' R' Sx s
in
({{ zL | zR//zcut }}; (..., ...)))
plus_inner_subproof0
plus_inner_subproof1
plus_inner_subproof2
plus_inner_subproof3
(game_of (yR r))
(isno_game_of (yR r))).1)
withend))
|} =
{|
game_of :=
opt (L + L') (R + R')
(sum_options L R L' R' Sx Sy)
(funx : L + L' =>
game_of
(sum_ind (fun_ : L + L' => No)
(funl : L =>
(xL_plus l).1 {{ yL | yR//ycut }})
(funl : L' => (plus_inner.1 (yL l)).1) x))
(funx : R + R' =>
game_of
(sum_ind (fun_ : R + R' => No)
(funr : R =>
(xR_plus r).1 {{ yL | yR//ycut }})
(funr : R' => (plus_inner.1 (yR r)).1) x));
isno_game_of :=
isno (L + L') (R + R')
(sum_options L R L' R' Sx Sy)
(funx : L + L' =>
game_of
(sum_ind (fun_ : L + L' => No)
(funl : L =>
(xL_plus l).1 {{ yL | yR//ycut }})
(funl : L' => (plus_inner.1 (yL l)).1) x))
(funx : R + R' =>
game_of
(sum_ind (fun_ : R + R' => No)
(funr : R =>
(xR_plus r).1 {{ yL | yR//ycut }})
(funr : R' => (plus_inner.1 (yR r)).1) x))
(funx : L + L' =>
isno_game_of
(sum_ind (fun_ : L + L' => No)
(funl : L =>
(xL_plus l).1 {{ yL | yR//ycut }})
(funl : L' => (plus_inner.1 (yL l)).1) x))
(funx : R + R' =>
isno_game_of
(sum_ind (fun_ : R + R' => No)
(funr : R =>
(xR_plus r).1 {{ yL | yR//ycut }})
(funr : R' => (plus_inner.1 (yR r)).1) x))
?zcut
|}
reflexivity.Qed.EndInner.
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type
{f
: No ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)} &
(forallxy : GenNo S,
x <= y -> forallz : No, (f x).1 z <= (f y).1 z) *
(forallxy : GenNo S,
x < y -> forallz : No, (f x).1 z < (f y).1 z)}
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type
{f
: No ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)} &
(forallxy : GenNo S,
x <= y -> forallz : No, (f x).1 z <= (f y).1 z) *
(forallxy : GenNo S,
x < y -> forallz : No, (f x).1 z < (f y).1 z)}
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type
forallab : {g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)},
(forallx : No, a.1 x <= b.1 x) ->
(forallx : No, b.1 x <= a.1 x) -> a = b
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type
forall (LR : Type) (s : InSort S L R)
(xL : L -> GenNo S) (xR : R -> GenNo S)
(xcut : forall (l : L) (r : R), xL l < xR r)
(fxL : L ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fxR : R ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fxcut : forall (l : L) (r : R) (x : No),
(fxL l).1 x < (fxR r).1 x) (L'R' : Type)
(s' : InSort S L' R') (yL : L' -> GenNo S)
(yR : R' -> GenNo S)
(ycut : forall (l : L') (r : R'), yL l < yR r)
(fyL : L' ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fyR : R' ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fycut : forall (l : L') (r : R') (x : No),
(fyL l).1 x < (fyR r).1 x),
(foralll : L, xL l < {{ yL | yR//ycut }}) ->
(forall (l : L) (x : No),
(fxL l).1 x <
(letg := plus_inner fyL fyR fycut in
(funy : No => (g.1 y).1; g.2)).1 x) ->
(forallr : R', {{ xL | xR//xcut }} < yR r) ->
(forall (r : R') (x : No),
(letg := plus_inner fxL fxR fxcut in
(funy : No => (g.1 y).1; g.2)).1 x < (fyR r).1 x) ->
forallx : No,
(letg := plus_inner fxL fxR fxcut in
(funy : No => (g.1 y).1; g.2)).1 x <=
(letg := plus_inner fyL fyR fycut in
(funy : No => (g.1 y).1; g.2)).1 x
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type
forall (LR : Type) (s : InSort S L R)
(xL : L -> GenNo S) (xR : R -> GenNo S)
(xcut : forall (l : L) (r : R), xL l < xR r)
(fxL : L ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fxR : R ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fxcut : forall (l : L) (r : R) (x : No),
(fxL l).1 x < (fxR r).1 x) (L'R' : Type)
(s' : InSort S L' R') (yL : L' -> GenNo S)
(yR : R' -> GenNo S),
(forall (l : L') (r : R'), yL l < yR r) ->
forall
(fyL : L' ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fyR : R' ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fycut : forall (l : L') (r : R') (x : No),
(fyL l).1 x < (fyR r).1 x) (l : L'),
{{ xL | xR//xcut }} <= yL l ->
(forallx : No,
(letg := plus_inner fxL fxR fxcut in
(funy : No => (g.1 y).1; g.2)).1 x <= (fyL l).1 x) ->
forallx : No,
(letg := plus_inner fxL fxR fxcut in
(funy : No => (g.1 y).1; g.2)).1 x <
(letg := plus_inner fyL fyR fycut in
(funy : No => (g.1 y).1; g.2)).1 x
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type
forall (LR : Type) (s : InSort S L R)
(xL : L -> GenNo S) (xR : R -> GenNo S),
(forall (l : L) (r : R), xL l < xR r) ->
forall
(fxL : L ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fxR : R ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fxcut : forall (l : L) (r : R) (x : No),
(fxL l).1 x < (fxR r).1 x) (L'R' : Type)
(s' : InSort S L' R') (yL : L' -> GenNo S)
(yR : R' -> GenNo S)
(ycut : forall (l : L') (r : R'), yL l < yR r)
(fyL : L' ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fyR : R' ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fycut : forall (l : L') (r : R') (x : No),
(fyL l).1 x < (fyR r).1 x) (r : R),
xR r <= {{ yL | yR//ycut }} ->
(forallx : No,
(fxR r).1 x <=
(letg := plus_inner fyL fyR fycut in
(funy : No => (g.1 y).1; g.2)).1 x) ->
forallx : No,
(letg := plus_inner fxL fxR fxcut in
(funy : No => (g.1 y).1; g.2)).1 x <
(letg := plus_inner fyL fyR fycut in
(funy : No => (g.1 y).1; g.2)).1 x
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type
forallab : {g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)},
(forallx : No, a.1 x <= b.1 x) ->
(forallx : No, b.1 x <= a.1 x) -> a = b
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type
forall (LR : Type) (s : InSort S L R)
(xL : L -> GenNo S) (xR : R -> GenNo S)
(xcut : forall (l : L) (r : R), xL l < xR r)
(fxL : L ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fxR : R ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fxcut : forall (l : L) (r : R) (x : No),
(fxL l).1 x < (fxR r).1 x) (L'R' : Type)
(s' : InSort S L' R') (yL : L' -> GenNo S)
(yR : R' -> GenNo S)
(ycut : forall (l : L') (r : R'), yL l < yR r)
(fyL : L' ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fyR : R' ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fycut : forall (l : L') (r : R') (x : No),
(fyL l).1 x < (fyR r).1 x),
(foralll : L, xL l < {{ yL | yR//ycut }}) ->
(forall (l : L) (x : No),
(fxL l).1 x <
(letg := plus_inner fyL fyR fycut in
(funy : No => (g.1 y).1; g.2)).1 x) ->
(forallr : R', {{ xL | xR//xcut }} < yR r) ->
(forall (r : R') (x : No),
(letg := plus_inner fxL fxR fxcut in
(funy : No => (g.1 y).1; g.2)).1 x < (fyR r).1 x) ->
forallx : No,
(letg := plus_inner fxL fxR fxcut in
(funy : No => (g.1 y).1; g.2)).1 x <=
(letg := plus_inner fyL fyR fycut in
(funy : No => (g.1 y).1; g.2)).1 x
abstract (
intros L R ? xL xR xcut xL_plus xR_plus xL_lt_xR_plus
L' R' ? yL yR ycut yL_plus yR_plus yL_lt_yR_plus;
intros xL_lt_y xL_lt_y_plus x_lt_yR x_lt_yR_plus z;
lazy beta zeta in *; cbn [pr1] in *;
pattern z; refine (No_ind_hprop _ _ z);
intros L'' R'' ? zL zR zcut x_le_y_plus_zL x_le_y_plus_zR;
destruct (plus_inner_cut xL_plus xR_plus xL_lt_xR_plus
zL zR zcut) as [xzcut p]; rewrite p;
destruct (plus_inner_cut yL_plus yR_plus yL_lt_yR_plus
zL zR zcut) as [yzcut q];rewrite q;
apply le_lr; [ intros [l|l] | intros [r|r] ];
[ (** x^L + z < y + z *)specialize (xL_lt_y_plus l {{ zL | zR // zcut }});
rewrite q in xL_lt_y_plus;
exact xL_lt_y_plus
| (** x + z^L < y + z *)refine (le_lt_trans (x_le_y_plus_zL l) _);
exact (lt_lopt _ _ _ (inr l))
| (** x + z < y^R + z *)specialize (x_lt_yR_plus r {{ zL | zR // zcut }});
rewrite p in x_lt_yR_plus;
exact x_lt_yR_plus
| (** x + z < y + z^R *)refine (lt_le_trans _ (x_le_y_plus_zR r));
exact (lt_ropt _ _ _ (inr r)) ]).
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type
forall (LR : Type) (s : InSort S L R)
(xL : L -> GenNo S) (xR : R -> GenNo S)
(xcut : forall (l : L) (r : R), xL l < xR r)
(fxL : L ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fxR : R ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fxcut : forall (l : L) (r : R) (x : No),
(fxL l).1 x < (fxR r).1 x) (L'R' : Type)
(s' : InSort S L' R') (yL : L' -> GenNo S)
(yR : R' -> GenNo S),
(forall (l : L') (r : R'), yL l < yR r) ->
forall
(fyL : L' ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fyR : R' ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fycut : forall (l : L') (r : R') (x : No),
(fyL l).1 x < (fyR r).1 x) (l : L'),
{{ xL | xR//xcut }} <= yL l ->
(forallx : No,
(letg := plus_inner fxL fxR fxcut in
(funy : No => (g.1 y).1; g.2)).1 x <= (fyL l).1 x) ->
forallx : No,
(letg := plus_inner fxL fxR fxcut in
(funy : No => (g.1 y).1; g.2)).1 x <
(letg := plus_inner fyL fyR fycut in
(funy : No => (g.1 y).1; g.2)).1 x
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type
forall (LR : Type) (s : InSort S L R)
(xL : L -> GenNo S) (xR : R -> GenNo S),
(forall (l : L) (r : R), xL l < xR r) ->
forall
(fxL : L ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fxR : R ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fxcut : forall (l : L) (r : R) (x : No),
(fxL l).1 x < (fxR r).1 x) (L'R' : Type)
(s' : InSort S L' R') (yL : L' -> GenNo S)
(yR : R' -> GenNo S)
(ycut : forall (l : L') (r : R'), yL l < yR r)
(fyL : L' ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fyR : R' ->
{g : No -> No &
(forallxy : GenNo S, x <= y -> g x <= g y) *
(forallxy : GenNo S, x < y -> g x < g y)})
(fycut : forall (l : L') (r : R') (x : No),
(fyL l).1 x < (fyR r).1 x) (r : R),
xR r <= {{ yL | yR//ycut }} ->
(forallx : No,
(fxR r).1 x <=
(letg := plus_inner fyL fyR fycut in
(funy : No => (g.1 y).1; g.2)).1 x) ->
forallx : No,
(letg := plus_inner fxL fxR fxcut in
(funy : No => (g.1 y).1; g.2)).1 x <
(letg := plus_inner fyL fyR fycut in
(funy : No => (g.1 y).1; g.2)).1 x
abstract (
intros L R ? xL xR xcut xL_plus xR_plus xL_lt_xR_plus
L' R' ? yL yR ycut yL_plus yR_plus yL_lt_yR_plus;
intros r xR_le_y xR_le_y_plus z;
lazy beta zeta in *; cbn [pr1] in *;
pattern z; refine (No_ind_hprop _ _ z);
intros L'' R'' ? zL zR zcut x_le_y_plus_zL x_le_y_plus_zR;
destruct (plus_inner_cut xL_plus xR_plus xL_lt_xR_plus
zL zR zcut) as [xzcut p]; rewrite p;
destruct (plus_inner_cut yL_plus yR_plus yL_lt_yR_plus
zL zR zcut) as [yzcut q];rewrite q;
refine (lt_le_trans _ (xR_le_y_plus {{ zL | zR // zcut }}));
exact (lt_ropt _ _ _ (inl r)) ).Defined.Definitionplus (xy : No) : No
:= (plus_outer.1 x).1 y.Infix"+" := plus : surreal_scope.Definitionplus_le_l (xx'y : No) (p : x <= x')
: (x + y) <= (x' + y)
:= fst (plus_outer.2) x x' p y.Definitionplus_lt_l (xx'y : No) (p : x < x')
: (x + y) < (x' + y)
:= snd (plus_outer.2) x x' p y.Definitionplus_le_r (xyy' : No) (p : y <= y')
: (x + y) <= (x + y')
:= fst (plus_outer.1 x).2 y y' p.Definitionplus_lt_r (xyy' : No) (p : y < y')
: (x + y) < (x + y')
:= snd (plus_outer.1 x).2 y y' p.(** See the remarks above [plus_inner_cut] to explain the type of this lemma. *)Definitionplus_cut
{LR : Type@{i} } {Sx : InSort S L R}
(xL : L -> No) (xR : R -> No)
(xcut : forall (l : L) (r : R), xL l < xR r)
{L'R' : Type@{i} } {Sy : InSort S L' R'}
(yL : L' -> No) (yR : R' -> No)
(ycut : forall (l : L') (r : R'), yL l < yR r)
: letL'' := (L + L')%type inletR'' := (R + R')%type inletx := {{ xL | xR // xcut }} inlety := {{ yL | yR // ycut }} inletzL := sum_ind (fun_ => No)
(funl => (xL l) + y) (funl => x + (yL l))
: L'' -> No inletzR := sum_ind (fun_ => No)
(funr => (xR r) + y) (funr => x + (yR r))
: R'' -> No inletSz := sum_options L R L' R' _ _ in
{ zcut : forall (l:L'') (r:R''), zL l < zR r &
x + y = @No_cut _ _ _ Sz zL zR zcut }
:= plus_inner_cut (Sx := Sx)
(funl => plus_outer.1 (xL l))
(funr => plus_outer.1 (xR r))
(funlr => snd plus_outer.2 (xL l) (xR r) (xcut l r))
yL yR ycut.(** Because the conclusion of [plus_cut] is a sigma-type whose second component is the real equality we want to rewrite along, in order to rewrite along it we have to first destruct it. This tactic takes care of that for us. *)Ltacdo_plus_cut :=
repeatmatch goal with
| [ |- context ctx [ {{ ?xL | ?xR // ?xcut }} + {{ ?yL | ?yR // ?ycut }} ] ] =>
letxycut := fresh"cut"inletp := fresh"p"indestruct (plus_cut xL xR xcut yL yR ycut) as [xycut p];
rewrite p; clear p
end.(** Conway proves the basic properties of arithmetic using "one-line proofs". We can't quite do them in one line of Ltac, but the following tactic does help a lot. Note that it is specific to addition. It requires the caller to specify the equivalences along which to identify the indexing types for the options, as well as a rewriting tactic for evaluating those equivalences on constructors. Unfortunately, it doesn't usually manage to finish the whole proof, since in general it can't guess how to use the inductive hypotheses. It's usually fairly easy to finish all the cases it leaves over, but we do generally have to refer by name to the inductive hypotheses that were automatically named by [intros] here. I haven't thought of a good solution to that. *)LocalOpaque No_cut plus. (* required to make [rewrite] fail quickly *)Local Unset Keyed Unification. (* shaves another second or two off of [rewrite] *)Tactic Notation"one_line_proof"uconstr(eL) uconstr(eR) :=
unfold No in *;
repeat_No_ind_hprop;
do_plus_cut;
refine (path_No_easy _ _ _ _ eL eR _ _ _ _);
intros;
repeatmatch goal with
| [ H : (?A + ?B) |- _ ] => destruct H
end;
repeatmatch goal with
| [ |- context[@equiv_fun ?A?B?e?v] ]
=> (* first check that we picked up either [eL] or [eR]; we can't use [unify] because it doesn't infer holes, and we can't Ltac-match on [eL] / [eR] because apparently matching on uconstr doesn't work when there are holes in the uconstr *)first [ letunif := constr:(idpath : e = eL) inidtac
| letunif := constr:(idpath : e = eR) inidtac ];
(* assume that the term reduces to a constructor; use [hnf] to get that constructor *)letef := constr:(@equiv_fun A B e v) inletef' := (evalhnfin ef) inprogresschange ef with ef'
end;
repeatcbn [sum_ind];
(* rewrite with induction hypotheses from [repeat_No_ind_hprop] and [do_plus_cut] *)repeatmatch goal with
| [ |- ?x = ?x ] => reflexivity
| [ |- ?a + _ = ?a + _ ] => apply ap
| [ |- _ + ?a = _ + ?a ] => apply (ap (funx => x + a))
| [ e : Empty |- _ ] => elim e
| [ IH : (foralllr, _ + _ = _) |- _ ]
=> rewrite IH; clear IH
| [ IH : (foralllr, _ + _ = _ + _) |- _ ]
=> first [ rewrite IH | rewrite <- IH ]; clear IH
| [ IH : (foralllr (y : GenNo _), _ + _ = _ + _) |- _ ]
=> first [ rewrite IH | rewrite <- IH ]; clear IH
| [ IH : (foralllr (yz : GenNo _), _ + _ = _ + _) |- _ ]
=> first [ rewrite IH | rewrite <- IH ]; clear IH
end.(** At last we are ready to prove that the surreal numbers are a commutative monoid under addition. *)
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type x, y: No
x + y = y + x
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type x, y: No
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type x: No
zero + x = x
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type x: No
zero + x = x
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type x: No
{{ Empty_rec | Empty_rec//lempty_cut }} + x = x
one_line_proof (sum_empty_l _) (sum_empty_l _).Defined.(** If we also have negation, we can prove that it gives additive inverses, so that we have an abelian group. *)Context `{HasNegation S}.
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type H1: HasNegation S x: No
x + negate x = zero
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type H1: HasNegation S x: No
x + negate x = zero
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type H1: HasNegation S L, R: Type s: InSort S L R xL: L -> GenNo S xR: R -> GenNo S xcut: forall (l : L) (r : R), xL l < xR r IHL: foralll : L, xL l + negate (xL l) = zero IHR: forallr : R, xR r + negate (xR r) = zero nxcut: forall (r : R) (l : L),
negate (xR r) < negate (xL l) cut: forall (l : L + R) (r : R + L),
sum_ind (fun_ : L + R => No)
(funl0 : L =>
xL l0 +
{{ funr0 : R => negate (xR r0) |
(funl1 : L => negate (xL l1))//nxcut }})
(funl0 : R =>
{{ xL | xR//xcut }} + negate (xR l0)) l <
sum_ind (fun_ : R + L => No)
(funr0 : R =>
xR r0 +
{{ funr1 : R => negate (xR r1) |
(funl0 : L => negate (xL l0))//nxcut }})
(funr0 : L =>
{{ xL | xR//xcut }} + negate (xL r0)) r
{{ sum_ind (fun_ : L + R => No)
(funl : L =>
xL l +
{{ funr : R => negate (xR r) | (funl0 : L =>
negate (xL l0))//nxcut }})
(funl : R => {{ xL | xR//xcut }} + negate (xR l)) |
sum_ind (fun_ : R + L => No)
(funr : R =>
xR r +
{{ funr0 : R => negate (xR r0) | (funl : L =>
negate (xL l))//nxcut }})
(funr : L => {{ xL | xR//xcut }} + negate (xL r))//cut }} =
zero
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type H1: HasNegation S L, R: Type s: InSort S L R xL: L -> GenNo S xR: R -> GenNo S xcut: forall (l : L) (r : R), xL l < xR r IHL: foralll : L, xL l + negate (xL l) = zero IHR: forallr : R, xR r + negate (xR r) = zero nxcut: forall (r : R) (l : L),
negate (xR r) < negate (xL l) cut: forall (l : L + R) (r : R + L),
sum_ind (fun_ : L + R => No)
(funl0 : L =>
xL l0 +
{{ funr0 : R => negate (xR r0) |
(funl1 : L => negate (xL l1))//nxcut }})
(funl0 : R =>
{{ xL | xR//xcut }} + negate (xR l0)) l <
sum_ind (fun_ : R + L => No)
(funr0 : R =>
xR r0 +
{{ funr1 : R => negate (xR r1) |
(funl0 : L => negate (xL l0))//nxcut }})
(funr0 : L =>
{{ xL | xR//xcut }} + negate (xL r0)) r
{{ sum_ind (fun_ : L + R => No)
(funl : L =>
xL l +
{{ funr : R => negate (xR r) | (funl0 : L =>
negate (xL l0))//nxcut }})
(funl : R => {{ xL | xR//xcut }} + negate (xR l)) |
sum_ind (fun_ : R + L => No)
(funr : R =>
xR r +
{{ funr0 : R => negate (xR r0) | (funl : L =>
negate (xL l))//nxcut }})
(funr : L => {{ xL | xR//xcut }} + negate (xL r))//cut }} <=
zero
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type H1: HasNegation S L, R: Type s: InSort S L R xL: L -> GenNo S xR: R -> GenNo S xcut: forall (l : L) (r : R), xL l < xR r IHL: foralll : L, xL l + negate (xL l) = zero IHR: forallr : R, xR r + negate (xR r) = zero nxcut: forall (r : R) (l : L),
negate (xR r) < negate (xL l) cut: forall (l : L + R) (r : R + L),
sum_ind (fun_ : L + R => No)
(funl0 : L =>
xL l0 +
{{ funr0 : R => negate (xR r0) |
(funl1 : L => negate (xL l1))//nxcut }})
(funl0 : R =>
{{ xL | xR//xcut }} + negate (xR l0)) l <
sum_ind (fun_ : R + L => No)
(funr0 : R =>
xR r0 +
{{ funr1 : R => negate (xR r1) |
(funl0 : L => negate (xL l0))//nxcut }})
(funr0 : L =>
{{ xL | xR//xcut }} + negate (xL r0)) r
zero <=
{{ sum_ind (fun_ : L + R => No)
(funl : L =>
xL l +
{{ funr : R => negate (xR r) |
(funl0 : L => negate (xL l0))//nxcut }})
(funl : R => {{ xL | xR//xcut }} + negate (xR l)) |
sum_ind (fun_ : R + L => No)
(funr : R =>
xR r +
{{ funr0 : R => negate (xR r0) |
(funl : L => negate (xL l))//nxcut }})
(funr : L => {{ xL | xR//xcut }} + negate (xL r))//cut }}
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type H1: HasNegation S L, R: Type s: InSort S L R xL: L -> GenNo S xR: R -> GenNo S xcut: forall (l : L) (r : R), xL l < xR r IHL: foralll : L, xL l + negate (xL l) = zero IHR: forallr : R, xR r + negate (xR r) = zero nxcut: forall (r : R) (l : L),
negate (xR r) < negate (xL l) cut: forall (l : L + R) (r : R + L),
sum_ind (fun_ : L + R => No)
(funl0 : L =>
xL l0 +
{{ funr0 : R => negate (xR r0) |
(funl1 : L => negate (xL l1))//nxcut }})
(funl0 : R =>
{{ xL | xR//xcut }} + negate (xR l0)) l <
sum_ind (fun_ : R + L => No)
(funr0 : R =>
xR r0 +
{{ funr1 : R => negate (xR r1) |
(funl0 : L => negate (xL l0))//nxcut }})
(funr0 : L =>
{{ xL | xR//xcut }} + negate (xL r0)) r
{{ sum_ind (fun_ : L + R => No)
(funl : L =>
xL l +
{{ funr : R => negate (xR r) | (funl0 : L =>
negate (xL l0))//nxcut }})
(funl : R => {{ xL | xR//xcut }} + negate (xR l)) |
sum_ind (fun_ : R + L => No)
(funr : R =>
xR r +
{{ funr0 : R => negate (xR r0) | (funl : L =>
negate (xL l))//nxcut }})
(funr : L => {{ xL | xR//xcut }} + negate (xL r))//cut }} <=
zero
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type H1: HasNegation S L, R: Type s: InSort S L R xL: L -> GenNo S xR: R -> GenNo S xcut: forall (l : L) (r : R), xL l < xR r IHL: foralll : L, xL l + negate (xL l) = zero IHR: forallr : R, xR r + negate (xR r) = zero nxcut: forall (r : R) (l : L),
negate (xR r) < negate (xL l) cut: forall (l : L + R) (r : R + L),
sum_ind (fun_ : L + R => No)
(funl0 : L =>
xL l0 +
{{ funr0 : R => negate (xR r0) |
(funl1 : L => negate (xL l1))//nxcut }})
(funl0 : R =>
{{ xL | xR//xcut }} + negate (xR l0)) l <
sum_ind (fun_ : R + L => No)
(funr0 : R =>
xR r0 +
{{ funr1 : R => negate (xR r1) |
(funl0 : L => negate (xL l0))//nxcut }})
(funr0 : L =>
{{ xL | xR//xcut }} + negate (xL r0)) r l: L
xL l +
{{ funr : R => negate (xR r) | (funl : L =>
negate (xL l))//nxcut }} <
{{ Empty_rec | Empty_rec//lempty_cut }}
H: Univalence S: OptionSort H0: HasAddition S No:= GenNo S: Type H1: HasNegation S L, R: Type s: InSort S L R xL: L -> GenNo S xR: R -> GenNo S xcut: forall (l : L) (r : R), xL l < xR r IHL: foralll : L, xL l + negate (xL l) = zero IHR: forallr : R, xR r + negate (xR r) = zero nxcut: forall (r : R) (l : L),
negate (xR r) < negate (xL l) cut: forall (l : L + R) (r : R + L),
sum_ind (fun_ : L + R => No)
(funl0 : L =>
xL l0 +
{{ funr0 : R => negate (xR r0) |
(funl1 : L => negate (xL l1))//nxcut }})
(funl0 : R =>
{{ xL | xR//xcut }} + negate (xR l0)) l <
sum_ind (fun_ : R + L => No)
(funr0 : R =>
xR r0 +
{{ funr1 : R => negate (xR r1) |
(funl0 : L => negate (xL l0))//nxcut }})
(funr0 : L =>
{{ xL | xR//xcut }} + negate (xL r0)) r r: R