l3lab/ntp-mathlib huggingface dataset:
/-- Given an open cover on `X`, we may pull them back along a morphism `f : W ⟶ X` to obtain
an open cover of `W`. This is similar to `Scheme.OpenCover.pullbackCover`, but here we
take `pullback (𝒰.map x) f` instead of `pullback f (𝒰.map x)`. -/
@[simps]
def Scheme.OpenCover.pullbackCover' {X : Scheme} (𝒰 : X.OpenCover) {W : Scheme} (f : W ⟶ X) :
    W.OpenCover where
  J := 𝒰.J
  obj x := pullback (𝒰.map x) f
  map x := pullback.snd
  f x := 𝒰.f (f.1.base x)
  Covers x := by
    

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
𝒰 : OpenCover X
W : Scheme
f : W ⟶ X
x : ↑↑W.toPresheafedSpace
⊢ x ∈ Set.range ⇑((fun x => pullback.snd) ((fun x => AlgebraicGeometry.Scheme.OpenCover.f 𝒰 (f.val.base x)) x)).val.base

Next tactic:
rw [←
      show _ = (pullback.snd : pullback (𝒰.map (𝒰.f (f.1.base x))) f ⟶ _).1.base from
        PreservesPullback.iso_hom_snd Scheme.forgetToTop (𝒰.map (𝒰.f (f.1.base x))) f]
/-- Given an open cover on `X`, we may pull them back along a morphism `f : W ⟶ X` to obtain
an open cover of `W`. This is similar to `Scheme.OpenCover.pullbackCover`, but here we
take `pullback (𝒰.map x) f` instead of `pullback f (𝒰.map x)`. -/
@[simps]
def Scheme.OpenCover.pullbackCover' {X : Scheme} (𝒰 : X.OpenCover) {W : Scheme} (f : W ⟶ X) :
    W.OpenCover where
  J := 𝒰.J
  obj x := pullback (𝒰.map x) f
  map x := pullback.snd
  f x := 𝒰.f (f.1.base x)
  Covers x := by
    rw [←
      show _ = (pullback.snd : pullback (𝒰.map (𝒰.f (f.1.base x))) f ⟶ _).1.base from
        PreservesPullback.iso_hom_snd Scheme.forgetToTop (𝒰.map (𝒰.f (f.1.base x))) f]
    -- Porting note : `rw` to `erw` on this single lemma
    

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
𝒰 : OpenCover X
W : Scheme
f : W ⟶ X
x : ↑↑W.toPresheafedSpace
⊢ x ∈
    Set.range
      ⇑((PreservesPullback.iso forgetToTop (map 𝒰 (AlgebraicGeometry.Scheme.OpenCover.f 𝒰 (f.val.base x))) f).hom ≫
          pullback.snd)

Next tactic:
erw [coe_comp]
/-- Given an open cover on `X`, we may pull them back along a morphism `f : W ⟶ X` to obtain
an open cover of `W`. This is similar to `Scheme.OpenCover.pullbackCover`, but here we
take `pullback (𝒰.map x) f` instead of `pullback f (𝒰.map x)`. -/
@[simps]
def Scheme.OpenCover.pullbackCover' {X : Scheme} (𝒰 : X.OpenCover) {W : Scheme} (f : W ⟶ X) :
    W.OpenCover where
  J := 𝒰.J
  obj x := pullback (𝒰.map x) f
  map x := pullback.snd
  f x := 𝒰.f (f.1.base x)
  Covers x := by
    rw [←
      show _ = (pullback.snd : pullback (𝒰.map (𝒰.f (f.1.base x))) f ⟶ _).1.base from
        PreservesPullback.iso_hom_snd Scheme.forgetToTop (𝒰.map (𝒰.f (f.1.base x))) f]
    -- Porting note : `rw` to `erw` on this single lemma
    erw [coe_comp]
    

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
𝒰 : OpenCover X
W : Scheme
f : W ⟶ X
x : ↑↑W.toPresheafedSpace
⊢ x ∈
    Set.range
      (⇑pullback.snd ∘
        ⇑(PreservesPullback.iso forgetToTop (map 𝒰 (AlgebraicGeometry.Scheme.OpenCover.f 𝒰 (f.val.base x))) f).hom)

Next tactic:
rw [Set.range_comp, Set.range_iff_surjective.mpr, Set.image_univ,
      TopCat.pullback_snd_range]
