Theorem: AlgebraicGeometry.AffineTargetMorphismProperty.IsLocal.affine_openCover_iff
File: Mathlib/AlgebraicGeometry/Morphisms/Basic.lean

tactic: refine ⟨fun H => let h := ((hP.affine_openCover_TFAE f).out 0 2).mp H; ?_,
  fun H => let h := ((hP.affine_openCover_TFAE f).out 1 0).mp; ?_⟩
state_before: P : AffineTargetMorphismProperty
hP : P.IsLocal
X Y : Scheme
f : X ⟶ Y
𝒰 : Y.OpenCover
h𝒰 : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)
⊢ targetAffineLocally P f ↔ ∀ (i : 𝒰.J), P pullback.snd
state_after: case refine_1
P : AffineTargetMorphismProperty
hP : P.IsLocal
X Y : Scheme
f : X ⟶ Y
𝒰 : Y.OpenCover
h𝒰 : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)
H : targetAffineLocally P f
h : ∀ (𝒰 : Y.OpenCover) [inst : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)] (i : 𝒰.J), P pullback.snd :=
  (List.TFAE.out (affine_openCover_TFAE hP f) 0 2
        (Eq.refl
          ([targetAffineLocally P f, ∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)), ∀ (i : 𝒰.J), P pullback.snd,
                ∀ (𝒰 : Y.OpenCover) [inst : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)] (i : 𝒰.J), P pullback.snd,
                ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd,
                ∃ ι U, ∃ (_ : iSup U = ⊤) (hU' : ∀ (i : ι), IsAffineOpen (U i)), ∀ (i : ι), P (f ∣_ U i)].get?
            0))
        (Eq.refl
          ([targetAffineLocally P f, ∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)), ∀ (i : 𝒰.J), P pullback.snd,
                ∀ (𝒰 : Y.OpenCover) [inst : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)] (i : 𝒰.J), P pullback.snd,
                ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd,
                ∃ ι U, ∃ (_ : iSup U = ⊤) (hU' : ∀ (i : ι), IsAffineOpen (U i)), ∀ (i : ι), P (f ∣_ U i)].get?
            2))).mp
    H
⊢ ∀ (i : 𝒰.J), P pullback.snd

case refine_2
P : AffineTargetMorphismProperty
hP : P.IsLocal
X Y : Scheme
f : X ⟶ Y
𝒰 : Y.OpenCover
h𝒰 : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)
H : ∀ (i : 𝒰.J), P pullback.snd
h : (∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)), ∀ (i : 𝒰.J), P pullback.snd) → targetAffineLocally P f :=
  (List.TFAE.out (affine_openCover_TFAE hP f) 1 0
      (Eq.refl
        ([targetAffineLocally P f, ∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)), ∀ (i : 𝒰.J), P pullback.snd,
              ∀ (𝒰 : Y.OpenCover) [inst : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)] (i : 𝒰.J), P pullback.snd,
              ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd,
              ∃ ι U, ∃ (_ : iSup U = ⊤) (hU' : ∀ (i : ι), IsAffineOpen (U i)), ∀ (i : ι), P (f ∣_ U i)].get?
          1))
      (Eq.refl
        ([targetAffineLocally P f, ∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)), ∀ (i : 𝒰.J), P pullback.snd,
              ∀ (𝒰 : Y.OpenCover) [inst : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)] (i : 𝒰.J), P pullback.snd,
              ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd,
              ∃ ι U, ∃ (_ : iSup U = ⊤) (hU' : ∀ (i : ι), IsAffineOpen (U i)), ∀ (i : ι), P (f ∣_ U i)].get?
          0))).mp
⊢ targetAffineLocally P f

tactic: exact fun i => h 𝒰 i
state_before: case refine_1
P : AffineTargetMorphismProperty
hP : P.IsLocal
X Y : Scheme
f : X ⟶ Y
𝒰 : Y.OpenCover
h𝒰 : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)
H : targetAffineLocally P f
h : ∀ (𝒰 : Y.OpenCover) [inst : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)] (i : 𝒰.J), P pullback.snd :=
  (List.TFAE.out (affine_openCover_TFAE hP f) 0 2
        (Eq.refl
          ([targetAffineLocally P f, ∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)), ∀ (i : 𝒰.J), P pullback.snd,
                ∀ (𝒰 : Y.OpenCover) [inst : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)] (i : 𝒰.J), P pullback.snd,
                ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd,
                ∃ ι U, ∃ (_ : iSup U = ⊤) (hU' : ∀ (i : ι), IsAffineOpen (U i)), ∀ (i : ι), P (f ∣_ U i)].get?
            0))
        (Eq.refl
          ([targetAffineLocally P f, ∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)), ∀ (i : 𝒰.J), P pullback.snd,
                ∀ (𝒰 : Y.OpenCover) [inst : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)] (i : 𝒰.J), P pullback.snd,
                ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd,
                ∃ ι U, ∃ (_ : iSup U = ⊤) (hU' : ∀ (i : ι), IsAffineOpen (U i)), ∀ (i : ι), P (f ∣_ U i)].get?
            2))).mp
    H
⊢ ∀ (i : 𝒰.J), P pullback.snd
state_after: no goals

tactic: exact h ⟨𝒰, inferInstance, H⟩
state_before: case refine_2
P : AffineTargetMorphismProperty
hP : P.IsLocal
X Y : Scheme
f : X ⟶ Y
𝒰 : Y.OpenCover
h𝒰 : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)
H : ∀ (i : 𝒰.J), P pullback.snd
h : (∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)), ∀ (i : 𝒰.J), P pullback.snd) → targetAffineLocally P f :=
  (List.TFAE.out (affine_openCover_TFAE hP f) 1 0
      (Eq.refl
        ([targetAffineLocally P f, ∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)), ∀ (i : 𝒰.J), P pullback.snd,
              ∀ (𝒰 : Y.OpenCover) [inst : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)] (i : 𝒰.J), P pullback.snd,
              ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd,
              ∃ ι U, ∃ (_ : iSup U = ⊤) (hU' : ∀ (i : ι), IsAffineOpen (U i)), ∀ (i : ι), P (f ∣_ U i)].get?
          1))
      (Eq.refl
        ([targetAffineLocally P f, ∃ 𝒰, ∃ (x : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)), ∀ (i : 𝒰.J), P pullback.snd,
              ∀ (𝒰 : Y.OpenCover) [inst : ∀ (i : 𝒰.J), IsAffine (𝒰.obj i)] (i : 𝒰.J), P pullback.snd,
              ∀ {U : Scheme} (g : U ⟶ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], P pullback.snd,
              ∃ ι U, ∃ (_ : iSup U = ⊤) (hU' : ∀ (i : ι), IsAffineOpen (U i)), ∀ (i : ι), P (f ∣_ U i)].get?
          0))).mp
⊢ targetAffineLocally P f
state_after: no goals