[GOAL]
C : Type u_1
inst✝³ : Category.{v, u_1} C
inst✝² : Preadditive C
inst✝¹ : HasFiniteBiproducts C
J : Type
inst✝ : Finite J
F : J → Karoubi C
⊢ ((biproduct.map fun j => (F j).p) ≫ biproduct.map fun j => (F j).p) = biproduct.map fun j => (F j).p
[PROOFSTEP]
ext
[GOAL]
case w.w
C : Type u_1
inst✝³ : Category.{v, u_1} C
inst✝² : Preadditive C
inst✝¹ : HasFiniteBiproducts C
J : Type
inst✝ : Finite J
F : J → Karoubi C
j✝¹ j✝ : J
⊢ biproduct.ι (fun j => (F j).X) j✝ ≫
      ((biproduct.map fun j => (F j).p) ≫ biproduct.map fun j => (F j).p) ≫ biproduct.π (fun j => (F j).X) j✝¹ =
    biproduct.ι (fun j => (F j).X) j✝ ≫ (biproduct.map fun j => (F j).p) ≫ biproduct.π (fun j => (F j).X) j✝¹
[PROOFSTEP]
simp only [assoc, biproduct.map_π, biproduct.map_π_assoc, idem]
[GOAL]
C : Type u_1
inst✝³ : Category.{v, u_1} C
inst✝² : Preadditive C
inst✝¹ : HasFiniteBiproducts C
J : Type
inst✝ : Finite J
F : J → Karoubi C
j : J
⊢ (biproduct.map fun j => (F j).p) ≫ Bicone.π (biproduct.bicone fun j => (F j).X) j =
    (mk (⨁ fun j => (F j).X) (biproduct.map fun j => (F j).p)).p ≫
      ((biproduct.map fun j => (F j).p) ≫ Bicone.π (biproduct.bicone fun j => (F j).X) j) ≫ (F j).p
[PROOFSTEP]
simp only [assoc, biproduct.bicone_π, biproduct.map_π, biproduct.map_π_assoc, (F j).idem]
[GOAL]
C : Type u_1
inst✝³ : Category.{v, u_1} C
inst✝² : Preadditive C
inst✝¹ : HasFiniteBiproducts C
J : Type
inst✝ : Finite J
F : J → Karoubi C
j : J
⊢ (biproduct.ι (fun j => (F j).X) j ≫ biproduct.map fun j => (F j).p) =
    (F j).p ≫
      (biproduct.ι (fun j => (F j).X) j ≫ biproduct.map fun j => (F j).p) ≫
        (mk (⨁ fun j => (F j).X) (biproduct.map fun j => (F j).p)).p
[PROOFSTEP]
simp only [biproduct.ι_map, assoc, idem_assoc]
[GOAL]
C : Type u_1
inst✝³ : Category.{v, u_1} C
inst✝² : Preadditive C
inst✝¹ : HasFiniteBiproducts C
J : Type
inst✝ : Finite J
F : J → Karoubi C
j j' : J
⊢ (fun j => Hom.mk (biproduct.ι (fun j => (F j).X) j ≫ biproduct.map fun j => (F j).p)) j ≫
      (fun j => Hom.mk ((biproduct.map fun j => (F j).p) ≫ Bicone.π (biproduct.bicone fun j => (F j).X) j)) j' =
    if h : j = j' then eqToHom (_ : F j = F j') else 0