/-- Given an open cover on `X`, we may pull them back along a morphism `f : W ⟶ X` to obtain
an open cover of `W`. This is similar to `Scheme.OpenCover.pullbackCover`, but here we
take `pullback (𝒰.map x) f` instead of `pullback f (𝒰.map x)`. -/
@[simps]
def Scheme.OpenCover.pullbackCover' {X : Scheme} (𝒰 : X.OpenCover) {W : Scheme} (f : W ⟶ X) :
    W.OpenCover where
  J := 𝒰.J
  obj x := pullback (𝒰.map x) f
  map x := pullback.snd
  f x := 𝒰.f (f.1.base x)
  Covers x := by
    rw [←
      show _ = (pullback.snd : pullback (𝒰.map (𝒰.f (f.1.base x))) f ⟶ _).1.base from
        PreservesPullback.iso_hom_snd Scheme.forgetToTop (𝒰.map (𝒰.f (f.1.base x))) f]
    -- Porting note : `rw` to `erw` on this single lemma
    erw [coe_comp]
    rw [Set.range_comp, Set.range_iff_surjective.mpr, Set.image_univ,
      TopCat.pullback_snd_range]
    

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
𝒰 : OpenCover X
W : Scheme
f : W ⟶ X
x : ↑↑W.toPresheafedSpace
⊢ x ∈
    {y |
      ∃ x_1,
        (forgetToTop.map (map 𝒰 (AlgebraicGeometry.Scheme.OpenCover.f 𝒰 (f.val.base x)))) x_1 = (forgetToTop.map f) y}
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
𝒰 : OpenCover X
W : Scheme
f : W ⟶ X
x : ↑↑W.toPresheafedSpace
⊢ Function.Surjective
    ⇑(PreservesPullback.iso forgetToTop (map 𝒰 (AlgebraicGeometry.Scheme.OpenCover.f 𝒰 (f.val.base x))) f).hom

Next tactic:
obtain ⟨y, h⟩ := 𝒰.Covers (f.1.base x)
/-- Given an open cover on `X`, we may pull them back along a morphism `f : W ⟶ X` to obtain
an open cover of `W`. This is similar to `Scheme.OpenCover.pullbackCover`, but here we
take `pullback (𝒰.map x) f` instead of `pullback f (𝒰.map x)`. -/
@[simps]
def Scheme.OpenCover.pullbackCover' {X : Scheme} (𝒰 : X.OpenCover) {W : Scheme} (f : W ⟶ X) :
    W.OpenCover where
  J := 𝒰.J
  obj x := pullback (𝒰.map x) f
  map x := pullback.snd
  f x := 𝒰.f (f.1.base x)
  Covers x := by
    rw [←
      show _ = (pullback.snd : pullback (𝒰.map (𝒰.f (f.1.base x))) f ⟶ _).1.base from
        PreservesPullback.iso_hom_snd Scheme.forgetToTop (𝒰.map (𝒰.f (f.1.base x))) f]
    -- Porting note : `rw` to `erw` on this single lemma
    erw [coe_comp]
    rw [Set.range_comp, Set.range_iff_surjective.mpr, Set.image_univ,
      TopCat.pullback_snd_range]
    obtain ⟨y, h⟩ := 𝒰.Covers (f.1.base x)
    

Proof state:
case intro
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
𝒰 : OpenCover X
W : Scheme
f : W ⟶ X
x : ↑↑W.toPresheafedSpace
y : (forget TopCat).obj ↑(obj 𝒰 (AlgebraicGeometry.Scheme.OpenCover.f 𝒰 (f.val.base x))).toPresheafedSpace
h : (map 𝒰 (AlgebraicGeometry.Scheme.OpenCover.f 𝒰 (f.val.base x))).val.base y = f.val.base x
⊢ x ∈
    {y |
      ∃ x_1,
        (forgetToTop.map (map 𝒰 (AlgebraicGeometry.Scheme.OpenCover.f 𝒰 (f.val.base x)))) x_1 = (forgetToTop.map f) y}
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
𝒰 : OpenCover X
W : Scheme
f : W ⟶ X
x : ↑↑W.toPresheafedSpace
⊢ Function.Surjective
    ⇑(PreservesPullback.iso forgetToTop (map 𝒰 (AlgebraicGeometry.Scheme.OpenCover.f 𝒰 (f.val.base x))) f).hom

