l3lab/ntp-mathlib huggingface dataset:
theorem cardinal_mk_lift_le_mul :
    Cardinal.lift.{u} #{ x : A // IsAlgebraic R x } ≤ Cardinal.lift.{v} #R[X] * ℵ₀ := by
  rw [← mk_uLift, ← mk_uLift]
  choose g hg₁ hg₂ using fun x : { x : A | IsAlgebraic R x } => x.coe_prop
  refine' lift_mk_le_lift_mk_mul_of_lift_mk_preimage_le g fun f => _
  rw [lift_le_aleph0, le_aleph0_iff_set_countable]
  suffices : MapsTo (↑) (g ⁻¹' {f}) (f.rootSet A)
  exact this.countable_of_injOn (Subtype.coe_injective.injOn _) (f.rootSet_finite A).countable
  

Proof state:
case this
R : Type u
A : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : IsDomain A
inst✝¹ : Algebra R A
inst✝ : NoZeroSMulDivisors R A
g : ↑{x | IsAlgebraic R x} → R[X]
hg₁ : ∀ (x : ↑{x | IsAlgebraic R x}), g x ≠ 0
hg₂ : ∀ (x : ↑{x | IsAlgebraic R x}), (aeval ↑x) (g x) = 0
f : R[X]
⊢ MapsTo Subtype.val (g ⁻¹' {f}) (rootSet f A)

Next tactic:
rintro x (rfl : g x = f)
theorem cardinal_mk_lift_le_mul :
    Cardinal.lift.{u} #{ x : A // IsAlgebraic R x } ≤ Cardinal.lift.{v} #R[X] * ℵ₀ := by
  rw [← mk_uLift, ← mk_uLift]
  choose g hg₁ hg₂ using fun x : { x : A | IsAlgebraic R x } => x.coe_prop
  refine' lift_mk_le_lift_mk_mul_of_lift_mk_preimage_le g fun f => _
  rw [lift_le_aleph0, le_aleph0_iff_set_countable]
  suffices : MapsTo (↑) (g ⁻¹' {f}) (f.rootSet A)
  exact this.countable_of_injOn (Subtype.coe_injective.injOn _) (f.rootSet_finite A).countable
  rintro x (rfl : g x = f)
  

Proof state:
case this
R : Type u
A : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : IsDomain A
inst✝¹ : Algebra R A
inst✝ : NoZeroSMulDivisors R A
g : ↑{x | IsAlgebraic R x} → R[X]
hg₁ : ∀ (x : ↑{x | IsAlgebraic R x}), g x ≠ 0
hg₂ : ∀ (x : ↑{x | IsAlgebraic R x}), (aeval ↑x) (g x) = 0
x : ↑{x | IsAlgebraic R x}
⊢ ↑x ∈ rootSet (g x) A

Next tactic:
exact mem_rootSet.2 ⟨hg₁ x, hg₂ x⟩
theorem cardinal_mk_lift_le_max :
    Cardinal.lift.{u} #{ x : A // IsAlgebraic R x } ≤ max (Cardinal.lift.{v} #R) ℵ₀ :=
  (cardinal_mk_lift_le_mul R A).trans <|
    (mul_le_mul_right' (lift_le.2 cardinal_mk_le_max) _).trans <| by 

Proof state:
R : Type u
A : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : IsDomain A
inst✝¹ : Algebra R A
inst✝ : NoZeroSMulDivisors R A
⊢ lift.{v, u} (max #R ℵ₀) * ℵ₀ ≤ max (lift.{v, u} #R) ℵ₀

Next tactic:
simp
@[simp]
protected theorem countable : Set.Countable { x : A | IsAlgebraic R x } := by
  

Proof state:
R : Type u
A : Type v
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : IsDomain A
inst✝² : Algebra R A
inst✝¹ : NoZeroSMulDivisors R A
inst✝ : Countable R
⊢ Set.Countable {x | IsAlgebraic R x}

Next tactic:
rw [← le_aleph0_iff_set_countable, ← lift_le]
@[simp]
protected theorem countable : Set.Countable { x : A | IsAlgebraic R x } := by
  rw [← le_aleph0_iff_set_countable, ← lift_le]
  

Proof state:
R : Type u
A : Type v
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : IsDomain A
inst✝² : Algebra R A
inst✝¹ : NoZeroSMulDivisors R A
inst✝ : Countable R
⊢ lift.{?u.51550, v} #↑{x | IsAlgebraic R x} ≤ lift.{?u.51550, v} ℵ₀

Next tactic:
apply (cardinal_mk_lift_le_max R A).trans
@[simp]
protected theorem countable : Set.Countable { x : A | IsAlgebraic R x } := by
  rw [← le_aleph0_iff_set_countable, ← lift_le]
  apply (cardinal_mk_lift_le_max R A).trans
  

Proof state:
R : Type u
A : Type v
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : IsDomain A
inst✝² : Algebra R A
inst✝¹ : NoZeroSMulDivisors R A
inst✝ : Countable R
⊢ max (lift.{v, u} #R) ℵ₀ ≤ lift.{u, v} ℵ₀

Next tactic:
simp
theorem cardinal_mk_le_mul : #{ x : A // IsAlgebraic R x } ≤ #R[X] * ℵ₀ := by
  

Proof state:
R A : Type u
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : IsDomain A
inst✝¹ : Algebra R A
inst✝ : NoZeroSMulDivisors R A
⊢ #{ x // IsAlgebraic R x } ≤ #R[X] * ℵ₀

Next tactic:
rw [← lift_id #_, ← lift_id #R[X]]
theorem cardinal_mk_le_mul : #{ x : A // IsAlgebraic R x } ≤ #R[X] * ℵ₀ := by
  rw [← lift_id #_, ← lift_id #R[X]]
  

Proof state:
R A : Type u
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : IsDomain A
inst✝¹ : Algebra R A
inst✝ : NoZeroSMulDivisors R A
⊢ lift.{u, u} #{ x // IsAlgebraic R x } ≤ lift.{u, u} #R[X] * ℵ₀

Next tactic:
exact cardinal_mk_lift_le_mul R A
theorem cardinal_mk_le_max : #{ x : A // IsAlgebraic R x } ≤ max #R ℵ₀ := by
  

Proof state:
R A : Type u
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : IsDomain A
inst✝¹ : Algebra R A
inst✝ : NoZeroSMulDivisors R A
⊢ #{ x // IsAlgebraic R x } ≤ max #R ℵ₀

Next tactic:
rw [← lift_id #_, ← lift_id #R]
theorem cardinal_mk_le_max : #{ x : A // IsAlgebraic R x } ≤ max #R ℵ₀ := by
  rw [← lift_id #_, ← lift_id #R]
  

Proof state:
R A : Type u
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : IsDomain A
inst✝¹ : Algebra R A
inst✝ : NoZeroSMulDivisors R A
⊢ lift.{u, u} #{ x // IsAlgebraic R x } ≤ max (lift.{u, u} #R) ℵ₀

Next tactic:
exact cardinal_mk_lift_le_max R A
/-- `Set.image2` in terms of monadic operations. Note that this can't be taken as the definition
because of the lack of universe polymorphism. -/
theorem image2_def {α β γ : Type u} (f : α → β → γ) (s : Set α) (t : Set β) :
    image2 f s t = f <$> s <*> t := by
  

Proof state:
α✝ β✝ : Type u
s✝ : Set α✝
f✝ : α✝ → Set β✝
g : Set (α✝ → β✝)
α β γ : Type u
f : α → β → γ
s : Set α
t : Set β
⊢ image2 f s t = Seq.seq (f <$> s) fun x => t

Next tactic:
ext
/-- `Set.image2` in terms of monadic operations. Note that this can't be taken as the definition
because of the lack of universe polymorphism. -/
theorem image2_def {α β γ : Type u} (f : α → β → γ) (s : Set α) (t : Set β) :
    image2 f s t = f <$> s <*> t := by
  ext
  

Proof state:
case h
α✝ β✝ : Type u
s✝ : Set α✝
f✝ : α✝ → Set β✝
g : Set (α✝ → β✝)
α β γ : Type u
f : α → β → γ
s : Set α
t : Set β
x✝ : γ
⊢ x✝ ∈ image2 f s t ↔ x✝ ∈ Seq.seq (f <$> s) fun x => t

Next tactic:
simp
instance : LawfulMonad Set := LawfulMonad.mk'
  (id_map := image_id)
  (pure_bind := biUnion_singleton)
  (bind_assoc := fun _ _ _ => by 

Proof state:
α β : Type u
s : Set α
f : α → Set β
g : Set (α → β)
α✝ β✝ γ✝ : Type ?u.7220
x✝² : Set α✝
x✝¹ : α✝ → Set β✝
x✝ : β✝ → Set γ✝
⊢ x✝² >>= x✝¹ >>= x✝ = x✝² >>= fun x => x✝¹ x >>= x✝

Next tactic:
simp only [bind_def, biUnion_iUnion]
theorem coe_subset : (γ : Set α) ⊆ β := by
  

Proof state:
α β✝ : Type u
s : Set α
f : α → Set β✝
g : Set (α → β✝)
β : Set α
γ : Set ↑β
⊢ Lean.Internal.coeM γ ⊆ β

Next tactic:
intro _ ⟨_, ⟨⟨⟨_, ha⟩, rfl⟩, _, ⟨_, rfl⟩, _⟩⟩
theorem coe_subset : (γ : Set α) ⊆ β := by
  intro _ ⟨_, ⟨⟨⟨_, ha⟩, rfl⟩, _, ⟨_, rfl⟩, _⟩⟩; 

Proof state:
α β✝ : Type u
s : Set α
f : α → Set β✝
g : Set (α → β✝)
β : Set α
γ : Set ↑β
a✝ val✝ : α
ha : val✝ ∈ β
h✝ : { val := val✝, property := ha } ∈ γ
right✝ : a✝ ∈ (fun h => (fun a => pure (CoeT.coe a)) { val := val✝, property := ha }) h✝
⊢ a✝ ∈ β

Next tactic:
convert ha
theorem mem_of_mem_coe (ha : a ∈ (γ : Set α)) : ⟨a, coe_subset ha⟩ ∈ γ := by
  

Proof state:
α β✝ : Type u
s : Set α
f : α → Set β✝
g : Set (α → β✝)
β : Set α
γ : Set ↑β
a : α
ha : a ∈ Lean.Internal.coeM γ
⊢ { val := a, property := (_ : a ∈ β) } ∈ γ

Next tactic:
rcases ha with ⟨_, ⟨_, rfl⟩, _, ⟨ha, rfl⟩, _⟩
theorem mem_of_mem_coe (ha : a ∈ (γ : Set α)) : ⟨a, coe_subset ha⟩ ∈ γ := by
  rcases ha with ⟨_, ⟨_, rfl⟩, _, ⟨ha, rfl⟩, _⟩; 

Proof state:
case intro.intro.intro.intro.intro.intro
α β✝ : Type u
s : Set α
f : α → Set β✝
g : Set (α → β✝)
β : Set α
γ : Set ↑β
a : α
w✝ : ↑β
ha : w✝ ∈ γ
right✝ : a ∈ (fun h => (fun a => pure (CoeT.coe a)) w✝) ha
⊢ { val := a, property := (_ : a ∈ β) } ∈ γ

Next tactic:
convert ha
/-- The coercion from `Set.monad` as an instance is equal to the coercion defined above. -/
theorem coe_eq_image_val (t : Set s) :
    @Lean.Internal.coeM Set s α _ Set.monad t = (t : Set α) := by
  

Proof state:
α β : Type u
s : Set α
f : α → Set β
g : Set (α → β)
t : Set ↑s
⊢ Lean.Internal.coeM t = Subtype.val '' t

Next tactic:
change ⋃ (x ∈ t), {x.1} = _
/-- The coercion from `Set.monad` as an instance is equal to the coercion defined above. -/
theorem coe_eq_image_val (t : Set s) :
    @Lean.Internal.coeM Set s α _ Set.monad t = (t : Set α) := by
  change ⋃ (x ∈ t), {x.1} = _
  

Proof state:
α β : Type u
s : Set α
f : α → Set β
g : Set (α → β)
t : Set ↑s
⊢ ⋃ x ∈ t, {↑x} = Subtype.val '' t

Next tactic:
ext
/-- The coercion from `Set.monad` as an instance is equal to the coercion defined above. -/
theorem coe_eq_image_val (t : Set s) :
    @Lean.Internal.coeM Set s α _ Set.monad t = (t : Set α) := by
  change ⋃ (x ∈ t), {x.1} = _
  ext
  

Proof state:
case h
α β : Type u
s : Set α
f : α → Set β
g : Set (α → β)
t : Set ↑s
x✝ : α
⊢ x✝ ∈ ⋃ x ∈ t, {↑x} ↔ x✝ ∈ Subtype.val '' t

Next tactic:
simp
theorem image_val_subset : (γ : Set α) ⊆ β := by
  

Proof state:
α β✝ : Type u
s : Set α
f : α → Set β✝
g : Set (α → β✝)
β : Set α
γ : Set ↑β
⊢ Subtype.val '' γ ⊆ β

Next tactic:
rintro _ ⟨⟨_, ha⟩, _, rfl⟩
theorem image_val_subset : (γ : Set α) ⊆ β := by
  rintro _ ⟨⟨_, ha⟩, _, rfl⟩; 

Proof state:
case intro.mk.intro
α β✝ : Type u
s : Set α
f : α → Set β✝
g : Set (α → β✝)
β : Set α
γ : Set ↑β
val✝ : α
ha : val✝ ∈ β
left✝ : { val := val✝, property := ha } ∈ γ
⊢ ↑{ val := val✝, property := ha } ∈ β

Next tactic:
exact ha
theorem mem_of_mem_image_val (ha : a ∈ (γ : Set α)) : ⟨a, image_val_subset ha⟩ ∈ γ := by
  

Proof state:
α β✝ : Type u
s : Set α
f : α → Set β✝
g : Set (α → β✝)
β : Set α
γ : Set ↑β
a : α
ha : a ∈ Subtype.val '' γ
⊢ { val := a, property := (_ : a ∈ β) } ∈ γ

Next tactic:
rcases ha with ⟨_, ha, rfl⟩
theorem mem_of_mem_image_val (ha : a ∈ (γ : Set α)) : ⟨a, image_val_subset ha⟩ ∈ γ := by
  rcases ha with ⟨_, ha, rfl⟩; 

Proof state:
case intro.intro
α β✝ : Type u
s : Set α
f : α → Set β✝
g : Set (α → β✝)
β : Set α
γ : Set ↑β
w✝ : { x // x ∈ β }
ha : w✝ ∈ γ
⊢ { val := ↑w✝, property := (_ : ↑w✝ ∈ β) } ∈ γ

Next tactic:
exact ha
theorem image_image_val_eq_restrict_image {f : α → δ} : f '' γ = β.restrict f '' γ := by
  

Proof state:
α β✝ : Type u
s : Set α
f✝ : α → Set β✝
g : Set (α → β✝)
β : Set α
γ : Set ↑β
δ : Type u_1
f : α → δ
⊢ f '' (Subtype.val '' γ) = restrict β f '' γ

Next tactic:
ext
theorem image_image_val_eq_restrict_image {f : α → δ} : f '' γ = β.restrict f '' γ := by
  ext; 

Proof state:
case h
α β✝ : Type u
s : Set α
f✝ : α → Set β✝
g : Set (α → β✝)
β : Set α
γ : Set ↑β
δ : Type u_1
f : α → δ
x✝ : δ
⊢ x✝ ∈ f '' (Subtype.val '' γ) ↔ x✝ ∈ restrict β f '' γ

Next tactic:
simp
/-- The Zariski pretopology on the category of schemes. -/
def zariskiPretopology : Pretopology (Scheme.{u}) where
  coverings Y S := ∃ (U : OpenCover.{u} Y), S = Presieve.ofArrows U.obj U.map
  has_isos Y X f _ := ⟨openCoverOfIsIso f, (Presieve.ofArrows_pUnit _).symm⟩
  pullbacks := by
    

Proof state:
⊢ ∀ ⦃X Y : Scheme⦄ (f : Y ⟶ X),
    ∀ S ∈ (fun Y S => ∃ U, S = Presieve.ofArrows U.obj U.map) X,
      Presieve.pullbackArrows f S ∈ (fun Y S => ∃ U, S = Presieve.ofArrows U.obj U.map) Y

Next tactic:
rintro Y X f _ ⟨U, rfl⟩
/-- The Zariski pretopology on the category of schemes. -/
def zariskiPretopology : Pretopology (Scheme.{u}) where
  coverings Y S := ∃ (U : OpenCover.{u} Y), S = Presieve.ofArrows U.obj U.map
  has_isos Y X f _ := ⟨openCoverOfIsIso f, (Presieve.ofArrows_pUnit _).symm⟩
  pullbacks := by
    rintro Y X f _ ⟨U, rfl⟩
    

Proof state:
case intro
Y X : Scheme
f : X ⟶ Y
U : OpenCover Y
⊢ Presieve.pullbackArrows f (Presieve.ofArrows U.obj U.map) ∈ (fun Y S => ∃ U, S = Presieve.ofArrows U.obj U.map) X

Next tactic:
exact ⟨U.pullbackCover' f, (Presieve.ofArrows_pullback _ _ _).symm⟩
/-- The Zariski pretopology on the category of schemes. -/
def zariskiPretopology : Pretopology (Scheme.{u}) where
  coverings Y S := ∃ (U : OpenCover.{u} Y), S = Presieve.ofArrows U.obj U.map
  has_isos Y X f _ := ⟨openCoverOfIsIso f, (Presieve.ofArrows_pUnit _).symm⟩
  pullbacks := by
    rintro Y X f _ ⟨U, rfl⟩
    exact ⟨U.pullbackCover' f, (Presieve.ofArrows_pullback _ _ _).symm⟩
  Transitive := by
    

Proof state:
⊢ ∀ ⦃X : Scheme⦄ (S : Presieve X) (Ti : ⦃Y : Scheme⦄ → (f : Y ⟶ X) → S f → Presieve Y),
    S ∈ (fun Y S => ∃ U, S = Presieve.ofArrows U.obj U.map) X →
      (∀ ⦃Y : Scheme⦄ (f : Y ⟶ X) (H : S f), Ti f H ∈ (fun Y S => ∃ U, S = Presieve.ofArrows U.obj U.map) Y) →
        Presieve.bind S Ti ∈ (fun Y S => ∃ U, S = Presieve.ofArrows U.obj U.map) X

Next tactic:
rintro X _ T ⟨U, rfl⟩ H
/-- The Zariski pretopology on the category of schemes. -/
def zariskiPretopology : Pretopology (Scheme.{u}) where
  coverings Y S := ∃ (U : OpenCover.{u} Y), S = Presieve.ofArrows U.obj U.map
  has_isos Y X f _ := ⟨openCoverOfIsIso f, (Presieve.ofArrows_pUnit _).symm⟩
  pullbacks := by
    rintro Y X f _ ⟨U, rfl⟩
    exact ⟨U.pullbackCover' f, (Presieve.ofArrows_pullback _ _ _).symm⟩
  Transitive := by
    rintro X _ T ⟨U, rfl⟩ H
    

Proof state:
case intro
X : Scheme
U : OpenCover X
T : ⦃Y : Scheme⦄ → (f : Y ⟶ X) → Presieve.ofArrows U.obj U.map f → Presieve Y
H :
  ∀ ⦃Y : Scheme⦄ (f : Y ⟶ X) (H : Presieve.ofArrows U.obj U.map f),
    T f H ∈ (fun Y S => ∃ U, S = Presieve.ofArrows U.obj U.map) Y
⊢ Presieve.bind (Presieve.ofArrows U.obj U.map) T ∈ (fun Y S => ∃ U, S = Presieve.ofArrows U.obj U.map) X

Next tactic:
choose V hV using H
/-- The Zariski pretopology on the category of schemes. -/
def zariskiPretopology : Pretopology (Scheme.{u}) where
  coverings Y S := ∃ (U : OpenCover.{u} Y), S = Presieve.ofArrows U.obj U.map
  has_isos Y X f _ := ⟨openCoverOfIsIso f, (Presieve.ofArrows_pUnit _).symm⟩
  pullbacks := by
    rintro Y X f _ ⟨U, rfl⟩
    exact ⟨U.pullbackCover' f, (Presieve.ofArrows_pullback _ _ _).symm⟩
  Transitive := by
    rintro X _ T ⟨U, rfl⟩ H
    choose V hV using H
    

Proof state:
case intro
X : Scheme
U : OpenCover X
T : ⦃Y : Scheme⦄ → (f : Y ⟶ X) → Presieve.ofArrows U.obj U.map f → Presieve Y
V : ⦃Y : Scheme⦄ → (f : Y ⟶ X) → Presieve.ofArrows U.obj U.map f → OpenCover Y
hV : ∀ ⦃Y : Scheme⦄ (f : Y ⟶ X) (H : Presieve.ofArrows U.obj U.map f), T f H = Presieve.ofArrows (V f H).obj (V f H).map
⊢ Presieve.bind (Presieve.ofArrows U.obj U.map) T ∈ (fun Y S => ∃ U, S = Presieve.ofArrows U.obj U.map) X

Next tactic:
use U.bind (fun j => V (U.map j) ⟨j⟩)
/-- The Zariski pretopology on the category of schemes. -/
def zariskiPretopology : Pretopology (Scheme.{u}) where
  coverings Y S := ∃ (U : OpenCover.{u} Y), S = Presieve.ofArrows U.obj U.map
  has_isos Y X f _ := ⟨openCoverOfIsIso f, (Presieve.ofArrows_pUnit _).symm⟩
  pullbacks := by
    rintro Y X f _ ⟨U, rfl⟩
    exact ⟨U.pullbackCover' f, (Presieve.ofArrows_pullback _ _ _).symm⟩
  Transitive := by
    rintro X _ T ⟨U, rfl⟩ H
    choose V hV using H
    use U.bind (fun j => V (U.map j) ⟨j⟩)
    

Proof state:
case h
X : Scheme
U : OpenCover X
T : ⦃Y : Scheme⦄ → (f : Y ⟶ X) → Presieve.ofArrows U.obj U.map f → Presieve Y
V : ⦃Y : Scheme⦄ → (f : Y ⟶ X) → Presieve.ofArrows U.obj U.map f → OpenCover Y
hV : ∀ ⦃Y : Scheme⦄ (f : Y ⟶ X) (H : Presieve.ofArrows U.obj U.map f), T f H = Presieve.ofArrows (V f H).obj (V f H).map
⊢ Presieve.bind (Presieve.ofArrows U.obj U.map) T =
    Presieve.ofArrows
      (OpenCover.bind U fun j => V (OpenCover.map U j) (_ : Presieve.ofArrows U.obj U.map (OpenCover.map U j))).obj
      (OpenCover.bind U fun j => V (OpenCover.map U j) (_ : Presieve.ofArrows U.obj U.map (OpenCover.map U j))).map

Next tactic:
simpa only [OpenCover.bind, ← hV] using Presieve.ofArrows_bind U.obj U.map _
      (fun _ f H => (V f H).obj) (fun _ f H => (V f H).map)
lemma zariskiTopology_openCover {Y : Scheme.{u}} (U : OpenCover.{v} Y) :
    zariskiTopology Y (Sieve.generate (Presieve.ofArrows U.obj U.map)) := by
  

Proof state:
Y : Scheme
U : OpenCover Y
⊢ GrothendieckTopology.sieves zariskiTopology Y (Sieve.generate (Presieve.ofArrows U.obj U.map))

Next tactic:
let V : OpenCover.{u} Y :=
    { J := Y
      obj := fun y => U.obj (U.f y)
      map := fun y => U.map (U.f y)
      f := id
      Covers := U.Covers
      IsOpen := fun _ => U.IsOpen _ }
lemma zariskiTopology_openCover {Y : Scheme.{u}} (U : OpenCover.{v} Y) :
    zariskiTopology Y (Sieve.generate (Presieve.ofArrows U.obj U.map)) := by
  let V : OpenCover.{u} Y :=
    { J := Y
      obj := fun y => U.obj (U.f y)
      map := fun y => U.map (U.f y)
      f := id
      Covers := U.Covers
      IsOpen := fun _ => U.IsOpen _ }
  

Proof state:
Y : Scheme
U : OpenCover Y
V : OpenCover Y :=
  OpenCover.mk (↑↑Y.toPresheafedSpace) (fun y => OpenCover.obj U (OpenCover.f U y))
    (fun y => OpenCover.map U (OpenCover.f U y)) id
    (_ : ∀ (x : ↑↑Y.toPresheafedSpace), x ∈ Set.range ⇑(OpenCover.map U (OpenCover.f U x)).val.base)
⊢ GrothendieckTopology.sieves zariskiTopology Y (Sieve.generate (Presieve.ofArrows U.obj U.map))

Next tactic:
refine' ⟨_, zariskiPretopology_openCover V, _⟩
lemma zariskiTopology_openCover {Y : Scheme.{u}} (U : OpenCover.{v} Y) :
    zariskiTopology Y (Sieve.generate (Presieve.ofArrows U.obj U.map)) := by
  let V : OpenCover.{u} Y :=
    { J := Y
      obj := fun y => U.obj (U.f y)
      map := fun y => U.map (U.f y)
      f := id
      Covers := U.Covers
      IsOpen := fun _ => U.IsOpen _ }
  refine' ⟨_, zariskiPretopology_openCover V, _⟩
  

Proof state:
Y : Scheme
U : OpenCover Y
V : OpenCover Y :=
  OpenCover.mk (↑↑Y.toPresheafedSpace) (fun y => OpenCover.obj U (OpenCover.f U y))
    (fun y => OpenCover.map U (OpenCover.f U y)) id
    (_ : ∀ (x : ↑↑Y.toPresheafedSpace), x ∈ Set.range ⇑(OpenCover.map U (OpenCover.f U x)).val.base)
⊢ Presieve.ofArrows V.obj V.map ≤ (Sieve.generate (Presieve.ofArrows U.obj U.map)).arrows

Next tactic:
rintro _ _ ⟨y⟩
lemma zariskiTopology_openCover {Y : Scheme.{u}} (U : OpenCover.{v} Y) :
    zariskiTopology Y (Sieve.generate (Presieve.ofArrows U.obj U.map)) := by
  let V : OpenCover.{u} Y :=
    { J := Y
      obj := fun y => U.obj (U.f y)
      map := fun y => U.map (U.f y)
      f := id
      Covers := U.Covers
      IsOpen := fun _ => U.IsOpen _ }
  refine' ⟨_, zariskiPretopology_openCover V, _⟩
  rintro _ _ ⟨y⟩
  

Proof state:
case mk
Y✝ : Scheme
U : OpenCover Y✝
V : OpenCover Y✝ :=
  OpenCover.mk (↑↑Y✝.toPresheafedSpace) (fun y => OpenCover.obj U (OpenCover.f U y))
    (fun y => OpenCover.map U (OpenCover.f U y)) id
    (_ : ∀ (x : ↑↑Y✝.toPresheafedSpace), x ∈ Set.range ⇑(OpenCover.map U (OpenCover.f U x)).val.base)
Y : Scheme
y : V.J
⊢ OpenCover.map V y ∈ (Sieve.generate (Presieve.ofArrows U.obj U.map)).arrows

Next tactic:
exact ⟨_, 𝟙 _, U.map (U.f y), ⟨_⟩, by simp⟩
lemma zariskiTopology_openCover {Y : Scheme.{u}} (U : OpenCover.{v} Y) :
    zariskiTopology Y (Sieve.generate (Presieve.ofArrows U.obj U.map)) := by
  let V : OpenCover.{u} Y :=
    { J := Y
      obj := fun y => U.obj (U.f y)
      map := fun y => U.map (U.f y)
      f := id
      Covers := U.Covers
      IsOpen := fun _ => U.IsOpen _ }
  refine' ⟨_, zariskiPretopology_openCover V, _⟩
  rintro _ _ ⟨y⟩
  exact ⟨_, 𝟙 _, U.map (U.f y), ⟨_⟩, by 

Proof state:
Y✝ : Scheme
U : OpenCover Y✝
V : OpenCover Y✝ :=
  OpenCover.mk (↑↑Y✝.toPresheafedSpace) (fun y => OpenCover.obj U (OpenCover.f U y))
    (fun y => OpenCover.map U (OpenCover.f U y)) id
    (_ : ∀ (x : ↑↑Y✝.toPresheafedSpace), x ∈ Set.range ⇑(OpenCover.map U (OpenCover.f U x)).val.base)
Y : Scheme
y : V.J
⊢ 𝟙 (OpenCover.obj V y) ≫ OpenCover.map U (OpenCover.f U y) = OpenCover.map V y

Next tactic:
simp
instance : Inhabited (PicardLindelof E) :=
  ⟨⟨0, 0, 0, ⟨0, le_rfl, le_rfl⟩, 0, 0, 0, 0,
      { ht₀ := by 

Proof state:
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℝ E
v : PicardLindelof E
⊢ ↑{ val := 0, property := (_ : 0 ≤ 0 ∧ 0 ≤ 0) } ∈ Icc 0 0

Next tactic:
rw [Subtype.coe_mk, Icc_self]
instance : Inhabited (PicardLindelof E) :=
  ⟨⟨0, 0, 0, ⟨0, le_rfl, le_rfl⟩, 0, 0, 0, 0,
      { ht₀ := by rw [Subtype.coe_mk, Icc_self]; 

Proof state:
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℝ E
v : PicardLindelof E
⊢ 0 ∈ {0}

Next tactic:
exact mem_singleton _
instance : Inhabited (PicardLindelof E) :=
  ⟨⟨0, 0, 0, ⟨0, le_rfl, le_rfl⟩, 0, 0, 0, 0,
      { ht₀ := by rw [Subtype.coe_mk, Icc_self]; exact mem_singleton _
        hR := le_rfl
        lipschitz := fun t _ => (LipschitzWith.const 0).lipschitzOnWith _
        cont := fun _ _ => by 

Proof state:
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℝ E
v : PicardLindelof E
x✝¹ : E
x✝ : x✝¹ ∈ closedBall 0 ↑0
⊢ ContinuousOn (fun t => OfNat.ofNat 0 t x✝¹) (Icc 0 0)

Next tactic:
simpa only [Pi.zero_apply] using continuousOn_const
theorem dist_t₀_le (t : Icc v.tMin v.tMax) : dist t v.t₀ ≤ v.tDist := by
  

Proof state:
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℝ E
v : PicardLindelof E
t : ↑(Icc v.tMin v.tMax)
⊢ dist t v.t₀ ≤ tDist v

Next tactic:
rw [Subtype.dist_eq, Real.dist_eq]
theorem dist_t₀_le (t : Icc v.tMin v.tMax) : dist t v.t₀ ≤ v.tDist := by
  rw [Subtype.dist_eq, Real.dist_eq]
  

Proof state:
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℝ E
v : PicardLindelof E
t : ↑(Icc v.tMin v.tMax)
⊢ |↑t - ↑v.t₀| ≤ tDist v

Next tactic:
rcases le_total t v.t₀ with ht | ht
theorem dist_t₀_le (t : Icc v.tMin v.tMax) : dist t v.t₀ ≤ v.tDist := by
  rw [Subtype.dist_eq, Real.dist_eq]
  rcases le_total t v.t₀ with ht | ht
  · 

Proof state:
case inl
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℝ E
v : PicardLindelof E
t : ↑(Icc v.tMin v.tMax)
ht : t ≤ v.t₀
⊢ |↑t - ↑v.t₀| ≤ tDist v

Next tactic:
rw [abs_of_nonpos (sub_nonpos.2 <| Subtype.coe_le_coe.2 ht), neg_sub]
theorem dist_t₀_le (t : Icc v.tMin v.tMax) : dist t v.t₀ ≤ v.tDist := by
  rw [Subtype.dist_eq, Real.dist_eq]
  rcases le_total t v.t₀ with ht | ht
  · rw [abs_of_nonpos (sub_nonpos.2 <| Subtype.coe_le_coe.2 ht), neg_sub]
    

Proof state:
case inl
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℝ E
v : PicardLindelof E
t : ↑(Icc v.tMin v.tMax)
ht : t ≤ v.t₀
⊢ ↑v.t₀ - ↑t ≤ tDist v

Next tactic:
exact (sub_le_sub_left t.2.1 _).trans (le_max_right _ _)
theorem dist_t₀_le (t : Icc v.tMin v.tMax) : dist t v.t₀ ≤ v.tDist := by
  rw [Subtype.dist_eq, Real.dist_eq]
  rcases le_total t v.t₀ with ht | ht
  · rw [abs_of_nonpos (sub_nonpos.2 <| Subtype.coe_le_coe.2 ht), neg_sub]
    exact (sub_le_sub_left t.2.1 _).trans (le_max_right _ _)
  · 

Proof state:
case inr
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℝ E
v : PicardLindelof E
t : ↑(Icc v.tMin v.tMax)
ht : v.t₀ ≤ t
⊢ |↑t - ↑v.t₀| ≤ tDist v

Next tactic:
rw [abs_of_nonneg (sub_nonneg.2 <| Subtype.coe_le_coe.2 ht)]
theorem dist_t₀_le (t : Icc v.tMin v.tMax) : dist t v.t₀ ≤ v.tDist := by
  rw [Subtype.dist_eq, Real.dist_eq]
  rcases le_total t v.t₀ with ht | ht
  · rw [abs_of_nonpos (sub_nonpos.2 <| Subtype.coe_le_coe.2 ht), neg_sub]
    exact (sub_le_sub_left t.2.1 _).trans (le_max_right _ _)
  · rw [abs_of_nonneg (sub_nonneg.2 <| Subtype.coe_le_coe.2 ht)]
    

Proof state:
case inr
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℝ E
v : PicardLindelof E
t : ↑(Icc v.tMin v.tMax)
ht : v.t₀ ≤ t
⊢ ↑t - ↑v.t₀ ≤ tDist v

Next tactic:
exact (sub_le_sub_right t.2.2 _).trans (le_max_left _ _)
theorem proj_of_mem {t : ℝ} (ht : t ∈ Icc v.tMin v.tMax) : ↑(v.proj t) = t := by
  

Proof state:
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℝ E
v : PicardLindelof E
t : ℝ
ht : t ∈ Icc v.tMin v.tMax
⊢ ↑(proj v t) = t

Next tactic:
simp only [proj, projIcc_of_mem v.tMin_le_tMax ht]
/-- Each curve in `PicardLindelof.FunSpace` is continuous. -/
def toContinuousMap : v.FunSpace ↪ C(Icc v.tMin v.tMax, E) :=
  ⟨fun f => ⟨f, f.continuous⟩, fun f g h => by 

Proof state:
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℝ E
v : PicardLindelof E
f✝ f g : FunSpace v
h : (fun f => ContinuousMap.mk f.toFun) f = (fun f => ContinuousMap.mk f.toFun) g
⊢ f = g

Next tactic:
cases f
/-- Each curve in `PicardLindelof.FunSpace` is continuous. -/
def toContinuousMap : v.FunSpace ↪ C(Icc v.tMin v.tMax, E) :=
  ⟨fun f => ⟨f, f.continuous⟩, fun f g h => by cases f; 

Proof state:
case mk
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℝ E
v : PicardLindelof E
f g : FunSpace v
toFun✝ : ↑(Icc v.tMin v.tMax) → E
map_t₀'✝ : toFun✝ v.t₀ = v.x₀
lipschitz'✝ : LipschitzWith v.C toFun✝
h :
  (fun f => ContinuousMap.mk f.toFun) { toFun := toFun✝, map_t₀' := map_t₀'✝, lipschitz' := lipschitz'✝ } =
    (fun f => ContinuousMap.mk f.toFun) g
⊢ { toFun := toFun✝, map_t₀' := map_t₀'✝, lipschitz' := lipschitz'✝ } = g

Next tactic:
cases g