[PROOFSTEP]
split_ifs with h
[GOAL]
case pos
C : Type u_1
inst✝³ : Category.{v, u_1} C
inst✝² : Preadditive C
inst✝¹ : HasFiniteBiproducts C
J : Type
inst✝ : Finite J
F : J → Karoubi C
j j' : J
h : j = j'
⊢ (fun j => Hom.mk (biproduct.ι (fun j => (F j).X) j ≫ biproduct.map fun j => (F j).p)) j ≫
      (fun j => Hom.mk ((biproduct.map fun j => (F j).p) ≫ Bicone.π (biproduct.bicone fun j => (F j).X) j)) j' =
    eqToHom (_ : F j = F j')
[PROOFSTEP]
subst h
[GOAL]
case pos
C : Type u_1
inst✝³ : Category.{v, u_1} C
inst✝² : Preadditive C
inst✝¹ : HasFiniteBiproducts C
J : Type
inst✝ : Finite J
F : J → Karoubi C
j : J
⊢ (fun j => Hom.mk (biproduct.ι (fun j => (F j).X) j ≫ biproduct.map fun j => (F j).p)) j ≫
      (fun j => Hom.mk ((biproduct.map fun j => (F j).p) ≫ Bicone.π (biproduct.bicone fun j => (F j).X) j)) j =
    eqToHom (_ : F j = F j)
[PROOFSTEP]
simp only [biproduct.ι_map, biproduct.bicone_π, biproduct.map_π, eqToHom_refl, id_eq, hom_ext_iff, comp_f, assoc,
  bicone_ι_π_self_assoc, idem]
[GOAL]
case neg
C : Type u_1
inst✝³ : Category.{v, u_1} C
inst✝² : Preadditive C
inst✝¹ : HasFiniteBiproducts C
J : Type
inst✝ : Finite J
F : J → Karoubi C
j j' : J
h : ¬j = j'
⊢ (fun j => Hom.mk (biproduct.ι (fun j => (F j).X) j ≫ biproduct.map fun j => (F j).p)) j ≫
      (fun j => Hom.mk ((biproduct.map fun j => (F j).p) ≫ Bicone.π (biproduct.bicone fun j => (F j).X) j)) j' =
    0
[PROOFSTEP]
dsimp
[GOAL]
case neg
C : Type u_1
inst✝³ : Category.{v, u_1} C
inst✝² : Preadditive C
inst✝¹ : HasFiniteBiproducts C
J : Type
inst✝ : Finite J
F : J → Karoubi C
j j' : J
h : ¬j = j'
⊢ Hom.mk (biproduct.ι (fun j => (F j).X) j ≫ biproduct.map fun j => (F j).p) ≫
      Hom.mk ((biproduct.map fun j => (F j).p) ≫ biproduct.π (fun j => (F j).X) j') =
    Hom.mk 0
[PROOFSTEP]
simp only [hom_ext_iff, biproduct.ι_map, biproduct.map_π, comp_f, assoc, ne_eq, biproduct.ι_π_ne_assoc _ h, comp_zero,
  zero_comp]
[GOAL]
C : Type u_1
inst✝² : Category.{v, u_1} C
inst✝¹ : Preadditive C
inst✝ : HasFiniteBiproducts C
n : ℕ
F : Fin n → Karoubi C
⊢ HasBiproduct F
[PROOFSTEP]
apply hasBiproduct_of_total (Biproducts.bicone F)
[GOAL]
C : Type u_1
inst✝² : Category.{v, u_1} C
inst✝¹ : Preadditive C
inst✝ : HasFiniteBiproducts C
n : ℕ
F : Fin n → Karoubi C
⊢ (Finset.sum Finset.univ fun j => Bicone.π (Biproducts.bicone F) j ≫ Bicone.ι (Biproducts.bicone F) j) =
    𝟙 (Biproducts.bicone F).pt
[PROOFSTEP]
simp only [hom_ext_iff]
[GOAL]
C : Type u_1
inst✝² : Category.{v, u_1} C
inst✝¹ : Preadditive C
inst✝ : HasFiniteBiproducts C
n : ℕ
F : Fin n → Karoubi C
⊢ (Finset.sum Finset.univ fun j => Bicone.π (Biproducts.bicone F) j ≫ Bicone.ι (Biproducts.bicone F) j).f =
    (𝟙 (Biproducts.bicone F).pt).f
[PROOFSTEP]
refine' biproduct.hom_ext' _ _ (fun j => _)
[GOAL]
C : Type u_1
inst✝² : Category.{v, u_1} C
inst✝¹ : Preadditive C
inst✝ : HasFiniteBiproducts C
n : ℕ
F : Fin n → Karoubi C
j : Fin n
⊢ biproduct.ι (fun j => (F j).X) j ≫
      (Finset.sum Finset.univ fun j => Bicone.π (Biproducts.bicone F) j ≫ Bicone.ι (Biproducts.bicone F) j).f =
    biproduct.ι (fun j => (F j).X) j ≫ (𝟙 (Biproducts.bicone F).pt).f
[PROOFSTEP]
simp only [Biproducts.bicone_pt_X, sum_hom, comp_f, Biproducts.bicone_π_f, biproduct.bicone_π, biproduct.map_π,
  Biproducts.bicone_ι_f, biproduct.ι_map, assoc, idem_assoc, id_eq, Biproducts.bicone_pt_p, comp_sum]
[GOAL]
C : Type u_1
inst✝² : Category.{v, u_1} C
inst✝¹ : Preadditive C
inst✝ : HasFiniteBiproducts C
n : ℕ
F : Fin n → Karoubi C
j : Fin n
⊢ (Finset.sum Finset.univ fun j_1 =>
      biproduct.ι (fun j => (F j).X) j ≫
        biproduct.π (fun b => (F b).X) j_1 ≫ (F j_1).p ≫ biproduct.ι (fun j => (F j).X) j_1) =
    (F j).p ≫ biproduct.ι (fun j => (F j).X) j
[PROOFSTEP]
rw [Finset.sum_eq_single j]
[GOAL]
C : Type u_1
inst✝² : Category.{v, u_1} C
inst✝¹ : Preadditive C
inst✝ : HasFiniteBiproducts C
n : ℕ
F : Fin n → Karoubi C
j : Fin n
⊢ biproduct.ι (fun j => (F j).X) j ≫ biproduct.π (fun b => (F b).X) j ≫ (F j).p ≫ biproduct.ι (fun j => (F j).X) j =
    (F j).p ≫ biproduct.ι (fun j => (F j).X) j
[PROOFSTEP]
simp only [bicone_ι_π_self_assoc]
[GOAL]
case h₀
C : Type u_1
inst✝² : Category.{v, u_1} C
inst✝¹ : Preadditive C
inst✝ : HasFiniteBiproducts C
n : ℕ
F : Fin n → Karoubi C
j : Fin n
⊢ ∀ (b : Fin n),
    b ∈ Finset.univ →
      b ≠ j →
        biproduct.ι (fun j => (F j).X) j ≫
            biproduct.π (fun b => (F b).X) b ≫ (F b).p ≫ biproduct.ι (fun j => (F j).X) b =
          0
[PROOFSTEP]
intro b _ hb
[GOAL]
case h₀
C : Type u_1
inst✝² : Category.{v, u_1} C
inst✝¹ : Preadditive C
inst✝ : HasFiniteBiproducts C
n : ℕ
F : Fin n → Karoubi C
j b : Fin n
a✝ : b ∈ Finset.univ
hb : b ≠ j
⊢ biproduct.ι (fun j => (F j).X) j ≫ biproduct.π (fun b => (F b).X) b ≫ (F b).p ≫ biproduct.ι (fun j => (F j).X) b = 0
[PROOFSTEP]
simp only [biproduct.ι_π_ne_assoc _ hb.symm, zero_comp]
[GOAL]
case h₁
C : Type u_1
inst✝² : Category.{v, u_1} C
inst✝¹ : Preadditive C
inst✝ : HasFiniteBiproducts C
n : ℕ
F : Fin n → Karoubi C
j : Fin n
⊢ ¬j ∈ Finset.univ →
    biproduct.ι (fun j => (F j).X) j ≫ biproduct.π (fun b => (F b).X) j ≫ (F j).p ≫ biproduct.ι (fun j => (F j).X) j = 0
[PROOFSTEP]
intro hj
[GOAL]
case h₁
C : Type u_1
inst✝² : Category.{v, u_1} C
inst✝¹ : Preadditive C
inst✝ : HasFiniteBiproducts C
n : ℕ
F : Fin n → Karoubi C
j : Fin n
hj : ¬j ∈ Finset.univ
⊢ biproduct.ι (fun j => (F j).X) j ≫ biproduct.π (fun b => (F b).X) j ≫ (F j).p ≫ biproduct.ι (fun j => (F j).X) j = 0
[PROOFSTEP]
simp only [Finset.mem_univ, not_true] at hj
[GOAL]
C : Type u_1
inst✝¹ : Category.{v, u_1} C
inst✝ : Preadditive C
P : Karoubi C
⊢ decompId_i P ≫ decompId_p (complement P) = 0
[PROOFSTEP]
simp only [instAddCommGroupHom_zero, hom_ext_iff, complement_X, comp_f, decompId_i_f, decompId_p_f, complement_p,
  comp_sub, comp_id, idem, sub_self]
[GOAL]
C : Type u_1
inst✝¹ : Category.{v, u_1} C
inst✝ : Preadditive C
P : Karoubi C
⊢ decompId_i (complement P) ≫ decompId_p P = 0
[PROOFSTEP]
simp only [instAddCommGroupHom_zero, hom_ext_iff, complement_X, comp_f, decompId_i_f, complement_p, decompId_p_f,
  sub_comp, id_comp, idem, sub_self]
[GOAL]
C : Type u_1
inst✝¹ : Category.{v, u_1} C
inst✝ : Preadditive C
P : Karoubi C
⊢ (BinaryBicone.mk (mk P.X (𝟙 P.X)) (decompId_p P) (decompId_p (complement P)) (decompId_i P)
            (decompId_i (complement P))).fst ≫
        (BinaryBicone.mk (mk P.X (𝟙 P.X)) (decompId_p P) (decompId_p (complement P)) (decompId_i P)
            (decompId_i (complement P))).inl +
      (BinaryBicone.mk (mk P.X (𝟙 P.X)) (decompId_p P) (decompId_p (complement P)) (decompId_i P)
            (decompId_i (complement P))).snd ≫
        (BinaryBicone.mk (mk P.X (𝟙 P.X)) (decompId_p P) (decompId_p (complement P)) (decompId_i P)
            (decompId_i (complement P))).inr =
    𝟙
      (BinaryBicone.mk (mk P.X (𝟙 P.X)) (decompId_p P) (decompId_p (complement P)) (decompId_i P)
          (decompId_i (complement P))).pt
[PROOFSTEP]
simp only [id_eq, complement_X, comp_f, decompId_i_f, decompId_p_f, complement_p, instAddCommGroupHom_add, idem,
  comp_sub, comp_id, sub_comp, id_comp, sub_self, sub_zero, add_sub_cancel'_right]
[GOAL]
C : Type u_1
inst✝¹ : Category.{v, u_1} C
inst✝ : Preadditive C
P : Karoubi C
⊢ biprod.desc (decompId_i P) (decompId_i (complement P)) ≫ biprod.lift (decompId_p P) (decompId_p (complement P)) =
    𝟙 (P ⊞ complement P)
[PROOFSTEP]
apply biprod.hom_ext'
[GOAL]
case h₀
C : Type u_1
inst✝¹ : Category.{v, u_1} C
inst✝ : Preadditive C
P : Karoubi C
⊢ biprod.inl ≫
      biprod.desc (decompId_i P) (decompId_i (complement P)) ≫ biprod.lift (decompId_p P) (decompId_p (complement P)) =
    biprod.inl ≫ 𝟙 (P ⊞ complement P)
[PROOFSTEP]
rw [biprod.inl_desc_assoc, comp_id, biprod.lift_eq, comp_add, ← decompId_assoc, add_right_eq_self, ← assoc]
[GOAL]
case h₀
C : Type u_1
inst✝¹ : Category.{v, u_1} C
inst✝ : Preadditive C
P : Karoubi C
⊢ (decompId_i P ≫ decompId_p (complement P)) ≫ biprod.inr = 0
[PROOFSTEP]
refine' (_ =≫ _).trans zero_comp
[GOAL]
case h₀
C : Type u_1
inst✝¹ : Category.{v, u_1} C
inst✝ : Preadditive C
P : Karoubi C
⊢ decompId_i P ≫ decompId_p (complement P) = 0
[PROOFSTEP]
ext
[GOAL]
case h₀.h
C : Type u_1
inst✝¹ : Category.{v, u_1} C
inst✝ : Preadditive C
P : Karoubi C
⊢ (decompId_i P ≫ decompId_p (complement P)).f = 0.f
[PROOFSTEP]
simp only [comp_f, toKaroubi_obj_X, decompId_i_f, decompId_p_f, complement_p, comp_sub, comp_id, idem, sub_self,
  instAddCommGroupHom_zero]
[GOAL]
case h₁
C : Type u_1
inst✝¹ : Category.{v, u_1} C
inst✝ : Preadditive C
P : Karoubi C
⊢ biprod.inr ≫
      biprod.desc (decompId_i P) (decompId_i (complement P)) ≫ biprod.lift (decompId_p P) (decompId_p (complement P)) =
    biprod.inr ≫ 𝟙 (P ⊞ complement P)
[PROOFSTEP]
rw [biprod.inr_desc_assoc, comp_id, biprod.lift_eq, comp_add, ← decompId_assoc, add_left_eq_self, ← assoc]
[GOAL]
case h₁
C : Type u_1
inst✝¹ : Category.{v, u_1} C
inst✝ : Preadditive C
P : Karoubi C
⊢ (decompId_i (complement P) ≫ decompId_p P) ≫ biprod.inl = 0
[PROOFSTEP]
refine' (_ =≫ _).trans zero_comp
[GOAL]
case h₁
C : Type u_1
inst✝¹ : Category.{v, u_1} C
inst✝ : Preadditive C
P : Karoubi C
⊢ decompId_i (complement P) ≫ decompId_p P = 0
[PROOFSTEP]
ext
[GOAL]
case h₁.h
C : Type u_1
inst✝¹ : Category.{v, u_1} C
inst✝ : Preadditive C
P : Karoubi C
⊢ (decompId_i (complement P) ≫ decompId_p P).f = 0.f
[PROOFSTEP]
simp only [complement_X, comp_f, decompId_i_f, complement_p, decompId_p_f, sub_comp, id_comp, idem, sub_self,
  instAddCommGroupHom_zero]
[GOAL]
C : Type u_1
inst✝¹ : Category.{v, u_1} C
inst✝ : Preadditive C
P : Karoubi C
⊢ biprod.lift (decompId_p P) (decompId_p (complement P)) ≫ biprod.desc (decompId_i P) (decompId_i (complement P)) =
    𝟙 ((toKaroubi C).obj P.X)
[PROOFSTEP]
simp only [biprod.lift_desc, instAddCommGroupHom_add, toKaroubi_obj_X, comp_f, decompId_p_f, decompId_i_f, idem,
  complement_X, complement_p, comp_sub, comp_id, sub_comp, id_comp, sub_self, sub_zero, add_sub_cancel'_right, id_eq,
  toKaroubi_obj_p]


[GOAL]
α : Type ?u.3173
ι : Type ?u.3179
κ : Type ?u.3180
C : (ι → Option α) → κ
⊢ Inhabited (ColorFocused C)
[PROOFSTEP]
refine' ⟨⟨0, fun _ => none, fun h => _, Multiset.nodup_zero⟩⟩
[GOAL]
α : Type ?u.3173
ι : Type ?u.3179
κ : Type ?u.3180
C : (ι → Option α) → κ
h : AlmostMono C
⊢ h ∈ 0 → (fun x i => Option.getD (idxFun h.line i) x) none = fun x => none
[PROOFSTEP]
simp only [Multiset.not_mem_zero, IsEmpty.forall_iff]
[GOAL]
α : Type ?u.3673
α' : Type ?u.3677
ι : Type ?u.3674
f : α → α'
l : Line α ι
⊢ (fun i => Option.map f (idxFun l i)) (Exists.choose (_ : ∃ i, idxFun l i = none)) = none
[PROOFSTEP]
simp only [l.proper.choose_spec, Option.map_none']
[GOAL]
α : Type u_1
ι : Type u_2
l : Line α ι
x : α
i : ι
h : idxFun l i = none
⊢ (fun x i => Option.getD (idxFun l i) x) x i = x
[PROOFSTEP]
simp only [Option.getD_none, h, l.apply]
[GOAL]
α : Type u_1
ι : Type u_2
l : Line α ι
x : α
i : ι
h : idxFun l i ≠ none
⊢ some ((fun x i => Option.getD (idxFun l i) x) x i) = idxFun l i
[PROOFSTEP]
rw [l.apply, Option.getD_of_ne_none h]
[GOAL]
α : Type u_1
α' : Type u_2
ι : Type u_3
f : α → α'
l : Line α ι
x : α
⊢ (fun x i => Option.getD (idxFun (map f l) i) x) (f x) = f ∘ (fun x i => Option.getD (idxFun l i) x) x
[PROOFSTEP]
simp only [Line.apply, Line.map, Option.getD_map]
[GOAL]
α : Type u_1
α' : Type u_2
ι : Type u_3
f : α → α'
l : Line α ι
x : α
⊢ (fun i => f (Option.getD (idxFun l i) x)) = f ∘ fun i => Option.getD (idxFun l i) x
[PROOFSTEP]
rfl
[GOAL]
α : Type u_1
ι : Type u_2
ι' : Type u_3
v : ι → α
l : Line α ι'
x : α
⊢ (fun x i => Option.getD (idxFun (vertical v l) i) x) x = Sum.elim v ((fun x i => Option.getD (idxFun l i) x) x)
[PROOFSTEP]
funext i
[GOAL]
case h
α : Type u_1
ι : Type u_2
ι' : Type u_3
v : ι → α
l : Line α ι'
x : α
i : ι ⊕ ι'
⊢ (fun x i => Option.getD (idxFun (vertical v l) i) x) x i = Sum.elim v ((fun x i => Option.getD (idxFun l i) x) x) i
[PROOFSTEP]
cases i
[GOAL]
case h.inl
α : Type u_1
ι : Type u_2
ι' : Type u_3
v : ι → α
l : Line α ι'
x : α
val✝ : ι
⊢ (fun x i => Option.getD (idxFun (vertical v l) i) x) x (Sum.inl val✝) =
    Sum.elim v ((fun x i => Option.getD (idxFun l i) x) x) (Sum.inl val✝)
[PROOFSTEP]
rfl
[GOAL]
case h.inr
α : Type u_1
ι : Type u_2
ι' : Type u_3
v : ι → α
l : Line α ι'
x : α
val✝ : ι'
⊢ (fun x i => Option.getD (idxFun (vertical v l) i) x) x (Sum.inr val✝) =
    Sum.elim v ((fun x i => Option.getD (idxFun l i) x) x) (Sum.inr val✝)
[PROOFSTEP]
rfl
[GOAL]
α : Type u_1
ι : Type u_2
ι' : Type u_3
l : Line α ι
v : ι' → α
x : α
⊢ (fun x i => Option.getD (idxFun (horizontal l v) i) x) x = Sum.elim ((fun x i => Option.getD (idxFun l i) x) x) v
[PROOFSTEP]
funext i
[GOAL]
case h
α : Type u_1
ι : Type u_2
ι' : Type u_3
l : Line α ι
v : ι' → α
x : α
i : ι ⊕ ι'
⊢ (fun x i => Option.getD (idxFun (horizontal l v) i) x) x i = Sum.elim ((fun x i => Option.getD (idxFun l i) x) x) v i
[PROOFSTEP]
cases i
[GOAL]
case h.inl
α : Type u_1
ι : Type u_2
ι' : Type u_3
l : Line α ι
v : ι' → α
x : α
val✝ : ι
⊢ (fun x i => Option.getD (idxFun (horizontal l v) i) x) x (Sum.inl val✝) =
    Sum.elim ((fun x i => Option.getD (idxFun l i) x) x) v (Sum.inl val✝)
[PROOFSTEP]
rfl
[GOAL]
case h.inr
α : Type u_1
ι : Type u_2
ι' : Type u_3
l : Line α ι
v : ι' → α
x : α
val✝ : ι'
⊢ (fun x i => Option.getD (idxFun (horizontal l v) i) x) x (Sum.inr val✝) =
    Sum.elim ((fun x i => Option.getD (idxFun l i) x) x) v (Sum.inr val✝)
[PROOFSTEP]
rfl
[GOAL]
α : Type u_1
ι : Type u_2
ι' : Type u_3
l : Line α ι
l' : Line α ι'
x : α
⊢ (fun x i => Option.getD (idxFun (prod l l') i) x) x =
    Sum.elim ((fun x i => Option.getD (idxFun l i) x) x) ((fun x i => Option.getD (idxFun l' i) x) x)
[PROOFSTEP]
funext i
[GOAL]
case h
α : Type u_1
ι : Type u_2
ι' : Type u_3
l : Line α ι
l' : Line α ι'
x : α
i : ι ⊕ ι'
⊢ (fun x i => Option.getD (idxFun (prod l l') i) x) x i =
    Sum.elim ((fun x i => Option.getD (idxFun l i) x) x) ((fun x i => Option.getD (idxFun l' i) x) x) i
[PROOFSTEP]
cases i
[GOAL]
case h.inl
α : Type u_1
ι : Type u_2
ι' : Type u_3
l : Line α ι
l' : Line α ι'
x : α
val✝ : ι
⊢ (fun x i => Option.getD (idxFun (prod l l') i) x) x (Sum.inl val✝) =
    Sum.elim ((fun x i => Option.getD (idxFun l i) x) x) ((fun x i => Option.getD (idxFun l' i) x) x) (Sum.inl val✝)
[PROOFSTEP]
rfl
[GOAL]
case h.inr
α : Type u_1
ι : Type u_2
ι' : Type u_3
l : Line α ι
l' : Line α ι'
x : α
val✝ : ι'
⊢ (fun x i => Option.getD (idxFun (prod l l') i) x) x (Sum.inr val✝) =
    Sum.elim ((fun x i => Option.getD (idxFun l i) x) x) ((fun x i => Option.getD (idxFun l' i) x) x) (Sum.inr val✝)
[PROOFSTEP]
rfl
[GOAL]
α : Type u_1
ι : Type u_2
inst✝ : Nonempty ι
x : α
⊢ (fun x i => Option.getD (idxFun (diagonal α ι) i) x) x = fun x_1 => x
[PROOFSTEP]
simp_rw [Line.diagonal, Option.getD_none]
[GOAL]
α α' : Type u
e : α ≃ α'
κ : Type (max v u)
x✝¹ : Finite κ
ι : Type
x✝ : Fintype ι
h : ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
C : (ι → α') → κ
l : Line α ι
c : κ
lc : ∀ (x : α), (fun v => C (↑e ∘ v)) ((fun x i => Option.getD (idxFun l i) x) x) = c
x : α
⊢ C ((fun x i => Option.getD (idxFun (map (↑e) l) i) x) (↑e x)) = c
[PROOFSTEP]
rw [← lc x, Line.map_apply]
[GOAL]
⊢ ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → PEmpty) → κ), ∃ l, IsMono C l
[PROOFSTEP]
intro κ _
[GOAL]
κ : Type (max v u)
inst✝ : Finite κ
⊢ ∃ ι x, ∀ (C : (ι → PEmpty) → κ), ∃ l, IsMono C l
[PROOFSTEP]
by_cases h : Nonempty κ
[GOAL]
case pos
κ : Type (max v u)
inst✝ : Finite κ
h : Nonempty κ
⊢ ∃ ι x, ∀ (C : (ι → PEmpty) → κ), ∃ l, IsMono C l
[PROOFSTEP]
refine' ⟨Unit, inferInstance, fun C => ⟨default, Classical.arbitrary _, PEmpty.rec⟩⟩
[GOAL]
case neg
κ : Type (max v u)
inst✝ : Finite κ
h : ¬Nonempty κ
⊢ ∃ ι x, ∀ (C : (ι → PEmpty) → κ), ∃ l, IsMono C l
[PROOFSTEP]
exact ⟨Empty, inferInstance, fun C => (h ⟨C (Empty.rec)⟩).elim⟩
[GOAL]
⊢ ∀ {α : Type u} [inst : Fintype α],
    (∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l) →
      ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → Option α) → κ), ∃ l, IsMono C l
[PROOFSTEP]
intro α _ ihα κ _
[GOAL]
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
⊢ ∃ ι x, ∀ (C : (ι → Option α) → κ), ∃ l, IsMono C l
[PROOFSTEP]
cases nonempty_fintype κ
[GOAL]
case intro
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
⊢ ∃ ι x, ∀ (C : (ι → Option α) → κ), ∃ l, IsMono C l
[PROOFSTEP]
by_cases h : Nonempty α
[GOAL]
case pos
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
⊢ ∃ ι x, ∀ (C : (ι → Option α) → κ), ∃ l, IsMono C l
case neg
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : ¬Nonempty α
⊢ ∃ ι x, ∀ (C : (ι → Option α) → κ), ∃ l, IsMono C l
[PROOFSTEP]
case neg =>
  refine' ⟨Unit, inferInstance, fun C => ⟨diagonal _ Unit, C fun _ => none, ?_⟩⟩
  rintro (_ | ⟨a⟩)
  · rfl
  · exact (h ⟨a⟩).elim
[GOAL]
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : ¬Nonempty α
⊢ ∃ ι x, ∀ (C : (ι → Option α) → κ), ∃ l, IsMono C l
[PROOFSTEP]
case neg =>
  refine' ⟨Unit, inferInstance, fun C => ⟨diagonal _ Unit, C fun _ => none, ?_⟩⟩
  rintro (_ | ⟨a⟩)
  · rfl
  · exact (h ⟨a⟩).elim
[GOAL]
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : ¬Nonempty α
⊢ ∃ ι x, ∀ (C : (ι → Option α) → κ), ∃ l, IsMono C l
[PROOFSTEP]
refine' ⟨Unit, inferInstance, fun C => ⟨diagonal _ Unit, C fun _ => none, ?_⟩⟩
[GOAL]
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : ¬Nonempty α
C : (Unit → Option α) → κ
⊢ ∀ (x : Option α), C ((fun x i => Option.getD (idxFun (diagonal (Option α) Unit) i) x) x) = C fun x => none
[PROOFSTEP]
rintro (_ | ⟨a⟩)
[GOAL]
case none
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : ¬Nonempty α
C : (Unit → Option α) → κ
⊢ C ((fun x i => Option.getD (idxFun (diagonal (Option α) Unit) i) x) none) = C fun x => none
[PROOFSTEP]
rfl
[GOAL]
case some
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : ¬Nonempty α
C : (Unit → Option α) → κ
a : α
⊢ C ((fun x i => Option.getD (idxFun (diagonal (Option α) Unit) i) x) (some a)) = C fun x => none
[PROOFSTEP]
exact (h ⟨a⟩).elim
[GOAL]
case pos
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
⊢ ∃ ι x, ∀ (C : (ι → Option α) → κ), ∃ l, IsMono C l
[PROOFSTEP]
suffices key :
  ∀ r : ℕ,
    ∃ (ι : Type) (_ : Fintype ι),
      ∀ C : (ι → Option α) → κ, (∃ s : ColorFocused C, Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
[GOAL]
case pos
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
key : ∀ (r : ℕ), ∃ ι x, ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
⊢ ∃ ι x, ∀ (C : (ι → Option α) → κ), ∃ l, IsMono C l
[PROOFSTEP]
obtain ⟨ι, _inst, hι⟩ := key (Fintype.card κ + 1)
[GOAL]
case pos.intro.intro
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
key : ∀ (r : ℕ), ∃ ι x, ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
ι : Type
_inst : Fintype ι
hι : ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = Fintype.card κ + 1) ∨ ∃ l, IsMono C l
⊢ ∃ ι x, ∀ (C : (ι → Option α) → κ), ∃ l, IsMono C l
[PROOFSTEP]
refine' ⟨ι, _inst, fun C => (hι C).resolve_left _⟩
[GOAL]
case pos.intro.intro
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
key : ∀ (r : ℕ), ∃ ι x, ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
ι : Type
_inst : Fintype ι
hι : ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = Fintype.card κ + 1) ∨ ∃ l, IsMono C l
C : (ι → Option α) → κ
⊢ ¬∃ s, ↑Multiset.card s.lines = Fintype.card κ + 1
[PROOFSTEP]
rintro ⟨s, sr⟩
[GOAL]
case pos.intro.intro.intro
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
key : ∀ (r : ℕ), ∃ ι x, ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
ι : Type
_inst : Fintype ι
hι : ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = Fintype.card κ + 1) ∨ ∃ l, IsMono C l
C : (ι → Option α) → κ
s : ColorFocused C
sr : ↑Multiset.card s.lines = Fintype.card κ + 1
⊢ False
[PROOFSTEP]
apply Nat.not_succ_le_self (Fintype.card κ)
[GOAL]
case pos.intro.intro.intro
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
key : ∀ (r : ℕ), ∃ ι x, ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
ι : Type
_inst : Fintype ι
hι : ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = Fintype.card κ + 1) ∨ ∃ l, IsMono C l
C : (ι → Option α) → κ
s : ColorFocused C
sr : ↑Multiset.card s.lines = Fintype.card κ + 1
⊢ Nat.succ (Fintype.card κ) ≤ Fintype.card κ
[PROOFSTEP]
rw [← Nat.add_one, ← sr, ← Multiset.card_map, ← Finset.card_mk]
[GOAL]
case pos.intro.intro.intro
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
key : ∀ (r : ℕ), ∃ ι x, ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
ι : Type
_inst : Fintype ι
hι : ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = Fintype.card κ + 1) ∨ ∃ l, IsMono C l
C : (ι → Option α) → κ
s : ColorFocused C
sr : ↑Multiset.card s.lines = Fintype.card κ + 1
⊢ Finset.card { val := Multiset.map ?pos.intro.intro.intro.f✝ s.lines, nodup := ?m.16664 } ≤ Fintype.card κ
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
key : ∀ (r : ℕ), ∃ ι x, ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
ι : Type
_inst : Fintype ι
hι : ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = Fintype.card κ + 1) ∨ ∃ l, IsMono C l
C : (ι → Option α) → κ
s : ColorFocused C
sr : ↑Multiset.card s.lines = Fintype.card κ + 1
⊢ Type ?u.16661
case pos.intro.intro.intro.f
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
key : ∀ (r : ℕ), ∃ ι x, ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
ι : Type
_inst : Fintype ι
hι : ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = Fintype.card κ + 1) ∨ ∃ l, IsMono C l
C : (ι → Option α) → κ
s : ColorFocused C
sr : ↑Multiset.card s.lines = Fintype.card κ + 1
⊢ AlmostMono C → ?m.16662
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
key : ∀ (r : ℕ), ∃ ι x, ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
ι : Type
_inst : Fintype ι
hι : ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = Fintype.card κ + 1) ∨ ∃ l, IsMono C l
C : (ι → Option α) → κ
s : ColorFocused C
sr : ↑Multiset.card s.lines = Fintype.card κ + 1
⊢ Multiset.Nodup (Multiset.map ?pos.intro.intro.intro.f✝ s.lines)
case pos.intro.intro.intro.f
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
key : ∀ (r : ℕ), ∃ ι x, ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
ι : Type
_inst : Fintype ι
hι : ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = Fintype.card κ + 1) ∨ ∃ l, IsMono C l
C : (ι → Option α) → κ
s : ColorFocused C
sr : ↑Multiset.card s.lines = Fintype.card κ + 1
⊢ AlmostMono C → ?m.16662
[PROOFSTEP]
exact
  Finset.card_le_univ
    ⟨_, s.distinct_colors⟩
      -- We now prove the key claim, by induction on `r`.
[GOAL]
case key
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
⊢ ∀ (r : ℕ), ∃ ι x, ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
[PROOFSTEP]
intro r
[GOAL]
case key
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
r : ℕ
⊢ ∃ ι x, ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
[PROOFSTEP]
induction' r with r ihr
[GOAL]
case key.zero
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
⊢ ∃ ι x, ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = Nat.zero) ∨ ∃ l, IsMono C l
[PROOFSTEP]
exact
  ⟨Empty, inferInstance, fun C => Or.inl ⟨default, Multiset.card_zero⟩⟩
    -- Supposing the key claim holds for `r`, we need to show it for `r+1`. First pick a high
        -- enough dimension `ι` for `r`.
[GOAL]
case key.succ
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
r : ℕ
ihr : ∃ ι x, ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
⊢ ∃ ι x, ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = Nat.succ r) ∨ ∃ l, IsMono C l
[PROOFSTEP]
obtain ⟨ι, _inst, hι⟩ := ihr
[GOAL]
case key.succ.intro.intro
α : Type u
inst✝¹ : Fintype α
ihα : ∀ (κ : Type (max v u)) [inst : Finite κ], ∃ ι x, ∀ (C : (ι → α) → κ), ∃ l, IsMono C l
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
r : ℕ
ι : Type
_inst : Fintype ι
hι : ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
⊢ ∃ ι x, ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = Nat.succ r) ∨ ∃ l, IsMono C l
[PROOFSTEP]
specialize ihα ((ι → Option α) → κ)
[GOAL]
case key.succ.intro.intro
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
r : ℕ
ι : Type
_inst : Fintype ι
hι : ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
ihα : ∃ ι_1 x, ∀ (C : (ι_1 → α) → (ι → Option α) → κ), ∃ l, IsMono C l
⊢ ∃ ι x, ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = Nat.succ r) ∨ ∃ l, IsMono C l
[PROOFSTEP]
obtain ⟨ι', _inst, hι'⟩ := ihα
[GOAL]
case key.succ.intro.intro.intro.intro
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
hι : ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
ι' : Type
_inst : Fintype ι'
hι' : ∀ (C : (ι' → α) → (ι → Option α) → κ), ∃ l, IsMono C l
⊢ ∃ ι x, ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = Nat.succ r) ∨ ∃ l, IsMono C l
[PROOFSTEP]
refine' ⟨Sum ι ι', inferInstance, _⟩
[GOAL]
case key.succ.intro.intro.intro.intro
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
hι : ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
ι' : Type
_inst : Fintype ι'
hι' : ∀ (C : (ι' → α) → (ι → Option α) → κ), ∃ l, IsMono C l
⊢ ∀ (C : (ι ⊕ ι' → Option α) → κ), (∃ s, ↑Multiset.card s.lines = Nat.succ r) ∨ ∃ l, IsMono C l
[PROOFSTEP]
intro C
[GOAL]
case key.succ.intro.intro.intro.intro
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
hι : ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
ι' : Type
_inst : Fintype ι'
hι' : ∀ (C : (ι' → α) → (ι → Option α) → κ), ∃ l, IsMono C l
C : (ι ⊕ ι' → Option α) → κ
⊢ (∃ s, ↑Multiset.card s.lines = Nat.succ r) ∨ ∃ l, IsMono C l
[PROOFSTEP]
specialize
  hι' fun v' v =>
    C
      (Sum.elim v (some ∘ v'))
        -- By choice of `ι'` this coloring has a monochromatic line `l'` with color class `C'`, where
            -- `C'` is a `κ`-coloring of `ι → α`.
[GOAL]
case key.succ.intro.intro.intro.intro
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
hι : ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
hι' : ∃ l, IsMono (fun v' v => C (Sum.elim v (some ∘ v'))) l
⊢ (∃ s, ↑Multiset.card s.lines = Nat.succ r) ∨ ∃ l, IsMono C l
[PROOFSTEP]
obtain ⟨l', C', hl'⟩ := hι'
[GOAL]
case key.succ.intro.intro.intro.intro.intro.intro
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
hι : ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
⊢ (∃ s, ↑Multiset.card s.lines = Nat.succ r) ∨ ∃ l, IsMono C l
[PROOFSTEP]
have mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l :=
  by
  rintro ⟨l, c, hl⟩
  refine' ⟨l.horizontal (some ∘ l' (Classical.arbitrary α)), c, fun x => _⟩
  rw [Line.horizontal_apply, ← hl, ← hl']
    -- By choice of `ι`, `C'` either has `r` color-focused lines or a monochromatic line.
[GOAL]
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
hι : ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
⊢ (∃ l, IsMono C' l) → ∃ l, IsMono C l
[PROOFSTEP]
rintro ⟨l, c, hl⟩
[GOAL]
case intro.intro
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
hι : ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
l : Line (Option α) ι
c : κ
hl : ∀ (x : Option α), C' ((fun x i => Option.getD (idxFun l i) x) x) = c
⊢ ∃ l, IsMono C l
[PROOFSTEP]
refine' ⟨l.horizontal (some ∘ l' (Classical.arbitrary α)), c, fun x => _⟩
[GOAL]
case intro.intro
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
hι : ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
l : Line (Option α) ι
c : κ
hl : ∀ (x : Option α), C' ((fun x i => Option.getD (idxFun l i) x) x) = c
x : Option α
⊢ C
      ((fun x i =>
          Option.getD
            (idxFun (horizontal l (some ∘ (fun x i => Option.getD (idxFun l' i) x) (Classical.arbitrary α))) i) x)
        x) =
    c
[PROOFSTEP]
rw [Line.horizontal_apply, ← hl, ← hl']
  -- By choice of `ι`, `C'` either has `r` color-focused lines or a monochromatic line.
[GOAL]
case key.succ.intro.intro.intro.intro.intro.intro
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
hι : ∀ (C : (ι → Option α) → κ), (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C l
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
⊢ (∃ s, ↑Multiset.card s.lines = Nat.succ r) ∨ ∃ l, IsMono C l
[PROOFSTEP]
specialize hι C'
[GOAL]
case key.succ.intro.intro.intro.intro.intro.intro
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
hι : (∃ s, ↑Multiset.card s.lines = r) ∨ ∃ l, IsMono C' l
⊢ (∃ s, ↑Multiset.card s.lines = Nat.succ r) ∨ ∃ l, IsMono C l
[PROOFSTEP]
rcases hι with (⟨s, sr⟩ | h)
[GOAL]
case key.succ.intro.intro.intro.intro.intro.intro.inl.intro
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
s : ColorFocused C'
sr : ↑Multiset.card s.lines = r
⊢ (∃ s, ↑Multiset.card s.lines = Nat.succ r) ∨ ∃ l, IsMono C l
case key.succ.intro.intro.intro.intro.intro.intro.inr
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h✝ : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
h : ∃ l, IsMono C' l
⊢ (∃ s, ↑Multiset.card s.lines = Nat.succ r) ∨ ∃ l, IsMono C l
[PROOFSTEP]
on_goal 2 =>
  exact
    Or.inr
      (mono_of_mono h)
        -- Here we assume `C'` has `r` color focused lines. We split into cases depending on whether
            -- one of these `r` lines has the same color as the focus point.
[GOAL]
case key.succ.intro.intro.intro.intro.intro.intro.inl.intro
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
s : ColorFocused C'
sr : ↑Multiset.card s.lines = r
⊢ (∃ s, ↑Multiset.card s.lines = Nat.succ r) ∨ ∃ l, IsMono C l
case key.succ.intro.intro.intro.intro.intro.intro.inr
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h✝ : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
h : ∃ l, IsMono C' l
⊢ (∃ s, ↑Multiset.card s.lines = Nat.succ r) ∨ ∃ l, IsMono C l
[PROOFSTEP]
on_goal 2 =>
  exact
    Or.inr
      (mono_of_mono h)
        -- Here we assume `C'` has `r` color focused lines. We split into cases depending on whether
            -- one of these `r` lines has the same color as the focus point.
[GOAL]
case key.succ.intro.intro.intro.intro.intro.intro.inr
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h✝ : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
h : ∃ l, IsMono C' l
⊢ (∃ s, ↑Multiset.card s.lines = Nat.succ r) ∨ ∃ l, IsMono C l
[PROOFSTEP]
exact
  Or.inr
    (mono_of_mono h)
      -- Here we assume `C'` has `r` color focused lines. We split into cases depending on whether
          -- one of these `r` lines has the same color as the focus point.
[GOAL]
case key.succ.intro.intro.intro.intro.intro.intro.inl.intro
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
s : ColorFocused C'
sr : ↑Multiset.card s.lines = r
⊢ (∃ s, ↑Multiset.card s.lines = Nat.succ r) ∨ ∃ l, IsMono C l
[PROOFSTEP]
by_cases h : ∃ p ∈ s.lines, (p : AlmostMono _).color = C' s.focus
[GOAL]
case pos
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h✝ : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
s : ColorFocused C'
sr : ↑Multiset.card s.lines = r
h : ∃ p, p ∈ s.lines ∧ p.color = C' s.focus
⊢ (∃ s, ↑Multiset.card s.lines = Nat.succ r) ∨ ∃ l, IsMono C l
[PROOFSTEP]
obtain ⟨p, p_mem, hp⟩ := h
[GOAL]
case pos.intro.intro
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
s : ColorFocused C'
sr : ↑Multiset.card s.lines = r
p : AlmostMono C'
p_mem : p ∈ s.lines
hp : p.color = C' s.focus
⊢ (∃ s, ↑Multiset.card s.lines = Nat.succ r) ∨ ∃ l, IsMono C l
[PROOFSTEP]
refine' Or.inr (mono_of_mono ⟨p.line, p.color, _⟩)
[GOAL]
case pos.intro.intro
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
s : ColorFocused C'
sr : ↑Multiset.card s.lines = r
p : AlmostMono C'
p_mem : p ∈ s.lines
hp : p.color = C' s.focus
⊢ ∀ (x : Option α), C' ((fun x i => Option.getD (idxFun p.line i) x) x) = p.color
[PROOFSTEP]
rintro (_ | _)
[GOAL]
case pos.intro.intro.none
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
s : ColorFocused C'
sr : ↑Multiset.card s.lines = r
p : AlmostMono C'
p_mem : p ∈ s.lines
hp : p.color = C' s.focus
⊢ C' ((fun x i => Option.getD (idxFun p.line i) x) none) = p.color
case pos.intro.intro.some
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝¹ : Fintype κ
h : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
s : ColorFocused C'
sr : ↑Multiset.card s.lines = r
p : AlmostMono C'
p_mem : p ∈ s.lines
hp : p.color = C' s.focus
val✝ : α
⊢ C' ((fun x i => Option.getD (idxFun p.line i) x) (some val✝)) = p.color
[PROOFSTEP]
rw [hp, s.is_focused p p_mem]
[GOAL]
case pos.intro.intro.some
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝¹ : Fintype κ
h : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
s : ColorFocused C'
sr : ↑Multiset.card s.lines = r
p : AlmostMono C'
p_mem : p ∈ s.lines
hp : p.color = C' s.focus
val✝ : α
⊢ C' ((fun x i => Option.getD (idxFun p.line i) x) (some val✝)) = p.color
[PROOFSTEP]
apply p.has_color
[GOAL]
case neg
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h✝ : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
s : ColorFocused C'
sr : ↑Multiset.card s.lines = r
h : ¬∃ p, p ∈ s.lines ∧ p.color = C' s.focus
⊢ (∃ s, ↑Multiset.card s.lines = Nat.succ r) ∨ ∃ l, IsMono C l
[PROOFSTEP]
refine'
  Or.inl
    ⟨⟨(s.lines.map _).cons ⟨(l'.map some).vertical s.focus, C' s.focus, fun x => _⟩,
        Sum.elim s.focus (l'.map some none), _, _⟩,
      _⟩
      -- Porting note: Needed to reorder the following two goals
          -- The product lines are almost monochromatic.
[GOAL]
case neg.refine'_1
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h✝ : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
s : ColorFocused C'
sr : ↑Multiset.card s.lines = r
h : ¬∃ p, p ∈ s.lines ∧ p.color = C' s.focus
⊢ AlmostMono C' → AlmostMono C
[PROOFSTEP]
refine' fun p => ⟨p.line.prod (l'.map some), p.color, fun x => _⟩
[GOAL]
case neg.refine'_1
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h✝ : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
s : ColorFocused C'
sr : ↑Multiset.card s.lines = r
h : ¬∃ p, p ∈ s.lines ∧ p.color = C' s.focus
p : AlmostMono C'
x : α
⊢ C ((fun x i => Option.getD (idxFun (prod p.line (map some l')) i) x) (some x)) = p.color
[PROOFSTEP]
rw [Line.prod_apply, Line.map_apply, ← p.has_color, ← congr_fun (hl' x)]
  -- The vertical line is almost monochromatic.
[GOAL]
case neg.refine'_2
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h✝ : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
s : ColorFocused C'
sr : ↑Multiset.card s.lines = r
h : ¬∃ p, p ∈ s.lines ∧ p.color = C' s.focus
x : α
⊢ C ((fun x i => Option.getD (idxFun (vertical s.focus (map some l')) i) x) (some x)) = C' s.focus
[PROOFSTEP]
rw [vertical_apply, ← congr_fun (hl' x), Line.map_apply]
  -- Our `r+1` lines have the same endpoint.
[GOAL]
case neg.refine'_3
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h✝ : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
s : ColorFocused C'
sr : ↑Multiset.card s.lines = r
h : ¬∃ p, p ∈ s.lines ∧ p.color = C' s.focus
⊢ ∀ (p : AlmostMono C),
    p ∈
        { line := vertical s.focus (map some l'), color := C' s.focus,
            has_color :=
              (_ :
                ∀ (x : α),
                  C ((fun x i => Option.getD (idxFun (vertical s.focus (map some l')) i) x) (some x)) =
                    C' s.focus) } ::ₘ
          Multiset.map
            (fun p =>
              { line := prod p.line (map some l'), color := p.color,
                has_color :=
                  (_ :
                    ∀ (x : α),
                      C ((fun x i => Option.getD (idxFun (prod p.line (map some l')) i) x) (some x)) = p.color) })
            s.lines →
      (fun x i => Option.getD (idxFun p.line i) x) none =
        Sum.elim s.focus ((fun x i => Option.getD (idxFun (map some l') i) x) none)
[PROOFSTEP]
simp_rw [Multiset.mem_cons, Multiset.mem_map]
[GOAL]
case neg.refine'_3
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h✝ : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
s : ColorFocused C'
sr : ↑Multiset.card s.lines = r
h : ¬∃ p, p ∈ s.lines ∧ p.color = C' s.focus
⊢ ∀ (p : AlmostMono C),
    (p =
          { line := vertical s.focus (map some l'), color := C' s.focus,
            has_color :=
              (_ :
                ∀ (x : α),
                  C ((fun x i => Option.getD (idxFun (vertical s.focus (map some l')) i) x) (some x)) = C' s.focus) } ∨
        ∃ a,
          a ∈ s.lines ∧
            { line := prod a.line (map some l'), color := a.color,
                has_color :=
                  (_ :
                    ∀ (x : α),
                      C ((fun x i => Option.getD (idxFun (prod a.line (map some l')) i) x) (some x)) = a.color) } =
              p) →
      (fun i => Option.getD (idxFun p.line i) none) =
        Sum.elim s.focus fun i => Option.getD (idxFun (map some l') i) none
[PROOFSTEP]
rintro _ (rfl | ⟨q, hq, rfl⟩)
[GOAL]
case neg.refine'_3.inl
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h✝ : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
s : ColorFocused C'
sr : ↑Multiset.card s.lines = r
h : ¬∃ p, p ∈ s.lines ∧ p.color = C' s.focus
⊢ (fun i =>
      Option.getD
        (idxFun
          { line := vertical s.focus (map some l'), color := C' s.focus,
              has_color :=
                (_ :
                  ∀ (x : α),
                    C ((fun x i => Option.getD (idxFun (vertical s.focus (map some l')) i) x) (some x)) =
                      C' s.focus) }.line
          i)
        none) =
    Sum.elim s.focus fun i => Option.getD (idxFun (map some l') i) none
[PROOFSTEP]
simp only [vertical_apply]
[GOAL]
case neg.refine'_3.inr.intro.intro
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h✝ : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
s : ColorFocused C'
sr : ↑Multiset.card s.lines = r
h : ¬∃ p, p ∈ s.lines ∧ p.color = C' s.focus
q : AlmostMono C'
hq : q ∈ s.lines
⊢ (fun i =>
      Option.getD
        (idxFun
          { line := prod q.line (map some l'), color := q.color,
              has_color :=
                (_ :
                  ∀ (x : α),
                    C ((fun x i => Option.getD (idxFun (prod q.line (map some l')) i) x) (some x)) = q.color) }.line
          i)
        none) =
    Sum.elim s.focus fun i => Option.getD (idxFun (map some l') i) none
[PROOFSTEP]
simp only [prod_apply, s.is_focused q hq]
  -- Our `r+1` lines have distinct colors (this is why we needed to split into cases above).
[GOAL]
case neg.refine'_4
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h✝ : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
s : ColorFocused C'
sr : ↑Multiset.card s.lines = r
h : ¬∃ p, p ∈ s.lines ∧ p.color = C' s.focus
⊢ Multiset.Nodup
    (Multiset.map AlmostMono.color
      ({ line := vertical s.focus (map some l'), color := C' s.focus,
          has_color :=
            (_ :
              ∀ (x : α),
                C ((fun x i => Option.getD (idxFun (vertical s.focus (map some l')) i) x) (some x)) = C' s.focus) } ::ₘ
        Multiset.map
          (fun p =>
            { line := prod p.line (map some l'), color := p.color,
              has_color :=
                (_ :
                  ∀ (x : α),
                    C ((fun x i => Option.getD (idxFun (prod p.line (map some l')) i) x) (some x)) = p.color) })
          s.lines))
[PROOFSTEP]
rw [Multiset.map_cons, Multiset.map_map, Multiset.nodup_cons, Multiset.mem_map]
[GOAL]
case neg.refine'_4
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h✝ : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
s : ColorFocused C'
sr : ↑Multiset.card s.lines = r
h : ¬∃ p, p ∈ s.lines ∧ p.color = C' s.focus
⊢ (¬∃ a,
        a ∈ s.lines ∧
          (AlmostMono.color ∘ fun p =>
                { line := prod p.line (map some l'), color := p.color,
                  has_color :=
                    (_ :
                      ∀ (x : α),
                        C ((fun x i => Option.getD (idxFun (prod p.line (map some l')) i) x) (some x)) = p.color) })
              a =
            { line := vertical s.focus (map some l'), color := C' s.focus,
                has_color :=
                  (_ :
                    ∀ (x : α),
                      C ((fun x i => Option.getD (idxFun (vertical s.focus (map some l')) i) x) (some x)) =
                        C' s.focus) }.color) ∧
    Multiset.Nodup
      (Multiset.map
        (AlmostMono.color ∘ fun p =>
          { line := prod p.line (map some l'), color := p.color,
            has_color :=
              (_ :
                ∀ (x : α), C ((fun x i => Option.getD (idxFun (prod p.line (map some l')) i) x) (some x)) = p.color) })
        s.lines)
[PROOFSTEP]
exact
  ⟨fun ⟨q, hq, he⟩ => h ⟨q, hq, he⟩, s.distinct_colors⟩
    -- Finally, we really do have `r+1` lines!
[GOAL]
case neg.refine'_5
α : Type u
inst✝¹ : Fintype α
κ : Type (max v u)
inst✝ : Finite κ
val✝ : Fintype κ
h✝ : Nonempty α
r : ℕ
ι : Type
_inst✝ : Fintype ι
ι' : Type
_inst : Fintype ι'
C : (ι ⊕ ι' → Option α) → κ
l' : Line α ι'
C' : (ι → Option α) → κ
hl' : ∀ (x : α), (fun v' v => C (Sum.elim v (some ∘ v'))) ((fun x i => Option.getD (idxFun l' i) x) x) = C'
mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l
s : ColorFocused C'
sr : ↑Multiset.card s.lines = r
h : ¬∃ p, p ∈ s.lines ∧ p.color = C' s.focus
⊢ ↑Multiset.card
      {
          lines :=
            { line := vertical s.focus (map some l'), color := C' s.focus,
                has_color :=
                  (_ :
                    ∀ (x : α),
                      C ((fun x i => Option.getD (idxFun (vertical s.focus (map some l')) i) x) (some x)) =
                        C' s.focus) } ::ₘ
              Multiset.map
                (fun p =>
                  { line := prod p.line (map some l'), color := p.color,
                    has_color :=
                      (_ :
                        ∀ (x : α),
                          C ((fun x i => Option.getD (idxFun (prod p.line (map some l')) i) x) (some x)) = p.color) })
                s.lines,
          focus := Sum.elim s.focus ((fun x i => Option.getD (idxFun (map some l') i) x) none),
          is_focused :=
            (_ :
              ∀ (p : AlmostMono C),
                p ∈
                    { line := vertical s.focus (map some l'), color := C' s.focus,
                        has_color :=
                          (_ :
                            ∀ (x : α),
                              C ((fun x i => Option.getD (idxFun (vertical s.focus (map some l')) i) x) (some x)) =
                                C' s.focus) } ::ₘ
                      Multiset.map
                        (fun p =>
                          { line := prod p.line (map some l'), color := p.color,
                            has_color :=
                              (_ :
                                ∀ (x : α),
                                  C ((fun x i => Option.getD (idxFun (prod p.line (map some l')) i) x) (some x)) =
                                    p.color) })
                        s.lines →
                  (fun x i => Option.getD (idxFun p.line i) x) none =
                    Sum.elim s.focus ((fun x i => Option.getD (idxFun (map some l') i) x) none)),
          distinct_colors :=
            (_ :
              Multiset.Nodup
                (Multiset.map AlmostMono.color
                  ({ line := vertical s.focus (map some l'), color := C' s.focus,
                      has_color :=
                        (_ :
                          ∀ (x : α),
                            C ((fun x i => Option.getD (idxFun (vertical s.focus (map some l')) i) x) (some x)) =
                              C' s.focus) } ::ₘ
                    Multiset.map
                      (fun p =>
                        { line := prod p.line (map some l'), color := p.color,
                          has_color :=
                            (_ :
                              ∀ (x : α),
                                C ((fun x i => Option.getD (idxFun (prod p.line (map some l')) i) x) (some x)) =
                                  p.color) })
                      s.lines))) }.lines =
    Nat.succ r
[PROOFSTEP]
rw [Multiset.card_cons, Multiset.card_map, sr]
[GOAL]
α : Type u
inst✝¹ : Finite α
κ : Type v
inst✝ : Finite κ
ι : Type
ιfin : Fintype ι
hι : ∀ (C : (ι → α) → ULift κ), ∃ l, IsMono C l
C : (ι → α) → κ
l : Line α ι
c : ULift κ
hc : ∀ (x : α), (ULift.up ∘ C) ((fun x i => Option.getD (idxFun l i) x) x) = c
x : α
⊢ C ((fun x i => Option.getD (idxFun l i) x) x) = c.down
[PROOFSTEP]
rw [← hc x, Function.comp_apply]
[GOAL]
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
⊢ ∃ a, a > 0 ∧ ∃ b c, ∀ (s : M), s ∈ S → C (a • s + b) = c
[PROOFSTEP]
obtain ⟨ι, _inst, hι⟩ := Line.exists_mono_in_high_dimension S κ
[GOAL]
case intro.intro
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
hι : ∀ (C : (ι → { x // x ∈ S }) → κ), ∃ l, Line.IsMono C l
⊢ ∃ a, a > 0 ∧ ∃ b c, ∀ (s : M), s ∈ S → C (a • s + b) = c
[PROOFSTEP]
specialize hι fun v => C <| ∑ i, v i
[GOAL]
case intro.intro
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
hι : ∃ l, Line.IsMono (fun v => C (∑ i : ι, ↑(v i))) l
⊢ ∃ a, a > 0 ∧ ∃ b c, ∀ (s : M), s ∈ S → C (a • s + b) = c
[PROOFSTEP]
obtain ⟨l, c, hl⟩ := hι
[GOAL]
case intro.intro.intro.intro
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => Option.getD (Line.idxFun l i) x) x) = c
⊢ ∃ a, a > 0 ∧ ∃ b c, ∀ (s : M), s ∈ S → C (a • s + b) = c
[PROOFSTEP]
set s : Finset ι := Finset.univ.filter (fun i => l.idxFun i = none) with hs
[GOAL]
case intro.intro.intro.intro
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => Option.getD (Line.idxFun l i) x) x) = c
s : Finset ι := Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
hs : s = Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
⊢ ∃ a, a > 0 ∧ ∃ b c, ∀ (s : M), s ∈ S → C (a • s + b) = c
[PROOFSTEP]
refine' ⟨s.card, Finset.card_pos.mpr ⟨l.proper.choose, _⟩, ∑ i in sᶜ, ((l.idxFun i).map _).getD 0, c, _⟩
[GOAL]
case intro.intro.intro.intro.refine'_1
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => Option.getD (Line.idxFun l i) x) x) = c
s : Finset ι := Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
hs : s = Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
⊢ Exists.choose (_ : ∃ i, Line.idxFun l i = none) ∈ s
[PROOFSTEP]
rw [hs, Finset.mem_filter]
[GOAL]
case intro.intro.intro.intro.refine'_1
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => Option.getD (Line.idxFun l i) x) x) = c
s : Finset ι := Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
hs : s = Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
⊢ Exists.choose (_ : ∃ i, Line.idxFun l i = none) ∈ Finset.univ ∧
    Line.idxFun l (Exists.choose (_ : ∃ i, Line.idxFun l i = none)) = none
[PROOFSTEP]
exact ⟨Finset.mem_univ _, l.proper.choose_spec⟩
[GOAL]
case intro.intro.intro.intro.refine'_2
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => Option.getD (Line.idxFun l i) x) x) = c
s : Finset ι := Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
hs : s = Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
i : ι
⊢ { x // x ∈ S } → M
[PROOFSTEP]
exact fun m => m
[GOAL]
case intro.intro.intro.intro.refine'_3
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => Option.getD (Line.idxFun l i) x) x) = c
s : Finset ι := Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
hs : s = Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
⊢ ∀ (s_1 : M),
    s_1 ∈ S → C (Finset.card s • s_1 + ∑ i in sᶜ, Option.getD (Option.map (fun m => ↑m) (Line.idxFun l i)) 0) = c
[PROOFSTEP]
intro x xs
[GOAL]
case intro.intro.intro.intro.refine'_3
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => Option.getD (Line.idxFun l i) x) x) = c
s : Finset ι := Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
hs : s = Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
x : M
xs : x ∈ S
⊢ C (Finset.card s • x + ∑ i in sᶜ, Option.getD (Option.map (fun m => ↑m) (Line.idxFun l i)) 0) = c
[PROOFSTEP]
rw [← hl ⟨x, xs⟩]
[GOAL]
case intro.intro.intro.intro.refine'_3
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => Option.getD (Line.idxFun l i) x) x) = c
s : Finset ι := Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
hs : s = Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
x : M
xs : x ∈ S
⊢ C (Finset.card s • x + ∑ i in sᶜ, Option.getD (Option.map (fun m => ↑m) (Line.idxFun l i)) 0) =
    (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => Option.getD (Line.idxFun l i) x) { val := x, property := xs })
[PROOFSTEP]
clear hl
[GOAL]
case intro.intro.intro.intro.refine'_3
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
hs : s = Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
x : M
xs : x ∈ S
⊢ C (Finset.card s • x + ∑ i in sᶜ, Option.getD (Option.map (fun m => ↑m) (Line.idxFun l i)) 0) =
    (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => Option.getD (Line.idxFun l i) x) { val := x, property := xs })
[PROOFSTEP]
congr
[GOAL]
case intro.intro.intro.intro.refine'_3.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
hs : s = Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
x : M
xs : x ∈ S
⊢ Finset.card s • x + ∑ i in sᶜ, Option.getD (Option.map (fun m => ↑m) (Line.idxFun l i)) 0 =
    ∑ i : ι, ↑((fun x i => Option.getD (Line.idxFun l i) x) { val := x, property := xs } i)
[PROOFSTEP]
rw [← Finset.sum_add_sum_compl s]
[GOAL]
case intro.intro.intro.intro.refine'_3.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
hs : s = Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
x : M
xs : x ∈ S
⊢ Finset.card s • x + ∑ i in sᶜ, Option.getD (Option.map (fun m => ↑m) (Line.idxFun l i)) 0 =
    ∑ i in s, ↑((fun x i => Option.getD (Line.idxFun l i) x) { val := x, property := xs } i) +
      ∑ i in sᶜ, ↑((fun x i => Option.getD (Line.idxFun l i) x) { val := x, property := xs } i)
[PROOFSTEP]
congr 1
[GOAL]
case intro.intro.intro.intro.refine'_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
hs : s = Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
x : M
xs : x ∈ S
⊢ Finset.card s • x = ∑ i in s, ↑((fun x i => Option.getD (Line.idxFun l i) x) { val := x, property := xs } i)
[PROOFSTEP]
rw [← Finset.sum_const]
[GOAL]
case intro.intro.intro.intro.refine'_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
hs : s = Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
x : M
xs : x ∈ S
⊢ ∑ _x in s, x = ∑ i in s, ↑((fun x i => Option.getD (Line.idxFun l i) x) { val := x, property := xs } i)
[PROOFSTEP]
apply Finset.sum_congr rfl
[GOAL]
case intro.intro.intro.intro.refine'_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
hs : s = Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
x : M
xs : x ∈ S
⊢ ∀ (x_1 : ι), x_1 ∈ s → x = ↑((fun x i => Option.getD (Line.idxFun l i) x) { val := x, property := xs } x_1)
[PROOFSTEP]
intro i hi
[GOAL]
case intro.intro.intro.intro.refine'_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
hs : s = Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
x : M
xs : x ∈ S
i : ι
hi : i ∈ s
⊢ x = ↑((fun x i => Option.getD (Line.idxFun l i) x) { val := x, property := xs } i)
[PROOFSTEP]
rw [hs, Finset.mem_filter] at hi
[GOAL]
case intro.intro.intro.intro.refine'_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
hs : s = Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
x : M
xs : x ∈ S
i : ι
hi : i ∈ Finset.univ ∧ Line.idxFun l i = none
⊢ x = ↑((fun x i => Option.getD (Line.idxFun l i) x) { val := x, property := xs } i)
[PROOFSTEP]
rw [l.apply_none _ _ hi.right, Subtype.coe_mk]
[GOAL]
case intro.intro.intro.intro.refine'_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
hs : s = Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
x : M
xs : x ∈ S
⊢ ∑ i in sᶜ, Option.getD (Option.map (fun m => ↑m) (Line.idxFun l i)) 0 =
    ∑ i in sᶜ, ↑((fun x i => Option.getD (Line.idxFun l i) x) { val := x, property := xs } i)
[PROOFSTEP]
apply Finset.sum_congr rfl
[GOAL]
case intro.intro.intro.intro.refine'_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
hs : s = Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
x : M
xs : x ∈ S
⊢ ∀ (x_1 : ι),
    x_1 ∈ sᶜ →
      Option.getD (Option.map (fun m => ↑m) (Line.idxFun l x_1)) 0 =
        ↑((fun x i => Option.getD (Line.idxFun l i) x) { val := x, property := xs } x_1)
[PROOFSTEP]
intro i hi
[GOAL]
case intro.intro.intro.intro.refine'_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
hs : s = Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
x : M
xs : x ∈ S
i : ι
hi : i ∈ sᶜ
⊢ Option.getD (Option.map (fun m => ↑m) (Line.idxFun l i)) 0 =
    ↑((fun x i => Option.getD (Line.idxFun l i) x) { val := x, property := xs } i)
[PROOFSTEP]
rw [hs, Finset.compl_filter, Finset.mem_filter] at hi
[GOAL]
case intro.intro.intro.intro.refine'_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
hs : s = Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
x : M
xs : x ∈ S
i : ι
hi : i ∈ Finset.univ ∧ ¬Line.idxFun l i = none
⊢ Option.getD (Option.map (fun m => ↑m) (Line.idxFun l i)) 0 =
    ↑((fun x i => Option.getD (Line.idxFun l i) x) { val := x, property := xs } i)
[PROOFSTEP]
obtain ⟨y, hy⟩ := Option.ne_none_iff_exists.mp hi.right
[GOAL]
case intro.intro.intro.intro.refine'_3.e_a.e_a.intro
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
hs : s = Finset.filter (fun i => Line.idxFun l i = none) Finset.univ
x : M
xs : x ∈ S
i : ι
hi : i ∈ Finset.univ ∧ ¬Line.idxFun l i = none
y : { x // x ∈ S }
hy : some y = Line.idxFun l i
⊢ Option.getD (Option.map (fun m => ↑m) (Line.idxFun l i)) 0 =
    ↑((fun x i => Option.getD (Line.idxFun l i) x) { val := x, property := xs } i)
[PROOFSTEP]
simp_rw [← hy, Option.map_some', Option.getD]


[GOAL]
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : MonoidalCategory C
X Y : C
hX : Closed X
hY : Closed Y
⊢ IsLeftAdjoint (tensorLeft (X ⊗ Y))
[PROOFSTEP]
haveI := hX.isAdj
[GOAL]
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : MonoidalCategory C
X Y : C
hX : Closed X
hY : Closed Y
this : IsLeftAdjoint (tensorLeft X)
⊢ IsLeftAdjoint (tensorLeft (X ⊗ Y))
[PROOFSTEP]
haveI := hY.isAdj
[GOAL]
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : MonoidalCategory C
X Y : C
hX : Closed X
hY : Closed Y
this✝ : IsLeftAdjoint (tensorLeft X)
this : IsLeftAdjoint (tensorLeft Y)
⊢ IsLeftAdjoint (tensorLeft (X ⊗ Y))
[PROOFSTEP]
exact Adjunction.leftAdjointOfNatIso (MonoidalCategory.tensorLeftTensor _ _).symm
[GOAL]
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : MonoidalCategory C
X x✝ : C
⊢ Function.LeftInverse (fun a => (λ_ X).hom ≫ a) fun a => (λ_ X).inv ≫ a
[PROOFSTEP]
aesop_cat
[GOAL]
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : MonoidalCategory C
X x✝ : C
⊢ Function.RightInverse (fun a => (λ_ X).hom ≫ a) fun a => (λ_ X).inv ≫ a
[PROOFSTEP]
aesop_cat
[GOAL]
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : MonoidalCategory C
X'✝ X✝ Y✝ : C
f : X'✝ ⟶ X✝
g : X✝ ⟶ (𝟭 C).obj Y✝
⊢ ↑((fun X x =>
              { toFun := fun a => (λ_ X).inv ≫ a, invFun := fun a => (λ_ X).hom ≫ a,
                left_inv := (_ : ∀ (x_1 : (tensorLeft (𝟙_ C)).obj X ⟶ x), (λ_ X).hom ≫ (λ_ X).inv ≫ x_1 = x_1),
                right_inv := (_ : ∀ (x_1 : X ⟶ (𝟭 C).obj x), (λ_ X).inv ≫ (λ_ X).hom ≫ x_1 = x_1) })
            X'✝ Y✝).symm
      (f ≫ g) =
    (tensorLeft (𝟙_ C)).map f ≫
      ↑((fun X x =>
                { toFun := fun a => (λ_ X).inv ≫ a, invFun := fun a => (λ_ X).hom ≫ a,
                  left_inv := (_ : ∀ (x_1 : (tensorLeft (𝟙_ C)).obj X ⟶ x), (λ_ X).hom ≫ (λ_ X).inv ≫ x_1 = x_1),
                  right_inv := (_ : ∀ (x_1 : X ⟶ (𝟭 C).obj x), (λ_ X).inv ≫ (λ_ X).hom ≫ x_1 = x_1) })
              X✝ Y✝).symm
        g
[PROOFSTEP]
dsimp
[GOAL]
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : MonoidalCategory C
X'✝ X✝ Y✝ : C
f : X'✝ ⟶ X✝
g : X✝ ⟶ (𝟭 C).obj Y✝
⊢ (λ_ X'✝).hom ≫ f ≫ g = (𝟙 (𝟙_ C) ⊗ f) ≫ (λ_ X✝).hom ≫ g
[PROOFSTEP]
rw [leftUnitor_naturality_assoc]
[GOAL]
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : MonoidalCategory C
A B X X' Y Y' Z : C
inst✝ : Closed A
⊢ uncurry (𝟙 ((ihom A).obj X)) = NatTrans.app (ihom.ev A) X
[PROOFSTEP]
rw [uncurry_eq, tensor_id, id_comp]
[GOAL]
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : MonoidalCategory C
A B X X' Y Y' Z : C
inst✝ : Closed A
⊢ curry (𝟙 (A ⊗ (𝟭 C).obj X)) = NatTrans.app (ihom.coev A) X
[PROOFSTEP]
rw [curry_eq, (ihom A).map_id (A ⊗ _)]
[GOAL]
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : MonoidalCategory C
A B X X' Y Y' Z : C
inst✝ : Closed A
⊢ NatTrans.app (ihom.coev A) ((𝟭 C).obj X) ≫ 𝟙 ((ihom A).obj (A ⊗ (𝟭 C).obj X)) = NatTrans.app (ihom.coev A) X
[PROOFSTEP]
apply comp_id
[GOAL]
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : MonoidalCategory C
A B X✝ X' Y Y' Z : C
inst✝¹ : Closed A
inst✝ : Closed B
f : B ⟶ A
X : C
⊢ uncurry (NatTrans.app (pre f) X) = (f ⊗ 𝟙 ((ihom A).obj X)) ≫ NatTrans.app (ihom.ev A) X
[PROOFSTEP]
rw [uncurry_eq, id_tensor_pre_app_comp_ev]
[GOAL]
C : Type u
inst✝⁴ : Category.{v, u} C
inst✝³ : MonoidalCategory C
A✝ B X X' Y Y' Z : C
inst✝² : Closed A✝
inst✝¹ : Closed B
A : C
inst✝ : Closed A
⊢ pre (𝟙 A) = 𝟙 (ihom A)
[PROOFSTEP]
simp only [pre, Functor.map_id]
[GOAL]
C : Type u
inst✝⁴ : Category.{v, u} C
inst✝³ : MonoidalCategory C
A✝ B X X' Y Y' Z : C
inst✝² : Closed A✝
inst✝¹ : Closed B
A : C
inst✝ : Closed A
⊢ ↑(transferNatTransSelf (ihom.adjunction A) (ihom.adjunction A)) (𝟙 ((tensoringLeft C).obj A)) = 𝟙 (ihom A)
[PROOFSTEP]
dsimp
[GOAL]
C : Type u
inst✝⁴ : Category.{v, u} C
inst✝³ : MonoidalCategory C
A✝ B X X' Y Y' Z : C
inst✝² : Closed A✝
inst✝¹ : Closed B
A : C
inst✝ : Closed A
⊢ ↑(transferNatTransSelf (ihom.adjunction A) (ihom.adjunction A)) (𝟙 (tensorLeft A)) = 𝟙 (ihom A)
[PROOFSTEP]
simp
[GOAL]
C : Type u
inst✝⁶ : Category.{v, u} C
inst✝⁵ : MonoidalCategory C
A B X X' Y Y' Z : C
inst✝⁴ : Closed A
inst✝³ : Closed B
A₁ A₂ A₃ : C
inst✝² : Closed A₁
inst✝¹ : Closed A₂
inst✝ : Closed A₃
f : A₁ ⟶ A₂
g : A₂ ⟶ A₃
⊢ pre (f ≫ g) = pre g ≫ pre f
[PROOFSTEP]
rw [pre, pre, pre, transferNatTransSelf_comp, (tensoringLeft C).map_comp]
[GOAL]
C : Type u
inst✝⁵ : Category.{v, u} C
inst✝⁴ : MonoidalCategory C
A B X✝ X' Y✝ Y' Z✝ : C
inst✝³ : Closed A
inst✝² : Closed B
W X Y Z : C
inst✝¹ : Closed W
inst✝ : Closed X
f : W ⟶ X
g : Y ⟶ Z
⊢ NatTrans.app (pre f) Y ≫ (ihom W).map g = (ihom X).map g ≫ NatTrans.app (pre f) Z
[PROOFSTEP]
simp
[GOAL]
C : Type u
inst✝⁵ : Category.{v, u} C
inst✝⁴ : MonoidalCategory C
A B X✝ X' Y Y' Z : C
inst✝³ : Closed A
D : Type u₂
inst✝² : Category.{v₂, u₂} D
inst✝¹ : MonoidalCategory D
F : MonoidalFunctor C D
inst✝ : IsEquivalence F.toFunctor
h : MonoidalClosed D
X : C
⊢ IsLeftAdjoint (tensorLeft X)
[PROOFSTEP]
haveI q : Closed (F.obj X) := inferInstance
[GOAL]
C : Type u
inst✝⁵ : Category.{v, u} C
inst✝⁴ : MonoidalCategory C
A B X✝ X' Y Y' Z : C
inst✝³ : Closed A
D : Type u₂
inst✝² : Category.{v₂, u₂} D
inst✝¹ : MonoidalCategory D
F : MonoidalFunctor C D
inst✝ : IsEquivalence F.toFunctor
h : MonoidalClosed D
X : C
q : Closed (F.obj X)
⊢ IsLeftAdjoint (tensorLeft X)
[PROOFSTEP]
haveI : IsLeftAdjoint (tensorLeft (F.obj X)) := q.isAdj
[GOAL]
C : Type u
inst✝⁵ : Category.{v, u} C
inst✝⁴ : MonoidalCategory C
A B X✝ X' Y Y' Z : C
inst✝³ : Closed A
D : Type u₂
inst✝² : Category.{v₂, u₂} D
inst✝¹ : MonoidalCategory D
F : MonoidalFunctor C D
inst✝ : IsEquivalence F.toFunctor
h : MonoidalClosed D
X : C
q : Closed (F.obj X)
this : IsLeftAdjoint (tensorLeft (F.obj X))
⊢ IsLeftAdjoint (tensorLeft X)
[PROOFSTEP]
have i := compInvIso (MonoidalFunctor.commTensorLeft F X)
[GOAL]
C : Type u
inst✝⁵ : Category.{v, u} C
inst✝⁴ : MonoidalCategory C
A B X✝ X' Y Y' Z : C
inst✝³ : Closed A
D : Type u₂
inst✝² : Category.{v₂, u₂} D
inst✝¹ : MonoidalCategory D
F : MonoidalFunctor C D
inst✝ : IsEquivalence F.toFunctor
h : MonoidalClosed D
X : C
q : Closed (F.obj X)
this : IsLeftAdjoint (tensorLeft (F.obj X))
i : (F.toFunctor ⋙ tensorLeft (F.obj X)) ⋙ Functor.inv F.toFunctor ≅ tensorLeft X
⊢ IsLeftAdjoint (tensorLeft X)
[PROOFSTEP]
exact Adjunction.leftAdjointOfNatIso i


[GOAL]
X✝ : LocallyRingedSpace
X : LocallyRingedSpace
x : ↑↑X.toPresheafedSpace
⊢ IsLocalRingHom (PresheafedSpace.stalkMap (𝟙 X.toSheafedSpace) x)
[PROOFSTEP]
erw [PresheafedSpace.stalkMap.id]
[GOAL]
X✝ : LocallyRingedSpace
X : LocallyRingedSpace
x : ↑↑X.toPresheafedSpace
⊢ IsLocalRingHom (𝟙 (PresheafedSpace.stalk X.toPresheafedSpace x))
[PROOFSTEP]
apply isLocalRingHom_id
[GOAL]
X✝ : LocallyRingedSpace
X Y Z : LocallyRingedSpace
f : Hom X Y
g : Hom Y Z
x : ↑↑X.toPresheafedSpace
⊢ IsLocalRingHom (PresheafedSpace.stalkMap (f.val ≫ g.val) x)
[PROOFSTEP]
erw [PresheafedSpace.stalkMap.comp]
[GOAL]
X✝ : LocallyRingedSpace
X Y Z : LocallyRingedSpace
f : Hom X Y
g : Hom Y Z
x : ↑↑X.toPresheafedSpace
⊢ IsLocalRingHom (PresheafedSpace.stalkMap g.val (↑f.val.base x) ≫ PresheafedSpace.stalkMap f.val x)
[PROOFSTEP]
exact @isLocalRingHom_comp _ _ _ _ _ _ _ _ (f.2 _) (g.2 _)
[GOAL]
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X ⟶ Y
⊢ (𝟙 X ≫ f).val = f.val
[PROOFSTEP]
simp [comp]
[GOAL]
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X ⟶ Y
⊢ (f ≫ 𝟙 Y).val = f.val
[PROOFSTEP]
simp [comp]
[GOAL]
X : LocallyRingedSpace
x✝³ x✝² x✝¹ x✝ : LocallyRingedSpace
f : x✝³ ⟶ x✝²
g : x✝² ⟶ x✝¹
h : x✝¹ ⟶ x✝
⊢ ((f ≫ g) ≫ h).val = (f ≫ g ≫ h).val
[PROOFSTEP]
simp [comp]
[GOAL]
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X.toSheafedSpace ⟶ Y.toSheafedSpace
inst✝ : IsIso f
x : ↑↑X.toPresheafedSpace
⊢ IsLocalRingHom (PresheafedSpace.stalkMap (SheafedSpace.forgetToPresheafedSpace.map f) x)
[PROOFSTEP]
infer_instance
[GOAL]
X✝ : LocallyRingedSpace
U : TopCat
X : LocallyRingedSpace
f : U ⟶ toTopCat X
h : OpenEmbedding ↑f
⊢ ∀ (x : ↑↑(SheafedSpace.restrict X.toSheafedSpace h).toPresheafedSpace),
    LocalRing ↑(Presheaf.stalk (SheafedSpace.restrict X.toSheafedSpace h).toPresheafedSpace.presheaf x)
[PROOFSTEP]
intro x
[GOAL]
X✝ : LocallyRingedSpace
U : TopCat
X : LocallyRingedSpace
f : U ⟶ toTopCat X
h : OpenEmbedding ↑f
x : ↑↑(SheafedSpace.restrict X.toSheafedSpace h).toPresheafedSpace
⊢ LocalRing ↑(Presheaf.stalk (SheafedSpace.restrict X.toSheafedSpace h).toPresheafedSpace.presheaf x)
[PROOFSTEP]
apply @RingEquiv.localRing _ _ _ (X.localRing (f x))
[GOAL]
case e
X✝ : LocallyRingedSpace
U : TopCat
X : LocallyRingedSpace
f : U ⟶ toTopCat X
h : OpenEmbedding ↑f
x : ↑↑(SheafedSpace.restrict X.toSheafedSpace h).toPresheafedSpace
⊢ ↑(Presheaf.stalk X.presheaf (↑f x)) ≃+*
    ↑(Presheaf.stalk (SheafedSpace.restrict X.toSheafedSpace h).toPresheafedSpace.presheaf x)
[PROOFSTEP]
exact (X.restrictStalkIso h x).symm.commRingCatIsoToRingEquiv
[GOAL]
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X ⟶ Y
U : Opens ↑(toTopCat Y)
s : ↑(Y.presheaf.obj (op U))
⊢ (Opens.map f.val.base).obj (RingedSpace.basicOpen (toRingedSpace Y) s) =
    RingedSpace.basicOpen (toRingedSpace X) (↑(NatTrans.app f.val.c (op U)) s)
[PROOFSTEP]
ext x
[GOAL]
case h.h
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X ⟶ Y
U : Opens ↑(toTopCat Y)
s : ↑(Y.presheaf.obj (op U))
x : ↑↑X.toPresheafedSpace
⊢ x ∈ ↑((Opens.map f.val.base).obj (RingedSpace.basicOpen (toRingedSpace Y) s)) ↔
    x ∈ ↑(RingedSpace.basicOpen (toRingedSpace X) (↑(NatTrans.app f.val.c (op U)) s))
[PROOFSTEP]
constructor
[GOAL]
case h.h.mp
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X ⟶ Y
U : Opens ↑(toTopCat Y)
s : ↑(Y.presheaf.obj (op U))
x : ↑↑X.toPresheafedSpace
⊢ x ∈ ↑((Opens.map f.val.base).obj (RingedSpace.basicOpen (toRingedSpace Y) s)) →
    x ∈ ↑(RingedSpace.basicOpen (toRingedSpace X) (↑(NatTrans.app f.val.c (op U)) s))
[PROOFSTEP]
rintro ⟨⟨y, hyU⟩, hy : IsUnit _, rfl : y = _⟩
[GOAL]
case h.h.mp.intro.mk.intro
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X ⟶ Y
U : Opens ↑(toTopCat Y)
s : ↑(Y.presheaf.obj (op U))
x : ↑↑X.toPresheafedSpace
hyU : ↑f.val.base x ∈ U
hy : IsUnit (↑(Presheaf.germ (toRingedSpace Y).toPresheafedSpace.presheaf { val := ↑f.val.base x, property := hyU }) s)
⊢ x ∈ ↑(RingedSpace.basicOpen (toRingedSpace X) (↑(NatTrans.app f.val.c (op U)) s))
[PROOFSTEP]
erw [RingedSpace.mem_basicOpen _ _ ⟨x, show x ∈ (Opens.map f.1.base).obj U from hyU⟩, ←
  PresheafedSpace.stalkMap_germ_apply]
[GOAL]
case h.h.mp.intro.mk.intro
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X ⟶ Y
U : Opens ↑(toTopCat Y)
s : ↑(Y.presheaf.obj (op U))
x : ↑↑X.toPresheafedSpace
hyU : ↑f.val.base x ∈ U
hy : IsUnit (↑(Presheaf.germ (toRingedSpace Y).toPresheafedSpace.presheaf { val := ↑f.val.base x, property := hyU }) s)
⊢ IsUnit
    (↑(PresheafedSpace.stalkMap f.val ↑{ val := x, property := (_ : x ∈ (Opens.map f.val.base).obj U) })
      (↑(Presheaf.germ Y.presheaf
            { val := ↑f.val.base ↑{ val := x, property := (_ : x ∈ (Opens.map f.val.base).obj U) },
              property :=
                (_ :
                  ↑{ val := x, property := (_ : x ∈ (Opens.map f.val.base).obj U) } ∈ (Opens.map f.val.base).obj U) })
        s))
[PROOFSTEP]
exact (PresheafedSpace.stalkMap f.1 _).isUnit_map hy
[GOAL]
case h.h.mpr
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X ⟶ Y
U : Opens ↑(toTopCat Y)
s : ↑(Y.presheaf.obj (op U))
x : ↑↑X.toPresheafedSpace
⊢ x ∈ ↑(RingedSpace.basicOpen (toRingedSpace X) (↑(NatTrans.app f.val.c (op U)) s)) →
    x ∈ ↑((Opens.map f.val.base).obj (RingedSpace.basicOpen (toRingedSpace Y) s))
[PROOFSTEP]
rintro ⟨y, hy : IsUnit _, rfl⟩
[GOAL]
case h.h.mpr.intro.intro
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X ⟶ Y
U : Opens ↑(toTopCat Y)
s : ↑(Y.presheaf.obj (op U))
y : { x // x ∈ (Opens.map f.val.base).obj U }
hy : IsUnit (↑(Presheaf.germ (toRingedSpace X).toPresheafedSpace.presheaf y) (↑(NatTrans.app f.val.c (op U)) s))
⊢ ↑y ∈ ↑((Opens.map f.val.base).obj (RingedSpace.basicOpen (toRingedSpace Y) s))
[PROOFSTEP]
erw [RingedSpace.mem_basicOpen _ _ ⟨f.1.base y.1, y.2⟩]
[GOAL]
case h.h.mpr.intro.intro
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X ⟶ Y
U : Opens ↑(toTopCat Y)
s : ↑(Y.presheaf.obj (op U))
y : { x // x ∈ (Opens.map f.val.base).obj U }
hy : IsUnit (↑(Presheaf.germ (toRingedSpace X).toPresheafedSpace.presheaf y) (↑(NatTrans.app f.val.c (op U)) s))
⊢ IsUnit (↑(Presheaf.germ Y.presheaf { val := ↑f.val.base ↑y, property := (_ : ↑y ∈ (Opens.map f.val.base).obj U) }) s)
[PROOFSTEP]
erw [← PresheafedSpace.stalkMap_germ_apply] at hy
[GOAL]
case h.h.mpr.intro.intro
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X ⟶ Y
U : Opens ↑(toTopCat Y)
s : ↑(Y.presheaf.obj (op U))
y : { x // x ∈ (Opens.map f.val.base).obj U }
hy :
  IsUnit
    (↑(PresheafedSpace.stalkMap f.val ↑y)
      (↑(Presheaf.germ Y.presheaf { val := ↑f.val.base ↑y, property := (_ : ↑y ∈ (Opens.map f.val.base).obj U) }) s))
⊢ IsUnit (↑(Presheaf.germ Y.presheaf { val := ↑f.val.base ↑y, property := (_ : ↑y ∈ (Opens.map f.val.base).obj U) }) s)
[PROOFSTEP]
exact (isUnit_map_iff (PresheafedSpace.stalkMap f.1 _) _).mp hy
[GOAL]
X✝ : LocallyRingedSpace
X : LocallyRingedSpace
U : Opens ↑↑X.toPresheafedSpace
⊢ RingedSpace.basicOpen (toRingedSpace X) 0 = ⊥
[PROOFSTEP]
ext x
[GOAL]
case h.h
X✝ : LocallyRingedSpace
X : LocallyRingedSpace
U : Opens ↑↑X.toPresheafedSpace
x : ↑↑(toRingedSpace X).toPresheafedSpace
⊢ x ∈ ↑(RingedSpace.basicOpen (toRingedSpace X) 0) ↔ x ∈ ↑⊥
[PROOFSTEP]
simp only [RingedSpace.basicOpen, Opens.coe_mk, Set.mem_image, Set.mem_setOf_eq, Subtype.exists, exists_and_right,
  exists_eq_right, Opens.coe_bot, Set.mem_empty_iff_false, iff_false, not_exists]
[GOAL]
case h.h
X✝ : LocallyRingedSpace
X : LocallyRingedSpace
U : Opens ↑↑X.toPresheafedSpace
x : ↑↑(toRingedSpace X).toPresheafedSpace
⊢ ∀ (x_1 : x ∈ U),
    ¬IsUnit (↑(Presheaf.germ (toRingedSpace X).toPresheafedSpace.presheaf { val := x, property := (_ : x ∈ U) }) 0)
[PROOFSTEP]
intros hx
[GOAL]
case h.h
X✝ : LocallyRingedSpace
X : LocallyRingedSpace
U : Opens ↑↑X.toPresheafedSpace
x : ↑↑(toRingedSpace X).toPresheafedSpace
hx : x ∈ U
⊢ ¬IsUnit (↑(Presheaf.germ (toRingedSpace X).toPresheafedSpace.presheaf { val := x, property := (_ : x ∈ U) }) 0)
[PROOFSTEP]
rw [map_zero, isUnit_zero_iff]
[GOAL]
case h.h
X✝ : LocallyRingedSpace
X : LocallyRingedSpace
U : Opens ↑↑X.toPresheafedSpace
x : ↑↑(toRingedSpace X).toPresheafedSpace
hx : x ∈ U
⊢ ¬0 = 1
[PROOFSTEP]
change (0 : X.stalk x) ≠ (1 : X.stalk x)
[GOAL]
case h.h
X✝ : LocallyRingedSpace
X : LocallyRingedSpace
U : Opens ↑↑X.toPresheafedSpace
x : ↑↑(toRingedSpace X).toPresheafedSpace
hx : x ∈ U
⊢ 0 ≠ 1
[PROOFSTEP]
exact zero_ne_one