Next tactic:
exact ⟨y, h⟩
/-- Given an open cover on `X`, we may pull them back along a morphism `f : W ⟶ X` to obtain
an open cover of `W`. This is similar to `Scheme.OpenCover.pullbackCover`, but here we
take `pullback (𝒰.map x) f` instead of `pullback f (𝒰.map x)`. -/
@[simps]
def Scheme.OpenCover.pullbackCover' {X : Scheme} (𝒰 : X.OpenCover) {W : Scheme} (f : W ⟶ X) :
    W.OpenCover where
  J := 𝒰.J
  obj x := pullback (𝒰.map x) f
  map x := pullback.snd
  f x := 𝒰.f (f.1.base x)
  Covers x := by
    rw [←
      show _ = (pullback.snd : pullback (𝒰.map (𝒰.f (f.1.base x))) f ⟶ _).1.base from
        PreservesPullback.iso_hom_snd Scheme.forgetToTop (𝒰.map (𝒰.f (f.1.base x))) f]
    -- Porting note : `rw` to `erw` on this single lemma
    erw [coe_comp]
    rw [Set.range_comp, Set.range_iff_surjective.mpr, Set.image_univ,
      TopCat.pullback_snd_range]
    obtain ⟨y, h⟩ := 𝒰.Covers (f.1.base x)
    exact ⟨y, h⟩
    · 

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
𝒰 : OpenCover X
W : Scheme
f : W ⟶ X
x : ↑↑W.toPresheafedSpace
⊢ Function.Surjective
    ⇑(PreservesPullback.iso forgetToTop (map 𝒰 (AlgebraicGeometry.Scheme.OpenCover.f 𝒰 (f.val.base x))) f).hom

Next tactic:
rw [← TopCat.epi_iff_surjective]
/-- Given an open cover on `X`, we may pull them back along a morphism `f : W ⟶ X` to obtain
an open cover of `W`. This is similar to `Scheme.OpenCover.pullbackCover`, but here we
take `pullback (𝒰.map x) f` instead of `pullback f (𝒰.map x)`. -/
@[simps]
def Scheme.OpenCover.pullbackCover' {X : Scheme} (𝒰 : X.OpenCover) {W : Scheme} (f : W ⟶ X) :
    W.OpenCover where
  J := 𝒰.J
  obj x := pullback (𝒰.map x) f
  map x := pullback.snd
  f x := 𝒰.f (f.1.base x)
  Covers x := by
    rw [←
      show _ = (pullback.snd : pullback (𝒰.map (𝒰.f (f.1.base x))) f ⟶ _).1.base from
        PreservesPullback.iso_hom_snd Scheme.forgetToTop (𝒰.map (𝒰.f (f.1.base x))) f]
    -- Porting note : `rw` to `erw` on this single lemma
    erw [coe_comp]
    rw [Set.range_comp, Set.range_iff_surjective.mpr, Set.image_univ,
      TopCat.pullback_snd_range]
    obtain ⟨y, h⟩ := 𝒰.Covers (f.1.base x)
    exact ⟨y, h⟩
    · rw [← TopCat.epi_iff_surjective]; 

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
𝒰 : OpenCover X
W : Scheme
f : W ⟶ X
x : ↑↑W.toPresheafedSpace
⊢ Epi (PreservesPullback.iso forgetToTop (map 𝒰 (AlgebraicGeometry.Scheme.OpenCover.f 𝒰 (f.val.base x))) f).hom

Next tactic:
infer_instance
theorem Scheme.OpenCover.iUnion_range {X : Scheme} (𝒰 : X.OpenCover) :
    ⋃ i, Set.range (𝒰.map i).1.base = Set.univ := by
  

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
𝒰 : OpenCover X
⊢ ⋃ i, Set.range ⇑(map 𝒰 i).val.base = Set.univ

Next tactic:
rw [Set.eq_univ_iff_forall]
theorem Scheme.OpenCover.iUnion_range {X : Scheme} (𝒰 : X.OpenCover) :
    ⋃ i, Set.range (𝒰.map i).1.base = Set.univ := by
  rw [Set.eq_univ_iff_forall]
  

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
𝒰 : OpenCover X
⊢ ∀ (x : (forget TopCat).obj ↑X.toPresheafedSpace), x ∈ ⋃ i, Set.range ⇑(map 𝒰 i).val.base

Next tactic:
intro x
theorem Scheme.OpenCover.iUnion_range {X : Scheme} (𝒰 : X.OpenCover) :
    ⋃ i, Set.range (𝒰.map i).1.base = Set.univ := by
  rw [Set.eq_univ_iff_forall]
  intro x
  

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
𝒰 : OpenCover X
x : (forget TopCat).obj ↑X.toPresheafedSpace
⊢ x ∈ ⋃ i, Set.range ⇑(map 𝒰 i).val.base

Next tactic:
rw [Set.mem_iUnion]
theorem Scheme.OpenCover.iUnion_range {X : Scheme} (𝒰 : X.OpenCover) :
    ⋃ i, Set.range (𝒰.map i).1.base = Set.univ := by
  rw [Set.eq_univ_iff_forall]
  intro x
  rw [Set.mem_iUnion]
  

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
𝒰 : OpenCover X
x : (forget TopCat).obj ↑X.toPresheafedSpace
⊢ ∃ i, x ∈ Set.range ⇑(map 𝒰 i).val.base

Next tactic:
exact ⟨𝒰.f x, 𝒰.Covers x⟩
theorem Scheme.OpenCover.iSup_opensRange {X : Scheme} (𝒰 : X.OpenCover) :
    ⨆ i, Scheme.Hom.opensRange (𝒰.map i) = ⊤ :=
  Opens.ext <| by 

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
𝒰 : OpenCover X
⊢ ↑(⨆ i, Hom.opensRange (map 𝒰 i)) = ↑⊤

Next tactic:
rw [Opens.coe_iSup]
theorem Scheme.OpenCover.iSup_opensRange {X : Scheme} (𝒰 : X.OpenCover) :
    ⨆ i, Scheme.Hom.opensRange (𝒰.map i) = ⊤ :=
  Opens.ext <| by rw [Opens.coe_iSup]; 

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
𝒰 : OpenCover X
⊢ ⋃ i, ↑(Hom.opensRange (map 𝒰 i)) = ↑⊤

Next tactic:
exact 𝒰.iUnion_range
theorem Scheme.OpenCover.compactSpace {X : Scheme} (𝒰 : X.OpenCover) [Finite 𝒰.J]
    [H : ∀ i, CompactSpace (𝒰.obj i)] : CompactSpace X := by
  

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
X : Scheme
𝒰 : OpenCover X
inst✝ : Finite 𝒰.J
H : ∀ (i : 𝒰.J), CompactSpace ↑↑(obj 𝒰 i).toPresheafedSpace
⊢ CompactSpace ↑↑X.toPresheafedSpace

Next tactic:
cases nonempty_fintype 𝒰.J
theorem Scheme.OpenCover.compactSpace {X : Scheme} (𝒰 : X.OpenCover) [Finite 𝒰.J]
    [H : ∀ i, CompactSpace (𝒰.obj i)] : CompactSpace X := by
  cases nonempty_fintype 𝒰.J
  

Proof state:
case intro
C : Type u
inst✝¹ : Category.{v, u} C
X : Scheme
𝒰 : OpenCover X
inst✝ : Finite 𝒰.J
H : ∀ (i : 𝒰.J), CompactSpace ↑↑(obj 𝒰 i).toPresheafedSpace
val✝ : Fintype 𝒰.J
⊢ CompactSpace ↑↑X.toPresheafedSpace

Next tactic:
rw [← isCompact_univ_iff, ← 𝒰.iUnion_range]
theorem Scheme.OpenCover.compactSpace {X : Scheme} (𝒰 : X.OpenCover) [Finite 𝒰.J]
    [H : ∀ i, CompactSpace (𝒰.obj i)] : CompactSpace X := by
  cases nonempty_fintype 𝒰.J
  rw [← isCompact_univ_iff, ← 𝒰.iUnion_range]
  

Proof state:
case intro
C : Type u
inst✝¹ : Category.{v, u} C
X : Scheme
𝒰 : OpenCover X
inst✝ : Finite 𝒰.J
H : ∀ (i : 𝒰.J), CompactSpace ↑↑(obj 𝒰 i).toPresheafedSpace
val✝ : Fintype 𝒰.J
⊢ IsCompact (⋃ i, Set.range ⇑(map 𝒰 i).val.base)

Next tactic:
apply isCompact_iUnion
theorem Scheme.OpenCover.compactSpace {X : Scheme} (𝒰 : X.OpenCover) [Finite 𝒰.J]
    [H : ∀ i, CompactSpace (𝒰.obj i)] : CompactSpace X := by
  cases nonempty_fintype 𝒰.J
  rw [← isCompact_univ_iff, ← 𝒰.iUnion_range]
  apply isCompact_iUnion
  

Proof state:
case intro.h
C : Type u
inst✝¹ : Category.{v, u} C
X : Scheme
𝒰 : OpenCover X
inst✝ : Finite 𝒰.J
H : ∀ (i : 𝒰.J), CompactSpace ↑↑(obj 𝒰 i).toPresheafedSpace
val✝ : Fintype 𝒰.J
⊢ ∀ (i : 𝒰.J), IsCompact (Set.range ⇑(map 𝒰 i).val.base)

Next tactic:
intro i
theorem Scheme.OpenCover.compactSpace {X : Scheme} (𝒰 : X.OpenCover) [Finite 𝒰.J]
    [H : ∀ i, CompactSpace (𝒰.obj i)] : CompactSpace X := by
  cases nonempty_fintype 𝒰.J
  rw [← isCompact_univ_iff, ← 𝒰.iUnion_range]
  apply isCompact_iUnion
  intro i
  

Proof state:
case intro.h
C : Type u
inst✝¹ : Category.{v, u} C
X : Scheme
𝒰 : OpenCover X
inst✝ : Finite 𝒰.J
H : ∀ (i : 𝒰.J), CompactSpace ↑↑(obj 𝒰 i).toPresheafedSpace
val✝ : Fintype 𝒰.J
i : 𝒰.J
⊢ IsCompact (Set.range ⇑(map 𝒰 i).val.base)

Next tactic:
rw [isCompact_iff_compactSpace]
theorem Scheme.OpenCover.compactSpace {X : Scheme} (𝒰 : X.OpenCover) [Finite 𝒰.J]
    [H : ∀ i, CompactSpace (𝒰.obj i)] : CompactSpace X := by
  cases nonempty_fintype 𝒰.J
  rw [← isCompact_univ_iff, ← 𝒰.iUnion_range]
  apply isCompact_iUnion
  intro i
  rw [isCompact_iff_compactSpace]
  

Proof state:
case intro.h
C : Type u
inst✝¹ : Category.{v, u} C
X : Scheme
𝒰 : OpenCover X
inst✝ : Finite 𝒰.J
H : ∀ (i : 𝒰.J), CompactSpace ↑↑(obj 𝒰 i).toPresheafedSpace
val✝ : Fintype 𝒰.J
i : 𝒰.J
⊢ CompactSpace ↑(Set.range ⇑(map 𝒰 i).val.base)

Next tactic:
exact
    @Homeomorph.compactSpace _ _ _ _ (H i)
      (TopCat.homeoOfIso
        (asIso
          (IsOpenImmersion.isoOfRangeEq (𝒰.map i)
                  (X.ofRestrict (Opens.openEmbedding ⟨_, (𝒰.IsOpen i).base_open.open_range⟩))
                  Subtype.range_coe.symm).hom.1.base))
/-- Given open covers `{ Uᵢ }` and `{ Uⱼ }`, we may form the open cover `{ Uᵢ ∩ Uⱼ }`. -/
def Scheme.OpenCover.inter {X : Scheme.{u}} (𝒰₁ : Scheme.OpenCover.{v₁} X)
    (𝒰₂ : Scheme.OpenCover.{v₂} X) : X.OpenCover where
  J := 𝒰₁.J × 𝒰₂.J
  obj ij := pullback (𝒰₁.map ij.1) (𝒰₂.map ij.2)
  map ij := pullback.fst ≫ 𝒰₁.map ij.1
  f x := ⟨𝒰₁.f x, 𝒰₂.f x⟩
  Covers x := by
    

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
𝒰₁ : OpenCover X
𝒰₂ : OpenCover X
x : ↑↑X.toPresheafedSpace
⊢ x ∈ Set.range ⇑((fun ij => pullback.fst ≫ map 𝒰₁ ij.1) ((fun x => (f 𝒰₁ x, f 𝒰₂ x)) x)).val.base

Next tactic:
rw [IsOpenImmersion.range_pullback_to_base_of_left]
/-- Given open covers `{ Uᵢ }` and `{ Uⱼ }`, we may form the open cover `{ Uᵢ ∩ Uⱼ }`. -/
def Scheme.OpenCover.inter {X : Scheme.{u}} (𝒰₁ : Scheme.OpenCover.{v₁} X)
    (𝒰₂ : Scheme.OpenCover.{v₂} X) : X.OpenCover where
  J := 𝒰₁.J × 𝒰₂.J
  obj ij := pullback (𝒰₁.map ij.1) (𝒰₂.map ij.2)
  map ij := pullback.fst ≫ 𝒰₁.map ij.1
  f x := ⟨𝒰₁.f x, 𝒰₂.f x⟩
  Covers x := by
    rw [IsOpenImmersion.range_pullback_to_base_of_left]
    

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
𝒰₁ : OpenCover X
𝒰₂ : OpenCover X
x : ↑↑X.toPresheafedSpace
⊢ x ∈
    Set.range ⇑(map 𝒰₁ ((fun x => (f 𝒰₁ x, f 𝒰₂ x)) x).1).val.base ∩
      Set.range ⇑(map 𝒰₂ ((fun x => (f 𝒰₁ x, f 𝒰₂ x)) x).2).val.base

Next tactic:
exact ⟨𝒰₁.Covers x, 𝒰₂.Covers x⟩
/-- If `U` is a family of open sets that covers `X`, then `X.restrict U` forms an `X.open_cover`. -/
@[simps! J obj map]
def Scheme.openCoverOfSuprEqTop {s : Type*} (X : Scheme) (U : s → Opens X)
    (hU : ⨆ i, U i = ⊤) : X.OpenCover where
  J := s
  obj i := X.restrict (U i).openEmbedding
  map i := X.ofRestrict (U i).openEmbedding
  f x :=
    haveI : x ∈ ⨆ i, U i := hU.symm ▸ show x ∈ (⊤ : Opens X) by 

Proof state:
C : Type u
inst✝ : Category.{v, u} C
s : Type u_1
X : Scheme
U : s → Opens ↑↑X.toPresheafedSpace
hU : ⨆ i, U i = ⊤
x : ↑↑X.toPresheafedSpace
⊢ x ∈ ⊤

Next tactic:
triv
/-- If `U` is a family of open sets that covers `X`, then `X.restrict U` forms an `X.open_cover`. -/
@[simps! J obj map]
def Scheme.openCoverOfSuprEqTop {s : Type*} (X : Scheme) (U : s → Opens X)
    (hU : ⨆ i, U i = ⊤) : X.OpenCover where
  J := s
  obj i := X.restrict (U i).openEmbedding
  map i := X.ofRestrict (U i).openEmbedding
  f x :=
    haveI : x ∈ ⨆ i, U i := hU.symm ▸ show x ∈ (⊤ : Opens X) by triv
    (Opens.mem_iSup.mp this).choose
  Covers x := by
    

Proof state:
C : Type u
inst✝ : Category.{v, u} C
s : Type u_1
X : Scheme
U : s → Opens ↑↑X.toPresheafedSpace
hU : ⨆ i, U i = ⊤
x : ↑↑X.toPresheafedSpace
⊢ x ∈
    Set.range
      ⇑((fun i => ofRestrict X (_ : OpenEmbedding ⇑(Opens.inclusion (U i))))
              ((fun x => Exists.choose (_ : ∃ i, x ∈ U i)) x)).val.base

Next tactic:
erw [Subtype.range_coe]
/-- If `U` is a family of open sets that covers `X`, then `X.restrict U` forms an `X.open_cover`. -/
@[simps! J obj map]
def Scheme.openCoverOfSuprEqTop {s : Type*} (X : Scheme) (U : s → Opens X)
    (hU : ⨆ i, U i = ⊤) : X.OpenCover where
  J := s
  obj i := X.restrict (U i).openEmbedding
  map i := X.ofRestrict (U i).openEmbedding
  f x :=
    haveI : x ∈ ⨆ i, U i := hU.symm ▸ show x ∈ (⊤ : Opens X) by triv
    (Opens.mem_iSup.mp this).choose
  Covers x := by
    erw [Subtype.range_coe]
    

Proof state:
C : Type u
inst✝ : Category.{v, u} C
s : Type u_1
X : Scheme
U : s → Opens ↑↑X.toPresheafedSpace
hU : ⨆ i, U i = ⊤
x : ↑↑X.toPresheafedSpace
⊢ x ∈ ↑(U ((fun x => Exists.choose (_ : ∃ i, x ∈ U i)) x))

Next tactic:
have : x ∈ ⨆ i, U i := hU.symm ▸ show x ∈ (⊤ : Opens X) by triv
/-- If `U` is a family of open sets that covers `X`, then `X.restrict U` forms an `X.open_cover`. -/
@[simps! J obj map]
def Scheme.openCoverOfSuprEqTop {s : Type*} (X : Scheme) (U : s → Opens X)
    (hU : ⨆ i, U i = ⊤) : X.OpenCover where
  J := s
  obj i := X.restrict (U i).openEmbedding
  map i := X.ofRestrict (U i).openEmbedding
  f x :=
    haveI : x ∈ ⨆ i, U i := hU.symm ▸ show x ∈ (⊤ : Opens X) by triv
    (Opens.mem_iSup.mp this).choose
  Covers x := by
    erw [Subtype.range_coe]
    have : x ∈ ⨆ i, U i := hU.symm ▸ show x ∈ (⊤ : Opens X) by 

Proof state:
C : Type u
inst✝ : Category.{v, u} C
s : Type u_1
X : Scheme
U : s → Opens ↑↑X.toPresheafedSpace
hU : ⨆ i, U i = ⊤
x : ↑↑X.toPresheafedSpace
⊢ x ∈ ⊤

Next tactic:
triv
/-- If `U` is a family of open sets that covers `X`, then `X.restrict U` forms an `X.open_cover`. -/
@[simps! J obj map]
def Scheme.openCoverOfSuprEqTop {s : Type*} (X : Scheme) (U : s → Opens X)
    (hU : ⨆ i, U i = ⊤) : X.OpenCover where
  J := s
  obj i := X.restrict (U i).openEmbedding
  map i := X.ofRestrict (U i).openEmbedding
  f x :=
    haveI : x ∈ ⨆ i, U i := hU.symm ▸ show x ∈ (⊤ : Opens X) by triv
    (Opens.mem_iSup.mp this).choose
  Covers x := by
    erw [Subtype.range_coe]
    have : x ∈ ⨆ i, U i := hU.symm ▸ show x ∈ (⊤ : Opens X) by triv
    

Proof state:
C : Type u
inst✝ : Category.{v, u} C
s : Type u_1
X : Scheme
U : s → Opens ↑↑X.toPresheafedSpace
hU : ⨆ i, U i = ⊤
x : ↑↑X.toPresheafedSpace
this : x ∈ ⨆ i, U i
⊢ x ∈ ↑(U ((fun x => Exists.choose (_ : ∃ i, x ∈ U i)) x))

Next tactic:
exact (Opens.mem_iSup.mp this).choose_spec
/-- An affine isometry between finite dimensional spaces of equal dimension can be upgraded
    to an affine isometry equivalence. -/
def toAffineIsometryEquiv [Inhabited P₁] (li : P₁ →ᵃⁱ[𝕜] P₂) (h : finrank 𝕜 V₁ = finrank 𝕜 V₂) :
    P₁ ≃ᵃⁱ[𝕜] P₂ :=
  AffineIsometryEquiv.mk' li (li.linearIsometry.toLinearIsometryEquiv h)
    (Inhabited.default (α := P₁)) fun p => by 

Proof state:
𝕜 : Type u_1
V₁ : Type u_2
V₂ : Type u_3
P₁ : Type u_4
P₂ : Type u_5
inst✝¹¹ : NormedField 𝕜
inst✝¹⁰ : NormedAddCommGroup V₁
inst✝⁹ : SeminormedAddCommGroup V₂
inst✝⁸ : NormedSpace 𝕜 V₁
inst✝⁷ : NormedSpace 𝕜 V₂
inst✝⁶ : MetricSpace P₁
inst✝⁵ : PseudoMetricSpace P₂
inst✝⁴ : NormedAddTorsor V₁ P₁
inst✝³ : NormedAddTorsor V₂ P₂
inst✝² : FiniteDimensional 𝕜 V₁
inst✝¹ : FiniteDimensional 𝕜 V₂
inst✝ : Inhabited P₁
li : P₁ →ᵃⁱ[𝕜] P₂
h : finrank 𝕜 V₁ = finrank 𝕜 V₂
p : P₁
⊢ li p = (LinearIsometry.toLinearIsometryEquiv (AffineIsometry.linearIsometry li) h) (p -ᵥ default) +ᵥ li default

Next tactic:
simp
theorem ContinuousLinearMap.continuous_det : Continuous fun f : E →L[𝕜] E => f.det := by
  

Proof state:
𝕜 : Type u
inst✝¹⁰ : NontriviallyNormedField 𝕜
E : Type v
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedSpace 𝕜 E
F : Type w
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedSpace 𝕜 F
F' : Type x
inst✝⁵ : AddCommGroup F'
inst✝⁴ : Module 𝕜 F'
inst✝³ : TopologicalSpace F'
inst✝² : TopologicalAddGroup F'
inst✝¹ : ContinuousSMul 𝕜 F'
inst✝ : CompleteSpace 𝕜
⊢ Continuous fun f => det f

Next tactic:
change Continuous fun f : E →L[𝕜] E => LinearMap.det (f : E →ₗ[𝕜] E)
theorem ContinuousLinearMap.continuous_det : Continuous fun f : E →L[𝕜] E => f.det := by
  change Continuous fun f : E →L[𝕜] E => LinearMap.det (f : E →ₗ[𝕜] E)
  -- Porting note: this could be easier with `det_cases`
  

Proof state:
𝕜 : Type u
inst✝¹⁰ : NontriviallyNormedField 𝕜
E : Type v
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedSpace 𝕜 E
F : Type w
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedSpace 𝕜 F
F' : Type x
inst✝⁵ : AddCommGroup F'
inst✝⁴ : Module 𝕜 F'
inst✝³ : TopologicalSpace F'
inst✝² : TopologicalAddGroup F'
inst✝¹ : ContinuousSMul 𝕜 F'
inst✝ : CompleteSpace 𝕜
⊢ Continuous fun f => LinearMap.det ↑f

Next tactic:
by_cases h : ∃ s : Finset E, Nonempty (Basis (↥s) 𝕜 E)
theorem ContinuousLinearMap.continuous_det : Continuous fun f : E →L[𝕜] E => f.det := by
  change Continuous fun f : E →L[𝕜] E => LinearMap.det (f : E →ₗ[𝕜] E)
  -- Porting note: this could be easier with `det_cases`
  by_cases h : ∃ s : Finset E, Nonempty (Basis (↥s) 𝕜 E)
  · 

Proof state:
case pos
𝕜 : Type u
inst✝¹⁰ : NontriviallyNormedField 𝕜
E : Type v
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedSpace 𝕜 E
F : Type w
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedSpace 𝕜 F
F' : Type x
inst✝⁵ : AddCommGroup F'
inst✝⁴ : Module 𝕜 F'
inst✝³ : TopologicalSpace F'
inst✝² : TopologicalAddGroup F'
inst✝¹ : ContinuousSMul 𝕜 F'
inst✝ : CompleteSpace 𝕜
h : ∃ s, Nonempty (Basis { x // x ∈ s } 𝕜 E)
⊢ Continuous fun f => LinearMap.det ↑f

Next tactic:
rcases h with ⟨s, ⟨b⟩⟩
theorem ContinuousLinearMap.continuous_det : Continuous fun f : E →L[𝕜] E => f.det := by
  change Continuous fun f : E →L[𝕜] E => LinearMap.det (f : E →ₗ[𝕜] E)
  -- Porting note: this could be easier with `det_cases`
  by_cases h : ∃ s : Finset E, Nonempty (Basis (↥s) 𝕜 E)
  · rcases h with ⟨s, ⟨b⟩⟩
    

Proof state:
case pos.intro.intro
𝕜 : Type u
inst✝¹⁰ : NontriviallyNormedField 𝕜
E : Type v
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedSpace 𝕜 E
F : Type w
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedSpace 𝕜 F
F' : Type x
inst✝⁵ : AddCommGroup F'
inst✝⁴ : Module 𝕜 F'
inst✝³ : TopologicalSpace F'
inst✝² : TopologicalAddGroup F'
inst✝¹ : ContinuousSMul 𝕜 F'
inst✝ : CompleteSpace 𝕜
s : Finset E
b : Basis { x // x ∈ s } 𝕜 E
⊢ Continuous fun f => LinearMap.det ↑f

Next tactic:
haveI : FiniteDimensional 𝕜 E := FiniteDimensional.of_fintype_basis b
theorem ContinuousLinearMap.continuous_det : Continuous fun f : E →L[𝕜] E => f.det := by
  change Continuous fun f : E →L[𝕜] E => LinearMap.det (f : E →ₗ[𝕜] E)
  -- Porting note: this could be easier with `det_cases`
  by_cases h : ∃ s : Finset E, Nonempty (Basis (↥s) 𝕜 E)
  · rcases h with ⟨s, ⟨b⟩⟩
    haveI : FiniteDimensional 𝕜 E := FiniteDimensional.of_fintype_basis b
    

Proof state:
case pos.intro.intro
𝕜 : Type u
inst✝¹⁰ : NontriviallyNormedField 𝕜
E : Type v
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedSpace 𝕜 E
F : Type w
inst✝⁷ : NormedAddCommGroup F
inst✝⁶ : NormedSpace 𝕜 F
F' : Type x
inst✝⁵ : AddCommGroup F'
inst✝⁴ : Module 𝕜 F'
inst✝³ : TopologicalSpace F'
inst✝² : TopologicalAddGroup F'
inst✝¹ : ContinuousSMul 𝕜 F'
inst✝ : CompleteSpace 𝕜
s : Finset E
b : Basis { x // x ∈ s } 𝕜 E
this : FiniteDimensional 𝕜 E
⊢ Continuous fun f => LinearMap.det ↑f

Next tactic:
simp_rw [LinearMap.det_eq_det_toMatrix_of_finset b]