Datasets:
AI4M
/

text
stringlengths
0
3.34M
[GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝¹ : IsAffine X inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) ⊒ P (Scheme.Ξ“.map (f ∣_ Scheme.basicOpen Y r).op) ↔ P (IsLocalization.Away.map (↑(Y.presheaf.obj (Opposite.op (Scheme.basicOpen Y r)))) (↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r))))) (Scheme.Ξ“.map f.op) r) [PROOFSTEP] rw [Ξ“_map_morphismRestrict, hP.cancel_left_isIso, hP.cancel_right_isIso, ← hP.cancel_right_isIso (f.val.c.app (Opposite.op (Y.basicOpen r))) (X.presheaf.map (eqToHom (Scheme.preimage_basicOpen f r).symm).op), ← eq_iff_iff] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝¹ : IsAffine X inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) ⊒ P (NatTrans.app f.val.c (Opposite.op (Scheme.basicOpen Y r)) ≫ X.presheaf.map (eqToHom (_ : Scheme.basicOpen X (↑(NatTrans.app f.val.c (Opposite.op ⊀)) r) = (Opens.map f.val.base).obj (Scheme.basicOpen Y r))).op) = P (IsLocalization.Away.map (↑(Y.presheaf.obj (Opposite.op (Scheme.basicOpen Y r)))) (↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r))))) (Scheme.Ξ“.map f.op) r) [PROOFSTEP] congr [GOAL] case e_a P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝¹ : IsAffine X inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) ⊒ NatTrans.app f.val.c (Opposite.op (Scheme.basicOpen Y r)) ≫ X.presheaf.map (eqToHom (_ : Scheme.basicOpen X (↑(NatTrans.app f.val.c (Opposite.op ⊀)) r) = (Opens.map f.val.base).obj (Scheme.basicOpen Y r))).op = IsLocalization.Away.map (↑(Y.presheaf.obj (Opposite.op (Scheme.basicOpen Y r)))) (↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r))))) (Scheme.Ξ“.map f.op) r [PROOFSTEP] delta IsLocalization.Away.map [GOAL] case e_a P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝¹ : IsAffine X inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) ⊒ NatTrans.app f.val.c (Opposite.op (Scheme.basicOpen Y r)) ≫ X.presheaf.map (eqToHom (_ : Scheme.basicOpen X (↑(NatTrans.app f.val.c (Opposite.op ⊀)) r) = (Opens.map f.val.base).obj (Scheme.basicOpen Y r))).op = IsLocalization.map (↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r))))) (Scheme.Ξ“.map f.op) (_ : Submonoid.powers r ≀ Submonoid.comap (Scheme.Ξ“.map f.op) (Submonoid.powers (↑(Scheme.Ξ“.map f.op) r))) [PROOFSTEP] refine' IsLocalization.ringHom_ext (Submonoid.powers r) _ [GOAL] case e_a P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝¹ : IsAffine X inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) ⊒ comp (NatTrans.app f.val.c (Opposite.op (Scheme.basicOpen Y r)) ≫ X.presheaf.map (eqToHom (_ : Scheme.basicOpen X (↑(NatTrans.app f.val.c (Opposite.op ⊀)) r) = (Opens.map f.val.base).obj (Scheme.basicOpen Y r))).op) (algebraMap ↑(Y.presheaf.obj (Opposite.op ⊀)) ↑(Y.presheaf.obj (Opposite.op (Scheme.basicOpen Y r)))) = comp (IsLocalization.map (↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r))))) (Scheme.Ξ“.map f.op) (_ : Submonoid.powers r ≀ Submonoid.comap (Scheme.Ξ“.map f.op) (Submonoid.powers (↑(Scheme.Ξ“.map f.op) r)))) (algebraMap ↑(Y.presheaf.obj (Opposite.op ⊀)) ↑(Y.presheaf.obj (Opposite.op (Scheme.basicOpen Y r)))) [PROOFSTEP] generalize_proofs h1 h2 h3 [GOAL] case e_a P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝¹ : IsAffine X inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) h1 : Scheme.basicOpen X (↑(NatTrans.app f.val.c (Opposite.op ⊀)) r) = (Opens.map f.val.base).obj (Scheme.basicOpen Y r) h2 : IsLocalization.Away (↑(Scheme.Ξ“.map f.op) r) ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r)))) h3 : Submonoid.powers r ≀ Submonoid.comap (Scheme.Ξ“.map f.op) (Submonoid.powers (↑(Scheme.Ξ“.map f.op) r)) ⊒ comp (NatTrans.app f.val.c (Opposite.op (Scheme.basicOpen Y r)) ≫ X.presheaf.map (eqToHom h1).op) (algebraMap ↑(Y.presheaf.obj (Opposite.op ⊀)) ↑(Y.presheaf.obj (Opposite.op (Scheme.basicOpen Y r)))) = comp (IsLocalization.map (↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r))))) (Scheme.Ξ“.map f.op) h3) (algebraMap ↑(Y.presheaf.obj (Opposite.op ⊀)) ↑(Y.presheaf.obj (Opposite.op (Scheme.basicOpen Y r)))) [PROOFSTEP] haveI i1 := @isLocalization_away_of_isAffine X _ (Scheme.Ξ“.map f.op r) -- Porting note : needs to be very explicit here [GOAL] case e_a P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝¹ : IsAffine X inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) h1 : Scheme.basicOpen X (↑(NatTrans.app f.val.c (Opposite.op ⊀)) r) = (Opens.map f.val.base).obj (Scheme.basicOpen Y r) h2 : IsLocalization.Away (↑(Scheme.Ξ“.map f.op) r) ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r)))) h3 : Submonoid.powers r ≀ Submonoid.comap (Scheme.Ξ“.map f.op) (Submonoid.powers (↑(Scheme.Ξ“.map f.op) r)) i1 : IsLocalization.Away (↑(Scheme.Ξ“.map f.op) r) ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r)))) ⊒ comp (NatTrans.app f.val.c (Opposite.op (Scheme.basicOpen Y r)) ≫ X.presheaf.map (eqToHom h1).op) (algebraMap ↑(Y.presheaf.obj (Opposite.op ⊀)) ↑(Y.presheaf.obj (Opposite.op (Scheme.basicOpen Y r)))) = comp (IsLocalization.map (↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r))))) (Scheme.Ξ“.map f.op) h3) (algebraMap ↑(Y.presheaf.obj (Opposite.op ⊀)) ↑(Y.presheaf.obj (Opposite.op (Scheme.basicOpen Y r)))) [PROOFSTEP] convert (@IsLocalization.map_comp (hy := h3) (Y.presheaf.obj <| Opposite.op (Scheme.basicOpen Y r)) _ _ (isLocalization_away_of_isAffine _) _ _ _ i1).symm using 1 [GOAL] case h.e'_2.h P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝¹ : IsAffine X inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) h1 : Scheme.basicOpen X (↑(NatTrans.app f.val.c (Opposite.op ⊀)) r) = (Opens.map f.val.base).obj (Scheme.basicOpen Y r) h2 : IsLocalization.Away (↑(Scheme.Ξ“.map f.op) r) ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r)))) h3 : Submonoid.powers r ≀ Submonoid.comap (Scheme.Ξ“.map f.op) (Submonoid.powers (↑(Scheme.Ξ“.map f.op) r)) i1 : IsLocalization.Away (↑(Scheme.Ξ“.map f.op) r) ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r)))) e_1✝ : (↑(Y.presheaf.obj (Opposite.op ⊀)) β†’+* ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(NatTrans.app f.val.c (Opposite.op ⊀)) r))))) = (↑(Y.presheaf.obj (Opposite.op ⊀)) β†’+* ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r))))) ⊒ comp (NatTrans.app f.val.c (Opposite.op (Scheme.basicOpen Y r)) ≫ X.presheaf.map (eqToHom h1).op) (algebraMap ↑(Y.presheaf.obj (Opposite.op ⊀)) ↑(Y.presheaf.obj (Opposite.op (Scheme.basicOpen Y r)))) = comp (algebraMap ((fun x => ↑(X.presheaf.obj (Opposite.op ⊀))) r) ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r))))) (Scheme.Ξ“.map f.op) [PROOFSTEP] change Y.presheaf.map _ ≫ _ = _ ≫ X.presheaf.map _ [GOAL] case h.e'_2.h P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝¹ : IsAffine X inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) h1 : Scheme.basicOpen X (↑(NatTrans.app f.val.c (Opposite.op ⊀)) r) = (Opens.map f.val.base).obj (Scheme.basicOpen Y r) h2 : IsLocalization.Away (↑(Scheme.Ξ“.map f.op) r) ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r)))) h3 : Submonoid.powers r ≀ Submonoid.comap (Scheme.Ξ“.map f.op) (Submonoid.powers (↑(Scheme.Ξ“.map f.op) r)) i1 : IsLocalization.Away (↑(Scheme.Ξ“.map f.op) r) ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r)))) e_1✝ : (↑(Y.presheaf.obj (Opposite.op ⊀)) β†’+* ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(NatTrans.app f.val.c (Opposite.op ⊀)) r))))) = (↑(Y.presheaf.obj (Opposite.op ⊀)) β†’+* ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r))))) ⊒ Y.presheaf.map (homOfLE (_ : RingedSpace.basicOpen Y.toSheafedSpace r ≀ ⊀)).op ≫ NatTrans.app f.val.c (Opposite.op (Scheme.basicOpen Y r)) ≫ X.presheaf.map (eqToHom h1).op = Scheme.Ξ“.map f.op ≫ X.presheaf.map (homOfLE (_ : RingedSpace.basicOpen X.toSheafedSpace (↑(Scheme.Ξ“.map f.op) r) ≀ ⊀)).op [PROOFSTEP] rw [f.val.c.naturality_assoc] [GOAL] case h.e'_2.h P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝¹ : IsAffine X inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) h1 : Scheme.basicOpen X (↑(NatTrans.app f.val.c (Opposite.op ⊀)) r) = (Opens.map f.val.base).obj (Scheme.basicOpen Y r) h2 : IsLocalization.Away (↑(Scheme.Ξ“.map f.op) r) ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r)))) h3 : Submonoid.powers r ≀ Submonoid.comap (Scheme.Ξ“.map f.op) (Submonoid.powers (↑(Scheme.Ξ“.map f.op) r)) i1 : IsLocalization.Away (↑(Scheme.Ξ“.map f.op) r) ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r)))) e_1✝ : (↑(Y.presheaf.obj (Opposite.op ⊀)) β†’+* ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(NatTrans.app f.val.c (Opposite.op ⊀)) r))))) = (↑(Y.presheaf.obj (Opposite.op ⊀)) β†’+* ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r))))) ⊒ NatTrans.app f.val.c (Opposite.op ⊀) ≫ (f.val.base _* X.presheaf).map (homOfLE (_ : RingedSpace.basicOpen Y.toSheafedSpace r ≀ ⊀)).op ≫ X.presheaf.map (eqToHom h1).op = Scheme.Ξ“.map f.op ≫ X.presheaf.map (homOfLE (_ : RingedSpace.basicOpen X.toSheafedSpace (↑(Scheme.Ξ“.map f.op) r) ≀ ⊀)).op [PROOFSTEP] erw [← X.presheaf.map_comp] [GOAL] case h.e'_2.h P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝¹ : IsAffine X inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) h1 : Scheme.basicOpen X (↑(NatTrans.app f.val.c (Opposite.op ⊀)) r) = (Opens.map f.val.base).obj (Scheme.basicOpen Y r) h2 : IsLocalization.Away (↑(Scheme.Ξ“.map f.op) r) ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r)))) h3 : Submonoid.powers r ≀ Submonoid.comap (Scheme.Ξ“.map f.op) (Submonoid.powers (↑(Scheme.Ξ“.map f.op) r)) i1 : IsLocalization.Away (↑(Scheme.Ξ“.map f.op) r) ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r)))) e_1✝ : (↑(Y.presheaf.obj (Opposite.op ⊀)) β†’+* ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(NatTrans.app f.val.c (Opposite.op ⊀)) r))))) = (↑(Y.presheaf.obj (Opposite.op ⊀)) β†’+* ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r))))) ⊒ NatTrans.app f.val.c (Opposite.op ⊀) ≫ X.presheaf.map ((Opens.map f.val.base).op.map (homOfLE (_ : RingedSpace.basicOpen Y.toSheafedSpace r ≀ ⊀)).op ≫ (eqToHom h1).op) = Scheme.Ξ“.map f.op ≫ X.presheaf.map (homOfLE (_ : RingedSpace.basicOpen X.toSheafedSpace (↑(Scheme.Ξ“.map f.op) r) ≀ ⊀)).op [PROOFSTEP] congr 1 [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝¹ : IsAffine X inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) ⊒ P (Scheme.Ξ“.map (f ∣_ Scheme.basicOpen Y r).op) ↔ P (Localization.awayMap (Scheme.Ξ“.map f.op) r) [PROOFSTEP] refine (hP.basicOpen_iff _ _).trans ?_ -- Porting note : was a one line term mode proof, but this `dsimp` is vital so the term mode -- one liner is not possible [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝¹ : IsAffine X inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) ⊒ P (IsLocalization.Away.map (↑(Y.presheaf.obj (Opposite.op (Scheme.basicOpen Y r)))) (↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r))))) (Scheme.Ξ“.map f.op) r) ↔ P (Localization.awayMap (Scheme.Ξ“.map f.op) r) [PROOFSTEP] dsimp [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝¹ : IsAffine X inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) ⊒ P (IsLocalization.Away.map (↑(Y.presheaf.obj (Opposite.op (Scheme.basicOpen Y r)))) (↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(NatTrans.app f.val.c (Opposite.op ⊀)) r))))) (NatTrans.app f.val.c (Opposite.op ⊀)) r) ↔ P (Localization.awayMap (NatTrans.app f.val.c (Opposite.op ⊀)) r) [PROOFSTEP] rw [← hP.is_localization_away_iff] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U V : Opens ↑↑(Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace e : V = (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion V)) ≫ f ∣_ Scheme.basicOpen Y r).op) ↔ P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) [PROOFSTEP] subst e [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U))) ≫ f ∣_ Scheme.basicOpen Y r).op) ↔ P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) [PROOFSTEP] letI a1 : Algebra (Scheme.Ξ“.obj (Opposite.op Y)) (Scheme.Ξ“.obj (Opposite.op (Y.restrict (Y.basicOpen r).openEmbedding))) := Ξ“RestrictAlgebra _ [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U))) ≫ f ∣_ Scheme.basicOpen Y r).op) ↔ P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) [PROOFSTEP] let U' := ((Opens.map (X.ofRestrict ((Opens.map f.val.base).obj (Y.basicOpen r)).openEmbedding).val.base).obj U).openEmbedding [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U))) ≫ f ∣_ Scheme.basicOpen Y r).op) ↔ P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) [PROOFSTEP] letI a2 : Algebra (Scheme.Ξ“.obj (Opposite.op (X.restrict U.openEmbedding))) (Scheme.Ξ“.obj <| Opposite.op <| (X.restrict ((Opens.map f.val.base).obj (Y.basicOpen r)).openEmbedding).restrict U') := by apply RingHom.toAlgebra refine X.presheaf.map (@homOfLE _ _ ((IsOpenMap.functor _).obj _) ((IsOpenMap.functor _).obj _) ?_).op rw [← SetLike.coe_subset_coe, Functor.op_obj] dsimp [Opens.inclusion] simp only [Set.image_univ, Set.image_subset_iff, Subtype.range_val] rw [ContinuousMap.coe_mk, Subtype.range_val, ContinuousMap.coe_mk, ContinuousMap.coe_mk, Subtype.range_val] rfl [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) ⊒ Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) [PROOFSTEP] apply RingHom.toAlgebra [GOAL] case i P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) ⊒ ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) β†’+* ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) [PROOFSTEP] refine X.presheaf.map (@homOfLE _ _ ((IsOpenMap.functor _).obj _) ((IsOpenMap.functor _).obj _) ?_).op [GOAL] case i P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop [PROOFSTEP] rw [← SetLike.coe_subset_coe, Functor.op_obj] [GOAL] case i P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) ⊒ ↑((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).obj (Opposite.op ⊀).unop)).unop) βŠ† ↑((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop) [PROOFSTEP] dsimp [Opens.inclusion] [GOAL] case i P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) ⊒ ↑(ContinuousMap.mk Subtype.val) '' (↑(ContinuousMap.mk Subtype.val) '' Set.univ) βŠ† ↑(ContinuousMap.mk Subtype.val) '' Set.univ [PROOFSTEP] simp only [Set.image_univ, Set.image_subset_iff, Subtype.range_val] [GOAL] case i P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) ⊒ Set.range ↑(ContinuousMap.mk Subtype.val) βŠ† ↑(ContinuousMap.mk Subtype.val) ⁻¹' Set.range ↑(ContinuousMap.mk Subtype.val) [PROOFSTEP] rw [ContinuousMap.coe_mk, Subtype.range_val, ContinuousMap.coe_mk, ContinuousMap.coe_mk, Subtype.range_val] [GOAL] case i P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) ⊒ ↑((Opens.map (ContinuousMap.mk Subtype.val)).obj U) βŠ† Subtype.val ⁻¹' ↑U [PROOFSTEP] rfl [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) a2 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) := toAlgebra (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U))) ≫ f ∣_ Scheme.basicOpen Y r).op) ↔ P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) [PROOFSTEP] have i1 := AlgebraicGeometry.Ξ“_restrict_isLocalization Y r [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) a2 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) := toAlgebra (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) i1 : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U))) ≫ f ∣_ Scheme.basicOpen Y r).op) ↔ P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) [PROOFSTEP] have i2 : IsLocalization.Away ((Scheme.Ξ“.map (X.ofRestrict U.openEmbedding ≫ f).op) r) (Scheme.Ξ“.obj <| Opposite.op <| (X.restrict ((Opens.map f.val.base).obj (Y.basicOpen r)).openEmbedding).restrict U') := by rw [← U.openEmbedding_obj_top] at hU dsimp [Scheme.Ξ“_obj_op, Scheme.Ξ“_map_op, Scheme.restrict] apply AlgebraicGeometry.isLocalization_of_eq_basicOpen _ hU rw [Opens.openEmbedding_obj_top, Opens.functor_obj_map_obj] convert (X.basicOpen_res (Scheme.Ξ“.map f.op r) (homOfLE le_top).op).symm using 1 rw [Opens.openEmbedding_obj_top, Opens.openEmbedding_obj_top, inf_comm, Scheme.Ξ“_map_op] -- Porting note : changed `rw` to `erw` erw [← Scheme.preimage_basicOpen] -- Porting note : have to add many explicit variables [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) a2 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) := toAlgebra (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) i1 : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) ⊒ IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) [PROOFSTEP] rw [← U.openEmbedding_obj_top] at hU [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊀) a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) a2 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) := toAlgebra (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) i1 : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) ⊒ IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) [PROOFSTEP] dsimp [Scheme.Ξ“_obj_op, Scheme.Ξ“_map_op, Scheme.restrict] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊀) a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) a2 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) := toAlgebra (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) i1 : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) ⊒ IsLocalization.Away (↑(NatTrans.app f.val.c (Opposite.op ⊀) ≫ X.presheaf.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit ((Opens.map f.val.base).obj ⊀)).op) r) ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).obj U)))).obj ⊀)))) [PROOFSTEP] apply AlgebraicGeometry.isLocalization_of_eq_basicOpen _ hU [GOAL] case e P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊀) a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) a2 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) := toAlgebra (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) i1 : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).obj U)))).obj ⊀) = Scheme.basicOpen X (↑(NatTrans.app f.val.c (Opposite.op ⊀) ≫ X.presheaf.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit ((Opens.map f.val.base).obj ⊀)).op) r) [PROOFSTEP] rw [Opens.openEmbedding_obj_top, Opens.functor_obj_map_obj] [GOAL] case e P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊀) a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) a2 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) := toAlgebra (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) i1 : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ⊀ βŠ“ U = Scheme.basicOpen X (↑(NatTrans.app f.val.c (Opposite.op ⊀) ≫ X.presheaf.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit ((Opens.map f.val.base).obj ⊀)).op) r) [PROOFSTEP] convert (X.basicOpen_res (Scheme.Ξ“.map f.op r) (homOfLE le_top).op).symm using 1 [GOAL] case h.e'_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊀) a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) a2 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) := toAlgebra (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) i1 : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ⊀ βŠ“ U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊀ βŠ“ Scheme.basicOpen X (↑(Scheme.Ξ“.map f.op) r) [PROOFSTEP] rw [Opens.openEmbedding_obj_top, Opens.openEmbedding_obj_top, inf_comm, Scheme.Ξ“_map_op] -- Porting note : changed `rw` to `erw` [GOAL] case h.e'_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊀) a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) a2 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) := toAlgebra (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) i1 : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) ⊒ U βŠ“ (Opens.map f.val.base).obj (Scheme.basicOpen Y r) = U βŠ“ Scheme.basicOpen X (↑(NatTrans.app f.val.c (Opposite.op ⊀)) r) [PROOFSTEP] erw [← Scheme.preimage_basicOpen] -- Porting note : have to add many explicit variables [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) a2 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) := toAlgebra (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) i1 : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) i2 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U))) ≫ f ∣_ Scheme.basicOpen Y r).op) ↔ P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) [PROOFSTEP] have := @RespectsIso.is_localization_away_iff (hP := hP) (R := Scheme.Ξ“.obj <| Opposite.op Y) (S := Scheme.Ξ“.obj (Opposite.op (X.restrict U.openEmbedding))) (R' := Scheme.Ξ“.obj (Opposite.op (Y.restrict (Y.basicOpen r).openEmbedding))) (S' := Scheme.Ξ“.obj <| Opposite.op <| (X.restrict ((Opens.map f.val.base).obj (Y.basicOpen r)).openEmbedding).restrict U') _ _ _ _ _ _ (Scheme.Ξ“.map (X.ofRestrict U.openEmbedding ≫ f).op) r [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) a2 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) := toAlgebra (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) i1 : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) i2 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) this : βˆ€ [inst : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))] [inst_1 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))], P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↔ P (IsLocalization.Away.map (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))) (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U))) ≫ f ∣_ Scheme.basicOpen Y r).op) ↔ P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) [PROOFSTEP] rw [this, iff_iff_eq] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) a2 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) := toAlgebra (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) i1 : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) i2 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) this : βˆ€ [inst : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))] [inst_1 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))], P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↔ P (IsLocalization.Away.map (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))) (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U))) ≫ f ∣_ Scheme.basicOpen Y r).op) = P (IsLocalization.Away.map (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))) (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) [PROOFSTEP] congr 1 [GOAL] case e_a P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) a2 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) := toAlgebra (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) i1 : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) i2 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) this : βˆ€ [inst : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))] [inst_1 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))], P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↔ P (IsLocalization.Away.map (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))) (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ⊒ Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U))) ≫ f ∣_ Scheme.basicOpen Y r).op = IsLocalization.Away.map (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))) (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r [PROOFSTEP] apply IsLocalization.ringHom_ext (R := Scheme.Ξ“.obj (Opposite.op Y)) (Submonoid.powers r) _ [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) a2 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) := toAlgebra (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) i1 : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) i2 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) this : βˆ€ [inst : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))] [inst_1 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))], P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↔ P (IsLocalization.Away.map (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))) (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ⊒ comp (Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U))) ≫ f ∣_ Scheme.basicOpen Y r).op) (algebraMap ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))) = comp (IsLocalization.Away.map (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))) (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) (algebraMap ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))) [PROOFSTEP] rw [IsLocalization.Away.map, IsLocalization.map_comp, RingHom.algebraMap_toAlgebra] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) a2 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) := toAlgebra (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) i1 : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) i2 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) this : βˆ€ [inst : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))] [inst_1 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))], P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↔ P (IsLocalization.Away.map (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))) (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ⊒ comp (Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U))) ≫ f ∣_ Scheme.basicOpen Y r).op) (Scheme.Ξ“.map (Scheme.ofRestrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))).op) = comp (algebraMap ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U))))))) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) [PROOFSTEP] rw [op_comp, op_comp, Functor.map_comp, Functor.map_comp] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) a2 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) := toAlgebra (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) i1 : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) i2 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) this : βˆ€ [inst : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))] [inst_1 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))], P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↔ P (IsLocalization.Away.map (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))) (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ⊒ comp (Scheme.Ξ“.map (f ∣_ Scheme.basicOpen Y r).op ≫ Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op) (Scheme.Ξ“.map (Scheme.ofRestrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))).op) = comp (algebraMap ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U))))))) (Scheme.Ξ“.map f.op ≫ Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).op) [PROOFSTEP] change _ = comp (X.presheaf.map _) _ [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) a2 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) := toAlgebra (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) i1 : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) i2 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) this : βˆ€ [inst : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))] [inst_1 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))], P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↔ P (IsLocalization.Away.map (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))) (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ⊒ comp (Scheme.Ξ“.map (f ∣_ Scheme.basicOpen Y r).op ≫ Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op) (Scheme.Ξ“.map (Scheme.ofRestrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))).op) = comp (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) (Scheme.Ξ“.map f.op ≫ Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).op) [PROOFSTEP] refine' (@Category.assoc CommRingCat _ _ _ _ _ _ _ _).symm.trans _ [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) a2 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) := toAlgebra (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) i1 : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) i2 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) this : βˆ€ [inst : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))] [inst_1 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))], P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↔ P (IsLocalization.Away.map (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))) (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ⊒ (Scheme.Ξ“.map (Scheme.ofRestrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))).op ≫ Scheme.Ξ“.map (f ∣_ Scheme.basicOpen Y r).op) ≫ Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op = comp (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) (Scheme.Ξ“.map f.op ≫ Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).op) [PROOFSTEP] refine' Eq.trans _ (@Category.assoc CommRingCat _ _ _ _ _ _ _ _) [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) a2 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) := toAlgebra (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) i1 : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) i2 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) this : βˆ€ [inst : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))] [inst_1 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))], P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↔ P (IsLocalization.Away.map (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))) (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ⊒ (Scheme.Ξ“.map (Scheme.ofRestrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))).op ≫ Scheme.Ξ“.map (f ∣_ Scheme.basicOpen Y r).op) ≫ Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op = (Scheme.Ξ“.map f.op ≫ Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).op) ≫ X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op [PROOFSTEP] dsimp only [Scheme.Ξ“_map, Quiver.Hom.unop_op] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) a2 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) := toAlgebra (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) i1 : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) i2 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) this : βˆ€ [inst : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))] [inst_1 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))], P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↔ P (IsLocalization.Away.map (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))) (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ⊒ (NatTrans.app (Scheme.ofRestrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))).val.c (Opposite.op ⊀) ≫ NatTrans.app (f ∣_ Scheme.basicOpen Y r).val.c (Opposite.op ⊀)) ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).val.c (Opposite.op ⊀) = (NatTrans.app f.val.c (Opposite.op ⊀) ≫ NatTrans.app (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.c (Opposite.op ⊀)) ≫ X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op [PROOFSTEP] rw [morphismRestrict_c_app, Category.assoc, Category.assoc, Category.assoc] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) a2 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) := toAlgebra (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) i1 : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) i2 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) this : βˆ€ [inst : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))] [inst_1 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))], P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↔ P (IsLocalization.Away.map (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))) (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ⊒ NatTrans.app (Scheme.ofRestrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))).val.c (Opposite.op ⊀) ≫ NatTrans.app f.val.c (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen Y r)))).obj ⊀)) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((Opens.map (f ∣_ Scheme.basicOpen Y r).val.base).obj ⊀) = (Opens.map f.val.base).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen Y r)))).obj ⊀))).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).val.c (Opposite.op ⊀) = NatTrans.app f.val.c (Opposite.op ⊀) ≫ NatTrans.app (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.c (Opposite.op ⊀) ≫ X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op [PROOFSTEP] erw [f.1.c.naturality_assoc, ← X.presheaf.map_comp, ← X.presheaf.map_comp, ← X.presheaf.map_comp] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RespectsIso P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (Opposite.op ⊀)) U : Opens ↑↑X.toPresheafedSpace hU : IsAffineOpen U a1 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op Y)) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) := Ξ“RestrictAlgebra (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))) U' : OpenEmbedding ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)) := Opens.openEmbedding ((Opens.map (Scheme.ofRestrict X (Opens.openEmbedding ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))).val.base).obj U) a2 : Algebra ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) := toAlgebra (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) i1 : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r)))))) i2 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U'))) this : βˆ€ [inst : IsLocalization.Away r ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))] [inst_1 : IsLocalization.Away (↑(Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))], P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ↔ P (IsLocalization.Away.map (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen Y r))))))) (↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) U')))) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).op) r) ⊒ NatTrans.app f.val.c (Opposite.op ⊀) ≫ X.presheaf.map ((Opens.map f.val.base).op.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen Y r)))).counit (Opposite.op ⊀).unop).op ≫ (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((Opens.map (f ∣_ Scheme.basicOpen Y r).val.base).obj ⊀) = (Opens.map f.val.base).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen Y r)))).obj ⊀))).op ≫ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).op.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).counit (Opposite.op ⊀).unop).op) = NatTrans.app f.val.c (Opposite.op ⊀) ≫ X.presheaf.map ((NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit (Opposite.op ⊀).unop).op ≫ (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))).val.base).obj U)))).op.obj (Opposite.op ⊀)).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj (Opposite.op ⊀).unop)).op) [PROOFSTEP] congr 1 [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : StableUnderBaseChange P hP' : RespectsIso P X Y S : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Y inst✝ : IsAffine S f : X ⟢ S g : Y ⟢ S H : P (Scheme.Ξ“.map g.op) ⊒ P (Scheme.Ξ“.map pullback.fst.op) [PROOFSTEP] erw [← PreservesPullback.iso_inv_fst AffineScheme.forgetToScheme (AffineScheme.ofHom f) (AffineScheme.ofHom g)] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : StableUnderBaseChange P hP' : RespectsIso P X Y S : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Y inst✝ : IsAffine S f : X ⟢ S g : Y ⟢ S H : P (Scheme.Ξ“.map g.op) ⊒ P (Scheme.Ξ“.map ((PreservesPullback.iso AffineScheme.forgetToScheme (AffineScheme.ofHom f) (AffineScheme.ofHom g)).inv ≫ AffineScheme.forgetToScheme.map pullback.fst).op) [PROOFSTEP] rw [op_comp, Functor.map_comp, hP'.cancel_right_isIso, AffineScheme.forgetToScheme_map] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : StableUnderBaseChange P hP' : RespectsIso P X Y S : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Y inst✝ : IsAffine S f : X ⟢ S g : Y ⟢ S H : P (Scheme.Ξ“.map g.op) ⊒ P (Scheme.Ξ“.map pullback.fst.op) [PROOFSTEP] have := _root_.congr_arg Quiver.Hom.unop (PreservesPullback.iso_hom_fst AffineScheme.Ξ“.rightOp (AffineScheme.ofHom f) (AffineScheme.ofHom g)) [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : StableUnderBaseChange P hP' : RespectsIso P X Y S : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Y inst✝ : IsAffine S f : X ⟢ S g : Y ⟢ S H : P (Scheme.Ξ“.map g.op) this : ((PreservesPullback.iso AffineScheme.Ξ“.rightOp (AffineScheme.ofHom f) (AffineScheme.ofHom g)).hom ≫ pullback.fst).unop = (AffineScheme.Ξ“.rightOp.map pullback.fst).unop ⊒ P (Scheme.Ξ“.map pullback.fst.op) [PROOFSTEP] simp only [Quiver.Hom.unop_op, Functor.rightOp_map, unop_comp] at this [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : StableUnderBaseChange P hP' : RespectsIso P X Y S : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Y inst✝ : IsAffine S f : X ⟢ S g : Y ⟢ S H : P (Scheme.Ξ“.map g.op) this : pullback.fst.unop ≫ (PreservesPullback.iso AffineScheme.Ξ“.rightOp (AffineScheme.ofHom f) (AffineScheme.ofHom g)).hom.unop = AffineScheme.Ξ“.map pullback.fst.op ⊒ P (Scheme.Ξ“.map pullback.fst.op) [PROOFSTEP] delta AffineScheme.Ξ“ at this [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : StableUnderBaseChange P hP' : RespectsIso P X Y S : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Y inst✝ : IsAffine S f : X ⟢ S g : Y ⟢ S H : P (Scheme.Ξ“.map g.op) this : pullback.fst.unop ≫ (PreservesPullback.iso (AffineScheme.forgetToScheme.op β‹™ Scheme.Ξ“).rightOp (AffineScheme.ofHom f) (AffineScheme.ofHom g)).hom.unop = (AffineScheme.forgetToScheme.op β‹™ Scheme.Ξ“).map pullback.fst.op ⊒ P (Scheme.Ξ“.map pullback.fst.op) [PROOFSTEP] simp only [Quiver.Hom.unop_op, Functor.comp_map, AffineScheme.forgetToScheme_map, Functor.op_map] at this [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : StableUnderBaseChange P hP' : RespectsIso P X Y S : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Y inst✝ : IsAffine S f : X ⟢ S g : Y ⟢ S H : P (Scheme.Ξ“.map g.op) this : pullback.fst.unop ≫ (PreservesPullback.iso (AffineScheme.forgetToScheme.op β‹™ Scheme.Ξ“).rightOp (AffineScheme.ofHom f) (AffineScheme.ofHom g)).hom.unop = Scheme.Ξ“.map pullback.fst.op ⊒ P (Scheme.Ξ“.map pullback.fst.op) [PROOFSTEP] rw [← this, hP'.cancel_right_isIso, ← pushoutIsoUnopPullback_inl_hom (Quiver.Hom.unop _) (Quiver.Hom.unop _), hP'.cancel_right_isIso] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : StableUnderBaseChange P hP' : RespectsIso P X Y S : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Y inst✝ : IsAffine S f : X ⟢ S g : Y ⟢ S H : P (Scheme.Ξ“.map g.op) this : pullback.fst.unop ≫ (PreservesPullback.iso (AffineScheme.forgetToScheme.op β‹™ Scheme.Ξ“).rightOp (AffineScheme.ofHom f) (AffineScheme.ofHom g)).hom.unop = Scheme.Ξ“.map pullback.fst.op ⊒ P pushout.inl [PROOFSTEP] exact hP.pushout_inl _ hP' _ _ H [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P ⊒ MorphismProperty.RespectsIso (AffineTargetMorphismProperty.toProperty (sourceAffineLocally P)) [PROOFSTEP] apply AffineTargetMorphismProperty.respectsIso_mk [GOAL] case h₁ P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P ⊒ βˆ€ {X Y Z : Scheme} (e : X β‰… Y) (f : Y ⟢ Z) [inst : IsAffine Z], sourceAffineLocally P f β†’ sourceAffineLocally P (e.hom ≫ f) [PROOFSTEP] introv H U [GOAL] case h₁ P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P X Y Z : Scheme e : X β‰… Y f : Y ⟢ Z inst✝ : IsAffine Z H : sourceAffineLocally P f U : ↑(Scheme.affineOpens X) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ e.hom ≫ f).op) [PROOFSTEP] rw [← h₁.cancel_right_isIso _ (Scheme.Ξ“.map (Scheme.restrictMapIso e.inv U.1).hom.op), ← Functor.map_comp, ← op_comp] [GOAL] case h₁ P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P X Y Z : Scheme e : X β‰… Y f : Y ⟢ Z inst✝ : IsAffine Z H : sourceAffineLocally P f U : ↑(Scheme.affineOpens X) ⊒ P (Scheme.Ξ“.map ((Scheme.restrictMapIso e.inv ↑U).hom ≫ Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ e.hom ≫ f).op) [PROOFSTEP] convert H ⟨_, U.prop.map_isIso e.inv⟩ using 3 -- Porting note : have to add this instance manually [GOAL] case h.e'_5.h.e'_8.h.e'_5 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P X Y Z : Scheme e : X β‰… Y f : Y ⟢ Z inst✝ : IsAffine Z H : sourceAffineLocally P f U : ↑(Scheme.affineOpens X) ⊒ (Scheme.restrictMapIso e.inv ↑U).hom ≫ Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ e.hom ≫ f = Scheme.ofRestrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑{ val := (Opens.map e.inv.val.base).obj ↑U, property := (_ : IsAffineOpen ((Opens.map e.inv.val.base).obj ↑U)) })) ≫ f [PROOFSTEP] haveI i1 : IsOpenImmersion (Scheme.ofRestrict Y ((Opens.map e.inv.val.base).obj U.1).openEmbedding ≫ e.inv) := PresheafedSpace.IsOpenImmersion.comp _ _ [GOAL] case h.e'_5.h.e'_8.h.e'_5 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P X Y Z : Scheme e : X β‰… Y f : Y ⟢ Z inst✝ : IsAffine Z H : sourceAffineLocally P f U : ↑(Scheme.affineOpens X) i1 : IsOpenImmersion (Scheme.ofRestrict Y (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map e.inv.val.base).obj ↑U))) ≫ e.inv) ⊒ (Scheme.restrictMapIso e.inv ↑U).hom ≫ Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ e.hom ≫ f = Scheme.ofRestrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑{ val := (Opens.map e.inv.val.base).obj ↑U, property := (_ : IsAffineOpen ((Opens.map e.inv.val.base).obj ↑U)) })) ≫ f [PROOFSTEP] rw [IsOpenImmersion.isoOfRangeEq_hom, IsOpenImmersion.lift_fac_assoc, Category.assoc, e.inv_hom_id_assoc] [GOAL] case hβ‚‚ P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P ⊒ βˆ€ {X Y Z : Scheme} (e : Y β‰… Z) (f : X ⟢ Y) [h : IsAffine Y], sourceAffineLocally P f β†’ sourceAffineLocally P (f ≫ e.hom) [PROOFSTEP] introv H U [GOAL] case hβ‚‚ P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P X Y Z : Scheme e : Y β‰… Z f : X ⟢ Y h : IsAffine Y H : sourceAffineLocally P f U : ↑(Scheme.affineOpens X) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f ≫ e.hom).op) [PROOFSTEP] rw [← Category.assoc, op_comp, Functor.map_comp, h₁.cancel_left_isIso] [GOAL] case hβ‚‚ P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P X Y Z : Scheme e : Y β‰… Z f : X ⟢ Y h : IsAffine Y H : sourceAffineLocally P f U : ↑(Scheme.affineOpens X) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) [PROOFSTEP] exact H U [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y ⊒ affineLocally P f ↔ βˆ€ (U : ↑(Scheme.affineOpens Y)) (V : ↑(Scheme.affineOpens X)) (e : ↑V ≀ (Opens.map f.val.base).obj ↑U), P (Scheme.Hom.appLe f e) [PROOFSTEP] apply forall_congr' [GOAL] case h P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y ⊒ βˆ€ (a : ↑(Scheme.affineOpens Y)), sourceAffineLocally P (f ∣_ ↑a) ↔ βˆ€ (V : ↑(Scheme.affineOpens X)) (e : ↑V ≀ (Opens.map f.val.base).obj ↑a), P (Scheme.Hom.appLe f e) [PROOFSTEP] intro U [GOAL] case h P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) ⊒ sourceAffineLocally P (f ∣_ ↑U) ↔ βˆ€ (V : ↑(Scheme.affineOpens X)) (e : ↑V ≀ (Opens.map f.val.base).obj ↑U), P (Scheme.Hom.appLe f e) [PROOFSTEP] delta sourceAffineLocally [GOAL] case h P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) ⊒ (βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1)) ≫ f ∣_ ↑U).op)) ↔ βˆ€ (V : ↑(Scheme.affineOpens X)) (e : ↑V ≀ (Opens.map f.val.base).obj ↑U), P (Scheme.Hom.appLe f e) [PROOFSTEP] simp_rw [op_comp, Scheme.Ξ“.map_comp, Ξ“_map_morphismRestrict, Category.assoc, Scheme.Ξ“_map_op, hP.cancel_left_isIso] [GOAL] case h P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) ⊒ (βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀))) ↔ βˆ€ (V : ↑(Scheme.affineOpens X)) (e : ↑V ≀ (Opens.map f.val.base).obj ↑U), P (Scheme.Hom.appLe f e) [PROOFSTEP] constructor [GOAL] case h.mp P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) ⊒ (βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀))) β†’ βˆ€ (V : ↑(Scheme.affineOpens X)) (e : ↑V ≀ (Opens.map f.val.base).obj ↑U), P (Scheme.Hom.appLe f e) [PROOFSTEP] intro H V e [GOAL] case h.mp P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U ⊒ P (Scheme.Hom.appLe f e) [PROOFSTEP] let U' := (Opens.map f.val.base).obj U.1 [GOAL] case h.mp P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U ⊒ P (Scheme.Hom.appLe f e) [PROOFSTEP] have e' : U'.openEmbedding.isOpenMap.functor.obj ((Opens.map U'.inclusion).obj V.1) = V.1 := by ext1; refine' Set.image_preimage_eq_inter_range.trans (Set.inter_eq_left_iff_subset.mpr _) erw [Subtype.range_val] convert e [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V [PROOFSTEP] ext1 [GOAL] case h P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U ⊒ ↑((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V)) = ↑↑V [PROOFSTEP] refine' Set.image_preimage_eq_inter_range.trans (Set.inter_eq_left_iff_subset.mpr _) [GOAL] case h P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U ⊒ (↑V).1 βŠ† Set.range fun x => ↑(Opens.inclusion U') x [PROOFSTEP] erw [Subtype.range_val] [GOAL] case h P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U ⊒ (↑V).1 βŠ† ↑U' [PROOFSTEP] convert e [GOAL] case h.mp P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V ⊒ P (Scheme.Hom.appLe f e) [PROOFSTEP] have := H ⟨(Opens.map (X.ofRestrict U'.openEmbedding).1.base).obj V.1, ?_⟩ [GOAL] case h.mp.refine_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V this : P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑{ val := (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V, property := ?h.mp.refine_1 }))).val.c (op ⊀)) ⊒ P (Scheme.Hom.appLe f e) case h.mp.refine_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V ⊒ (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V ∈ Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) [PROOFSTEP] erw [← X.presheaf.map_comp] at this [GOAL] case h.mp.refine_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V this : P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map ((eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).op.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion ↑{ val := (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V, property := ?h.mp.refine_1 }))).counit (op ⊀).unop).op)) ⊒ P (Scheme.Hom.appLe f e) case h.mp.refine_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V ⊒ (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V ∈ Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) case h.mp.refine_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V ⊒ (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V ∈ Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) [PROOFSTEP] rw [← hP.cancel_right_isIso _ (X.presheaf.map (eqToHom _)), Category.assoc, ← X.presheaf.map_comp] [GOAL] case h.mp.refine_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V this : P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map ((eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).op.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion ↑{ val := (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V, property := ?h.mp.refine_1 }))).counit (op ⊀).unop).op)) ⊒ P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map ((homOfLE e).op ≫ eqToHom ?m.92694)) P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V this : P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map ((eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).op.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion ↑{ val := (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V, property := ?h.mp.refine_1 }))).counit (op ⊀).unop).op)) ⊒ (Opens ↑↑X.toPresheafedSpace)α΅’α΅– P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V this : P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map ((eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).op.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion ↑{ val := (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V, property := ?h.mp.refine_1 }))).counit (op ⊀).unop).op)) ⊒ op ↑V = ?m.93449 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V this : P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map ((eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).op.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion ↑{ val := (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V, property := ?h.mp.refine_1 }))).counit (op ⊀).unop).op)) ⊒ op ↑V = ?m.93449 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V this : P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map ((eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).op.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion ↑{ val := (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V, property := ?h.mp.refine_1 }))).counit (op ⊀).unop).op)) ⊒ op ↑V = ?m.93449 case h.mp.refine_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V ⊒ (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V ∈ Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) case h.mp.refine_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V ⊒ (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V ∈ Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) [PROOFSTEP] convert this using 1 [GOAL] case h.mp.refine_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V ⊒ (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V ∈ Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) [PROOFSTEP] apply (@isAffineOpen_iff_of_isOpenImmersion _ _ (@Scheme.ofRestrict _ X U'.inclusion _) ?_ _).mp [GOAL] case h.mp.refine_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V ⊒ IsAffineOpen ((PresheafedSpace.IsOpenImmersion.openFunctor ?m.94942).obj ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V)) P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V ⊒ IsOpenImmersion (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) [PROOFSTEP] erw [e'] [GOAL] case h.mp.refine_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V ⊒ IsAffineOpen ↑V P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V ⊒ IsOpenImmersion (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V ⊒ IsOpenImmersion (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) [PROOFSTEP] apply V.2 [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V ⊒ IsOpenImmersion (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V ⊒ IsOpenImmersion (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) [PROOFSTEP] infer_instance [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V this : P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map ((eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).op.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion ↑{ val := (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V, property := (_ : IsAffineOpen ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V)) }))).counit (op ⊀).unop).op)) ⊒ op ↑V = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).op.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑{ val := (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V, property := (_ : IsAffineOpen ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V)) }))).op.obj (op ⊀)) [PROOFSTEP] dsimp only [Functor.op, unop_op] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V this : P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map ((eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).op.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion ↑{ val := (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V, property := (_ : IsAffineOpen ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V)) }))).counit (op ⊀).unop).op)) ⊒ op ↑V = op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).val.base).obj ↑V)))).obj ⊀)) [PROOFSTEP] rw [Opens.openEmbedding_obj_top] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V this : P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map ((eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).op.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion ↑{ val := (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V, property := (_ : IsAffineOpen ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V)) }))).counit (op ⊀).unop).op)) ⊒ op ↑V = op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).val.base).obj ↑V)) [PROOFSTEP] congr 1 [GOAL] case e_x P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) V : ↑(Scheme.affineOpens X) e : ↑V ≀ (Opens.map f.val.base).obj ↑U U' : Opens ↑↑X.toPresheafedSpace := (Opens.map f.val.base).obj ↑U e' : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U'))).obj ((Opens.map (Opens.inclusion U')).obj ↑V) = ↑V this : P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map ((eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).op.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion ↑{ val := (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V, property := (_ : IsAffineOpen ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U'))).val.base).obj ↑V)) }))).counit (op ⊀).unop).op)) ⊒ ↑V = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).val.base).obj ↑V) [PROOFSTEP] apply e'.symm [GOAL] case h.mpr P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) ⊒ (βˆ€ (V : ↑(Scheme.affineOpens X)) (e : ↑V ≀ (Opens.map f.val.base).obj ↑U), P (Scheme.Hom.appLe f e)) β†’ βˆ€ (U_1 : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))))), P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U_1))).val.c (op ⊀)) [PROOFSTEP] intro H V [GOAL] case h.mpr P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) H : βˆ€ (V : ↑(Scheme.affineOpens X)) (e : ↑V ≀ (Opens.map f.val.base).obj ↑U), P (Scheme.Hom.appLe f e) V : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))) ⊒ P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑V))).val.c (op ⊀)) [PROOFSTEP] specialize H ⟨_, V.2.imageIsOpenImmersion (X.ofRestrict _)⟩ (Subtype.coe_image_subset _ _) [GOAL] case h.mpr P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) V : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))) H : P (Scheme.Hom.appLe f (_ : Subtype.val '' ↑↑V βŠ† ↑((Opens.map f.val.base).obj ↑U))) ⊒ P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))) (_ : OpenEmbedding ↑(Opens.inclusion ↑V))).val.c (op ⊀)) [PROOFSTEP] erw [← X.presheaf.map_comp] [GOAL] case h.mpr P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) V : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))) H : P (Scheme.Hom.appLe f (_ : Subtype.val '' ↑↑V βŠ† ↑((Opens.map f.val.base).obj ↑U))) ⊒ P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map ((eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).op.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion ↑V))).counit (op ⊀).unop).op)) [PROOFSTEP] rw [← hP.cancel_right_isIso _ (X.presheaf.map (eqToHom _)), Category.assoc, ← X.presheaf.map_comp] [GOAL] case h.mpr P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) V : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))) H : P (Scheme.Hom.appLe f (_ : Subtype.val '' ↑↑V βŠ† ↑((Opens.map f.val.base).obj ↑U))) ⊒ P (NatTrans.app f.val.c (op ↑U) ≫ X.presheaf.map (((eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ⊀ = (Opens.map f.val.base).obj ↑U)).op ≫ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).op.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion ↑V))).counit (op ⊀).unop).op) ≫ eqToHom ?m.96601)) P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) V : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))) H : P (Scheme.Hom.appLe f (_ : Subtype.val '' ↑↑V βŠ† ↑((Opens.map f.val.base).obj ↑U))) ⊒ (Opens ↑↑X.toPresheafedSpace)α΅’α΅– P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) V : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))) H : P (Scheme.Hom.appLe f (_ : Subtype.val '' ↑↑V βŠ† ↑((Opens.map f.val.base).obj ↑U))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).op.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑V))).op.obj (op ⊀)) = ?m.97455 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) V : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))) H : P (Scheme.Hom.appLe f (_ : Subtype.val '' ↑↑V βŠ† ↑((Opens.map f.val.base).obj ↑U))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).op.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑V))).op.obj (op ⊀)) = ?m.97455 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) V : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))) H : P (Scheme.Hom.appLe f (_ : Subtype.val '' ↑↑V βŠ† ↑((Opens.map f.val.base).obj ↑U))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).op.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑V))).op.obj (op ⊀)) = ?m.97455 [PROOFSTEP] convert H [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) V : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))) H : P (Scheme.Hom.appLe f (_ : Subtype.val '' ↑↑V βŠ† ↑((Opens.map f.val.base).obj ↑U))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).op.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑V))).op.obj (op ⊀)) = op ↑{ val := (Scheme.Hom.opensFunctor (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))).obj ↑V, property := (_ : IsAffineOpen ((Scheme.Hom.opensFunctor (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))).obj ↑V)) } [PROOFSTEP] dsimp only [Functor.op, unop_op] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.RespectsIso P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens Y) V : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))) H : P (Scheme.Hom.appLe f (_ : Subtype.val '' ↑↑V βŠ† ↑((Opens.map f.val.base).obj ↑U))) ⊒ op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U)))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑V))).obj ⊀)) = op ((Scheme.Hom.opensFunctor (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))).obj ↑V) [PROOFSTEP] rw [Opens.openEmbedding_obj_top] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (op ⊀)) H : sourceAffineLocally P f U : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))))) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f ∣_ Scheme.basicOpen Y r).op) [PROOFSTEP] specialize H ⟨_, U.2.imageIsOpenImmersion (X.ofRestrict _)⟩ [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (op ⊀)) U : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))))) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑{ val := (Scheme.Hom.opensFunctor (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))))).obj ↑U, property := (_ : IsAffineOpen ((Scheme.Hom.opensFunctor (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))))).obj ↑U)) })) ≫ f).op) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f ∣_ Scheme.basicOpen Y r).op) [PROOFSTEP] letI i1 : Algebra (Y.presheaf.obj <| Opposite.op ⊀) (Localization.Away r) := Localization.algebra [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (op ⊀)) U : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))))) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑{ val := (Scheme.Hom.opensFunctor (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))))).obj ↑U, property := (_ : IsAffineOpen ((Scheme.Hom.opensFunctor (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))))).obj ↑U)) })) ≫ f).op) i1 : Algebra (↑(Y.presheaf.obj (op ⊀))) (Localization.Away r) := Localization.algebra ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f ∣_ Scheme.basicOpen Y r).op) [PROOFSTEP] exact (h₁.ofRestrict_morphismRestrict_iff f r ((Scheme.Hom.opensFunctor (X.ofRestrict ((Opens.map f.1.base).obj <| Y.basicOpen r).openEmbedding)).obj U.1) (IsAffineOpen.imageIsOpenImmersion U.2 (X.ofRestrict ((Opens.map f.1.base).obj <| Y.basicOpen r).openEmbedding)) (Opens.ext (Set.preimage_image_eq _ Subtype.coe_injective).symm)).mpr (hβ‚‚.away r H) [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P h₃ : RingHom.OfLocalizationSpan P ⊒ AffineTargetMorphismProperty.IsLocal (sourceAffineLocally P) [PROOFSTEP] constructor [GOAL] case RespectsIso P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P h₃ : RingHom.OfLocalizationSpan P ⊒ MorphismProperty.RespectsIso (AffineTargetMorphismProperty.toProperty (sourceAffineLocally P)) [PROOFSTEP] exact sourceAffineLocally_respectsIso h₁ [GOAL] case toBasicOpen P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P h₃ : RingHom.OfLocalizationSpan P ⊒ βˆ€ {X Y : Scheme} [inst : IsAffine Y] (f : X ⟢ Y) (r : ↑(Y.presheaf.obj (op ⊀))), sourceAffineLocally P f β†’ sourceAffineLocally P (f ∣_ Scheme.basicOpen Y r) [PROOFSTEP] introv H U [GOAL] case toBasicOpen P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P h₃ : RingHom.OfLocalizationSpan P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (op ⊀)) H : sourceAffineLocally P f U : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))))) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r))))) (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f ∣_ Scheme.basicOpen Y r).op) [PROOFSTEP] apply scheme_restrict_basicOpen_of_localizationPreserves h₁ hβ‚‚ [GOAL] case toBasicOpen.H P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P h₃ : RingHom.OfLocalizationSpan P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y r : ↑(Y.presheaf.obj (op ⊀)) H : sourceAffineLocally P f U : ↑(Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y r)))))) ⊒ sourceAffineLocally P f [PROOFSTEP] assumption [GOAL] case ofBasicOpenCover P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P h₃ : RingHom.OfLocalizationSpan P ⊒ βˆ€ {X Y : Scheme} [inst : IsAffine Y] (f : X ⟢ Y) (s : Finset ↑(Y.presheaf.obj (op ⊀))), Ideal.span ↑s = ⊀ β†’ (βˆ€ (r : { x // x ∈ s }), sourceAffineLocally P (f ∣_ Scheme.basicOpen Y ↑r)) β†’ sourceAffineLocally P f [PROOFSTEP] introv hs hs' U [GOAL] case ofBasicOpenCover P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P h₃ : RingHom.OfLocalizationSpan P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y s : Finset ↑(Y.presheaf.obj (op ⊀)) hs : Ideal.span ↑s = ⊀ hs' : βˆ€ (r : { x // x ∈ s }), sourceAffineLocally P (f ∣_ Scheme.basicOpen Y ↑r) U : ↑(Scheme.affineOpens X) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) [PROOFSTEP] skip [GOAL] case ofBasicOpenCover P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P h₃ : RingHom.OfLocalizationSpan P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y s : Finset ↑(Y.presheaf.obj (op ⊀)) hs : Ideal.span ↑s = ⊀ hs' : βˆ€ (r : { x // x ∈ s }), sourceAffineLocally P (f ∣_ Scheme.basicOpen Y ↑r) U : ↑(Scheme.affineOpens X) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) [PROOFSTEP] apply h₃ _ _ hs [GOAL] case ofBasicOpenCover P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P h₃ : RingHom.OfLocalizationSpan P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y s : Finset ↑(Y.presheaf.obj (op ⊀)) hs : Ideal.span ↑s = ⊀ hs' : βˆ€ (r : { x // x ∈ s }), sourceAffineLocally P (f ∣_ Scheme.basicOpen Y ↑r) U : ↑(Scheme.affineOpens X) ⊒ βˆ€ (r : ↑↑s), P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) ↑r) [PROOFSTEP] intro r [GOAL] case ofBasicOpenCover P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P h₃ : RingHom.OfLocalizationSpan P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y s : Finset ↑(Y.presheaf.obj (op ⊀)) hs : Ideal.span ↑s = ⊀ hs' : βˆ€ (r : { x // x ∈ s }), sourceAffineLocally P (f ∣_ Scheme.basicOpen Y ↑r) U : ↑(Scheme.affineOpens X) r : ↑↑s ⊒ P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) ↑r) [PROOFSTEP] have := hs' r ⟨(Opens.map (X.ofRestrict _).1.base).obj U.1, ?_⟩ [GOAL] case ofBasicOpenCover.refine_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P h₃ : RingHom.OfLocalizationSpan P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y s : Finset ↑(Y.presheaf.obj (op ⊀)) hs : Ideal.span ↑s = ⊀ hs' : βˆ€ (r : { x // x ∈ s }), sourceAffineLocally P (f ∣_ Scheme.basicOpen Y ↑r) U : ↑(Scheme.affineOpens X) r : ↑↑s this : P (Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y ↑r))))) (_ : OpenEmbedding ↑(Opens.inclusion ↑{ val := (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y ↑r))))).val.base).obj ↑U, property := ?ofBasicOpenCover.refine_1 })) ≫ f ∣_ Scheme.basicOpen Y ↑r).op) ⊒ P (Localization.awayMap (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) ↑r) case ofBasicOpenCover.refine_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P h₃ : RingHom.OfLocalizationSpan P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y s : Finset ↑(Y.presheaf.obj (op ⊀)) hs : Ideal.span ↑s = ⊀ hs' : βˆ€ (r : { x // x ∈ s }), sourceAffineLocally P (f ∣_ Scheme.basicOpen Y ↑r) U : ↑(Scheme.affineOpens X) r : ↑↑s ⊒ (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y ↑r))))).val.base).obj ↑U ∈ Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y ↑r))))) [PROOFSTEP] rwa [h₁.ofRestrict_morphismRestrict_iff] at this [GOAL] case ofBasicOpenCover.refine_2.hU P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P h₃ : RingHom.OfLocalizationSpan P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y s : Finset ↑(Y.presheaf.obj (op ⊀)) hs : Ideal.span ↑s = ⊀ hs' : βˆ€ (r : { x // x ∈ s }), sourceAffineLocally P (f ∣_ Scheme.basicOpen Y ↑r) U : ↑(Scheme.affineOpens X) r : ↑↑s this : P (Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y ↑r))))) (_ : OpenEmbedding ↑(Opens.inclusion ↑{ val := (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y ↑r))))).val.base).obj ↑U, property := ?ofBasicOpenCover.refine_1 })) ≫ f ∣_ Scheme.basicOpen Y ↑r).op) ⊒ IsAffineOpen ↑U [PROOFSTEP] exact U.2 [GOAL] case ofBasicOpenCover.refine_2.e P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P h₃ : RingHom.OfLocalizationSpan P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y s : Finset ↑(Y.presheaf.obj (op ⊀)) hs : Ideal.span ↑s = ⊀ hs' : βˆ€ (r : { x // x ∈ s }), sourceAffineLocally P (f ∣_ Scheme.basicOpen Y ↑r) U : ↑(Scheme.affineOpens X) r : ↑↑s this : P (Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y ↑r))))) (_ : OpenEmbedding ↑(Opens.inclusion ↑{ val := (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y ↑r))))).val.base).obj ↑U, property := ?ofBasicOpenCover.refine_1 })) ≫ f ∣_ Scheme.basicOpen Y ↑r).op) ⊒ ↑{ val := (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y ↑r))))).val.base).obj ↑U, property := ?ofBasicOpenCover.refine_1 } = (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y ↑r))))).val.base).obj ↑U [PROOFSTEP] rfl [GOAL] case ofBasicOpenCover.refine_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P h₃ : RingHom.OfLocalizationSpan P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y s : Finset ↑(Y.presheaf.obj (op ⊀)) hs : Ideal.span ↑s = ⊀ hs' : βˆ€ (r : { x // x ∈ s }), sourceAffineLocally P (f ∣_ Scheme.basicOpen Y ↑r) U : ↑(Scheme.affineOpens X) r : ↑↑s ⊒ (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y ↑r))))).val.base).obj ↑U ∈ Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y ↑r))))) [PROOFSTEP] suffices βˆ€ (V) (_ : V = (Opens.map f.val.base).obj (Y.basicOpen r.val)), IsAffineOpen ((Opens.map (X.ofRestrict V.openEmbedding).1.base).obj U.1) by exact this _ rfl [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P h₃ : RingHom.OfLocalizationSpan P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y s : Finset ↑(Y.presheaf.obj (op ⊀)) hs : Ideal.span ↑s = ⊀ hs' : βˆ€ (r : { x // x ∈ s }), sourceAffineLocally P (f ∣_ Scheme.basicOpen Y ↑r) U : ↑(Scheme.affineOpens X) r : ↑↑s this : βˆ€ (V : Opens ↑↑X.toPresheafedSpace), V = (Opens.map f.val.base).obj (Scheme.basicOpen Y ↑r) β†’ IsAffineOpen ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion V))).val.base).obj ↑U) ⊒ (Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y ↑r))))).val.base).obj ↑U ∈ Scheme.affineOpens (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj (Scheme.basicOpen Y ↑r))))) [PROOFSTEP] exact this _ rfl [GOAL] case ofBasicOpenCover.refine_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P h₃ : RingHom.OfLocalizationSpan P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y s : Finset ↑(Y.presheaf.obj (op ⊀)) hs : Ideal.span ↑s = ⊀ hs' : βˆ€ (r : { x // x ∈ s }), sourceAffineLocally P (f ∣_ Scheme.basicOpen Y ↑r) U : ↑(Scheme.affineOpens X) r : ↑↑s ⊒ βˆ€ (V : Opens ↑↑X.toPresheafedSpace), V = (Opens.map f.val.base).obj (Scheme.basicOpen Y ↑r) β†’ IsAffineOpen ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion V))).val.base).obj ↑U) [PROOFSTEP] intro V hV [GOAL] case ofBasicOpenCover.refine_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P h₃ : RingHom.OfLocalizationSpan P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y s : Finset ↑(Y.presheaf.obj (op ⊀)) hs : Ideal.span ↑s = ⊀ hs' : βˆ€ (r : { x // x ∈ s }), sourceAffineLocally P (f ∣_ Scheme.basicOpen Y ↑r) U : ↑(Scheme.affineOpens X) r : ↑↑s V : Opens ↑↑X.toPresheafedSpace hV : V = (Opens.map f.val.base).obj (Scheme.basicOpen Y ↑r) ⊒ IsAffineOpen ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion V))).val.base).obj ↑U) [PROOFSTEP] rw [Scheme.preimage_basicOpen] at hV [GOAL] case ofBasicOpenCover.refine_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P h₃ : RingHom.OfLocalizationSpan P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y s : Finset ↑(Y.presheaf.obj (op ⊀)) hs : Ideal.span ↑s = ⊀ hs' : βˆ€ (r : { x // x ∈ s }), sourceAffineLocally P (f ∣_ Scheme.basicOpen Y ↑r) U : ↑(Scheme.affineOpens X) r : ↑↑s V : Opens ↑↑X.toPresheafedSpace hV : V = Scheme.basicOpen X (↑(NatTrans.app f.val.c (op ⊀)) ↑r) ⊒ IsAffineOpen ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion V))).val.base).obj ↑U) [PROOFSTEP] subst hV [GOAL] case ofBasicOpenCover.refine_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop h₁ : RingHom.RespectsIso P hβ‚‚ : RingHom.LocalizationPreserves P h₃ : RingHom.OfLocalizationSpan P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y s : Finset ↑(Y.presheaf.obj (op ⊀)) hs : Ideal.span ↑s = ⊀ hs' : βˆ€ (r : { x // x ∈ s }), sourceAffineLocally P (f ∣_ Scheme.basicOpen Y ↑r) U : ↑(Scheme.affineOpens X) r : ↑↑s ⊒ IsAffineOpen ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X (↑(NatTrans.app f.val.c (op ⊀)) ↑r))))).val.base).obj ↑U) [PROOFSTEP] exact U.2.mapRestrictBasicOpen (Scheme.Ξ“.map f.op r.1) [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs : Ideal.span s = ⊀ hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) [PROOFSTEP] apply_fun Ideal.map (X.presheaf.map (eqToHom U.1.openEmbedding_obj_top).op) at hs [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.map (X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) (Ideal.span s) = Ideal.map (X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) ⊀ ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) [PROOFSTEP] rw [Ideal.map_span, Ideal.map_top] at hs [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) [PROOFSTEP] apply h₃ _ _ hs [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ ⊒ βˆ€ (r : ↑(↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s)), P (RingHom.comp (algebraMap (↑(X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀)))) (Localization.Away ↑r)) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op)) [PROOFSTEP] rintro ⟨s, r, hr, hs⟩ [GOAL] case mk.intro.intro P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s✝ : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s✝), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs✝ : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s✝) = ⊀ s : ↑(X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀))) r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s✝ hs : ↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r = s ⊒ P (RingHom.comp (algebraMap (↑(X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀)))) (Localization.Away ↑{ val := s, property := (_ : βˆƒ a, a ∈ s✝ ∧ ↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) a = s) })) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op)) [PROOFSTEP] have := (@Localization.algEquiv _ _ _ _ _ _ (@AlgebraicGeometry.Ξ“_restrict_isLocalization _ U.2 s)).toRingEquiv.toCommRingCatIso [GOAL] case mk.intro.intro P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s✝ : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s✝), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs✝ : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s✝) = ⊀ s : ↑(X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀))) r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s✝ hs : ↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r = s this : CommRingCat.of (Localization (Submonoid.powers s)) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) s)))))) ⊒ P (RingHom.comp (algebraMap (↑(X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀)))) (Localization.Away ↑{ val := s, property := (_ : βˆƒ a, a ∈ s✝ ∧ ↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) a = s) })) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op)) [PROOFSTEP] refine (h₁.cancel_right_isIso _ (@Localization.algEquiv _ _ _ _ _ _ (@AlgebraicGeometry.Ξ“_restrict_isLocalization _ U.2 s)).toRingEquiv.toCommRingCatIso.hom).mp ?_ [GOAL] case mk.intro.intro P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s✝ : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s✝), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs✝ : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s✝) = ⊀ s : ↑(X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀))) r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s✝ hs : ↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r = s this : CommRingCat.of (Localization (Submonoid.powers s)) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) s)))))) ⊒ P (RingHom.comp (algebraMap (↑(X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀)))) (Localization.Away ↑{ val := s, property := (_ : βˆƒ a, a ∈ s✝ ∧ ↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) a = s) })) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) ≫ (RingEquiv.toCommRingCatIso (AlgEquiv.toRingEquiv (Localization.algEquiv (Submonoid.powers s) ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) s))))))))).hom) [PROOFSTEP] subst hs [GOAL] case mk.intro.intro P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ P (RingHom.comp (algebraMap (↑(X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀)))) (Localization.Away ↑{ val := ↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r, property := (_ : βˆƒ a, a ∈ s ∧ ↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) a = ↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r) })) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) ≫ (RingEquiv.toCommRingCatIso (AlgEquiv.toRingEquiv (Localization.algEquiv (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)) ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)))))))))).hom) [PROOFSTEP] rw [CommRingCat.comp_eq_ring_hom_comp, ← RingHom.comp_assoc] -- Porting note: here is where it gets bad; previously `erw [IsLocalization.map_comp]` -- ask Lean to synthesize instances and it runs away -- we also have to pass in one `Localization` instance now (and not before) [GOAL] case mk.intro.intro P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ P (RingHom.comp (RingHom.comp (RingEquiv.toCommRingCatIso (AlgEquiv.toRingEquiv (Localization.algEquiv (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)) ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)))))))))).hom (algebraMap (↑(X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀)))) (Localization.Away ↑{ val := ↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r, property := (_ : βˆƒ a, a ∈ s ∧ ↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) a = ↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r) }))) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op)) [PROOFSTEP] erw [@IsLocalization.map_comp _ _ _ _ _ (_) (Scheme.Ξ“.obj (Opposite.op (X.restrict U.1.openEmbedding))) _ (_) _ (Submonoid.powers (X.presheaf.map (eqToHom U.1.openEmbedding_obj_top).op r)) ((Scheme.Ξ“.obj (Opposite.op ((X.restrict U.1.openEmbedding).restrict ((X.restrict U.1.openEmbedding).basicOpen (X.presheaf.map (eqToHom U.1.openEmbedding_obj_top).op r)).openEmbedding)))) _ (le_of_eq rfl) (_) (@AlgebraicGeometry.Ξ“_restrict_isLocalization _ U.2 _)] [GOAL] case mk.intro.intro P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ P (RingHom.comp (RingHom.comp (algebraMap ↑(Scheme.Ξ“.obj (op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))) ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)))))))) ↑(RingEquiv.refl ↑(Scheme.Ξ“.obj (op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))))) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op)) [PROOFSTEP] erw [RingHom.comp_id] [GOAL] case mk.intro.intro P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ P (RingHom.comp (algebraMap ↑(Scheme.Ξ“.obj (op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))) ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)))))))) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op)) [PROOFSTEP] rw [RingHom.algebraMap_toAlgebra, op_comp, Functor.map_comp, ← CommRingCat.comp_eq_ring_hom_comp, Scheme.Ξ“_map_op, Scheme.Ξ“_map_op, Scheme.Ξ“_map_op, Category.assoc] [GOAL] case mk.intro.intro P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ P (NatTrans.app f.val.c (op ⊀) ≫ NatTrans.app (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))).val.c (op ⊀) ≫ NatTrans.app (Scheme.ofRestrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).val.c (op ⊀)) [PROOFSTEP] erw [← X.presheaf.map_comp] [GOAL] case mk.intro.intro P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ P (NatTrans.app f.val.c (op ⊀) ≫ X.presheaf.map ((NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion ↑U))).counit (op ⊀).unop).op ≫ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).op.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).counit (op ⊀).unop).op)) [PROOFSTEP] rw [← h₁.cancel_right_isIso _ (X.presheaf.map (eqToHom _))] [GOAL] case mk.intro.intro P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ P ((NatTrans.app f.val.c (op ⊀) ≫ X.presheaf.map ((NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion ↑U))).counit (op ⊀).unop).op ≫ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).op.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).counit (op ⊀).unop).op)) ≫ X.presheaf.map (eqToHom ?m.148221)) P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ (Opens ↑↑X.toPresheafedSpace)α΅’α΅– P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).op.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).op.obj (op ⊀)) = ?m.148220 [PROOFSTEP] convert hs' ⟨r, hr⟩ using 1 [GOAL] case h.e'_5.h P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) e_4✝ : CommRingCat.instCommRingΞ± (X.presheaf.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr })))).op.obj (op ⊀))) = CommRingCat.instCommRingΞ± (Scheme.Ξ“.obj (op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr })))))) ⊒ (NatTrans.app f.val.c (op ⊀) ≫ X.presheaf.map ((NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion ↑U))).counit (op ⊀).unop).op ≫ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).op.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).counit (op ⊀).unop).op)) ≫ X.presheaf.map (eqToHom ?m.148221) = Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr }))) ≫ f).op [PROOFSTEP] erw [Category.assoc] [GOAL] case h.e'_5.h P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) e_4✝ : CommRingCat.instCommRingΞ± (X.presheaf.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr })))).op.obj (op ⊀))) = CommRingCat.instCommRingΞ± (Scheme.Ξ“.obj (op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr })))))) ⊒ NatTrans.app f.val.c (op ⊀) ≫ X.presheaf.map ((NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion ↑U))).counit (op ⊀).unop).op ≫ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).op.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).counit (op ⊀).unop).op) ≫ X.presheaf.map (eqToHom ?m.148221) = Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr }))) ≫ f).op P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).op.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).op.obj (op ⊀)) = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr })))).op.obj (op ⊀) [PROOFSTEP] rw [← X.presheaf.map_comp, op_comp, Scheme.Ξ“.map_comp, Scheme.Ξ“_map_op, Scheme.Ξ“_map_op] [GOAL] case h.e'_5.h P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) e_4✝ : CommRingCat.instCommRingΞ± (X.presheaf.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr })))).op.obj (op ⊀))) = CommRingCat.instCommRingΞ± (Scheme.Ξ“.obj (op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr })))))) ⊒ NatTrans.app f.val.c (op ⊀) ≫ X.presheaf.map (((NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion ↑U))).counit (op ⊀).unop).op ≫ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).op.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).counit (op ⊀).unop).op) ≫ eqToHom ?m.148221) = NatTrans.app f.val.c (op ⊀) ≫ NatTrans.app (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr })))).val.c (op ⊀) P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).op.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).op.obj (op ⊀)) = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr })))).op.obj (op ⊀) P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).op.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).op.obj (op ⊀)) = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr })))).op.obj (op ⊀) P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).op.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).op.obj (op ⊀)) = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr })))).op.obj (op ⊀) P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).op.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).op.obj (op ⊀)) = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr })))).op.obj (op ⊀) P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).op.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).op.obj (op ⊀)) = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr })))).op.obj (op ⊀) P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).op.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).op.obj (op ⊀)) = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr })))).op.obj (op ⊀) [PROOFSTEP] congr! [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).op.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).op.obj (op ⊀)) = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr })))).op.obj (op ⊀) P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).op.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).op.obj (op ⊀)) = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr })))).op.obj (op ⊀) P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).op.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).op.obj (op ⊀)) = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr })))).op.obj (op ⊀) P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).op.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).op.obj (op ⊀)) = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr })))).op.obj (op ⊀) P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).op.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).op.obj (op ⊀)) = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr })))).op.obj (op ⊀) P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).op.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).op.obj (op ⊀)) = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr })))).op.obj (op ⊀) [PROOFSTEP] all_goals Β· dsimp [Functor.op] conv_lhs => rw [Opens.openEmbedding_obj_top] conv_rhs => rw [Opens.openEmbedding_obj_top] erw [Scheme.image_basicOpen (X.ofRestrict U.1.openEmbedding)] erw [PresheafedSpace.IsOpenImmersion.ofRestrict_invApp_apply] rw [Scheme.basicOpen_res_eq] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).op.obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).op.obj (op ⊀)) = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X ↑{ val := r, property := hr })))).op.obj (op ⊀) [PROOFSTEP] dsimp [Functor.op] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).obj ⊀)) = op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀) [PROOFSTEP] conv_lhs => rw [Opens.openEmbedding_obj_top] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) | op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).obj ⊀)) [PROOFSTEP] rw [Opens.openEmbedding_obj_top] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) | op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).obj ⊀)) [PROOFSTEP] rw [Opens.openEmbedding_obj_top] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) | op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))).obj ⊀)) [PROOFSTEP] rw [Opens.openEmbedding_obj_top] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) = op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀) [PROOFSTEP] conv_rhs => rw [Opens.openEmbedding_obj_top] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) | op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀) [PROOFSTEP] rw [Opens.openEmbedding_obj_top] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) | op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀) [PROOFSTEP] rw [Opens.openEmbedding_obj_top] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) | op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀) [PROOFSTEP] rw [Opens.openEmbedding_obj_top] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) = op (Scheme.basicOpen X r) [PROOFSTEP] erw [Scheme.image_basicOpen (X.ofRestrict U.1.openEmbedding)] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ op (Scheme.basicOpen X (↑(Scheme.Hom.invApp (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) ⊀) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) = op (Scheme.basicOpen X r) [PROOFSTEP] erw [PresheafedSpace.IsOpenImmersion.ofRestrict_invApp_apply] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P h₃ : RingHom.OfLocalizationSpanTarget P X Y : Scheme f : X ⟢ Y U : ↑(Scheme.affineOpens X) s : Set ↑(X.presheaf.obj (op ↑U)) hs' : βˆ€ (r : ↑s), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X ↑r))) ≫ f).op) hs : Ideal.span (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) '' s) = ⊀ r : ↑(X.presheaf.obj (op ↑U)) hr : r ∈ s this : CommRingCat.of (Localization (Submonoid.powers (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))) β‰… CommRingCat.of ↑(Scheme.Ξ“.obj (op (Scheme.restrict (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r))))))) ⊒ op (Scheme.basicOpen X (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)) = op (Scheme.basicOpen X r) [PROOFSTEP] rw [Scheme.basicOpen_res_eq] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P X Y Z : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Z f : X ⟢ Y inst✝ : IsOpenImmersion f g : Y ⟢ Z hβ‚‚ : sourceAffineLocally P g ⊒ P (Scheme.Ξ“.map (f ≫ g).op) [PROOFSTEP] rw [← h₁.cancel_right_isIso _ (Scheme.Ξ“.map (IsOpenImmersion.isoOfRangeEq (Y.ofRestrict _) f _).hom.op), ← Functor.map_comp, ← op_comp] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P X Y Z : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Z f : X ⟢ Y inst✝ : IsOpenImmersion f g : Y ⟢ Z hβ‚‚ : sourceAffineLocally P g ⊒ P (Scheme.Ξ“.map ((IsOpenImmersion.isoOfRangeEq (Scheme.ofRestrict Y ?m.164260) f ?m.164267).hom ≫ f ≫ g).op) P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P X Y Z : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Z f : X ⟢ Y inst✝ : IsOpenImmersion f g : Y ⟢ Z hβ‚‚ : sourceAffineLocally P g ⊒ TopCat P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P X Y Z : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Z f : X ⟢ Y inst✝ : IsOpenImmersion f g : Y ⟢ Z hβ‚‚ : sourceAffineLocally P g ⊒ ?m.164258 ⟢ TopCat.of ↑↑Y.toPresheafedSpace P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P X Y Z : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Z f : X ⟢ Y inst✝ : IsOpenImmersion f g : Y ⟢ Z hβ‚‚ : sourceAffineLocally P g ⊒ OpenEmbedding ↑?m.164259 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P X Y Z : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Z f : X ⟢ Y inst✝ : IsOpenImmersion f g : Y ⟢ Z hβ‚‚ : sourceAffineLocally P g ⊒ Set.range ↑(Scheme.ofRestrict Y ?m.164260).val.base = Set.range ↑f.val.base P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P X Y Z : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Z f : X ⟢ Y inst✝ : IsOpenImmersion f g : Y ⟢ Z hβ‚‚ : sourceAffineLocally P g ⊒ TopCat P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P X Y Z : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Z f : X ⟢ Y inst✝ : IsOpenImmersion f g : Y ⟢ Z hβ‚‚ : sourceAffineLocally P g ⊒ ?m.164258 ⟢ TopCat.of ↑↑Y.toPresheafedSpace P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P X Y Z : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Z f : X ⟢ Y inst✝ : IsOpenImmersion f g : Y ⟢ Z hβ‚‚ : sourceAffineLocally P g ⊒ OpenEmbedding ↑?m.164259 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P X Y Z : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Z f : X ⟢ Y inst✝ : IsOpenImmersion f g : Y ⟢ Z hβ‚‚ : sourceAffineLocally P g ⊒ Set.range ↑(Scheme.ofRestrict Y ?m.164260).val.base = Set.range ↑f.val.base P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P X Y Z : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Z f : X ⟢ Y inst✝ : IsOpenImmersion f g : Y ⟢ Z hβ‚‚ : sourceAffineLocally P g ⊒ TopCat P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P X Y Z : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Z f : X ⟢ Y inst✝ : IsOpenImmersion f g : Y ⟢ Z hβ‚‚ : sourceAffineLocally P g ⊒ ?m.164258 ⟢ TopCat.of ↑↑Y.toPresheafedSpace P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P X Y Z : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Z f : X ⟢ Y inst✝ : IsOpenImmersion f g : Y ⟢ Z hβ‚‚ : sourceAffineLocally P g ⊒ OpenEmbedding ↑?m.164259 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P X Y Z : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Z f : X ⟢ Y inst✝ : IsOpenImmersion f g : Y ⟢ Z hβ‚‚ : sourceAffineLocally P g ⊒ Set.range ↑(Scheme.ofRestrict Y ?m.164260).val.base = Set.range ↑f.val.base [PROOFSTEP] convert hβ‚‚ ⟨_, rangeIsAffineOpenOfOpenImmersion f⟩ using 3 [GOAL] case h.e'_5.h.h.e'_8.h.e'_5 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P X Y Z : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Z f : X ⟢ Y inst✝ : IsOpenImmersion f g : Y ⟢ Z hβ‚‚ : sourceAffineLocally P g ⊒ (IsOpenImmersion.isoOfRangeEq (Scheme.ofRestrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑{ val := Scheme.Hom.opensRange f, property := (_ : IsAffineOpen (Scheme.Hom.opensRange f)) }))) f ?m.164267).hom ≫ f ≫ g = Scheme.ofRestrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑{ val := Scheme.Hom.opensRange f, property := (_ : IsAffineOpen (Scheme.Hom.opensRange f)) })) ≫ g [PROOFSTEP] rw [IsOpenImmersion.isoOfRangeEq_hom, IsOpenImmersion.lift_fac_assoc] [GOAL] case h.e'_5.h.h.e'_8.h.e'_5.e P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : RingHom.PropertyIsLocal P h₁ : RingHom.RespectsIso P X Y Z : Scheme inst✝² : IsAffine X inst✝¹ : IsAffine Z f : X ⟢ Y inst✝ : IsOpenImmersion f g : Y ⟢ Z hβ‚‚ : sourceAffineLocally P g ⊒ Set.range ↑(Scheme.ofRestrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑{ val := Scheme.Hom.opensRange f, property := (_ : IsAffineOpen (Scheme.Hom.opensRange f)) }))).val.base = Set.range ↑f.val.base [PROOFSTEP] exact Subtype.range_coe [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) ⊒ sourceAffineLocally P f [PROOFSTEP] let S i := (⟨⟨Set.range (𝒰.map i).1.base, (𝒰.IsOpen i).base_open.open_range⟩, rangeIsAffineOpenOfOpenImmersion (𝒰.map i)⟩ : X.affineOpens) [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } ⊒ sourceAffineLocally P f [PROOFSTEP] intro U [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U : ↑(Scheme.affineOpens X) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) [PROOFSTEP] apply of_affine_open_cover (P := fun V => P (Scheme.Ξ“.map (X.ofRestrict (Opens.openEmbedding V.val) ≫ f).op)) U [GOAL] case hP₁ P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U : ↑(Scheme.affineOpens X) ⊒ βˆ€ (U : ↑(Scheme.affineOpens X)) (f_1 : ↑(X.presheaf.obj (Opposite.op ↑U))), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) β†’ P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑(Scheme.affineBasicOpen X f_1))) ≫ f).op) case hPβ‚‚ P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U : ↑(Scheme.affineOpens X) ⊒ βˆ€ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (Opposite.op ↑U))), Ideal.span ↑s = ⊀ β†’ (βˆ€ (f_1 : { x // x ∈ s }), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑(Scheme.affineBasicOpen X ↑f_1))) ≫ f).op)) β†’ P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) case hS P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U : ↑(Scheme.affineOpens X) ⊒ ⋃ (i : ↑?S), ↑↑↑i = Set.univ case hS' P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U : ↑(Scheme.affineOpens X) ⊒ βˆ€ (U : ↑?S), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑↑U)) ≫ f).op) case S P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U : ↑(Scheme.affineOpens X) ⊒ Set ↑(Scheme.affineOpens X) [PROOFSTEP] pick_goal 5 [GOAL] case S P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U : ↑(Scheme.affineOpens X) ⊒ Set ↑(Scheme.affineOpens X) [PROOFSTEP] exact Set.range S [GOAL] case hP₁ P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U : ↑(Scheme.affineOpens X) ⊒ βˆ€ (U : ↑(Scheme.affineOpens X)) (f_1 : ↑(X.presheaf.obj (Opposite.op ↑U))), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) β†’ P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑(Scheme.affineBasicOpen X f_1))) ≫ f).op) [PROOFSTEP] intro U r H [GOAL] case hP₁ P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑(Scheme.affineBasicOpen X r))) ≫ f).op) [PROOFSTEP] convert hP.StableUnderComposition (S := Scheme.Ξ“.obj (Opposite.op (X.restrict <| Opens.openEmbedding U.val))) (T := Scheme.Ξ“.obj (Opposite.op (X.restrict <| Opens.openEmbedding (X.basicOpen r)))) ?_ ?_ H ?_ using 1 [GOAL] case h.e'_5 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) ⊒ Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑(Scheme.affineBasicOpen X r))) ≫ f).op = comp ?hP₁.convert_1 (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) case hP₁.convert_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) ⊒ ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))) β†’+* ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X r)))))) case hP₁.convert_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) ⊒ P ?hP₁.convert_1 [PROOFSTEP] swap [GOAL] case hP₁.convert_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) ⊒ ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))) β†’+* ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X r)))))) [PROOFSTEP] refine' X.presheaf.map (@homOfLE _ _ ((IsOpenMap.functor _).obj _) ((IsOpenMap.functor _).obj _) _).op [GOAL] case hP₁.convert_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj (Opposite.op ⊀).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj (Opposite.op ⊀).unop [PROOFSTEP] rw [unop_op, unop_op, Opens.openEmbedding_obj_top, Opens.openEmbedding_obj_top] [GOAL] case hP₁.convert_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) ⊒ Scheme.basicOpen X r ≀ ↑U [PROOFSTEP] exact X.basicOpen_le _ [GOAL] case h.e'_5 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) ⊒ Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑(Scheme.affineBasicOpen X r))) ≫ f).op = comp (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj (Opposite.op ⊀).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj (Opposite.op ⊀).unop)).op) (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) [PROOFSTEP] rw [op_comp, op_comp, Functor.map_comp, Functor.map_comp] [GOAL] case h.e'_5 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) ⊒ Scheme.Ξ“.map f.op ≫ Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑(Scheme.affineBasicOpen X r)))).op = comp (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj (Opposite.op ⊀).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj (Opposite.op ⊀).unop)).op) (Scheme.Ξ“.map f.op ≫ Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))).op) [PROOFSTEP] refine' (Eq.trans _ (Category.assoc (obj := CommRingCat) _ _ _).symm : _) [GOAL] case h.e'_5 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) ⊒ Scheme.Ξ“.map f.op ≫ Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑(Scheme.affineBasicOpen X r)))).op = Scheme.Ξ“.map f.op ≫ Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))).op ≫ X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj (Opposite.op ⊀).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj (Opposite.op ⊀).unop)).op [PROOFSTEP] congr 1 [GOAL] case h.e'_5.e_a P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) ⊒ Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑(Scheme.affineBasicOpen X r)))).op = Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))).op ≫ X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj (Opposite.op ⊀).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj (Opposite.op ⊀).unop)).op [PROOFSTEP] dsimp [GOAL] case h.e'_5.e_a P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) ⊒ X.presheaf.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).counit ⊀).op = X.presheaf.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion ↑U))).counit ⊀).op ≫ X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀ ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀)).op [PROOFSTEP] refine' Eq.trans _ (X.presheaf.map_comp _ _) [GOAL] case h.e'_5.e_a P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) ⊒ X.presheaf.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).counit ⊀).op = X.presheaf.map ((NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion ↑U))).counit ⊀).op ≫ (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀ ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀)).op) [PROOFSTEP] change X.presheaf.map _ = _ [GOAL] case h.e'_5.e_a P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) ⊒ X.presheaf.map (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).counit ⊀).op = X.presheaf.map ((NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion ↑U))).counit ⊀).op ≫ (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀ ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀)).op) [PROOFSTEP] congr! -- Porting note: need to pass Algebra through explicitly [GOAL] case hP₁.convert_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) ⊒ P (X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj (Opposite.op ⊀).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj (Opposite.op ⊀).unop)).op) [PROOFSTEP] convert @HoldsForLocalizationAway _ hP _ (Scheme.Ξ“.obj (Opposite.op (X.restrict (X.basicOpen r).openEmbedding))) _ _ ?_ (X.presheaf.map (eqToHom U.1.openEmbedding_obj_top).op r) ?_ [GOAL] case h.e'_5.h.h P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) e_1✝ : ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))) = (fun x => (forget CommRingCat).obj (X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀)))) r he✝ : CommRingCat.instCommRingΞ± (Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))) = CommRingCat.instCommRing' (X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀))) ⊒ X.presheaf.map (homOfLE (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj (Opposite.op ⊀).unop ≀ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj (Opposite.op ⊀).unop)).op = algebraMap ((fun x => (forget CommRingCat).obj (X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀)))) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X r)))))) [PROOFSTEP] exact RingHom.algebraMap_toAlgebra (R := Scheme.Ξ“.obj <| Opposite.op <| X.restrict (U.1.openEmbedding)) (S := Scheme.Ξ“.obj (Opposite.op <| X.restrict (X.affineBasicOpen r).1.openEmbedding)) _ |>.symm [GOAL] case hP₁.convert_2.convert_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) ⊒ IsLocalization.Away (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r) ↑(Scheme.Ξ“.obj (Opposite.op (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X r)))))) [PROOFSTEP] dsimp [Scheme.Ξ“] [GOAL] case hP₁.convert_2.convert_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) ⊒ IsLocalization.Away (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r) ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀))) [PROOFSTEP] have := U.2 [GOAL] case hP₁.convert_2.convert_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) this : ↑U ∈ Scheme.affineOpens X ⊒ IsLocalization.Away (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r) ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀))) [PROOFSTEP] rw [← U.1.openEmbedding_obj_top] at this [GOAL] case hP₁.convert_2.convert_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) this : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ ∈ Scheme.affineOpens X ⊒ IsLocalization.Away (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r) ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀))) [PROOFSTEP] convert (config := { typeEqs := true, transparency := .default }) isLocalization_basicOpen this _ using 5 [GOAL] case h.e'_4.h.e'_2.h.e'_6.h.e'_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) this : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ ∈ Scheme.affineOpens X ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀ = Scheme.basicOpen X (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r) case h.e'_5.e'_2.e'_1.h.e'_6.h.e'_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) this : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ ∈ Scheme.affineOpens X e_4✝ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀ = Scheme.basicOpen X (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r) case h.e'_6.e'_2.h.e'_2.h.e'_6.h.e'_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) this : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ ∈ Scheme.affineOpens X e_4✝ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)))) e_5✝ : HEq CommRing.toCommSemiring CommRing.toCommSemiring ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀ = RingedSpace.basicOpen X.toSheafedSpace (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r) case h.e'_6.e'_5.h.e'_7.h.e'_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) this : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ ∈ Scheme.affineOpens X e_4✝¹ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)))) e_5✝ : HEq CommRing.toCommSemiring CommRing.toCommSemiring e_1✝ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀))) e_2✝ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op (RingedSpace.basicOpen X.toSheafedSpace (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)))) he✝ : CommRing.toCommSemiring = CommRing.toCommSemiring e_4✝ : HEq CommRing.toCommSemiring CommRing.toCommSemiring ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀ = RingedSpace.basicOpen X.toSheafedSpace (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r) case h.e'_6.e'_5.h.e'_8.e'_3 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) this : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ ∈ Scheme.affineOpens X e_4✝¹ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)))) e_5✝ : HEq CommRing.toCommSemiring CommRing.toCommSemiring e_1✝ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀))) e_2✝ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op (RingedSpace.basicOpen X.toSheafedSpace (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)))) he✝ : CommRing.toCommSemiring = CommRing.toCommSemiring e_4✝ : HEq CommRing.toCommSemiring CommRing.toCommSemiring e_7✝ : Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀) = Opposite.op (RingedSpace.basicOpen X.toSheafedSpace (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀ = RingedSpace.basicOpen X.toSheafedSpace (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r) [PROOFSTEP] all_goals rw [Opens.openEmbedding_obj_top]; exact (Scheme.basicOpen_res_eq _ _ _).symm [GOAL] case h.e'_4.h.e'_2.h.e'_6.h.e'_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) this : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ ∈ Scheme.affineOpens X ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀ = Scheme.basicOpen X (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r) [PROOFSTEP] rw [Opens.openEmbedding_obj_top] [GOAL] case h.e'_4.h.e'_2.h.e'_6.h.e'_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) this : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ ∈ Scheme.affineOpens X ⊒ Scheme.basicOpen X r = Scheme.basicOpen X (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r) [PROOFSTEP] exact (Scheme.basicOpen_res_eq _ _ _).symm [GOAL] case h.e'_5.e'_2.e'_1.h.e'_6.h.e'_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) this : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ ∈ Scheme.affineOpens X e_4✝ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)))) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀ = Scheme.basicOpen X (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r) [PROOFSTEP] rw [Opens.openEmbedding_obj_top] [GOAL] case h.e'_5.e'_2.e'_1.h.e'_6.h.e'_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) this : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ ∈ Scheme.affineOpens X e_4✝ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)))) ⊒ Scheme.basicOpen X r = Scheme.basicOpen X (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r) [PROOFSTEP] exact (Scheme.basicOpen_res_eq _ _ _).symm [GOAL] case h.e'_6.e'_2.h.e'_2.h.e'_6.h.e'_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) this : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ ∈ Scheme.affineOpens X e_4✝ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)))) e_5✝ : HEq CommRing.toCommSemiring CommRing.toCommSemiring ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀ = RingedSpace.basicOpen X.toSheafedSpace (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r) [PROOFSTEP] rw [Opens.openEmbedding_obj_top] [GOAL] case h.e'_6.e'_2.h.e'_2.h.e'_6.h.e'_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) this : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ ∈ Scheme.affineOpens X e_4✝ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)))) e_5✝ : HEq CommRing.toCommSemiring CommRing.toCommSemiring ⊒ Scheme.basicOpen X r = RingedSpace.basicOpen X.toSheafedSpace (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r) [PROOFSTEP] exact (Scheme.basicOpen_res_eq _ _ _).symm [GOAL] case h.e'_6.e'_5.h.e'_7.h.e'_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) this : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ ∈ Scheme.affineOpens X e_4✝¹ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)))) e_5✝ : HEq CommRing.toCommSemiring CommRing.toCommSemiring e_1✝ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀))) e_2✝ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op (RingedSpace.basicOpen X.toSheafedSpace (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)))) he✝ : CommRing.toCommSemiring = CommRing.toCommSemiring e_4✝ : HEq CommRing.toCommSemiring CommRing.toCommSemiring ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀ = RingedSpace.basicOpen X.toSheafedSpace (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r) [PROOFSTEP] rw [Opens.openEmbedding_obj_top] [GOAL] case h.e'_6.e'_5.h.e'_7.h.e'_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) this : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ ∈ Scheme.affineOpens X e_4✝¹ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)))) e_5✝ : HEq CommRing.toCommSemiring CommRing.toCommSemiring e_1✝ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀))) e_2✝ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op (RingedSpace.basicOpen X.toSheafedSpace (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)))) he✝ : CommRing.toCommSemiring = CommRing.toCommSemiring e_4✝ : HEq CommRing.toCommSemiring CommRing.toCommSemiring ⊒ Scheme.basicOpen X r = RingedSpace.basicOpen X.toSheafedSpace (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r) [PROOFSTEP] exact (Scheme.basicOpen_res_eq _ _ _).symm [GOAL] case h.e'_6.e'_5.h.e'_8.e'_3 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) this : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ ∈ Scheme.affineOpens X e_4✝¹ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)))) e_5✝ : HEq CommRing.toCommSemiring CommRing.toCommSemiring e_1✝ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀))) e_2✝ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op (RingedSpace.basicOpen X.toSheafedSpace (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)))) he✝ : CommRing.toCommSemiring = CommRing.toCommSemiring e_4✝ : HEq CommRing.toCommSemiring CommRing.toCommSemiring e_7✝ : Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀) = Opposite.op (RingedSpace.basicOpen X.toSheafedSpace (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)) ⊒ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀ = RingedSpace.basicOpen X.toSheafedSpace (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r) [PROOFSTEP] rw [Opens.openEmbedding_obj_top] [GOAL] case h.e'_6.e'_5.h.e'_8.e'_3 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H✝ : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) r : ↑(X.presheaf.obj (Opposite.op ↑U)) H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) this : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ ∈ Scheme.affineOpens X e_4✝¹ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op (Scheme.basicOpen X (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)))) e_5✝ : HEq CommRing.toCommSemiring CommRing.toCommSemiring e_1✝ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀))) e_2✝ : ↑(X.presheaf.obj (Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀))) = ↑(X.presheaf.obj (Opposite.op (RingedSpace.basicOpen X.toSheafedSpace (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)))) he✝ : CommRing.toCommSemiring = CommRing.toCommSemiring e_4✝ : HEq CommRing.toCommSemiring CommRing.toCommSemiring e_7✝ : Opposite.op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion (Scheme.basicOpen X r)))).obj ⊀) = Opposite.op (RingedSpace.basicOpen X.toSheafedSpace (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r)) ⊒ Scheme.basicOpen X r = RingedSpace.basicOpen X.toSheafedSpace (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion ↑U))).obj ⊀ = ↑U)).op) r) [PROOFSTEP] exact (Scheme.basicOpen_res_eq _ _ _).symm [GOAL] case hPβ‚‚ P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U : ↑(Scheme.affineOpens X) ⊒ βˆ€ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (Opposite.op ↑U))), Ideal.span ↑s = ⊀ β†’ (βˆ€ (f_1 : { x // x ∈ s }), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑(Scheme.affineBasicOpen X ↑f_1))) ≫ f).op)) β†’ P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) [PROOFSTEP] introv hs hs' [GOAL] case hPβ‚‚ P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U✝ U : ↑(Scheme.affineOpens X) s : Finset ↑(X.presheaf.obj (Opposite.op ↑U)) hs : Ideal.span ↑s = ⊀ hs' : βˆ€ (f_1 : { x // x ∈ s }), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑(Scheme.affineBasicOpen X ↑f_1))) ≫ f).op) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑U)) ≫ f).op) [PROOFSTEP] exact sourceAffineLocally_of_source_open_cover_aux hP.respectsIso hP.2 _ _ _ hs hs' [GOAL] case hS P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U : ↑(Scheme.affineOpens X) ⊒ ⋃ (i : ↑(Set.range S)), ↑↑↑i = Set.univ [PROOFSTEP] rw [Set.eq_univ_iff_forall] [GOAL] case hS P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U : ↑(Scheme.affineOpens X) ⊒ βˆ€ (x : ↑↑X.toPresheafedSpace), x ∈ ⋃ (i : ↑(Set.range S)), ↑↑↑i [PROOFSTEP] intro x [GOAL] case hS P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U : ↑(Scheme.affineOpens X) x : ↑↑X.toPresheafedSpace ⊒ x ∈ ⋃ (i : ↑(Set.range S)), ↑↑↑i [PROOFSTEP] rw [Set.mem_iUnion] [GOAL] case hS P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U : ↑(Scheme.affineOpens X) x : ↑↑X.toPresheafedSpace ⊒ βˆƒ i, x ∈ ↑↑↑i [PROOFSTEP] exact ⟨⟨_, 𝒰.f x, rfl⟩, 𝒰.Covers x⟩ [GOAL] case hS' P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U : ↑(Scheme.affineOpens X) ⊒ βˆ€ (U : ↑(Set.range S)), P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑↑U)) ≫ f).op) [PROOFSTEP] rintro ⟨_, i, rfl⟩ [GOAL] case hS'.mk.intro P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U : ↑(Scheme.affineOpens X) i : 𝒰.J ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑↑{ val := S i, property := (_ : βˆƒ y, S y = S i) })) ≫ f).op) [PROOFSTEP] specialize H i [GOAL] case hS'.mk.intro P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U : ↑(Scheme.affineOpens X) i : 𝒰.J H : P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑↑{ val := S i, property := (_ : βˆƒ y, S y = S i) })) ≫ f).op) [PROOFSTEP] rw [← hP.respectsIso.cancel_right_isIso _ (Scheme.Ξ“.map (IsOpenImmersion.isoOfRangeEq (𝒰.map i) (X.ofRestrict (S i).1.openEmbedding) Subtype.range_coe.symm).inv.op)] at H [GOAL] case hS'.mk.intro P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) S : 𝒰.J β†’ { x // x ∈ Scheme.affineOpens X } := fun i => { val := { carrier := Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base, is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange (Scheme.OpenCover.map 𝒰 i))) } U : ↑(Scheme.affineOpens X) i : 𝒰.J H : P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op ≫ Scheme.Ξ“.map (IsOpenImmersion.isoOfRangeEq (Scheme.OpenCover.map 𝒰 i) (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑(S i)))) (_ : Set.range ↑(Scheme.OpenCover.map 𝒰 i).val.base = Set.range Subtype.val)).inv.op) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑↑{ val := S i, property := (_ : βˆƒ y, S y = S i) })) ≫ f).op) [PROOFSTEP] rwa [← Scheme.Ξ“.map_comp, ← op_comp, IsOpenImmersion.isoOfRangeEq_inv, IsOpenImmersion.lift_fac_assoc] at H [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y ⊒ List.TFAE [sourceAffineLocally P f, βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op), βˆ€ (𝒰 : Scheme.OpenCover X) [inst : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op), βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op)] [PROOFSTEP] tfae_have 1 β†’ 4 [GOAL] case tfae_1_to_4 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y ⊒ sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) [PROOFSTEP] intro H U g _ hg [GOAL] case tfae_1_to_4 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝¹ : IsAffine Y f : X ⟢ Y H : sourceAffineLocally P f U : Scheme g : U ⟢ X inst✝ : IsAffine U hg : IsOpenImmersion g ⊒ P (Scheme.Ξ“.map (g ≫ f).op) [PROOFSTEP] skip [GOAL] case tfae_1_to_4 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝¹ : IsAffine Y f : X ⟢ Y H : sourceAffineLocally P f U : Scheme g : U ⟢ X inst✝ : IsAffine U hg : IsOpenImmersion g ⊒ P (Scheme.Ξ“.map (g ≫ f).op) [PROOFSTEP] specialize H ⟨⟨_, hg.base_open.open_range⟩, rangeIsAffineOpenOfOpenImmersion g⟩ [GOAL] case tfae_1_to_4 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝¹ : IsAffine Y f : X ⟢ Y U : Scheme g : U ⟢ X inst✝ : IsAffine U hg : IsOpenImmersion g H : P (Scheme.Ξ“.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑{ val := { carrier := Set.range ↑g.val.base, is_open' := (_ : IsOpen (Set.range ↑g.val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange g)) })) ≫ f).op) ⊒ P (Scheme.Ξ“.map (g ≫ f).op) [PROOFSTEP] rw [← hP.respectsIso.cancel_right_isIso _ (Scheme.Ξ“.map (IsOpenImmersion.isoOfRangeEq g (X.ofRestrict (Opens.openEmbedding ⟨_, hg.base_open.open_range⟩)) Subtype.range_coe.symm).hom.op), ← Scheme.Ξ“.map_comp, ← op_comp, IsOpenImmersion.isoOfRangeEq_hom] at H [GOAL] case tfae_1_to_4 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝¹ : IsAffine Y f : X ⟢ Y U : Scheme g : U ⟢ X inst✝ : IsAffine U hg : IsOpenImmersion g H : P (Scheme.Ξ“.map (IsOpenImmersion.lift (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion { carrier := Set.range ↑g.val.base, is_open' := (_ : IsOpen (Set.range ↑g.val.base)) }))) g (_ : Set.range ↑g.val.base ≀ Set.range ↑(Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion { carrier := Set.range ↑g.val.base, is_open' := (_ : IsOpen (Set.range ↑g.val.base)) }))).val.base) ≫ Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ↑{ val := { carrier := Set.range ↑g.val.base, is_open' := (_ : IsOpen (Set.range ↑g.val.base)) }, property := (_ : IsAffineOpen (Scheme.Hom.opensRange g)) })) ≫ f).op) ⊒ P (Scheme.Ξ“.map (g ≫ f).op) [PROOFSTEP] erw [IsOpenImmersion.lift_fac_assoc] at H [GOAL] case tfae_1_to_4 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝¹ : IsAffine Y f : X ⟢ Y U : Scheme g : U ⟢ X inst✝ : IsAffine U hg : IsOpenImmersion g H : P (Scheme.Ξ“.map (g ≫ f).op) ⊒ P (Scheme.Ξ“.map (g ≫ f).op) [PROOFSTEP] exact H [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) ⊒ List.TFAE [sourceAffineLocally P f, βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op), βˆ€ (𝒰 : Scheme.OpenCover X) [inst : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op), βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op)] [PROOFSTEP] tfae_have 4 β†’ 3 [GOAL] case tfae_4_to_3 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) ⊒ (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) [inst : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) [PROOFSTEP] intro H 𝒰 _ i [GOAL] case tfae_4_to_3 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝¹ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) H : βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) i : 𝒰.J ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) [PROOFSTEP] skip [GOAL] case tfae_4_to_3 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝¹ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) H : βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) i : 𝒰.J ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) [PROOFSTEP] apply H [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) [inst : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) ⊒ List.TFAE [sourceAffineLocally P f, βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op), βˆ€ (𝒰 : Scheme.OpenCover X) [inst : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op), βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op)] [PROOFSTEP] tfae_have 3 β†’ 2 [GOAL] case tfae_3_to_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) [inst : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) ⊒ (βˆ€ (𝒰 : Scheme.OpenCover X) [inst : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)) β†’ βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) [PROOFSTEP] intro H [GOAL] case tfae_3_to_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) [inst : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) H : βˆ€ (𝒰 : Scheme.OpenCover X) [inst : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) ⊒ βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) [PROOFSTEP] refine' ⟨X.affineCover, inferInstance, H _⟩ [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) [inst : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) tfae_3_to_2 : (βˆ€ (𝒰 : Scheme.OpenCover X) [inst : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)) β†’ βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) ⊒ List.TFAE [sourceAffineLocally P f, βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op), βˆ€ (𝒰 : Scheme.OpenCover X) [inst : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op), βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op)] [PROOFSTEP] tfae_have 2 β†’ 1 [GOAL] case tfae_2_to_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) [inst : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) tfae_3_to_2 : (βˆ€ (𝒰 : Scheme.OpenCover X) [inst : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)) β†’ βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) ⊒ (βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)) β†’ sourceAffineLocally P f [PROOFSTEP] rintro βŸ¨π’°, _, hπ’°βŸ© [GOAL] case tfae_2_to_1.intro.intro P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) [inst : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) tfae_3_to_2 : (βˆ€ (𝒰 : Scheme.OpenCover X) [inst : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)) β†’ βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) 𝒰 : Scheme.OpenCover X w✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) h𝒰 : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) ⊒ sourceAffineLocally P f [PROOFSTEP] exact sourceAffineLocally_of_source_openCover hP f 𝒰 h𝒰 [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) [inst : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) tfae_3_to_2 : (βˆ€ (𝒰 : Scheme.OpenCover X) [inst : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)) β†’ βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) tfae_2_to_1 : (βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)) β†’ sourceAffineLocally P f ⊒ List.TFAE [sourceAffineLocally P f, βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op), βˆ€ (𝒰 : Scheme.OpenCover X) [inst : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op), βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op)] [PROOFSTEP] tfae_finish [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y ⊒ List.TFAE [sourceAffineLocally P f, βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f), βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f), βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)] [PROOFSTEP] tfae_have 1 β†’ 4 [GOAL] case tfae_1_to_4 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y ⊒ sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) [PROOFSTEP] intro H U g hg V [GOAL] case tfae_1_to_4 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y H : sourceAffineLocally P f U : Scheme g : U ⟢ X hg : IsOpenImmersion g V : ↑(Scheme.affineOpens U) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict U (_ : OpenEmbedding ↑(Opens.inclusion ↑V)) ≫ g ≫ f).op) [PROOFSTEP] skip -- Porting note: this has metavariable if I put it directly into rw [GOAL] case tfae_1_to_4 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y H : sourceAffineLocally P f U : Scheme g : U ⟢ X hg : IsOpenImmersion g V : ↑(Scheme.affineOpens U) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict U (_ : OpenEmbedding ↑(Opens.inclusion ↑V)) ≫ g ≫ f).op) [PROOFSTEP] have := (hP.affine_openCover_TFAE f).out 0 3 [GOAL] case tfae_1_to_4 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y H : sourceAffineLocally P f U : Scheme g : U ⟢ X hg : IsOpenImmersion g V : ↑(Scheme.affineOpens U) this : sourceAffineLocally P f ↔ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict U (_ : OpenEmbedding ↑(Opens.inclusion ↑V)) ≫ g ≫ f).op) [PROOFSTEP] rw [this] at H [GOAL] case tfae_1_to_4 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y H : βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) U : Scheme g : U ⟢ X hg : IsOpenImmersion g V : ↑(Scheme.affineOpens U) this : sourceAffineLocally P f ↔ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict U (_ : OpenEmbedding ↑(Opens.inclusion ↑V)) ≫ g ≫ f).op) [PROOFSTEP] haveI : IsAffine _ := V.2 [GOAL] case tfae_1_to_4 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y H : βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) U : Scheme g : U ⟢ X hg : IsOpenImmersion g V : ↑(Scheme.affineOpens U) this✝ : sourceAffineLocally P f ↔ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) this : IsAffine (Scheme.restrict U (_ : OpenEmbedding ↑(Opens.inclusion ↑V))) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict U (_ : OpenEmbedding ↑(Opens.inclusion ↑V)) ≫ g ≫ f).op) [PROOFSTEP] rw [← Category.assoc] -- Porting note: Lean could find this previously [GOAL] case tfae_1_to_4 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y H : βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) U : Scheme g : U ⟢ X hg : IsOpenImmersion g V : ↑(Scheme.affineOpens U) this✝ : sourceAffineLocally P f ↔ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) this : IsAffine (Scheme.restrict U (_ : OpenEmbedding ↑(Opens.inclusion ↑V))) ⊒ P (Scheme.Ξ“.map ((Scheme.ofRestrict U (_ : OpenEmbedding ↑(Opens.inclusion ↑V)) ≫ g) ≫ f).op) [PROOFSTEP] have : IsOpenImmersion <| (Scheme.ofRestrict U (Opens.openEmbedding V.val)) ≫ g := LocallyRingedSpace.IsOpenImmersion.comp _ _ [GOAL] case tfae_1_to_4 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y H : βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) U : Scheme g : U ⟢ X hg : IsOpenImmersion g V : ↑(Scheme.affineOpens U) this✝¹ : sourceAffineLocally P f ↔ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ f).op) this✝ : IsAffine (Scheme.restrict U (_ : OpenEmbedding ↑(Opens.inclusion ↑V))) this : IsOpenImmersion (Scheme.ofRestrict U (_ : OpenEmbedding ↑(Opens.inclusion ↑V)) ≫ g) ⊒ P (Scheme.Ξ“.map ((Scheme.ofRestrict U (_ : OpenEmbedding ↑(Opens.inclusion ↑V)) ≫ g) ≫ f).op) [PROOFSTEP] apply H [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) ⊒ List.TFAE [sourceAffineLocally P f, βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f), βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f), βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)] [PROOFSTEP] tfae_have 4 β†’ 3 [GOAL] case tfae_4_to_3 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) ⊒ (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) [PROOFSTEP] intro H 𝒰 _ i [GOAL] case tfae_4_to_3 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) H : βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) 𝒰 : Scheme.OpenCover X i✝ : 𝒰.J i : ↑(Scheme.affineOpens (Scheme.OpenCover.obj 𝒰 i✝)) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.OpenCover.obj 𝒰 i✝) (_ : OpenEmbedding ↑(Opens.inclusion ↑i)) ≫ Scheme.OpenCover.map 𝒰 i✝ ≫ f).op) [PROOFSTEP] skip [GOAL] case tfae_4_to_3 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) H : βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) 𝒰 : Scheme.OpenCover X i✝ : 𝒰.J i : ↑(Scheme.affineOpens (Scheme.OpenCover.obj 𝒰 i✝)) ⊒ P (Scheme.Ξ“.map (Scheme.ofRestrict (Scheme.OpenCover.obj 𝒰 i✝) (_ : OpenEmbedding ↑(Opens.inclusion ↑i)) ≫ Scheme.OpenCover.map 𝒰 i✝ ≫ f).op) [PROOFSTEP] apply H [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) ⊒ List.TFAE [sourceAffineLocally P f, βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f), βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f), βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)] [PROOFSTEP] tfae_have 3 β†’ 2 [GOAL] case tfae_3_to_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) ⊒ (βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) β†’ βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) [PROOFSTEP] intro H [GOAL] case tfae_3_to_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) H : βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) ⊒ βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) [PROOFSTEP] refine' ⟨X.affineCover, H _⟩ [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) tfae_3_to_2 : (βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) β†’ βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) ⊒ List.TFAE [sourceAffineLocally P f, βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f), βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f), βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)] [PROOFSTEP] tfae_have 2 β†’ 1 [GOAL] case tfae_2_to_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) tfae_3_to_2 : (βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) β†’ βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) ⊒ (βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) β†’ sourceAffineLocally P f [PROOFSTEP] rintro βŸ¨π’°, hπ’°βŸ© -- Porting note: this has metavariable if I put it directly into rw [GOAL] case tfae_2_to_1.intro P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) tfae_3_to_2 : (βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) β†’ βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) 𝒰 : Scheme.OpenCover X h𝒰 : βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) ⊒ sourceAffineLocally P f [PROOFSTEP] have := (hP.affine_openCover_TFAE f).out 0 1 [GOAL] case tfae_2_to_1.intro P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) tfae_3_to_2 : (βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) β†’ βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) 𝒰 : Scheme.OpenCover X h𝒰 : βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) this : sourceAffineLocally P f ↔ βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) ⊒ sourceAffineLocally P f [PROOFSTEP] rw [this] [GOAL] case tfae_2_to_1.intro P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) tfae_3_to_2 : (βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) β†’ βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) 𝒰 : Scheme.OpenCover X h𝒰 : βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) this : sourceAffineLocally P f ↔ βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) ⊒ βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) [PROOFSTEP] refine' βŸ¨π’°.bind fun _ => Scheme.affineCover _, _, _⟩ [GOAL] case tfae_2_to_1.intro.refine'_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) tfae_3_to_2 : (βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) β†’ βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) 𝒰 : Scheme.OpenCover X h𝒰 : βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) this : sourceAffineLocally P f ↔ βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) ⊒ βˆ€ (i : (Scheme.OpenCover.bind 𝒰 fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)).J), IsAffine (Scheme.OpenCover.obj (Scheme.OpenCover.bind 𝒰 fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)) i) [PROOFSTEP] intro i [GOAL] case tfae_2_to_1.intro.refine'_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) tfae_3_to_2 : (βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) β†’ βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) 𝒰 : Scheme.OpenCover X h𝒰 : βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) this : sourceAffineLocally P f ↔ βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) i : (Scheme.OpenCover.bind 𝒰 fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)).J ⊒ IsAffine (Scheme.OpenCover.obj (Scheme.OpenCover.bind 𝒰 fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)) i) [PROOFSTEP] dsimp [GOAL] case tfae_2_to_1.intro.refine'_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) tfae_3_to_2 : (βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) β†’ βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) 𝒰 : Scheme.OpenCover X h𝒰 : βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) this : sourceAffineLocally P f ↔ βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) i : (Scheme.OpenCover.bind 𝒰 fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)).J ⊒ IsAffine (Scheme.OpenCover.obj (Scheme.affineCover (Scheme.OpenCover.obj 𝒰 i.fst)) i.snd) [PROOFSTEP] infer_instance [GOAL] case tfae_2_to_1.intro.refine'_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) tfae_3_to_2 : (βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) β†’ βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) 𝒰 : Scheme.OpenCover X h𝒰 : βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) this : sourceAffineLocally P f ↔ βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) ⊒ βˆ€ (i : (Scheme.OpenCover.bind 𝒰 fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)).J), P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.OpenCover.bind 𝒰 fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)) i ≫ f).op) [PROOFSTEP] intro i [GOAL] case tfae_2_to_1.intro.refine'_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) tfae_3_to_2 : (βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) β†’ βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) 𝒰 : Scheme.OpenCover X h𝒰 : βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) this : sourceAffineLocally P f ↔ βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) i : (Scheme.OpenCover.bind 𝒰 fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)).J ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.OpenCover.bind 𝒰 fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)) i ≫ f).op) [PROOFSTEP] specialize h𝒰 i.1 -- Porting note: this has metavariable if I put it directly into rw [GOAL] case tfae_2_to_1.intro.refine'_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) tfae_3_to_2 : (βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) β†’ βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) 𝒰 : Scheme.OpenCover X this : sourceAffineLocally P f ↔ βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) i : (Scheme.OpenCover.bind 𝒰 fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)).J h𝒰 : sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i.fst ≫ f) ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.OpenCover.bind 𝒰 fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)) i ≫ f).op) [PROOFSTEP] have := (hP.affine_openCover_TFAE (𝒰.map i.fst ≫ f)).out 0 3 [GOAL] case tfae_2_to_1.intro.refine'_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) tfae_3_to_2 : (βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) β†’ βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) 𝒰 : Scheme.OpenCover X this✝ : sourceAffineLocally P f ↔ βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) i : (Scheme.OpenCover.bind 𝒰 fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)).J h𝒰 : sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i.fst ≫ f) this : sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i.fst ≫ f) ↔ βˆ€ {U : Scheme} (g : U ⟢ Scheme.OpenCover.obj 𝒰 i.fst) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ Scheme.OpenCover.map 𝒰 i.fst ≫ f).op) ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.OpenCover.bind 𝒰 fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)) i ≫ f).op) [PROOFSTEP] rw [this] at h𝒰 [GOAL] case tfae_2_to_1.intro.refine'_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) tfae_3_to_2 : (βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) β†’ βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) 𝒰 : Scheme.OpenCover X this✝ : sourceAffineLocally P f ↔ βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) i : (Scheme.OpenCover.bind 𝒰 fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)).J h𝒰 : βˆ€ {U : Scheme} (g : U ⟢ Scheme.OpenCover.obj 𝒰 i.fst) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ Scheme.OpenCover.map 𝒰 i.fst ≫ f).op) this : sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i.fst ≫ f) ↔ βˆ€ {U : Scheme} (g : U ⟢ Scheme.OpenCover.obj 𝒰 i.fst) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ Scheme.OpenCover.map 𝒰 i.fst ≫ f).op) ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.OpenCover.bind 𝒰 fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)) i ≫ f).op) [PROOFSTEP] erw [Category.assoc] -- Porting note: this was discharged after the apply previously [GOAL] case tfae_2_to_1.intro.refine'_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) tfae_3_to_2 : (βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) β†’ βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) 𝒰 : Scheme.OpenCover X this✝ : sourceAffineLocally P f ↔ βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) i : (Scheme.OpenCover.bind 𝒰 fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)).J h𝒰 : βˆ€ {U : Scheme} (g : U ⟢ Scheme.OpenCover.obj 𝒰 i.fst) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ Scheme.OpenCover.map 𝒰 i.fst ≫ f).op) this : sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i.fst ≫ f) ↔ βˆ€ {U : Scheme} (g : U ⟢ Scheme.OpenCover.obj 𝒰 i.fst) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ Scheme.OpenCover.map 𝒰 i.fst ≫ f).op) ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map ((fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)) i.fst) i.snd ≫ Scheme.OpenCover.map 𝒰 i.fst ≫ f).op) [PROOFSTEP] have : IsAffine (Scheme.OpenCover.obj (Scheme.OpenCover.bind 𝒰 fun x ↦ Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)) i) := by dsimp; infer_instance [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) tfae_3_to_2 : (βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) β†’ βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) 𝒰 : Scheme.OpenCover X this✝ : sourceAffineLocally P f ↔ βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) i : (Scheme.OpenCover.bind 𝒰 fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)).J h𝒰 : βˆ€ {U : Scheme} (g : U ⟢ Scheme.OpenCover.obj 𝒰 i.fst) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ Scheme.OpenCover.map 𝒰 i.fst ≫ f).op) this : sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i.fst ≫ f) ↔ βˆ€ {U : Scheme} (g : U ⟢ Scheme.OpenCover.obj 𝒰 i.fst) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ Scheme.OpenCover.map 𝒰 i.fst ≫ f).op) ⊒ IsAffine (Scheme.OpenCover.obj (Scheme.OpenCover.bind 𝒰 fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)) i) [PROOFSTEP] dsimp [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) tfae_3_to_2 : (βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) β†’ βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) 𝒰 : Scheme.OpenCover X this✝ : sourceAffineLocally P f ↔ βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) i : (Scheme.OpenCover.bind 𝒰 fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)).J h𝒰 : βˆ€ {U : Scheme} (g : U ⟢ Scheme.OpenCover.obj 𝒰 i.fst) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ Scheme.OpenCover.map 𝒰 i.fst ≫ f).op) this : sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i.fst ≫ f) ↔ βˆ€ {U : Scheme} (g : U ⟢ Scheme.OpenCover.obj 𝒰 i.fst) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ Scheme.OpenCover.map 𝒰 i.fst ≫ f).op) ⊒ IsAffine (Scheme.OpenCover.obj (Scheme.affineCover (Scheme.OpenCover.obj 𝒰 i.fst)) i.snd) [PROOFSTEP] infer_instance [GOAL] case tfae_2_to_1.intro.refine'_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) tfae_3_to_2 : (βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) β†’ βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) 𝒰 : Scheme.OpenCover X this✝¹ : sourceAffineLocally P f ↔ βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) i : (Scheme.OpenCover.bind 𝒰 fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)).J h𝒰 : βˆ€ {U : Scheme} (g : U ⟢ Scheme.OpenCover.obj 𝒰 i.fst) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ Scheme.OpenCover.map 𝒰 i.fst ≫ f).op) this✝ : sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i.fst ≫ f) ↔ βˆ€ {U : Scheme} (g : U ⟢ Scheme.OpenCover.obj 𝒰 i.fst) [inst : IsAffine U] [inst : IsOpenImmersion g], P (Scheme.Ξ“.map (g ≫ Scheme.OpenCover.map 𝒰 i.fst ≫ f).op) this : IsAffine (Scheme.OpenCover.obj (Scheme.OpenCover.bind 𝒰 fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)) i) ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map ((fun x => Scheme.affineCover (Scheme.OpenCover.obj 𝒰 x)) i.fst) i.snd ≫ Scheme.OpenCover.map 𝒰 i.fst ≫ f).op) [PROOFSTEP] apply @h𝒰 _ (show _ from _) [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme inst✝ : IsAffine Y f : X ⟢ Y tfae_1_to_4 : sourceAffineLocally P f β†’ βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f) tfae_4_to_3 : (βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)) β†’ βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) tfae_3_to_2 : (βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) β†’ βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) tfae_2_to_1 : (βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) β†’ sourceAffineLocally P f ⊒ List.TFAE [sourceAffineLocally P f, βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f), βˆ€ (𝒰 : Scheme.OpenCover X) (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f), βˆ€ {U : Scheme} (g : U ⟢ X) [inst : IsOpenImmersion g], sourceAffineLocally P (g ≫ f)] [PROOFSTEP] tfae_finish [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y Z : Scheme inst✝¹ : IsAffine Z f : X ⟢ Y g : Y ⟢ Z inst✝ : IsOpenImmersion f H : sourceAffineLocally P g ⊒ sourceAffineLocally P (f ≫ g) [PROOFSTEP] have := (hP.openCover_TFAE g).out 0 3 [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y Z : Scheme inst✝¹ : IsAffine Z f : X ⟢ Y g : Y ⟢ Z inst✝ : IsOpenImmersion f H : sourceAffineLocally P g this : sourceAffineLocally P g ↔ βˆ€ {U : Scheme} (g_1 : U ⟢ Y) [inst : IsOpenImmersion g_1], sourceAffineLocally P (g_1 ≫ g) ⊒ sourceAffineLocally P (f ≫ g) [PROOFSTEP] apply this.mp H [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) ⊒ sourceAffineLocally P f ↔ βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) [PROOFSTEP] refine ⟨fun H => ?_, fun H => ?_⟩ [GOAL] case refine_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : sourceAffineLocally P f ⊒ βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) [PROOFSTEP] have h := (hP.affine_openCover_TFAE f).out 0 2 [GOAL] case refine_1 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : sourceAffineLocally P f h : sourceAffineLocally P f ↔ βˆ€ (𝒰 : Scheme.OpenCover X) [inst : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) ⊒ βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) [PROOFSTEP] apply h.mp [GOAL] case refine_1.a P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : sourceAffineLocally P f h : sourceAffineLocally P f ↔ βˆ€ (𝒰 : Scheme.OpenCover X) [inst : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)] (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) ⊒ sourceAffineLocally P f [PROOFSTEP] exact H [GOAL] case refine_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) ⊒ sourceAffineLocally P f [PROOFSTEP] have h := (hP.affine_openCover_TFAE f).out 1 0 [GOAL] case refine_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) h : (βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)) ↔ sourceAffineLocally P f ⊒ sourceAffineLocally P f [PROOFSTEP] apply h.mp [GOAL] case refine_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y inst✝¹ : IsAffine Y 𝒰 : Scheme.OpenCover X inst✝ : βˆ€ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i) H : βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) h : (βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op)) ↔ sourceAffineLocally P f ⊒ βˆƒ 𝒰 x, βˆ€ (i : 𝒰.J), P (Scheme.Ξ“.map (Scheme.OpenCover.map 𝒰 i ≫ f).op) [PROOFSTEP] use 𝒰 [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y 𝒰 : Scheme.OpenCover X ⊒ affineLocally P f ↔ βˆ€ (i : 𝒰.J), affineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) [PROOFSTEP] constructor [GOAL] case mp P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y 𝒰 : Scheme.OpenCover X ⊒ affineLocally P f β†’ βˆ€ (i : 𝒰.J), affineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) [PROOFSTEP] intro H i U [GOAL] case mp P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y 𝒰 : Scheme.OpenCover X H : affineLocally P f i : 𝒰.J U : ↑(Scheme.affineOpens Y) ⊒ sourceAffineLocally P ((Scheme.OpenCover.map 𝒰 i ≫ f) ∣_ ↑U) [PROOFSTEP] rw [morphismRestrict_comp] [GOAL] case mp P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y 𝒰 : Scheme.OpenCover X H : affineLocally P f i : 𝒰.J U : ↑(Scheme.affineOpens Y) ⊒ sourceAffineLocally P ((Scheme.OpenCover.map 𝒰 i ∣_ (Opens.map f.val.base).obj ↑U) ≫ f ∣_ ↑U) [PROOFSTEP] delta morphismRestrict [GOAL] case mp P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y 𝒰 : Scheme.OpenCover X H : affineLocally P f i : 𝒰.J U : ↑(Scheme.affineOpens Y) ⊒ sourceAffineLocally P (((pullbackRestrictIsoRestrict (Scheme.OpenCover.map 𝒰 i) ((Opens.map f.val.base).obj ↑U)).inv ≫ pullback.snd) ≫ (pullbackRestrictIsoRestrict f ↑U).inv ≫ pullback.snd) [PROOFSTEP] have : IsAffine (Scheme.restrict Y <| Opens.openEmbedding U.val) := U.property [GOAL] case mp P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y 𝒰 : Scheme.OpenCover X H : affineLocally P f i : 𝒰.J U : ↑(Scheme.affineOpens Y) this : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) ⊒ sourceAffineLocally P (((pullbackRestrictIsoRestrict (Scheme.OpenCover.map 𝒰 i) ((Opens.map f.val.base).obj ↑U)).inv ≫ pullback.snd) ≫ (pullbackRestrictIsoRestrict f ↑U).inv ≫ pullback.snd) [PROOFSTEP] have : IsOpenImmersion ((pullbackRestrictIsoRestrict (Scheme.OpenCover.map 𝒰 i) ((Opens.map f.val.base).obj ↑U)).inv ≫ pullback.snd) := LocallyRingedSpace.IsOpenImmersion.comp _ _ [GOAL] case mp P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y 𝒰 : Scheme.OpenCover X H : affineLocally P f i : 𝒰.J U : ↑(Scheme.affineOpens Y) this✝ : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) this : IsOpenImmersion ((pullbackRestrictIsoRestrict (Scheme.OpenCover.map 𝒰 i) ((Opens.map f.val.base).obj ↑U)).inv ≫ pullback.snd) ⊒ sourceAffineLocally P (((pullbackRestrictIsoRestrict (Scheme.OpenCover.map 𝒰 i) ((Opens.map f.val.base).obj ↑U)).inv ≫ pullback.snd) ≫ (pullbackRestrictIsoRestrict f ↑U).inv ≫ pullback.snd) [PROOFSTEP] apply hP.sourceAffineLocally_comp_of_isOpenImmersion [GOAL] case mp.H P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y 𝒰 : Scheme.OpenCover X H : affineLocally P f i : 𝒰.J U : ↑(Scheme.affineOpens Y) this✝ : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) this : IsOpenImmersion ((pullbackRestrictIsoRestrict (Scheme.OpenCover.map 𝒰 i) ((Opens.map f.val.base).obj ↑U)).inv ≫ pullback.snd) ⊒ sourceAffineLocally P ((pullbackRestrictIsoRestrict f ↑U).inv ≫ pullback.snd) [PROOFSTEP] apply H [GOAL] case mpr P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y 𝒰 : Scheme.OpenCover X ⊒ (βˆ€ (i : 𝒰.J), affineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f)) β†’ affineLocally P f [PROOFSTEP] intro H U [GOAL] case mpr P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y 𝒰 : Scheme.OpenCover X H : βˆ€ (i : 𝒰.J), affineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) U : ↑(Scheme.affineOpens Y) ⊒ sourceAffineLocally P (f ∣_ ↑U) [PROOFSTEP] haveI : IsAffine _ := U.2 [GOAL] case mpr P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y 𝒰 : Scheme.OpenCover X H : βˆ€ (i : 𝒰.J), affineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) U : ↑(Scheme.affineOpens Y) this : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) ⊒ sourceAffineLocally P (f ∣_ ↑U) [PROOFSTEP] apply ((hP.openCover_TFAE (f ∣_ U.1)).out 1 0).mp [GOAL] case mpr P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y 𝒰 : Scheme.OpenCover X H : βˆ€ (i : 𝒰.J), affineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) U : ↑(Scheme.affineOpens Y) this : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) ⊒ βˆƒ 𝒰, βˆ€ (i : 𝒰.J), sourceAffineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f ∣_ ↑U) [PROOFSTEP] use 𝒰.pullbackCover (X.ofRestrict _) [GOAL] case h P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y 𝒰 : Scheme.OpenCover X H : βˆ€ (i : 𝒰.J), affineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) U : ↑(Scheme.affineOpens Y) this : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) ⊒ βˆ€ (i : (Scheme.OpenCover.pullbackCover 𝒰 (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))).J), sourceAffineLocally P (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover 𝒰 (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))) i ≫ f ∣_ ↑U) [PROOFSTEP] intro i [GOAL] case h P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y 𝒰 : Scheme.OpenCover X H : βˆ€ (i : 𝒰.J), affineLocally P (Scheme.OpenCover.map 𝒰 i ≫ f) U : ↑(Scheme.affineOpens Y) this : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) i : (Scheme.OpenCover.pullbackCover 𝒰 (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))).J ⊒ sourceAffineLocally P (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover 𝒰 (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))) i ≫ f ∣_ ↑U) [PROOFSTEP] specialize H i U [GOAL] case h P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y 𝒰 : Scheme.OpenCover X U : ↑(Scheme.affineOpens Y) this : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) i : (Scheme.OpenCover.pullbackCover 𝒰 (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))).J H : sourceAffineLocally P ((Scheme.OpenCover.map 𝒰 i ≫ f) ∣_ ↑U) ⊒ sourceAffineLocally P (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover 𝒰 (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))) i ≫ f ∣_ ↑U) [PROOFSTEP] rw [morphismRestrict_comp] at H [GOAL] case h P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y 𝒰 : Scheme.OpenCover X U : ↑(Scheme.affineOpens Y) this : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) i : (Scheme.OpenCover.pullbackCover 𝒰 (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))).J H : sourceAffineLocally P ((Scheme.OpenCover.map 𝒰 i ∣_ (Opens.map f.val.base).obj ↑U) ≫ f ∣_ ↑U) ⊒ sourceAffineLocally P (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover 𝒰 (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))) i ≫ f ∣_ ↑U) [PROOFSTEP] delta morphismRestrict at H [GOAL] case h P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y 𝒰 : Scheme.OpenCover X U : ↑(Scheme.affineOpens Y) this : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) i : (Scheme.OpenCover.pullbackCover 𝒰 (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))).J H : sourceAffineLocally P (((pullbackRestrictIsoRestrict (Scheme.OpenCover.map 𝒰 i) ((Opens.map f.val.base).obj ↑U)).inv ≫ pullback.snd) ≫ (pullbackRestrictIsoRestrict f ↑U).inv ≫ pullback.snd) ⊒ sourceAffineLocally P (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover 𝒰 (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))) i ≫ f ∣_ ↑U) [PROOFSTEP] have := sourceAffineLocally_respectsIso hP.respectsIso [GOAL] case h P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y 𝒰 : Scheme.OpenCover X U : ↑(Scheme.affineOpens Y) this✝ : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) i : (Scheme.OpenCover.pullbackCover 𝒰 (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))).J H : sourceAffineLocally P (((pullbackRestrictIsoRestrict (Scheme.OpenCover.map 𝒰 i) ((Opens.map f.val.base).obj ↑U)).inv ≫ pullback.snd) ≫ (pullbackRestrictIsoRestrict f ↑U).inv ≫ pullback.snd) this : MorphismProperty.RespectsIso (AffineTargetMorphismProperty.toProperty (sourceAffineLocally P)) ⊒ sourceAffineLocally P (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover 𝒰 (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))) i ≫ f ∣_ ↑U) [PROOFSTEP] rw [Category.assoc, affine_cancel_left_isIso this, ← affine_cancel_left_isIso this (pullbackSymmetry _ _).hom, pullbackSymmetry_hom_comp_snd_assoc] at H [GOAL] case h P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y 𝒰 : Scheme.OpenCover X U : ↑(Scheme.affineOpens Y) this✝ : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) i : (Scheme.OpenCover.pullbackCover 𝒰 (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))).J H✝ : sourceAffineLocally P (pullback.snd ≫ (pullbackRestrictIsoRestrict f ↑U).inv ≫ pullback.snd) H : sourceAffineLocally P (pullback.fst ≫ (pullbackRestrictIsoRestrict f ↑U).inv ≫ pullback.snd) this : MorphismProperty.RespectsIso (AffineTargetMorphismProperty.toProperty (sourceAffineLocally P)) ⊒ sourceAffineLocally P (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover 𝒰 (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion ((Opens.map f.val.base).obj ↑U))))) i ≫ f ∣_ ↑U) [PROOFSTEP] exact H [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP✝ hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y hf : IsOpenImmersion f ⊒ affineLocally P f [PROOFSTEP] intro U [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP✝ hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y hf : IsOpenImmersion f U : ↑(Scheme.affineOpens Y) ⊒ sourceAffineLocally P (f ∣_ ↑U) [PROOFSTEP] haveI H : IsAffine _ := U.2 [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP✝ hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y hf : IsOpenImmersion f U : ↑(Scheme.affineOpens Y) H : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) ⊒ sourceAffineLocally P (f ∣_ ↑U) [PROOFSTEP] rw [← Category.comp_id (f ∣_ U)] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP✝ hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y hf : IsOpenImmersion f U : ↑(Scheme.affineOpens Y) H : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) ⊒ sourceAffineLocally P ((f ∣_ ↑U) ≫ πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U)))) [PROOFSTEP] apply hP.sourceAffineLocally_comp_of_isOpenImmersion [GOAL] case H P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP✝ hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y hf : IsOpenImmersion f U : ↑(Scheme.affineOpens Y) H : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) ⊒ sourceAffineLocally P (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U)))) [PROOFSTEP] rw [@source_affine_openCover_iff _ hP _ _ _ _ (Scheme.openCoverOfIsIso (πŸ™ _)) (_)] [GOAL] case H P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP✝ hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y hf : IsOpenImmersion f U : ↑(Scheme.affineOpens Y) H : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) ⊒ βˆ€ (i : (Scheme.openCoverOfIsIso (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))).J), P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.openCoverOfIsIso (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))) i ≫ πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U)))).op) [PROOFSTEP] intro i [GOAL] case H P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP✝ hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y hf : IsOpenImmersion f U : ↑(Scheme.affineOpens Y) H : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) i : (Scheme.openCoverOfIsIso (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))).J ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.openCoverOfIsIso (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))) i ≫ πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U)))).op) [PROOFSTEP] erw [Category.id_comp, op_id, Scheme.Ξ“.map_id] [GOAL] case H P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP✝ hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y hf : IsOpenImmersion f U : ↑(Scheme.affineOpens Y) H : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) i : (Scheme.openCoverOfIsIso (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))).J ⊒ P (πŸ™ (Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U)))))) [PROOFSTEP] let esto := Scheme.Ξ“.obj (Opposite.op (Y.restrict <| Opens.openEmbedding U.val)) [GOAL] case H P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP✝ hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y hf : IsOpenImmersion f U : ↑(Scheme.affineOpens Y) H : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) i : (Scheme.openCoverOfIsIso (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))).J esto : CommRingCat := Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U)))) ⊒ P (πŸ™ (Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U)))))) [PROOFSTEP] let eso := Scheme.Ξ“.obj (Opposite.op ((Scheme.openCoverOfIsIso (πŸ™ (Y.restrict <| Opens.openEmbedding U.val))).obj i)) -- Porting note: Lean this needed this spelled out before -- convert hP.HoldsAwayLocalizationAway _ (1 : Scheme.Ξ“.obj _) _ [GOAL] case H P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP✝ hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y hf : IsOpenImmersion f U : ↑(Scheme.affineOpens Y) H : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) i : (Scheme.openCoverOfIsIso (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))).J esto : CommRingCat := Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U)))) eso : CommRingCat := Scheme.Ξ“.obj (Opposite.op (Scheme.OpenCover.obj (Scheme.openCoverOfIsIso (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))) i)) ⊒ P (πŸ™ (Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U)))))) [PROOFSTEP] have : πŸ™ (Scheme.Ξ“.obj (Opposite.op (Y.restrict <| Opens.openEmbedding U.val))) = @algebraMap esto eso _ _ (_) := (RingHom.algebraMap_toAlgebra _).symm [GOAL] case H P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP✝ hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y hf : IsOpenImmersion f U : ↑(Scheme.affineOpens Y) H : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) i : (Scheme.openCoverOfIsIso (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))).J esto : CommRingCat := Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U)))) eso : CommRingCat := Scheme.Ξ“.obj (Opposite.op (Scheme.OpenCover.obj (Scheme.openCoverOfIsIso (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))) i)) this : πŸ™ (Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))) = algebraMap ↑esto ↑eso ⊒ P (πŸ™ (Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U)))))) [PROOFSTEP] rw [this] [GOAL] case H P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP✝ hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y hf : IsOpenImmersion f U : ↑(Scheme.affineOpens Y) H : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) i : (Scheme.openCoverOfIsIso (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))).J esto : CommRingCat := Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U)))) eso : CommRingCat := Scheme.Ξ“.obj (Opposite.op (Scheme.OpenCover.obj (Scheme.openCoverOfIsIso (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))) i)) this : πŸ™ (Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))) = algebraMap ↑esto ↑eso ⊒ P (algebraMap ↑esto ↑eso) [PROOFSTEP] have := hP.HoldsForLocalizationAway [GOAL] case H P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP✝ hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y hf : IsOpenImmersion f U : ↑(Scheme.affineOpens Y) H : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) i : (Scheme.openCoverOfIsIso (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))).J esto : CommRingCat := Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U)))) eso : CommRingCat := Scheme.Ξ“.obj (Opposite.op (Scheme.OpenCover.obj (Scheme.openCoverOfIsIso (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))) i)) this✝ : πŸ™ (Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))) = algebraMap ↑esto ↑eso this : RingHom.HoldsForLocalizationAway P ⊒ P (algebraMap ↑esto ↑eso) [PROOFSTEP] convert @this esto eso _ _ ?_ ?_ ?_ [GOAL] case H.convert_2 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP✝ hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y hf : IsOpenImmersion f U : ↑(Scheme.affineOpens Y) H : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) i : (Scheme.openCoverOfIsIso (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))).J esto : CommRingCat := Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U)))) eso : CommRingCat := Scheme.Ξ“.obj (Opposite.op (Scheme.OpenCover.obj (Scheme.openCoverOfIsIso (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))) i)) this✝ : πŸ™ (Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))) = algebraMap ↑esto ↑eso this : RingHom.HoldsForLocalizationAway P ⊒ ↑esto [PROOFSTEP] exact 1 -- Porting note: again we have to bypass TC synthesis to keep Lean from running away [GOAL] case H.convert_3 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP✝ hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y hf : IsOpenImmersion f U : ↑(Scheme.affineOpens Y) H : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) i : (Scheme.openCoverOfIsIso (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))).J esto : CommRingCat := Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U)))) eso : CommRingCat := Scheme.Ξ“.obj (Opposite.op (Scheme.OpenCover.obj (Scheme.openCoverOfIsIso (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))) i)) this✝ : πŸ™ (Scheme.Ξ“.obj (Opposite.op (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))) = algebraMap ↑esto ↑eso this : RingHom.HoldsForLocalizationAway P ⊒ IsLocalization.Away 1 ↑eso [PROOFSTEP] refine' @IsLocalization.away_of_isUnit_of_bijective _ _ _ _ (_) _ isUnit_one Function.bijective_id [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP✝ hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y hf : IsOpenImmersion f U : ↑(Scheme.affineOpens Y) H : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) ⊒ βˆ€ (i : (Scheme.openCoverOfIsIso (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))).J), IsAffine (Scheme.OpenCover.obj (Scheme.openCoverOfIsIso (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))) i) [PROOFSTEP] intro [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP✝ hP : PropertyIsLocal P X Y : Scheme f : X ⟢ Y hf : IsOpenImmersion f U : ↑(Scheme.affineOpens Y) H : IsAffine (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))) i✝ : (Scheme.openCoverOfIsIso (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))).J ⊒ IsAffine (Scheme.OpenCover.obj (Scheme.openCoverOfIsIso (πŸ™ (Scheme.restrict Y (_ : OpenEmbedding ↑(Opens.inclusion ↑U))))) i✝) [PROOFSTEP] exact H [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z h : affineLocally P (f ≫ g) ⊒ affineLocally P f [PROOFSTEP] let 𝒰 : βˆ€ i, ((Z.affineCover.pullbackCover (f ≫ g)).obj i).OpenCover := by intro i refine' Scheme.OpenCover.bind _ fun i => Scheme.affineCover _ apply Scheme.OpenCover.pushforwardIso _ (pullbackRightPullbackFstIso g (Z.affineCover.map i) f).hom apply Scheme.Pullback.openCoverOfRight exact (pullback g (Z.affineCover.map i)).affineCover [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z h : affineLocally P (f ≫ g) ⊒ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)) i) [PROOFSTEP] intro i [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z h : affineLocally P (f ≫ g) i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J ⊒ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)) i) [PROOFSTEP] refine' Scheme.OpenCover.bind _ fun i => Scheme.affineCover _ [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z h : affineLocally P (f ≫ g) i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J ⊒ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)) i) [PROOFSTEP] apply Scheme.OpenCover.pushforwardIso _ (pullbackRightPullbackFstIso g (Z.affineCover.map i) f).hom [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z h : affineLocally P (f ≫ g) i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J ⊒ Scheme.OpenCover (pullback f pullback.fst) [PROOFSTEP] apply Scheme.Pullback.openCoverOfRight [GOAL] case 𝒰 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z h : affineLocally P (f ≫ g) i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J ⊒ Scheme.OpenCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i)) [PROOFSTEP] exact (pullback g (Z.affineCover.map i)).affineCover [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z h : affineLocally P (f ≫ g) 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) i_1) ⊒ affineLocally P f [PROOFSTEP] have h𝒰 : βˆ€ i j, IsAffine ((𝒰 i).obj j) := by dsimp; infer_instance [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z h : affineLocally P (f ≫ g) 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) i_1) ⊒ βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) (j : (𝒰 i).J), IsAffine (Scheme.OpenCover.obj (𝒰 i) j) [PROOFSTEP] dsimp [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z h : affineLocally P (f ≫ g) 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) i_1) ⊒ βˆ€ (i : (Scheme.affineCover Z).J) (j : (i_1 : (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))).J) Γ— (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) i_1 ≫ pullback.fst))).J), IsAffine (Scheme.OpenCover.obj (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j.fst ≫ pullback.fst))) j.snd) [PROOFSTEP] infer_instance [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z h : affineLocally P (f ≫ g) 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) i_1) h𝒰 : βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) (j : (𝒰 i).J), IsAffine (Scheme.OpenCover.obj (𝒰 i) j) ⊒ affineLocally P f [PROOFSTEP] let 𝒰' := (Z.affineCover.pullbackCover g).bind fun i => Scheme.affineCover _ [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z h : affineLocally P (f ≫ g) 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) i_1) h𝒰 : βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) (j : (𝒰 i).J), IsAffine (Scheme.OpenCover.obj (𝒰 i) j) 𝒰' : Scheme.OpenCover Y := Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun i => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) i) ⊒ affineLocally P f [PROOFSTEP] have h𝒰' : βˆ€ i, IsAffine (𝒰'.obj i) := by dsimp; infer_instance [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z h : affineLocally P (f ≫ g) 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) i_1) h𝒰 : βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) (j : (𝒰 i).J), IsAffine (Scheme.OpenCover.obj (𝒰 i) j) 𝒰' : Scheme.OpenCover Y := Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun i => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) i) ⊒ βˆ€ (i : 𝒰'.J), IsAffine (Scheme.OpenCover.obj 𝒰' i) [PROOFSTEP] dsimp [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z h : affineLocally P (f ≫ g) 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) i_1) h𝒰 : βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) (j : (𝒰 i).J), IsAffine (Scheme.OpenCover.obj (𝒰 i) j) 𝒰' : Scheme.OpenCover Y := Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun i => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) i) ⊒ βˆ€ (i : (i : (Scheme.affineCover Z).J) Γ— (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))).J), IsAffine (Scheme.OpenCover.obj (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i.fst))) i.snd) [PROOFSTEP] infer_instance [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z h : affineLocally P (f ≫ g) 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) i_1) h𝒰 : βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) (j : (𝒰 i).J), IsAffine (Scheme.OpenCover.obj (𝒰 i) j) 𝒰' : Scheme.OpenCover Y := Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun i => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) i) h𝒰' : βˆ€ (i : 𝒰'.J), IsAffine (Scheme.OpenCover.obj 𝒰' i) ⊒ affineLocally P f [PROOFSTEP] rw [hP.affine_openCover_iff f 𝒰' fun i => Scheme.affineCover _] [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z h : affineLocally P (f ≫ g) 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) i_1) h𝒰 : βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) (j : (𝒰 i).J), IsAffine (Scheme.OpenCover.obj (𝒰 i) j) 𝒰' : Scheme.OpenCover Y := Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun i => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) i) h𝒰' : βˆ€ (i : 𝒰'.J), IsAffine (Scheme.OpenCover.obj 𝒰' i) ⊒ βˆ€ (i : (Scheme.OpenCover.pullbackCover 𝒰' f).J) (j : (Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover 𝒰' f) i)).J), P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover 𝒰' f) i)) j ≫ pullback.snd).op) [PROOFSTEP] rw [hP.affine_openCover_iff (f ≫ g) Z.affineCover 𝒰] at h [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) i_1) h : βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) (j : (𝒰 i).J), P (Scheme.Ξ“.map (Scheme.OpenCover.map (𝒰 i) j ≫ pullback.snd).op) h𝒰 : βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) (j : (𝒰 i).J), IsAffine (Scheme.OpenCover.obj (𝒰 i) j) 𝒰' : Scheme.OpenCover Y := Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun i => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) i) h𝒰' : βˆ€ (i : 𝒰'.J), IsAffine (Scheme.OpenCover.obj 𝒰' i) ⊒ βˆ€ (i : (Scheme.OpenCover.pullbackCover 𝒰' f).J) (j : (Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover 𝒰' f) i)).J), P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover 𝒰' f) i)) j ≫ pullback.snd).op) [PROOFSTEP] rintro ⟨i, j⟩ k [GOAL] case mk P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) i_1) h : βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) (j : (𝒰 i).J), P (Scheme.Ξ“.map (Scheme.OpenCover.map (𝒰 i) j ≫ pullback.snd).op) h𝒰 : βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) (j : (𝒰 i).J), IsAffine (Scheme.OpenCover.obj (𝒰 i) j) 𝒰' : Scheme.OpenCover Y := Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun i => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) i) h𝒰' : βˆ€ (i : 𝒰'.J), IsAffine (Scheme.OpenCover.obj 𝒰' i) i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g).J j : ((fun i => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) i)) i).J k : (Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover 𝒰' f) { fst := i, snd := j })).J ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover 𝒰' f) { fst := i, snd := j })) k ≫ pullback.snd).op) [PROOFSTEP] dsimp at i j k [GOAL] case mk P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) i_1) h : βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) (j : (𝒰 i).J), P (Scheme.Ξ“.map (Scheme.OpenCover.map (𝒰 i) j ≫ pullback.snd).op) h𝒰 : βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) (j : (𝒰 i).J), IsAffine (Scheme.OpenCover.obj (𝒰 i) j) 𝒰' : Scheme.OpenCover Y := Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun i => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) i) h𝒰' : βˆ€ (i : 𝒰'.J), IsAffine (Scheme.OpenCover.obj 𝒰' i) i : (Scheme.affineCover Z).J j : (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))).J k : (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst))).J ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover 𝒰' f) { fst := i, snd := j })) k ≫ pullback.snd).op) [PROOFSTEP] specialize h i ⟨j, k⟩ [GOAL] case mk P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) i_1) h𝒰 : βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) (j : (𝒰 i).J), IsAffine (Scheme.OpenCover.obj (𝒰 i) j) 𝒰' : Scheme.OpenCover Y := Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun i => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) i) h𝒰' : βˆ€ (i : 𝒰'.J), IsAffine (Scheme.OpenCover.obj 𝒰' i) i : (Scheme.affineCover Z).J j : (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))).J k : (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst))).J h : P (Scheme.Ξ“.map (Scheme.OpenCover.map (𝒰 i) { fst := j, snd := k } ≫ pullback.snd).op) ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover 𝒰' f) { fst := i, snd := j })) k ≫ pullback.snd).op) [PROOFSTEP] dsimp only [Scheme.OpenCover.bind_map, Scheme.OpenCover.pushforwardIso_obj, Scheme.Pullback.openCoverOfRight_obj, Scheme.OpenCover.pushforwardIso_map, Scheme.Pullback.openCoverOfRight_map, Scheme.OpenCover.bind_obj, Scheme.OpenCover.pullbackCover_obj, Scheme.OpenCover.pullbackCover_map] at h ⊒ [GOAL] case mk P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) i_1) h𝒰 : βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) (j : (𝒰 i).J), IsAffine (Scheme.OpenCover.obj (𝒰 i) j) 𝒰' : Scheme.OpenCover Y := Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun i => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) i) h𝒰' : βˆ€ (i : 𝒰'.J), IsAffine (Scheme.OpenCover.obj 𝒰' i) i : (Scheme.affineCover Z).J j : (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))).J k : (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst))).J h : P (Scheme.Ξ“.map ((Scheme.OpenCover.map (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst))) k ≫ pullback.map f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst) f pullback.fst (πŸ™ X) (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j) (πŸ™ Y) (_ : f ≫ πŸ™ Y = πŸ™ X ≫ f) (_ : (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst) ≫ πŸ™ Y = Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst) ≫ (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) ≫ pullback.snd).op) ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst))) k ≫ pullback.snd).op) [PROOFSTEP] rw [Category.assoc, Category.assoc, pullbackRightPullbackFstIso_hom_snd, pullback.lift_snd_assoc, Category.assoc, ← Category.assoc, op_comp, Functor.map_comp] at h [GOAL] case mk P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) i_1) h𝒰 : βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) (j : (𝒰 i).J), IsAffine (Scheme.OpenCover.obj (𝒰 i) j) 𝒰' : Scheme.OpenCover Y := Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun i => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) i) h𝒰' : βˆ€ (i : 𝒰'.J), IsAffine (Scheme.OpenCover.obj 𝒰' i) i : (Scheme.affineCover Z).J j : (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))).J k : (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst))).J h : P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.snd).op ≫ Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst))) k ≫ pullback.snd).op) ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst))) k ≫ pullback.snd).op) [PROOFSTEP] let f' := Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.snd).op [GOAL] case mk P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) i_1) h𝒰 : βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) (j : (𝒰 i).J), IsAffine (Scheme.OpenCover.obj (𝒰 i) j) 𝒰' : Scheme.OpenCover Y := Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun i => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) i) h𝒰' : βˆ€ (i : 𝒰'.J), IsAffine (Scheme.OpenCover.obj 𝒰' i) i : (Scheme.affineCover Z).J j : (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))).J k : (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst))).J h : P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.snd).op ≫ Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst))) k ≫ pullback.snd).op) f' : Scheme.Ξ“.obj (Opposite.op (Scheme.OpenCover.obj (Scheme.affineCover Z) i)) ⟢ Scheme.Ξ“.obj (Opposite.op (Scheme.OpenCover.obj (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j)) := Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.snd).op ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst))) k ≫ pullback.snd).op) [PROOFSTEP] let g' := Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst))) k ≫ pullback.snd).op [GOAL] case mk P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) i_1) h𝒰 : βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) (j : (𝒰 i).J), IsAffine (Scheme.OpenCover.obj (𝒰 i) j) 𝒰' : Scheme.OpenCover Y := Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun i => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) i) h𝒰' : βˆ€ (i : 𝒰'.J), IsAffine (Scheme.OpenCover.obj 𝒰' i) i : (Scheme.affineCover Z).J j : (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))).J k : (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst))).J h : P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.snd).op ≫ Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst))) k ≫ pullback.snd).op) f' : Scheme.Ξ“.obj (Opposite.op (Scheme.OpenCover.obj (Scheme.affineCover Z) i)) ⟢ Scheme.Ξ“.obj (Opposite.op (Scheme.OpenCover.obj (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j)) := Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.snd).op g' : Scheme.Ξ“.obj (Opposite.op (Scheme.OpenCover.obj (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j)) ⟢ Scheme.Ξ“.obj (Opposite.op (Scheme.OpenCover.obj (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst))) k)) := Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst))) k ≫ pullback.snd).op ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst))) k ≫ pullback.snd).op) [PROOFSTEP] convert H f' g' ?_ [GOAL] case mk P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P H : βˆ€ {R S T : Type u} [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] (f : R β†’+* S) (g : S β†’+* T), P (comp g f) β†’ P g X Y Z : Scheme f : X ⟢ Y g : Y ⟢ Z 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover Z) i) f).hom) i_1) h𝒰 : βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) (f ≫ g)).J) (j : (𝒰 i).J), IsAffine (Scheme.OpenCover.obj (𝒰 i) j) 𝒰' : Scheme.OpenCover Y := Scheme.OpenCover.bind (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) fun i => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) i) h𝒰' : βˆ€ (i : 𝒰'.J), IsAffine (Scheme.OpenCover.obj 𝒰' i) i : (Scheme.affineCover Z).J j : (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))).J k : (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst))).J h : P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.snd).op ≫ Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst))) k ≫ pullback.snd).op) f' : Scheme.Ξ“.obj (Opposite.op (Scheme.OpenCover.obj (Scheme.affineCover Z) i)) ⟢ Scheme.Ξ“.obj (Opposite.op (Scheme.OpenCover.obj (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j)) := Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.snd).op g' : Scheme.Ξ“.obj (Opposite.op (Scheme.OpenCover.obj (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j)) ⟢ Scheme.Ξ“.obj (Opposite.op (Scheme.OpenCover.obj (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst))) k)) := Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover Z) i))) j ≫ pullback.fst))) k ≫ pullback.snd).op ⊒ P (comp g' f') [PROOFSTEP] exact h [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P ⊒ MorphismProperty.StableUnderComposition (affineLocally P) [PROOFSTEP] intro X Y S f g hf hg [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : affineLocally P f hg : affineLocally P g ⊒ affineLocally P (f ≫ g) [PROOFSTEP] let 𝒰 : βˆ€ i, ((S.affineCover.pullbackCover (f ≫ g)).obj i).OpenCover := by intro i refine' Scheme.OpenCover.bind _ fun i => Scheme.affineCover _ apply Scheme.OpenCover.pushforwardIso _ (pullbackRightPullbackFstIso g (S.affineCover.map i) f).hom apply Scheme.Pullback.openCoverOfRight exact (pullback g (S.affineCover.map i)).affineCover [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : affineLocally P f hg : affineLocally P g ⊒ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) [PROOFSTEP] intro i [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : affineLocally P f hg : affineLocally P g i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J ⊒ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) [PROOFSTEP] refine' Scheme.OpenCover.bind _ fun i => Scheme.affineCover _ [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : affineLocally P f hg : affineLocally P g i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J ⊒ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) [PROOFSTEP] apply Scheme.OpenCover.pushforwardIso _ (pullbackRightPullbackFstIso g (S.affineCover.map i) f).hom [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : affineLocally P f hg : affineLocally P g i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J ⊒ Scheme.OpenCover (pullback f pullback.fst) [PROOFSTEP] apply Scheme.Pullback.openCoverOfRight [GOAL] case 𝒰 P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : affineLocally P f hg : affineLocally P g i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J ⊒ Scheme.OpenCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i)) [PROOFSTEP] exact (pullback g (S.affineCover.map i)).affineCover [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : affineLocally P f hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) ⊒ affineLocally P (f ≫ g) [PROOFSTEP] apply (@affine_openCover_iff _ hP _ _ (f ≫ g) S.affineCover _ ?_ ?_).mpr [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : affineLocally P f hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) ⊒ βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) (j : (?m.591569 i).J), P (Scheme.Ξ“.map (Scheme.OpenCover.map (?m.591569 i) j ≫ pullback.snd).op) P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : affineLocally P f hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) ⊒ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : affineLocally P f hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) ⊒ βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) (j : (?m.591569 i).J), IsAffine (Scheme.OpenCover.obj (?m.591569 i) j) [PROOFSTEP] rotate_left [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : affineLocally P f hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) ⊒ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) [PROOFSTEP] exact 𝒰 [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : affineLocally P f hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) ⊒ βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) (j : (𝒰 i).J), IsAffine (Scheme.OpenCover.obj (𝒰 i) j) [PROOFSTEP] intro i j [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : affineLocally P f hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J j : (𝒰 i).J ⊒ IsAffine (Scheme.OpenCover.obj (𝒰 i) j) [PROOFSTEP] dsimp at * [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : affineLocally P f hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J j : (𝒰 i).J ⊒ IsAffine (Scheme.OpenCover.obj (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j.fst ≫ pullback.fst))) j.snd) [PROOFSTEP] infer_instance [GOAL] P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : affineLocally P f hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) ⊒ βˆ€ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) (j : (𝒰 i).J), P (Scheme.Ξ“.map (Scheme.OpenCover.map (𝒰 i) j ≫ pullback.snd).op) [PROOFSTEP] rintro i ⟨j, k⟩ [GOAL] case mk P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : affineLocally P f hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J j : (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom).J k : ((fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1)) j).J ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (𝒰 i) { fst := j, snd := k } ≫ pullback.snd).op) [PROOFSTEP] dsimp at i j k [GOAL] case mk P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : affineLocally P f hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) i : (Scheme.affineCover S).J j : (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))).J k : (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))).J ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (𝒰 i) { fst := j, snd := k } ≫ pullback.snd).op) [PROOFSTEP] dsimp only [Scheme.OpenCover.bind_map, Scheme.OpenCover.pushforwardIso_obj, Scheme.Pullback.openCoverOfRight_obj, Scheme.OpenCover.pushforwardIso_map, Scheme.Pullback.openCoverOfRight_map, Scheme.OpenCover.bind_obj] [GOAL] case mk P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : affineLocally P f hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) i : (Scheme.affineCover S).J j : (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))).J k : (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))).J ⊒ P (Scheme.Ξ“.map ((Scheme.OpenCover.map (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))) k ≫ pullback.map f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst) f pullback.fst (πŸ™ X) (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j) (πŸ™ Y) (_ : f ≫ πŸ™ Y = πŸ™ X ≫ f) (_ : (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst) ≫ πŸ™ Y = Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst) ≫ (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) ≫ pullback.snd).op) [PROOFSTEP] rw [Category.assoc, Category.assoc, pullbackRightPullbackFstIso_hom_snd, pullback.lift_snd_assoc, Category.assoc, ← Category.assoc, op_comp, Functor.map_comp] [GOAL] case mk P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : affineLocally P f hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) i : (Scheme.affineCover S).J j : (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))).J k : (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))).J ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.snd).op ≫ Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))) k ≫ pullback.snd).op) [PROOFSTEP] apply hP.StableUnderComposition [GOAL] case mk.x P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : affineLocally P f hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) i : (Scheme.affineCover S).J j : (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))).J k : (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))).J ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.snd).op) [PROOFSTEP] apply hP.affine_openCover_iff _ _ _ |>.mp [GOAL] case mk.x.a P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : affineLocally P f hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) i : (Scheme.affineCover S).J j : (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))).J k : (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))).J ⊒ affineLocally P g [PROOFSTEP] exact hg [GOAL] case mk.x P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : affineLocally P f hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) i : (Scheme.affineCover S).J j : (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))).J k : (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))).J ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))) k ≫ pullback.snd).op) [PROOFSTEP] delta affineLocally at hf [GOAL] case mk.x P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : targetAffineLocally (sourceAffineLocally P) f hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) i : (Scheme.affineCover S).J j : (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))).J k : (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))).J ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))) k ≫ pullback.snd).op) [PROOFSTEP] have := (hP.isLocal_sourceAffineLocally.affine_openCover_TFAE f).out 0 3 [GOAL] case mk.x P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : targetAffineLocally (sourceAffineLocally P) f hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) i : (Scheme.affineCover S).J j : (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))).J k : (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))).J this : targetAffineLocally (sourceAffineLocally P) f ↔ βˆ€ {U : Scheme} (g : U ⟢ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], sourceAffineLocally P pullback.snd ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))) k ≫ pullback.snd).op) [PROOFSTEP] rw [this] at hf [GOAL] case mk.x P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : βˆ€ {U : Scheme} (g : U ⟢ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], sourceAffineLocally P pullback.snd hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) i : (Scheme.affineCover S).J j : (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))).J k : (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))).J this : targetAffineLocally (sourceAffineLocally P) f ↔ βˆ€ {U : Scheme} (g : U ⟢ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], sourceAffineLocally P pullback.snd ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))) k ≫ pullback.snd).op) [PROOFSTEP] have : IsOpenImmersion <| ((pullback g (S.affineCover.map i)).affineCover.map j ≫ pullback.fst) := LocallyRingedSpace.IsOpenImmersion.comp _ _ [GOAL] case mk.x P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hf : βˆ€ {U : Scheme} (g : U ⟢ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], sourceAffineLocally P pullback.snd hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) i : (Scheme.affineCover S).J j : (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))).J k : (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))).J this✝ : targetAffineLocally (sourceAffineLocally P) f ↔ βˆ€ {U : Scheme} (g : U ⟢ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], sourceAffineLocally P pullback.snd this : IsOpenImmersion (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst) ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))) k ≫ pullback.snd).op) [PROOFSTEP] specialize hf ((pullback g (S.affineCover.map i)).affineCover.map j ≫ pullback.fst) -- Porting note: again strange behavior of TFAE [GOAL] case mk.x P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) i : (Scheme.affineCover S).J j : (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))).J k : (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))).J this✝ : targetAffineLocally (sourceAffineLocally P) f ↔ βˆ€ {U : Scheme} (g : U ⟢ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], sourceAffineLocally P pullback.snd this : IsOpenImmersion (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst) hf : sourceAffineLocally P pullback.snd ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))) k ≫ pullback.snd).op) [PROOFSTEP] have := (hP.affine_openCover_TFAE (pullback.snd : pullback f ((pullback g (S.affineCover.map i)).affineCover.map j ≫ pullback.fst) ⟢ _)).out 0 3 [GOAL] case mk.x P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) i : (Scheme.affineCover S).J j : (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))).J k : (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))).J this✝¹ : targetAffineLocally (sourceAffineLocally P) f ↔ βˆ€ {U : Scheme} (g : U ⟢ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], sourceAffineLocally P pullback.snd this✝ : IsOpenImmersion (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst) hf : sourceAffineLocally P pullback.snd this : sourceAffineLocally P pullback.snd ↔ βˆ€ {U : Scheme} (g_1 : U ⟢ pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst)) [inst : IsAffine U] [inst : IsOpenImmersion g_1], P (Scheme.Ξ“.map (g_1 ≫ pullback.snd).op) ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))) k ≫ pullback.snd).op) [PROOFSTEP] rw [this] at hf [GOAL] case mk.x P : {R S : Type u} β†’ [inst : CommRing R] β†’ [inst_1 : CommRing S] β†’ (R β†’+* S) β†’ Prop hP : PropertyIsLocal P X Y S : Scheme f : X ⟢ Y g : Y ⟢ S hg : affineLocally P g 𝒰 : (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)).J) β†’ Scheme.OpenCover (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) (f ≫ g)) i) := fun i => Scheme.OpenCover.bind (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) fun i_1 => Scheme.affineCover (Scheme.OpenCover.obj (Scheme.OpenCover.pushforwardIso (Scheme.Pullback.openCoverOfRight (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) f pullback.fst) (pullbackRightPullbackFstIso g (Scheme.OpenCover.map (Scheme.affineCover S) i) f).hom) i_1) i : (Scheme.affineCover S).J j : (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))).J k : (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))).J this✝¹ : targetAffineLocally (sourceAffineLocally P) f ↔ βˆ€ {U : Scheme} (g : U ⟢ Y) [inst : IsAffine U] [inst_1 : IsOpenImmersion g], sourceAffineLocally P pullback.snd this✝ : IsOpenImmersion (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst) hf : βˆ€ {U : Scheme} (g_1 : U ⟢ pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst)) [inst : IsAffine U] [inst : IsOpenImmersion g_1], P (Scheme.Ξ“.map (g_1 ≫ pullback.snd).op) this : sourceAffineLocally P pullback.snd ↔ βˆ€ {U : Scheme} (g_1 : U ⟢ pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst)) [inst : IsAffine U] [inst : IsOpenImmersion g_1], P (Scheme.Ξ“.map (g_1 ≫ pullback.snd).op) ⊒ P (Scheme.Ξ“.map (Scheme.OpenCover.map (Scheme.affineCover (pullback f (Scheme.OpenCover.map (Scheme.affineCover (pullback g (Scheme.OpenCover.map (Scheme.affineCover S) i))) j ≫ pullback.fst))) k ≫ pullback.snd).op) [PROOFSTEP] apply hf
From Coq Require Import NArith Arith Lia List. Local Open Scope list_scope. Definition range (offset count: N) : list N := let fix range' (countdown: nat) := match countdown with | O => nil | S k => cons (offset + count - 1 - N.of_nat k)%N (range' k) end in range' (N.to_nat count). Local Example range_example: range 5 3 = (5 :: 6 :: 7 :: nil)%N. Proof. trivial. Qed. Definition range_nat (offset count: nat) : list N := let fix range' (countdown: nat) := match countdown with | O => nil | S k => cons (N.of_nat (offset + count - 1 - k)) (range' k) end in range' count. Lemma range_nat_ok (offset count: nat): range_nat offset count = range (N.of_nat offset) (N.of_nat count). Proof. unfold range, range_nat. rewrite Nat2N.id. revert offset. induction count. { trivial. } intro offset. cbn. assert (IH := IHcount (S offset)). clear IHcount. f_equal. { f_equal. lia. } assert (EqLHS: forall t, (fix range' (countdown : nat) : list N := match countdown with | 0 => nil | S k => (N.of_nat (offset + S count - 1 - k)) :: range' k end) t = (fix range' (countdown : nat) : list N := match countdown with | 0 => nil | S k => (N.of_nat (S offset + count - 1 - k)) :: range' k end) t). { clear IH. intro t. revert offset. induction t. { easy. } intro offset. f_equal. 2:apply IHt. f_equal. f_equal. lia. } rewrite EqLHS. clear EqLHS. assert (EqRHS: forall t, (fix range' (countdown : nat) : list N := match countdown with | 0 => nil | S k => (N.of_nat offset + N.pos (Pos.of_succ_nat count) - 1 - N.of_nat k)%N :: range' k end) t = (fix range' (countdown : nat) : list N := match countdown with | 0 => nil | S k => (N.of_nat (S offset) + N.of_nat count - 1 - N.of_nat k)%N :: range' k end) t). { clear IH. intro t. revert offset. induction t. { easy. } intro offset. f_equal. 2:apply IHt. f_equal. f_equal. lia. } rewrite EqRHS. clear EqRHS. apply IH. Qed. Lemma range_via_nat (offset count: N): range offset count = range_nat (N.to_nat offset) (N.to_nat count). Proof. rewrite range_nat_ok. now repeat rewrite N2Nat.id. Qed. Lemma range_cons (offset count: N): range offset (N.succ count) = offset :: range (N.succ offset) count. Proof. rewrite range_via_nat. unfold range_nat. revert offset. induction count; intros. { cbn. replace (Pos.to_nat 1) with 1 by easy. f_equal. lia. } cbn. rewrite Pnat.Pos2Nat.inj_succ. f_equal. { lia. } match goal with |- ?l _ = ?r _ => enough (forall x, l x = r x) by easy end. intro x. induction x. { trivial. } f_equal. { lia. } apply IHx. Qed.
lemma cmod_complex_polar: "cmod (r * (cos a + \<i> * sin a)) = \<bar>r\<bar>"
/** * Copyright (C) 2015 Dato, Inc. * All rights reserved. * * This software may be modified and distributed under the terms * of the BSD license. See the LICENSE file for details. */ /** * Copyright (c) 2009 Carnegie Mellon University. * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an "AS * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language * governing permissions and limitations under the License. * * For more about this software visit: * * http://www.graphlab.ml.cmu.edu * */ #ifndef GRAPHLAB_SYNCHRONIZED_UNORDERED_MAP #define GRAPHLAB_SYNCHRONIZED_UNORDERED_MAP #include <vector> #include <boost/unordered_map.hpp> #include <parallel/pthread_tools.hpp> namespace graphlab { /// \ingroup util_internal template <typename Data> class synchronized_unordered_map { public: typedef boost::unordered_map<size_t, Data> container; typedef typename container::iterator iterator; typedef typename container::const_iterator const_iterator; typedef std::pair<bool, Data*> datapointer; typedef std::pair<bool, const Data*> const_datapointer; typedef Data value_type; typedef size_t key_type; private: std::vector<container> data; std::vector<rwlock> lock; size_t nblocks; public: synchronized_unordered_map(size_t numblocks):data(numblocks), lock(numblocks), nblocks(numblocks) { for (size_t i = 0;i < numblocks; ++i) { data[i].max_load_factor(1.0); } } std::pair<bool, Data*> find(size_t key) { size_t b = key % nblocks; lock[b].readlock(); iterator iter = data[b].find(key); std::pair<bool, Data*> ret = std::make_pair(iter != data[b].end(), &(iter->second)); lock[b].rdunlock(); return ret; } /** return std::pair<found, iterator> if not found, iterator is invalid */ std::pair<bool, const Data*> find(size_t key) const { size_t b = key % nblocks; lock[b].readlock(); const_iterator iter = data[b].find(key); std::pair<bool, const Data*> ret = std::make_pair(iter != data[b].end(), &(iter->second)); lock[b].rdunlock(); return ret; } // care must be taken that you do not access an erased iterator void erase(size_t key) { size_t b = key % nblocks; lock[b].writelock(); data[b].erase(key); lock[b].wrunlock(); } template<typename Predicate> void erase_if(size_t key, Predicate pred) { size_t b = key % nblocks; lock[b].writelock(); iterator iter = data[b].find(key); if (iter != data[b].end() && pred(iter->second)) data[b].erase(key); lock[b].wrunlock(); } value_type& insert(size_t key, const value_type &val) { size_t b = key % nblocks; lock[b].writelock(); data[b][key] = val; value_type& ret = data[b][key]; lock[b].wrunlock(); return ret; } /** returns std::pair<success, iterator> on success, iterator will point to the entry on failure, iterator will point to an existing entry */ std::pair<bool, Data*> insert_with_failure_detect(size_t key, const value_type &val) { std::pair<bool, Data*> ret ; size_t b = key % nblocks; lock[b].writelock(); //search for it iterator iter = data[b].find(key); // if it not in the table, write and return if (iter == data[b].end()) { data[b][key] = val; ret = std::make_pair(true, &(data[b].find(key)->second)); } else { ret = std::make_pair(false, &(iter->second)); } lock[b].wrunlock(); return ret; } void clear() { for (size_t i = 0;i < data.size(); ++i) { data[i].clear(); } } }; } #endif
import tactic import data.real.basic import data.real.irrational -- Q1) what's the biggest element of {x ∈ ℝ | x < 1}? theorem soln1 : βˆ€ a ∈ {x : ℝ | x < 1}, βˆƒ b ∈ {x : ℝ | x < 1}, a < b := begin intro a, rintro (ha : a < 1), use (a + 1) / 2, split, { simp, linarith }, linarith, end open real -- Q2) Prove that for every positive intger n β‰  3, √n - √3 is irrational theorem soln2 : βˆ€ n : β„•, 0 < n ∧ n β‰  3 β†’ irrational (sqrt (n : ℝ) - sqrt 3) := begin rintros n ⟨hn0, hn3⟩ hq, rw set.mem_range at hq, cases hq with q hq, have hq1 := add_eq_of_eq_sub hq, apply_fun (Ξ» x, x * x) at hq1, have h3 : (0 : ℝ) ≀ 3 := by norm_num, simp [mul_add, add_mul, h3] at hq1, have hq2 : (2 : ℝ) * q * sqrt 3 = n - q * q - 3, rw ← hq1, ring, let r : β„š := n - q * q - 3, have hq3 : (2 : ℝ) * q * sqrt 3 = r, convert hq2, norm_cast, clear hq1, clear hq2, have s3 : irrational (sqrt ((3 : β„•) : ℝ)), apply nat.prime.irrational_sqrt, norm_num, simp at s3, have temp : (2 : ℝ) * q * sqrt 3 = sqrt 3 * ((2 : β„š) * q : β„š), rw mul_comm ((2 : ℝ) * _), norm_cast, rw temp at hq3, apply irrational.mul_rat s3, swap, use r, exact hq3.symm, clear hq3 r s3 temp, intro h, rw mul_eq_zero at h, cases h, linarith, rw h at hq, simp at hq, symmetry' at hq, rw sub_eq_zero at hq, apply hn3, apply_fun (Ξ» x, x * x) at hq, simp [h3] at hq, norm_cast at hq, end
theory DDL imports Main (* Christoph BenzmΓΌller & Xavier Parent & Ali Farjami, 2018 *) begin (* DDL: Dyadic Deontic Logic by Carmo and Jones *) typedecl i (*type for possible worlds*) type_synonym \<sigma> = "(i\<Rightarrow>bool)" consts av::"i\<Rightarrow>\<sigma>" pv::"i\<Rightarrow>\<sigma>" ob::"\<sigma>\<Rightarrow>(\<sigma>\<Rightarrow>bool)" (*accessibility relations*) cw::i (*current world*) axiomatization where ax_3a: "\<exists>x. av(w)(x)" and ax_4a: "\<forall>x. av(w)(x) \<longrightarrow> pv(w)(x)" and ax_4b: "pv(w)(w)" and ax_5a: "\<not>ob(X)(\<lambda>x. False)" and ax_5b: "(\<forall>w. ((Y(w) \<and> X(w)) \<longleftrightarrow> (Z(w) \<and> X(w)))) \<longrightarrow> (ob(X)(Y) \<longleftrightarrow> ob(X)(Z))" and ax_5c: "((\<forall>Z. \<beta>(Z) \<longrightarrow> ob(X)(Z)) \<and> (\<exists>Z. \<beta>(Z))) \<longrightarrow> (((\<exists>y. ((\<lambda>w. \<forall>Z. (\<beta> Z) \<longrightarrow> (Z w))(y) \<and> X(y))) \<longrightarrow> ob(X)(\<lambda>w. \<forall>Z. (\<beta> Z) \<longrightarrow> (Z w))))" and ax_5d: "((\<forall>w. Y(w) \<longrightarrow> X(w)) \<and> ob(X)(Y) \<and> (\<forall>w. X(w) \<longrightarrow> Z(w))) \<longrightarrow> ob(Z)(\<lambda>w. (Z(w) \<and> \<not>X(w)) \<or> Y(w))" and ax_5e: "((\<forall>w. Y(w) \<longrightarrow> X(w)) \<and> ob(X)(Z) \<and> (\<exists>w. Y(w) \<and> Z(w))) \<longrightarrow> ob(Y)(Z)" abbreviation ddlneg ("\<^bold>\<not>_"[52]53) where "\<^bold>\<not>A \<equiv> \<lambda>w. \<not>A(w)" abbreviation ddland (infixr"\<^bold>\<and>"51) where "A\<^bold>\<and>B \<equiv> \<lambda>w. A(w)\<and>B(w)" abbreviation ddlor (infixr"\<^bold>\<or>"50) where "A\<^bold>\<or>B \<equiv> \<lambda>w. A(w)\<or>B(w)" abbreviation ddlimp (infixr"\<^bold>\<rightarrow>"49) where "A\<^bold>\<rightarrow>B \<equiv> \<lambda>w. A(w)\<longrightarrow>B(w)" abbreviation ddlequiv (infixr"\<^bold>\<leftrightarrow>"48) where "A\<^bold>\<leftrightarrow>B \<equiv> \<lambda>w. A(w)\<longleftrightarrow>B(w)" abbreviation ddlbox ("\<^bold>\<box>") where "\<^bold>\<box>A \<equiv> \<lambda>w.\<forall>v. A(v)" (*A = (\<lambda>w. True)*) abbreviation ddlboxa ("\<^bold>\<box>\<^sub>a") where "\<^bold>\<box>\<^sub>aA \<equiv> \<lambda>w. (\<forall>x. av(w)(x) \<longrightarrow> A(x))" (*in all actual worlds*) abbreviation ddlboxp ("\<^bold>\<box>\<^sub>p") where "\<^bold>\<box>\<^sub>pA \<equiv> \<lambda>w. (\<forall>x. pv(w)(x) \<longrightarrow> A(x))" (*in all potential worlds*) abbreviation ddldia ("\<^bold>\<diamond>") where "\<^bold>\<diamond>A \<equiv> \<^bold>\<not>\<^bold>\<box>(\<^bold>\<not>A)" abbreviation ddldiaa ("\<^bold>\<diamond>\<^sub>a") where "\<^bold>\<diamond>\<^sub>aA \<equiv> \<^bold>\<not>\<^bold>\<box>\<^sub>a(\<^bold>\<not>A)" abbreviation ddldiap ("\<^bold>\<diamond>\<^sub>p") where "\<^bold>\<diamond>\<^sub>pA \<equiv> \<^bold>\<not>\<^bold>\<box>\<^sub>p(\<^bold>\<not>A)" abbreviation ddlo ("\<^bold>O\<^bold>\<langle>_\<^bold>|_\<^bold>\<rangle>"[52]53) where "\<^bold>O\<^bold>\<langle>B\<^bold>|A\<^bold>\<rangle> \<equiv> \<lambda>w. ob(A)(B)" (*it ought to be \<psi>, given \<phi> *) abbreviation ddloa ("\<^bold>O\<^sub>a") where "\<^bold>O\<^sub>aA \<equiv> \<lambda>w. ob(av(w))(A) \<and> (\<exists>x. av(w)(x) \<and> \<not>A(x))" (*actual obligation*) abbreviation ddlop ("\<^bold>O\<^sub>p") where "\<^bold>O\<^sub>pA \<equiv> \<lambda>w. ob(pv(w))(A) \<and> (\<exists>x. pv(w)(x) \<and> \<not>A(x))" (*primary obligation*) abbreviation ddltop ("\<^bold>\<top>") where "\<^bold>\<top> \<equiv> \<lambda>w. True" abbreviation ddlbot ("\<^bold>\<bottom>") where "\<^bold>\<bottom> \<equiv> \<lambda>w. False" abbreviation ddlvalid::"\<sigma> \<Rightarrow> bool" ("\<lfloor>_\<rfloor>"[7]105) where "\<lfloor>A\<rfloor> \<equiv> \<forall>w. A w" (*Global validity*) abbreviation ddlvalidcw::"\<sigma> \<Rightarrow> bool" ("\<lfloor>_\<rfloor>\<^sub>c\<^sub>w"[7]105) where "\<lfloor>A\<rfloor>\<^sub>c\<^sub>w \<equiv> A cw" (*Local validity (in cw)*) (* A is obliagtory *) abbreviation obligatoryDDL::"\<sigma>\<Rightarrow>\<sigma>" ("\<^bold>O\<^bold>\<langle>_\<^bold>\<rangle>") where "\<^bold>O\<^bold>\<langle>A\<^bold>\<rangle> \<equiv> \<^bold>O\<^bold>\<langle>A\<^bold>|\<^bold>\<top>\<^bold>\<rangle>" (* Consistency *) lemma True nitpick [satisfy] oops (* Unimportant *) sledgehammer_params [max_facts=20,timeout=20] (* Sets parameters for theorem provers *) nitpick_params [user_axioms,expect=genuine,show_all,format=2] (* ... and model finder. *) end
||| CSS Rules for the Inc. Buttons Example module Examples.CSS.Reset import Data.Vect import Examples.CSS.Colors import public Examples.CSS.Core import Rhone.JS import Text.CSS -------------------------------------------------------------------------------- -- IDs -------------------------------------------------------------------------------- ||| Where the accumulated count is printed to public export out : ElemRef Div out = Id Div "reset_out" ||| ID of the increasing button public export btnInc : ElemRef Button btnInc = Id Button "reset_inc" ||| ID of the decreasing button public export btnDec : ElemRef Button btnDec = Id Button "reset_dec" ||| ID of the reset button public export btnReset : ElemRef Button btnReset = Id Button "reset_reset" -------------------------------------------------------------------------------- -- CSS -------------------------------------------------------------------------------- export resetLbl : String resetLbl = "reset_resetlbl" export incLbl : String incLbl = "reset_inclbl" export decLbl : String decLbl = "reset_declbl" export countLbl : String countLbl = "reset_countlbl" export resetContent : String resetContent = "reset_content" export resetBtn : String resetBtn = "reset_incbtn" data Tag = LRes | BRes | LInc | BInc | LDec | BDec | LCnt | OCnt AreaTag Tag where showTag LRes = "LRes" showTag BRes = "BRes" showTag LInc = "LInc" showTag BInc = "BInc" showTag LDec = "LDec" showTag BDec = "BDec" showTag LCnt = "LCnt" showTag OCnt = "OCnt" export css : List (Rule 1) css = [ class resetContent !! [ Display .= Area (replicate 4 MinContent) [MaxContent, MaxContent] [ [LRes, BRes] , [LInc, BInc] , [LDec, BDec] , [LCnt, OCnt] ] , ColumnGap .= px 10 , RowGap .= px 10 , Padding .= VH (px 20) (px 10) ] , class resetLbl !! [ GridArea .= LRes ] , idRef btnReset !! [ GridArea .= BRes ] , class incLbl !! [ GridArea .= LInc ] , idRef btnInc !! [ GridArea .= BInc ] , class decLbl !! [ GridArea .= LDec ] , idRef btnDec !! [ GridArea .= BDec ] , class countLbl !! [ GridArea .= LCnt ] , idRef out !! [ FontSize .= Large , GridArea .= OCnt , TextAlign .= End ] ]
# Simple 1-D Burger's POD-ROM The problem we are solving is, for $ x\in [0,100] $ and $t\in [0, T]$: \begin{align}\label{eq:burgers} \begin{split} w_t + \frac{1}{2}\left(w^2\right)_x &= 0.02 e^{\mu_2 x}, \\ w(0, t, \mu) &= \mu_1, \\ w(x,0,\mu) &= 1. \end{split} \end{align} ```python # These are required from time import perf_counter import numpy as np import matplotlib.pyplot as plt # This is only necessary to load the previously prepared data from torch import load ``` ### This is the class managing the simulation. Computes ROM and (optionally) FOM with finite differences. Supports loading data from my file or generating it from a list of parameter pairs. ```python class BurgersROM: def __init__(self): pass def POD_from_data(self, file, n): ''' Loads snapshot data from my BurgersData file. Computes POD approximation after subtracting initial condition. ''' data = load(file) S = data['S'] M = data['M'] tStart = perf_counter() for i in range(12): IC = np.ones(S.shape[1]) IC[0] = M[101*i][1] S[101*i:101*(i+1)] = S[101*i:101*(i+1)] - IC.reshape(1,-1) self.POD = np.linalg.svd(S.T)[0][:,:n] tEnd = perf_counter() print(f'POD time is {tEnd-tStart}') def POD_from_parameters(self, N, Nt, t_max, mu_list, n): ''' Computes a POD approximation from a user-defined list of parameters. ''' sols = [0 for mu in mu_list] u0 = np.ones(N) for i, mu in enumerate(mu_list): sols[i] = self.solve_FOM(N, Nt, t_max, mu, verbose=False) u0[0] = mu[0] sols[i] = sols[i] - u0.reshape(-1,1) snapshots = np.concatenate(sols, axis=1) self.POD = np.linalg.svd(snapshots)[0][:,:n] def solve_FOM(self, N, Nt, t_max, mu, I=[0,100], verbose=True): ''' Computes the (N x Nt) FOM solution at parameter mu. ''' def f(u): return 0.5 * u**2 # Convenience function # Define parameters a, b = I dt = t_max / Nt x = np.linspace(a, b, N) dx = (b - a) / N # Define forcing. g = 0.02 * np.exp(mu[1] * x) # Set up the initial solution values. u0 = np.ones_like(x) u0[0] = mu[0] # BC at left endpoint # Initialize quantities. U = np.zeros((Nt+1, N)) U[0] = u0 # Implementation of the numerical method. FOMtElapsed = 0 for i in range(1, Nt+1): # Upwind conservative. FOMtStart = perf_counter() u = U[i-1] uNew = u uNew[1:] = u[1:] + dt * (-1 / dx * (f(u[1:]) - f(u[:-1])) + g[1:]) FOMtEnd = perf_counter() FOMtElapsed = FOMtElapsed + FOMtEnd - FOMtStart # Save the latest result. U[i] = uNew if verbose is True: print(f'FOM time is {FOMtElapsed}') return U.T def assemble(self, mu, I=[0,100]): ''' Assembles ROM system at parameter mu. Uses POD basis computed earlier. ''' a, b = I N = self.POD.shape[0] x = np.linspace(a, b, N) dx = (b - a) / N def tridiag(a, b, c, k1=-1, k2=0, k3=1): return np.diag(a, k1) + np.diag(b, k2) + np.diag(c, k3) tStart = perf_counter() # Precompute quantities for ROM. PODinv = self.POD.T # Since POD comes from unitary mtx self.gRed = PODinv @ (0.02 * np.exp(mu[1] * x)) fdiag = np.insert(np.ones(N-1), 0, 0) FD = tridiag(-np.ones(N-1), fdiag, np.zeros(N-1)) / dx fd = PODinv @ FD # low-dim FD matrix u0 = np.ones_like(x) u0[0] = mu[0] # BC at left endpoint self.aVec = fd @ (0.5*u0**2) # rank-1 term in (u^2)_x self.Bmat = fd @ np.diag(u0) @ self.POD # rank-2 term in (u^2)_x outprod = np.tensordot(self.POD, self.POD, axes=0) temp = 0.5 * outprod.diagonal(axis1=0, axis2=2).transpose((2,1,0)) self.Ctens = np.einsum('ij,jkl', fd, temp) # rank-3 term in (u^2)_x tEnd = perf_counter() print(f'assembly time is {tEnd-tStart}') def solve_ROM(self, Nt, t_max, I=[0,100]): ''' Forward Euler to solve the pre-assembled ROM. ''' # Define parameters a, b = I dt = t_max / Nt N = self.POD.shape[0] x = np.linspace(a, b, N) dx = (b-a) / N # Initialize quantities. uRed0 = np.zeros(self.POD.shape[1]) U = np.zeros((Nt+1, self.POD.shape[1])) U[0] = uRed0 # Implementation of the numerical method. ROMtElapsed = 0 for i in range(1,Nt+1): ROMtStart = perf_counter() uRed = U[i-1] uRed2 = np.tensordot(uRed, uRed, axes=0) uRedNew = uRed + dt * (self.gRed - self.aVec - self.Bmat @ uRed \ - np.einsum('ijk,jk', self.Ctens, uRed2)) ROMtEnd = perf_counter() ROMtElapsed = ROMtElapsed + ROMtEnd - ROMtStart # Save the latest result. U[i] = uRedNew print(f'ROM time is {ROMtElapsed}') return U.T def reconstruct(self, approx, mu): ''' Reconstruct approximation to the FOM solution at mu from approx. ''' u0 = np.ones(self.POD.shape[0]) u0[0] = mu[0] return u0.reshape(-1,1) + self.POD @ approx ``` ## Testing We test the convergence under refinement of the reduced dimension. First, we use the POD basis computed from my saved data. ```python x = np.linspace(0, 100, 256) mu = [2.75, 0.00275] p=50 rom = BurgersROM() sol = rom.solve_FOM(256, 100, 10, mu) rom.POD_from_data('datasets/burgersData', 3) rom.assemble(mu) qqq = rom.solve_ROM(100, 10) sol4 = rom.reconstruct(qqq, mu) rom.POD_from_data('datasets/burgersData', 10) rom.assemble(mu) qqq = rom.solve_ROM(100, 10) sol10 = rom.reconstruct(qqq, mu) rom.POD_from_data('datasets/burgersData', 30) rom.assemble(mu) qqq = rom.solve_ROM(100, 10) sol30 = rom.reconstruct(qqq, mu) fig = plt.figure(1, figsize=(8, 8)) ax = fig.add_subplot(1, 1, 1) ax.xaxis.label.set_size(24) ax.yaxis.label.set_size(24) ax.tick_params(axis='x', labelsize=18) ax.tick_params(axis='y', labelsize=18) ax.set_xlabel('Position $x$', labelpad=15) ax.set_ylabel('Solution $w$', labelpad=15) ax.plot(x, sol[:,p]) ax.plot(x, sol4[:,p]) ax.plot(x, sol10[:,p]) ax.plot(x, sol30[:,p]) plt.show() ``` ### Testing from parameters Now, we test the basis computed from some random parameters. ```python mu_list = np.array([0.5, 0.001]) + np.random.rand(10,2) * [3.5, 0.003] x = np.linspace(0, 100, 256) mu = [2.75, 0.00275] p=50 rom = BurgersROM() sol = rom.solve_FOM(256, 100, 10, mu) rom.POD_from_parameters(256, 100, 10, mu_list, 3) rom.assemble(mu) qqq = rom.solve_ROM(100, 10) sol4 = rom.reconstruct(qqq, mu) rom.POD_from_parameters(256, 100, 10, mu_list, 10) rom.assemble(mu) qqq = rom.solve_ROM(100, 10) sol10 = rom.reconstruct(qqq, mu) rom.POD_from_parameters(256, 100, 10, mu_list, 30) rom.assemble(mu) qqq = rom.solve_ROM(100, 10) sol30 = rom.reconstruct(qqq, mu) fig = plt.figure(1, figsize=(8, 8)) ax = fig.add_subplot(1, 1, 1) ax.xaxis.label.set_size(24) ax.yaxis.label.set_size(24) ax.tick_params(axis='x', labelsize=18) ax.tick_params(axis='y', labelsize=18) ax.set_xlabel('Position $x$', labelpad=15) ax.set_ylabel('Solution $w$', labelpad=15) ax.plot(x, sol[:,p]) ax.plot(x, sol4[:,p]) ax.plot(x, sol10[:,p]) ax.plot(x, sol30[:,p]) plt.show() ```
[GOAL] X : Type u_2 Y : Type u_1 Z : Type ?u.666 W : Type ?u.669 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y e : X β‰ƒβ‚œ Y ⊒ IsProperMap ↑e [PROOFSTEP] rw [isProperMap_iff_clusterPt] [GOAL] X : Type u_2 Y : Type u_1 Z : Type ?u.666 W : Type ?u.669 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y e : X β‰ƒβ‚œ Y ⊒ Continuous ↑e ∧ βˆ€ ⦃ℱ : Filter X⦄ ⦃y : Y⦄, MapClusterPt y β„± ↑e β†’ βˆƒ x, ↑e x = y ∧ ClusterPt x β„± [PROOFSTEP] refine ⟨e.continuous, fun β„± y ↦ ?_⟩ [GOAL] X : Type u_2 Y : Type u_1 Z : Type ?u.666 W : Type ?u.669 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y e : X β‰ƒβ‚œ Y β„± : Filter X y : Y ⊒ MapClusterPt y β„± ↑e β†’ βˆƒ x, ↑e x = y ∧ ClusterPt x β„± [PROOFSTEP] simp_rw [MapClusterPt, ClusterPt, ← Filter.push_pull', map_neBot_iff, e.comap_nhds_eq, ← e.coe_toEquiv, ← e.eq_symm_apply, exists_eq_left] [GOAL] X : Type u_2 Y : Type u_1 Z : Type ?u.666 W : Type ?u.669 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y e : X β‰ƒβ‚œ Y β„± : Filter X y : Y ⊒ NeBot (𝓝 (↑(Homeomorph.symm e) y) βŠ“ β„±) β†’ NeBot (𝓝 (↑e.symm y) βŠ“ β„±) [PROOFSTEP] exact id [GOAL] X : Type u_1 Y : Type u_2 Z : Type ?u.2964 W : Type ?u.2967 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y h : IsProperMap f ⊒ IsClosedMap f [PROOFSTEP] rw [isClosedMap_iff_clusterPt] [GOAL] X : Type u_1 Y : Type u_2 Z : Type ?u.2964 W : Type ?u.2967 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y h : IsProperMap f ⊒ βˆ€ (s : Set X) (y : Y), MapClusterPt y (π“Ÿ s) f β†’ βˆƒ x, f x = y ∧ ClusterPt x (π“Ÿ s) [PROOFSTEP] exact fun s y ↦ h.clusterPt_of_mapClusterPt (β„± := π“Ÿ s) (y := y) [GOAL] X : Type u_1 Y : Type u_2 Z : Type ?u.3327 W : Type ?u.3330 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y ⊒ IsProperMap f ↔ Continuous f ∧ βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] rw [isProperMap_iff_clusterPt] [GOAL] X : Type u_1 Y : Type u_2 Z : Type ?u.3327 W : Type ?u.3330 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y ⊒ (Continuous f ∧ βˆ€ ⦃ℱ : Filter X⦄ ⦃y : Y⦄, MapClusterPt y β„± f β†’ βˆƒ x, f x = y ∧ ClusterPt x β„±) ↔ Continuous f ∧ βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] refine and_congr_right (fun _ ↦ ?_) [GOAL] X : Type u_1 Y : Type u_2 Z : Type ?u.3327 W : Type ?u.3330 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y x✝ : Continuous f ⊒ (βˆ€ ⦃ℱ : Filter X⦄ ⦃y : Y⦄, MapClusterPt y β„± f β†’ βˆƒ x, f x = y ∧ ClusterPt x β„±) ↔ βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] constructor [GOAL] case mp X : Type u_1 Y : Type u_2 Z : Type ?u.3327 W : Type ?u.3330 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y x✝ : Continuous f ⊒ (βˆ€ ⦃ℱ : Filter X⦄ ⦃y : Y⦄, MapClusterPt y β„± f β†’ βˆƒ x, f x = y ∧ ClusterPt x β„±) β†’ βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] intro H [GOAL] case mpr X : Type u_1 Y : Type u_2 Z : Type ?u.3327 W : Type ?u.3330 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y x✝ : Continuous f ⊒ (βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x) β†’ βˆ€ ⦃ℱ : Filter X⦄ ⦃y : Y⦄, MapClusterPt y β„± f β†’ βˆƒ x, f x = y ∧ ClusterPt x β„± [PROOFSTEP] intro H [GOAL] case mp X : Type u_1 Y : Type u_2 Z : Type ?u.3327 W : Type ?u.3330 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y x✝ : Continuous f H : βˆ€ ⦃ℱ : Filter X⦄ ⦃y : Y⦄, MapClusterPt y β„± f β†’ βˆƒ x, f x = y ∧ ClusterPt x β„± ⊒ βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] intro 𝒰 y (hY : (Ultrafilter.map f 𝒰 : Filter Y) ≀ _) [GOAL] case mp X : Type u_1 Y : Type u_2 Z : Type ?u.3327 W : Type ?u.3330 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y x✝ : Continuous f H : βˆ€ ⦃ℱ : Filter X⦄ ⦃y : Y⦄, MapClusterPt y β„± f β†’ βˆƒ x, f x = y ∧ ClusterPt x β„± 𝒰 : Ultrafilter X y : Y hY : ↑(Ultrafilter.map f 𝒰) ≀ 𝓝 y ⊒ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] simp_rw [← Ultrafilter.clusterPt_iff] at hY ⊒ [GOAL] case mp X : Type u_1 Y : Type u_2 Z : Type ?u.3327 W : Type ?u.3330 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y x✝ : Continuous f H : βˆ€ ⦃ℱ : Filter X⦄ ⦃y : Y⦄, MapClusterPt y β„± f β†’ βˆƒ x, f x = y ∧ ClusterPt x β„± 𝒰 : Ultrafilter X y : Y hY : ClusterPt y ↑(Ultrafilter.map f 𝒰) ⊒ βˆƒ x, f x = y ∧ ClusterPt x ↑𝒰 [PROOFSTEP] exact H hY [GOAL] case mpr X : Type u_1 Y : Type u_2 Z : Type ?u.3327 W : Type ?u.3330 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y x✝ : Continuous f H : βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x ⊒ βˆ€ ⦃ℱ : Filter X⦄ ⦃y : Y⦄, MapClusterPt y β„± f β†’ βˆƒ x, f x = y ∧ ClusterPt x β„± [PROOFSTEP] simp_rw [MapClusterPt, ClusterPt, ← Filter.push_pull', map_neBot_iff, ← exists_ultrafilter_iff, forall_exists_index] [GOAL] case mpr X : Type u_1 Y : Type u_2 Z : Type ?u.3327 W : Type ?u.3330 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y x✝ : Continuous f H : βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x ⊒ βˆ€ ⦃ℱ : Filter X⦄ ⦃y : Y⦄ (x : Ultrafilter X), ↑x ≀ comap f (𝓝 y) βŠ“ β„± β†’ βˆƒ x, f x = y ∧ βˆƒ u, ↑u ≀ 𝓝 x βŠ“ β„± [PROOFSTEP] intro β„± y 𝒰 hy [GOAL] case mpr X : Type u_1 Y : Type u_2 Z : Type ?u.3327 W : Type ?u.3330 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y x✝ : Continuous f H : βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x β„± : Filter X y : Y 𝒰 : Ultrafilter X hy : ↑𝒰 ≀ comap f (𝓝 y) βŠ“ β„± ⊒ βˆƒ x, f x = y ∧ βˆƒ u, ↑u ≀ 𝓝 x βŠ“ β„± [PROOFSTEP] rcases H (tendsto_iff_comap.mpr <| hy.trans inf_le_left) with ⟨x, hxy, hx⟩ [GOAL] case mpr.intro.intro X : Type u_1 Y : Type u_2 Z : Type ?u.3327 W : Type ?u.3330 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y x✝ : Continuous f H : βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x β„± : Filter X y : Y 𝒰 : Ultrafilter X hy : ↑𝒰 ≀ comap f (𝓝 y) βŠ“ β„± x : X hxy : f x = y hx : ↑𝒰 ≀ 𝓝 x ⊒ βˆƒ x, f x = y ∧ βˆƒ u, ↑u ≀ 𝓝 x βŠ“ β„± [PROOFSTEP] exact ⟨x, hxy, 𝒰, le_inf hx (hy.trans inf_le_right)⟩ [GOAL] X : Type u_1 Y : Type u_2 Z : Type u_3 W : Type u_4 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y g : Z β†’ W hf : IsProperMap f hg : IsProperMap g ⊒ IsProperMap (Prod.map f g) [PROOFSTEP] simp_rw [isProperMap_iff_ultrafilter] at hf hg ⊒ [GOAL] X : Type u_1 Y : Type u_2 Z : Type u_3 W : Type u_4 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y g : Z β†’ W hf : Continuous f ∧ βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x hg : Continuous g ∧ βˆ€ ⦃𝒰 : Ultrafilter Z⦄ ⦃y : W⦄, Tendsto g (↑𝒰) (𝓝 y) β†’ βˆƒ x, g x = y ∧ ↑𝒰 ≀ 𝓝 x ⊒ Continuous (Prod.map f g) ∧ βˆ€ ⦃𝒰 : Ultrafilter (X Γ— Z)⦄ ⦃y : Y Γ— W⦄, Tendsto (Prod.map f g) (↑𝒰) (𝓝 y) β†’ βˆƒ x, Prod.map f g x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] constructor -- Continuity is clear. [GOAL] case left X : Type u_1 Y : Type u_2 Z : Type u_3 W : Type u_4 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y g : Z β†’ W hf : Continuous f ∧ βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x hg : Continuous g ∧ βˆ€ ⦃𝒰 : Ultrafilter Z⦄ ⦃y : W⦄, Tendsto g (↑𝒰) (𝓝 y) β†’ βˆƒ x, g x = y ∧ ↑𝒰 ≀ 𝓝 x ⊒ Continuous (Prod.map f g) [PROOFSTEP] exact hf.1.prod_map hg.1 -- Let `𝒰 : Ultrafilter (X Γ— Z)`, and assume that `f Γ— g` tends to some `(y, w) : Y Γ— W` -- along `𝒰`. [GOAL] case right X : Type u_1 Y : Type u_2 Z : Type u_3 W : Type u_4 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y g : Z β†’ W hf : Continuous f ∧ βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x hg : Continuous g ∧ βˆ€ ⦃𝒰 : Ultrafilter Z⦄ ⦃y : W⦄, Tendsto g (↑𝒰) (𝓝 y) β†’ βˆƒ x, g x = y ∧ ↑𝒰 ≀ 𝓝 x ⊒ βˆ€ ⦃𝒰 : Ultrafilter (X Γ— Z)⦄ ⦃y : Y Γ— W⦄, Tendsto (Prod.map f g) (↑𝒰) (𝓝 y) β†’ βˆƒ x, Prod.map f g x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] intro 𝒰 ⟨y, w⟩ hyw [GOAL] case right X : Type u_1 Y : Type u_2 Z : Type u_3 W : Type u_4 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y g : Z β†’ W hf : Continuous f ∧ βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x hg : Continuous g ∧ βˆ€ ⦃𝒰 : Ultrafilter Z⦄ ⦃y : W⦄, Tendsto g (↑𝒰) (𝓝 y) β†’ βˆƒ x, g x = y ∧ ↑𝒰 ≀ 𝓝 x 𝒰 : Ultrafilter (X Γ— Z) y : Y w : W hyw : Tendsto (Prod.map f g) (↑𝒰) (𝓝 (y, w)) ⊒ βˆƒ x, Prod.map f g x = (y, w) ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] simp_rw [nhds_prod_eq, tendsto_prod_iff'] at hyw [GOAL] case right X : Type u_1 Y : Type u_2 Z : Type u_3 W : Type u_4 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y g : Z β†’ W hf : Continuous f ∧ βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x hg : Continuous g ∧ βˆ€ ⦃𝒰 : Ultrafilter Z⦄ ⦃y : W⦄, Tendsto g (↑𝒰) (𝓝 y) β†’ βˆƒ x, g x = y ∧ ↑𝒰 ≀ 𝓝 x 𝒰 : Ultrafilter (X Γ— Z) y : Y w : W hyw : Tendsto (fun n => (Prod.map f g n).fst) (↑𝒰) (𝓝 y) ∧ Tendsto (fun n => (Prod.map f g n).snd) (↑𝒰) (𝓝 w) ⊒ βˆƒ x, Prod.map f g x = (y, w) ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] rcases hf.2 (show Tendsto f (Ultrafilter.map fst 𝒰) (𝓝 y) by simpa using hyw.1) with ⟨x, hxy, hx⟩ [GOAL] X : Type u_1 Y : Type u_2 Z : Type u_3 W : Type u_4 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y g : Z β†’ W hf : Continuous f ∧ βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x hg : Continuous g ∧ βˆ€ ⦃𝒰 : Ultrafilter Z⦄ ⦃y : W⦄, Tendsto g (↑𝒰) (𝓝 y) β†’ βˆƒ x, g x = y ∧ ↑𝒰 ≀ 𝓝 x 𝒰 : Ultrafilter (X Γ— Z) y : Y w : W hyw : Tendsto (fun n => (Prod.map f g n).fst) (↑𝒰) (𝓝 y) ∧ Tendsto (fun n => (Prod.map f g n).snd) (↑𝒰) (𝓝 w) ⊒ Tendsto f (↑(Ultrafilter.map fst 𝒰)) (𝓝 y) [PROOFSTEP] simpa using hyw.1 [GOAL] case right.intro.intro X : Type u_1 Y : Type u_2 Z : Type u_3 W : Type u_4 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y g : Z β†’ W hf : Continuous f ∧ βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x hg : Continuous g ∧ βˆ€ ⦃𝒰 : Ultrafilter Z⦄ ⦃y : W⦄, Tendsto g (↑𝒰) (𝓝 y) β†’ βˆƒ x, g x = y ∧ ↑𝒰 ≀ 𝓝 x 𝒰 : Ultrafilter (X Γ— Z) y : Y w : W hyw : Tendsto (fun n => (Prod.map f g n).fst) (↑𝒰) (𝓝 y) ∧ Tendsto (fun n => (Prod.map f g n).snd) (↑𝒰) (𝓝 w) x : X hxy : f x = y hx : ↑(Ultrafilter.map fst 𝒰) ≀ 𝓝 x ⊒ βˆƒ x, Prod.map f g x = (y, w) ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] rcases hg.2 (show Tendsto g (Ultrafilter.map snd 𝒰) (𝓝 w) by simpa using hyw.2) with ⟨z, hzw, hz⟩ -- By the properties of the product topology, that means that `𝒰` tends to `(x, z)`, -- which completes the proof since `(f Γ— g)(x, z) = (y, w)`. [GOAL] X : Type u_1 Y : Type u_2 Z : Type u_3 W : Type u_4 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y g : Z β†’ W hf : Continuous f ∧ βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x hg : Continuous g ∧ βˆ€ ⦃𝒰 : Ultrafilter Z⦄ ⦃y : W⦄, Tendsto g (↑𝒰) (𝓝 y) β†’ βˆƒ x, g x = y ∧ ↑𝒰 ≀ 𝓝 x 𝒰 : Ultrafilter (X Γ— Z) y : Y w : W hyw : Tendsto (fun n => (Prod.map f g n).fst) (↑𝒰) (𝓝 y) ∧ Tendsto (fun n => (Prod.map f g n).snd) (↑𝒰) (𝓝 w) x : X hxy : f x = y hx : ↑(Ultrafilter.map fst 𝒰) ≀ 𝓝 x ⊒ Tendsto g (↑(Ultrafilter.map snd 𝒰)) (𝓝 w) [PROOFSTEP] simpa using hyw.2 [GOAL] case right.intro.intro.intro.intro X : Type u_1 Y : Type u_2 Z : Type u_3 W : Type u_4 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y g : Z β†’ W hf : Continuous f ∧ βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x hg : Continuous g ∧ βˆ€ ⦃𝒰 : Ultrafilter Z⦄ ⦃y : W⦄, Tendsto g (↑𝒰) (𝓝 y) β†’ βˆƒ x, g x = y ∧ ↑𝒰 ≀ 𝓝 x 𝒰 : Ultrafilter (X Γ— Z) y : Y w : W hyw : Tendsto (fun n => (Prod.map f g n).fst) (↑𝒰) (𝓝 y) ∧ Tendsto (fun n => (Prod.map f g n).snd) (↑𝒰) (𝓝 w) x : X hxy : f x = y hx : ↑(Ultrafilter.map fst 𝒰) ≀ 𝓝 x z : Z hzw : g z = w hz : ↑(Ultrafilter.map snd 𝒰) ≀ 𝓝 z ⊒ βˆƒ x, Prod.map f g x = (y, w) ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] refine ⟨⟨x, z⟩, Prod.ext hxy hzw, ?_⟩ [GOAL] case right.intro.intro.intro.intro X : Type u_1 Y : Type u_2 Z : Type u_3 W : Type u_4 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y g : Z β†’ W hf : Continuous f ∧ βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x hg : Continuous g ∧ βˆ€ ⦃𝒰 : Ultrafilter Z⦄ ⦃y : W⦄, Tendsto g (↑𝒰) (𝓝 y) β†’ βˆƒ x, g x = y ∧ ↑𝒰 ≀ 𝓝 x 𝒰 : Ultrafilter (X Γ— Z) y : Y w : W hyw : Tendsto (fun n => (Prod.map f g n).fst) (↑𝒰) (𝓝 y) ∧ Tendsto (fun n => (Prod.map f g n).snd) (↑𝒰) (𝓝 w) x : X hxy : f x = y hx : ↑(Ultrafilter.map fst 𝒰) ≀ 𝓝 x z : Z hzw : g z = w hz : ↑(Ultrafilter.map snd 𝒰) ≀ 𝓝 z ⊒ ↑𝒰 ≀ 𝓝 (x, z) [PROOFSTEP] rw [nhds_prod_eq, le_prod] [GOAL] case right.intro.intro.intro.intro X : Type u_1 Y : Type u_2 Z : Type u_3 W : Type u_4 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y g : Z β†’ W hf : Continuous f ∧ βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x hg : Continuous g ∧ βˆ€ ⦃𝒰 : Ultrafilter Z⦄ ⦃y : W⦄, Tendsto g (↑𝒰) (𝓝 y) β†’ βˆƒ x, g x = y ∧ ↑𝒰 ≀ 𝓝 x 𝒰 : Ultrafilter (X Γ— Z) y : Y w : W hyw : Tendsto (fun n => (Prod.map f g n).fst) (↑𝒰) (𝓝 y) ∧ Tendsto (fun n => (Prod.map f g n).snd) (↑𝒰) (𝓝 w) x : X hxy : f x = y hx : ↑(Ultrafilter.map fst 𝒰) ≀ 𝓝 x z : Z hzw : g z = w hz : ↑(Ultrafilter.map snd 𝒰) ≀ 𝓝 z ⊒ Tendsto fst (↑𝒰) (𝓝 x) ∧ Tendsto snd (↑𝒰) (𝓝 z) [PROOFSTEP] exact ⟨hx, hz⟩ [GOAL] X✝ : Type ?u.30436 Y✝ : Type ?u.30439 Z : Type ?u.30442 W : Type ?u.30445 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ ΞΉ : Type u_3 X : ΞΉ β†’ Type u_1 Y : ΞΉ β†’ Type u_2 inst✝¹ : (i : ΞΉ) β†’ TopologicalSpace (X i) inst✝ : (i : ΞΉ) β†’ TopologicalSpace (Y i) f : (i : ΞΉ) β†’ X i β†’ Y i h : βˆ€ (i : ΞΉ), IsProperMap (f i) ⊒ IsProperMap fun x i => f i (x i) [PROOFSTEP] simp_rw [isProperMap_iff_ultrafilter] at h ⊒ [GOAL] X✝ : Type ?u.30436 Y✝ : Type ?u.30439 Z : Type ?u.30442 W : Type ?u.30445 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ ΞΉ : Type u_3 X : ΞΉ β†’ Type u_1 Y : ΞΉ β†’ Type u_2 inst✝¹ : (i : ΞΉ) β†’ TopologicalSpace (X i) inst✝ : (i : ΞΉ) β†’ TopologicalSpace (Y i) f : (i : ΞΉ) β†’ X i β†’ Y i h : βˆ€ (i : ΞΉ), Continuous (f i) ∧ βˆ€ ⦃𝒰 : Ultrafilter (X i)⦄ ⦃y : Y i⦄, Tendsto (f i) (↑𝒰) (𝓝 y) β†’ βˆƒ x, f i x = y ∧ ↑𝒰 ≀ 𝓝 x ⊒ (Continuous fun x i => f i (x i)) ∧ βˆ€ ⦃𝒰 : Ultrafilter ((i : ΞΉ) β†’ X i)⦄ ⦃y : (i : ΞΉ) β†’ Y i⦄, Tendsto (fun x i => f i (x i)) (↑𝒰) (𝓝 y) β†’ βˆƒ x, (fun i => f i (x i)) = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] constructor -- Continuity is clear. [GOAL] case left X✝ : Type ?u.30436 Y✝ : Type ?u.30439 Z : Type ?u.30442 W : Type ?u.30445 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ ΞΉ : Type u_3 X : ΞΉ β†’ Type u_1 Y : ΞΉ β†’ Type u_2 inst✝¹ : (i : ΞΉ) β†’ TopologicalSpace (X i) inst✝ : (i : ΞΉ) β†’ TopologicalSpace (Y i) f : (i : ΞΉ) β†’ X i β†’ Y i h : βˆ€ (i : ΞΉ), Continuous (f i) ∧ βˆ€ ⦃𝒰 : Ultrafilter (X i)⦄ ⦃y : Y i⦄, Tendsto (f i) (↑𝒰) (𝓝 y) β†’ βˆƒ x, f i x = y ∧ ↑𝒰 ≀ 𝓝 x ⊒ Continuous fun x i => f i (x i) [PROOFSTEP] exact continuous_pi fun i ↦ (h i).1.comp (continuous_apply i) -- Let `𝒰 : Ultrafilter (Ξ  i, X i)`, and assume that `Ξ  i, f i` tends to some `y : Ξ  i, Y i` -- along `𝒰`. [GOAL] case right X✝ : Type ?u.30436 Y✝ : Type ?u.30439 Z : Type ?u.30442 W : Type ?u.30445 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ ΞΉ : Type u_3 X : ΞΉ β†’ Type u_1 Y : ΞΉ β†’ Type u_2 inst✝¹ : (i : ΞΉ) β†’ TopologicalSpace (X i) inst✝ : (i : ΞΉ) β†’ TopologicalSpace (Y i) f : (i : ΞΉ) β†’ X i β†’ Y i h : βˆ€ (i : ΞΉ), Continuous (f i) ∧ βˆ€ ⦃𝒰 : Ultrafilter (X i)⦄ ⦃y : Y i⦄, Tendsto (f i) (↑𝒰) (𝓝 y) β†’ βˆƒ x, f i x = y ∧ ↑𝒰 ≀ 𝓝 x ⊒ βˆ€ ⦃𝒰 : Ultrafilter ((i : ΞΉ) β†’ X i)⦄ ⦃y : (i : ΞΉ) β†’ Y i⦄, Tendsto (fun x i => f i (x i)) (↑𝒰) (𝓝 y) β†’ βˆƒ x, (fun i => f i (x i)) = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] intro 𝒰 y hy [GOAL] case right X✝ : Type ?u.30436 Y✝ : Type ?u.30439 Z : Type ?u.30442 W : Type ?u.30445 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ ΞΉ : Type u_3 X : ΞΉ β†’ Type u_1 Y : ΞΉ β†’ Type u_2 inst✝¹ : (i : ΞΉ) β†’ TopologicalSpace (X i) inst✝ : (i : ΞΉ) β†’ TopologicalSpace (Y i) f : (i : ΞΉ) β†’ X i β†’ Y i h : βˆ€ (i : ΞΉ), Continuous (f i) ∧ βˆ€ ⦃𝒰 : Ultrafilter (X i)⦄ ⦃y : Y i⦄, Tendsto (f i) (↑𝒰) (𝓝 y) β†’ βˆƒ x, f i x = y ∧ ↑𝒰 ≀ 𝓝 x 𝒰 : Ultrafilter ((i : ΞΉ) β†’ X i) y : (i : ΞΉ) β†’ Y i hy : Tendsto (fun x i => f i (x i)) (↑𝒰) (𝓝 y) ⊒ βˆƒ x, (fun i => f i (x i)) = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] have : βˆ€ i, Tendsto (f i) (Ultrafilter.map (eval i) 𝒰) (𝓝 (y i)) := by simpa [tendsto_pi_nhds] using hy [GOAL] X✝ : Type ?u.30436 Y✝ : Type ?u.30439 Z : Type ?u.30442 W : Type ?u.30445 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ ΞΉ : Type u_3 X : ΞΉ β†’ Type u_1 Y : ΞΉ β†’ Type u_2 inst✝¹ : (i : ΞΉ) β†’ TopologicalSpace (X i) inst✝ : (i : ΞΉ) β†’ TopologicalSpace (Y i) f : (i : ΞΉ) β†’ X i β†’ Y i h : βˆ€ (i : ΞΉ), Continuous (f i) ∧ βˆ€ ⦃𝒰 : Ultrafilter (X i)⦄ ⦃y : Y i⦄, Tendsto (f i) (↑𝒰) (𝓝 y) β†’ βˆƒ x, f i x = y ∧ ↑𝒰 ≀ 𝓝 x 𝒰 : Ultrafilter ((i : ΞΉ) β†’ X i) y : (i : ΞΉ) β†’ Y i hy : Tendsto (fun x i => f i (x i)) (↑𝒰) (𝓝 y) ⊒ βˆ€ (i : ΞΉ), Tendsto (f i) (↑(Ultrafilter.map (eval i) 𝒰)) (𝓝 (y i)) [PROOFSTEP] simpa [tendsto_pi_nhds] using hy [GOAL] case right X✝ : Type ?u.30436 Y✝ : Type ?u.30439 Z : Type ?u.30442 W : Type ?u.30445 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ ΞΉ : Type u_3 X : ΞΉ β†’ Type u_1 Y : ΞΉ β†’ Type u_2 inst✝¹ : (i : ΞΉ) β†’ TopologicalSpace (X i) inst✝ : (i : ΞΉ) β†’ TopologicalSpace (Y i) f : (i : ΞΉ) β†’ X i β†’ Y i h : βˆ€ (i : ΞΉ), Continuous (f i) ∧ βˆ€ ⦃𝒰 : Ultrafilter (X i)⦄ ⦃y : Y i⦄, Tendsto (f i) (↑𝒰) (𝓝 y) β†’ βˆƒ x, f i x = y ∧ ↑𝒰 ≀ 𝓝 x 𝒰 : Ultrafilter ((i : ΞΉ) β†’ X i) y : (i : ΞΉ) β†’ Y i hy : Tendsto (fun x i => f i (x i)) (↑𝒰) (𝓝 y) this : βˆ€ (i : ΞΉ), Tendsto (f i) (↑(Ultrafilter.map (eval i) 𝒰)) (𝓝 (y i)) ⊒ βˆƒ x, (fun i => f i (x i)) = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] choose x hxy hx using fun i ↦ (h i).2 (this i) -- By the properties of the product topology, that means that `𝒰` tends to `x`, -- which completes the proof since `(Ξ  i, f i) x = y`. [GOAL] case right X✝ : Type ?u.30436 Y✝ : Type ?u.30439 Z : Type ?u.30442 W : Type ?u.30445 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ ΞΉ : Type u_3 X : ΞΉ β†’ Type u_1 Y : ΞΉ β†’ Type u_2 inst✝¹ : (i : ΞΉ) β†’ TopologicalSpace (X i) inst✝ : (i : ΞΉ) β†’ TopologicalSpace (Y i) f : (i : ΞΉ) β†’ X i β†’ Y i h : βˆ€ (i : ΞΉ), Continuous (f i) ∧ βˆ€ ⦃𝒰 : Ultrafilter (X i)⦄ ⦃y : Y i⦄, Tendsto (f i) (↑𝒰) (𝓝 y) β†’ βˆƒ x, f i x = y ∧ ↑𝒰 ≀ 𝓝 x 𝒰 : Ultrafilter ((i : ΞΉ) β†’ X i) y : (i : ΞΉ) β†’ Y i hy : Tendsto (fun x i => f i (x i)) (↑𝒰) (𝓝 y) this : βˆ€ (i : ΞΉ), Tendsto (f i) (↑(Ultrafilter.map (eval i) 𝒰)) (𝓝 (y i)) x : (i : ΞΉ) β†’ X i hxy : βˆ€ (i : ΞΉ), f i (x i) = y i hx : βˆ€ (i : ΞΉ), ↑(Ultrafilter.map (eval i) 𝒰) ≀ 𝓝 (x i) ⊒ βˆƒ x, (fun i => f i (x i)) = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] refine ⟨x, funext hxy, ?_⟩ [GOAL] case right X✝ : Type ?u.30436 Y✝ : Type ?u.30439 Z : Type ?u.30442 W : Type ?u.30445 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ ΞΉ : Type u_3 X : ΞΉ β†’ Type u_1 Y : ΞΉ β†’ Type u_2 inst✝¹ : (i : ΞΉ) β†’ TopologicalSpace (X i) inst✝ : (i : ΞΉ) β†’ TopologicalSpace (Y i) f : (i : ΞΉ) β†’ X i β†’ Y i h : βˆ€ (i : ΞΉ), Continuous (f i) ∧ βˆ€ ⦃𝒰 : Ultrafilter (X i)⦄ ⦃y : Y i⦄, Tendsto (f i) (↑𝒰) (𝓝 y) β†’ βˆƒ x, f i x = y ∧ ↑𝒰 ≀ 𝓝 x 𝒰 : Ultrafilter ((i : ΞΉ) β†’ X i) y : (i : ΞΉ) β†’ Y i hy : Tendsto (fun x i => f i (x i)) (↑𝒰) (𝓝 y) this : βˆ€ (i : ΞΉ), Tendsto (f i) (↑(Ultrafilter.map (eval i) 𝒰)) (𝓝 (y i)) x : (i : ΞΉ) β†’ X i hxy : βˆ€ (i : ΞΉ), f i (x i) = y i hx : βˆ€ (i : ΞΉ), ↑(Ultrafilter.map (eval i) 𝒰) ≀ 𝓝 (x i) ⊒ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] rwa [nhds_pi, le_pi] [GOAL] X : Type u_1 Y : Type u_2 Z : Type ?u.36187 W : Type ?u.36190 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y h : IsProperMap f K : Set Y hK : IsCompact K ⊒ IsCompact (f ⁻¹' K) [PROOFSTEP] rw [isCompact_iff_ultrafilter_le_nhds] -- Let `𝒰 ≀ π“Ÿ (f ⁻¹' K)` an ultrafilter. [GOAL] X : Type u_1 Y : Type u_2 Z : Type ?u.36187 W : Type ?u.36190 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y h : IsProperMap f K : Set Y hK : IsCompact K ⊒ βˆ€ (f_1 : Ultrafilter X), ↑f_1 ≀ π“Ÿ (f ⁻¹' K) β†’ βˆƒ a, a ∈ f ⁻¹' K ∧ ↑f_1 ≀ 𝓝 a [PROOFSTEP] intro 𝒰 h𝒰 [GOAL] X : Type u_1 Y : Type u_2 Z : Type ?u.36187 W : Type ?u.36190 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y h : IsProperMap f K : Set Y hK : IsCompact K 𝒰 : Ultrafilter X h𝒰 : ↑𝒰 ≀ π“Ÿ (f ⁻¹' K) ⊒ βˆƒ a, a ∈ f ⁻¹' K ∧ ↑𝒰 ≀ 𝓝 a [PROOFSTEP] rw [← comap_principal, ← map_le_iff_le_comap, ← Ultrafilter.coe_map] at h𝒰 [GOAL] X : Type u_1 Y : Type u_2 Z : Type ?u.36187 W : Type ?u.36190 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y h : IsProperMap f K : Set Y hK : IsCompact K 𝒰 : Ultrafilter X h𝒰 : ↑(Ultrafilter.map f 𝒰) ≀ π“Ÿ K ⊒ βˆƒ a, a ∈ f ⁻¹' K ∧ ↑𝒰 ≀ 𝓝 a [PROOFSTEP] rcases hK.ultrafilter_le_nhds _ h𝒰 with ⟨y, hyK, hy⟩ -- Then, by properness of `f`, that means that `𝒰` tends to some `x ∈ f ⁻¹' {y} βŠ† f ⁻¹' K`, -- which completes the proof. [GOAL] case intro.intro X : Type u_1 Y : Type u_2 Z : Type ?u.36187 W : Type ?u.36190 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y h : IsProperMap f K : Set Y hK : IsCompact K 𝒰 : Ultrafilter X h𝒰 : ↑(Ultrafilter.map f 𝒰) ≀ π“Ÿ K y : Y hyK : y ∈ K hy : ↑(Ultrafilter.map f 𝒰) ≀ 𝓝 y ⊒ βˆƒ a, a ∈ f ⁻¹' K ∧ ↑𝒰 ≀ 𝓝 a [PROOFSTEP] rcases h.ultrafilter_le_nhds_of_tendsto hy with ⟨x, rfl, hx⟩ [GOAL] case intro.intro.intro.intro X : Type u_1 Y : Type u_2 Z : Type ?u.36187 W : Type ?u.36190 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y h : IsProperMap f K : Set Y hK : IsCompact K 𝒰 : Ultrafilter X h𝒰 : ↑(Ultrafilter.map f 𝒰) ≀ π“Ÿ K x : X hx : ↑𝒰 ≀ 𝓝 x hyK : f x ∈ K hy : ↑(Ultrafilter.map f 𝒰) ≀ 𝓝 (f x) ⊒ βˆƒ a, a ∈ f ⁻¹' K ∧ ↑𝒰 ≀ 𝓝 a [PROOFSTEP] exact ⟨x, hyK, hx⟩ [GOAL] X : Type u_1 Y : Type u_2 Z : Type ?u.36806 W : Type ?u.36809 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y ⊒ IsProperMap f ↔ Continuous f ∧ IsClosedMap f ∧ βˆ€ (y : Y), IsCompact (f ⁻¹' {y}) [PROOFSTEP] constructor [GOAL] case mp X : Type u_1 Y : Type u_2 Z : Type ?u.36806 W : Type ?u.36809 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y ⊒ IsProperMap f β†’ Continuous f ∧ IsClosedMap f ∧ βˆ€ (y : Y), IsCompact (f ⁻¹' {y}) [PROOFSTEP] intro H [GOAL] case mpr X : Type u_1 Y : Type u_2 Z : Type ?u.36806 W : Type ?u.36809 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y ⊒ (Continuous f ∧ IsClosedMap f ∧ βˆ€ (y : Y), IsCompact (f ⁻¹' {y})) β†’ IsProperMap f [PROOFSTEP] intro H [GOAL] case mp X : Type u_1 Y : Type u_2 Z : Type ?u.36806 W : Type ?u.36809 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y H : IsProperMap f ⊒ Continuous f ∧ IsClosedMap f ∧ βˆ€ (y : Y), IsCompact (f ⁻¹' {y}) [PROOFSTEP] exact ⟨H.continuous, H.isClosedMap, fun y ↦ H.isCompact_preimage isCompact_singleton⟩ [GOAL] case mpr X : Type u_1 Y : Type u_2 Z : Type ?u.36806 W : Type ?u.36809 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y H : Continuous f ∧ IsClosedMap f ∧ βˆ€ (y : Y), IsCompact (f ⁻¹' {y}) ⊒ IsProperMap f [PROOFSTEP] rw [isProperMap_iff_clusterPt] -- Let `β„± : Filter X` and `y` some cluster point of `map f β„±`. [GOAL] case mpr X : Type u_1 Y : Type u_2 Z : Type ?u.36806 W : Type ?u.36809 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y H : Continuous f ∧ IsClosedMap f ∧ βˆ€ (y : Y), IsCompact (f ⁻¹' {y}) ⊒ Continuous f ∧ βˆ€ ⦃ℱ : Filter X⦄ ⦃y : Y⦄, MapClusterPt y β„± f β†’ βˆƒ x, f x = y ∧ ClusterPt x β„± [PROOFSTEP] refine ⟨H.1, fun β„± y hy ↦ ?_⟩ -- That means that the singleton `pure y` meets the "closure" of `map f β„±`, by which we mean -- `Filter.lift' (map f β„±) closure`. But `f` is closed, so -- `closure (map f β„±) = map f (closure β„±)` (see `IsClosedMap.lift'_closure_map_eq`). -- Thus `map f (closure β„± βŠ“ π“Ÿ (f ⁻¹' {y})) = map f (closure β„±) βŠ“ π“Ÿ {y} β‰  βŠ₯`, hence -- `closure β„± βŠ“ π“Ÿ (f ⁻¹' {y}) β‰  βŠ₯`. [GOAL] case mpr X : Type u_1 Y : Type u_2 Z : Type ?u.36806 W : Type ?u.36809 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y H : Continuous f ∧ IsClosedMap f ∧ βˆ€ (y : Y), IsCompact (f ⁻¹' {y}) β„± : Filter X y : Y hy : MapClusterPt y β„± f ⊒ βˆƒ x, f x = y ∧ ClusterPt x β„± [PROOFSTEP] rw [H.2.1.mapClusterPt_iff_lift'_closure H.1] at hy [GOAL] case mpr X : Type u_1 Y : Type u_2 Z : Type ?u.36806 W : Type ?u.36809 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y H : Continuous f ∧ IsClosedMap f ∧ βˆ€ (y : Y), IsCompact (f ⁻¹' {y}) β„± : Filter X y : Y hy : NeBot (Filter.lift' β„± closure βŠ“ π“Ÿ (f ⁻¹' {y})) ⊒ βˆƒ x, f x = y ∧ ClusterPt x β„± [PROOFSTEP] rcases H.2.2 y (f := Filter.lift' β„± closure βŠ“ π“Ÿ (f ⁻¹' { y })) inf_le_right with ⟨x, hxy, hx⟩ [GOAL] case mpr.intro.intro X : Type u_1 Y : Type u_2 Z : Type ?u.36806 W : Type ?u.36809 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y H : Continuous f ∧ IsClosedMap f ∧ βˆ€ (y : Y), IsCompact (f ⁻¹' {y}) β„± : Filter X y : Y hy : NeBot (Filter.lift' β„± closure βŠ“ π“Ÿ (f ⁻¹' {y})) x : X hxy : x ∈ f ⁻¹' {y} hx : ClusterPt x (Filter.lift' β„± closure βŠ“ π“Ÿ (f ⁻¹' {y})) ⊒ βˆƒ x, f x = y ∧ ClusterPt x β„± [PROOFSTEP] refine ⟨x, hxy, ?_⟩ -- In particular `x` is a cluster point of `closure β„±`. Since cluster points of `closure β„±` -- are exactly cluster points of `β„±` (see `clusterPt_lift'_closure_iff`), this completes -- the proof. [GOAL] case mpr.intro.intro X : Type u_1 Y : Type u_2 Z : Type ?u.36806 W : Type ?u.36809 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y H : Continuous f ∧ IsClosedMap f ∧ βˆ€ (y : Y), IsCompact (f ⁻¹' {y}) β„± : Filter X y : Y hy : NeBot (Filter.lift' β„± closure βŠ“ π“Ÿ (f ⁻¹' {y})) x : X hxy : x ∈ f ⁻¹' {y} hx : ClusterPt x (Filter.lift' β„± closure βŠ“ π“Ÿ (f ⁻¹' {y})) ⊒ ClusterPt x β„± [PROOFSTEP] rw [← clusterPt_lift'_closure_iff] [GOAL] case mpr.intro.intro X : Type u_1 Y : Type u_2 Z : Type ?u.36806 W : Type ?u.36809 inst✝³ : TopologicalSpace X inst✝² : TopologicalSpace Y inst✝¹ : TopologicalSpace Z inst✝ : TopologicalSpace W f : X β†’ Y H : Continuous f ∧ IsClosedMap f ∧ βˆ€ (y : Y), IsCompact (f ⁻¹' {y}) β„± : Filter X y : Y hy : NeBot (Filter.lift' β„± closure βŠ“ π“Ÿ (f ⁻¹' {y})) x : X hxy : x ∈ f ⁻¹' {y} hx : ClusterPt x (Filter.lift' β„± closure βŠ“ π“Ÿ (f ⁻¹' {y})) ⊒ ClusterPt x (Filter.lift' β„± closure) [PROOFSTEP] exact hx.mono inf_le_left [GOAL] X : Type u_2 Y : Type u_1 Z : Type ?u.37764 W : Type ?u.37767 inst✝⁴ : TopologicalSpace X inst✝³ : TopologicalSpace Y inst✝² : TopologicalSpace Z inst✝¹ : TopologicalSpace W f : X β†’ Y inst✝ : T1Space Y ⊒ IsProperMap f ↔ Continuous f ∧ IsClosedMap f ∧ Tendsto f (cocompact X) cofinite [PROOFSTEP] simp_rw [isProperMap_iff_isClosedMap_and_compact_fibers, Tendsto, le_cofinite_iff_compl_singleton_mem, mem_map, preimage_compl] [GOAL] X : Type u_2 Y : Type u_1 Z : Type ?u.37764 W : Type ?u.37767 inst✝⁴ : TopologicalSpace X inst✝³ : TopologicalSpace Y inst✝² : TopologicalSpace Z inst✝¹ : TopologicalSpace W f : X β†’ Y inst✝ : T1Space Y ⊒ (Continuous f ∧ IsClosedMap f ∧ βˆ€ (y : Y), IsCompact (f ⁻¹' {y})) ↔ Continuous f ∧ IsClosedMap f ∧ βˆ€ (x : Y), (f ⁻¹' {x})ᢜ ∈ cocompact X [PROOFSTEP] refine and_congr_right fun f_cont ↦ and_congr_right fun _ ↦ ⟨fun H y ↦ (H y).compl_mem_cocompact, fun H y ↦ ?_⟩ [GOAL] X : Type u_2 Y : Type u_1 Z : Type ?u.37764 W : Type ?u.37767 inst✝⁴ : TopologicalSpace X inst✝³ : TopologicalSpace Y inst✝² : TopologicalSpace Z inst✝¹ : TopologicalSpace W f : X β†’ Y inst✝ : T1Space Y f_cont : Continuous f x✝ : IsClosedMap f H : βˆ€ (x : Y), (f ⁻¹' {x})ᢜ ∈ cocompact X y : Y ⊒ IsCompact (f ⁻¹' {y}) [PROOFSTEP] rcases mem_cocompact.mp (H y) with ⟨K, hK, hKy⟩ [GOAL] case intro.intro X : Type u_2 Y : Type u_1 Z : Type ?u.37764 W : Type ?u.37767 inst✝⁴ : TopologicalSpace X inst✝³ : TopologicalSpace Y inst✝² : TopologicalSpace Z inst✝¹ : TopologicalSpace W f : X β†’ Y inst✝ : T1Space Y f_cont : Continuous f x✝ : IsClosedMap f H : βˆ€ (x : Y), (f ⁻¹' {x})ᢜ ∈ cocompact X y : Y K : Set X hK : IsCompact K hKy : Kᢜ βŠ† (f ⁻¹' {y})ᢜ ⊒ IsCompact (f ⁻¹' {y}) [PROOFSTEP] exact isCompact_of_isClosed_subset hK (isClosed_singleton.preimage f_cont) (compl_le_compl_iff_le.mp hKy) [GOAL] X : Type u_2 Y : Type u_1 Z : Type ?u.39226 W : Type ?u.39229 inst✝⁡ : TopologicalSpace X inst✝⁴ : TopologicalSpace Y inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f : X β†’ Y inst✝¹ : T2Space Y inst✝ : LocallyCompactSpace Y ⊒ IsProperMap f ↔ Continuous f ∧ βˆ€ ⦃K : Set Y⦄, IsCompact K β†’ IsCompact (f ⁻¹' K) [PROOFSTEP] constructor [GOAL] case mp X : Type u_2 Y : Type u_1 Z : Type ?u.39226 W : Type ?u.39229 inst✝⁡ : TopologicalSpace X inst✝⁴ : TopologicalSpace Y inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f : X β†’ Y inst✝¹ : T2Space Y inst✝ : LocallyCompactSpace Y ⊒ IsProperMap f β†’ Continuous f ∧ βˆ€ ⦃K : Set Y⦄, IsCompact K β†’ IsCompact (f ⁻¹' K) [PROOFSTEP] intro H [GOAL] case mpr X : Type u_2 Y : Type u_1 Z : Type ?u.39226 W : Type ?u.39229 inst✝⁡ : TopologicalSpace X inst✝⁴ : TopologicalSpace Y inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f : X β†’ Y inst✝¹ : T2Space Y inst✝ : LocallyCompactSpace Y ⊒ (Continuous f ∧ βˆ€ ⦃K : Set Y⦄, IsCompact K β†’ IsCompact (f ⁻¹' K)) β†’ IsProperMap f [PROOFSTEP] intro H [GOAL] case mp X : Type u_2 Y : Type u_1 Z : Type ?u.39226 W : Type ?u.39229 inst✝⁡ : TopologicalSpace X inst✝⁴ : TopologicalSpace Y inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f : X β†’ Y inst✝¹ : T2Space Y inst✝ : LocallyCompactSpace Y H : IsProperMap f ⊒ Continuous f ∧ βˆ€ ⦃K : Set Y⦄, IsCompact K β†’ IsCompact (f ⁻¹' K) [PROOFSTEP] exact ⟨H.continuous, fun K hK ↦ H.isCompact_preimage hK⟩ [GOAL] case mpr X : Type u_2 Y : Type u_1 Z : Type ?u.39226 W : Type ?u.39229 inst✝⁡ : TopologicalSpace X inst✝⁴ : TopologicalSpace Y inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f : X β†’ Y inst✝¹ : T2Space Y inst✝ : LocallyCompactSpace Y H : Continuous f ∧ βˆ€ ⦃K : Set Y⦄, IsCompact K β†’ IsCompact (f ⁻¹' K) ⊒ IsProperMap f [PROOFSTEP] rw [isProperMap_iff_ultrafilter] -- Let `𝒰 : Ultrafilter X`, and assume that `f` tends to some `y` along `𝒰`. [GOAL] case mpr X : Type u_2 Y : Type u_1 Z : Type ?u.39226 W : Type ?u.39229 inst✝⁡ : TopologicalSpace X inst✝⁴ : TopologicalSpace Y inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f : X β†’ Y inst✝¹ : T2Space Y inst✝ : LocallyCompactSpace Y H : Continuous f ∧ βˆ€ ⦃K : Set Y⦄, IsCompact K β†’ IsCompact (f ⁻¹' K) ⊒ Continuous f ∧ βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] refine ⟨H.1, fun 𝒰 y hy ↦ ?_⟩ -- Pick `K` some compact neighborhood of `y`, which exists by local compactness. [GOAL] case mpr X : Type u_2 Y : Type u_1 Z : Type ?u.39226 W : Type ?u.39229 inst✝⁡ : TopologicalSpace X inst✝⁴ : TopologicalSpace Y inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f : X β†’ Y inst✝¹ : T2Space Y inst✝ : LocallyCompactSpace Y H : Continuous f ∧ βˆ€ ⦃K : Set Y⦄, IsCompact K β†’ IsCompact (f ⁻¹' K) 𝒰 : Ultrafilter X y : Y hy : Tendsto f (↑𝒰) (𝓝 y) ⊒ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] rcases exists_compact_mem_nhds y with ⟨K, hK, hKy⟩ -- Then `map f 𝒰 ≀ 𝓝 y ≀ π“Ÿ K`, hence `𝒰 ≀ π“Ÿ (f ⁻¹' K)` [GOAL] case mpr.intro.intro X : Type u_2 Y : Type u_1 Z : Type ?u.39226 W : Type ?u.39229 inst✝⁡ : TopologicalSpace X inst✝⁴ : TopologicalSpace Y inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f : X β†’ Y inst✝¹ : T2Space Y inst✝ : LocallyCompactSpace Y H : Continuous f ∧ βˆ€ ⦃K : Set Y⦄, IsCompact K β†’ IsCompact (f ⁻¹' K) 𝒰 : Ultrafilter X y : Y hy : Tendsto f (↑𝒰) (𝓝 y) K : Set Y hK : IsCompact K hKy : K ∈ 𝓝 y ⊒ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] have : 𝒰 ≀ π“Ÿ (f ⁻¹' K) := by simpa only [← comap_principal, ← tendsto_iff_comap] using hy.mono_right (le_principal_iff.mpr hKy) -- By compactness of `f ⁻¹' K`, `𝒰` converges to some `x ∈ f ⁻¹' K`. [GOAL] X : Type u_2 Y : Type u_1 Z : Type ?u.39226 W : Type ?u.39229 inst✝⁡ : TopologicalSpace X inst✝⁴ : TopologicalSpace Y inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f : X β†’ Y inst✝¹ : T2Space Y inst✝ : LocallyCompactSpace Y H : Continuous f ∧ βˆ€ ⦃K : Set Y⦄, IsCompact K β†’ IsCompact (f ⁻¹' K) 𝒰 : Ultrafilter X y : Y hy : Tendsto f (↑𝒰) (𝓝 y) K : Set Y hK : IsCompact K hKy : K ∈ 𝓝 y ⊒ ↑𝒰 ≀ π“Ÿ (f ⁻¹' K) [PROOFSTEP] simpa only [← comap_principal, ← tendsto_iff_comap] using hy.mono_right (le_principal_iff.mpr hKy) -- By compactness of `f ⁻¹' K`, `𝒰` converges to some `x ∈ f ⁻¹' K`. [GOAL] case mpr.intro.intro X : Type u_2 Y : Type u_1 Z : Type ?u.39226 W : Type ?u.39229 inst✝⁡ : TopologicalSpace X inst✝⁴ : TopologicalSpace Y inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f : X β†’ Y inst✝¹ : T2Space Y inst✝ : LocallyCompactSpace Y H : Continuous f ∧ βˆ€ ⦃K : Set Y⦄, IsCompact K β†’ IsCompact (f ⁻¹' K) 𝒰 : Ultrafilter X y : Y hy : Tendsto f (↑𝒰) (𝓝 y) K : Set Y hK : IsCompact K hKy : K ∈ 𝓝 y this : ↑𝒰 ≀ π“Ÿ (f ⁻¹' K) ⊒ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] rcases(H.2 hK).ultrafilter_le_nhds _ this with ⟨x, -, hx⟩ -- Finally, `f` tends to `f x` along `𝒰` by continuity, thus `f x = y`. [GOAL] case mpr.intro.intro.intro.intro X : Type u_2 Y : Type u_1 Z : Type ?u.39226 W : Type ?u.39229 inst✝⁡ : TopologicalSpace X inst✝⁴ : TopologicalSpace Y inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f : X β†’ Y inst✝¹ : T2Space Y inst✝ : LocallyCompactSpace Y H : Continuous f ∧ βˆ€ ⦃K : Set Y⦄, IsCompact K β†’ IsCompact (f ⁻¹' K) 𝒰 : Ultrafilter X y : Y hy : Tendsto f (↑𝒰) (𝓝 y) K : Set Y hK : IsCompact K hKy : K ∈ 𝓝 y this : ↑𝒰 ≀ π“Ÿ (f ⁻¹' K) x : X hx : ↑𝒰 ≀ 𝓝 x ⊒ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] refine ⟨x, tendsto_nhds_unique ((H.1.tendsto _).comp hx) hy, hx⟩ [GOAL] X : Type u_2 Y : Type u_1 Z : Type ?u.49990 W : Type ?u.49993 inst✝⁡ : TopologicalSpace X inst✝⁴ : TopologicalSpace Y inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f : X β†’ Y inst✝¹ : T2Space Y inst✝ : LocallyCompactSpace Y ⊒ IsProperMap f ↔ Continuous f ∧ Tendsto f (cocompact X) (cocompact Y) [PROOFSTEP] simp_rw [isProperMap_iff_isCompact_preimage, hasBasis_cocompact.tendsto_right_iff, ← mem_preimage, eventually_mem_set, preimage_compl] [GOAL] X : Type u_2 Y : Type u_1 Z : Type ?u.49990 W : Type ?u.49993 inst✝⁡ : TopologicalSpace X inst✝⁴ : TopologicalSpace Y inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f : X β†’ Y inst✝¹ : T2Space Y inst✝ : LocallyCompactSpace Y ⊒ (Continuous f ∧ βˆ€ ⦃K : Set Y⦄, IsCompact K β†’ IsCompact (f ⁻¹' K)) ↔ Continuous f ∧ βˆ€ (i : Set Y), IsCompact i β†’ (f ⁻¹' i)ᢜ ∈ cocompact X [PROOFSTEP] refine and_congr_right fun f_cont ↦ ⟨fun H K hK ↦ (H hK).compl_mem_cocompact, fun H K hK ↦ ?_⟩ [GOAL] X : Type u_2 Y : Type u_1 Z : Type ?u.49990 W : Type ?u.49993 inst✝⁡ : TopologicalSpace X inst✝⁴ : TopologicalSpace Y inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f : X β†’ Y inst✝¹ : T2Space Y inst✝ : LocallyCompactSpace Y f_cont : Continuous f H : βˆ€ (i : Set Y), IsCompact i β†’ (f ⁻¹' i)ᢜ ∈ cocompact X K : Set Y hK : IsCompact K ⊒ IsCompact (f ⁻¹' K) [PROOFSTEP] rcases mem_cocompact.mp (H K hK) with ⟨K', hK', hK'y⟩ [GOAL] case intro.intro X : Type u_2 Y : Type u_1 Z : Type ?u.49990 W : Type ?u.49993 inst✝⁡ : TopologicalSpace X inst✝⁴ : TopologicalSpace Y inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f : X β†’ Y inst✝¹ : T2Space Y inst✝ : LocallyCompactSpace Y f_cont : Continuous f H : βˆ€ (i : Set Y), IsCompact i β†’ (f ⁻¹' i)ᢜ ∈ cocompact X K : Set Y hK : IsCompact K K' : Set X hK' : IsCompact K' hK'y : K'ᢜ βŠ† (f ⁻¹' K)ᢜ ⊒ IsCompact (f ⁻¹' K) [PROOFSTEP] exact isCompact_of_isClosed_subset hK' (hK.isClosed.preimage f_cont) (compl_le_compl_iff_le.mp hK'y) [GOAL] X✝ : Type ?u.52247 Y✝ : Type ?u.52250 Z : Type ?u.52253 W : Type ?u.52256 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y ⊒ IsProperMap f ↔ Continuous f ∧ IsClosedMap (Prod.map f id) [PROOFSTEP] constructor [GOAL] case mp X✝ : Type ?u.52247 Y✝ : Type ?u.52250 Z : Type ?u.52253 W : Type ?u.52256 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y ⊒ IsProperMap f β†’ Continuous f ∧ IsClosedMap (Prod.map f id) [PROOFSTEP] intro H [GOAL] case mpr X✝ : Type ?u.52247 Y✝ : Type ?u.52250 Z : Type ?u.52253 W : Type ?u.52256 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y ⊒ Continuous f ∧ IsClosedMap (Prod.map f id) β†’ IsProperMap f [PROOFSTEP] intro H [GOAL] case mp X✝ : Type ?u.52247 Y✝ : Type ?u.52250 Z : Type ?u.52253 W : Type ?u.52256 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : IsProperMap f ⊒ Continuous f ∧ IsClosedMap (Prod.map f id) [PROOFSTEP] exact ⟨H.continuous, H.universally_closed _⟩ [GOAL] case mpr X✝ : Type ?u.52247 Y✝ : Type ?u.52250 Z : Type ?u.52253 W : Type ?u.52256 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : Continuous f ∧ IsClosedMap (Prod.map f id) ⊒ IsProperMap f [PROOFSTEP] rw [isProperMap_iff_ultrafilter] -- Let `𝒰 : Ultrafilter X`, and assume that `f` tends to some `y` along `𝒰`. [GOAL] case mpr X✝ : Type ?u.52247 Y✝ : Type ?u.52250 Z : Type ?u.52253 W : Type ?u.52256 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : Continuous f ∧ IsClosedMap (Prod.map f id) ⊒ Continuous f ∧ βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] refine ⟨H.1, fun 𝒰 y hy ↦ ?_⟩ -- In `X Γ— Filter X`, consider the closed set `F := closure {(x, β„±) | β„± = pure x}` [GOAL] case mpr X✝ : Type ?u.52247 Y✝ : Type ?u.52250 Z : Type ?u.52253 W : Type ?u.52256 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : Continuous f ∧ IsClosedMap (Prod.map f id) 𝒰 : Ultrafilter X y : Y hy : Tendsto f (↑𝒰) (𝓝 y) ⊒ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] let F : Set (X Γ— Filter X) := closure {xβ„± | xβ„±.2 = pure xβ„±.1} -- Since `f Γ— id` is closed, the set `(f Γ— id) '' F` is also closed. [GOAL] case mpr X✝ : Type ?u.52247 Y✝ : Type ?u.52250 Z : Type ?u.52253 W : Type ?u.52256 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : Continuous f ∧ IsClosedMap (Prod.map f id) 𝒰 : Ultrafilter X y : Y hy : Tendsto f (↑𝒰) (𝓝 y) F : Set (X Γ— Filter X) := closure {xβ„± | xβ„±.snd = pure xβ„±.fst} ⊒ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] have := H.2 F isClosed_closure [GOAL] case mpr X✝ : Type ?u.52247 Y✝ : Type ?u.52250 Z : Type ?u.52253 W : Type ?u.52256 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : Continuous f ∧ IsClosedMap (Prod.map f id) 𝒰 : Ultrafilter X y : Y hy : Tendsto f (↑𝒰) (𝓝 y) F : Set (X Γ— Filter X) := closure {xβ„± | xβ„±.snd = pure xβ„±.fst} this : IsClosed (Prod.map f id '' F) ⊒ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] have : (y, ↑𝒰) ∈ Prod.map f id '' F := -- Note that, by the properties of the topology on `Filter X`, the function `pure : X β†’ Filter X` -- tends to the point `𝒰` of `Filter X` along the filter `𝒰` on `X`. Since `f` tends to `y` along -- `𝒰`, we get that the function `(f, pure) : X β†’ (Y, Filter X)` tends to `(y, 𝒰)` along -- `𝒰`. Furthermore, each `(f, pure)(x) = (f Γ— id)(x, pure x)` is clearly an element of -- the closed set `(f Γ— id) '' F`, thus the limit `(y, 𝒰)` also belongs to that set.this.mem_of_tendsto (hy.prod_mk_nhds (Filter.tendsto_pure_self (𝒰 : Filter X))) (eventually_of_forall fun x ↦ ⟨⟨x, pure x⟩, subset_closure rfl, rfl⟩) -- The above shows that `(y, 𝒰) = (f x, 𝒰)`, for some `x : X` such that `(x, 𝒰) ∈ F`. [GOAL] case mpr X✝ : Type ?u.52247 Y✝ : Type ?u.52250 Z : Type ?u.52253 W : Type ?u.52256 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : Continuous f ∧ IsClosedMap (Prod.map f id) 𝒰 : Ultrafilter X y : Y hy : Tendsto f (↑𝒰) (𝓝 y) F : Set (X Γ— Filter X) := closure {xβ„± | xβ„±.snd = pure xβ„±.fst} this✝ : IsClosed (Prod.map f id '' F) this : (y, ↑𝒰) ∈ Prod.map f id '' F ⊒ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] rcases this with ⟨⟨x, _⟩, hx, ⟨_, _⟩⟩ -- We already know that `f x = y`, so to finish the proof we just have to check that `𝒰` tends -- to `x`. So, for `U ∈ 𝓝 x` arbitrary, let's show that `U ∈ 𝒰`. Since `𝒰` is a ultrafilter, -- it is enough to show that `Uᢜ` is not in `𝒰`. [GOAL] case mpr.intro.mk.intro.refl X✝ : Type ?u.52247 Y✝ : Type ?u.52250 Z : Type ?u.52253 W : Type ?u.52256 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : Continuous f ∧ IsClosedMap (Prod.map f id) 𝒰 : Ultrafilter X F : Set (X Γ— Filter X) := closure {xβ„± | xβ„±.snd = pure xβ„±.fst} this : IsClosed (Prod.map f id '' F) x : X hy : Tendsto f (↑𝒰) (𝓝 (f x)) hx : (x, 𝒰.1) ∈ F ⊒ βˆƒ x_1, f x_1 = f x ∧ ↑𝒰 ≀ 𝓝 x_1 [PROOFSTEP] refine ⟨x, rfl, fun U hU ↦ Ultrafilter.compl_not_mem_iff.mp fun hUc ↦ ?_⟩ [GOAL] case mpr.intro.mk.intro.refl X✝ : Type ?u.52247 Y✝ : Type ?u.52250 Z : Type ?u.52253 W : Type ?u.52256 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : Continuous f ∧ IsClosedMap (Prod.map f id) 𝒰 : Ultrafilter X F : Set (X Γ— Filter X) := closure {xβ„± | xβ„±.snd = pure xβ„±.fst} this : IsClosed (Prod.map f id '' F) x : X hy : Tendsto f (↑𝒰) (𝓝 (f x)) hx : (x, 𝒰.1) ∈ F U : Set X hU : U ∈ 𝓝 x hUc : Uᢜ ∈ 𝒰 ⊒ False [PROOFSTEP] rw [mem_closure_iff_nhds] at hx [GOAL] case mpr.intro.mk.intro.refl X✝ : Type ?u.52247 Y✝ : Type ?u.52250 Z : Type ?u.52253 W : Type ?u.52256 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : Continuous f ∧ IsClosedMap (Prod.map f id) 𝒰 : Ultrafilter X F : Set (X Γ— Filter X) := closure {xβ„± | xβ„±.snd = pure xβ„±.fst} this : IsClosed (Prod.map f id '' F) x : X hy : Tendsto f (↑𝒰) (𝓝 (f x)) hx : βˆ€ (t : Set (X Γ— Filter X)), t ∈ 𝓝 (x, 𝒰.1) β†’ Set.Nonempty (t ∩ {xβ„± | xβ„±.snd = pure xβ„±.fst}) U : Set X hU : U ∈ 𝓝 x hUc : Uᢜ ∈ 𝒰 ⊒ False [PROOFSTEP] rcases hx (U Γ—Λ’ {𝒒 | Uᢜ ∈ 𝒒}) (prod_mem_nhds hU (isOpen_setOf_mem.mem_nhds hUc)) with ⟨⟨z, π’’βŸ©, ⟨⟨hz : z ∈ U, hz' : Uᢜ ∈ π’’βŸ©, rfl : 𝒒 = pure z⟩⟩ [GOAL] case mpr.intro.mk.intro.refl.intro.mk.intro.intro X✝ : Type ?u.52247 Y✝ : Type ?u.52250 Z : Type ?u.52253 W : Type ?u.52256 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : Continuous f ∧ IsClosedMap (Prod.map f id) 𝒰 : Ultrafilter X F : Set (X Γ— Filter X) := closure {xβ„± | xβ„±.snd = pure xβ„±.fst} this : IsClosed (Prod.map f id '' F) x : X hy : Tendsto f (↑𝒰) (𝓝 (f x)) hx : βˆ€ (t : Set (X Γ— Filter X)), t ∈ 𝓝 (x, 𝒰.1) β†’ Set.Nonempty (t ∩ {xβ„± | xβ„±.snd = pure xβ„±.fst}) U : Set X hU : U ∈ 𝓝 x hUc : Uᢜ ∈ 𝒰 z : X hz : z ∈ U hz' : Uᢜ ∈ pure z ⊒ False [PROOFSTEP] exact hz' hz [GOAL] X✝ : Type ?u.54240 Y✝ : Type ?u.54243 Z : Type ?u.54246 W : Type ?u.54249 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y ⊒ IsProperMap f ↔ Continuous f ∧ IsClosedMap (Prod.map f id) [PROOFSTEP] constructor [GOAL] case mp X✝ : Type ?u.54240 Y✝ : Type ?u.54243 Z : Type ?u.54246 W : Type ?u.54249 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y ⊒ IsProperMap f β†’ Continuous f ∧ IsClosedMap (Prod.map f id) [PROOFSTEP] intro H [GOAL] case mpr X✝ : Type ?u.54240 Y✝ : Type ?u.54243 Z : Type ?u.54246 W : Type ?u.54249 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y ⊒ Continuous f ∧ IsClosedMap (Prod.map f id) β†’ IsProperMap f [PROOFSTEP] intro H [GOAL] case mp X✝ : Type ?u.54240 Y✝ : Type ?u.54243 Z : Type ?u.54246 W : Type ?u.54249 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : IsProperMap f ⊒ Continuous f ∧ IsClosedMap (Prod.map f id) [PROOFSTEP] exact ⟨H.continuous, H.universally_closed _⟩ [GOAL] case mpr X✝ : Type ?u.54240 Y✝ : Type ?u.54243 Z : Type ?u.54246 W : Type ?u.54249 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : Continuous f ∧ IsClosedMap (Prod.map f id) ⊒ IsProperMap f [PROOFSTEP] rw [isProperMap_iff_ultrafilter] [GOAL] case mpr X✝ : Type ?u.54240 Y✝ : Type ?u.54243 Z : Type ?u.54246 W : Type ?u.54249 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : Continuous f ∧ IsClosedMap (Prod.map f id) ⊒ Continuous f ∧ βˆ€ ⦃𝒰 : Ultrafilter X⦄ ⦃y : Y⦄, Tendsto f (↑𝒰) (𝓝 y) β†’ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] refine ⟨H.1, fun 𝒰 y hy ↦ ?_⟩ [GOAL] case mpr X✝ : Type ?u.54240 Y✝ : Type ?u.54243 Z : Type ?u.54246 W : Type ?u.54249 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : Continuous f ∧ IsClosedMap (Prod.map f id) 𝒰 : Ultrafilter X y : Y hy : Tendsto f (↑𝒰) (𝓝 y) ⊒ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] let F : Set (X Γ— Ultrafilter X) := closure {xβ„± | xβ„±.2 = pure xβ„±.1} [GOAL] case mpr X✝ : Type ?u.54240 Y✝ : Type ?u.54243 Z : Type ?u.54246 W : Type ?u.54249 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : Continuous f ∧ IsClosedMap (Prod.map f id) 𝒰 : Ultrafilter X y : Y hy : Tendsto f (↑𝒰) (𝓝 y) F : Set (X Γ— Ultrafilter X) := closure {xβ„± | xβ„±.snd = pure xβ„±.fst} ⊒ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] have := H.2 F isClosed_closure [GOAL] case mpr X✝ : Type ?u.54240 Y✝ : Type ?u.54243 Z : Type ?u.54246 W : Type ?u.54249 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : Continuous f ∧ IsClosedMap (Prod.map f id) 𝒰 : Ultrafilter X y : Y hy : Tendsto f (↑𝒰) (𝓝 y) F : Set (X Γ— Ultrafilter X) := closure {xβ„± | xβ„±.snd = pure xβ„±.fst} this : IsClosed (Prod.map f id '' F) ⊒ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] have : (y, 𝒰) ∈ Prod.map f id '' F := this.mem_of_tendsto (hy.prod_mk_nhds (Ultrafilter.tendsto_pure_self 𝒰)) (eventually_of_forall fun x ↦ ⟨⟨x, pure x⟩, subset_closure rfl, rfl⟩) [GOAL] case mpr X✝ : Type ?u.54240 Y✝ : Type ?u.54243 Z : Type ?u.54246 W : Type ?u.54249 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : Continuous f ∧ IsClosedMap (Prod.map f id) 𝒰 : Ultrafilter X y : Y hy : Tendsto f (↑𝒰) (𝓝 y) F : Set (X Γ— Ultrafilter X) := closure {xβ„± | xβ„±.snd = pure xβ„±.fst} this✝ : IsClosed (Prod.map f id '' F) this : (y, 𝒰) ∈ Prod.map f id '' F ⊒ βˆƒ x, f x = y ∧ ↑𝒰 ≀ 𝓝 x [PROOFSTEP] rcases this with ⟨⟨x, _⟩, hx, ⟨_, _⟩⟩ [GOAL] case mpr.intro.mk.intro.refl X✝ : Type ?u.54240 Y✝ : Type ?u.54243 Z : Type ?u.54246 W : Type ?u.54249 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : Continuous f ∧ IsClosedMap (Prod.map f id) F : Set (X Γ— Ultrafilter X) := closure {xβ„± | xβ„±.snd = pure xβ„±.fst} this : IsClosed (Prod.map f id '' F) x : X snd✝ : Ultrafilter X hx : (x, snd✝) ∈ F hy : Tendsto f (↑(id snd✝)) (𝓝 (f x)) ⊒ βˆƒ x_1, f x_1 = f x ∧ ↑(id snd✝) ≀ 𝓝 x_1 [PROOFSTEP] refine ⟨x, rfl, fun U hU ↦ Ultrafilter.compl_not_mem_iff.mp fun hUc ↦ ?_⟩ [GOAL] case mpr.intro.mk.intro.refl X✝ : Type ?u.54240 Y✝ : Type ?u.54243 Z : Type ?u.54246 W : Type ?u.54249 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : Continuous f ∧ IsClosedMap (Prod.map f id) F : Set (X Γ— Ultrafilter X) := closure {xβ„± | xβ„±.snd = pure xβ„±.fst} this : IsClosed (Prod.map f id '' F) x : X snd✝ : Ultrafilter X hx : (x, snd✝) ∈ F hy : Tendsto f (↑(id snd✝)) (𝓝 (f x)) U : Set X hU : U ∈ 𝓝 x hUc : Uᢜ ∈ id snd✝ ⊒ False [PROOFSTEP] rw [mem_closure_iff_nhds] at hx [GOAL] case mpr.intro.mk.intro.refl X✝ : Type ?u.54240 Y✝ : Type ?u.54243 Z : Type ?u.54246 W : Type ?u.54249 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : Continuous f ∧ IsClosedMap (Prod.map f id) F : Set (X Γ— Ultrafilter X) := closure {xβ„± | xβ„±.snd = pure xβ„±.fst} this : IsClosed (Prod.map f id '' F) x : X snd✝ : Ultrafilter X hx : βˆ€ (t : Set (X Γ— Ultrafilter X)), t ∈ 𝓝 (x, snd✝) β†’ Set.Nonempty (t ∩ {xβ„± | xβ„±.snd = pure xβ„±.fst}) hy : Tendsto f (↑(id snd✝)) (𝓝 (f x)) U : Set X hU : U ∈ 𝓝 x hUc : Uᢜ ∈ id snd✝ ⊒ False [PROOFSTEP] rcases hx (U Γ—Λ’ {𝒒 | Uᢜ ∈ 𝒒}) (prod_mem_nhds hU ((ultrafilter_isOpen_basic _).mem_nhds hUc)) with ⟨⟨y, π’’βŸ©, ⟨⟨hy : y ∈ U, hy' : Uᢜ ∈ π’’βŸ©, rfl : 𝒒 = pure y⟩⟩ [GOAL] case mpr.intro.mk.intro.refl.intro.mk.intro.intro X✝ : Type ?u.54240 Y✝ : Type ?u.54243 Z : Type ?u.54246 W : Type ?u.54249 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : Continuous f ∧ IsClosedMap (Prod.map f id) F : Set (X Γ— Ultrafilter X) := closure {xβ„± | xβ„±.snd = pure xβ„±.fst} this : IsClosed (Prod.map f id '' F) x : X snd✝ : Ultrafilter X hx : βˆ€ (t : Set (X Γ— Ultrafilter X)), t ∈ 𝓝 (x, snd✝) β†’ Set.Nonempty (t ∩ {xβ„± | xβ„±.snd = pure xβ„±.fst}) hy✝ : Tendsto f (↑(id snd✝)) (𝓝 (f x)) U : Set X hU : U ∈ 𝓝 x hUc : Uᢜ ∈ id snd✝ y : X hy : y ∈ U hy' : Uᢜ ∈ pure y ⊒ False [PROOFSTEP] exact hy' hy [GOAL] X✝ : Type ?u.56079 Y✝ : Type ?u.56082 Z : Type ?u.56085 W : Type ?u.56088 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y ⊒ IsProperMap f ↔ Continuous f ∧ βˆ€ (Z : Type u) [inst : TopologicalSpace Z], IsClosedMap (Prod.map f id) [PROOFSTEP] constructor [GOAL] case mp X✝ : Type ?u.56079 Y✝ : Type ?u.56082 Z : Type ?u.56085 W : Type ?u.56088 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y ⊒ IsProperMap f β†’ Continuous f ∧ βˆ€ (Z : Type u) [inst : TopologicalSpace Z], IsClosedMap (Prod.map f id) [PROOFSTEP] intro H [GOAL] case mpr X✝ : Type ?u.56079 Y✝ : Type ?u.56082 Z : Type ?u.56085 W : Type ?u.56088 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y ⊒ (Continuous f ∧ βˆ€ (Z : Type u) [inst : TopologicalSpace Z], IsClosedMap (Prod.map f id)) β†’ IsProperMap f [PROOFSTEP] intro H [GOAL] case mp X✝ : Type ?u.56079 Y✝ : Type ?u.56082 Z : Type ?u.56085 W : Type ?u.56088 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : IsProperMap f ⊒ Continuous f ∧ βˆ€ (Z : Type u) [inst : TopologicalSpace Z], IsClosedMap (Prod.map f id) [PROOFSTEP] exact ⟨H.continuous, fun Z ↦ H.universally_closed _⟩ [GOAL] case mpr X✝ : Type ?u.56079 Y✝ : Type ?u.56082 Z : Type ?u.56085 W : Type ?u.56088 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : Continuous f ∧ βˆ€ (Z : Type u) [inst : TopologicalSpace Z], IsClosedMap (Prod.map f id) ⊒ IsProperMap f [PROOFSTEP] rw [isProperMap_iff_isClosedMap_ultrafilter] [GOAL] case mpr X✝ : Type ?u.56079 Y✝ : Type ?u.56082 Z : Type ?u.56085 W : Type ?u.56088 inst✝⁡ : TopologicalSpace X✝ inst✝⁴ : TopologicalSpace Y✝ inst✝³ : TopologicalSpace Z inst✝² : TopologicalSpace W f✝ : X✝ β†’ Y✝ X : Type u Y : Type v inst✝¹ : TopologicalSpace X inst✝ : TopologicalSpace Y f : X β†’ Y H : Continuous f ∧ βˆ€ (Z : Type u) [inst : TopologicalSpace Z], IsClosedMap (Prod.map f id) ⊒ Continuous f ∧ IsClosedMap (Prod.map f id) [PROOFSTEP] exact ⟨H.1, H.2 _⟩
[GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i X : C ⊒ NatTrans.app (ofRightAdjoint i).unit (i.obj ((leftAdjoint i).obj X)) = i.map ((leftAdjoint i).map (NatTrans.app (ofRightAdjoint i).unit X)) [PROOFSTEP] rw [← cancel_mono (i.map ((ofRightAdjoint i).counit.app ((leftAdjoint i).obj X))), ← i.map_comp] [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i X : C ⊒ NatTrans.app (ofRightAdjoint i).unit (i.obj ((leftAdjoint i).obj X)) ≫ i.map (NatTrans.app (ofRightAdjoint i).counit ((leftAdjoint i).obj X)) = i.map ((leftAdjoint i).map (NatTrans.app (ofRightAdjoint i).unit X) ≫ NatTrans.app (ofRightAdjoint i).counit ((leftAdjoint i).obj X)) [PROOFSTEP] simp [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i B : D ⊒ IsIso (NatTrans.app (ofRightAdjoint i).unit (i.obj B)) [PROOFSTEP] have : (ofRightAdjoint i).unit.app (i.obj B) = inv (i.map ((ofRightAdjoint i).counit.app B)) := by rw [← comp_hom_eq_id] apply (ofRightAdjoint i).right_triangle_components [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i B : D ⊒ NatTrans.app (ofRightAdjoint i).unit (i.obj B) = inv (i.map (NatTrans.app (ofRightAdjoint i).counit B)) [PROOFSTEP] rw [← comp_hom_eq_id] [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i B : D ⊒ NatTrans.app (ofRightAdjoint i).unit (i.obj B) ≫ i.map (NatTrans.app (ofRightAdjoint i).counit B) = πŸ™ ((𝟭 C).obj (i.obj B)) [PROOFSTEP] apply (ofRightAdjoint i).right_triangle_components [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i B : D this : NatTrans.app (ofRightAdjoint i).unit (i.obj B) = inv (i.map (NatTrans.app (ofRightAdjoint i).counit B)) ⊒ IsIso (NatTrans.app (ofRightAdjoint i).unit (i.obj B)) [PROOFSTEP] rw [this] [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i B : D this : NatTrans.app (ofRightAdjoint i).unit (i.obj B) = inv (i.map (NatTrans.app (ofRightAdjoint i).counit B)) ⊒ IsIso (inv (i.map (NatTrans.app (ofRightAdjoint i).counit B))) [PROOFSTEP] exact IsIso.inv_isIso [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i A : C h : A ∈ essImage i ⊒ IsIso (NatTrans.app (ofRightAdjoint i).unit A) [PROOFSTEP] suffices (ofRightAdjoint i).unit.app A = h.getIso.inv ≫ (ofRightAdjoint i).unit.app (i.obj (Functor.essImage.witness h)) ≫ (leftAdjoint i β‹™ i).map h.getIso.hom by rw [this] infer_instance [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i A : C h : A ∈ essImage i this : NatTrans.app (ofRightAdjoint i).unit A = (getIso h).inv ≫ NatTrans.app (ofRightAdjoint i).unit (i.obj (witness h)) ≫ (leftAdjoint i β‹™ i).map (getIso h).hom ⊒ IsIso (NatTrans.app (ofRightAdjoint i).unit A) [PROOFSTEP] rw [this] [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i A : C h : A ∈ essImage i this : NatTrans.app (ofRightAdjoint i).unit A = (getIso h).inv ≫ NatTrans.app (ofRightAdjoint i).unit (i.obj (witness h)) ≫ (leftAdjoint i β‹™ i).map (getIso h).hom ⊒ IsIso ((getIso h).inv ≫ NatTrans.app (ofRightAdjoint i).unit (i.obj (witness h)) ≫ (leftAdjoint i β‹™ i).map (getIso h).hom) [PROOFSTEP] infer_instance [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i A : C h : A ∈ essImage i ⊒ NatTrans.app (ofRightAdjoint i).unit A = (getIso h).inv ≫ NatTrans.app (ofRightAdjoint i).unit (i.obj (witness h)) ≫ (leftAdjoint i β‹™ i).map (getIso h).hom [PROOFSTEP] rw [← NatTrans.naturality] [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i A : C h : A ∈ essImage i ⊒ NatTrans.app (ofRightAdjoint i).unit A = (getIso h).inv ≫ (𝟭 C).map (getIso h).hom ≫ NatTrans.app (ofRightAdjoint i).unit A [PROOFSTEP] simp [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : Category.{vβ‚‚, uβ‚‚} D inst✝² : Category.{v₃, u₃} E i : D β₯€ C inst✝¹ : Reflective i A : C inst✝ : IsSplitMono (NatTrans.app (ofRightAdjoint i).unit A) ⊒ A ∈ Functor.essImage i [PROOFSTEP] let Ξ· : 𝟭 C ⟢ leftAdjoint i β‹™ i := (ofRightAdjoint i).unit [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : Category.{vβ‚‚, uβ‚‚} D inst✝² : Category.{v₃, u₃} E i : D β₯€ C inst✝¹ : Reflective i A : C inst✝ : IsSplitMono (NatTrans.app (ofRightAdjoint i).unit A) Ξ· : 𝟭 C ⟢ leftAdjoint i β‹™ i := (ofRightAdjoint i).unit ⊒ A ∈ Functor.essImage i [PROOFSTEP] haveI : IsIso (Ξ·.app (i.obj ((leftAdjoint i).obj A))) := Functor.essImage.unit_isIso ((i.obj_mem_essImage _)) [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : Category.{vβ‚‚, uβ‚‚} D inst✝² : Category.{v₃, u₃} E i : D β₯€ C inst✝¹ : Reflective i A : C inst✝ : IsSplitMono (NatTrans.app (ofRightAdjoint i).unit A) Ξ· : 𝟭 C ⟢ leftAdjoint i β‹™ i := (ofRightAdjoint i).unit this : IsIso (NatTrans.app Ξ· (i.obj ((leftAdjoint i).obj A))) ⊒ A ∈ Functor.essImage i [PROOFSTEP] have : Epi (Ξ·.app A) := by refine @epi_of_epi _ _ _ _ _ (retraction (Ξ·.app A)) (Ξ·.app A) ?_ rw [show retraction _ ≫ Ξ·.app A = _ from Ξ·.naturality (retraction (Ξ·.app A))] apply epi_comp (Ξ·.app (i.obj ((leftAdjoint i).obj A))) [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : Category.{vβ‚‚, uβ‚‚} D inst✝² : Category.{v₃, u₃} E i : D β₯€ C inst✝¹ : Reflective i A : C inst✝ : IsSplitMono (NatTrans.app (ofRightAdjoint i).unit A) Ξ· : 𝟭 C ⟢ leftAdjoint i β‹™ i := (ofRightAdjoint i).unit this : IsIso (NatTrans.app Ξ· (i.obj ((leftAdjoint i).obj A))) ⊒ Epi (NatTrans.app Ξ· A) [PROOFSTEP] refine @epi_of_epi _ _ _ _ _ (retraction (Ξ·.app A)) (Ξ·.app A) ?_ [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : Category.{vβ‚‚, uβ‚‚} D inst✝² : Category.{v₃, u₃} E i : D β₯€ C inst✝¹ : Reflective i A : C inst✝ : IsSplitMono (NatTrans.app (ofRightAdjoint i).unit A) Ξ· : 𝟭 C ⟢ leftAdjoint i β‹™ i := (ofRightAdjoint i).unit this : IsIso (NatTrans.app Ξ· (i.obj ((leftAdjoint i).obj A))) ⊒ Epi (retraction (NatTrans.app Ξ· A) ≫ NatTrans.app Ξ· A) [PROOFSTEP] rw [show retraction _ ≫ Ξ·.app A = _ from Ξ·.naturality (retraction (Ξ·.app A))] [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : Category.{vβ‚‚, uβ‚‚} D inst✝² : Category.{v₃, u₃} E i : D β₯€ C inst✝¹ : Reflective i A : C inst✝ : IsSplitMono (NatTrans.app (ofRightAdjoint i).unit A) Ξ· : 𝟭 C ⟢ leftAdjoint i β‹™ i := (ofRightAdjoint i).unit this : IsIso (NatTrans.app Ξ· (i.obj ((leftAdjoint i).obj A))) ⊒ Epi (NatTrans.app Ξ· ((leftAdjoint i β‹™ i).obj A) ≫ (leftAdjoint i β‹™ i).map (retraction (NatTrans.app Ξ· A))) [PROOFSTEP] apply epi_comp (Ξ·.app (i.obj ((leftAdjoint i).obj A))) [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : Category.{vβ‚‚, uβ‚‚} D inst✝² : Category.{v₃, u₃} E i : D β₯€ C inst✝¹ : Reflective i A : C inst✝ : IsSplitMono (NatTrans.app (ofRightAdjoint i).unit A) Ξ· : 𝟭 C ⟢ leftAdjoint i β‹™ i := (ofRightAdjoint i).unit this✝ : IsIso (NatTrans.app Ξ· (i.obj ((leftAdjoint i).obj A))) this : Epi (NatTrans.app Ξ· A) ⊒ A ∈ Functor.essImage i [PROOFSTEP] skip [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : Category.{vβ‚‚, uβ‚‚} D inst✝² : Category.{v₃, u₃} E i : D β₯€ C inst✝¹ : Reflective i A : C inst✝ : IsSplitMono (NatTrans.app (ofRightAdjoint i).unit A) Ξ· : 𝟭 C ⟢ leftAdjoint i β‹™ i := (ofRightAdjoint i).unit this✝ : IsIso (NatTrans.app Ξ· (i.obj ((leftAdjoint i).obj A))) this : Epi (NatTrans.app Ξ· A) ⊒ A ∈ Functor.essImage i [PROOFSTEP] haveI := isIso_of_epi_of_isSplitMono (Ξ·.app A) [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝⁴ : Category.{v₁, u₁} C inst✝³ : Category.{vβ‚‚, uβ‚‚} D inst✝² : Category.{v₃, u₃} E i : D β₯€ C inst✝¹ : Reflective i A : C inst✝ : IsSplitMono (NatTrans.app (ofRightAdjoint i).unit A) Ξ· : 𝟭 C ⟢ leftAdjoint i β‹™ i := (ofRightAdjoint i).unit this✝¹ : IsIso (NatTrans.app Ξ· (i.obj ((leftAdjoint i).obj A))) this✝ : Epi (NatTrans.app Ξ· A) this : IsIso (NatTrans.app Ξ· A) ⊒ A ∈ Functor.essImage i [PROOFSTEP] exact mem_essImage_of_unit_isIso A [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i A : C B : D f : i.obj ((leftAdjoint i).obj A) ⟢ i.obj B ⊒ ↑(unitCompPartialBijectiveAux A B).symm f = NatTrans.app (ofRightAdjoint i).unit A ≫ f [PROOFSTEP] simp [unitCompPartialBijectiveAux] [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i A B : C hB : B ∈ Functor.essImage i f : i.obj ((leftAdjoint i).obj A) ⟢ B ⊒ ↑(unitCompPartialBijective A hB).symm f = NatTrans.app (ofRightAdjoint i).unit A ≫ f [PROOFSTEP] simp [unitCompPartialBijective, unitCompPartialBijectiveAux_symm_apply] [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i A B B' : C h : B ⟢ B' hB : B ∈ Functor.essImage i hB' : B' ∈ Functor.essImage i f : i.obj ((leftAdjoint i).obj A) ⟢ B ⊒ ↑(unitCompPartialBijective A hB').symm (f ≫ h) = ↑(unitCompPartialBijective A hB).symm f ≫ h [PROOFSTEP] simp [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i A B B' : C h : B ⟢ B' hB : B ∈ Functor.essImage i hB' : B' ∈ Functor.essImage i f : A ⟢ B ⊒ ↑(unitCompPartialBijective A hB') (f ≫ h) = ↑(unitCompPartialBijective A hB) f ≫ h [PROOFSTEP] rw [← Equiv.eq_symm_apply, unitCompPartialBijective_symm_natural A h, Equiv.symm_apply_apply] [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i X : Functor.EssImageSubcategory i ⊒ ((Functor.essImageInclusion i β‹™ leftAdjoint i) β‹™ Functor.toEssImage i).obj X β‰… X [PROOFSTEP] refine' Iso.symm (@asIso _ _ X _ ((ofRightAdjoint i).unit.app X.obj) ?_) [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i X : Functor.EssImageSubcategory i ⊒ IsIso (NatTrans.app (ofRightAdjoint i).unit X.obj) [PROOFSTEP] refine @isIso_of_reflects_iso _ _ _ _ _ _ _ i.essImageInclusion ?_ _ [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i X : Functor.EssImageSubcategory i ⊒ IsIso ((Functor.essImageInclusion i).map (NatTrans.app (ofRightAdjoint i).unit X.obj)) [PROOFSTEP] dsimp [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i X : Functor.EssImageSubcategory i ⊒ IsIso (NatTrans.app (ofRightAdjoint i).unit X.obj) [PROOFSTEP] exact inferInstance [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i X : Functor.EssImageSubcategory i ⊒ (Functor.essImageInclusion i).map (equivEssImageOfReflective_counitIso_app X).hom = inv (NatTrans.app (ofRightAdjoint i).unit X.obj) [PROOFSTEP] simp [equivEssImageOfReflective_counitIso_app, asIso] [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i X : Functor.EssImageSubcategory i ⊒ inv (NatTrans.app (ofRightAdjoint i).unit X.obj) = inv (NatTrans.app (ofRightAdjoint i).unit X.obj) [PROOFSTEP] rfl [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i ⊒ βˆ€ {X Y : D} (f : X ⟢ Y), (𝟭 D).map f ≫ ((fun X => (asIso (NatTrans.app (ofRightAdjoint i).counit X)).symm) Y).hom = ((fun X => (asIso (NatTrans.app (ofRightAdjoint i).counit X)).symm) X).hom ≫ (Functor.toEssImage i β‹™ Functor.essImageInclusion i β‹™ leftAdjoint i).map f [PROOFSTEP] intro X Y f [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i X Y : D f : X ⟢ Y ⊒ (𝟭 D).map f ≫ ((fun X => (asIso (NatTrans.app (ofRightAdjoint i).counit X)).symm) Y).hom = ((fun X => (asIso (NatTrans.app (ofRightAdjoint i).counit X)).symm) X).hom ≫ (Functor.toEssImage i β‹™ Functor.essImageInclusion i β‹™ leftAdjoint i).map f [PROOFSTEP] dsimp [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i X Y : D f : X ⟢ Y ⊒ f ≫ inv (NatTrans.app (ofRightAdjoint i).counit Y) = inv (NatTrans.app (ofRightAdjoint i).counit X) ≫ (leftAdjoint i).map (i.map f) [PROOFSTEP] rw [IsIso.comp_inv_eq, Category.assoc, IsIso.eq_inv_comp] [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i X Y : D f : X ⟢ Y ⊒ NatTrans.app (ofRightAdjoint i).counit X ≫ f = (leftAdjoint i).map (i.map f) ≫ NatTrans.app (ofRightAdjoint i).counit Y [PROOFSTEP] exact ((ofRightAdjoint i).counit.naturality f).symm [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i ⊒ βˆ€ {X Y : Functor.EssImageSubcategory i} (f : X ⟢ Y), ((Functor.essImageInclusion i β‹™ leftAdjoint i) β‹™ Functor.toEssImage i).map f ≫ (equivEssImageOfReflective_counitIso_app Y).hom = (equivEssImageOfReflective_counitIso_app X).hom ≫ (𝟭 (Functor.EssImageSubcategory i)).map f [PROOFSTEP] intro X Y f [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i X Y : Functor.EssImageSubcategory i f : X ⟢ Y ⊒ ((Functor.essImageInclusion i β‹™ leftAdjoint i) β‹™ Functor.toEssImage i).map f ≫ (equivEssImageOfReflective_counitIso_app Y).hom = (equivEssImageOfReflective_counitIso_app X).hom ≫ (𝟭 (Functor.EssImageSubcategory i)).map f [PROOFSTEP] apply (Functor.essImageInclusion i).map_injective [GOAL] case a C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i X Y : Functor.EssImageSubcategory i f : X ⟢ Y ⊒ (Functor.essImageInclusion i).map (((Functor.essImageInclusion i β‹™ leftAdjoint i) β‹™ Functor.toEssImage i).map f ≫ (equivEssImageOfReflective_counitIso_app Y).hom) = (Functor.essImageInclusion i).map ((equivEssImageOfReflective_counitIso_app X).hom ≫ (𝟭 (Functor.EssImageSubcategory i)).map f) [PROOFSTEP] have h := ((ofRightAdjoint i).unit.naturality f).symm [GOAL] case a C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i X Y : Functor.EssImageSubcategory i f : X ⟢ Y h : NatTrans.app (ofRightAdjoint i).unit X.obj ≫ (leftAdjoint i β‹™ i).map f = (𝟭 C).map f ≫ NatTrans.app (ofRightAdjoint i).unit Y.obj ⊒ (Functor.essImageInclusion i).map (((Functor.essImageInclusion i β‹™ leftAdjoint i) β‹™ Functor.toEssImage i).map f ≫ (equivEssImageOfReflective_counitIso_app Y).hom) = (Functor.essImageInclusion i).map ((equivEssImageOfReflective_counitIso_app X).hom ≫ (𝟭 (Functor.EssImageSubcategory i)).map f) [PROOFSTEP] rw [Functor.id_map] at h [GOAL] case a C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i X Y : Functor.EssImageSubcategory i f : X ⟢ Y h : NatTrans.app (ofRightAdjoint i).unit X.obj ≫ (leftAdjoint i β‹™ i).map f = f ≫ NatTrans.app (ofRightAdjoint i).unit Y.obj ⊒ (Functor.essImageInclusion i).map (((Functor.essImageInclusion i β‹™ leftAdjoint i) β‹™ Functor.toEssImage i).map f ≫ (equivEssImageOfReflective_counitIso_app Y).hom) = (Functor.essImageInclusion i).map ((equivEssImageOfReflective_counitIso_app X).hom ≫ (𝟭 (Functor.EssImageSubcategory i)).map f) [PROOFSTEP] erw [Functor.map_comp, Functor.map_comp, equivEssImageOfReflective_map_counitIso_app_hom, equivEssImageOfReflective_map_counitIso_app_hom, IsIso.comp_inv_eq, assoc, ← h, IsIso.inv_hom_id_assoc, Functor.comp_map] [GOAL] C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i X : D ⊒ (Functor.toEssImage i).map (NatTrans.app (NatIso.ofComponents fun X => (asIso (NatTrans.app (ofRightAdjoint i).counit X)).symm).hom X) ≫ NatTrans.app (NatIso.ofComponents equivEssImageOfReflective_counitIso_app).hom ((Functor.toEssImage i).obj X) = πŸ™ ((Functor.toEssImage i).obj X) [PROOFSTEP] apply (Functor.essImageInclusion i).map_injective [GOAL] case a C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i X : D ⊒ (Functor.essImageInclusion i).map ((Functor.toEssImage i).map (NatTrans.app (NatIso.ofComponents fun X => (asIso (NatTrans.app (ofRightAdjoint i).counit X)).symm).hom X) ≫ NatTrans.app (NatIso.ofComponents equivEssImageOfReflective_counitIso_app).hom ((Functor.toEssImage i).obj X)) = (Functor.essImageInclusion i).map (πŸ™ ((Functor.toEssImage i).obj X)) [PROOFSTEP] erw [Functor.map_comp, equivEssImageOfReflective_map_counitIso_app_hom] [GOAL] case a C : Type u₁ D : Type uβ‚‚ E : Type u₃ inst✝³ : Category.{v₁, u₁} C inst✝² : Category.{vβ‚‚, uβ‚‚} D inst✝¹ : Category.{v₃, u₃} E i : D β₯€ C inst✝ : Reflective i X : D ⊒ (Functor.essImageInclusion i).map ((Functor.toEssImage i).map (NatTrans.app (NatIso.ofComponents fun X => (asIso (NatTrans.app (ofRightAdjoint i).counit X)).symm).hom X)) ≫ inv (NatTrans.app (ofRightAdjoint i).unit ((𝟭 (Functor.EssImageSubcategory i)).obj ((Functor.toEssImage i).obj X)).obj) = (Functor.essImageInclusion i).map (πŸ™ ((Functor.toEssImage i).obj X)) [PROOFSTEP] aesop_cat
State Before: ΞΉ : Type u_1 M : Type ?u.49727 n : β„• I J : Box ΞΉ i : ΞΉ x : ℝ inst✝ : Finite ΞΉ s : Finset (Box ΞΉ) ⊒ βˆ€αΆ  (t : Finset (ΞΉ Γ— ℝ)) in atTop, βˆ€ (I J : Box ΞΉ), J ∈ s β†’ βˆ€ (J' : Box ΞΉ), J' ∈ splitMany I t β†’ Β¬Disjoint ↑J ↑J' β†’ J' ≀ J State After: case intro ΞΉ : Type u_1 M : Type ?u.49727 n : β„• I J : Box ΞΉ i : ΞΉ x : ℝ inst✝ : Finite ΞΉ s : Finset (Box ΞΉ) val✝ : Fintype ΞΉ ⊒ βˆ€αΆ  (t : Finset (ΞΉ Γ— ℝ)) in atTop, βˆ€ (I J : Box ΞΉ), J ∈ s β†’ βˆ€ (J' : Box ΞΉ), J' ∈ splitMany I t β†’ Β¬Disjoint ↑J ↑J' β†’ J' ≀ J Tactic: cases nonempty_fintype ΞΉ State Before: case intro ΞΉ : Type u_1 M : Type ?u.49727 n : β„• I J : Box ΞΉ i : ΞΉ x : ℝ inst✝ : Finite ΞΉ s : Finset (Box ΞΉ) val✝ : Fintype ΞΉ ⊒ βˆ€αΆ  (t : Finset (ΞΉ Γ— ℝ)) in atTop, βˆ€ (I J : Box ΞΉ), J ∈ s β†’ βˆ€ (J' : Box ΞΉ), J' ∈ splitMany I t β†’ Β¬Disjoint ↑J ↑J' β†’ J' ≀ J State After: case intro ΞΉ : Type u_1 M : Type ?u.49727 n : β„• I✝ J✝ : Box ΞΉ i✝ : ΞΉ x : ℝ inst✝ : Finite ΞΉ s : Finset (Box ΞΉ) val✝ : Fintype ΞΉ t : Finset (ΞΉ Γ— ℝ) ht : t β‰₯ Finset.biUnion s fun J => Finset.biUnion Finset.univ fun i => {(i, Box.lower J i), (i, Box.upper J i)} I J : Box ΞΉ hJ : J ∈ s J' : Box ΞΉ hJ' : J' ∈ splitMany I t i : ΞΉ ⊒ {(i, Box.lower J i), (i, Box.upper J i)} βŠ† t Tactic: refine' eventually_atTop.2 ⟨s.biUnion fun J => Finset.univ.biUnion fun i => {(i, J.lower i), (i, J.upper i)}, fun t ht I J hJ J' hJ' => not_disjoint_imp_le_of_subset_of_mem_splitMany (fun i => _) hJ'⟩ State Before: case intro ΞΉ : Type u_1 M : Type ?u.49727 n : β„• I✝ J✝ : Box ΞΉ i✝ : ΞΉ x : ℝ inst✝ : Finite ΞΉ s : Finset (Box ΞΉ) val✝ : Fintype ΞΉ t : Finset (ΞΉ Γ— ℝ) ht : t β‰₯ Finset.biUnion s fun J => Finset.biUnion Finset.univ fun i => {(i, Box.lower J i), (i, Box.upper J i)} I J : Box ΞΉ hJ : J ∈ s J' : Box ΞΉ hJ' : J' ∈ splitMany I t i : ΞΉ ⊒ {(i, Box.lower J i), (i, Box.upper J i)} βŠ† t State After: no goals Tactic: exact fun p hp => ht (Finset.mem_biUnion.2 ⟨J, hJ, Finset.mem_biUnion.2 ⟨i, Finset.mem_univ _, hp⟩⟩)
lemma Sup_lexord1: assumes A: "A \<noteq> {}" "(\<And>a. a \<in> A \<Longrightarrow> k a = (\<Union>a\<in>A. k a))" "P (c A)" shows "P (Sup_lexord k c s A)"
lemma analytic_on_mult [analytic_intros]: assumes f: "f analytic_on S" and g: "g analytic_on S" shows "(\<lambda>z. f z * g z) analytic_on S"
# This file was generated, do not modify it. # hide rms(y_wind[test], y_hat)
function get_realization(n::Integer, prep_fn = "prep.h5") habitat = load_realization(prep_fn, "habitat", n) movement = load_movement(prep_fn, "movement", n) init_pop = load_spatial_eq(prep_fn, "spatial_eq", n) comm_catchability = load_realization(prep_fn, "catchability_devs", n) log_qdevs = load_realization(prep_fn, "log_catchability_devs", n) habitat, movement, init_pop, comm_catchability, log_qdevs end struct SpatQSimPrep{M, P, Q, F} realization::Int movement::M init_pop::P log_qdevs::Q prep_file::F function SpatQSimPrep(realization::Int, movement::M, init_pop::P, log_qdevs::Q, prep_file::F = nothing) where {M<:MovementModel, P<:PopState, Q<:Matrix, F<:Union{String, Nothing}} new{M, P, Q, F}(realization, movement, init_pop, log_qdevs, prep_file) end end function SpatQSimPrep(realization::Int, prep_file::String) _, movement, init_pop, _, log_qdevs = get_realization(realization, prep_file) SpatQSimPrep(realization, movement, init_pop, log_qdevs, prep_file) end movement(prep::SpatQSimPrep) = prep.movement init_pop(prep::SpatQSimPrep) = prep.init_pop log_qdevs(prep::SpatQSimPrep) = prep.log_qdevs realization(prep::SpatQSimPrep) = prep.realization prep_file(prep::SpatQSimPrep) = prep.prep_file
[GOAL] C : Type u₁ inst✝ : Category.{v₁, u₁} C T : Monad C X : Algebra T ⊒ IsReflexivePair (FreeCoequalizer.topMap X) (FreeCoequalizer.bottomMap X) [PROOFSTEP] apply IsReflexivePair.mk' _ _ _ [GOAL] C : Type u₁ inst✝ : Category.{v₁, u₁} C T : Monad C X : Algebra T ⊒ (free T).obj X.A ⟢ (free T).obj (T.obj X.A) C : Type u₁ inst✝ : Category.{v₁, u₁} C T : Monad C X : Algebra T ⊒ ?m.2463 ≫ FreeCoequalizer.topMap X = πŸ™ ((free T).obj X.A) C : Type u₁ inst✝ : Category.{v₁, u₁} C T : Monad C X : Algebra T ⊒ ?m.2463 ≫ FreeCoequalizer.bottomMap X = πŸ™ ((free T).obj X.A) [PROOFSTEP] apply (free T).map (T.Ξ·.app X.A) [GOAL] C : Type u₁ inst✝ : Category.{v₁, u₁} C T : Monad C X : Algebra T ⊒ (free T).map (NatTrans.app (Ξ· T) X.A) ≫ FreeCoequalizer.topMap X = πŸ™ ((free T).obj X.A) [PROOFSTEP] ext [GOAL] case h C : Type u₁ inst✝ : Category.{v₁, u₁} C T : Monad C X : Algebra T ⊒ ((free T).map (NatTrans.app (Ξ· T) X.A) ≫ FreeCoequalizer.topMap X).f = (πŸ™ ((free T).obj X.A)).f [PROOFSTEP] dsimp [GOAL] case h C : Type u₁ inst✝ : Category.{v₁, u₁} C T : Monad C X : Algebra T ⊒ T.map (NatTrans.app (Ξ· T) X.A) ≫ T.map X.a = πŸ™ (T.obj X.A) [PROOFSTEP] rw [← Functor.map_comp, X.unit, Functor.map_id] [GOAL] C : Type u₁ inst✝ : Category.{v₁, u₁} C T : Monad C X : Algebra T ⊒ (free T).map (NatTrans.app (Ξ· T) X.A) ≫ FreeCoequalizer.bottomMap X = πŸ™ ((free T).obj X.A) [PROOFSTEP] ext [GOAL] case h C : Type u₁ inst✝ : Category.{v₁, u₁} C T : Monad C X : Algebra T ⊒ ((free T).map (NatTrans.app (Ξ· T) X.A) ≫ FreeCoequalizer.bottomMap X).f = (πŸ™ ((free T).obj X.A)).f [PROOFSTEP] apply Monad.right_unit [GOAL] C : Type u₁ inst✝ : Category.{v₁, u₁} C T : Monad C X : Algebra T s : Cofork (FreeCoequalizer.topMap X) (FreeCoequalizer.bottomMap X) ⊒ { l // Cofork.Ο€ (beckAlgebraCofork X) ≫ l = Cofork.Ο€ s ∧ βˆ€ {m : ((Functor.const WalkingParallelPair).obj (beckAlgebraCofork X).pt).obj WalkingParallelPair.one ⟢ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one}, Cofork.Ο€ (beckAlgebraCofork X) ≫ m = Cofork.Ο€ s β†’ m = l } [PROOFSTEP] have h₁ : (T : C β₯€ C).map X.a ≫ s.Ο€.f = T.ΞΌ.app X.A ≫ s.Ο€.f := congr_arg Monad.Algebra.Hom.f s.condition [GOAL] C : Type u₁ inst✝ : Category.{v₁, u₁} C T : Monad C X : Algebra T s : Cofork (FreeCoequalizer.topMap X) (FreeCoequalizer.bottomMap X) h₁ : T.map X.a ≫ (Cofork.Ο€ s).f = NatTrans.app (ΞΌ T) X.A ≫ (Cofork.Ο€ s).f ⊒ { l // Cofork.Ο€ (beckAlgebraCofork X) ≫ l = Cofork.Ο€ s ∧ βˆ€ {m : ((Functor.const WalkingParallelPair).obj (beckAlgebraCofork X).pt).obj WalkingParallelPair.one ⟢ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one}, Cofork.Ο€ (beckAlgebraCofork X) ≫ m = Cofork.Ο€ s β†’ m = l } [PROOFSTEP] have hβ‚‚ : (T : C β₯€ C).map s.Ο€.f ≫ s.pt.a = T.ΞΌ.app X.A ≫ s.Ο€.f := s.Ο€.h [GOAL] C : Type u₁ inst✝ : Category.{v₁, u₁} C T : Monad C X : Algebra T s : Cofork (FreeCoequalizer.topMap X) (FreeCoequalizer.bottomMap X) h₁ : T.map X.a ≫ (Cofork.Ο€ s).f = NatTrans.app (ΞΌ T) X.A ≫ (Cofork.Ο€ s).f hβ‚‚ : T.map (Cofork.Ο€ s).f ≫ s.pt.a = NatTrans.app (ΞΌ T) X.A ≫ (Cofork.Ο€ s).f ⊒ { l // Cofork.Ο€ (beckAlgebraCofork X) ≫ l = Cofork.Ο€ s ∧ βˆ€ {m : ((Functor.const WalkingParallelPair).obj (beckAlgebraCofork X).pt).obj WalkingParallelPair.one ⟢ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one}, Cofork.Ο€ (beckAlgebraCofork X) ≫ m = Cofork.Ο€ s β†’ m = l } [PROOFSTEP] refine' ⟨⟨T.Ξ·.app _ ≫ s.Ο€.f, _⟩, _, _⟩ [GOAL] case refine'_1 C : Type u₁ inst✝ : Category.{v₁, u₁} C T : Monad C X : Algebra T s : Cofork (FreeCoequalizer.topMap X) (FreeCoequalizer.bottomMap X) h₁ : T.map X.a ≫ (Cofork.Ο€ s).f = NatTrans.app (ΞΌ T) X.A ≫ (Cofork.Ο€ s).f hβ‚‚ : T.map (Cofork.Ο€ s).f ≫ s.pt.a = NatTrans.app (ΞΌ T) X.A ≫ (Cofork.Ο€ s).f ⊒ T.map (NatTrans.app (Ξ· T) (beckAlgebraCofork X).pt.1 ≫ (Cofork.Ο€ s).f) ≫ s.pt.a = (beckAlgebraCofork X).pt.a ≫ NatTrans.app (Ξ· T) (beckAlgebraCofork X).pt.1 ≫ (Cofork.Ο€ s).f [PROOFSTEP] dsimp [GOAL] case refine'_1 C : Type u₁ inst✝ : Category.{v₁, u₁} C T : Monad C X : Algebra T s : Cofork (FreeCoequalizer.topMap X) (FreeCoequalizer.bottomMap X) h₁ : T.map X.a ≫ (Cofork.Ο€ s).f = NatTrans.app (ΞΌ T) X.A ≫ (Cofork.Ο€ s).f hβ‚‚ : T.map (Cofork.Ο€ s).f ≫ s.pt.a = NatTrans.app (ΞΌ T) X.A ≫ (Cofork.Ο€ s).f ⊒ T.map (NatTrans.app (Ξ· T) X.1 ≫ (Cofork.Ο€ s).f) ≫ s.pt.a = X.a ≫ NatTrans.app (Ξ· T) X.1 ≫ (Cofork.Ο€ s).f [PROOFSTEP] rw [Functor.map_comp, Category.assoc, hβ‚‚, Monad.right_unit_assoc, show X.a ≫ _ ≫ _ = _ from T.Ξ·.naturality_assoc _ _, h₁, Monad.left_unit_assoc] [GOAL] case refine'_2 C : Type u₁ inst✝ : Category.{v₁, u₁} C T : Monad C X : Algebra T s : Cofork (FreeCoequalizer.topMap X) (FreeCoequalizer.bottomMap X) h₁ : T.map X.a ≫ (Cofork.Ο€ s).f = NatTrans.app (ΞΌ T) X.A ≫ (Cofork.Ο€ s).f hβ‚‚ : T.map (Cofork.Ο€ s).f ≫ s.pt.a = NatTrans.app (ΞΌ T) X.A ≫ (Cofork.Ο€ s).f ⊒ Cofork.Ο€ (beckAlgebraCofork X) ≫ Algebra.Hom.mk (NatTrans.app (Ξ· T) (beckAlgebraCofork X).pt.1 ≫ (Cofork.Ο€ s).f) = Cofork.Ο€ s [PROOFSTEP] ext [GOAL] case refine'_2.h C : Type u₁ inst✝ : Category.{v₁, u₁} C T : Monad C X : Algebra T s : Cofork (FreeCoequalizer.topMap X) (FreeCoequalizer.bottomMap X) h₁ : T.map X.a ≫ (Cofork.Ο€ s).f = NatTrans.app (ΞΌ T) X.A ≫ (Cofork.Ο€ s).f hβ‚‚ : T.map (Cofork.Ο€ s).f ≫ s.pt.a = NatTrans.app (ΞΌ T) X.A ≫ (Cofork.Ο€ s).f ⊒ (Cofork.Ο€ (beckAlgebraCofork X) ≫ Algebra.Hom.mk (NatTrans.app (Ξ· T) (beckAlgebraCofork X).pt.1 ≫ (Cofork.Ο€ s).f)).f = (Cofork.Ο€ s).f [PROOFSTEP] simpa [← T.Ξ·.naturality_assoc, T.left_unit_assoc] using T.Ξ·.app ((T : C β₯€ C).obj X.A) ≫= h₁ [GOAL] case refine'_3 C : Type u₁ inst✝ : Category.{v₁, u₁} C T : Monad C X : Algebra T s : Cofork (FreeCoequalizer.topMap X) (FreeCoequalizer.bottomMap X) h₁ : T.map X.a ≫ (Cofork.Ο€ s).f = NatTrans.app (ΞΌ T) X.A ≫ (Cofork.Ο€ s).f hβ‚‚ : T.map (Cofork.Ο€ s).f ≫ s.pt.a = NatTrans.app (ΞΌ T) X.A ≫ (Cofork.Ο€ s).f ⊒ βˆ€ {m : ((Functor.const WalkingParallelPair).obj (beckAlgebraCofork X).pt).obj WalkingParallelPair.one ⟢ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one}, Cofork.Ο€ (beckAlgebraCofork X) ≫ m = Cofork.Ο€ s β†’ m = Algebra.Hom.mk (NatTrans.app (Ξ· T) (beckAlgebraCofork X).pt.1 ≫ (Cofork.Ο€ s).f) [PROOFSTEP] intro m hm [GOAL] case refine'_3 C : Type u₁ inst✝ : Category.{v₁, u₁} C T : Monad C X : Algebra T s : Cofork (FreeCoequalizer.topMap X) (FreeCoequalizer.bottomMap X) h₁ : T.map X.a ≫ (Cofork.Ο€ s).f = NatTrans.app (ΞΌ T) X.A ≫ (Cofork.Ο€ s).f hβ‚‚ : T.map (Cofork.Ο€ s).f ≫ s.pt.a = NatTrans.app (ΞΌ T) X.A ≫ (Cofork.Ο€ s).f m : ((Functor.const WalkingParallelPair).obj (beckAlgebraCofork X).pt).obj WalkingParallelPair.one ⟢ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one hm : Cofork.Ο€ (beckAlgebraCofork X) ≫ m = Cofork.Ο€ s ⊒ m = Algebra.Hom.mk (NatTrans.app (Ξ· T) (beckAlgebraCofork X).pt.1 ≫ (Cofork.Ο€ s).f) [PROOFSTEP] ext [GOAL] case refine'_3.h C : Type u₁ inst✝ : Category.{v₁, u₁} C T : Monad C X : Algebra T s : Cofork (FreeCoequalizer.topMap X) (FreeCoequalizer.bottomMap X) h₁ : T.map X.a ≫ (Cofork.Ο€ s).f = NatTrans.app (ΞΌ T) X.A ≫ (Cofork.Ο€ s).f hβ‚‚ : T.map (Cofork.Ο€ s).f ≫ s.pt.a = NatTrans.app (ΞΌ T) X.A ≫ (Cofork.Ο€ s).f m : ((Functor.const WalkingParallelPair).obj (beckAlgebraCofork X).pt).obj WalkingParallelPair.one ⟢ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one hm : Cofork.Ο€ (beckAlgebraCofork X) ≫ m = Cofork.Ο€ s ⊒ m.f = (Algebra.Hom.mk (NatTrans.app (Ξ· T) (beckAlgebraCofork X).pt.1 ≫ (Cofork.Ο€ s).f)).f [PROOFSTEP] dsimp only [GOAL] case refine'_3.h C : Type u₁ inst✝ : Category.{v₁, u₁} C T : Monad C X : Algebra T s : Cofork (FreeCoequalizer.topMap X) (FreeCoequalizer.bottomMap X) h₁ : T.map X.a ≫ (Cofork.Ο€ s).f = NatTrans.app (ΞΌ T) X.A ≫ (Cofork.Ο€ s).f hβ‚‚ : T.map (Cofork.Ο€ s).f ≫ s.pt.a = NatTrans.app (ΞΌ T) X.A ≫ (Cofork.Ο€ s).f m : ((Functor.const WalkingParallelPair).obj (beckAlgebraCofork X).pt).obj WalkingParallelPair.one ⟢ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one hm : Cofork.Ο€ (beckAlgebraCofork X) ≫ m = Cofork.Ο€ s ⊒ m.f = NatTrans.app (Ξ· T) (beckAlgebraCofork X).pt.1 ≫ (Cofork.Ο€ s).f [PROOFSTEP] rw [← hm] [GOAL] case refine'_3.h C : Type u₁ inst✝ : Category.{v₁, u₁} C T : Monad C X : Algebra T s : Cofork (FreeCoequalizer.topMap X) (FreeCoequalizer.bottomMap X) h₁ : T.map X.a ≫ (Cofork.Ο€ s).f = NatTrans.app (ΞΌ T) X.A ≫ (Cofork.Ο€ s).f hβ‚‚ : T.map (Cofork.Ο€ s).f ≫ s.pt.a = NatTrans.app (ΞΌ T) X.A ≫ (Cofork.Ο€ s).f m : ((Functor.const WalkingParallelPair).obj (beckAlgebraCofork X).pt).obj WalkingParallelPair.one ⟢ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one hm : Cofork.Ο€ (beckAlgebraCofork X) ≫ m = Cofork.Ο€ s ⊒ m.f = NatTrans.app (Ξ· T) (beckAlgebraCofork X).pt.1 ≫ (Cofork.Ο€ (beckAlgebraCofork X) ≫ m).f [PROOFSTEP] apply (X.unit_assoc _).symm
/- Copyright (c) 2018 Chris Hughes. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Chris Hughes, Abhimanyu Pallavi Sudhir, Jean Lo, Calle SΓΆnne, Benjamin Davidson ! This file was ported from Lean 3 source module analysis.special_functions.complex.log_deriv ! leanprover-community/mathlib commit f2ce6086713c78a7f880485f7917ea547a215982 ! Please do not edit these lines, except to modify the commit id ! if you have ported upstream changes. -/ import Mathbin.Analysis.SpecialFunctions.Complex.Log import Mathbin.Analysis.SpecialFunctions.ExpDeriv /-! # Differentiability of the complex `log` function -/ noncomputable section namespace Complex open Set Filter open Real Topology /-- `complex.exp` as a `local_homeomorph` with `source = {z | -Ο€ < im z < Ο€}` and `target = {z | 0 < re z} βˆͺ {z | im z β‰  0}`. This definition is used to prove that `complex.log` is complex differentiable at all points but the negative real semi-axis. -/ def expLocalHomeomorph : LocalHomeomorph β„‚ β„‚ := LocalHomeomorph.ofContinuousOpen { toFun := exp invFun := log source := { z : β„‚ | z.im ∈ Ioo (-Ο€) Ο€ } target := { z : β„‚ | 0 < z.re } βˆͺ { z : β„‚ | z.im β‰  0 } map_source' := by rintro ⟨x, y⟩ ⟨h₁ : -Ο€ < y, hβ‚‚ : y < Ο€βŸ© refine' (not_or_of_imp fun hz => _).symm obtain rfl : y = 0 := by rw [exp_im] at hz simpa [(Real.exp_pos _).ne', Real.sin_eq_zero_iff_of_lt_of_lt h₁ hβ‚‚] using hz rw [mem_set_of_eq, ← of_real_def, exp_of_real_re] exact Real.exp_pos x map_target' := fun z h => suffices 0 ≀ z.re ∨ z.im β‰  0 by simpa [log_im, neg_pi_lt_arg, (arg_le_pi _).lt_iff_ne, arg_eq_pi_iff, not_and_or] h.imp (fun h => le_of_lt h) id left_inv' := fun x hx => log_exp hx.1 (le_of_lt hx.2) right_inv' := fun x hx => exp_log <| by rintro rfl simpa [lt_irrefl] using hx } continuous_exp.ContinuousOn isOpenMap_exp (isOpen_Ioo.Preimage continuous_im) #align complex.exp_local_homeomorph Complex.expLocalHomeomorph theorem hasStrictDerivAt_log {x : β„‚} (h : 0 < x.re ∨ x.im β‰  0) : HasStrictDerivAt log x⁻¹ x := have h0 : x β‰  0 := by rintro rfl simpa [lt_irrefl] using h expLocalHomeomorph.hasStrictDerivAt_symm h h0 <| by simpa [exp_log h0] using has_strict_deriv_at_exp (log x) #align complex.has_strict_deriv_at_log Complex.hasStrictDerivAt_log theorem hasStrictFderivAt_log_real {x : β„‚} (h : 0 < x.re ∨ x.im β‰  0) : HasStrictFderivAt log (x⁻¹ β€’ (1 : β„‚ β†’L[ℝ] β„‚)) x := (hasStrictDerivAt_log h).complexToReal_fderiv #align complex.has_strict_fderiv_at_log_real Complex.hasStrictFderivAt_log_real theorem contDiffAt_log {x : β„‚} (h : 0 < x.re ∨ x.im β‰  0) {n : β„•βˆž} : ContDiffAt β„‚ n log x := expLocalHomeomorph.contDiffAt_symm_deriv (exp_ne_zero <| log x) h (hasDerivAt_exp _) contDiff_exp.ContDiffAt #align complex.cont_diff_at_log Complex.contDiffAt_log end Complex section LogDeriv open Complex Filter open Topology variable {Ξ± : Type _} [TopologicalSpace Ξ±] {E : Type _} [NormedAddCommGroup E] [NormedSpace β„‚ E] theorem HasStrictFderivAt.clog {f : E β†’ β„‚} {f' : E β†’L[β„‚] β„‚} {x : E} (h₁ : HasStrictFderivAt f f' x) (hβ‚‚ : 0 < (f x).re ∨ (f x).im β‰  0) : HasStrictFderivAt (fun t => log (f t)) ((f x)⁻¹ β€’ f') x := (hasStrictDerivAt_log hβ‚‚).comp_hasStrictFderivAt x h₁ #align has_strict_fderiv_at.clog HasStrictFderivAt.clog theorem HasStrictDerivAt.clog {f : β„‚ β†’ β„‚} {f' x : β„‚} (h₁ : HasStrictDerivAt f f' x) (hβ‚‚ : 0 < (f x).re ∨ (f x).im β‰  0) : HasStrictDerivAt (fun t => log (f t)) (f' / f x) x := by rw [div_eq_inv_mul] exact (has_strict_deriv_at_log hβ‚‚).comp x h₁ #align has_strict_deriv_at.clog HasStrictDerivAt.clog theorem HasStrictDerivAt.clog_real {f : ℝ β†’ β„‚} {x : ℝ} {f' : β„‚} (h₁ : HasStrictDerivAt f f' x) (hβ‚‚ : 0 < (f x).re ∨ (f x).im β‰  0) : HasStrictDerivAt (fun t => log (f t)) (f' / f x) x := by simpa only [div_eq_inv_mul] using (has_strict_fderiv_at_log_real hβ‚‚).comp_hasStrictDerivAt x h₁ #align has_strict_deriv_at.clog_real HasStrictDerivAt.clog_real theorem HasFderivAt.clog {f : E β†’ β„‚} {f' : E β†’L[β„‚] β„‚} {x : E} (h₁ : HasFderivAt f f' x) (hβ‚‚ : 0 < (f x).re ∨ (f x).im β‰  0) : HasFderivAt (fun t => log (f t)) ((f x)⁻¹ β€’ f') x := (hasStrictDerivAt_log hβ‚‚).HasDerivAt.comp_hasFderivAt x h₁ #align has_fderiv_at.clog HasFderivAt.clog theorem HasDerivAt.clog {f : β„‚ β†’ β„‚} {f' x : β„‚} (h₁ : HasDerivAt f f' x) (hβ‚‚ : 0 < (f x).re ∨ (f x).im β‰  0) : HasDerivAt (fun t => log (f t)) (f' / f x) x := by rw [div_eq_inv_mul] exact (has_strict_deriv_at_log hβ‚‚).HasDerivAt.comp x h₁ #align has_deriv_at.clog HasDerivAt.clog theorem HasDerivAt.clog_real {f : ℝ β†’ β„‚} {x : ℝ} {f' : β„‚} (h₁ : HasDerivAt f f' x) (hβ‚‚ : 0 < (f x).re ∨ (f x).im β‰  0) : HasDerivAt (fun t => log (f t)) (f' / f x) x := by simpa only [div_eq_inv_mul] using (has_strict_fderiv_at_log_real hβ‚‚).HasFderivAt.comp_hasDerivAt x h₁ #align has_deriv_at.clog_real HasDerivAt.clog_real theorem DifferentiableAt.clog {f : E β†’ β„‚} {x : E} (h₁ : DifferentiableAt β„‚ f x) (hβ‚‚ : 0 < (f x).re ∨ (f x).im β‰  0) : DifferentiableAt β„‚ (fun t => log (f t)) x := (h₁.HasFderivAt.clog hβ‚‚).DifferentiableAt #align differentiable_at.clog DifferentiableAt.clog theorem HasFderivWithinAt.clog {f : E β†’ β„‚} {f' : E β†’L[β„‚] β„‚} {s : Set E} {x : E} (h₁ : HasFderivWithinAt f f' s x) (hβ‚‚ : 0 < (f x).re ∨ (f x).im β‰  0) : HasFderivWithinAt (fun t => log (f t)) ((f x)⁻¹ β€’ f') s x := (hasStrictDerivAt_log hβ‚‚).HasDerivAt.comp_hasFderivWithinAt x h₁ #align has_fderiv_within_at.clog HasFderivWithinAt.clog theorem HasDerivWithinAt.clog {f : β„‚ β†’ β„‚} {f' x : β„‚} {s : Set β„‚} (h₁ : HasDerivWithinAt f f' s x) (hβ‚‚ : 0 < (f x).re ∨ (f x).im β‰  0) : HasDerivWithinAt (fun t => log (f t)) (f' / f x) s x := by rw [div_eq_inv_mul] exact (has_strict_deriv_at_log hβ‚‚).HasDerivAt.comp_hasDerivWithinAt x h₁ #align has_deriv_within_at.clog HasDerivWithinAt.clog theorem HasDerivWithinAt.clog_real {f : ℝ β†’ β„‚} {s : Set ℝ} {x : ℝ} {f' : β„‚} (h₁ : HasDerivWithinAt f f' s x) (hβ‚‚ : 0 < (f x).re ∨ (f x).im β‰  0) : HasDerivWithinAt (fun t => log (f t)) (f' / f x) s x := by simpa only [div_eq_inv_mul] using (has_strict_fderiv_at_log_real hβ‚‚).HasFderivAt.comp_hasDerivWithinAt x h₁ #align has_deriv_within_at.clog_real HasDerivWithinAt.clog_real theorem DifferentiableWithinAt.clog {f : E β†’ β„‚} {s : Set E} {x : E} (h₁ : DifferentiableWithinAt β„‚ f s x) (hβ‚‚ : 0 < (f x).re ∨ (f x).im β‰  0) : DifferentiableWithinAt β„‚ (fun t => log (f t)) s x := (h₁.HasFderivWithinAt.clog hβ‚‚).DifferentiableWithinAt #align differentiable_within_at.clog DifferentiableWithinAt.clog theorem DifferentiableOn.clog {f : E β†’ β„‚} {s : Set E} (h₁ : DifferentiableOn β„‚ f s) (hβ‚‚ : βˆ€ x ∈ s, 0 < (f x).re ∨ (f x).im β‰  0) : DifferentiableOn β„‚ (fun t => log (f t)) s := fun x hx => (h₁ x hx).clog (hβ‚‚ x hx) #align differentiable_on.clog DifferentiableOn.clog theorem Differentiable.clog {f : E β†’ β„‚} (h₁ : Differentiable β„‚ f) (hβ‚‚ : βˆ€ x, 0 < (f x).re ∨ (f x).im β‰  0) : Differentiable β„‚ fun t => log (f t) := fun x => (h₁ x).clog (hβ‚‚ x) #align differentiable.clog Differentiable.clog end LogDeriv
The public debate on which media can be trusted further divided the public and the focus on finding the truth became more contentious. This was on show at the White House Correspondents dinner, boycotted by Trump and nativist Breitbart and its key strategists now within the White House. Media self-examination predominated the dinner, of Fox, CNN, MSNBC and the traditional mainstream media, The Washington Post, New York Times, the New Yorker, The Atlantic and others. Meanwhile Trump created a media show by pitting his Pennsylvania rally in the same time slot, and lampooning the Washington event as β€œthe elitist fake news media”. The Washington speakers fell into Trump’s trap by proclaiming that they were not β€œfake news” …a fundamental communications error which gave more legitimacy to these slurs.
module PatternSynonymOverloaded where data Nat : Set where zero : Nat suc : Nat -> Nat pattern ss x = suc (suc x) pattern ss x = suc x
SUBROUTINE ZPOSV_F95( A, B, UPLO, INFO ) ! ! -- LAPACK95 interface driver routine (version 3.0) -- ! UNI-C, Denmark; Univ. of Tennessee, USA; NAG Ltd., UK ! September, 2000 ! ! .. USE STATEMENTS .. USE LA_PRECISION, ONLY: WP => DP USE LA_AUXMOD, ONLY: ERINFO, LSAME USE F77_LAPACK, ONLY: POSV_F77 => LA_POSV ! .. IMPLICIT STATEMENT .. IMPLICIT NONE ! .. SCALAR ARGUMENTS .. CHARACTER(LEN=1), INTENT(IN), OPTIONAL :: UPLO INTEGER, INTENT(OUT), OPTIONAL :: INFO ! .. ARRAY ARGUMENTS .. COMPLEX(WP), INTENT(INOUT) :: A(:,:), B(:,:) !---------------------------------------------------------------------- ! ! Purpose ! ======= ! ! LA_POSV computes the solution to a linear system of equations ! A*X=B, where A is real symmetric or complex Hermitian and, in either ! case, positive definite, and where X and B are rectangular matrices ! or vectors. The Cholesky decomposition is used to factor A as ! A = U^H*U if UPLO = 'U', or A = L*L^H if UPLO = 'L' ! where U is an upper triangular matrix and L is a lower triangular ! matrix (L = U^H ). The factored form of A is then used to solve the ! above system. ! ! ========= ! ! SUBROUTINE LA_POSV( A, B, UPLO=uplo, INFO=info ) ! <type>(<wp>), INTENT(INOUT) :: A(:,:), <rhs> ! CHARACTER(LEN=1), INTENT(IN), OPTIONAL :: UPLO ! INTEGER, INTENT(OUT), OPTIONAL :: INFO ! where ! <type> ::= REAL | COMPLEX ! <wp> ::= KIND(1.0) | KIND(1.0D0) ! <rhs> ::= B(:,:) | B(:) ! ! Arguments ! ========= ! ! A (input/output) REAL or COMPLEX square array, shape (:,:). ! On entry, the matrix A. ! If UPLO = 'U', the upper triangular part of A contains the upper ! triangular part of the matrix A, and the strictly lower triangular ! part of A is not referenced. If UPLO = 'L', the lower triangular ! part of A contains the lower triangular part of the matrix A, and ! the strictly upper triangular part of A is not referenced. ! On exit, the factor U or L from the Cholesky factorization ! A = U^H*U = L*L^H. ! B (input/output) REAL or COMPLEX array, shape (:,:) with ! size(B,1) = size(A,1) or shape (:) with size(B) = size(A,1). ! On entry, the matrix B. ! On exit, the solution matrix X. ! UPLO Optional (input) CHARACTER(LEN=1) ! = 'U': Upper triangle of A is stored; ! = 'L': Lower triangle of A is stored. ! Default value: 'U'. ! INFO Optional (output) INTEGER ! = 0: sauccessful exit. ! < 0: if INFO = -i, the i-th argument had an illegal value. ! > 0: if INFO = i, the leading minor of order i of A is not ! positive definite, so the factorization could not be ! completed and the solution could not be computed. ! If INFO is not present and an error occurs, then the program is ! terminated with an error message. !---------------------------------------------------------------------- ! .. PARAMETERS .. CHARACTER(LEN=7), PARAMETER :: SRNAME = 'LA_POSV' ! .. LOCAL SCALARS .. CHARACTER(LEN=1) :: LUPLO INTEGER :: LINFO, N, NRHS ! .. INTRINSIC FUNCTIONS .. INTRINSIC SIZE, PRESENT ! .. EXECUTABLE STATEMENTS .. LINFO = 0; N = SIZE(A,1); NRHS = SIZE(B,2) IF( PRESENT(UPLO) )THEN; LUPLO = UPLO; ELSE; LUPLO = 'U'; END IF ! .. TEST THE ARGUMENTS IF( SIZE( A, 2 ) /= N .OR. N < 0 ) THEN; LINFO = -1 ELSE IF( SIZE( B, 1 ) /= N .OR. NRHS < 0 ) THEN; LINFO = -2 ELSE IF( .NOT.LSAME(LUPLO,'U') .AND. .NOT.LSAME(LUPLO,'L') )THEN; LINFO = -3 ELSE IF ( N > 0 ) THEN CALL POSV_F77( LUPLO, N, NRHS, A, N, B, N, LINFO ) END IF CALL ERINFO( LINFO, SRNAME, INFO ) END SUBROUTINE ZPOSV_F95
module m implicit none contains pure integer function twice(i) integer, intent(in) :: i twice = 2*i ! result has same name as function end function twice ! pure function double(i) result(j) integer, intent(in) :: i integer :: j j = 2*i ! result has different name from function end function double ! pure function double_vec(i) result(j) integer, intent(in) :: i(:) integer :: j(size(i)) j = 2*i end function double_vec ! end module m ! program test_func use m, only: twice, double, double_vec implicit none print*,twice(3),double(3) ! 6 6 print*,double_vec([3,4]) ! 6 8 end program test_func
module Data.Collection.Core.Properties where -- open import Data.List public using (List; []; _∷_) -- open import Data.String public using (String; _β‰Ÿ_) -- open import Level using (zero) -- -- open import Function using (flip) -- open import Relation.Nullary -- open import Relation.Nullary.Negation -- open import Relation.Nullary.Decidable renaming (map to mapDec; mapβ€² to mapDecβ€²) -- open import Relation.Unary -- open import Relation.Binary -- open import Relation.Binary.PropositionalEquality
(* Title: HOL/TPTP/TPTP_Proof_Reconstruction_Test.thy Author: Nik Sultana, Cambridge University Computer Laboratory Various tests for the proof reconstruction module. NOTE - looks for THF proofs in the path indicated by $THF_PROOFS - these proofs are generated using LEO-II with the following configuration choices: -po 1 -nux -nuc --expand_extuni You can simply filter LEO-II's output using the filter_proof script which is distributed with LEO-II. *) theory TPTP_Proof_Reconstruction_Test imports TPTP_Test TPTP_Proof_Reconstruction begin section "Main function" text "This function wraps all the reconstruction-related functions. Simply point it at a THF proof produced by LEO-II (using the configuration described above), and it will try to reconstruct it into an Isabelle/HOL theorem. It also returns the theory (into which the axioms and definitions used in the proof have been imported), but note that you can get the theory value from the theorem value." ML \<open> reconstruct_leo2 (Path.explode "$THF_PROOFS/NUM667^1.p.out") @{theory} \<close> section "Prep for testing the component functions" declare [[ tptp_trace_reconstruction = false, tptp_test_all = false, (* tptp_test_all = true, *) tptp_test_timeout = 30, (* tptp_max_term_size = 200 *) tptp_max_term_size = 0 ]] declare [[ML_exception_trace, ML_print_depth = 200]] section "Importing proofs" ML \<open> val probs = (* "$THF_PROOFS/SYN991^1.p.out" *) (*lacks conjecture*) (* "$THF_PROOFS/SYO040^2.p.out" *) (* "$THF_PROOFS/NUM640^1.p.out" *) (* "$THF_PROOFS/SEU553^2.p.out" *) (* "$THF_PROOFS/NUM665^1.p.out" *) (* "$THF_PROOFS/SEV161^5.p.out" *) (* "$THF_PROOFS/SET014^4.p.out" *) "$THF_PROOFS/NUM667^1.p.out" |> Path.explode |> single val prob_names = probs |> map (Path.file_name #> TPTP_Problem_Name.Nonstandard) \<close> setup \<open> if test_all @{context} then I else fold (fn path => TPTP_Reconstruct.import_thm true [Path.dir path, Path.explode "$THF_PROOFS"] path leo2_on_load) probs \<close> text "Display nicely." ML \<open> fun display_nicely ctxt (fms : TPTP_Reconstruct.formula_meaning list) = List.app (fn ((n, data) : TPTP_Reconstruct.formula_meaning) => Pretty.writeln (Pretty.block [Pretty.str (n ^ " "), Syntax.pretty_term ctxt (#fmla data), Pretty.str ( if is_none (#source_inf_opt data) then "" else ("\n\tannotation: " ^ @{make_string} (the (#source_inf_opt data : TPTP_Proof.source_info option))))]) ) (rev fms); (*FIXME hack for testing*) fun test_fmla thy = TPTP_Reconstruct.get_fmlas_of_prob thy (hd prob_names); fun test_pannot thy = TPTP_Reconstruct.get_pannot_of_prob thy (hd prob_names); if test_all @{context} orelse prob_names = [] then () else display_nicely @{context} (#meta (test_pannot @{theory})) (* To look at the original proof (i.e., before the proof transformations applied when the proof is loaded) replace previous line with: (test_fmla @{theory} |> map TPTP_Reconstruct.structure_fmla_meaning) *) \<close> ML \<open> fun step_range_tester f_x f_exn ctxt prob_name from until = let val max = case until of SOME x => x | NONE => if is_some Int.maxInt then the Int.maxInt else 999999 fun test_step x = if x > max then () else (f_x x; (interpret_leo2_inference ctxt prob_name (Int.toString x); ()) handle e => f_exn e; (*FIXME naive. should let Interrupt through*) (*assumes that inferences are numbered consecutively*) test_step (x + 1)) in test_step from end val step_range_tester_tracing = step_range_tester (fn x => tracing ("@step " ^ Int.toString x)) (fn e => tracing ("!!" ^ @{make_string} e)) \<close> ML \<open> (*try to reconstruct each inference step*) if test_all @{context} orelse prob_names = [] orelse true (*NOTE currently disabled*) then () else let (*FIXME not guaranteed to be the right nodes*) val heur_start = 3 val heur_end = hd (#meta (test_pannot @{theory})) |> #1 |> Int.fromString in step_range_tester_tracing @{context} (hd prob_names) heur_start heur_end end \<close> section "Building metadata and tactics" subsection "Building the skeleton" ML \<open> if test_all @{context} orelse prob_names = [] then [] else TPTP_Reconstruct.make_skeleton @{context} (test_pannot @{theory}); length it \<close> subsection "The 'one shot' tactic approach" ML \<open> val the_tactic = if test_all @{context} then [] else map (fn prob_name => (TPTP_Reconstruct.naive_reconstruct_tac @{context} interpret_leo2_inference (* auto_based_reconstruction_tac *) (* oracle_based_reconstruction_tac *) prob_name)) prob_names; \<close> subsection "The 'piecemeal' approach" ML \<open> val the_tactics = if test_all @{context} then [] else map (fn prob_name => TPTP_Reconstruct.naive_reconstruct_tacs interpret_leo2_inference (* auto_based_reconstruction_tac *) (* oracle_based_reconstruction_tac *) prob_name @{context}) prob_names; \<close> declare [[ML_print_depth = 2000]] ML \<open> the_tactics |> map (filter (fn (_, _, x) => is_none x) #> map (fn (x, SOME y, _) => (x, cterm_of @{theory} y))) \<close> section "Using metadata and tactics" text "There are various ways of testing the two ways (whole tactics or lists of tactics) of representing 'reconstructors'." subsection "The 'one shot' tactic approach" text "First we test whole tactics." ML \<open> (*produce thm*) if test_all @{context} then [] else map ( (* try *) (TPTP_Reconstruct.reconstruct @{context} (fn prob_name => TPTP_Reconstruct.naive_reconstruct_tac @{context} interpret_leo2_inference prob_name (* oracle_based_reconstruction_tac *)))) prob_names \<close> subsection "The 'piecemeal' approach" ML \<open> fun attac n = List.nth (List.nth (the_tactics, 0), n) |> #3 |> the |> snd fun attac_to n 0 = attac n | attac_to n m = attac n THEN attac_to (n + 1) (m - 1) fun shotac n = List.nth (List.nth (the_tactics, 0), n) |> #3 |> the |> fst \<close> ML \<open> (*Given a list of reconstructed inferences (as in "the_tactics" above, count the number of failures and successes, and list the failed inference reconstructions.*) fun evaluate_the_tactics [] acc = acc | evaluate_the_tactics ((node_no, (inf_name, inf_fmla, NONE)) :: xs) ((fai, suc), inf_list) = let val score = (fai + 1, suc) val index_info = get_index (fn (x, _) => if x = node_no then SOME true else NONE) inf_list val inf_list' = case index_info of NONE => (node_no, (inf_name, inf_fmla, 1)) :: inf_list | SOME (idx, _) => nth_map idx (fn (node_no, (inf_name, inf_fmla, count)) => (node_no, (inf_name, inf_fmla, count + 1))) inf_list in evaluate_the_tactics xs (score, inf_list') end | evaluate_the_tactics ((_, (_, _, SOME _)) :: xs) ((fai, suc), inf_list) = evaluate_the_tactics xs ((fai, suc + 1), inf_list) \<close> text "Now we build a tactic by combining lists of tactics" ML \<open> (*given a list of tactics to be applied in sequence (i.e., they follow a skeleton), we build a single tactic, interleaving some tracing info to help with debugging.*) fun step_by_step_tacs ctxt verbose (thm_tacs : (thm * tactic) list) : tactic = let fun interleave_tacs [] [] = all_tac | interleave_tacs (tac1 :: tacs1) (tac2 :: tacs2) = EVERY [tac1, tac2] THEN interleave_tacs tacs1 tacs2 val thms_to_traceprint = map (fn thm => fn st => (*FIXME uses makestring*) print_tac ctxt (@{make_string} thm) st) in if verbose then ListPair.unzip thm_tacs |> apfst (fn thms => enumerate 1 thms) |> apfst thms_to_traceprint |> uncurry interleave_tacs else EVERY (map #2 thm_tacs) end \<close> ML \<open> (*apply step_by_step_tacs to all problems under test*) fun narrated_tactics ctxt = map (map (#3 #> the) #> step_by_step_tacs ctxt false) the_tactics; (*produce thm*) (*use narrated_tactics to reconstruct all problems under test*) if test_all @{context} then [] else map (fn (prob_name, tac) => TPTP_Reconstruct.reconstruct @{context} (fn _ => tac) prob_name) (ListPair.zip (prob_names, narrated_tactics @{context})) \<close> subsection "Manually using 'piecemeal' approach" text "Another testing possibility involves manually creating a lemma and running through the list of tactics generating to prove that lemma. The following code shows the goal of each problem under test, and then for each problem returns the list of tactics which can be invoked individually as shown below." ML \<open> fun show_goal ctxt prob_name = let val thy = Proof_Context.theory_of ctxt val pannot = TPTP_Reconstruct.get_pannot_of_prob thy prob_name in #meta pannot |> filter (fn (_, info) => #role info = TPTP_Syntax.Role_Conjecture) |> hd |> snd |> #fmla |> cterm_of thy end; if test_all @{context} then [] else map (show_goal @{context}) prob_names; \<close> ML \<open> (*project out the list of tactics from "the_tactics"*) val just_the_tacs = map (map (#3 #> the #> #2)) the_tactics; map length just_the_tacs \<close> ML \<open> (*like just_the_tacs, but extract the thms, to inspect their thys*) val just_the_thms = map (map (#3 #> the #> #1)) the_tactics; map length just_the_thms; \<close> ML \<open> (*Show the skeleton-level inference which is done by each element of just_the_tacs. This is useful when debugging using the technique shown next*) if test_all @{context} orelse prob_names = [] then () else the_tactics |> hd |> map #1 |> TPTP_Reconstruct_Library.enumerate 0 |> List.app (@{make_string} #> writeln) \<close> ML \<open> fun leo2_tac_wrap ctxt prob_name step i st = rtac (interpret_leo2_inference ctxt prob_name step) i st \<close> (*FIXME move these examples elsewhere*) (* lemma "\<forall>(Xj::TPTP_Interpret.ind) Xk::TPTP_Interpret.ind. bnd_cCKB6_BLACK Xj Xk \<longrightarrow> bnd_cCKB6_BLACK (bnd_s (bnd_s (bnd_s Xj))) (bnd_s Xk)" apply (tactic {*nth (nth just_the_tacs 0) 0*}) apply (tactic {*nth (nth just_the_tacs 0) 1*}) apply (tactic {*nth (nth just_the_tacs 0) 2*}) apply (tactic {*nth (nth just_the_tacs 0) 3*}) apply (tactic {*nth (nth just_the_tacs 0) 4*}) apply (tactic {*nth (nth just_the_tacs 0) 5*}) ML_prf "nth (hd the_tactics) 6" apply (tactic {*nth (nth just_the_tacs 0) 6*}) apply (tactic {*nth (nth just_the_tacs 0) 7*}) apply (tactic {*nth (nth just_the_tacs 0) 8*}) apply (tactic {*nth (nth just_the_tacs 0) 9*}) apply (tactic {*nth (nth just_the_tacs 0) 10*}) apply (tactic {*nth (nth just_the_tacs 0) 11*}) apply (tactic {*nth (nth just_the_tacs 0) 12*}) apply (tactic {*nth (nth just_the_tacs 0) 13*}) apply (tactic {*nth (nth just_the_tacs 0) 14*}) apply (tactic {*nth (nth just_the_tacs 0) 15*}) apply (tactic {*nth (nth just_the_tacs 0) 16*}) (* apply (tactic {* rtac (interpret_leo2_inference @{context} (hd prob_names) "8") 1 *}) apply (tactic {* rtac (interpret_leo2_inference @{context} (hd prob_names) "7") 1 *}) apply (tactic {* rtac (interpret_leo2_inference @{context} (hd prob_names) "6") 1 *}) (* apply (tactic {* rtac (interpret_leo2_inference @{context} (hd prob_names) "4") 1 *}) *) *) apply (tactic {*nth (nth just_the_tacs 0) 17*}) apply (tactic {*nth (nth just_the_tacs 0) 18*}) apply (tactic {*nth (nth just_the_tacs 0) 19*}) apply (tactic {*nth (nth just_the_tacs 0) 20*}) apply (tactic {*nth (nth just_the_tacs 0) 21*}) ML_prf "nth (hd the_tactics) 21" ML_prf "nth (hd the_tactics) 22" apply (tactic {*nth (nth just_the_tacs 0) 22*}) apply (tactic {*nth (nth just_the_tacs 0) 23*}) apply (tactic {*nth (nth just_the_tacs 0) 24*}) apply (tactic {*nth (nth just_the_tacs 0) 25*}) ML_prf "nth (hd the_tactics) 19" apply (tactic {* interpret_leo2_inference_wrap (hd prob_names) "8" 1 *}) apply (tactic {* interpret_leo2_inference_wrap (hd prob_names) "7" 1 *}) apply (tactic {* interpret_leo2_inference_wrap (hd prob_names) "6" 1 *}) apply (tactic {* interpret_leo2_inference_wrap (hd prob_names) "4" 1 *}) ML_prf "nth (hd the_tactics) 20" ML_prf "nth (hd the_tactics) 21" ML_prf "nth (hd the_tactics) 22" *) (* lemma "bnd_powersetE1 \<longrightarrow> bnd_sepInPowerset \<longrightarrow> (\<forall>A Xphi. bnd_subset (bnd_dsetconstr A Xphi) A)" apply (tactic {*nth (nth just_the_tacs 0) 0*}) apply (tactic {*nth (nth just_the_tacs 0) 1*}) apply (tactic {*nth (nth just_the_tacs 0) 2*}) apply (tactic {*nth (nth just_the_tacs 0) 3*}) apply (tactic {*nth (nth just_the_tacs 0) 4*}) apply (tactic {*nth (nth just_the_tacs 0) 5*}) ML_prf "nth (hd the_tactics) 6" apply (tactic {*nth (nth just_the_tacs 0) 6*}) apply (tactic {*nth (nth just_the_tacs 0) 7*}) apply (tactic {*nth (nth just_the_tacs 0) 8*}) apply (tactic {*nth (nth just_the_tacs 0) 9*}) apply (tactic {*nth (nth just_the_tacs 0) 10*}) apply (tactic {*nth (nth just_the_tacs 0) 11*}) apply (tactic {*nth (nth just_the_tacs 0) 12*}) apply (tactic {*nth (nth just_the_tacs 0) 13*}) apply (tactic {*nth (nth just_the_tacs 0) 14*}) apply (tactic {*nth (nth just_the_tacs 0) 15*}) apply (tactic {*nth (nth just_the_tacs 0) 16*}) apply (tactic {*nth (nth just_the_tacs 0) 17*}) apply (tactic {*nth (nth just_the_tacs 0) 18*}) apply (tactic {*nth (nth just_the_tacs 0) 19*}) apply (tactic {*nth (nth just_the_tacs 0) 20*}) apply (tactic {*nth (nth just_the_tacs 0) 21*}) apply (tactic {*nth (nth just_the_tacs 0) 22*}) apply (tactic {*nth (nth just_the_tacs 0) 23*}) apply (tactic {*nth (nth just_the_tacs 0) 24*}) apply (tactic {*nth (nth just_the_tacs 0) 25*}) (* apply (tactic {*nth (nth just_the_tacs 0) 26*}) *) ML_prf "nth (hd the_tactics) 26" apply (subgoal_tac "(\<not> (\<forall>A Xphi. bnd_subset (bnd_dsetconstr A Xphi) A)) = True \<Longrightarrow> (\<not> bnd_subset (bnd_dsetconstr bnd_sK1 bnd_sK2) bnd_sK1) = True") prefer 2 apply (thin_tac "(bnd_powersetE1 \<longrightarrow> bnd_sepInPowerset \<longrightarrow> (\<forall>A Xphi. bnd_subset (bnd_dsetconstr A Xphi) A)) = False") apply (tactic {*extcnf_combined_simulator_tac (hd prob_names) 1*}) apply (tactic {*extcnf_combined_simulator_tac (hd prob_names) 1*}) apply (tactic {*extcnf_combined_simulator_tac (hd prob_names) 1*}) apply (tactic {*extcnf_combined_simulator_tac (hd prob_names) 1*}) apply simp (* apply (tactic {*nth (nth just_the_tacs 0) 26*}) *) apply (tactic {*nth (nth just_the_tacs 0) 27*}) apply (tactic {*nth (nth just_the_tacs 0) 28*}) apply (tactic {*nth (nth just_the_tacs 0) 29*}) apply (tactic {*nth (nth just_the_tacs 0) 30*}) apply (tactic {*nth (nth just_the_tacs 0) 31*}) apply (tactic {*nth (nth just_the_tacs 0) 32*}) apply (tactic {*nth (nth just_the_tacs 0) 33*}) apply (tactic {*nth (nth just_the_tacs 0) 34*}) apply (tactic {*nth (nth just_the_tacs 0) 35*}) apply (tactic {*nth (nth just_the_tacs 0) 36*}) apply (tactic {*nth (nth just_the_tacs 0) 37*}) apply (tactic {*nth (nth just_the_tacs 0) 38*}) apply (tactic {*nth (nth just_the_tacs 0) 39*}) apply (tactic {*nth (nth just_the_tacs 0) 40*}) apply (tactic {*nth (nth just_the_tacs 0) 41*}) apply (tactic {*nth (nth just_the_tacs 0) 42*}) apply (tactic {*nth (nth just_the_tacs 0) 43*}) apply (tactic {*nth (nth just_the_tacs 0) 44*}) apply (tactic {*nth (nth just_the_tacs 0) 45*}) apply (tactic {*nth (nth just_the_tacs 0) 46*}) apply (tactic {*nth (nth just_the_tacs 0) 47*}) apply (tactic {*nth (nth just_the_tacs 0) 48*}) apply (tactic {*nth (nth just_the_tacs 0) 49*}) apply (tactic {*nth (nth just_the_tacs 0) 50*}) apply (tactic {*nth (nth just_the_tacs 0) 51*}) done *) (* We can use just_the_tacs as follows: (this is from SEV012^5.p.out) lemma "((\<forall>(Xx :: bool) (Xy :: bool). True \<longrightarrow> True) \<and> (\<forall>(Xx :: bool) (Xy :: bool) (Xz :: bool). True \<and> True \<longrightarrow> True)) \<and> (\<lambda>(Xx :: bool) (Xy :: bool). True) = (\<lambda>Xx Xy. True)" apply (tactic {*nth (nth just_the_tacs 0) 0*}) apply (tactic {*nth (nth just_the_tacs 0) 1*}) apply (tactic {*nth (nth just_the_tacs 0) 2*}) apply (tactic {*nth (nth just_the_tacs 0) 3*}) apply (tactic {*nth (nth just_the_tacs 0) 4*}) apply (tactic {*nth (nth just_the_tacs 0) 5*}) ML_prf "nth (hd the_tactics) 6" apply (tactic {*nth (nth just_the_tacs 0) 6*}) apply (tactic {*nth (nth just_the_tacs 0) 7*}) apply (tactic {*nth (nth just_the_tacs 0) 8*}) apply (tactic {*nth (nth just_the_tacs 0) 9*}) apply (tactic {*nth (nth just_the_tacs 0) 10*}) apply (tactic {*nth (nth just_the_tacs 0) 11*}) apply (tactic {*nth (nth just_the_tacs 0) 12*}) apply (tactic {*nth (nth just_the_tacs 0) 13*}) apply (tactic {*nth (nth just_the_tacs 0) 14*}) apply (tactic {*nth (nth just_the_tacs 0) 15*}) apply (tactic {*nth (nth just_the_tacs 0) 16*}) apply (tactic {*nth (nth just_the_tacs 0) 17*}) apply (tactic {*nth (nth just_the_tacs 0) 18*}) apply (tactic {*nth (nth just_the_tacs 0) 19*}) apply (tactic {*nth (nth just_the_tacs 0) 20*}) apply (tactic {*nth (nth just_the_tacs 0) 21*}) apply (tactic {*nth (nth just_the_tacs 0) 22*}) done (* We could also use previous definitions directly, e.g. the following should prove the goal at a go: - apply (tactic {*narrated_tactics |> hd |> hd*}) - apply (tactic {* TPTP_Reconstruct.naive_reconstruct_tac interpret_leo2_inference (hd prob_names) @{context}*}) (Note that the previous two methods don't work in this "lemma" testing mode, not sure why. The previous methods (producing the thm values directly) should work though.) *) *) section "Testing against benchmark" ML \<open> (*if reconstruction_info value is NONE then a big error must have occurred*) type reconstruction_info = ((int(*no of failures*) * int(*no of successes*)) * (TPTP_Reconstruct.rolling_stock * term option(*inference formula*) * int (*number of times the inference occurs in the skeleton*)) list) option datatype proof_contents = No_info | Empty | Nonempty of reconstruction_info (*To make output less cluttered in whole-run tests*) fun erase_inference_fmlas (Nonempty (SOME (outline, inf_info))) = Nonempty (SOME (outline, map (fn (inf_name, _, count) => (inf_name, NONE, count)) inf_info)) | erase_inference_fmlas x = x \<close> ML \<open> (*Report on how many inferences in a proof are reconstructed, and give some info about the inferences for which reconstruction failed.*) fun test_partial_reconstruction thy prob_file = let val prob_name = prob_file |> Path.file_name |> TPTP_Problem_Name.Nonstandard val thy' = try (TPTP_Reconstruct.import_thm true [Path.dir prob_file, Path.explode "$TPTP"] prob_file leo2_on_load) thy val ctxt' = if is_some thy' then SOME (Proof_Context.init_global (the thy')) else NONE (*to test if proof is empty*) val fms = if is_some thy' then SOME (TPTP_Reconstruct.get_fmlas_of_prob (the thy') prob_name) else NONE val the_tactics = if is_some thy' then SOME (TPTP_Reconstruct.naive_reconstruct_tacs (* metis_based_reconstruction_tac *) interpret_leo2_inference (* auto_based_reconstruction_tac *) (* oracle_based_reconstruction_tac *) prob_name (the ctxt')) else NONE (* val _ = tracing ("tt=" ^ @{make_string} the_tactics) *) val skeleton = if is_some thy' then SOME (TPTP_Reconstruct.make_skeleton (the ctxt') (TPTP_Reconstruct.get_pannot_of_prob (the thy') prob_name)) else NONE val skeleton_and_tactics = if is_some thy' then SOME (ListPair.zip (the skeleton, the the_tactics)) else NONE val result = if is_some thy' then SOME (evaluate_the_tactics (the skeleton_and_tactics) ((0, 0), [])) else NONE (*strip node names*) val result' = if is_some result then SOME (apsnd (map #2) (the result)) else NONE in if is_some fms andalso List.null (the fms) then Empty else Nonempty result' end \<close> ML \<open> (*default timeout is 1 min*) fun reconstruct timeout light_output file thy = let val timer = Timer.startRealTimer () in Timeout.apply (Time.fromSeconds (if timeout = 0 then 60 else timeout)) (test_partial_reconstruction thy #> light_output ? erase_inference_fmlas #> @{make_string} (* FIXME *) #> (fn s => report (Proof_Context.init_global thy) (@{make_string} file ^ " === " ^ s ^ " t=" ^ (Timer.checkRealTimer timer |> Time.toMilliseconds |> @{make_string})))) file end \<close> ML \<open> (*this version of "reconstruct" builds theorems, instead of lists of reconstructed inferences*) (*default timeout is 1 min*) fun reconstruct timeout file thy = let val timer = Timer.startRealTimer () val thy' = TPTP_Reconstruct.import_thm true [Path.dir file, Path.explode "$TPTP"] file leo2_on_load thy val ctxt = Proof_Context.init_global thy' (*FIXME pass ctxt instead of thy*) val prob_name = file |> Path.file_name |> TPTP_Problem_Name.Nonstandard in Timeout.apply (Time.fromSeconds (if timeout = 0 then 60 else timeout)) (fn prob_name => (can (TPTP_Reconstruct.reconstruct ctxt (fn prob_name => TPTP_Reconstruct.naive_reconstruct_tac ctxt interpret_leo2_inference prob_name (* oracle_based_reconstruction_tac *))) prob_name ) |> (fn s => report ctxt (Path.print file ^ " === " ^ Bool.toString s ^ " t=" ^ (Timer.checkRealTimer timer |> Time.toMilliseconds |> @{make_string})))) prob_name end \<close> ML \<open> fun reconstruction_test timeout ctxt = test_fn ctxt (fn file => reconstruct timeout file (Proof_Context.theory_of ctxt)) "reconstructor" () \<close> ML \<open> datatype examination_results = Whole_proof of string(*filename*) * proof_contents | Specific_rule of string(*filename*) * string(*inference rule*) * term option list (*Look out for failures reconstructing a particular inference rule*) fun filter_failures inference_name (Whole_proof (filename, results)) = let val filtered_results = case results of Nonempty (SOME results') => #2 results' |> maps (fn (stock as TPTP_Reconstruct.Annotated_step (_, inf_name), inf_fmla, _) => if inf_name = inference_name then [inf_fmla] else []) | _ => [] in Specific_rule (filename, inference_name, filtered_results) end (*Returns detailed info about a proof-reconstruction attempt. If rule_name is specified then the related failed inferences are returned, otherwise all failed inferences are returned.*) fun examine_failed_inferences ctxt filename rule_name = let val thy = Proof_Context.theory_of ctxt val prob_file = Path.explode filename val results = if test_all ctxt then No_info else test_partial_reconstruction thy prob_file in Whole_proof (filename, results) |> is_some rule_name ? (fn x => filter_failures (the rule_name) x) end \<close> ML \<open> exception NONSENSE fun annotation_or_id (TPTP_Reconstruct.Step n) = n | annotation_or_id (TPTP_Reconstruct.Annotated_step (n, anno)) = anno | annotation_or_id TPTP_Reconstruct.Assumed = "assumption" | annotation_or_id TPTP_Reconstruct.Unconjoin = "conjI" | annotation_or_id TPTP_Reconstruct.Caboose = "(end)" | annotation_or_id (TPTP_Reconstruct.Synth_step s) = s | annotation_or_id (TPTP_Reconstruct.Split (split_node, soln_node, _)) = "split_at " ^ split_node ^ " " ^ soln_node; fun count_failures (Whole_proof (_, No_info)) = raise NONSENSE | count_failures (Whole_proof (_, Empty)) = raise NONSENSE | count_failures (Whole_proof (_, Nonempty NONE)) = raise NONSENSE | count_failures (Whole_proof (_, Nonempty (SOME (((n, _), _))))) = n | count_failures (Specific_rule (_, _, t)) = length t fun pre_classify_failures [] alist = alist | pre_classify_failures ((stock, _, _) :: xs) alist = let val inf = annotation_or_id stock val count = AList.lookup (=) alist inf in if is_none count then pre_classify_failures xs ((inf, 1) :: alist) else pre_classify_failures xs (AList.update (=) (inf, the count + 1) alist) end fun classify_failures (Whole_proof (_, Nonempty (SOME (((_, _), inferences))))) = pre_classify_failures inferences [] | classify_failures (Specific_rule (_, rule, t)) = [(rule, length t)] | classify_failures _ = raise NONSENSE \<close> ML \<open> val regressions = map (fn s => "$THF_PROOFS/" ^ s) ["SEV405^5.p.out", (*"SYO377^5.p.out", Always seems to raise Interrupt on my laptop -- probably because node 475 has lots of premises*) "PUZ031^5.p.out", "ALG001^5.p.out", "SYO238^5.p.out", (*"SEV158^5.p.out", This is big*) "SYO285^5.p.out", "../SYO285^5.p.out_reduced", (* "SYO225^5.p.out", This is big*) "SYO291^5.p.out", "SET669^3.p.out", "SEV233^5.p.out", (*"SEU511^1.p.out", This is big*) "SEV161^5.p.out", "SEV012^5.p.out", "SYO035^1.p.out", "SYO291^5.p.out", "SET741^4.p.out", (*involves both definitions and contorted splitting. has nice graph.*) "SEU548^2.p.out", "SEU513^2.p.out", "SYO006^1.p.out", "SYO371^5.p.out" (*has contorted splitting, like SYO006^1.p.out, but doesn't involve definitions*) ] \<close> ML \<open> val experiment = examine_failed_inferences @{context} (List.last regressions) NONE; (* val experiment_focus = filter_failures "extcnf_combined" experiment; *) (* count_failures experiment_focus classify_failures experiment *) \<close> text "Run reconstruction on all problems in a benchmark (provided via a script) and report on partial success." declare [[ tptp_test_all = true, tptp_test_timeout = 10 ]] ML \<open> (*problem source*) val tptp_probs_dir = Path.explode "$THF_PROOFS" |> Path.expand; \<close> ML \<open> if test_all @{context} then (report @{context} "Reconstructing proofs"; S timed_test (reconstruction_test (get_timeout @{context})) @{context} (TPTP_Syntax.get_file_list tptp_probs_dir)) else () \<close> (* Debugging strategy: 1) get list of all proofs 2) order by size 3) try to construct each in turn, given some timeout Use this to find the smallest failure, then debug that. *) end
function whitehKernDisplay(kern, spacing) % WHITEHKERNDISPLAY Display parameters of the WHITEH kernel. % FORMAT % DESC displays the parameters of the white noise % kernel and the kernel type to the console. % ARG kern : the kernel to display. % % FORMAT does the same as above, but indents the display according % to the amount specified. % ARG kern : the kernel to display. % ARG spacing : how many spaces to indent the display of the kernel by. % % SEEALSO : whiteKernParamInit, modelDisplay, kernDisplay % % COPYRIGHT : Neil D. Lawrence, 2004, 2005, 2006 % KERN if nargin > 1 spacing = repmat(32, 1, spacing); else spacing = []; end spacing = char(spacing); fprintf(spacing); fprintf('White Noise Variance: %2.4f\n', kern.variance)
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Regression" data-toc-modified-id="Regression-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Regression</a></span><ul class="toc-item"><li><ul class="toc-item"><li><span><a href="#Bibliography:-Chapter-8-Ivezic+" data-toc-modified-id="Bibliography:-Chapter-8-Ivezic+-1.0.1"><span class="toc-item-num">1.0.1&nbsp;&nbsp;</span>Bibliography: Chapter 8 Ivezic+</a></span></li></ul></li></ul></li><li><span><a href="#Regression:" data-toc-modified-id="Regression:-2"><span class="toc-item-num">2&nbsp;&nbsp;</span>Regression:</a></span></li><li><span><a href="#Metrics:" data-toc-modified-id="Metrics:-3"><span class="toc-item-num">3&nbsp;&nbsp;</span>Metrics:</a></span><ul class="toc-item"><li><span><a href="#Mean-squared-error-(MSE)" data-toc-modified-id="Mean-squared-error-(MSE)-3.1"><span class="toc-item-num">3.1&nbsp;&nbsp;</span>Mean squared error (MSE)</a></span></li><li><span><a href="#$MSE-\equiv-\frac{1}{n}-\sum_i-(y_i---\hat{y}_i)^2$" data-toc-modified-id="$MSE-\equiv-\frac{1}{n}-\sum_i-(y_i---\hat{y}_i)^2$-3.2"><span class="toc-item-num">3.2&nbsp;&nbsp;</span>$MSE \equiv \frac{1}{n} \sum_i (y_i - \hat{y}_i)^2$</a></span></li><li><span><a href="#Coefficient-of-determination-(R$^2$)" data-toc-modified-id="Coefficient-of-determination-(R$^2$)-3.3"><span class="toc-item-num">3.3&nbsp;&nbsp;</span>Coefficient of determination (R$^2$)</a></span></li><li><span><a href="#$R^2-\equiv-1----\frac{SS_{res}}{SS_{tot}}$," data-toc-modified-id="$R^2-\equiv-1----\frac{SS_{res}}{SS_{tot}}$,-3.4"><span class="toc-item-num">3.4&nbsp;&nbsp;</span>$R^2 \equiv 1 - \frac{SS_{res}}{SS_{tot}}$,</a></span><ul class="toc-item"><li><span><a href="#$-SS_{res}-=-\sum_i-(y_i---\hat{y}_i)^2$" data-toc-modified-id="$-SS_{res}-=-\sum_i-(y_i---\hat{y}_i)^2$-3.4.1"><span class="toc-item-num">3.4.1&nbsp;&nbsp;</span>$ SS_{res} = \sum_i (y_i - \hat{y}_i)^2$</a></span></li><li><span><a href="#$-SS_{tot}-=-\sum_i-(y_i---\bar{y})^2$" data-toc-modified-id="$-SS_{tot}-=-\sum_i-(y_i---\bar{y})^2$-3.4.2"><span class="toc-item-num">3.4.2&nbsp;&nbsp;</span>$ SS_{tot} = \sum_i (y_i - \bar{y})^2$</a></span></li></ul></li><li><span><a href="#Variance-and-bias" data-toc-modified-id="Variance-and-bias-3.5"><span class="toc-item-num">3.5&nbsp;&nbsp;</span>Variance and bias</a></span></li><li><span><a href="#$Var_{\hat{\theta}}-=-E_{\hat{\theta}}\biggl[-\bigl(\hat{\theta}---E_{\hat{\theta}}[\hat{\theta}]\bigr)^2\biggr]$" data-toc-modified-id="$Var_{\hat{\theta}}-=-E_{\hat{\theta}}\biggl[-\bigl(\hat{\theta}---E_{\hat{\theta}}[\hat{\theta}]\bigr)^2\biggr]$-3.6"><span class="toc-item-num">3.6&nbsp;&nbsp;</span>$Var_{\hat{\theta}} = E_{\hat{\theta}}\biggl[ \bigl(\hat{\theta} - E_{\hat{\theta}}[\hat{\theta}]\bigr)^2\biggr]$</a></span></li><li><span><a href="#$Bias_{\hat{\theta}}-=-E_{\hat{\theta}}---\theta$" data-toc-modified-id="$Bias_{\hat{\theta}}-=-E_{\hat{\theta}}---\theta$-3.7"><span class="toc-item-num">3.7&nbsp;&nbsp;</span>$Bias_{\hat{\theta}} = E_{\hat{\theta}} - \theta$</a></span></li><li><span><a href="#Relation-between-MSE,-variance-and-bias" data-toc-modified-id="Relation-between-MSE,-variance-and-bias-3.8"><span class="toc-item-num">3.8&nbsp;&nbsp;</span>Relation between MSE, variance and bias</a></span></li></ul></li><li><span><a href="#Linear-regression" data-toc-modified-id="Linear-regression-4"><span class="toc-item-num">4&nbsp;&nbsp;</span>Linear regression</a></span><ul class="toc-item"><li><span><a href="#Least-squares-regression-for-linear-regression" data-toc-modified-id="Least-squares-regression-for-linear-regression-4.1"><span class="toc-item-num">4.1&nbsp;&nbsp;</span>Least squares regression for linear regression</a></span></li><li><span><a href="#1.-Ordinary-least-squares" data-toc-modified-id="1.-Ordinary-least-squares-4.2"><span class="toc-item-num">4.2&nbsp;&nbsp;</span>1. Ordinary least squares</a></span><ul class="toc-item"><li><span><a href="#$\min-RSS-=-\min-\sum\limits_{i=1}^{n}-(y_i---\theta_0---\theta_1-x_i)^2$" data-toc-modified-id="$\min-RSS-=-\min-\sum\limits_{i=1}^{n}-(y_i---\theta_0---\theta_1-x_i)^2$-4.2.1"><span class="toc-item-num">4.2.1&nbsp;&nbsp;</span>$\min RSS = \min \sum\limits_{i=1}^{n} (y_i - \theta_0 - \theta_1 x_i)^2$</a></span></li></ul></li><li><span><a href="#$\hat{\theta}_{1,-OLS}-=-\frac{\sum\limits_{i=1}^n-(x_i---\bar{x})-(y_i---\bar{y})}{\sum\limits_{i=1}^n-(x_i---\bar{x})^2}-=-\frac{S_{xy}}{S_{xx}}$" data-toc-modified-id="$\hat{\theta}_{1,-OLS}-=-\frac{\sum\limits_{i=1}^n-(x_i---\bar{x})-(y_i---\bar{y})}{\sum\limits_{i=1}^n-(x_i---\bar{x})^2}-=-\frac{S_{xy}}{S_{xx}}$-4.3"><span class="toc-item-num">4.3&nbsp;&nbsp;</span>$\hat{\theta}_{1, OLS} = \frac{\sum\limits_{i=1}^n (x_i - \bar{x}) (y_i - \bar{y})}{\sum\limits_{i=1}^n (x_i - \bar{x})^2} = \frac{S_{xy}}{S_{xx}}$</a></span></li><li><span><a href="#$\hat{\theta}_{0,-OLS}-=-\bar{y}---\hat{\theta}_{1,OLS}-~\bar{x}$" data-toc-modified-id="$\hat{\theta}_{0,-OLS}-=-\bar{y}---\hat{\theta}_{1,OLS}-~\bar{x}$-4.4"><span class="toc-item-num">4.4&nbsp;&nbsp;</span>$\hat{\theta}_{0, OLS} = \bar{y} - \hat{\theta}_{1,OLS} ~\bar{x}$</a></span></li><li><span><a href="#$\hat{\sigma}^2-=-S^2-=-\frac{RSS}{n---2}$" data-toc-modified-id="$\hat{\sigma}^2-=-S^2-=-\frac{RSS}{n---2}$-4.5"><span class="toc-item-num">4.5&nbsp;&nbsp;</span>$\hat{\sigma}^2 = S^2 = \frac{RSS}{n - 2}$</a></span></li><li><span><a href="#$\hat{\theta}_{1,-OLS}-\sim-N\biggl(\theta_1,-\frac{\sigma^2}{S_{XX}}\biggr)$" data-toc-modified-id="$\hat{\theta}_{1,-OLS}-\sim-N\biggl(\theta_1,-\frac{\sigma^2}{S_{XX}}\biggr)$-4.6"><span class="toc-item-num">4.6&nbsp;&nbsp;</span>$\hat{\theta}_{1, OLS} \sim N\biggl(\theta_1, \frac{\sigma^2}{S_{XX}}\biggr)$</a></span></li><li><span><a href="#$\hat{\theta}_{0,-OLS}-\sim-N\biggl(\theta_0,-\sigma^2-\biggl(\frac{1}{n}-+-\frac{\bar{x}^2}{S_{XX}}\biggr)\biggr)$" data-toc-modified-id="$\hat{\theta}_{0,-OLS}-\sim-N\biggl(\theta_0,-\sigma^2-\biggl(\frac{1}{n}-+-\frac{\bar{x}^2}{S_{XX}}\biggr)\biggr)$-4.7"><span class="toc-item-num">4.7&nbsp;&nbsp;</span>$\hat{\theta}_{0, OLS} \sim N\biggl(\theta_0, \sigma^2 \biggl(\frac{1}{n} + \frac{\bar{x}^2}{S_{XX}}\biggr)\biggr)$</a></span></li><li><span><a href="#$\hat{\sigma}^2-\sim-\biggl(\frac{\sigma^2}{n---2}-\biggr)-\chi_{n-2}^{2}$" data-toc-modified-id="$\hat{\sigma}^2-\sim-\biggl(\frac{\sigma^2}{n---2}-\biggr)-\chi_{n-2}^{2}$-4.8"><span class="toc-item-num">4.8&nbsp;&nbsp;</span>$\hat{\sigma}^2 \sim \biggl(\frac{\sigma^2}{n - 2} \biggr) \chi_{n-2}^{2}$</a></span></li><li><span><a href="#$-T-=-\frac{\hat{\theta_1}---\theta_1}{SE}$" data-toc-modified-id="$-T-=-\frac{\hat{\theta_1}---\theta_1}{SE}$-4.9"><span class="toc-item-num">4.9&nbsp;&nbsp;</span>$ T = \frac{\hat{\theta_1} - \theta_1}{SE}$</a></span></li><li><span><a href="#$y(x)-=-\hat{\theta}_0-+-\hat{\theta}_1-x-\pm-t_{\alpha/2,-n---2}-~-S-~-\sqrt{1-+-\frac{1}{n}-\frac{(x---\bar{x})^2}{S_{xx}}}$" data-toc-modified-id="$y(x)-=-\hat{\theta}_0-+-\hat{\theta}_1-x-\pm-t_{\alpha/2,-n---2}-~-S-~-\sqrt{1-+-\frac{1}{n}-\frac{(x---\bar{x})^2}{S_{xx}}}$-4.10"><span class="toc-item-num">4.10&nbsp;&nbsp;</span>$y(x) = \hat{\theta}_0 + \hat{\theta}_1 x \pm t_{\alpha/2, n - 2} ~ S ~ \sqrt{1 + \frac{1}{n} \frac{(x - \bar{x})^2}{S_{xx}}}$</a></span></li><li><span><a href="#2.-Maximum-likelihood-estimator-(MLE)" data-toc-modified-id="2.-Maximum-likelihood-estimator-(MLE)-4.11"><span class="toc-item-num">4.11&nbsp;&nbsp;</span>2. Maximum likelihood estimator (MLE)</a></span></li><li><span><a href="#$p(\lbrace-y_i-\rbrace-|-\lbrace-x_i-\rbrace,-\theta)-=-\prod\limits_{i-=-1}^{N}-\frac{1}{\sqrt{2-\pi}-\sigma_i}-\exp-\biggl(-\frac{--(y_i---(\theta_0-+-\theta_1-x_i))^2}{2-\sigma_i^2}-\biggr)$" data-toc-modified-id="$p(\lbrace-y_i-\rbrace-|-\lbrace-x_i-\rbrace,-\theta)-=-\prod\limits_{i-=-1}^{N}-\frac{1}{\sqrt{2-\pi}-\sigma_i}-\exp-\biggl(-\frac{--(y_i---(\theta_0-+-\theta_1-x_i))^2}{2-\sigma_i^2}-\biggr)$-4.12"><span class="toc-item-num">4.12&nbsp;&nbsp;</span>$p(\lbrace y_i \rbrace | \lbrace x_i \rbrace, \theta) = \prod\limits_{i = 1}^{N} \frac{1}{\sqrt{2 \pi} \sigma_i} \exp \biggl( \frac{- (y_i - (\theta_0 + \theta_1 x_i))^2}{2 \sigma_i^2} \biggr)$</a></span></li><li><span><a href="#$\log(L)-=-\log-p(\lbrace-y_i-\rbrace-|-\lbrace-x_i-\rbrace,-\theta)-=-\sum\limits_{i-=-1}^{N}--\bigl(-\frac{--(y_i---(\theta_0-+-\theta_1-x_i))^2}{2-\sigma_i^2}-\bigr)$" data-toc-modified-id="$\log(L)-=-\log-p(\lbrace-y_i-\rbrace-|-\lbrace-x_i-\rbrace,-\theta)-=-\sum\limits_{i-=-1}^{N}--\bigl(-\frac{--(y_i---(\theta_0-+-\theta_1-x_i))^2}{2-\sigma_i^2}-\bigr)$-4.13"><span class="toc-item-num">4.13&nbsp;&nbsp;</span>$\log(L) = \log p(\lbrace y_i \rbrace | \lbrace x_i \rbrace, \theta) = \sum\limits_{i = 1}^{N} \bigl( \frac{- (y_i - (\theta_0 + \theta_1 x_i))^2}{2 \sigma_i^2} \bigr)$</a></span></li><li><span><a href="#$P(\theta-|-\lbrace-y_i-\rbrace,-\lbrace-x_i-\rbrace)-=-P(\lbrace-y_i-\rbrace-|-\lbrace-x_i-\rbrace,-\theta)-~-\frac{p(\theta)}{p(y_i)}$" data-toc-modified-id="$P(\theta-|-\lbrace-y_i-\rbrace,-\lbrace-x_i-\rbrace)-=-P(\lbrace-y_i-\rbrace-|-\lbrace-x_i-\rbrace,-\theta)-~-\frac{p(\theta)}{p(y_i)}$-4.14"><span class="toc-item-num">4.14&nbsp;&nbsp;</span>$P(\theta | \lbrace y_i \rbrace, \lbrace x_i \rbrace) = P(\lbrace y_i \rbrace | \lbrace x_i \rbrace, \theta) ~ \frac{p(\theta)}{p(y_i)}$</a></span></li><li><span><a href="#Online-estimation" data-toc-modified-id="Online-estimation-4.15"><span class="toc-item-num">4.15&nbsp;&nbsp;</span>Online estimation</a></span><ul class="toc-item"><li><span><a href="#Diabetes-dataset-example" data-toc-modified-id="Diabetes-dataset-example-4.15.1"><span class="toc-item-num">4.15.1&nbsp;&nbsp;</span>Diabetes dataset example</a></span></li></ul></li><li><span><a href="#3.-Least-squares-in-matrix-form" data-toc-modified-id="3.-Least-squares-in-matrix-form-4.16"><span class="toc-item-num">4.16&nbsp;&nbsp;</span>3. Least squares in matrix form</a></span></li><li><span><a href="#$y-=-{\bf-M}-~-\theta$" data-toc-modified-id="$y-=-{\bf-M}-~-\theta$-4.17"><span class="toc-item-num">4.17&nbsp;&nbsp;</span>$y = {\bf M} ~ \theta$</a></span></li><li><span><a href="#$y-=-\begin{bmatrix}-y_0-\\-y_1-\\-.-\\-y_{N-1}-\end{bmatrix}$" data-toc-modified-id="$y-=-\begin{bmatrix}-y_0-\\-y_1-\\-.-\\-y_{N-1}-\end{bmatrix}$-4.18"><span class="toc-item-num">4.18&nbsp;&nbsp;</span>$y = \begin{bmatrix} y_0 \\ y_1 \\ . \\ y_{N-1} \end{bmatrix}$</a></span></li><li><span><a href="#$\theta-=-\begin{bmatrix}-\theta_0-\\-\theta_1-\end{bmatrix}$" data-toc-modified-id="$\theta-=-\begin{bmatrix}-\theta_0-\\-\theta_1-\end{bmatrix}$-4.19"><span class="toc-item-num">4.19&nbsp;&nbsp;</span>$\theta = \begin{bmatrix} \theta_0 \\ \theta_1 \end{bmatrix}$</a></span></li><li><span><a href="#${\bf-M}-=-\begin{bmatrix}-1-&amp;-x_0-\\-1-&amp;-x_1-\\-...-&amp;-...-\\-1-&amp;-x_{N-1}-\\-\end{bmatrix}$" data-toc-modified-id="${\bf-M}-=-\begin{bmatrix}-1-&amp;-x_0-\\-1-&amp;-x_1-\\-...-&amp;-...-\\-1-&amp;-x_{N-1}-\\-\end{bmatrix}$-4.20"><span class="toc-item-num">4.20&nbsp;&nbsp;</span>${\bf M} = \begin{bmatrix} 1 &amp; x_0 \\ 1 &amp; x_1 \\ ... &amp; ... \\ 1 &amp; x_{N-1} \\ \end{bmatrix}$</a></span></li><li><span><a href="#$-C-=-\begin{bmatrix}-\sigma_0^2-&amp;-0-&amp;-.-&amp;-0-\\-0-&amp;-\sigma_1^2-&amp;-.-&amp;-0-\\-.-&amp;-.-&amp;-.-&amp;-.-\\-0-&amp;-0-&amp;-.-&amp;-\sigma_{N---1}^2\\-\end{bmatrix}$" data-toc-modified-id="$-C-=-\begin{bmatrix}-\sigma_0^2-&amp;-0-&amp;-.-&amp;-0-\\-0-&amp;-\sigma_1^2-&amp;-.-&amp;-0-\\-.-&amp;-.-&amp;-.-&amp;-.-\\-0-&amp;-0-&amp;-.-&amp;-\sigma_{N---1}^2\\-\end{bmatrix}$-4.21"><span class="toc-item-num">4.21&nbsp;&nbsp;</span>$ C = \begin{bmatrix} \sigma_0^2 &amp; 0 &amp; . &amp; 0 \\ 0 &amp; \sigma_1^2 &amp; . &amp; 0 \\ . &amp; . &amp; . &amp; . \\ 0 &amp; 0 &amp; . &amp; \sigma_{N - 1}^2\\ \end{bmatrix}$</a></span></li><li><span><a href="#${\bf-\hat{\theta}}-=-({\bf-M}^T-C^{-1}-{\bf-M})^{-1}-({\bf-M}^T-C^{-1}-{\bf-y})$" data-toc-modified-id="${\bf-\hat{\theta}}-=-({\bf-M}^T-C^{-1}-{\bf-M})^{-1}-({\bf-M}^T-C^{-1}-{\bf-y})$-4.22"><span class="toc-item-num">4.22&nbsp;&nbsp;</span>${\bf \hat{\theta}} = ({\bf M}^T C^{-1} {\bf M})^{-1} ({\bf M}^T C^{-1} {\bf y})$</a></span></li><li><span><a href="#$({\bf-y}---{\bf-M}-~-\theta)^{-1}-C^{-1}-({\bf-y}----{\bf-M}-~-\theta)$" data-toc-modified-id="$({\bf-y}---{\bf-M}-~-\theta)^{-1}-C^{-1}-({\bf-y}----{\bf-M}-~-\theta)$-4.23"><span class="toc-item-num">4.23&nbsp;&nbsp;</span>$({\bf y} - {\bf M} ~ \theta)^{-1} C^{-1} ({\bf y} - {\bf M} ~ \theta)$</a></span></li><li><span><a href="#$\Sigma_\theta-=-\begin{bmatrix}-\sigma_{\theta_0}^2-&amp;-\dots-&amp;-\sigma_{\theta_0-\theta_i}-&amp;-\dots-\\-\vdots-&amp;-\ddots-&amp;-\vdots-&amp;-\vdots-\\-\sigma_{\theta_0-\theta_i}-&amp;-\dots-&amp;-\sigma_{\theta_i}^2-\\--\vdots-&amp;-\vdots-&amp;-\vdots-&amp;-\ddots-\\-\end{bmatrix}-=-[{\bf-M}^T-C^{-1}-{\bf-M}]^{-1}$" data-toc-modified-id="$\Sigma_\theta-=-\begin{bmatrix}-\sigma_{\theta_0}^2-&amp;-\dots-&amp;-\sigma_{\theta_0-\theta_i}-&amp;-\dots-\\-\vdots-&amp;-\ddots-&amp;-\vdots-&amp;-\vdots-\\-\sigma_{\theta_0-\theta_i}-&amp;-\dots-&amp;-\sigma_{\theta_i}^2-\\--\vdots-&amp;-\vdots-&amp;-\vdots-&amp;-\ddots-\\-\end{bmatrix}-=-[{\bf-M}^T-C^{-1}-{\bf-M}]^{-1}$-4.24"><span class="toc-item-num">4.24&nbsp;&nbsp;</span>$\Sigma_\theta = \begin{bmatrix} \sigma_{\theta_0}^2 &amp; \dots &amp; \sigma_{\theta_0 \theta_i} &amp; \dots \\ \vdots &amp; \ddots &amp; \vdots &amp; \vdots \\ \sigma_{\theta_0 \theta_i} &amp; \dots &amp; \sigma_{\theta_i}^2 \\ \vdots &amp; \vdots &amp; \vdots &amp; \ddots \\ \end{bmatrix} = [{\bf M}^T C^{-1} {\bf M}]^{-1}$</a></span></li><li><span><a href="#4.-Polynomial-regression" data-toc-modified-id="4.-Polynomial-regression-4.25"><span class="toc-item-num">4.25&nbsp;&nbsp;</span>4. Polynomial regression</a></span></li><li><span><a href="#$y_i-=-\theta_0-+-\theta_1-x_i-+-\theta_2-x_i^2-+-\theta_3-x_i^3$" data-toc-modified-id="$y_i-=-\theta_0-+-\theta_1-x_i-+-\theta_2-x_i^2-+-\theta_3-x_i^3$-4.26"><span class="toc-item-num">4.26&nbsp;&nbsp;</span>$y_i = \theta_0 + \theta_1 x_i + \theta_2 x_i^2 + \theta_3 x_i^3$</a></span></li><li><span><a href="#$-M-=-\begin{bmatrix} 1-&amp;-x_0-&amp;-x_0^2-&amp;-x_0^3-\\ 1-&amp;-x_1-&amp;-x_1^2-&amp;-x_1^3-\\ .-&amp;-.-&amp;-.-&amp;-.-\\ 1-&amp;-x_N-&amp;-x_N^2-&amp;-x_N^3-\\ \end{bmatrix}$" data-toc-modified-id="$-M-=-\begin{bmatrix} 1-&amp;-x_0-&amp;-x_0^2-&amp;-x_0^3-\\ 1-&amp;-x_1-&amp;-x_1^2-&amp;-x_1^3-\\ .-&amp;-.-&amp;-.-&amp;-.-\\ 1-&amp;-x_N-&amp;-x_N^2-&amp;-x_N^3-\\ \end{bmatrix}$-4.27"><span class="toc-item-num">4.27&nbsp;&nbsp;</span>$ M = \begin{bmatrix} 1 &amp; x_0 &amp; x_0^2 &amp; x_0^3 \\ 1 &amp; x_1 &amp; x_1^2 &amp; x_1^3 \\ . &amp; . &amp; . &amp; . \\ 1 &amp; x_N &amp; x_N^2 &amp; x_N^3 \\ \end{bmatrix}$</a></span></li></ul></li><li><span><a href="#Regularization" data-toc-modified-id="Regularization-5"><span class="toc-item-num">5&nbsp;&nbsp;</span>Regularization</a></span><ul class="toc-item"><li><span><a href="#1.-Ridge-regression" data-toc-modified-id="1.-Ridge-regression-5.1"><span class="toc-item-num">5.1&nbsp;&nbsp;</span>1. Ridge regression</a></span></li><li><span><a href="#$({\bf-y}---M~-\theta)^{-1}-C^{-1}({\bf-y}---M~-\theta)-+-\lambda~-|\theta^T-\theta|$" data-toc-modified-id="$({\bf-y}---M~-\theta)^{-1}-C^{-1}({\bf-y}---M~-\theta)-+-\lambda~-|\theta^T-\theta|$-5.2"><span class="toc-item-num">5.2&nbsp;&nbsp;</span>$({\bf y} - M~ \theta)^{-1} C^{-1}({\bf y} - M~ \theta) + \lambda~ |\theta^T \theta|$</a></span></li><li><span><a href="#${\bf-\hat{\theta}}-=-({\bf-M}^T-C^{-1}-{\bf-M}-+-\lambda-I)^{-1}-({\bf-M}^T-C^{-1}-{\bf-y})$" data-toc-modified-id="${\bf-\hat{\theta}}-=-({\bf-M}^T-C^{-1}-{\bf-M}-+-\lambda-I)^{-1}-({\bf-M}^T-C^{-1}-{\bf-y})$-5.3"><span class="toc-item-num">5.3&nbsp;&nbsp;</span>${\bf \hat{\theta}} = ({\bf M}^T C^{-1} {\bf M} + \lambda I)^{-1} ({\bf M}^T C^{-1} {\bf y})$</a></span><ul class="toc-item"><li><span><a href="#Bayes-equivalent" data-toc-modified-id="Bayes-equivalent-5.3.1"><span class="toc-item-num">5.3.1&nbsp;&nbsp;</span>Bayes equivalent</a></span></li></ul></li><li><span><a href="#$-p(\theta)-\propto-\exp-\biggl(-\frac{--\lambda-(\theta^T-\theta)}{2}-\biggr)$" data-toc-modified-id="$-p(\theta)-\propto-\exp-\biggl(-\frac{--\lambda-(\theta^T-\theta)}{2}-\biggr)$-5.4"><span class="toc-item-num">5.4&nbsp;&nbsp;</span>$ p(\theta) \propto \exp \biggl( \frac{- \lambda (\theta^T \theta)}{2} \biggr)$</a></span></li><li><span><a href="#$|{\bf-\theta}|^2-<-s$" data-toc-modified-id="$|{\bf-\theta}|^2-<-s$-5.5"><span class="toc-item-num">5.5&nbsp;&nbsp;</span>$|{\bf \theta}|^2 &lt; s$</a></span></li><li><span><a href="#2.-LASSO-regression" data-toc-modified-id="2.-LASSO-regression-5.6"><span class="toc-item-num">5.6&nbsp;&nbsp;</span>2. LASSO regression</a></span></li><li><span><a href="#$({\bf-y}---\theta-{\bf-X})^{-1}({\bf-y}---\theta-{\bf-X})-+-\lambda-|\theta|$" data-toc-modified-id="$({\bf-y}---\theta-{\bf-X})^{-1}({\bf-y}---\theta-{\bf-X})-+-\lambda-|\theta|$-5.7"><span class="toc-item-num">5.7&nbsp;&nbsp;</span>$({\bf y} - \theta {\bf X})^{-1}({\bf y} - \theta {\bf X}) + \lambda |\theta|$</a></span></li><li><span><a href="#$|{\bf-\theta}|-<-s$" data-toc-modified-id="$|{\bf-\theta}|-<-s$-5.8"><span class="toc-item-num">5.8&nbsp;&nbsp;</span>$|{\bf \theta}| &lt; s$</a></span><ul class="toc-item"><li><span><a href="#Understanding-Ridge-and-LASSO-regression" data-toc-modified-id="Understanding-Ridge-and-LASSO-regression-5.8.1"><span class="toc-item-num">5.8.1&nbsp;&nbsp;</span>Understanding Ridge and LASSO regression</a></span></li></ul></li></ul></li><li><span><a href="#Comparison-between-ordinary,-Ridge-and-LASSO-regression" data-toc-modified-id="Comparison-between-ordinary,-Ridge-and-LASSO-regression-6"><span class="toc-item-num">6&nbsp;&nbsp;</span>Comparison between ordinary, Ridge and LASSO regression</a></span><ul class="toc-item"><li><span><a href="#Choosing-the-regularization-parameter-$\lambda$" data-toc-modified-id="Choosing-the-regularization-parameter-$\lambda$-6.1"><span class="toc-item-num">6.1&nbsp;&nbsp;</span>Choosing the regularization parameter $\lambda$</a></span></li><li><span><a href="#$-Err(\lambda)-=-k^{1}-\sum_k-N_k^{-1}-\sum\limits_{i}^{N_k}-\frac{[y_i---f(x_i-|-\theta)]^2}{\sigma_i^2}$" data-toc-modified-id="$-Err(\lambda)-=-k^{1}-\sum_k-N_k^{-1}-\sum\limits_{i}^{N_k}-\frac{[y_i---f(x_i-|-\theta)]^2}{\sigma_i^2}$-6.2"><span class="toc-item-num">6.2&nbsp;&nbsp;</span>$ Err(\lambda) = k^{1} \sum_k N_k^{-1} \sum\limits_{i}^{N_k} \frac{[y_i - f(x_i | \theta)]^2}{\sigma_i^2}$</a></span></li></ul></li><li><span><a href="#Outliers" data-toc-modified-id="Outliers-7"><span class="toc-item-num">7&nbsp;&nbsp;</span>Outliers</a></span><ul class="toc-item"><li><span><a href="#Huber-loss" data-toc-modified-id="Huber-loss-7.1"><span class="toc-item-num">7.1&nbsp;&nbsp;</span>Huber loss</a></span><ul class="toc-item"><li><span><a href="#$-\sum\limits_{i=1}^N-e(y_i|y)$" data-toc-modified-id="$-\sum\limits_{i=1}^N-e(y_i|y)$-7.1.1"><span class="toc-item-num">7.1.1&nbsp;&nbsp;</span>$ \sum\limits_{i=1}^N e(y_i|y)$</a></span></li><li><span><a href="#$\begin{equation} --\phi(t)=\left\{ --\begin{array}{@{}ll@{}} ----\frac{1}{2}-t^2,-&amp;-\text{if}\-|t|\le-c-\\ ----c|t|---\frac{1}{2}-c^2,-&amp;-\text{otherwise} --\end{array}\right. \end{equation}$" data-toc-modified-id="$\begin{equation} --\phi(t)=\left\{ --\begin{array}{@{}ll@{}} ----\frac{1}{2}-t^2,-&amp;-\text{if}\-|t|\le-c-\\ ----c|t|---\frac{1}{2}-c^2,-&amp;-\text{otherwise} --\end{array}\right. \end{equation}$-7.1.2"><span class="toc-item-num">7.1.2&nbsp;&nbsp;</span>$\begin{equation} \phi(t)=\left\{ \begin{array}{@{}ll@{}} \frac{1}{2} t^2, &amp; \text{if}\ |t|\le c \\ c|t| - \frac{1}{2} c^2, &amp; \text{otherwise} \end{array}\right. \end{equation}$</a></span></li></ul></li><li><span><a href="#Bayesian-Outlier-Methods" data-toc-modified-id="Bayesian-Outlier-Methods-7.2"><span class="toc-item-num">7.2&nbsp;&nbsp;</span>Bayesian Outlier Methods</a></span></li></ul></li><li><span><a href="#Cross-Validation-Testing" data-toc-modified-id="Cross-Validation-Testing-8"><span class="toc-item-num">8&nbsp;&nbsp;</span>Cross-Validation Testing</a></span></li></ul></div> ```python %config InlineBackend.figure_format = 'retina' %matplotlib inline import numpy as np import matplotlib.pyplot as plt plt.style.use(['ggplot', 'assets/class.mplstyle']) red = '#E24A33' blue = '#348ABD' purple = '#988ED5' gray = '#777777' yellow = '#FBC15E' green = '#8EBA42' pink = '#FFB5B8' ``` # Regression ### Bibliography: Chapter 8 Ivezic+ # Regression: - Finding the relation between a dependent variable $y$ and a set of independent variables $\bf x$. It describes the expectation value of $y$ given $\bf x$, $E[y|{\bf x}]$. - The dependent variable $y$ is also called **response variable**. - The problem is to find the expectation of $y$ given $\bf x$: $E[y|{\bf x}] = f({\bf x}, \theta) + \epsilon$ where $\epsilon$ is a random error. Note that we estimate $E[y | {\bf x}]$, the conditional expectation of $y$ given $\bf x$, rather than $p(y, {\bf x})$, the joint distribution of $y$ and $\bf x$, which is a much harder problem to solve. Regression is a simpler problem: instead of determining the multidimensional pdf, we would like to infer the expectation of $y$ given $\bf x$. **The goal of regression usually focuses on estimation of the parameters $\theta$ of the function and their confidence intervals.** # Metrics: ## Mean squared error (MSE) The mean squared error (MSE) or mean squared deviation (MSD) of an estimator measures the average of the squares of the errors: It is defined by (estimation of $y$): ## $MSE \equiv \frac{1}{n} \sum_i (y_i - \hat{y}_i)^2$ ## Coefficient of determination (R$^2$) It is the proportion of the variance in the dependent variable that is predictable from the independent variable(s). It is defined as: ## $R^2 \equiv 1 - \frac{SS_{res}}{SS_{tot}}$, where ### $ SS_{res} = \sum_i (y_i - \hat{y}_i)^2$ and ### $ SS_{tot} = \sum_i (y_i - \bar{y})^2$ ## Variance and bias The **variance** of an estimator of the parameter $\theta$ will be: ## $Var_{\hat{\theta}} = E_{\hat{\theta}}\biggl[ \bigl(\hat{\theta} - E_{\hat{\theta}}[\hat{\theta}]\bigr)^2\biggr]$ The **bias** of an estimator will be: ## $Bias_{\hat{\theta}} = E_{\hat{\theta}} - \theta$ ## Relation between MSE, variance and bias Note that when estimating a parameter the MSE equals the variance plus the bias squared # Linear regression The one dimensional linear regression model is defined by $f(x, \theta) = \theta_0 + \theta_1 x$ ## Least squares regression for linear regression ## 1. Ordinary least squares Minimizes the residual sum of squares (RSS) between the observed response values $y_i$ and the model predictions ### $\min RSS = \min \sum\limits_{i=1}^{n} (y_i - \theta_0 - \theta_1 x_i)^2$ Differentiating w.r.t. to $\theta_0$ and $\theta_1$ and setting these derivatives to zero gives two equations which can be solved to give: ## $\hat{\theta}_{1, OLS} = \frac{\sum\limits_{i=1}^n (x_i - \bar{x}) (y_i - \bar{y})}{\sum\limits_{i=1}^n (x_i - \bar{x})^2} = \frac{S_{xy}}{S_{xx}}$ ## $\hat{\theta}_{0, OLS} = \bar{y} - \hat{\theta}_{1,OLS} ~\bar{x}$ OLS = ordinary least squares These estimators are also the maximum likelihood estimator (MLE) when the errors are normally distributed. The OLS estimator of the error variance $\sigma^2$ is: ## $\hat{\sigma}^2 = S^2 = \frac{RSS}{n - 2}$ If the errors are i.i.d. random variables, the slope and intercept are unbiased and asymptotically normally distributed: ## $\hat{\theta}_{1, OLS} \sim N\biggl(\theta_1, \frac{\sigma^2}{S_{XX}}\biggr)$ ## $\hat{\theta}_{0, OLS} \sim N\biggl(\theta_0, \sigma^2 \biggl(\frac{1}{n} + \frac{\bar{x}^2}{S_{XX}}\biggr)\biggr)$ If the errors are also normally distributed with zero mean and known variance $\sigma^2$, then the variance is $\chi^2$ distributed: ## $\hat{\sigma}^2 \sim \biggl(\frac{\sigma^2}{n - 2} \biggr) \chi_{n-2}^{2}$ However, $\sigma^2$ is rarely known, and only the sample variance $S^2$ is known, changing the statistical properties of the estimators. Defining: ## $ T = \frac{\hat{\theta_1} - \theta_1}{SE}$ where $SE = \frac{S}{\sqrt{S_{XX}}}$ is also known as the **standard error**, one can show that $T$ is t (t-Student) distributed with $n-2$ degrees of freedom. Then, the $(1-\alpha)$ confidence interval for $\theta_1$ becomes $(\hat{\theta}_1 - t_{\alpha/2, n-2} ~ SE, \hat{\theta}_1 + t_{\alpha/2, n-2} ~ SE)$ and the confidence interval for $y$ at a given $x$ becomes: ## $y(x) = \hat{\theta}_0 + \hat{\theta}_1 x \pm t_{\alpha/2, n - 2} ~ S ~ \sqrt{1 + \frac{1}{n} \frac{(x - \bar{x})^2}{S_{xx}}}$ ## 2. Maximum likelihood estimator (MLE) Let us consider the probability of observing $\lbrace y_i \rbrace$ given the parameters $\theta$ and the set of independent variable $\lbrace x_i \rbrace$. Here we assume that the observations are Gaussian with standard deviation $\sigma_i$: ## $p(\lbrace y_i \rbrace | \lbrace x_i \rbrace, \theta) = \prod\limits_{i = 1}^{N} \frac{1}{\sqrt{2 \pi} \sigma_i} \exp \biggl( \frac{- (y_i - (\theta_0 + \theta_1 x_i))^2}{2 \sigma_i^2} \biggr)$ Thus, we can maximize the log likelihood minus a constant to find the **maximum likelihood estimator (MLE)** ## $\log(L) = \log p(\lbrace y_i \rbrace | \lbrace x_i \rbrace, \theta) = \sum\limits_{i = 1}^{N} \bigl( \frac{- (y_i - (\theta_0 + \theta_1 x_i))^2}{2 \sigma_i^2} \bigr)$ which is **equivalent to minimizing the RSS** Using Bayes theorem $P(A|B) = P(B|A)~\dfrac{P(A)}{P(B)}$ we can also see that ## $P(\theta | \lbrace y_i \rbrace, \lbrace x_i \rbrace) = P(\lbrace y_i \rbrace | \lbrace x_i \rbrace, \theta) ~ \frac{p(\theta)}{p(y_i)}$ Therefore, this is also the **maximum a posteriori (MAP)** estimator assuming a flat prior for $\theta$. ## Online estimation This figure illustrates how the uncertainties in the parameters shrink as the number of observations grow. ### Diabetes dataset example (https://scikit-learn.org/stable/auto_examples/linear_model/plot_ols.html#sphx-glr-auto-examples-linear-model-plot-ols-py) We want to try and figure out how bmi affects how sick the person is after one year. ```python import matplotlib.pyplot as plt import numpy as np from sklearn import datasets, linear_model from sklearn.metrics import mean_squared_error, r2_score # Load the diabetes dataset diabetes = datasets.load_diabetes() print(diabetes.DESCR) ``` .. _diabetes_dataset: Diabetes dataset ---------------- Ten baseline variables, age, sex, body mass index, average blood pressure, and six blood serum measurements were obtained for each of n = 442 diabetes patients, as well as the response of interest, a quantitative measure of disease progression one year after baseline. **Data Set Characteristics:** :Number of Instances: 442 :Number of Attributes: First 10 columns are numeric predictive values :Target: Column 11 is a quantitative measure of disease progression one year after baseline :Attribute Information: - age age in years - sex - bmi body mass index - bp average blood pressure - s1 tc, total serum cholesterol - s2 ldl, low-density lipoproteins - s3 hdl, high-density lipoproteins - s4 tch, total cholesterol / HDL - s5 ltg, possibly log of serum triglycerides level - s6 glu, blood sugar level Note: Each of these 10 feature variables have been mean centered and scaled by the standard deviation times `n_samples` (i.e. the sum of squares of each column totals 1). Source URL: https://www4.stat.ncsu.edu/~boos/var.select/diabetes.html For more information see: Bradley Efron, Trevor Hastie, Iain Johnstone and Robert Tibshirani (2004) "Least Angle Regression," Annals of Statistics (with discussion), 407-499. (https://web.stanford.edu/~hastie/Papers/LARS/LeastAngle_2002.pdf) ```python # Use only one feature (body mass index) diabetes_X = diabetes.data[:, np.newaxis, 2] # axis 2 = bmi # Split the data into training/testing sets diabetes_X_train = diabetes_X[:-20] # last 20 points diabetes_X_test = diabetes_X[-20:] # we put them into the test set # Split the targets into training/testing sets accordingly diabetes_y_train = diabetes.target[:-20] diabetes_y_test = diabetes.target[-20:] # Create linear regression object regr = linear_model.LinearRegression() # Train the model using the training sets regr.fit(diabetes_X_train, diabetes_y_train) # Make predictions using the testing set diabetes_y_pred = regr.predict(diabetes_X_test) # The coefficients print('Coefficients: \n', regr.coef_) # The mean squared error print("Mean squared error (MSE): %.2f" % mean_squared_error(diabetes_y_test, diabetes_y_pred)) # Explained variance score: 1 is perfect prediction print('Variance score (coefficient of determination, R2): %.2f' % r2_score(diabetes_y_test, diabetes_y_pred)) ``` Coefficients: [938.23786125] Mean squared error (MSE): 2548.07 Variance score (coefficient of determination, R2): 0.47 ```python fig, ax = plt.subplots(figsize = (11, 7)) ax.scatter(diabetes_X_test, diabetes_y_test, c='k') ax.scatter(diabetes_X_train, diabetes_y_train, c='gray', alpha=0.3) ax.plot(diabetes_X_test, diabetes_y_pred, color=blue, linewidth=3) ax.set_xlabel("BMI (scaled)") ax.set_ylabel("Diabetes disease progression") ``` ## 3. Least squares in matrix form The previous equations can be derived in matrix form In general one can define regression in terms of a design matrix $M$: ## $y = {\bf M} ~ \theta$ where $y$ is the $N$–dimensional vector of values $y_i$. ## $y = \begin{bmatrix} y_0 \\ y_1 \\ . \\ y_{N-1} \end{bmatrix}$ For straight--line regression, $\theta$ is a two--dimensional vector: ## $\theta = \begin{bmatrix} \theta_0 \\ \theta_1 \end{bmatrix}$ and $M$ is a $2 \times N$ matrix: ## ${\bf M} = \begin{bmatrix} 1 & x_0 \\ 1 & x_1 \\ ... & ... \\ 1 & x_{N-1} \\ \end{bmatrix}$ For the case of heteroscedastic (different) uncertainties, we can define the covariance matrix $C$: ## $ C = \begin{bmatrix} \sigma_0^2 & 0 & . & 0 \\ 0 & \sigma_1^2 & . & 0 \\ . & . & . & . \\ 0 & 0 & . & \sigma_{N - 1}^2\\ \end{bmatrix}$ The MLE solution for this regression is: ## ${\bf \hat{\theta}} = ({\bf M}^T C^{-1} {\bf M})^{-1} ({\bf M}^T C^{-1} {\bf y})$ which is the also the solution that minimizes the equation ## $({\bf y} - {\bf M} ~ \theta)^{-1} C^{-1} ({\bf y} - {\bf M} ~ \theta)$ The uncertainties on the regression coefficients $\bf \theta$ can be expressed as the following matrix (general case): ## $\Sigma_\theta = \begin{bmatrix} \sigma_{\theta_0}^2 & \dots & \sigma_{\theta_0 \theta_i} & \dots \\ \vdots & \ddots & \vdots & \vdots \\ \sigma_{\theta_0 \theta_i} & \dots & \sigma_{\theta_i}^2 \\ \vdots & \vdots & \vdots & \ddots \\ \end{bmatrix} = [{\bf M}^T C^{-1} {\bf M}]^{-1}$ Values outside of the diagonal appear when they are not fully independent. In the general case, $C$ can be non--diagonal too, which indicates correlated noise. We can extend it to... ## 4. Polynomial regression Let us consider the case where we perform a polynomial representation of the data, e.g.: ## $y_i = \theta_0 + \theta_1 x_i + \theta_2 x_i^2 + \theta_3 x_i^3$ In this case the design matrix $M$ becomes: ## $ M = \begin{bmatrix} 1 & x_0 & x_0^2 & x_0^3 \\ 1 & x_1 & x_1^2 & x_1^3 \\ . & . & . & . \\ 1 & x_N & x_N^2 & x_N^3 \\ \end{bmatrix}$ And the previous formulae can be used to find the least squares solution since the coefficients are linear # Regularization Sometimes we may want to trade an increase in bias for a reduction in variance (e.g. if the matrix $M$ is ill-conditioned the variance could be very large) ## 1. Ridge regression In this case we include the following regularization term in the least squares equation: ## $({\bf y} - M~ \theta)^{-1} C^{-1}({\bf y} - M~ \theta) + \lambda~ |\theta^T \theta|$ $\lambda$ is called the **regularization or smoothing parameter** and **$|\theta^T \theta|$** is called the **penalty function** It can be shown that the new solution will be: ## ${\bf \hat{\theta}} = ({\bf M}^T C^{-1} {\bf M} + \lambda I)^{-1} ({\bf M}^T C^{-1} {\bf y})$ It is worth noting that even if $M^T C^{-1} M$ were singular, $M^T C^{-1} M + \lambda I$ may not be singular => $\lambda$ wants $\theta$ to have elements with less variance "Continuous" ### Bayes equivalent In the Bayesian approach, it can be shown that the MAP solution is the same as the ridge solution if we assume a Gaussian prior for the parameters $\theta$: ## $ p(\theta) \propto \exp \biggl( \frac{- \lambda (\theta^T \theta)}{2} \biggr)$ Ridge regression effectively constrains the norm of the parameters $\theta$: ## $|{\bf \theta}|^2 < s$ ## 2. LASSO regression Another common regularization technique In this case we include a different regularization term in the least squares equation: ## $({\bf y} - \theta {\bf X})^{-1}({\bf y} - \theta {\bf X}) + \lambda |\theta|$ Now we use the $\ell_1$ norm instead of the $\ell_2$ norm. In this case there is no closed form, but it can be shown that the MAP solution is the same if an exponential prior for the parameters $\theta$ is assumed. LASSO regression effectively constrains the $\ell_1$ norm of the parameters $\theta$: ## $|{\bf \theta}| < s$ => $\lambda$ wants $\theta$ to have less elements "Discrete" ### Understanding Ridge and LASSO regression # Comparison between ordinary, Ridge and LASSO regression ```python from sklearn import linear_model X_train = np.c_[.5, 1].T y_train = [.5, 1] X_test = np.c_[0, 2].T np.random.seed(0) classifiers = dict(ols=linear_model.LinearRegression(), ridge=linear_model.Ridge(alpha=.05), lasso=linear_model.Lasso(alpha=.02)) for name, clf in classifiers.items(): fig, ax = plt.subplots(figsize=(4, 3)) for _ in range(6): this_X = .1 * np.random.normal(size=(2, 1)) + X_train clf.fit(this_X, y_train) ax.plot(X_test, clf.predict(X_test), color='gray') ax.scatter(this_X, y_train, s=3, c='gray', marker='o', zorder=10) clf.fit(X_train, y_train) ax.plot(X_test, clf.predict(X_test), linewidth=2, color=blue) ax.scatter(X_train, y_train, s=30, c=red, marker='+', zorder=10) ax.set_title(name) ax.set_xlim(0, 2) ax.set_ylim((0, 1.6)) ax.set_xlabel('X') ax.set_ylabel('y') fig.tight_layout() plt.show() ``` ## Choosing the regularization parameter $\lambda$ One way to choose $\lambda$ is to do k-fold cross-validation on $\lambda$, defining the error: ## $ Err(\lambda) = k^{1} \sum_k N_k^{-1} \sum\limits_{i}^{N_k} \frac{[y_i - f(x_i | \theta)]^2}{\sigma_i^2}$ and then choose the $\lambda$ with the smallest error. # Outliers ## Huber loss The Huber estimator minimizes ### $ \sum\limits_{i=1}^N e(y_i|y)$ where $e(y_i|y)$ is modeled as: ### $\begin{equation} \phi(t)=\left\{ \begin{array}{@{}ll@{}} \frac{1}{2} t^2, & \text{if}\ |t|\le c \\ c|t| - \frac{1}{2} c^2, & \text{otherwise} \end{array}\right. \end{equation}$ With $t = y_i - \hat{y}_i$ c is a new parameter If it's close to the line, it is treated as a Gaussian. If it is far, as an exponencial. ## Bayesian Outlier Methods Alternative to the Huber loss, we can modify the likelihood function by assuming a mixture model, where some points belong to an outlier distribution, which is modeled as a Gaussian with mean $\mu_b$ and variance $V_b$, and others belong to the main population, which follow the linear model. 1. Assume that the probability of belonging to the outlier population is $p_b$ 2. Assume that each point can be tagged as either outlier ($g_i = 0$) or not ($g_i = 1$) ```python ``` ```python from sklearn.datasets import make_regression from sklearn.linear_model import HuberRegressor, Ridge # Generate toy data. rng = np.random.RandomState(0) X, y = make_regression(n_samples=20, n_features=1, random_state=0, noise=4.0, bias=100.0) # Add four strong outliers to the dataset. X_outliers = rng.normal(0, 0.5, size=(4, 1)) y_outliers = rng.normal(0, 2.0, size=4) X_outliers[:2, :] += X.max() + X.mean() / 4. X_outliers[2:, :] += X.min() - X.mean() / 4. y_outliers[:2] += y.min() - y.mean() / 4. y_outliers[2:] += y.max() + y.mean() / 4. X = np.vstack((X, X_outliers)) y = np.concatenate((y, y_outliers)) plt.plot(X, y, 'b.') # Fit the huber regressor over a series of epsilon values. colors = ['r-', 'b-', 'y-', 'm-'] x = np.linspace(X.min(), X.max(), 7) epsilon_values = [1.35, 1.5, 1.75, 1.9] for k, epsilon in enumerate(epsilon_values): huber = HuberRegressor(fit_intercept=True, alpha=0.0, max_iter=100, epsilon=epsilon) huber.fit(X, y) coef_ = huber.coef_ * x + huber.intercept_ plt.plot(x, coef_, colors[k], label="huber loss, %s" % epsilon) # Fit a ridge regressor to compare it to huber regressor. ridge = Ridge(fit_intercept=True, alpha=0.0, random_state=0, normalize=True) ridge.fit(X, y) coef_ridge = ridge.coef_ coef_ = ridge.coef_ * x + ridge.intercept_ plt.plot(x, coef_, 'g-', label="ridge regression") plt.title("Comparison of HuberRegressor vs Ridge") plt.xlabel("X") plt.ylabel("y") plt.legend(loc=0) plt.show() ``` # Cross-Validation Testing Analogous to the classification problem, one can also do cross-validation during regression to determine the best hyperparameters. For example, choosing the regularization parameter for ridge or lasso regression, or choosing the polynomial degree of a polynomial fit. => **how to know when to stop increasing the degree of the polynomial?** We want to get close to the data points, but not EXACTLY. We want the underlying distribution, not get this specific set. We want to be somewhere in the good range that makes it better for both sets. ```python ```
module FreeRTOS.Task.Utils import FreeRTOS.Task.Control %default total %include C "FreeRTOS.h" %include C "task.h" ||| The handle of the currently running (calling) task. getCurrentTaskTID : IO TID getCurrentTaskTID = do ptr <- foreign FFI_C "xTaskGetCurrentTaskHandle" (IO Ptr) pure (MkTID ptr) ||| The task handle associated with the Idle task. getIdleTaskHandle : IO TID getIdleTaskHandle = do ptr <- foreign FFI_C "xTaskGetIdleTaskHandle" (IO Ptr) pure (MkTID ptr) ||| Looks up the name of a task from the task’s handle. getName : TID -> IO String getName (MkTID ptr) = foreign FFI_C "pcTaskGetName" (Ptr -> IO String) ptr ||| The number of tasks that the RTOS kernel is currently managing. getNbrTasks : IO Int getNbrTasks = foreign FFI_C "uxTaskGetNumberOfTasks" (IO Int)
import Criterion.Main import Criterion.Types import Dimacs (parseDIMACSFromFile) import Internal.Sat (solveDIMACS) import Sat (solve) import Statistics.Types import Test.HUnit solveFile :: String -> Bool -> IO () solveFile fileName isSat = do parsed <- parseDIMACSFromFile ("resources/problems/" ++ fileName) case parsed of Right dimacs -> do case solveDIMACS dimacs of Just _ -> assertBool "" isSat Nothing -> assertBool "" (not isSat) return () left -> assertFailure $ "" ++ fileName ++ "cannot be parsed" main :: IO () main = Criterion.Main.defaultMainWith (defaultConfig {timeLimit = 30}) [ bgroup "sat tests" [ benchit "add4.cnf" False, benchit "diamond1.cnf" False, benchit "diamond2.cnf" False, benchit "diamond3.cnf" False, benchit "ph2.cnf" False, benchit "ph3.cnf" False, benchit "prime4.cnf" True, benchit "prime9.cnf" True, benchit "prime25.cnf" True, benchit "prime49.cnf" True, benchit "prime121.cnf" True ] ] where benchit fileName isSat = bench fileName $ whnfIO $ solveFile fileName isSat
[STATEMENT] lemma ab_obey_2[PLM]: "[(\<lparr>A!,x\<^sup>P\<rparr> \<^bold>& \<lparr>A!,y\<^sup>P\<rparr>) \<^bold>\<rightarrow> ((\<^bold>\<exists> F . \<lbrace>x\<^sup>P, F\<rbrace> \<^bold>& \<^bold>\<not>\<lbrace>y\<^sup>P, F\<rbrace>) \<^bold>\<rightarrow> x\<^sup>P \<^bold>\<noteq> y\<^sup>P) in v]" [PROOF STATE] proof (prove) goal (1 subgoal): 1. [\<lparr>A!,x\<^sup>P\<rparr> \<^bold>& \<lparr>A!,y\<^sup>P\<rparr> \<^bold>\<rightarrow> ((\<^bold>\<exists>F. \<lbrace>x\<^sup>P,F\<rbrace> \<^bold>& \<^bold>\<not>\<lbrace>y\<^sup>P,F\<rbrace>) \<^bold>\<rightarrow> x\<^sup>P \<^bold>\<noteq> y\<^sup>P) in v] [PROOF STEP] proof(rule CP; rule CP) [PROOF STATE] proof (state) goal (1 subgoal): 1. \<lbrakk>[\<lparr>A!,x\<^sup>P\<rparr> \<^bold>& \<lparr>A!,y\<^sup>P\<rparr> in v]; [\<^bold>\<exists>F. \<lbrace>x\<^sup>P,F\<rbrace> \<^bold>& \<^bold>\<not>\<lbrace>y\<^sup>P,F\<rbrace> in v]\<rbrakk> \<Longrightarrow> [x\<^sup>P \<^bold>\<noteq> y\<^sup>P in v] [PROOF STEP] assume abs_xy: "[\<lparr>A!,x\<^sup>P\<rparr> \<^bold>& \<lparr>A!,y\<^sup>P\<rparr> in v]" [PROOF STATE] proof (state) this: [\<lparr>A!,x\<^sup>P\<rparr> \<^bold>& \<lparr>A!,y\<^sup>P\<rparr> in v] goal (1 subgoal): 1. \<lbrakk>[\<lparr>A!,x\<^sup>P\<rparr> \<^bold>& \<lparr>A!,y\<^sup>P\<rparr> in v]; [\<^bold>\<exists>F. \<lbrace>x\<^sup>P,F\<rbrace> \<^bold>& \<^bold>\<not>\<lbrace>y\<^sup>P,F\<rbrace> in v]\<rbrakk> \<Longrightarrow> [x\<^sup>P \<^bold>\<noteq> y\<^sup>P in v] [PROOF STEP] assume "[\<^bold>\<exists> F . \<lbrace>x\<^sup>P, F\<rbrace> \<^bold>& \<^bold>\<not>\<lbrace>y\<^sup>P, F\<rbrace> in v]" [PROOF STATE] proof (state) this: [\<^bold>\<exists>F. \<lbrace>x\<^sup>P,F\<rbrace> \<^bold>& \<^bold>\<not>\<lbrace>y\<^sup>P,F\<rbrace> in v] goal (1 subgoal): 1. \<lbrakk>[\<lparr>A!,x\<^sup>P\<rparr> \<^bold>& \<lparr>A!,y\<^sup>P\<rparr> in v]; [\<^bold>\<exists>F. \<lbrace>x\<^sup>P,F\<rbrace> \<^bold>& \<^bold>\<not>\<lbrace>y\<^sup>P,F\<rbrace> in v]\<rbrakk> \<Longrightarrow> [x\<^sup>P \<^bold>\<noteq> y\<^sup>P in v] [PROOF STEP] then [PROOF STATE] proof (chain) picking this: [\<^bold>\<exists>F. \<lbrace>x\<^sup>P,F\<rbrace> \<^bold>& \<^bold>\<not>\<lbrace>y\<^sup>P,F\<rbrace> in v] [PROOF STEP] obtain P where P_prop: "[\<lbrace>x\<^sup>P, P\<rbrace> \<^bold>& \<^bold>\<not>\<lbrace>y\<^sup>P, P\<rbrace> in v]" [PROOF STATE] proof (prove) using this: [\<^bold>\<exists>F. \<lbrace>x\<^sup>P,F\<rbrace> \<^bold>& \<^bold>\<not>\<lbrace>y\<^sup>P,F\<rbrace> in v] goal (1 subgoal): 1. (\<And>P. [\<lbrace>x\<^sup>P,P\<rbrace> \<^bold>& \<^bold>\<not>\<lbrace>y\<^sup>P,P\<rbrace> in v] \<Longrightarrow> thesis) \<Longrightarrow> thesis [PROOF STEP] by (rule "\<^bold>\<exists>E") [PROOF STATE] proof (state) this: [\<lbrace>x\<^sup>P,P\<rbrace> \<^bold>& \<^bold>\<not>\<lbrace>y\<^sup>P,P\<rbrace> in v] goal (1 subgoal): 1. \<lbrakk>[\<lparr>A!,x\<^sup>P\<rparr> \<^bold>& \<lparr>A!,y\<^sup>P\<rparr> in v]; [\<^bold>\<exists>F. \<lbrace>x\<^sup>P,F\<rbrace> \<^bold>& \<^bold>\<not>\<lbrace>y\<^sup>P,F\<rbrace> in v]\<rbrakk> \<Longrightarrow> [x\<^sup>P \<^bold>\<noteq> y\<^sup>P in v] [PROOF STEP] { [PROOF STATE] proof (state) this: [\<lbrace>x\<^sup>P,P\<rbrace> \<^bold>& \<^bold>\<not>\<lbrace>y\<^sup>P,P\<rbrace> in v] goal (1 subgoal): 1. \<lbrakk>[\<lparr>A!,x\<^sup>P\<rparr> \<^bold>& \<lparr>A!,y\<^sup>P\<rparr> in v]; [\<^bold>\<exists>F. \<lbrace>x\<^sup>P,F\<rbrace> \<^bold>& \<^bold>\<not>\<lbrace>y\<^sup>P,F\<rbrace> in v]\<rbrakk> \<Longrightarrow> [x\<^sup>P \<^bold>\<noteq> y\<^sup>P in v] [PROOF STEP] assume "[x\<^sup>P \<^bold>= y\<^sup>P in v]" [PROOF STATE] proof (state) this: [x\<^sup>P \<^bold>= y\<^sup>P in v] goal (1 subgoal): 1. \<lbrakk>[\<lparr>A!,x\<^sup>P\<rparr> \<^bold>& \<lparr>A!,y\<^sup>P\<rparr> in v]; [\<^bold>\<exists>F. \<lbrace>x\<^sup>P,F\<rbrace> \<^bold>& \<^bold>\<not>\<lbrace>y\<^sup>P,F\<rbrace> in v]\<rbrakk> \<Longrightarrow> [x\<^sup>P \<^bold>\<noteq> y\<^sup>P in v] [PROOF STEP] hence "[\<lbrace>x\<^sup>P, P\<rbrace> \<^bold>\<equiv> \<lbrace>y\<^sup>P, P\<rbrace> in v]" [PROOF STATE] proof (prove) using this: [x\<^sup>P \<^bold>= y\<^sup>P in v] goal (1 subgoal): 1. [\<lbrace>x\<^sup>P,P\<rbrace> \<^bold>\<equiv> \<lbrace>y\<^sup>P,P\<rbrace> in v] [PROOF STEP] using l_identity[axiom_instance, deduction, deduction] oth_class_taut_4_a [PROOF STATE] proof (prove) using this: [x\<^sup>P \<^bold>= y\<^sup>P in v] \<lbrakk>[?\<alpha>3 \<^bold>= ?\<beta>3 in ?v]; [?\<phi>3 ?\<alpha>3 in ?v]\<rbrakk> \<Longrightarrow> [?\<phi>3 ?\<beta>3 in ?v] [?\<phi> \<^bold>\<equiv> ?\<phi> in ?v] goal (1 subgoal): 1. [\<lbrace>x\<^sup>P,P\<rbrace> \<^bold>\<equiv> \<lbrace>y\<^sup>P,P\<rbrace> in v] [PROOF STEP] by fast [PROOF STATE] proof (state) this: [\<lbrace>x\<^sup>P,P\<rbrace> \<^bold>\<equiv> \<lbrace>y\<^sup>P,P\<rbrace> in v] goal (1 subgoal): 1. \<lbrakk>[\<lparr>A!,x\<^sup>P\<rparr> \<^bold>& \<lparr>A!,y\<^sup>P\<rparr> in v]; [\<^bold>\<exists>F. \<lbrace>x\<^sup>P,F\<rbrace> \<^bold>& \<^bold>\<not>\<lbrace>y\<^sup>P,F\<rbrace> in v]\<rbrakk> \<Longrightarrow> [x\<^sup>P \<^bold>\<noteq> y\<^sup>P in v] [PROOF STEP] hence "[\<lbrace>y\<^sup>P, P\<rbrace> in v]" [PROOF STATE] proof (prove) using this: [\<lbrace>x\<^sup>P,P\<rbrace> \<^bold>\<equiv> \<lbrace>y\<^sup>P,P\<rbrace> in v] goal (1 subgoal): 1. [\<lbrace>y\<^sup>P,P\<rbrace> in v] [PROOF STEP] using P_prop[conj1] [PROOF STATE] proof (prove) using this: [\<lbrace>x\<^sup>P,P\<rbrace> \<^bold>\<equiv> \<lbrace>y\<^sup>P,P\<rbrace> in v] [\<lbrace>x\<^sup>P,P\<rbrace> in v] goal (1 subgoal): 1. [\<lbrace>y\<^sup>P,P\<rbrace> in v] [PROOF STEP] by (rule "\<^bold>\<equiv>E") [PROOF STATE] proof (state) this: [\<lbrace>y\<^sup>P,P\<rbrace> in v] goal (1 subgoal): 1. \<lbrakk>[\<lparr>A!,x\<^sup>P\<rparr> \<^bold>& \<lparr>A!,y\<^sup>P\<rparr> in v]; [\<^bold>\<exists>F. \<lbrace>x\<^sup>P,F\<rbrace> \<^bold>& \<^bold>\<not>\<lbrace>y\<^sup>P,F\<rbrace> in v]\<rbrakk> \<Longrightarrow> [x\<^sup>P \<^bold>\<noteq> y\<^sup>P in v] [PROOF STEP] } [PROOF STATE] proof (state) this: [x\<^sup>P \<^bold>= y\<^sup>P in v] \<Longrightarrow> [\<lbrace>y\<^sup>P,P\<rbrace> in v] goal (1 subgoal): 1. \<lbrakk>[\<lparr>A!,x\<^sup>P\<rparr> \<^bold>& \<lparr>A!,y\<^sup>P\<rparr> in v]; [\<^bold>\<exists>F. \<lbrace>x\<^sup>P,F\<rbrace> \<^bold>& \<^bold>\<not>\<lbrace>y\<^sup>P,F\<rbrace> in v]\<rbrakk> \<Longrightarrow> [x\<^sup>P \<^bold>\<noteq> y\<^sup>P in v] [PROOF STEP] thus "[x\<^sup>P \<^bold>\<noteq> y\<^sup>P in v]" [PROOF STATE] proof (prove) using this: [x\<^sup>P \<^bold>= y\<^sup>P in v] \<Longrightarrow> [\<lbrace>y\<^sup>P,P\<rbrace> in v] goal (1 subgoal): 1. [x\<^sup>P \<^bold>\<noteq> y\<^sup>P in v] [PROOF STEP] using P_prop[conj2] modus_tollens_1 CP [PROOF STATE] proof (prove) using this: [x\<^sup>P \<^bold>= y\<^sup>P in v] \<Longrightarrow> [\<lbrace>y\<^sup>P,P\<rbrace> in v] [\<^bold>\<not>\<lbrace>y\<^sup>P,P\<rbrace> in v] \<lbrakk>[?\<phi> \<^bold>\<rightarrow> ?\<psi> in ?v]; [\<^bold>\<not>?\<psi> in ?v]\<rbrakk> \<Longrightarrow> [\<^bold>\<not>?\<phi> in ?v] ([?\<phi> in ?v] \<Longrightarrow> [?\<psi> in ?v]) \<Longrightarrow> [?\<phi> \<^bold>\<rightarrow> ?\<psi> in ?v] goal (1 subgoal): 1. [x\<^sup>P \<^bold>\<noteq> y\<^sup>P in v] [PROOF STEP] by blast [PROOF STATE] proof (state) this: [x\<^sup>P \<^bold>\<noteq> y\<^sup>P in v] goal: No subgoals! [PROOF STEP] qed
module overlap_backend implicit none double precision, parameter :: zero = 0.0d0 double precision, parameter :: half = 0.5d0 double precision, parameter :: one = 1.0d0 double precision, parameter :: two = 2.0d0 ! Use this constant instead of global, because of compatibility with MNDO etc double precision, parameter :: AU_TO_EV = 27.21d0 ! contains the factorials of i-1 double precision, parameter :: fc(1:25) =& (/ 1.0d0,1.0d0, 2.0d0, 6.0d0, 24.0d0, & 120.0d0, 720.0d0, 5040.0d0, 40320.0d0, 362880.0d0, & 3628800.0d0, 39916800.0d0, 4.790016d+08, 6.2270208d+09, 8.71782912d+10, & 1.307674368d+12, 2.092278989d+13, 3.55687428096d+14, 6.402373705728d+15, 1.21645100408832d+17, & 2.43290200817664d+18, 5.109094217170944d+19, 1.12400072777760768d+21, 2.585201673888497664d+22, & 6.2044840173323943936d+23 /) double precision, parameter :: logfc(1:25) = (/ 0.0d0, 0.0d0, 0.6931471805599d0, & & 1.7917594692281d0, 3.1780538303479d0, 4.7874917427820d0, & & 6.5792512120101d0, 8.5251613610654d0, 10.6046029027453d0, & & 12.8018274800815d0, 15.1044125730755d0, 17.5023078458739d0, & & 19.9872144956619d0, 22.5521638531234d0, 25.1912211827387d0, & & 27.8992713838409d0, 30.6718601061763d0, 33.5050734501369d0, & & 36.3954452080331d0, 39.3398841871995d0, 42.3356164607535d0, & & 45.3801388984769d0, 48.4711813518352d0, 51.6066755677644d0, & & 54.7847293981123d0 /) ! define c coefficients for associate legendre polynomials. double precision, parameter::cc(1:21,1:3) = reshape ( (/ & 8.0d0, 8.0d0, 4.0d0, -4.0d0, 4.0d0, & 4.0d0, -12.0d0, -6.0d0, 20.0d0, 5.0d0, & 3.0d0, -30.0d0, -10.0d0, 35.0d0, 7.0d0, & 15.0d0, 7.5d0, -70.0d0, -17.5d0, 63.0d0, & 10.5d0, & 0.0d0, 0.0d0, 0.0d0, 12.0d0, 0.0d0, & 0.0d0, 20.0d0, 30.0d0, 0.0d0, 0.0d0, & -30.0d0, 70.0d0, 70.0d0, 0.0d0, 0.0d0, & -70.0d0, -105.d0, 210.0d0, 157.5d0, 0.0d0, & 0.0d0, & 0.0d0, 0.0d0, 0.0d0, 0.0d0, 0.0d0, & 0.0d0, 0.0d0, 0.0d0, 0.0d0, 0.0d0, & 35.0d0, 0.0d0, 0.0d0, 0.0d0, 0.0d0, & 63.0d0, 157.5d0, 0.0d0, 0.0d0, 0.0d0, & 0.0d0/), (/ 21, 3 /) ) double precision, save::A(15),B(15) ! Constants ! THE ARRAY B0(I) CONTAINS THE B INTEGRALS FOR ZERO ARGUMENT. double precision, parameter :: B0(1:15)= & & (/ 2.0D0,0.0D0,0.666666666666667D0,0.0D0,0.4D0,0.0D0, & & 0.285714285714286D0,0.0D0,0.222222222222222D0,0.0D0, & & 0.181818181818182D0,0.0D0,0.153846153846154D0,0.0D0, & & 0.133333333333333D0 /) ! define addresses for index pairs (00,10,20,30,40,50,60,70). integer,parameter:: iad(1:8)= (/ 1,2,4,7,11,16,22,29 /) ! define binomial coefficients (00,10,11,20,...,77). integer,parameter:: ibinom(1:36)= (/& & 1,1,1,1,2,1,1,3,3,1,1,4,6,4,1,1,5,10,10,5,1, & & 1,6,15,20,15,6,1,1,7,21,35,35,21,7,1 /) contains function binomialcoefficient(m, n) result (biocoeff) integer, intent(in)::m,n double precision::biocoeff integer, parameter::size=30 integer, save::bc(size,size)=0 logical, save::initialized=.false.; integer::i,j,k if (.not.initialized) then do i=1,size bc(i,1)=one bc(i,2:size)=zero end do do i=2, size do j=2, i bc(i,j)=bc(i-1,j-1)+bc(i-1,j) end do end do initialized=.true. end if biocoeff=one*bc(m,n) end function binomialcoefficient function getslateroverlap(na, la, nb, lb, mm, zeta_a, zeta_b, rab) result (overlap) implicit none integer, intent(in)::na, la, nb, lb, mm double precision, intent(in)::zeta_a,zeta_b, rab double precision::overlap ! local variables integer, save::ntotal=-1 double precision, save:: zeta_a_old=-1.0d99, zeta_b_old=-1.0d99 double precision, save:: rab_old=-1.0d99 double precision, parameter:: tolerance=1.d0-16 logical::resetup if ((la.ge.na) .or. (lb.ge.nb)) then overlap=0.d0 return end if resetup=.true. if (ntotal.eq. (na+nb)) then if (abs(rab_old/rab-1.d0)< tolerance) then if (abs(zeta_a_old/zeta_a-1.d0) < tolerance) then if (abs(zeta_b_old/zeta_b-1.d0) < tolerance) then resetup=.false. end if end if end if end if if (resetup) then ntotal=(na+nb) rab_old=rab zeta_a_old=zeta_a zeta_b_old=zeta_b call setupslaterauxiliary(ntotal, zeta_a, zeta_b, rab) end if overlap=calculateoverlap (na,la,mm,nb,lb,zeta_a*rab,zeta_b*rab) end function getslateroverlap subroutine setupslaterauxiliary(n,sa,sb,rab) ! * ! calculation of auxiliary integrals for sto overlaps. ! * implicit double precision (a-h,o-z) implicit integer (i-n) !explicit type to satisfy pgi v8 compiler double precision betpow(17) ! *** initialization. alpha = 0.5d0*rab*(sa+sb) beta = 0.5d0*rab*(sa-sb) ! *** auxiliary a integrals for calculation of overlaps. c = exp(-alpha) ralpha = 1.0d0/alpha a(1) = c*ralpha do i=1,n a(i+1) = (a(i)*i+c)*ralpha end do ! *** auxiliary b integrals for calculation of overlaps. ! the code is valid only for n.le.14, i.e. for overlaps ! involving orbitals with main quantum numbers up to 7. ! branching depending on absolute value of the argument. absx = abs(beta) ! zero argument. if(absx.lt.1.0d-06) then do i=1,n+1 b(i) = b0(i) enddo return endif ! large argument. if((absx.gt.0.5d0 .and. n.le.5) .or. & & (absx.gt.1.0d0 .and. n.le.7) .or. & & (absx.gt.2.0d0 .and. n.le.10).or. & & absx.gt.3.0d0) then expx = exp(beta) expmx = 1.0d0/expx rx = 1.0d0/beta b(1) = (expx-expmx)*rx do i=1,n expx = -expx b(i+1)= (i*b(i)+expx-expmx)*rx enddo return endif ! small argument. if(absx.le.0.5d0) then last = 6 else if(absx.le.1.0d0) then last = 7 else if(absx.le.2.0d0) then last = 12 else last = 15 endif betpow(1) = 1.0d0 do m=1,last betpow(m+1) = -beta*betpow(m) enddo do i=1,n+1 y = 0.0d0 ma = 1-mod(i,2) do m=ma,last,2 y = y+betpow(m+1)/(fc(m+1)*(m+i)) enddo b(i) = y*2.0d0 enddo return end subroutine setupslaterauxiliary function calculateoverlap (na,la,mm,nb,lb,alpha,beta) ! * ! overlap integrals between slater type orbitals. ! * ! quantum numbers (na,la,mm) and (nb,lb,mm). ! na and nb must be positive and less than or equal to 7. ! la, lb and abs(mm) must be less than or equal to 5. ! further restrictions are la.le.na, lb.le.nb, ! mm.le.la, and mm.le.lb. ! * implicit double precision (a-h,o-z) implicit integer (i-n) ! *** initialization. m = abs(mm) nab = na+nb+1 x = 0.0d0 ! *** find a and b integrals. ! p = (alpha + beta)*0.5 ! pt = (alpha - beta)*0.5 ! call aintgs(a,p,na+nb) ! call bintgs(b,pt,na+nb) ! *** section used for overlap integrals involving s functions. if((la.gt.0).or.(lb.gt.0)) go to 20 iada = iad(na+1) iadb = iad(nb+1) do 10 i=0,na iba = ibinom(iada+i) do 10 j=0,nb ibb = iba*ibinom(iadb+j) if(mod(j,2).eq.1) ibb=-ibb ij = i+j x = x+ibb*a(nab-ij)*b(ij+1) 10 continue ss = x * 0.5d0 ss = ss * sqrt( alpha**(2*na+1)*beta**(2*nb+1)/ & & (fc(2*na+1)*fc(2*nb+1)) ) calculateoverlap = ss return ! *** section used for overlap integrals involving p functions. ! *** special case m=0, s-p(sigma), p(sigma)-s, p(sigma)-p(sigma). 20 if(la.gt.1 .or. lb.gt.1) go to 320 if(m.gt.0) go to 220 iu = mod(la,2) iv = mod(lb,2) namu = na-iu nbmv = nb-iv iadna = iad(namu+1) iadnb = iad(nbmv+1) do 130 kc=0,iu ic = nab-iu-iv+kc jc = 1+kc do 130 kd=0,iv id = ic+kd jd = jc+kd do 130 ke=0,namu ibe = ibinom(iadna+ke) ie = id-ke je = jd+ke do 130 kf=0,nbmv ibf = ibe*ibinom(iadnb+kf) if(mod(kd+kf,2).eq.1) ibf=-ibf x = x+ibf*a(ie-kf)*b(je+kf) 130 continue ss = x * sqrt( (2*la+1)*(2*lb+1)*0.25d0 ) ! compute overlap integral from reduced overlap integral. ss = ss * sqrt( alpha**(2*na+1)*beta**(2*nb+1)/ & & (fc(2*na+1)*fc(2*nb+1)) ) if(mod(lb,2).eq.1) ss=-ss calculateoverlap = ss return ! *** section used for overlap integrals involving p functions. ! *** special case la=lb=m=1, p(pi)-p(pi). 220 iadna = iad(na) iadnb = iad(nb) do 230 ke=0,na-1 ibe = ibinom(iadna+ke) ie = nab-ke je = ke+1 do 230 kf=0,nb-1 ibf = ibe*ibinom(iadnb+kf) if(mod(kf,2).eq.1) ibf=-ibf i = ie-kf j = je+kf x = x+ibf*(a(i)*b(j)-a(i)*b(j+2)-a(i-2)*b(j)+a(i-2)*b(j+2)) 230 continue ss = x * 0.75d0 ! compute overlap integral from reduced overlap integral. ss = ss * sqrt( alpha**(2*na+1)*beta**(2*nb+1)/ & & (fc(2*na+1)*fc(2*nb+1)) ) if(mod(lb+mm,2).eq.1) ss=-ss calculateoverlap = ss return ! *** section used for overlap integrals involving non-s functions. ! *** general case la.gt.1 or lb.gt.1, m.ge.0. 320 lam = la-m lbm = lb-m iada = iad(la+1)+m iadb = iad(lb+1)+m iadm = iad(m+1) iu1 = mod(lam,2) iv1 = mod(lbm,2) iuc = 0 do 340 iu=iu1,lam,2 iuc = iuc+1 cu = cc(iada,iuc) namu = na-m-iu iadna = iad(namu+1) iadu = iad(iu+1) ivc = 0 do 340 iv=iv1,lbm,2 ivc = ivc+1 nbmv = nb-m-iv iadnb = iad(nbmv+1) iadv = iad(iv+1) sum = 0.0d0 do 330 kc=0,iu ibc = ibinom(iadu+kc) ic = nab-iu-iv+kc jc = 1+kc do 330 kd=0,iv ibd = ibc*ibinom(iadv+kd) id = ic+kd jd = jc+kd do 330 ke=0,namu ibe = ibd*ibinom(iadna+ke) ie = id-ke je = jd+ke do 330 kf=0,nbmv ibf = ibe*ibinom(iadnb+kf) iff = ie-kf jff = je+kf do 330 ka=0,m iba = ibf*ibinom(iadm+ka) i = iff-2*ka do 330 kb=0,m ibb = iba*ibinom(iadm+kb) if(mod(ka+kb+kd+kf,2).eq.1) ibb=-ibb j = jff+2*kb sum = sum+ibb*a(i)*b(j) 330 continue x = x+sum*cu*cc(iadb,ivc) 340 continue ss = x*(fc(m+2)/8.0d0)**2* sqrt( (2*la+1)*fc(la-m+1)* & & (2*lb+1)*fc(lb-m+1)/(4.0d0*fc(la+m+1)*fc(lb+m+1))) ! compute overlap integral from reduced overlap integral. ss = ss * sqrt( alpha**(2*na+1)*beta**(2*nb+1)/ & & (fc(2*na+1)*fc(2*nb+1)) ) if(mod(lb+mm,2).eq.1) ss=-ss calculateoverlap = ss return end function calculateoverlap ! Calculate the radial part of one-center two-electron integrals (slater-condon parameter). function getslatercondonparameter(k,na,ea,nb,eb,nc,ec,nd,ed) result(slatercondon) ! Type of integral, can be equal to 0,1,2,3,4 in spd-basis integer, intent(in) :: k ! Principle quantum number of ao, electron 1 integer, intent(in) :: na integer, intent(in) :: nb ! Principle quantum number of ao, electron 2 integer, intent(in) :: nc integer, intent(in) :: nd ! Exponents of ao, electron 1 double precision, intent(in) :: ea double precision, intent(in) :: eb ! Exponents of ao, electron 2 double precision, intent(in) :: ec double precision, intent(in) :: ed ! The resulting Slater-Condon parameter double precision :: slatercondon ! Local variables integer :: nab, ncd, n, i, m, m1, m2 double precision :: eab, ecd, e, c, s0, s1, s2, s3 double precision :: aea, aeb, aec, aed, ae, a2, acd, aab aea = log(ea) aeb = log(eb) aec = log(ec) aed = log(ed) nab = na+nb ncd = nc+nd ecd = ec+ed eab = ea+eb e = ecd+eab n = nab+ncd ae = log(e) a2 = log(two) acd = log(ecd) aab = log(eab) c = exp(logfc(n)+na*aea+nb*aeb+nc*aec+nd*aed & +half*(aea+aeb+aec+aed)+a2*(n+2) & -half*(logfc(2*na+1)+logfc(2*nb+1) & +logfc(2*nc+1)+logfc(2*nd+1))-ae*n) c = c*au_to_ev s0 = one/e s1 = zero s2 = zero m = ncd-k do i=1,m s0 = s0*e/ecd s1 = s1+s0*(binomialcoefficient(ncd-k,i)-binomialcoefficient(ncd+k+1,i))/binomialcoefficient(n,i) enddo m1 = m+1 m2 = ncd+k+1 do i=m1,m2 s0 = s0*e/ecd s2 = s2+s0*binomialcoefficient(m2,i)/binomialcoefficient(n,i) enddo s3 = exp(ae*n-acd*m2-aab*(nab-k))/binomialcoefficient(n,m2) slatercondon = c*(s1-s2+s3) return end function getslatercondonparameter end module overlap_backend
I’ve been told that I have my mother’s eyes and my father’s smile. Sometimes the genetics we inherit reveal themselves in very obvious ways. And sometimes they don’t. Recently I wrote this post about DNA tests that can identify your skin’s inherent strengths and weaknesses, enabling you to pinpoint exactly what skincare products are best for you based on your unique genetic profile. This is a critical breakthrough because without this type of information, it’s impossible to know the specific needs of your skin. This is why we buy from the brands that we like (or that have a great sales pitch), get lucky with a few products and end up with a drawer full of skin care rejects that didn’t deliver as promised because they weren’t the right match for our skin. The beauty of these DNA tests is that they take out the guesswork, providing you with clear guidelines on how to shop for your skincare, supplements and professional skin treatments. Of course I could hardly wait to take the test and reveal my skin’s genetic destiny, but I also truly wondered if the information would be valuable to me or not. As someone extremely well versed in skincare, I already knew how to cut through the category clutter and felt very confident in my skincare regimen. Glycation Protection (Gene 3)– Quick skincare lesson: glycation occurs when excess bodily glucose (sugar) molecules link to the skin’s collagen and elastin fibers. Glycated fibers then become rigid and have reduced regenerative ability, leading to accelerated skin aging in the form of wrinkling and decreased elasticity. On a scale of 1-10, my skin’s ability to protect against glycation is about a 2.5. Major fail. So what do I do? Well, this is where it gets interesting. New evidence in the study of epigenetics proves how the lifestyle choices we make can either speed up or slow down the aging process. This can take the form of deciding whether or not to wear sunscreen, or in my case, whether or not to lay off the sugar and carbs. So with this hard data in hand, I can either blame my inevitable premature aging on bad genes, or I can start eating a low sugar diet and basically eliminate the expression of this genetic deficiency. The test has given me the power to alter how my skin ages – whether I like what I need to do or not. Kind of mind blowing, right? Now for some, this info wouldn’t be that enlightening. But it is for me – my husband is an owner in a gelato company and a partner in a bakery. I love sweets and eat more than I should, making this information highly valuable and certainly worth the $299 price of the test. But enough about me. What do tests like this mean for the future of the skincare industry? Here’s what I think. Right now, SkinDNA has the genetic data on over 40,000 people from a variety of ethnic backgrounds. They are adding to this at a rate of 15,000+ individuals a year and running all kinds of correlation studies. These studies generate statistics that have the ability to alter the way skincare is formulated and marketed. For example, they can identify genetic patterns among certain groups that can predict an increased likelihood of a genetic tendency. So I think it’s only a matter of time before this data is sold to a L’Oreal or Estee Lauder who can use it to either create new brands or reposition existing ones using this hard data as a guide. Then for those like me who want an individualized DNA report, the door is opened for companies to create bespoke skincare including both topicals and injestibles. GENEU, who offers a test similar to what I took through SkinDNA, is currently offering a personalized anti-aging serum based on your DNA results. Product starts at Β£300 for a 4 week supply. The really crazy thing is that DNA testing is just the tip of the iceberg when it comes to the future of customized skincare. New developments in biology will soon enable custom-made professional treatments, like using an individual’s own blood platelets to create protein-rich, collagen stimulating injectables. By using one’s own skin tissue as the basis for a filler, it has the potential to last longer and be more effective. Then there’s this: Biomedical Micro-engineering researchers at Heriot Watt University in Scotland, in collaboration with stem cell technology company Roslin Cellab, have created a breakthrough printing process that enables 3-D printing of embryonic cell cultures. These embryonic stem cells have an ability to replicate indefinitely and differentiate into almost any cell type in the human body (and I thought 3-D printed packaging was cool!). Since stem cells have the ability to regenerate damaged cells, this technology is expected to basically revolutionize the beauty industry and may truly become the future fountain of youth, all within the next two decades. Of course I’m all over this, so you can be sure that I’ll keep you posted as more and more research emerges. It’s going to be a wild ride!
Formal statement is: lemma bigomega_real_nat_transfer: "(f :: real \<Rightarrow> real) \<in> \<Omega>(g) \<Longrightarrow> (\<lambda>x::nat. f (real x)) \<in> \<Omega>(\<lambda>x. g (real x))" Informal statement is: If $f$ is big-Omega of $g$, then the function $x \mapsto f(x)$ is big-Omega of the function $x \mapsto g(x)$.
lemma continuous_on_If: assumes closed: "closed s" "closed t" and cont: "continuous_on s f" "continuous_on t g" and P: "\<And>x. x \<in> s \<Longrightarrow> \<not> P x \<Longrightarrow> f x = g x" "\<And>x. x \<in> t \<Longrightarrow> P x \<Longrightarrow> f x = g x" shows "continuous_on (s \<union> t) (\<lambda>x. if P x then f x else g x)" (is "continuous_on _ ?h")
f <- function () { {;c0 = 1;} }; g <- function () { {c1 = 2} }
theory Example_locale imports Main begin (*locale: a functor - maps parameters and a specification \<longrightarrow> a list of declarations*) (*parameter: le - a binary predicate with \<sqsubseteq>*) locale partial_order = fixes le :: "'a \<Rightarrow> 'a \<Rightarrow> bool" (infixl "\<sqsubseteq>" 50) (*declares a local parameter*) assumes refl [intro, simp]: "x \<sqsubseteq> x" (* local premises*) and anti_sym[intro]: "\<lbrakk> x \<sqsubseteq> y; y\<sqsubseteq> x \<rbrakk> \<Longrightarrow> x = y" and trans[trans]: "\<lbrakk> x \<sqsubseteq> y; y\<sqsubseteq> z \<rbrakk> \<Longrightarrow> x \<sqsubseteq> z" (*\<And>x y z.\<lbrakk> x \<sqsubseteq> y; y\<sqsubseteq> z \<rbrakk> \<Longrightarrow> x \<sqsubseteq> z *) begin definition (in partial_order) less :: "'a \<Rightarrow> 'a \<Rightarrow> bool" (infixl "\<sqsubset>" 50) where "(x \<sqsubset> y) = (x \<sqsubseteq> y) \<and> (x \<noteq> y)" end print_locale! partial_order thm partial_order_def (* definition (in partial_order) less :: "'a \<Rightarrow> 'a \<Rightarrow> bool" (infixl "\<sqsubset>" 50) where "(x \<sqsubset> y) = (x \<sqsubseteq> y) \<and> x \<noteq> y" *) locale total_order = partial_order + assumes total: "x \<sqsubseteq> y \<or> y \<sqsubseteq> x" lemma (in total_order) less_total: "x \<sqsubset> y \<or> x = y \<or> y \<sqsubset> x" end
```python import numpy as np import scipy.special as sci import matplotlib.pyplot as plt from scipy import stats # linregress import pandas as pd from IPython.display import Latex ``` ## Lecture 10: Reactive Mass Transport _(The contents presented in this section were re-developed principally by Dr. P. K. Yadav. The original contents are from Prof. Rudolf Liedl)_ --- The last lecture dealt with the conservative transport processes and quantified the mass flow and flux emanating from those processes. The effects of these processes were evaluated as an isolated processes and as joint transport process. The last lecture dealt with the conservative transport processes and quantified the mass flow and flux emanating from those processes. The effects of these processes were evaluated as an isolated processes and as joint transport process. ```{admonition} Last lecture important conclusions > $J_{adv}>J_{dis}>>J_{diff}$ is normal aquifers. > $J_{diff}$ may only be useful as an individual processes in special aquifers, e.g., clayey aquifers. > In general aquifers, hydrodynamic dispersion $J_{hyd} = J_{dis} + J_{diff}$ is used in the analysis of solute transport process. ``` Finally, the last chapter introduced _Concentration Profile_ $(C-t)$ and _Breakthrough Curve_ $(C-x)$ to visually evaluate solute transport in aquifers using _Concentration_ $(C)$, a process output, as a function of _time_ $(t)$ and _space_ $(x)$. Finally, the last chapter introduced _Concentration Profile_ $(C-t)$ and _Breakthrough Curve_ $(C-x)$ to visually evaluate solute transport in aquifers using _Concentration_ $(C)$, a process output, as a function of _time_ $(t)$ and _space_ $(x)$. This section focuses on the _reactive transport processes,_ which as already discussed involves the transport of solute with _reaction_ processes. This course being an introductory groundwater course, _sorption_ and _degradation_ are the only two reaction types introduced and combined with the conservative transport processes- _advection_ and _dispersion_. Eventully, the section evaluates the joint action of conservative transport and reactive processes limiting to 1-D scenario. The section will, however, first deal with 3-D effects of dispersive process, which is more important to quantify the reactive processes. ## Dispersive Mass Flow in 3-D In the last section we saw that concentration gradient $\frac{\Delta C}{\Delta L}$ drives dispersive and diffusive solute transport process. However, in the natural aquifers $\frac{\Delta C}{\Delta L}$ is normally varying with space $(x,y,z)$ and time $(t)$. Therefore, a differential operator $\big(\frac{\mathrm{d}}{\mathrm{d} x}\big)$ is more suitable representation of gradient than the difference operator $\frac{\Delta C}{\Delta x}$. The differential operator also generalizes the gradient case. Considering the differential operator, the diffusive mass flow and diffusive mass flux (= mass flow per unit area) in 1D is then expressed as: $$ J_{diff} = - n_e \cdot A \cdot D_p \cdot \frac{\mathrm{d} C}{\mathrm{d}x} $$ and $$ j_{diff} = - n_e \cdot D_p \cdot \frac{\mathrm{d} C}{\mathrm{d}x} $$ Likewise, the dispersive mass flow and dispersive mass flux (1-D) is: $$ J_{disp, h} = - n_e \cdot A \cdot D_{disp} \cdot \frac{\mathrm{d} C}{\mathrm{d}x} $$ $$ j_{disp, h} = - n_e \cdot D_{disp} \cdot \frac{\mathrm{d} C}{\mathrm{d}x} $$ The examples of these relations are presented in last section (@Alex pls. link) ### 3-D concentration Gradient The concentration gradient $\frac{\mathrm{d}C}{\mathrm{d}x}$ for 1-D solute transport problems is uni-directional, i.e, direction is fixed, and thus only the magnitude of the gradient is the important factor. However in higher dimensions, 2-D or 3-D, solute transport problems, the _direction_ of gradient along with it's _magnitude_ in that direction has to be specified. Thus, for higher dimension solute transport problems, the _concentration gradient_ becomes **concentration vector**, i.e., a quantity providing both magnitude and direction. Thus, the representation of concentration gradient in Cartesian coordinate in 2-D and 3-D is: $$ \mathrm{grad}C = \nabla C= \begin{pmatrix} \frac{\partial C}{\partial x}\\ \frac{\partial C}{\partial y} \end{pmatrix} $$ and $$ \mathrm{grad} C = \nabla C= \begin{pmatrix} \frac{\partial C}{\partial x}\\ \frac{\partial C}{\partial y}\\ \frac{\partial C}{\partial z} \end{pmatrix} $$ The $\nabla$, the inverted Delta symbol, is called the **del** or **nabla** operator. The vector **grad$C$** in the above relations points in the direction of the _steepest increase_ of $C$. However, for the **Hydrogeologists**, the concentration gradients as well the grad$C$ points to the _steepest decrease_ of $C$. **@Anne/Sophie - can we try to find a simple example finding grad$C$ in 2-D/3-D** ### Isotropic and Anisotropic Dispersion Corresponding the expression for the concentration gradient at higher dimensions, the expression for mass flow and flux becomes: $$ J_{disp,\, h} = \begin{pmatrix} J_{disp,\, hx}\\ J_{disp,\, hy}\\ J_{disp,\, hz} \end{pmatrix} $$ and the 3-D mass flux is: $$ j_{disp,\, h} = \begin{pmatrix} j_{disp,\, hx}\\ j_{disp,\, hy}\\ j_{disp,\, hz} \end{pmatrix} $$ The subscript in ${{disp, h}}$ refers to _hydrodynamic dispersion_ which is sum of _mechanical dispersion_ and _diffusion_. Likewise, the subscript ${{disp,\, hx}}$, ${{disp,\, hy}}$ and ${{disp,\, hz}}$ refers to dispersion components along the Cartesian coordinates. The corresponding mass flow and mass flux in the higher dimension is then: $$ J_{disp,\, h} = - n_e \cdot A \cdot D_{hyd} \cdot \text{grad}C $$ and ### Isotropic and Anisotropic Dispersion Corresponding the expression for the concentration gradient at higher dimensions, the expression for mass flow and flux becomes: $$ J_{disp,\, h} = \begin{pmatrix} J_{disp,\, hx}\\ J_{disp,\, hy}\\ J_{disp,\, hz} \end{pmatrix} $$ and the 3-D mass flux is: $$ j_{disp,\, h} = \begin{pmatrix} j_{disp,\, hx}\\ j_{disp,\, hy}\\ j_{disp,\, hz} \end{pmatrix} $$ The subscript in ${{disp,\, h}}$ refers to _hydrodynamic dispersion_ which is sum of _mechanical dispersion_ and _diffusion_. Likewise, the subscript ${{disp,\, hx}}$, ${{disp,\, hy}}$ and ${{disp,\, hz}}$ refers to dispersion components along the Cartesian coordinates. The corresponding mass flow and mass flux in the higher dimension is then: $$ J_{disp,\, h} = - n_e \cdot A \cdot D_{hyd} \cdot \text{grad}C $$ and $$ j_{disp,\, h} = - n_e \cdot A \cdot D_{hyd} \cdot \text{grad}C $$ The **isotropic dispersion**, rather an _exceptional,_ the $D_{hyd}$ in this case is: $$ D_{hyd} = \alpha \cdot |v| + n_e \cdot D $$ where, $D$ is direction independent dispersion coefficient and $\alpha$ $[L]$ is dispersivity, which in: **heterogeneous aquifer**: $\alpha = \alpha(x,y,z)$ and in **homogeneous aquifer**: $\alpha = \text{constant}$ For more practical cases and in normal aquifers, the 2-D and 3-D the dispersion for solute transport is _direction dependent,_ i.e. **anisotropic**. Hence the $D_{hyd}$ is not an scalar quantity but a _matrix (tensor),_ which relates the concentration gradient (vector) to the dispersive mass flow (vector). However, if the princopal axes of the dispersion tensor $D_{hyd}$ is made to coincide with the axes of a Cartesian coordinate system _and_ the groundwater flow is considered uniform along the $x-$axis, the dispersive mass flux can be obtained from $$ \begin{pmatrix} J_x \\ j_y \\ j_z \end{pmatrix} = \begin{pmatrix} \alpha_L \cdot v_x + n_e \cdot D & 0 & 0 \\ 0 & \alpha_{Th} \cdot v_x + n_e \cdot D & 0\\ 0 & 0 & \alpha_{Tv} \cdot v_x + n_e \cdot D \end{pmatrix} \cdot \begin{pmatrix} \frac{\partial C}{\partial x} \\ \frac{\partial C}{\partial y} \\ \frac{\partial C}{\partial z} \end{pmatrix} $$ with $\alpha_L$, $\alpha_{Th}$ and $\alpha_{Tv}$ are longitudinal dispersivity, horizontal transverse dispversity and vertical transverse dispersivity, respectively. The statistical analysis of dispersivity data shows that $\alpha_{L}>\alpha_{Th}>\alpha_{Tv}$ and the values differ by roughly an order of magnitude. This, however, is just a rule of thumb. @Anne/@Sophie can you find a very simple numerical example for caculating dispersivity or something that explains the above relation. ```python # Analytical solution from Bear (1976) - Line source, 1st-type input and infinte plane # Input (values can be changed) Co = 1 # mg/L, input concentration Dx = 3 # m, Dispersion in x direction Dy = Dx/10 # m v = 0.05 # m/d Q = 10 # m^3/d ## domain dimension and descritization (values can be changed) xmin = -100; xmax= 101 ymin = 0.1; ymax = 11 [x, y] = np.meshgrid(np.linspace(xmin, xmax, 1000), np.linspace(ymin, ymax, 100)) # mesh # Bear (1976) solution Implementation #"k0: Modified Bessel function of second type and zero Order" term1 = (Co*Q)/(2*np.pi* np.sqrt(Dx*Dy)) term2 = (x*v)/(2*Dx) args = (v**2*x**2)/(4*Dx**2) + (v**2*y**2)/(4*Dx*Dy) sol = term1*np.exp(term2)*sci.k0(args) # plots fig, ax = plt.subplots() CS = ax.contour(x,y,sol, cmap='flag') ax.clabel(CS, inline=1, fontsize= 10) CB = fig.colorbar(CS, shrink=0.8, extend='both') ``` ## Equilibrium Sorption ## --- A reactive transport system can include a single reactive process, e.g., degradation, or combination of several multiple reactive processes, e.g. degradation and sorption. The inclusion of the reactive process(es) in the transport studies are site specific. The important to note is that an inclusion of a reactive process increases the complexity of transport problem. In this course we limit ourselves with the following two types of reaction processes: **1. Sorption** **2. Degradation** Acid-base reaction, precipitation-dissolution reaction, organic combustion etc. are among the reactions type that can be part of the reactive process individually or in any combination. Also an important distinction is the rate or speed of the reaction. One distinguishes between time-dependent reaction (kinetics) or time-independent reactions (steady-state or equilibrium). Special reaction rates such as instantaneous reaction (extremely fast reaction) can also be part of the reaction process in the transport system. ### Sorption Basics **Sorption** is a rather a general term used to indicate both **adsorption** and **absorption**. But in this course the _sorption_ refers to only _adsorption._ **Adsorption** can be more formally defined as the process of accumulation of dissolved chemicals on the surface of a solid, e.g., accumulation of a chemicals dissolved in groundwater on the surface of the aquifer material. The figure below clarifies the _adsorption_ process. <a href="fig5"></a> In the figure _chemical in solution_ (the circular objects) more often called **solute** in the water is found to attach is the solid surface. The figure presents the following two important terms part of the adsorption process: > **Adsorbent**: The solid onto which the chemicals are attached. More formally, _adsorbents_ provide adsorption sites for solutes. > **Adsorbate**: These are solutes that are attached on the _adsorbent._ Based on the figure, _adsorption_ can be considered as a partition process that divides the chemical originally present in water between adsorbent and water. Quite often adsorption is a reversible process, i.e., adsorbed chemicals can get back to water phase. This process is called **desorption**. Speaking about _equilibrium,_ this is reached when > _adsorption rate_ $\rightleftharpoons $ _desorption rate_ Adsorption in groundwater is often a rapid process. Although sorption kinetics can be important, the description in this introductory level course is limited to equilibrium sorption. Thus, we learn next to quantify equilibrium sorption. ### Adsorption Isotherms The adsorption process that has reached equilibrium can be relatively easily quantified with the use of empirical models called **isotherms**. These models are often simple algebraic equation that relates solute concentrations partitioned between the adsorbate and adsorbent at constant temperature. More than 15 different _isotherm_ models can be found in the literature. However, in groundwater reactive transport studies the following three are the two most commonly used isotherms: 1. **Henry or Linear isotherm** <br> 2. **Freundlich isotherm** For quantification, laboratory based experiments are performed using solids from subsurface and chemicals of interest. The laboratory observations are then graphically fitted with empirical isotherm models to quantify adsorption properties. Figure below shows isotherms that are particularly observed in groundwater transport studies. As can be observed in the figure sorption coefficient ($K$) is the common quantities obtained from isotherm models. <a href="fig6"></a> ### Henry Isotherm The **Henry isotherm** (Henry, 1803) is based on the idea of a _linear_ relationship between the solute concentration **$C$** and the _adsorbate:adsorbent_ mass ratio $C_a$. Henry isotherm is quite often also called _linear isotherm_ or the $K_d$ model. Mathematically, the Henry isotherm is: $$ C_a = K_d \cdot C $$ with $C$ = solute concentration [ML$^{-3}$]<br> $C_a$ = mass ratio adsorbate:adsorbent [M:M]<br> $K_d$ = distribution or partitioning coefficient [L$^3$M$^{-1}$]. Often symbols $C_s$ or $s$ are used instead of $C_a$. The Henry model has been most widely used in groundwater transport studies. This is largely because of the simplicity (see equation) of the model and it's applicability in representing adsorption process more generally observed in groundwater studies. $K_d$, the partitioning coefficient, is particularly used in groundwater transport studies. It is equal to the slope of the Henry isotherm. ```python # Example of Henry isotherm (Source: Fetter et al. 2018) # Following sorption data are available: C = np.array([7, 15, 174, 249, 362]) # ug/L, Eq. concentration Ca = np.array([2, 4, 33, 50, 70]) # ug/g, Eq. sorbed mass # linear- fit y = m*x+c slope, intercept, r_value, p_value, std_err = stats.linregress(C, Ca) print("slope: %f intercept: %f R-squared: %f" % (slope, intercept, r_value**2)) fit_line = slope*C + intercept #plot plt.scatter(C, Ca, label= "Original data") # data plot plt.plot(C, fit_line, color = "red", label = "fit-line") plt.legend(); plt.xlabel(r"Equilibrium Aqueous Concentration, $C$ ($\mu$g/L) ") plt.ylabel(r"Mass sorbed per unit absorbent weight, $C_a$ ($\mu$g/g) "); plt.text(0, 50, '$C_a=%0.5s C + %0.5s$'%(slope, intercept), fontsize=10) plt.text(0, 40, '$R^2=%0.5s $'%(r_value**2), fontsize=10) # Output Latex("The required partition coefficient = slope, $K_{d}$= %0.5s L/g " % slope) ``` ### Freundlich Isotherm **Freundlich isotherm** (Freundlich, 1907) is a more general isotherm. It is based on the idea of a power law, i.e., includes also the non-linear behaviour, relating the solute concentration $C$ to the adsorbate:adsorbent mass ration $C_a$. The isotherm is mathematically given as $$ C_a = K_{Fr} \cdot C^N $$ with $C$ = solute concentration [ML$^{-3}$]<br> $C_a$ = mass ratio adsorbate:adsorbent [M:M]<br> $n$ = Freundlich exponent [-]<br> $K_{Fr}$ = Freundlich partitioning coefficient [(M:M)/(M/L$^3)^n$]. The Freundlich isotherm equation can be easily linearized by applying logarithmic transformation of the equation, which gives \begin{eqnarray} \log C_a = \log K_{Fr} + n\cdot \log C \end{eqnarray} The above equation resembles the straight line equation $y = b + a \cdot x b$, in which $b\equiv \log K_{Fr}$ is the intercept and $a\equiv n$ the slope. Thus, from fitting the adsoprtion experimental results with the above equation, both $n$ and $K_{Fr}$ can be obtained. ```python # Example of Freundlich isotherm # Following sorption data are available: Cf= np.array([23.6, 6.67, 3.26, 0.322, 0.169, 0.114]) # mg/L, Eq. concentration Caf = np.array([737, 450, 318, 121, 85.2, 75.8]) # mg/g, Eq. sorbed mass logCf = np.log10(Cf) # log10 transformation of data logCaf = np.log10(Caf) # fitting: y = mx +c slope, intercept, r_value, p_value, std_err = stats.linregress(logCf, logCaf) print("slope: %f intercept: %f R-squared: %f" % (slope, intercept, r_value**2)) fit_line = slope*logCf + intercept # plots plt.figure(figsize=(10,4)) plt.subplot(121) plt.plot(Cf, Caf, "*--", label= "Original data") plt.legend(); plt.xlabel(r"Eq. Aq. Conc., $C$ ($mg$g/L) "); plt.ylabel(r"Mass sorbed/absorbent weight, $C_a$ ($mg$g/g) "); plt.subplot(122) plt.scatter(logCf, logCaf, label="Log transformed data") plt.plot(logCf, fit_line, color="red", label= "linear fit line") plt.legend(); plt.xlabel(r"Eq. Aq. Conc., $\log C$ ($mg$g/L) "); plt.ylabel(r"Mass sorbed/absorbent weight, $\log C_a$ ($mg$/g) "); plt.text(-1, 2.6, '$C_a=%0.5s C + %0.5s$'%(slope, intercept), fontsize=10) plt.text(-1, 2.5, '$R^2=%0.5s $'%(r_value**2), fontsize=10) plt.subplots_adjust(wspace=0.35) Latex("$K_{Fr}$ = %0.5s (mg/g)$^{1/n}$(mg/L) and $n$ = %0.4s" % (10**intercept, slope)) ``` ### Retardation Factor (for Henry Isotherm) The net effect of adsorption is the retarded movement of solute in comparison to the average flow of the groundwater. The term **Retardation Factor** $(R)$ is defined that quantifies the retarded movement of solute. The formulation of $R$ is based on the type of isotherm. For Henry isotherm $R$ can be straightforwardly calculated with the help of a mass budget. For this purpose, an aquifer volume $V$ with the effective porosity $n_e$ is considered (see fig. below) <a href="fig7"></a> The steps involved are: - Total volume: $V$ - Water volume: $n_e \cdot V$ - Mass of dissolved chemical: $n_e \cdot V \cdot C$ - Volume of solid: $(1-n_e)\cdot V$ - Density of solid material: $\rho$ - Mass of solid: $\rho \cdot(1-n_e)\cdot V$ - Mass of adsorbate: $\rho \cdot(1-n_e)\cdot V\cdot C_a$ = $(1-n_e)\cdot\rho \cdot V \cdot K_d \cdot C$ - Total mass: $n_e\cdot V \cdot C + (1-n_e)\cdot\rho \cdot V\cdot K_d \cdot C = n_e \cdot R \cdot V \cdot C$ <br> with _Retardation factor_ $$R = 1 + \frac{1-n_e}{n_e}\cdot \rho \cdot K_d$$ The expression for $R$ can be further modified by using bulk density $\rho_b$ $= (1-n_e)\cdot \rho$ = mass of solid/total volume. This leads to $$ R = 1+\frac{\rho_b}{n_e} \cdot K_d $$ As can be observed from the equation, $R = 1$ when there is no adsorption, i.e., when $K_d= 0$. @ Anne @ Sophie pls. provide a very short numerical example on R ## Degradation **Degradation** leads to alteration or transformation of chemical structure of chemicals. This contrasts to adsorption in which chemical structure is not altered. In adsorption (or desorption) the original chemical is partitioned between the solid particles and water. It is _degradation_ that eventually lead to removal of the _original_ chemical from the groundwater. The transformation of original chemical, due to degradation, results to so-called _daughter products (metabolites)._ The new chemical(s) can make groundwater more suitable (decrease contamination) or further contaminate it. In groundwater studies, degradation can appear as: - **Radioactive decay** - **Microbial degradation (bio-degradation)** - **Chemical degradation** There are several approaches to quantify degradation process. A common aspect to most of them is the assumption of _time-dependency_ (or _Kinetics_ ). ### $n^{th}$ - Order Degradation Kinetics The general equation for the degradation kinetics is: $$ \frac{\text{d}C}{\text{d} t} = - \lambda \cdot C^n $$ with $t$ = time [t] <br> $C$ = solute concentration [ML$^{-3}$] <br> $n$ = order of the degradation kinetics [ - ] ($n\geq 0)$ <br> $\lambda$ = degradation rate constant [(ML$^{-3})^{(1-n)}$T$^{-1}$]. Considering the initial concentration (or input concentration) $C_0$, the solutions of the kinetics equation are: $$ C(t) = C_0\cdot e^{-\lambda \cdot t} \: \: \: \text{if }\: n = 1 $$ and $$ C(t) = [C_0^{1-n} - (1-n)\cdot \lambda t]^{\frac{1}{1-n}} \:\:\: \text{if }\: n\neq 1 $$ The **half life** $(T_{1/2})$, which is the time span elapsing until the initial concentration $C_0$ is reduced by half, is an important time-scale in the degradation analysis. $T_{1/2}$ is $C_0$ dependent in nearly all cases with an exception for 1$^\text{st}$- order degradation kinetics. 0$^{th}$-order and the 1$^\text{st}$- order degradation kinetics are most commonly observed in groundwater studies. The $(T_{1/2})$ of these orders are: $$ T_{1/2} = \frac{C_0}{2\cdot \lambda} \:\:\: \text{for } \:0^{\text{th}}\text{-order} $$ $$ T_{1/2} = \frac{\ln 2}{\lambda} \:\:\: \text{for } \:1^{\text{st}}\text{-order} $$ As can be observed above $T_{1/2}$ is independent of concentration for the 1$^{\text{st}}$-order degradation kinetics. Another important properties of the degradation kinetics is that for $n\geq 1$ the solute concentration _asymptotically_ approaches zero, whereas for $n<1$, the solute concentration actually reaches zero ```python # behaviour of degradation kinetics #input - you may change the values Co = 1 # mg/L, initial concentration la = 0.003 # unit is order dependent. For n=1, 1/t # main equation Z_order = lambda t: Co* np.exp(-la*t) # for n = 0 F_order = lambda t: Co-la*t # for n = 1 # simulation for t t = np.linspace(1,1000, 1000) # 1000 time units Z_results = Z_order(t) F_results = F_order(t) # plots plt.figure(figsize=(10,4)) # n = 1 plt.subplot(121) plt.plot(t, Z_results) plt.ylim(0, Co); plt.xlim(0) plt.text(400, Co*0.8, r"$C(t) = C_0 \cdot e^{-\lambda \cdot t} $", fontsize = 12) plt.text (400, Co*0.9, r"1$^{st}$-order kinetics", color = "red", fontsize = 12) plt.text(0, Co/2, r"$T_{1/2}= \frac{\ln 2}{\lambda}$", color= "red", fontsize=14) plt.xlabel("Time, t (days)"); plt.ylabel(r"Concentration, $C(t)$ (mg/L)") # n = 0 plt.subplot(122) plt.plot(t, F_results) plt.ylim(0, Co); plt.xlim(0) plt.text(400, Co*0.8, r"$C(t) = C_0 \cdot-\lambda \cdot t} $", fontsize = 12) plt.text (400, Co*0.9, r"0$^{th}$-order kinetics", color = "red", fontsize = 12) plt.text(0, Co/2, r"$T_{1/2}= \frac{C_0}{2\cdot \lambda}$", color= "red", fontsize=14) plt.xlabel("Time, t (days)"); plt.ylabel(r"Concentration, $C(t)$ (mg/L)") plt.subplots_adjust(wspace=0.35) ``` ### Radioactive decay Radioactive decay is degradation of a chemical due to radiation. The radioactive decay is limited to radioactive chemicals such as Cobalt, Cesium, Iodine. This decay obeys the 1$^\text{st}$- order degradation kinetics and therefore the half-life is $T_{1/2} = \frac{\ln 2}{\lambda}$. $T_{1/2}$ is characteristic property of radioactive chemicals and it can be used to compute degradation rate ($\lambda$). ```python # Example of Radioactive decaly #experimental results t = [0, 1, 2, 5, 10, 20, 28 ] # yr, time Co_60 = [10, 8.76, 7.68, 5.17, 2.68, 0.72, 0.25] # mg/L, Cobalt 60 conc. So_90 = [10, 9.76, 9.52, 8.84, 7.81, 6.10, 5] # mg/L, Strontium 90 Conc. z_list = list(zip(t, Co_60, So_90)) Cols= ["time (a)", "Cobalt 60 (mg/L)", "Strontium 90 (mg/L)"] df = pd.DataFrame(z_list, columns=Cols) print(df) # computing TH_Co60 = 28 # yr, Half life of Cobalt 60 TH_St90 = 5.26 # yr, Half life of Strontium 90 la_Co60 = np.log(2)/TH_Co60 # 1/yr, degradation rate of Cobalt 60 la_St90 = np.log(2)/TH_St90 # 1/yr, degradation rate of Strontium 90 # visualize plt.plot(t, Co_60, "o--", label = "Cobalt 60") plt.plot(t, So_90, "v--", label= "Strontium 90") plt.xlabel("Time (years)"); plt.ylabel("Concentration (mg/L)") plt.legend(); Latex("The degradation rate ($\lambda$) for Cobalt 60 = %0.5s 1/y and for Strontium 90 = %0.5s 1/y" % (la_Co60, la_St90)) ``` ## Joint Action of Conservative and Reactive Transport (1D) ### Concentration Profile Figure below presents the joint action of conservative transport with equilibrium sorption (linear isotherm) and degradation. The figure shows the solute concentration $C$ (in water) at the same time-levels for various combinations of acting processes. <a href="fig8"></a> The figure can be explained in the following way: (A): The solute is initially present at constant concentration in a limited area. (B): Solute spreads only due to advection. Due to absence of dispersion there is no (1D) spreading effect. (C): Inclusion of dispersion process causes spread of concentration. As retardation is absence the front centreline remains unchanged (D): The inclusion of retardation ($R$) with advection and dispersion leads to removal of chemicals from water and as well the retarded movement of the chemical front. (E): The inclusion of retardation along with degradation and conservative transport process leads to high removal of chemical from water. ### Breakthrough Curve Breakthrough curves provide a _time-dependent_ spread of chemicals in the groundwater. The inclusion of multiple processes are normally solved using numerical models. Analytical models are available for limited processes and simplified problems. A 1-D analytical solution by Kinzelbach (1987) provide a transient (time-dependent) solution of reactive transport problem with inclusion of equilibrium linear sorption represented by retardation $(R)$, first-order degradation rate $(\lambda)$ and the conservative transport quantities - dispersion $(D)$ and advection. The solution is given as: $$ C(x,t) = C_0 \cdot \exp(-\lambda\cdot t)\bigg(1- \frac{1}{2}\text{erfc}\bigg(\frac{R\cdot x - v\cdot t}{2\cdot\sqrt{D\cdot R \cdot t}}\bigg) - \frac{1}{2}\exp\bigg(\frac{v\cdot x}{D}\bigg)\text{erfc}\bigg(\frac{R\cdot x + v\cdot t}{2\cdot\sqrt{D\cdot R \cdot t}}\bigg) $$ with $C_0$ = input/source concentration [ML$^{-3}$] <br> $t$ = time [T]<br> $v$ = groundwater flow velocity [LT$^{-1}$]<br> erfc() = represents the complementary error function [See here for details](https://en.wikipedia.org/wiki/Error_function). erfc() can be easily computed using Python Scipy special function library. ```python # Breakthrough curve using Kinzelbach (1987) analytical solution Main function # The main function - you may change the value of C_o, lam, R, Dx, v, x # C_o = input concentration, mg/L # lam = 0 # 1/d, degradation rate, 1/d # R = retardation factor, () # Dx = dispersion coeff. along x, m^2/d # v = groundwater velocity, m/d # x = position where C is to be measured, m def Cx(t, C_o= 1, lam = 0, R=1, Dx=1, v= 10, x = 20): sterm = C_o*np.exp(-lam*t) erf_ag1 = (R*x-v*t)/(2*np.sqrt(Dx*R*t)) erf_ag2 = (R*x+v*t)/(2*np.sqrt(Dx*R*t)) C = sterm*(1-(0.5*sci.erfc(erf_ag1)-0.5*np.exp((v*x)/Dx)*sci.erfc(erf_ag2))) return C ``` ```python # Computing Case 1: Conservative process- R = 1, Lambda = 0 t1 = np.linspace(1e-5,50,1000) # times, d C1 = Cx(t1, C_o= 1, lam = 0, R=1, Dx=1, v= 1, x = 20) # Computing Case 2: Conservative system + Retardation - R = 2, Lambda = 0 t2 = np.linspace(1e-5,50,1000) # times, d C2 = Cx(t2, C_o= 1, lam = 0, R=2, Dx=1, v= 1, x = 20) # Computing Case 3: Conservative system + Retardation + degradation - R = 2, Lambda = 0.004 t3 = np.linspace(1e-5,50,1000) # times, d C3 = Cx(t3, C_o= 1, lam = 0.004, R=2, Dx=1, v= 1, x = 20) # plots - this should be adjusted as required plt.figure(figsize=(9, 6)) plt.plot(t1, C1, label="Conservative transport") plt.plot(t2, C2, label = "Reactive transport with sorption") plt.plot(t3, C3, label = "Reactive transport with sorption and degradation rate") plt.legend(loc= 3); plt.xlim(0), plt.ylim(0) plt.xlabel("time (d)"); plt.ylabel(r"Concentration, $C$ (mg/L)") plt.text(5, 0.2, r"$x= 20$ m") ``` ### Mass (Re-)Distribution During Injection / Extraction **Consider a scenario**: Water is _injected_ into a certain portion of an aquifer with total volume $V$, bulk density $\rho_b$ and effective porosity $n_e$. Assume that the injected water contains a chemical of total mass $M$, which is adsorbed by the aquifer materials under equilibrium conditions according to Henry isotherm (quantified by $K_d$$). Bases on the assumption of sorption equilibrium, the total mass $M$ of the chemical is instantaneously(!) split up into a dissolved and a sorbed part. In such case, the mass distribution can be computed as follows (with $R$ = retardation factor, $\rho_b$ = bulk density): \begin{align} M &= n_e \cdot V \cdot C + V\cdot\rho_b \cdot C_a \\ &= n_e \cdot V \cdot C + V \cdot \rho_b \cdot K_d \cdot C\\ &= n_e \cdot (1 + \rho_b \cdot K_d/n_e) \cdot V \cdot C\\ &= n_e \cdot R \cdot V \cdot C \end{align} In which, $n_e \cdot V \cdot C$ = dissolved mass <br> $V\cdot\rho_b \cdot C_a$ = mass of adsorbate For the dissolved mass we thus have $n_e \cdot V \cdot C = M/R$ and consequently the mass of adsorbate is:<br> $V\cdot\rho_b \cdot C_a = M- M/R = (1-1/R)\cdot M$ The same approach can be adopted for the **extraction** scenarios, i.e. equilibrium desorption.
[STATEMENT] lemma (in monoid) Units_inv_closed [intro, simp]: "x \<in> Units G ==> inv x \<in> carrier G" [PROOF STATE] proof (prove) goal (1 subgoal): 1. x \<in> Units G \<Longrightarrow> inv x \<in> carrier G [PROOF STEP] apply (simp add: Units_def m_inv_def) [PROOF STATE] proof (prove) goal (1 subgoal): 1. x \<in> carrier G \<and> (\<exists>xa\<in>carrier G. xa \<otimes> x = \<one> \<and> x \<otimes> xa = \<one>) \<Longrightarrow> (THE y. y \<in> carrier G \<and> x \<otimes> y = \<one> \<and> y \<otimes> x = \<one>) \<in> carrier G [PROOF STEP] by (metis (mono_tags, lifting) inv_unique the_equality)
module integrate_module implicit none private public :: integral contains function integral(f, a, b, n) result (integral_result) ! Calculates a trapezoidal approximation to an area using n trapezoids ! The region is bounded by lines x=a, y=0, x=b, and the curve y=f(x) interface function f(x) result (f_result) real, intent(in) :: x real :: f_result end function f end interface real, intent(in) :: a, b integer, intent(in) :: n real :: integral_result real :: h, total integer :: i h = (b - a) / n ! Calculate the sum f(a)/2+f(a+h)+...+f(b-h)+f(b)/2 ! Do the first and last terms first total = 0.5 * (f(a) + f(b)) do i = 1, n - 1 total = total + f(a + i * h) end do integral_result = h * total end function integral end module integrate_module module function_module implicit none private public :: square contains function square(x) result (squared_x) real, intent(in) :: x real :: squared_x squared_x = x ** 2 end function square end module function_module program integrate use integrate_module use function_module implicit none print *, integral(square, a=0.0, b=1.0, n=100) end program integrate
The bodice of this design has a simple round neckline. The waistline sits at the natural waist level of the body and is highlighted with braid. Ties come from the side seam to fasten into a bow at the back. Mother of pearl button closure at the back. The skirt is generously gathered and the length is to the knee. Handmade and beautifully finished with a full lining of plain Liberty Lawn and french seams. For special occasions - soft tulle netting can be added to the petticoat - giving just a little more fluffy volume and lightness to the skirt. Please see tulle petticoat listing.
From ch2o_compcert Require Export ch2o_lp64 countdown_ch2o. From ch2o Require Import stringmap frontend_sound. Local Open Scope string_scope. Definition alloc_program_result: frontend_state K. Proof. set (a:=alloc_program (K:=K) decls βˆ…). assert (match a with inl _ => False | inr _ => True end). { exact I. } destruct a. { elim H. } destruct p. exact f. Defined. Definition Ξ“: env K := to_env alloc_program_result. Definition Ξ΄: funenv K := to_funenv alloc_program_result. Definition m0: mem K := to_mem alloc_program_result. Definition S0 := initial_state m0 "main" []. Goal env_t Ξ“ = βˆ…. Proof. reflexivity. Qed. Goal stringmap_to_list (env_f Ξ“) = [("main", ([], sintT%T))]. reflexivity. Qed. (* Compute stringmap_to_list Ξ΄. *) Infix "<" := (EBinOp (CompOp LtOp)) (at level 70) : expr_scope. Goal stringmap_to_list Ξ΄ = [ ("main", local{sintT} ( var 0 ::= cast{sintT%T} (# intV{sintT} 32767) ;; catch ( loop ( if{# intV{sintT} 0 < load (var 0)} skip else throw 0 ;; catch ( ! (cast{voidT%T} (var 0 ::= load (var 0) - # intV{sintT} 1)) ) ) ) ;; ret (cast{sintT%T} (load (var 0))) ) : stmt K ) ]. Proof. reflexivity. Qed. Lemma Ξ΄_main: Ξ΄ !! ("main": funname) = Some ( local{sintT} ( var 0 ::= cast{sintT%T} (# intV{sintT} 32767) ;; catch ( loop ( if{# intV{sintT} 0 < load (var 0)} skip else throw 0 ;; catch ( ! (cast{voidT%T} (var 0 ::= load (var 0) - # intV{sintT} 1)) ) ) ) ;; ret (cast{sintT%T} (load (var 0))) ) : stmt K). Proof. reflexivity. Qed. Goal m0 = βˆ…. Proof. reflexivity. Qed. Goal S0 = State [] (Call "main" []) m0. Proof. reflexivity. Qed. Lemma alloc_program_eq: alloc_program decls empty = mret () alloc_program_result. Proof. reflexivity. Qed. Lemma Ξ“_valid: βœ“ Ξ“. Proof. apply alloc_program_valid with (1:=alloc_program_eq). Qed. Lemma Ξ΄_valid: βœ“{Ξ“,'{m0}} Ξ΄. Proof. apply alloc_program_valid with (1:=alloc_program_eq). Qed. Lemma m0_valid: βœ“{Ξ“} m0. apply alloc_program_valid with (1:=alloc_program_eq). Qed.
\section{Literatura} \begin{frame}{Literatura} \begin{thebibliography}{9} \setbeamertemplate{bibliography item}[online] \bibitem{MRS}{ J.~Peterson \newblock Finite Difference Methods for Boundary Value Problems \newblock \url{http://people.sc.fsu.edu/~jpeterson/notes_fd.pdf} } \bibitem{RR}{ J.~Lambers \newblock The Rayleigh-Ritz Method \newblock \url{http://www.math.usm.edu/lambers/mat461/spr10/lecture27.pdf} } \end{thebibliography} \end{frame}
\documentclass[11pt, a4paper, leqno]{article} \usepackage{a4wide} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{float, afterpage, rotating, graphicx} \usepackage{epstopdf} \usepackage{longtable, booktabs, tabularx} \usepackage{fancyvrb, moreverb, relsize} \usepackage{eurosym, calc, chngcntr} \usepackage{amsmath, amssymb, amsfonts, amsthm, bm} \usepackage{caption} \usepackage{mdwlist} \usepackage{xfrac} \usepackage{setspace} \usepackage{xcolor} % \usepackage{pdf14} % Enable for Manuscriptcentral -- can't handle pdf 1.5 % \usepackage{endfloat} % Enable to move tables / figures to the end. Useful for some submissions. \usepackage[ natbib=true, bibencoding=inputenc, bibstyle=authoryear-ibid, citestyle=authoryear-comp, maxcitenames=3, maxbibnames=10, useprefix=false, sortcites=true, backend=biber ]{biblatex} \AtBeginDocument{\toggletrue{blx@useprefix}} \AtBeginBibliography{\togglefalse{blx@useprefix}} \setlength{\bibitemsep}{1.5ex} \addbibresource{refs.bib} \usepackage[unicode=true]{hyperref} \hypersetup{ colorlinks=true, linkcolor=black, anchorcolor=black, citecolor=black, filecolor=black, menucolor=black, runcolor=black, urlcolor=black } \widowpenalty=10000 \clubpenalty=10000 \setlength{\parskip}{1ex} \setlength{\parindent}{0ex} \setstretch{1.5} \begin{document} \title{TTT \thanks{NNN: UUU, Address. \href{mailto:[email protected]} {\nolinkurl{x [at] y [dot] z}}, tel.~+00000.} % subtitle: % \\[1ex] % \large Subtitle here } \author{NNN % \\[1ex] % Additional authors here } \date{ {\bf Preliminary -- please do not quote} \\[1ex] \today } \maketitle \begin{abstract} Some abstract here. \end{abstract} \clearpage \section{Introduction} % (fold) \label{sec:introduction} If you are using this template, please cite this item from the references: \citet{GaudeckerEconProjectTemplates} \citet{Schelling69} example in the code is taken from \citet{StachurskiSargent13} The decision rule of an agent is the following: \input{formulas/decision_rule} \begin{figure} \caption{Segregation by cycle in the baseline \citet{Schelling69} model as in the \citet{StachurskiSargent13} example} \includegraphics[width=\textwidth]{../../out/figures/schelling_baseline} \end{figure} \begin{figure} \caption{Segregation by cycle in the baseline \citet{Schelling69} model, limiting the number of potential moves per period to two} \includegraphics[width=\textwidth]{../../out/figures/schelling_max_moves_2} \end{figure} % section introduction (end) \setstretch{1} \printbibliography \setstretch{1.5} %\appendix %\counterwithin{table}{section} %\counterwithin{figure}{section} \end{document}
module Data.List.Properties.Extra {a}{A : Set a} where open import Data.Nat open import Data.Fin hiding (_<_) open import Data.List open import Data.Product hiding (map) open import Data.Fin using (fromℕ≀; zero; suc) open import Data.List.Relation.Unary.All hiding (map; lookup; _[_]≔_) open import Data.List.Relation.Unary.Any hiding (map; lookup) open import Data.List.Membership.Propositional open import Data.List.Relation.Binary.Pointwise hiding (refl; map) open import Relation.Binary.PropositionalEquality ∈-∷ʳ : βˆ€ (l : List A)(x : A) β†’ x ∈ (l ∷ʳ x) ∈-∷ʳ [] x = here refl ∈-∷ʳ (x ∷ l) y = there (∈-∷ʳ l y) infixl 10 _[_]≔_ _[_]≔_ : (l : List A) β†’ Fin (length l) β†’ A β†’ List A [] [ () ]≔ x (x ∷ xs) [ zero ]≔ x' = x' ∷ xs (x ∷ xs) [ suc i ]≔ y = x ∷ xs [ i ]≔ y infixl 10 _[_]≔'_ _[_]≔'_ : βˆ€ {x} β†’ (l : List A) β†’ x ∈ l β†’ A β†’ List A [] [ () ]≔' y (x ∷ l) [ here px ]≔' y = y ∷ l (x ∷ l) [ there px ]≔' y = x ∷ (l [ px ]≔' y) ≔'-[]= : βˆ€ {x}{l : List A} (p : x ∈ l) β†’ βˆ€ {y} β†’ y ∈ (l [ p ]≔' y) ≔'-[]= (here px) = here refl ≔'-[]= (there p) = there (≔'-[]= p) drop-prefix : βˆ€ (l m : List A) β†’ drop (length l) (l ++ m) ≑ m drop-prefix [] m = refl drop-prefix (x ∷ l) m = drop-prefix l m
lemma affine_hull_convex_hull [simp]: "affine hull (convex hull S) = affine hull S"
function p = mcmcProposalProbability2(pE, adjlist, pWhole, smap1, origseg, smap2, newseg, niter) % compute probability of proposing newseg from smap1 % 1) Randomly select superpixel s1, then randomly selects different superpixel % s2 within same segment (if one exists); remove s1,s2 from s % 2) Then, for randomly ordered i: % if si is adjacent to s1, assign si to s1 with probability pE(si, s1) % if si is adjacent to s2, assign si to s2 with probability pE(si, s2) % remove si from s % 3) Repeat (2) until s is empty nsp = numel(smap1); ind1 = find(smap1==origseg); ind2 = find(smap2==newseg); n1 = numel(ind1); n2 = numel(ind2); if n1 == n2 % entire original segment selected if n1==1 p = 1/nsp; disp('one') else p = pWhole*n2/nsp; disp('whole') end else % subset of segment selected disp('subset') p = (1-pWhole)*n2/nsp; adjmat = zeros(n1, n1); for k = 1:size(adjlist, 1) if smap1(adjlist(k, 1))==origseg && smap1(adjlist(k, 2))==origseg i1 = logical(ind1==adjlist(k, 1)); i2 = logical(ind1==adjlist(k, 2)); adjmat(i1, i2) = k; adjmat(i2, i1) = k; end end assntrue = 2*ones(n1, 1); for k = 1:n1 if any(ind2==ind1(k)) assntrue(k) = 1; end adj{k} = find(adjmat(k, :)); adjlog{k} = logical(adjmat(k, :)>0); end notselectedind = find(assntrue==2); p = p * (n1-n2) / (n1-1); % prob of selecting valid starting point for s2 cpos = 0; cneg = 0; assn = zeros(n1, 1); for k = 1:niter s1 = ind2(ceil(rand(1)*n2)); ts1 = find(ind1==s1); ts2 = notselectedind(ceil(rand(1)*numel(notselectedind))); if assntrue(ts2)~=2 cneg = cneg+1; else assn(:)=0; assn(ts1)=1; assn(ts2)=2; rind = randperm(n1); rind([ts1 ts2]) = []; c = 0; while ~isempty(rind) for t = 1:numel(rind) r = rind(t); if ~assn(r) assnr = assn(adjlog{r}); end if ~assn(r) && sum(assnr)>0 assnr1 = logical(assnr==1); assnr2 = logical(assnr==2); isadj1 = any(assnr1); isadj2 = any(assnr2); if isadj1 && ~isadj2 adj1 = adj{r}(assnr1); p = 1-prod(1-pE(adjmat(r, adj1))); if rand(1) < p assn(r) = 1; end elseif isadj2 && ~isadj1 adj2 = adj{r}(assnr2); p = 1-prod(1-pE(adjmat(r, adj2))); if rand(1) < p assn(r) = 2; end else adj1 = adj{r}(assnr1); adj2 = adj{r}(assnr2); p1 = 1-prod(1-pE(adjmat(r, adj1))); p2 = 1-prod(1-pE(adjmat(r, adj2))); p1 = p1 / (p1 + p2); if rand(1) < p1 assn(r) = 1; else assn(r) = 2; end end if (assn(r)==1 && assntrue(r)==2) || (assn(r)==2 && assntrue(r)==1) assn(logical(assn==0)) = 3; break; end end % end: if unassigned and has assigned adjacent sp end % end: loop through randomly ordered indices rind = rind(logical(assn(rind)==0)); end % end: loop until all assigned while any(~assn) if any(assn~=assntrue) cneg = cneg + 1; else cpos = cpos + 1; end end % end: if ts2 matches profile end % end: loop over iterations p = p * max(cpos/(cpos+cneg), 1/niter); end % compute prob for subset
``` import numpy as np import scipy as sp import sympy import matplotlib.pyplot as plt import matplotlib as mpl ``` ``` # activate pop up plots #%matplotlib qt # or change to inline plots %matplotlib inline ``` ``` # some sample data x = np.arange(0,10,0.1) ``` ``` page_width_cm = 13 dpi = 200 inch = 2.54 # inch in cm # setting global plot configuration using the RC configuration style plt.rc('font', family='serif') plt.rc('xtick', labelsize=12) # tick labels plt.rc('ytick', labelsize=20) # tick labels plt.rc('axes', labelsize=20) # axes labels # If you don’t need LaTeX, don’t use it. It is slower to plot, and text # looks just fine without. If you need it, e.g. for symbols, then use it. #plt.rc('text', usetex=True) #<- P-E: Doesn't work on my Mac ``` ``` # create a figure instance, note that figure size is given in inches! fig, ax = plt.subplots(nrows=1, ncols=1, figsize=(8,6)) # set the big title (note aligment relative to figure) fig.suptitle("suptitle 16, figure alignment", fontsize=16) # actual plotting ax.plot(x, x**2, label="label 12") # set axes title (note aligment relative to axes) ax.set_title("title 14, axes alignment", fontsize=14) # axes labels ax.set_xlabel('xlabel 12') ax.set_ylabel(r'$y_{\alpha}$ 12', fontsize=8) # legend ax.legend(fontsize=12, loc="best") ############################################################## ##Ploting Grid plt.grid() #Changing Legend ax.legend(loc=4) ax.plot(x, x**2,color="purple", lw=1, ls='-', marker='s',markevery=5, markersize=8,markerfacecolor="yellow", markeredgewidth=2, markeredgecolor="blue", label="label 12") #Subplot #SubPlot fig, ax1 = plt.subplots(nrows=1, ncols=1, figsize=(8,6)) ax1.plot(x, x**3, label="label 12") ax1.set_title("Sub-plotting", fontsize=14) # saving the figure in different formats fig.savefig('figure-%03i.png' % dpi, dpi=dpi) fig.savefig('figure.svg') fig.savefig('figure.eps') ``` ``` ### Countour Plotting import math from pylab import * alpha = 0.7 phi_ext = 2 * math.pi * 0.5 def flux_qubit_potential(phi_m, phi_p): return 2 + alpha - 2 * np.cos(phi_p)*np.cos(phi_m) - alpha * np.cos(phi_ext - 2*phi_p) phi_m = np.linspace(0, 2*math.pi, 100) phi_p = np.linspace(0, 2*math.pi, 100) X,Y = np.meshgrid(phi_p, phi_m) Z = flux_qubit_potential(X, Y).T fig, ax = plt.subplots() cnt = contour(Z, cmap=cm.RdBu, vmin=abs(Z).min(), vmax=abs(Z).max(), extent=[0, 1, 0, 1]) # Second Axis ax2 = ax.twinx() ax2.set_ylabel(r"Temperature ($^\circ$C)") ax2.set_ylim(0, 35) #Add Line axvline(x=0.5, ymin=0, ymax=1) axhline(y=25,xmin=0,xmax=1) #autoformat dates for nice printing on the x-axis using fig.autofmt_xdate() fig.autofmt_xdate(bottom=0.2, rotation=30, ha='right') ``` # Advanced exercises We are going to play a bit with regression -Create a vector x of equally spaced number between x∈[0,5Ο€] of 1000 points (keyword: linspace) -create a vector y, so that y=sin(x) with some random noise -plot it -Try to do a polynomial fit on y(x) using numpy.polyfit, with different polynomial degree ``` x= np.linspace(0, 5*math.pi, 1000) Y= np.sin(x) noise = np.random.normal(-0.1,0.1,1000) y=Y+noise fig, ax1 = plt.subplots(nrows=1, ncols=1, figsize=(8,6)) fig.suptitle("Sin + Noise", fontsize=16) ax1.plot(x, y,color="black",lw=2, ls='*', marker='.', label="Sin(x) + Noise") plt.plot(x,Y,color="red", linewidth=2.00,label="Sin(x)") for i in [2,4,6,8,10]: p = np.poly1d(np.polyfit(x,y,i)) plt.plot(x,p(x), linewidth=2.00,label="Fit order: "+str(i)) ax1.legend(fontsize=12, loc="best") ``` ``` ```
lemma cbox01_nonempty [simp]: "cbox 0 One \<noteq> {}"
\section*{Introduction} \input{content/abstract.tex} Intuitively, it seems as if every natural science has \emph{laws of nature}: A prominent example is Newton's \emph{law} of gravity in physics. Aside from the fact that many powerful scientific concepts are called \enquote{laws}, many scientists also work under the assumption of laws, or even actively try to discover new ones. A logical-positivist might define a \emph{law of nature} in its simplest form as a universal, necessary statement, which is not analytically true. This definition\footnote{Many definitions are more elaborate, I focused on the most essential parts.} is widely agreed upon \cite[57]{philsciencebook}. Laws of nature are required in \emph{covering law} (c.l.) models, like the deductive-nomological (DN) or the inductive-statistical (IS) model \cite[Ch. 3]{philsciencebook}. This class of models requires a scientific explanation to use at least one law of nature, which is relevant to (covers) the to-be-explained phenomenon. Nancy Cartwright argues in her 1983 essay \enquote{The Truth Doesn't Explain Much} that science does not use real laws of nature at all, rather that the explanation is made using \emph{ceteris paribus generalizations} and thus covering law models are false \cite{cartwright1980truth}. \section*{Ceteris Paribus Generalizations} According to Cartwright the common (and c.l.) view on scientific theories is, that they express truths about nature and help us explain natural phenomena. She argues this is false, since there are no covering laws in most scientific explanations. This means that they cannot account for most scientific explanations and thus \enquote{covering-law models let in too little}\cite[2]{cartwright1980truth}. But what do scientific theories use, if not laws of nature? They use ceteris paribus (c.p.) generalizations: statements which are applicable only under a specific set of conditions. This makes them fail the condition of universality in the definition of natural laws. Cartwright believes there are no exceptionless quantitative laws at all \cite[2]{cartwright1980truth}. To understand this argument of Cartwright, let us look at an example of atomic \enquote{laws}, take \enquote{Every atomic nucleus is positively charged.}. It is not-analytic, necessary and general at first glance. But this is only true until we learn of anti-matter, which has reversed charge, so atoms with negatively charged nuclei. Hence, the actual law is \enquote{In matter, every atomic nucleus is positively charged}. The addition of \enquote{In matter} is the ceteris paribus modifier, which makes the statement true again, but it does not fulfill universality anymore. Indeed, even the most successful physical theories, have some sort of c.p. modifier, e.g. \enquote{Under the condition that the gravity fields are not too strong, Newton's laws hold true.}. Today an even better theory emerged, Einstein's general relativity, which remains the best theory of gravitation to date. But is this a natural law? Physicists are very aware of its limitation, and apply numerous c.p. modifiers to it, like \enquote{Except at the center of a black hole} or \enquote{Except at quantum mechanical level}. Indeed, no accepted physical theory today comes without c.p. modifiers. \section*{Unknown Laws} Is the statement about the positivity of an atom's nucleus a law, if we don't yet know about the existence of antimatter? A defender of c.l. models would argue, that even if what scientists believed to be a natural law turns out wrong, there is some better, still unknown covering law, which is a true natural law. Cartwright objects this view, with two arguments \cite[5]{cartwright1980truth}. Firstly, it is a possibility, that there are no laws. This is not a necessity, but there seems to be no reason to discard this possibility. Natural laws may not be needed after all. Secondly, the promises of some still unknown law, are no explanations, but \enquote{they are at best assurances that explanations are to be had} \cite[5]{cartwright1980truth}. If it comes in handy, we can choose to believe in (unknown) laws, Cartwright argues, but we don't do that with any scientific reason. We cannot test unknown laws and unknown laws can not explain anything. \section*{Explanations} But what if we are in a hypothetical scenario, where humankind has found enough laws, so we can explain everything \footnote{Physicists call this the \enquote{theory of everything}.}. Is science over then? No, it is still \enquote{the job of science to tell us what kinds of explanations are admissible}\cite[7]{cartwright1980truth}, Cartwright argues. Assume we observe an atom moving away from a positively charged electric source. How does science explain this? We have our c.p. law of \enquote{the nucleus of matter atoms is positively charged}, we know, that positive charges repel each other, and that an atom has negatively charged electrons in its hull. All these laws are either analytically or come with (numerous, implicit) c.p. modifiers. The explanation is \enquote{The atom moved away, because it was positively charged as a whole, since there were more positive charges in the nucleus, than negative ones in the hull}. Cartwright would argue this is the right explanation to give, even if we can't be absolutely certain that it is right. Science does not have to give perfect explanations, and can allow for some oversight \cite[7,8]{cartwright1980truth}. In fact, this explanation can be absolutely wrong: Maybe the atom is made of antimatter, maybe it was not even the positively charged source, which made the atom move in the first place. Even in the case, that this explanation is completely right, we never used the more fundamental laws, which cover the phenomenon: We did not employ the SchrΓΆdinger-Equation, nor Quantum-Field-Theory and thus weaker c.p. generalizations are used in science to explain. \section*{How Does Science Explain?} I hold two objections with Cartwright's view on the job of science. While our explanation for why the atom moves might be perfectly reasonable in everyday life, it is at best a first hypothesis in a true scientific explanation \footnote{Although I have chosen a different example than Cartwright herself, this is also applicable to her dying camellias \cite[6]{cartwright1980truth}.}. In reality, science doesn't just find a reasonable explanation and calls it a day, a true scientific treatise explores (all) different possible explanations to a phenomenon, and rules out as many as possible, with repeated hypothesis-testing and experimentation. Secondly, while I admit that Cartwright gets rid of a lot of metaphysical implications of natural laws, I do not think we need to go so far, as to get rid of them completely. After all, scientists use them with great success. A c.p. modifier does not make a law less general. In fact, I argue it makes the law even more general. A natural law can include its own limitations (c.p. modifiers): It is still applicable in general, it will just tell you in some, or even most, of the cases that it is of no use. Cartwright argues, that there is also the possibility that no covering law might exist at all. I disagree. Even in the case, that some things in the universe turn out to be completely random, the law \enquote{Things happen with complete randomness.} is a natural law. I argue c.p. generalizations are natural laws, and they do explain a lot. Science does not offer any absolute truths, but in explaining (or describing) nature with c.p. laws at least some truth can be found, with the restrictions the c.p. modifiers provide. Take Newton's law of gravitation as a counterexample to Cartwright's argumentation: After it was discovered, that Mercury did not follow Newton's laws, what did science do? Scientists predicted a new planet in the solar system, but did they rest after giving this perfectly good explanation? No, instead Einstein developed general relativity, which explained the same thing. After the proposed planet was never seen, the new-planet-theory was discarded, and we added a c.p. modifier to Newtonian gravity. But Newtonian gravity still remains a useful, general law of nature to this day, which in some cases tells you, to not use it. There is still truth in Newtonian gravity. This has no big metaphysical implications: We do not need to believe that natural laws are true, in the sense that they are always right and applicable. In fact, science is about knowing the limitations of the very laws it uses. \section*{Conclusion} Science uses \emph{ceteris paribus} laws. Cartwright argues, that these are no laws of nature, since they are not general with their c.p. modifiers. While her argument elegantly gets rid of many metaphysical implications, she removes more than needed. I argue, c.p. laws are still laws of nature, if we include the c.p. modifiers, and with that they provide explanations. These laws of nature provide some truth, and are of central importance to scientific explanation.
(in-package :omega) (th~deftheorem maxmal-implies-prime-ideal (in abelian-ring) (conclusion (all-types aa bb (forall (lam (M (o bb)) (forall (lam (P (o bb)) (forall (lam (R (o bb)) (implies (maximal-ideal M R) (prime-ideal M R)))))))))))
[STATEMENT] lemma isometry_bidual_embedding[simp]: \<open>isometry bidual_embedding\<close> [PROOF STATE] proof (prove) goal (1 subgoal): 1. isometry bidual_embedding [PROOF STEP] by (simp add: norm_preserving_isometry)
theory prop_58 imports Main "$HIPSTER_HOME/IsaHipster" begin datatype 'a list = Nil2 | Cons2 "'a" "'a list" datatype ('a, 'b) Pair2 = Pair "'a" "'b" datatype Nat = Z | S "Nat" fun zip2 :: "'a list => 'b list => (('a, 'b) Pair2) list" where "zip2 (Nil2) y = Nil2" | "zip2 (Cons2 z x2) (Nil2) = Nil2" | "zip2 (Cons2 z x2) (Cons2 x3 x4) = Cons2 (Pair z x3) (zip2 x2 x4)" fun drop :: "Nat => 'a list => 'a list" where "drop (Z) y = y" | "drop (S z) (Nil2) = Nil2" | "drop (S z) (Cons2 x2 x3) = drop z x3" (*hipster zip drop *) lemma lemma_a [thy_expl]: "drop x3 Nil2 = Nil2" by (hipster_induct_schemes drop.simps) lemma lemma_aa [thy_expl]: "drop (S Z) (drop x3 y3) = drop (S x3) y3" by (hipster_induct_schemes drop.simps) (*hipster zip2*) lemma lemma_ab [thy_expl]: "zip2 Nil2 x1 = zip2 x1 Nil2" by (hipster_induct_schemes zip2.simps) lemma lemma_ac [thy_expl]: "zip2 Nil2 x1 = zip2 y1 Nil2" by (hipster_induct_schemes zip2.simps) (*hipster zip2 drop*) theorem x0 : "(drop n (zip2 xs ys)) = (zip2 (drop n xs) (drop n ys))" by (hipster_induct_schemes drop.simps zip2.simps Nat.exhaust) (* apply(induction xs ys arbitrary: n rule: zip2.induct) apply(simp_all) apply(metis drop.simps thy_expl zip2.simps) apply(metis drop.simps thy_expl zip2.simps) apply(metis drop.simps thy_expl zip2.simps Nat.exhaust) by (tactic {* Subgoal.FOCUS_PARAMS (K (Tactic_Data.hard_tac @{context})) @{context} 1 *})*) end
a <- as.hexmode(35) b <- as.hexmode(42) as.integer(a & b) # 34 as.integer(a | b) # 43 as.integer(xor(a, b)) # 9
Require Import GhostSimulations. Require Import Raft. Require Import UpdateLemmas. Local Arguments update {_} {_} {_} _ _ _ _ : simpl never. Require Import RaftRefinementInterface. Require Import CommonTheorems. Require Import SpecLemmas. Require Import RefinementSpecLemmas. Require Import LogsLeaderLogsInterface. Require Import AppendEntriesRequestLeaderLogsInterface. Require Import RefinedLogMatchingLemmasInterface. Require Import AllEntriesLeaderLogsTermInterface. Require Import LeaderLogsContiguousInterface. Require Import OneLeaderLogPerTermInterface. Require Import LeaderLogsSortedInterface. Require Import TermSanityInterface. Require Import AllEntriesTermSanityInterface. Require Import AllEntriesLogInterface. Section AllEntriesLog. Context {orig_base_params : BaseParams}. Context {one_node_params : OneNodeParams orig_base_params}. Context {raft_params : RaftParams orig_base_params}. Context {llli : logs_leaderLogs_interface}. Context {aerlli : append_entries_leaderLogs_interface}. Context {rlmli : refined_log_matching_lemmas_interface}. Context {aellti : allEntries_leaderLogs_term_interface}. Context {llci : leaderLogs_contiguous_interface}. Context {ollpti : one_leaderLog_per_term_interface}. Context {llsi : leaderLogs_sorted_interface}. Context {tsi : term_sanity_interface}. Context {rri : raft_refinement_interface}. Context {aetsi : allEntries_term_sanity_interface}. (* strategy : prove allEntries_log as inductive invariant, then prove allEntries_leaderLogs inductive from that *) Ltac update_destruct := match goal with | [ |- context [ update _ ?y _ ?x ] ] => destruct (name_eq_dec y x) end. Ltac update_destruct_hyp := match goal with | [ _ : context [ update _ ?y _ ?x ] |- _ ] => destruct (name_eq_dec y x) end. Ltac destruct_update := repeat (first [update_destruct_hyp|update_destruct]; subst; rewrite_update). Definition no_entries_past_current_term_host_lifted net := forall (h : name) e, In e (log (snd (nwState net h))) -> eTerm e <= currentTerm (snd (nwState net h)). Lemma no_entries_past_current_term_host_lifted_invariant : forall net, refined_raft_intermediate_reachable net -> no_entries_past_current_term_host_lifted net. Proof using rri tsi. unfold no_entries_past_current_term_host_lifted. pose proof deghost_spec. do 4 intro. repeat find_reverse_higher_order_rewrite. eapply lift_prop; eauto. intros. find_apply_lem_hyp no_entries_past_current_term_invariant; eauto. Qed. (** Succeed iff [x] is in the list [ls], represented with left-associated nested tuples. *) Ltac inList x ls := match ls with | x => idtac | (_, x) => idtac | (?LS, _) => inList x LS end. (** Try calling tactic function [f] on every element of tupled list [ls], keeping the first call not to fail. *) Ltac app f ls := match ls with | (?LS, ?X) => f X || app f LS || fail 1 | _ => f ls end. (** Run [f] on every element of [ls], not just the first that doesn't fail. *) Ltac all f ls := match ls with | (?LS, ?X) => f X; all f LS | (_, _) => fail 1 | _ => f ls end. Lemma appendEntries_haveNewEntries_false : forall net p t n pli plt es ci h e, refined_raft_intermediate_reachable net -> In p (nwPackets net) -> pBody p = AppendEntries t n pli plt es ci -> haveNewEntries (snd (nwState net h)) es = false -> In e es -> In e (log (snd (nwState net h))). Proof using rlmli. intros. unfold haveNewEntries in *. do_bool. intuition; [unfold not_empty in *; break_match; subst; simpl in *; intuition; congruence|]. break_match; try congruence. do_bool. find_apply_lem_hyp findAtIndex_elim. intuition. assert (es <> nil) by (destruct es; subst; simpl in *; intuition; congruence). find_eapply_lem_hyp maxIndex_non_empty. break_exists. intuition. find_copy_eapply_lem_hyp entries_sorted_nw_invariant; eauto. match goal with | H : In e es |- _ => copy_eapply maxIndex_is_max H; eauto end. repeat find_rewrite. find_eapply_lem_hyp entries_match_nw_host_invariant; eauto. Qed. Lemma maxIndex_le : forall l1 l2, sorted l1 -> contiguous_range_exact_lo l1 0 -> findAtIndex l1 (maxIndex l2) = None -> l2 = nil \/ (exists e, In e l2 /\ eIndex e = 0) \/ maxIndex l1 <= maxIndex l2. Proof using. intros. destruct l2; intuition. simpl in *. right. destruct l1; intuition. find_copy_eapply_lem_hyp findAtIndex_None; simpl in *; eauto. unfold contiguous_range_exact_lo in *. simpl in *. intuition. destruct (lt_eq_lt_dec 0 (eIndex e)); intuition; eauto. destruct (lt_eq_lt_dec (eIndex e0) (eIndex e)); intuition. exfalso. repeat break_if; do_bool; intuition. match goal with | H : forall _, _ < _ <= _ -> _ |- _ => specialize (H (eIndex e)) end; conclude_using omega. simpl in *. break_exists. intuition; subst; intuition. eapply findAtIndex_None; eauto. Qed. Lemma maxIndex_le' : forall l1 l2 i, sorted l1 -> contiguous_range_exact_lo l1 0 -> l2 <> nil -> contiguous_range_exact_lo l2 i -> findAtIndex l1 (maxIndex l2) = None -> maxIndex l1 <= maxIndex l2. Proof using. intros. find_eapply_lem_hyp maxIndex_le; intuition; eauto. break_exists. intuition. unfold contiguous_range_exact_lo in *. intuition. find_insterU. conclude_using eauto. omega. Qed. Lemma sorted_app_in_in : forall l1 l2 e e', sorted (l1 ++ l2) -> In e l1 -> In e' l2 -> eIndex e' < eIndex e. Proof using. induction l1; intros; simpl in *; intuition; eauto. subst. find_insterU. conclude_using ltac:(apply in_app_iff; intuition eauto). intuition. Qed. Lemma sorted_app_sorted_app_in1_in2 : forall l1 l2 l3 e e', sorted (l1 ++ l3) -> sorted (l2 ++ l3) -> In e l1 -> In e' (l2 ++ l3) -> eIndex e' = eIndex e -> In e' l2. Proof using. intros. do_in_app. intuition. match goal with | H : sorted (?l ++ ?l'), _ : In _ ?l, _ : In _ ?l' |- _ => eapply sorted_app_in_in in H end; eauto. omega. Qed. Lemma sorted_app_sorted_app_in1_in2_prefix : forall l1 l2 l3 l4 e e', sorted (l1 ++ l3) -> sorted (l2 ++ l4) -> Prefix l4 l3 -> In e l1 -> In e' (l2 ++ l4) -> eIndex e' = eIndex e -> In e' l2. Proof using. intros. do_in_app. intuition. find_eapply_lem_hyp Prefix_In; [|eauto]. match goal with | H : sorted (?l ++ ?l'), _ : In _ ?l, _ : In _ ?l' |- _ => eapply sorted_app_in_in in H end; eauto. omega. Qed. Lemma sorted_app_in2_in2 : forall l1 l2 e e', sorted (l1 ++ l2) -> In e' (l1 ++ l2) -> In e l2 -> eIndex e' = eIndex e -> In e' l2. Proof using. intros. do_in_app. intuition. match goal with | H : sorted (?l ++ ?l'), _ : In _ ?l, _ : In _ ?l' |- _ => eapply sorted_app_in_in in H end; eauto. omega. Qed. (* Lemma sorted_app_in3_in4_prefix : forall l1 l2 l3 l4 e e', sorted (l1 ++ l3) -> sorted (l2 ++ l4) -> Prefix l4 l3 -> In e l3 -> In e' (l2 ++ l4) -> eIndex e' = eIndex e -> In e' l4. Proof. intros. do_in_app. intuition. match goal with | H : sorted (?l ++ ?l'), _ : In _ ?l, _ : In _ ?l' |- _ => eapply sorted_app_in_in in H end; eauto. omega. Qed. *) Lemma sorted_term_index_le : forall l e e', sorted l -> In e l -> In e' l -> eTerm e' < eTerm e -> eIndex e' <= eIndex e. Proof using. induction l; intros; simpl in *; intuition; subst_max; intuition. - find_apply_hyp_hyp. intuition. - find_apply_hyp_hyp. intuition. Qed. Lemma term_ne_in_l2 : forall l e e' l1 l2, sorted l -> In e l -> (forall e', In e' l -> eTerm e' <= eTerm e) -> removeAfterIndex l (eIndex e) = l1 ++ l2 -> (forall e', In e' l1 -> eTerm e' = eTerm e) -> In e' l -> eTerm e' <> eTerm e -> In e' l2. Proof using. intros. assert (eIndex e' <= eIndex e) by (eapply sorted_term_index_le; eauto; find_apply_hyp_hyp; destruct (lt_eq_lt_dec (eTerm e') (eTerm e)); intuition). find_eapply_lem_hyp removeAfterIndex_le_In; eauto. repeat find_rewrite. do_in_app. intuition. find_apply_hyp_hyp. intuition. Qed. Lemma Prefix_maxIndex_eq : forall l l', Prefix l l' -> l <> nil -> maxIndex l = maxIndex l'. Proof using. intros. induction l; simpl in *; intuition. break_match; intuition. subst. simpl. auto. Qed. Lemma sorted_gt_maxIndex : forall e l1 l2, sorted (e :: l1 ++ l2) -> l2 <> nil -> maxIndex l2 < eIndex e. Proof using. intros; induction l1; simpl in *; intuition. - destruct l2; simpl in *; intuition. match goal with | H : forall _, ?e = _ \/ _ -> _ |- _ => specialize (H e) end; intuition. Qed. Lemma allEntries_log_append_entries : refined_raft_net_invariant_append_entries allEntries_log. Proof using aetsi rri tsi llsi ollpti llci aellti rlmli aerlli llli. red. unfold allEntries_log in *. simpl in *. intros. repeat find_higher_order_rewrite. destruct_update; simpl in *; [|find_apply_hyp_hyp; intuition; right; break_exists_exists; intuition; repeat find_higher_order_rewrite; destruct_update; simpl in *; eauto; rewrite update_elections_data_appendEntries_leaderLogs; eauto]. find_eapply_lem_hyp update_elections_data_appendEntries_allEntries_detailed; eauto. intuition; [|repeat find_rewrite; find_eapply_lem_hyp appendEntries_haveNewEntries_false; eauto]. find_copy_apply_hyp_hyp. intuition; [|right; break_exists_exists; intuition; repeat find_higher_order_rewrite; destruct_update; simpl in *; eauto; try rewrite update_elections_data_appendEntries_leaderLogs; eauto; subst; find_apply_lem_hyp handleAppendEntries_currentTerm_leaderId; intuition; repeat find_rewrite; auto]. destruct (in_dec entry_eq_dec e (log d)); intuition. right. find_copy_apply_lem_hyp handleAppendEntries_log_detailed. intuition; repeat find_rewrite; intuition. - subst. find_copy_eapply_lem_hyp allEntries_term_sanity_invariant; eauto. destruct (lt_eq_lt_dec t0 (currentTerm d)); intuition; unfold ghost_data in *; simpl in *; try omega. + find_eapply_lem_hyp append_entries_leaderLogs_invariant; eauto. break_exists. break_and. match goal with | H : In (?t, ?ll) (leaderLogs (fst (nwState _ ?leader))) |- _ => (exists t, leader, ll) end. split; [repeat find_higher_order_rewrite; destruct_update; simpl in *; eauto; rewrite update_elections_data_appendEntries_leaderLogs; eauto|]; split; auto; intuition; [break_exists; intuition; find_eapply_lem_hyp leaderLogs_contiguous_invariant; eauto; omega|]. subst. repeat find_rewrite. intuition. + subst. find_eapply_lem_hyp allEntries_leaderLogs_term_invariant; eauto. intuition. * subst. exfalso. find_copy_eapply_lem_hyp logs_leaderLogs_invariant; eauto. find_copy_eapply_lem_hyp append_entries_leaderLogs_invariant; eauto. break_exists; intuition; [break_exists; intuition; find_eapply_lem_hyp leaderLogs_contiguous_invariant; eauto; omega|]. subst. clean. repeat find_rewrite. find_eapply_lem_hyp one_leaderLog_per_term_log_invariant; eauto; conclude_using eauto. subst. match goal with | H : In _ _ -> False |- _ => apply H end. find_copy_eapply_lem_hyp entries_sorted_invariant; eauto. unfold entries_sorted in *. repeat find_rewrite. match goal with | _ : removeAfterIndex ?l (eIndex ?e) = _ |- _ => assert (In e (removeAfterIndex l (eIndex e))) by (eapply removeAfterIndex_le_In; eauto) end. repeat find_rewrite. do_in_app; intuition. assert (exists e', eIndex e' = eIndex e /\ In e' (x1 ++ x4)) by (eapply entries_contiguous_nw_invariant; eauto; intuition; [eapply entries_contiguous_invariant; eauto|]; eapply le_trans; [eapply maxIndex_is_max; eauto|]; eapply maxIndex_le'; eauto; [eapply entries_contiguous_invariant; eauto| eapply entries_contiguous_nw_invariant; eauto]). break_exists. intuition. find_copy_eapply_lem_hyp sorted_app_sorted_app_in1_in2. Focus 5. eauto. Focus 4. eauto. all:(try solve [eapply entries_sorted_nw_invariant; eauto]). all:(try solve [repeat find_reverse_rewrite; eauto using removeAfterIndex_sorted]). find_apply_hyp_hyp. find_eapply_lem_hyp entries_match_nw_host_invariant; eauto; repeat conclude_using eauto. match goal with | H : eIndex _ = eIndex _ |- _ => eapply uniqueIndices_elim_eq in H end; eauto using sorted_uniqueIndices. subst. auto. * exfalso. find_copy_eapply_lem_hyp append_entries_leaderLogs_invariant; eauto. break_exists; intuition; [break_exists; intuition; find_eapply_lem_hyp leaderLogs_contiguous_invariant; eauto; omega|]. subst. clean. find_eapply_lem_hyp one_leaderLog_per_term_log_invariant; eauto; conclude_using eauto. subst. match goal with | H : In _ _ -> False |- _ => apply H end. repeat find_rewrite. apply in_app_iff; intuition. - subst. find_copy_eapply_lem_hyp allEntries_term_sanity_invariant; eauto. destruct (lt_eq_lt_dec t0 (currentTerm d)); intuition; unfold ghost_data in *; simpl in *; try omega. + find_eapply_lem_hyp append_entries_leaderLogs_invariant; eauto. break_exists. break_and. match goal with | H : In (?t, ?ll) (leaderLogs (fst (nwState _ ?leader))) |- _ => (exists t, leader, ll) end. find_higher_order_rewrite. split; [subst; find_higher_order_rewrite; destruct_update; simpl in *; eauto; rewrite update_elections_data_appendEntries_leaderLogs; eauto|]; split; auto. intuition; [break_exists; intuition; find_eapply_lem_hyp leaderLogs_contiguous_invariant; eauto; omega|]. subst. repeat find_rewrite. intuition. + subst. find_eapply_lem_hyp allEntries_leaderLogs_term_invariant; eauto. intuition. * { subst. exfalso. find_copy_eapply_lem_hyp logs_leaderLogs_invariant; eauto. find_copy_eapply_lem_hyp append_entries_leaderLogs_invariant; eauto. break_exists; intuition; [break_exists; intuition; find_eapply_lem_hyp leaderLogs_contiguous_invariant; eauto; omega|]. subst. clean. repeat find_rewrite. find_eapply_lem_hyp one_leaderLog_per_term_log_invariant; eauto; conclude_using eauto. subst. match goal with | H : In _ _ -> False |- _ => apply H end. find_copy_eapply_lem_hyp entries_sorted_invariant; eauto. unfold entries_sorted in *. repeat find_rewrite. match goal with | _ : removeAfterIndex ?l (eIndex ?e) = _ |- _ => assert (In e (removeAfterIndex l (eIndex e))) by (eapply removeAfterIndex_le_In; eauto) end. repeat find_rewrite. do_in_app; intuition. find_apply_lem_hyp findAtIndex_elim. intuition. find_copy_apply_lem_hyp maxIndex_non_empty. break_exists. intuition. match goal with | _ : In ?e' (log _), _ : maxIndex ?l = eIndex ?e' |- _ => destruct (le_lt_dec (eIndex e) (maxIndex l)) end. - assert (exists e', eIndex e' = eIndex e /\ In e' (x1 ++ x4)) by (eapply entries_contiguous_nw_invariant; eauto; intuition; eapply entries_gt_0_invariant; eauto). break_exists. intuition. find_copy_eapply_lem_hyp sorted_app_sorted_app_in1_in2. Focus 5. eauto. Focus 4. eauto. all:(try solve [eapply entries_sorted_nw_invariant; eauto]). all:(try solve [repeat find_reverse_rewrite; eauto using removeAfterIndex_sorted]). find_apply_hyp_hyp. find_eapply_lem_hyp entries_match_nw_host_invariant; eauto; repeat conclude_using eauto. match goal with | H : eIndex _ = eIndex _ |- _ => eapply uniqueIndices_elim_eq in H end; eauto using sorted_uniqueIndices. subst. auto. - exfalso. repeat find_rewrite. match goal with | _ : eIndex ?e' = eIndex ?x, _ : eIndex ?x < ?i, _ : context [removeAfterIndex ?l ?i] |- _ => assert (In e' (removeAfterIndex l i)) by (eapply removeAfterIndex_le_In; auto; omega) end. repeat find_rewrite. do_in_app. intuition. + find_copy_eapply_lem_hyp sorted_app_sorted_app_in1_in2. Focus 4. eauto. all:eauto. all:(try solve [eapply entries_sorted_nw_invariant; eauto]). all:(try solve [repeat find_reverse_rewrite; eauto using removeAfterIndex_sorted]). repeat find_apply_hyp_hyp. repeat find_rewrite. intuition. + find_eapply_lem_hyp leaderLogs_sorted_invariant; eauto. find_copy_eapply_lem_hyp sorted_app_in2_in2. Focus 3. eauto. all:eauto. all:(try solve [eapply entries_sorted_nw_invariant; eauto]). match goal with | H : eIndex ?e1 = eIndex ?e2, _ : In ?e1 ?ll, _ : In ?e2 ?ll |- _ => eapply uniqueIndices_elim_eq with (xs0 := ll) in H end; eauto using sorted_uniqueIndices. subst. intuition. } * exfalso. find_copy_eapply_lem_hyp append_entries_leaderLogs_invariant; eauto. break_exists; intuition; [break_exists; intuition; find_eapply_lem_hyp leaderLogs_contiguous_invariant; eauto; omega|]. subst. clean. find_eapply_lem_hyp one_leaderLog_per_term_log_invariant; eauto; conclude_using eauto. subst. match goal with | H : In _ _ -> False |- _ => apply H end. repeat find_rewrite. apply in_app_iff; intuition. - find_copy_eapply_lem_hyp allEntries_term_sanity_invariant; eauto. destruct (lt_eq_lt_dec t0 t); intuition; unfold ghost_data in *; simpl in *; try omega. + match goal with | H : context [pBody] |- _ => copy_eapply append_entries_leaderLogs_invariant H end; eauto. break_exists. break_and. subst. match goal with | H : In (?t, ?ll) (leaderLogs (fst (nwState _ ?leader))) |- _ => (exists t, leader, ll) end. split; [find_higher_order_rewrite; destruct_update; simpl in *; eauto; rewrite update_elections_data_appendEntries_leaderLogs; eauto|]; split; auto. intuition; subst. * find_false. apply in_app_iff. right. eapply removeAfterIndex_le_In; eauto. find_eapply_lem_hyp leaderLogs_sorted_invariant; eauto. eapply le_trans; [eapply maxIndex_is_max; eauto|]. omega. * { break_exists. intuition. unfold Prefix_sane in *. intuition. - destruct (le_lt_dec (eIndex e) (eIndex x3)). + match goal with | H : In e _ -> False |- _ => apply H end. apply in_app_iff. right. apply removeAfterIndex_le_In; auto. + match goal with | H : In e _ -> False |- _ => apply H end. apply in_app_iff. left. apply in_app_iff. right. find_eapply_lem_hyp leaderLogs_sorted_invariant; eauto. eapply prefix_contiguous; eauto. find_copy_eapply_lem_hyp entries_sorted_nw_invariant; eauto. eapply contiguous_app; eauto. eapply entries_contiguous_nw_invariant; eauto. - find_false. repeat find_rewrite. apply in_app_iff. right. find_eapply_lem_hyp leaderLogs_sorted_invariant; eauto. apply removeAfterIndex_le_In; auto. eapply maxIndex_is_max; eauto. } * find_false. intuition. + subst. find_eapply_lem_hyp allEntries_leaderLogs_term_invariant; eauto. intuition. * { subst. exfalso. find_copy_eapply_lem_hyp logs_leaderLogs_invariant; eauto. find_copy_eapply_lem_hyp append_entries_leaderLogs_invariant; eauto. break_exists. break_and. repeat find_rewrite. find_eapply_lem_hyp one_leaderLog_per_term_log_invariant; eauto. conclude_using eauto. subst. intuition. - repeat find_rewrite. destruct (le_lt_dec (eIndex e) (eIndex x6)). + match goal with | H : In e _ -> False |- _ => apply H end. apply in_app_iff. right. apply removeAfterIndex_le_In; auto. + match goal with | H : In e _ -> False |- _ => apply H end. apply in_app_iff. left. find_copy_eapply_lem_hyp entries_sorted_invariant. find_eapply_lem_hyp maxIndex_le'; eauto; [|eapply entries_contiguous_invariant; eauto|eapply entries_contiguous_nw_invariant; eauto]. find_copy_eapply_lem_hyp entries_contiguous_nw_invariant; eauto. unfold contiguous_range_exact_lo in *. break_and. find_copy_eapply_lem_hyp entries_sorted_invariant. match goal with | H : forall _, _ < _ <= _ -> _ |- _ => specialize (H (eIndex e)); conclude_using ltac:(intuition; eapply le_trans; [eapply maxIndex_is_max; eauto|]; eauto) end. break_exists. break_and. match goal with | H : eIndex ?x = eIndex e |- _ => copy_eapply entries_match_nw_host_invariant H end; eauto. find_copy_eapply_lem_hyp leaderLogs_sorted_invariant; eauto. conclude_using ltac:(match goal with | H : _ |- _ => apply H end; do_in_app; intuition; match goal with | H : In ?x _ |- In ?x _ => copy_eapply Prefix_maxIndex H end; [|idtac|eauto]; eauto; omega). conclude_using eauto. conclude_using auto. match goal with | H : _ = _ |- _ => eapply uniqueIndices_elim_eq in H end; eauto; eauto using sorted_uniqueIndices. subst. auto. - break_exists. break_and. destruct (le_lt_dec (eIndex e) (eIndex x6)). + match goal with | H : In e _ -> False |- _ => apply H end. apply in_app_iff. right. apply removeAfterIndex_le_In; auto. + match goal with | _ : removeAfterIndex _ (eIndex ?e) = ?l |- _ => assert (In e l) by (repeat find_reverse_rewrite; eapply removeAfterIndex_le_In; auto) end. find_copy_eapply_lem_hyp entries_sorted_invariant. assert (exists e', eIndex e' = eIndex e /\ In e' (x1 ++ x2)) by (eapply entries_contiguous_nw_invariant; eauto; intuition; eapply le_trans; [eapply maxIndex_is_max; eauto|]; eapply maxIndex_le'; eauto; [eapply entries_contiguous_invariant; eauto| eapply entries_contiguous_nw_invariant; eauto]). do_in_app. intuition. * break_exists. break_and. match goal with | H : eIndex _ = eIndex _ |- _ => copy_eapply sorted_app_sorted_app_in1_in2_prefix H end; eauto. all:try solve [repeat find_reverse_rewrite; eauto using removeAfterIndex_sorted]. all:try solve [eapply entries_sorted_nw_invariant; eauto]. find_apply_hyp_hyp. match goal with | H : In e _ -> False |- _ => apply H end. apply in_app_iff. left. match goal with | H : eIndex _ = eIndex _ |- _ => copy_eapply entries_match_nw_host_invariant H end; eauto. concludes. repeat conclude_using eauto. match goal with | H : eIndex _ = eIndex _ |- _ => copy_eapply uniqueIndices_elim_eq H end; eauto using sorted_uniqueIndices. subst. auto. * find_copy_eapply_lem_hyp leaderLogs_sorted_invariant; eauto. unfold Prefix_sane in *. intuition; [|find_eapply_lem_hyp maxIndex_is_max; eauto; omega]. find_eapply_lem_hyp prefix_contiguous. Focus 2. eauto. all:eauto. all:try solve [eapply contiguous_app; [|eapply entries_contiguous_nw_invariant; eauto]; eapply entries_sorted_nw_invariant; eauto]. match goal with | H : In e _ -> False |- _ => apply H end. intuition. - subst. destruct (le_lt_dec (eIndex e) (eIndex x6)). + match goal with | H : In e _ -> False |- _ => apply H end. apply in_app_iff. right. apply removeAfterIndex_le_In; auto. + match goal with | _ : removeAfterIndex _ (eIndex ?e) = ?l |- _ => assert (In e l) by (repeat find_reverse_rewrite; eapply removeAfterIndex_le_In; auto) end. find_copy_eapply_lem_hyp entries_sorted_invariant. assert (exists e', eIndex e' = eIndex e /\ In e' (x1 ++ x4)) by (eapply entries_contiguous_nw_invariant; eauto; intuition; eapply le_trans; [eapply maxIndex_is_max; eauto|]; eapply maxIndex_le'; eauto; [eapply entries_contiguous_invariant; eauto| eapply entries_contiguous_nw_invariant; eauto]). do_in_app. intuition. * break_exists. break_and. match goal with | H : eIndex _ = eIndex _ |- _ => copy_eapply sorted_app_sorted_app_in1_in2 H end; eauto. all:try solve [repeat find_reverse_rewrite; eauto using removeAfterIndex_sorted]. all:try solve [eapply entries_sorted_nw_invariant; eauto]. find_apply_hyp_hyp. match goal with | H : In e _ -> False |- _ => apply H end. apply in_app_iff. left. match goal with | H : eIndex _ = eIndex _ |- _ => copy_eapply entries_match_nw_host_invariant H end; eauto. concludes. repeat conclude_using eauto. match goal with | H : eIndex _ = eIndex _ |- _ => copy_eapply uniqueIndices_elim_eq H end; eauto using sorted_uniqueIndices. subst. auto. * match goal with | H : In e _ -> False |- _ => apply H end. intuition. } * { exfalso. find_copy_apply_lem_hyp append_entries_leaderLogs_invariant; eauto. break_exists; intuition. copy_eapply_prop_hyp append_entries_leaderLogs pBody; eauto. break_exists; break_and. subst. find_eapply_lem_hyp one_leaderLog_per_term_log_invariant; eauto; conclude_using eauto. subst. match goal with | H : In _ _ -> False |- _ => apply H end. find_copy_apply_lem_hyp leaderLogs_sorted_invariant; auto. find_copy_apply_lem_hyp maxIndex_is_max; auto. destruct (le_lt_dec (eIndex e) (eIndex x1)); [apply in_app_iff; right; eapply removeAfterIndex_le_In; eauto|]. repeat find_rewrite. apply in_app_iff; intuition. - omega. - break_exists; break_and. unfold Prefix_sane in *. break_or_hyp; try omega. left; apply in_app_iff; right. eapply prefix_contiguous; eauto. eapply contiguous_app; [|eapply entries_contiguous_nw_invariant; eauto]; eapply entries_sorted_nw_invariant; eauto. - subst. intuition. } - find_copy_eapply_lem_hyp allEntries_term_sanity_invariant; eauto. destruct (lt_eq_lt_dec t0 t); intuition; unfold ghost_data in *; simpl in *; try omega. + match goal with | H : context [pBody] |- _ => copy_eapply append_entries_leaderLogs_invariant H end; eauto. break_exists. break_and. subst. match goal with | H : In (?t, ?ll) (leaderLogs (fst (nwState _ ?leader))) |- _ => (exists t, leader, ll) end. split; [find_higher_order_rewrite; destruct_update; simpl in *; eauto; rewrite update_elections_data_appendEntries_leaderLogs; eauto|]; split; auto. intuition; subst. * find_false. apply in_app_iff. right. eapply removeAfterIndex_le_In; eauto. find_eapply_lem_hyp leaderLogs_sorted_invariant; eauto. eapply le_trans; [eapply maxIndex_is_max; eauto|]. omega. * { break_exists. intuition. unfold Prefix_sane in *. intuition. - destruct (le_lt_dec (eIndex e) (eIndex x4)). + match goal with | H : In e _ -> False |- _ => apply H end. apply in_app_iff. right. apply removeAfterIndex_le_In; auto. + match goal with | H : In e _ -> False |- _ => apply H end. apply in_app_iff. left. apply in_app_iff. right. find_eapply_lem_hyp leaderLogs_sorted_invariant; eauto. eapply prefix_contiguous; eauto. find_copy_eapply_lem_hyp entries_sorted_nw_invariant; eauto. eapply contiguous_app; eauto. eapply entries_contiguous_nw_invariant; eauto. - find_false. repeat find_rewrite. apply in_app_iff. right. find_eapply_lem_hyp leaderLogs_sorted_invariant; eauto. apply removeAfterIndex_le_In; auto. eapply maxIndex_is_max; eauto. } * find_false. intuition. + subst. find_eapply_lem_hyp allEntries_leaderLogs_term_invariant; eauto. intuition. * { subst. exfalso. find_copy_eapply_lem_hyp logs_leaderLogs_invariant; eauto. find_copy_eapply_lem_hyp append_entries_leaderLogs_invariant; eauto. break_exists. break_and. find_eapply_lem_hyp one_leaderLog_per_term_log_invariant; eauto. repeat find_rewrite. conclude_using eauto. subst. find_eapply_lem_hyp le_antisym; eauto. destruct x1. - simpl in *. destruct x2; simpl in *; auto. break_match; auto. match goal with | H : _ \/ (exists _, _) \/ _ |- _ => clear H end. break_and. subst. cut (e1 = x6); intros; subst; auto. find_apply_lem_hyp findAtIndex_elim. break_and. find_copy_apply_lem_hyp entries_sorted_invariant. eapply uniqueIndices_elim_eq; eauto using sorted_uniqueIndices. eapply removeAfterIndex_in with (i := (eIndex e)). unfold raft_data, ghost_data in *; simpl in *. unfold raft_data, ghost_data in *; simpl in *. repeat find_rewrite. intuition. - simpl in *. match goal with | H : forall _, ?e = _ \/ _ -> _ |- _ => specialize (H e) end. conclude_using auto. repeat find_rewrite. find_apply_lem_hyp findAtIndex_elim. break_and. find_eapply_lem_hyp term_ne_in_l2. Focus 7. eauto. all:eauto. all:try solve [eapply entries_sorted_invariant; eauto]. all:try solve [intros; find_eapply_lem_hyp no_entries_past_current_term_host_lifted_invariant; unfold ghost_data, raft_data in *; simpl in *; unfold ghost_data, raft_data in *; simpl in *; repeat find_rewrite; eauto]. assert (eIndex e0 <= maxIndex x4) by (repeat find_rewrite; eapply maxIndex_is_max; eauto; eapply leaderLogs_sorted_invariant; eauto). assert (eIndex x7 < eIndex e0) by (eapply entries_contiguous_nw_invariant; eauto; intuition). intuition. + break_exists. break_and. unfold Prefix_sane in *. intuition. find_copy_eapply_lem_hyp Prefix_maxIndex_eq; eauto. find_eapply_lem_hyp entries_sorted_nw_invariant; eauto. find_eapply_lem_hyp sorted_gt_maxIndex; eauto; omega. + subst. find_eapply_lem_hyp entries_sorted_nw_invariant; eauto. find_eapply_lem_hyp sorted_gt_maxIndex; eauto; try omega. destruct x4; simpl in *; congruence. } * { exfalso. find_copy_apply_lem_hyp append_entries_leaderLogs_invariant; eauto. break_exists; intuition. subst. copy_eapply_prop_hyp append_entries_leaderLogs pBody; eauto. break_exists; break_and. subst. find_eapply_lem_hyp one_leaderLog_per_term_log_invariant; eauto; conclude_using eauto. subst. match goal with | H : In _ _ -> False |- _ => apply H end. find_copy_apply_lem_hyp leaderLogs_sorted_invariant; auto. find_copy_apply_lem_hyp maxIndex_is_max; auto. destruct (le_lt_dec (eIndex e) (eIndex x2)); [apply in_app_iff; right; eapply removeAfterIndex_le_In; eauto|]. repeat find_rewrite. apply in_app_iff; intuition. - omega. - break_exists; break_and. unfold Prefix_sane in *. break_or_hyp; try omega. left; apply in_app_iff; right. eapply prefix_contiguous; eauto. eapply contiguous_app; [|eapply entries_contiguous_nw_invariant; eauto]; eapply entries_sorted_nw_invariant; eauto. - subst. intuition. } Qed. Lemma handleAppendEntriesReply_currentTerm_leaderId : forall h st h' t es res st' m, handleAppendEntriesReply h st h' t es res = (st', m) -> currentTerm st < currentTerm st' \/ (currentTerm st = currentTerm st' /\ leaderId st' = leaderId st). Proof using. intros. unfold handleAppendEntriesReply, advanceCurrentTerm in *. repeat (break_match; try find_inversion; simpl in *; auto). Qed. Lemma allEntries_log_append_entries_reply : refined_raft_net_invariant_append_entries_reply allEntries_log. Proof using. red. unfold allEntries_log in *. intros. simpl in *. repeat find_higher_order_rewrite. find_copy_apply_lem_hyp handleAppendEntriesReply_log. find_apply_lem_hyp handleAppendEntriesReply_currentTerm_leaderId. destruct_update; simpl in *; eauto; find_apply_hyp_hyp; repeat find_rewrite; intuition; right; break_exists_exists; repeat find_rewrite; intuition; find_higher_order_rewrite; destruct_update; simpl in *; auto. Qed. Lemma update_elections_data_requestVote_leaderLogs : forall h h' t lli llt st, leaderLogs (update_elections_data_requestVote h h' t h' lli llt st) = leaderLogs (fst st). Proof using. unfold update_elections_data_requestVote. intros. repeat break_match; auto. Qed. Lemma update_elections_data_requestVoteReply_leaderLogs : forall h h' t st t' ll' r, In (t', ll') (leaderLogs (fst st)) -> In (t', ll') (leaderLogs (update_elections_data_requestVoteReply h h' t r st)). Proof using. unfold update_elections_data_requestVoteReply. intros. repeat break_match; auto. simpl in *. intuition. Qed. Lemma allEntries_log_request_vote : refined_raft_net_invariant_request_vote allEntries_log. Proof using. red. unfold allEntries_log in *. intros. simpl in *. repeat find_higher_order_rewrite. find_copy_apply_lem_hyp handleRequestVote_log. find_apply_lem_hyp handleRequestVote_currentTerm_leaderId. destruct_update; simpl in *; eauto; try find_rewrite_lem update_elections_data_requestVote_allEntries; find_apply_hyp_hyp; repeat find_rewrite; intuition; right; break_exists_exists; intuition; repeat find_higher_order_rewrite; destruct_update; simpl in *; auto; rewrite update_elections_data_requestVote_leaderLogs; auto. Qed. Lemma handleRequestVoteReply_log' : forall h st h' t r, log (handleRequestVoteReply h st h' t r) = log st. Proof using. eauto using handleRequestVoteReply_log. Qed. Lemma allEntries_log_request_vote_reply : refined_raft_net_invariant_request_vote_reply allEntries_log. Proof using. red. unfold allEntries_log in *. intros. simpl in *. find_copy_apply_lem_hyp handleRequestVoteReply_currentTerm_leaderId. repeat find_higher_order_rewrite. destruct_update; simpl in *; eauto; try rewrite handleRequestVoteReply_log'; try find_rewrite_lem update_elections_data_requestVoteReply_allEntries; find_apply_hyp_hyp; repeat find_rewrite; intuition; right; break_exists_exists; repeat find_rewrite; intuition; find_higher_order_rewrite; destruct_update; simpl in *; auto; apply update_elections_data_requestVoteReply_leaderLogs; auto. Qed. Lemma update_elections_data_client_request_allEntries' : forall h st client id c out st' ms t e, handleClientRequest h (snd st) client id c = (out, st', ms) -> In (t, e) (allEntries (update_elections_data_client_request h st client id c)) -> In (t, e) (allEntries (fst st)) \/ In e (log st'). Proof using. intros. unfold update_elections_data_client_request in *. repeat break_match; repeat find_inversion; auto. simpl in *. intuition. find_inversion. repeat find_rewrite. intuition. Qed. Lemma handleClientRequest_currentTerm_leaderId : forall h st client id c out st' ms, handleClientRequest h st client id c = (out, st', ms) -> currentTerm st' = currentTerm st /\ leaderId st' = leaderId st. Proof using. intros. unfold handleClientRequest in *. subst. break_match; try find_inversion; simpl in *; auto. Qed. Lemma allEntries_log_client_request : refined_raft_net_invariant_client_request allEntries_log. Proof using. red. unfold allEntries_log in *. intros. simpl in *. repeat find_higher_order_rewrite. destruct_update; simpl in *; try (find_eapply_lem_hyp update_elections_data_client_request_allEntries'; eauto; [idtac]); intuition; find_copy_apply_lem_hyp handleClientRequest_log; find_apply_lem_hyp handleClientRequest_currentTerm_leaderId; intuition; try break_exists; intuition; repeat find_rewrite; intuition; simpl in *; find_apply_hyp_hyp; intuition; repeat right; break_exists_exists; intuition; repeat find_higher_order_rewrite; destruct_update; simpl in *; auto; rewrite update_elections_data_client_request_leaderLogs; auto. Qed. Lemma handleTimeout_currentTerm_leaderId : forall h st out st' ms, handleTimeout h st = (out, st', ms) -> currentTerm st < currentTerm st' \/ currentTerm st' = currentTerm st /\ leaderId st' = leaderId st. Proof using. intros. unfold handleTimeout, tryToBecomeLeader in *. subst. break_match; try find_inversion; simpl in *; auto. Qed. Lemma allEntries_log_timeout : refined_raft_net_invariant_timeout allEntries_log. Proof using. red. unfold allEntries_log in *. intros. simpl in *. repeat find_higher_order_rewrite. destruct_update; simpl in *; try find_rewrite_lem update_elections_data_timeout_allEntries; find_copy_apply_lem_hyp handleTimeout_log_same; find_apply_lem_hyp handleTimeout_currentTerm_leaderId; repeat find_rewrite; find_apply_hyp_hyp; intuition; right; break_exists_exists; intuition; repeat find_higher_order_rewrite; destruct_update; simpl in *; auto; rewrite update_elections_data_timeout_leaderLogs; auto. Qed. Lemma doLeader_currentTerm_leaderId : forall st h out st' m, doLeader st h = (out, st', m) -> currentTerm st' = currentTerm st /\ leaderId st' = leaderId st. Proof using. intros. unfold doLeader, advanceCommitIndex in *. repeat break_match; find_inversion; simpl in *; auto. Qed. Lemma allEntries_log_do_leader : refined_raft_net_invariant_do_leader allEntries_log. Proof using. red. unfold allEntries_log in *. intros. simpl in *. match goal with | H : nwState ?net ?h = (?gd, ?d) |- _ => replace gd with (fst (nwState net h)) in * by (rewrite H; reflexivity); replace d with (snd (nwState net h)) in * by (rewrite H; reflexivity); clear H end. repeat find_higher_order_rewrite. find_copy_apply_lem_hyp doLeader_log. find_apply_lem_hyp doLeader_currentTerm_leaderId. destruct_update; simpl in *; eauto; find_apply_hyp_hyp; repeat find_rewrite; intuition; right; break_exists_exists; intuition; find_higher_order_rewrite; destruct_update; simpl in *; auto. Qed. Lemma doGenericServer_currentTerm_leaderId : forall st h out st' m, doGenericServer h st = (out, st', m) -> currentTerm st' = currentTerm st /\ leaderId st' = leaderId st. Proof using. intros. unfold doGenericServer in *. repeat break_match; find_inversion; use_applyEntries_spec; subst; simpl in *; auto. Qed. Lemma allEntries_log_do_generic_server : refined_raft_net_invariant_do_generic_server allEntries_log. Proof using. red. unfold allEntries_log in *. intros. simpl in *. match goal with | H : nwState ?net ?h = (?gd, ?d) |- _ => replace gd with (fst (nwState net h)) in * by (rewrite H; reflexivity); replace d with (snd (nwState net h)) in * by (rewrite H; reflexivity); clear H end. repeat find_higher_order_rewrite. find_copy_apply_lem_hyp doGenericServer_log. find_apply_lem_hyp doGenericServer_currentTerm_leaderId. destruct_update; simpl in *; eauto; find_apply_hyp_hyp; repeat find_rewrite; intuition; right; break_exists_exists; intuition; find_higher_order_rewrite; destruct_update; simpl in *; auto. Qed. Lemma allEntries_log_init : refined_raft_net_invariant_init allEntries_log. Proof using. red. unfold allEntries_log. intros. simpl in *. intuition. Qed. Lemma allEntries_log_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset allEntries_log. Proof using. red. unfold allEntries_log in *. intros. repeat find_reverse_higher_order_rewrite. find_apply_hyp_hyp. intuition. right. break_exists_exists. repeat find_higher_order_rewrite. auto. Qed. Lemma allEntries_log_reboot : refined_raft_net_invariant_reboot allEntries_log. Proof using. red. unfold allEntries_log in *. intros. simpl in *. match goal with | H : nwState ?net ?h = (?gd, ?d) |- _ => replace gd with (fst (nwState net h)) in * by (rewrite H; reflexivity); replace d with (snd (nwState net h)) in * by (rewrite H; reflexivity); clear H end. repeat find_higher_order_rewrite. subst. unfold reboot in *. destruct_update; simpl in *; eauto; find_apply_hyp_hyp; repeat find_rewrite; intuition; right; break_exists_exists; intuition; find_higher_order_rewrite; destruct_update; simpl in *; auto. Qed. Lemma allEntries_log_invariant : forall net, refined_raft_intermediate_reachable net -> allEntries_log net. Proof using aetsi rri tsi llsi ollpti llci aellti rlmli aerlli llli. intros. apply refined_raft_net_invariant; auto. - exact allEntries_log_init. - exact allEntries_log_client_request. - exact allEntries_log_timeout. - exact allEntries_log_append_entries. - exact allEntries_log_append_entries_reply. - exact allEntries_log_request_vote. - exact allEntries_log_request_vote_reply. - exact allEntries_log_do_leader. - exact allEntries_log_do_generic_server. - exact allEntries_log_state_same_packet_subset. - exact allEntries_log_reboot. Qed. Instance aeli : allEntries_log_interface. split. eauto using allEntries_log_invariant. Defined. End AllEntriesLog.
{-# OPTIONS --safe --experimental-lossy-unification #-} module Cubical.ZCohomology.Properties where {- This module contains: 1. direct proofs of connectedness of Kn and Ξ©Kn 2. Induction principles for cohomology groups of pointed types 3. Equivalence between cohomology of A and reduced cohomology of (A + 1) 4. Equivalence between cohomology and reduced cohomology for dimension β‰₯ 1 5. Encode-decode proof of Kβ‚™ ≃ Ξ©Kβ‚™β‚Šβ‚ and proofs that this equivalence and its inverse are morphisms 6. A proof of coHomGr β‰… coHomGrΞ© 7. A locked (non-reducing) version of Kβ‚™ ≃ Ξ©Kβ‚™β‚Šβ‚ -} open import Cubical.ZCohomology.Base open import Cubical.ZCohomology.GroupStructure open import Cubical.HITs.S1 hiding (encode ; decode) open import Cubical.HITs.Sn open import Cubical.Foundations.HLevels open import Cubical.Foundations.Transport open import Cubical.Foundations.Function open import Cubical.Foundations.Equiv open import Cubical.Foundations.Prelude open import Cubical.Foundations.Pointed open import Cubical.Foundations.Pointed.Homogeneous open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.GroupoidLaws renaming (assoc to assocβˆ™) open import Cubical.Foundations.Univalence open import Cubical.HITs.Susp open import Cubical.HITs.SetTruncation renaming (rec to sRec ; rec2 to sRec2 ; elim to sElim ; elim2 to sElim2 ; setTruncIsSet to Β§) open import Cubical.Data.Int renaming (_+_ to _β„€+_) hiding (-_) open import Cubical.Data.Nat open import Cubical.HITs.Truncation renaming (elim to trElim ; map to trMap ; map2 to trMap2; rec to trRec ; elim3 to trElim3) open import Cubical.Homotopy.Loopspace open import Cubical.Homotopy.Connected open import Cubical.Algebra.Group hiding (Unit ; Int) open import Cubical.Algebra.AbGroup open import Cubical.Algebra.Semigroup open import Cubical.Algebra.Monoid open import Cubical.Foundations.Equiv.HalfAdjoint open import Cubical.Data.Sum.Base hiding (map) open import Cubical.Functions.Morphism open import Cubical.Data.Sigma open Iso renaming (inv to inv') private variable β„“ β„“' : Level ------------------- Connectedness --------------------- is2ConnectedKn : (n : β„•) β†’ isConnected 2 (coHomK (suc n)) is2ConnectedKn zero = ∣ ∣ base ∣ ∣ , trElim (Ξ» _ β†’ isOfHLevelPath 2 (isOfHLevelTrunc 2) _ _) (trElim (Ξ» _ β†’ isOfHLevelPath 3 (isOfHLevelSuc 2 (isOfHLevelTrunc 2)) _ _) (toPropElim (Ξ» _ β†’ isOfHLevelTrunc 2 _ _) refl)) is2ConnectedKn (suc n) = ∣ ∣ north ∣ ∣ , trElim (Ξ» _ β†’ isOfHLevelPath 2 (isOfHLevelTrunc 2) _ _) (trElim (Ξ» _ β†’ isPropβ†’isOfHLevelSuc (3 + n) (isOfHLevelTrunc 2 _ _)) (suspToPropElim (ptSn (suc n)) (Ξ» _ β†’ isOfHLevelTrunc 2 _ _) refl)) isConnectedKn : (n : β„•) β†’ isConnected (2 + n) (coHomK (suc n)) isConnectedKn n = isOfHLevelRetractFromIso 0 (invIso (truncOfTruncIso (2 + n) 1)) (sphereConnected (suc n)) -- direct proof of connectedness of Ξ©Kβ‚™β‚Šβ‚ not relying on the equivalence βˆ₯ a ≑ b βˆ₯β‚™ ≃ (∣ a βˆ£β‚™β‚Šβ‚ ≑ ∣ b βˆ£β‚™β‚Šβ‚) isConnectedPathKn : (n : β„•) (x y : (coHomK (suc n))) β†’ isConnected (suc n) (x ≑ y) isConnectedPathKn n = trElim (Ξ» _ β†’ isPropβ†’isOfHLevelSuc (2 + n) (isPropΞ  Ξ» _ β†’ isPropIsContr)) (sphereElim _ (Ξ» _ β†’ isPropβ†’isOfHLevelSuc n (isPropΞ  Ξ» _ β†’ isPropIsContr)) Ξ» y β†’ isContrRetractOfConstFun {B = (hLevelTrunc (suc n) (ptSn (suc n) ≑ ptSn (suc n)))} ∣ refl ∣ (fun⁻ n y , trElim (Ξ» _ β†’ isOfHLevelPath (suc n) (isOfHLevelTrunc (suc n)) _ _) (J (Ξ» y p β†’ fun⁻ n y _ ≑ _) (funExt⁻ (fun⁻Id n) ∣ refl ∣)))) where fun⁻ : (n : β„•) β†’ (y : coHomK (suc n)) β†’ hLevelTrunc (suc n) (ptSn (suc n) ≑ ptSn (suc n)) β†’ hLevelTrunc (suc n) (∣ ptSn (suc n) ∣ ≑ y) fun⁻ n = trElim (Ξ» _ β†’ isOfHLevelΞ  (3 + n) Ξ» _ β†’ isOfHLevelSuc (2 + n) (isOfHLevelSuc (suc n) (isOfHLevelTrunc (suc n)))) (sphereElim n (Ξ» _ β†’ isOfHLevelΞ  (suc n) Ξ» _ β†’ isOfHLevelTrunc (suc n)) Ξ» _ β†’ ∣ refl ∣) fun⁻Id : (n : β„•) β†’ fun⁻ n ∣ ptSn (suc n) ∣ ≑ Ξ» _ β†’ ∣ refl ∣ fun⁻Id zero = refl fun⁻Id (suc n) = refl ------------------- -- Induction principles for cohomology groups (n β‰₯ 1) -- If we want to show a proposition about some x : Hⁿ(A), it suffices to show it under the -- assumption that x = ∣ f βˆ£β‚‚ for some f : A β†’ Kβ‚™ and that f is pointed coHomPointedElim : {A : Type β„“} (n : β„•) (a : A) {B : coHom (suc n) A β†’ Type β„“'} β†’ ((x : coHom (suc n) A) β†’ isProp (B x)) β†’ ((f : A β†’ coHomK (suc n)) β†’ f a ≑ coHom-pt (suc n) β†’ B ∣ f βˆ£β‚‚) β†’ (x : coHom (suc n) A) β†’ B x coHomPointedElim {β„“' = β„“'} {A = A} n a isprop indp = sElim (Ξ» _ β†’ isOfHLevelSuc 1 (isprop _)) Ξ» f β†’ helper n isprop indp f (f a) refl where helper : (n : β„•) {B : coHom (suc n) A β†’ Type β„“'} β†’ ((x : coHom (suc n) A) β†’ isProp (B x)) β†’ ((f : A β†’ coHomK (suc n)) β†’ f a ≑ coHom-pt (suc n) β†’ B ∣ f βˆ£β‚‚) β†’ (f : A β†’ coHomK (suc n)) β†’ (x : coHomK (suc n)) β†’ f a ≑ x β†’ B ∣ f βˆ£β‚‚ -- pattern matching a bit extra to avoid isOfHLevelPlus' helper zero isprop ind f = trElim (Ξ» _ β†’ isOfHLevelPlus {n = 1} 2 (isPropΞ  Ξ» _ β†’ isprop _)) (toPropElim (Ξ» _ β†’ isPropΞ  Ξ» _ β†’ isprop _) (ind f)) helper (suc zero) isprop ind f = trElim (Ξ» _ β†’ isOfHLevelPlus {n = 1} 3 (isPropΞ  Ξ» _ β†’ isprop _)) (suspToPropElim base (Ξ» _ β†’ isPropΞ  Ξ» _ β†’ isprop _) (ind f)) helper (suc (suc zero)) isprop ind f = trElim (Ξ» _ β†’ isOfHLevelPlus {n = 1} 4 (isPropΞ  Ξ» _ β†’ isprop _)) (suspToPropElim north (Ξ» _ β†’ isPropΞ  Ξ» _ β†’ isprop _) (ind f)) helper (suc (suc (suc n))) isprop ind f = trElim (Ξ» _ β†’ isOfHLevelPlus' {n = 5 + n} 1 (isPropΞ  Ξ» _ β†’ isprop _)) (suspToPropElim north (Ξ» _ β†’ isPropΞ  Ξ» _ β†’ isprop _) (ind f)) coHomPointedElim2 : {A : Type β„“} (n : β„•) (a : A) {B : coHom (suc n) A β†’ coHom (suc n) A β†’ Type β„“'} β†’ ((x y : coHom (suc n) A) β†’ isProp (B x y)) β†’ ((f g : A β†’ coHomK (suc n)) β†’ f a ≑ coHom-pt (suc n) β†’ g a ≑ coHom-pt (suc n) β†’ B ∣ f βˆ£β‚‚ ∣ g βˆ£β‚‚) β†’ (x y : coHom (suc n) A) β†’ B x y coHomPointedElim2 {β„“' = β„“'} {A = A} n a isprop indp = sElim2 (Ξ» _ _ β†’ isOfHLevelSuc 1 (isprop _ _)) Ξ» f g β†’ helper n a isprop indp f g (f a) (g a) refl refl where helper : (n : β„•) (a : A) {B : coHom (suc n) A β†’ coHom (suc n) A β†’ Type β„“'} β†’ ((x y : coHom (suc n) A) β†’ isProp (B x y)) β†’ ((f g : A β†’ coHomK (suc n)) β†’ f a ≑ coHom-pt (suc n) β†’ g a ≑ coHom-pt (suc n) β†’ B ∣ f βˆ£β‚‚ ∣ g βˆ£β‚‚) β†’ (f g : A β†’ coHomK (suc n)) β†’ (x y : coHomK (suc n)) β†’ f a ≑ x β†’ g a ≑ y β†’ B ∣ f βˆ£β‚‚ ∣ g βˆ£β‚‚ helper zero a isprop indp f g = elim2 (Ξ» _ _ β†’ isOfHLevelPlus {n = 1} 2 (isPropΞ 2 Ξ» _ _ β†’ isprop _ _)) (toPropElim2 (Ξ» _ _ β†’ isPropΞ 2 Ξ» _ _ β†’ isprop _ _) (indp f g)) helper (suc zero) a isprop indp f g = elim2 (Ξ» _ _ β†’ isOfHLevelPlus {n = 1} 3 (isPropΞ 2 Ξ» _ _ β†’ isprop _ _)) (suspToPropElim2 base (Ξ» _ _ β†’ isPropΞ 2 Ξ» _ _ β†’ isprop _ _) (indp f g)) helper (suc (suc zero)) a isprop indp f g = elim2 (Ξ» _ _ β†’ isOfHLevelPlus {n = 1} 4 (isPropΞ 2 Ξ» _ _ β†’ isprop _ _)) (suspToPropElim2 north (Ξ» _ _ β†’ isPropΞ 2 Ξ» _ _ β†’ isprop _ _) (indp f g)) helper (suc (suc (suc n))) a isprop indp f g = elim2 (Ξ» _ _ β†’ isOfHLevelPlus' {n = 5 + n} 1 (isPropΞ 2 Ξ» _ _ β†’ isprop _ _)) (suspToPropElim2 north (Ξ» _ _ β†’ isPropΞ 2 Ξ» _ _ β†’ isprop _ _) (indp f g)) coHomK-elim : βˆ€ {β„“} (n : β„•) {B : coHomK (suc n) β†’ Type β„“} β†’ ((x : _) β†’ isOfHLevel (suc n) (B x)) β†’ B (0β‚– (suc n)) β†’ (x : _) β†’ B x coHomK-elim n {B = B } hlev b = trElim (Ξ» _ β†’ isOfHLevelPlus {n = (suc n)} 2 (hlev _)) (sphereElim _ (hlev ∘ ∣_∣) b) {- Equivalence between cohomology of A and reduced cohomology of (A + 1) -} coHomRed+1Equiv : (n : β„•) β†’ (A : Type β„“) β†’ (coHom n A) ≑ (coHomRed n ((A ⊎ Unit , inr (tt)))) coHomRed+1Equiv zero A i = βˆ₯ helpLemma {C = (Int , pos 0)} i βˆ₯β‚‚ module coHomRed+1 where helpLemma : {C : Pointed β„“} β†’ ( (A β†’ (typ C)) ≑ ((((A ⊎ Unit) , inr (tt)) β†’βˆ™ C))) helpLemma {C = C} = isoToPath (iso map1 map2 (Ξ» b β†’ linvPf b) (Ξ» _ β†’ refl)) where map1 : (A β†’ typ C) β†’ ((((A ⊎ Unit) , inr (tt)) β†’βˆ™ C)) map1 f = map1' , refl module helpmap where map1' : A ⊎ Unit β†’ fst C map1' (inl x) = f x map1' (inr x) = pt C map2 : ((((A ⊎ Unit) , inr (tt)) β†’βˆ™ C)) β†’ (A β†’ typ C) map2 (g , pf) x = g (inl x) linvPf : (b :((((A ⊎ Unit) , inr (tt)) β†’βˆ™ C))) β†’ map1 (map2 b) ≑ b linvPf (f , snd) i = (Ξ» x β†’ helper x i) , Ξ» j β†’ snd ((~ i) ∨ j) where helper : (x : A ⊎ Unit) β†’ ((helpmap.map1') (map2 (f , snd)) x) ≑ f x helper (inl x) = refl helper (inr tt) = sym snd coHomRed+1Equiv (suc zero) A i = βˆ₯ coHomRed+1.helpLemma A i {C = (coHomK 1 , ∣ base ∣)} i βˆ₯β‚‚ coHomRed+1Equiv (suc (suc n)) A i = βˆ₯ coHomRed+1.helpLemma A i {C = (coHomK (2 + n) , ∣ north ∣)} i βˆ₯β‚‚ Iso-coHom-coHomRed : βˆ€ {β„“} {A : Pointed β„“} (n : β„•) β†’ Iso (coHomRed (suc n) A) (coHom (suc n) (typ A)) fun (Iso-coHom-coHomRed {A = A , a} n) = map fst inv' (Iso-coHom-coHomRed {A = A , a} n) = map Ξ» f β†’ (Ξ» x β†’ f x -β‚– f a) , rCancelβ‚– _ _ rightInv (Iso-coHom-coHomRed {A = A , a} n) = sElim (Ξ» _ β†’ isOfHLevelPath 2 Β§ _ _) Ξ» f β†’ trRec (isPropβ†’isOfHLevelSuc _ (Β§ _ _)) (Ξ» p β†’ cong ∣_βˆ£β‚‚ (funExt Ξ» x β†’ cong (Ξ» y β†’ f x +β‚– y) (cong -β‚–_ p βˆ™ -0β‚–) βˆ™ rUnitβ‚– _ (f x))) (Iso.fun (PathIdTruncIso (suc n)) (isContrβ†’isProp (isConnectedKn n) ∣ f a ∣ ∣ 0β‚– _ ∣)) leftInv (Iso-coHom-coHomRed {A = A , a} n) = sElim (Ξ» _ β†’ isOfHLevelPath 2 Β§ _ _) Ξ» {(f , p) β†’ cong ∣_βˆ£β‚‚ (Ξ£PathP (((funExt Ξ» x β†’ (cong (Ξ» y β†’ f x -β‚– y) p βˆ™βˆ™ cong (Ξ» y β†’ f x +β‚– y) -0β‚– βˆ™βˆ™ rUnitβ‚– _ (f x)) βˆ™ refl)) , helper n (f a) (sym p)))} where path : (n : β„•) (x : coHomK (suc n)) (p : 0β‚– _ ≑ x) β†’ _ path n x p = (cong (Ξ» y β†’ x -β‚– y) (sym p) βˆ™βˆ™ cong (Ξ» y β†’ x +β‚– y) -0β‚– βˆ™βˆ™ rUnitβ‚– _ x) βˆ™ refl helper : (n : β„•) (x : coHomK (suc n)) (p : 0β‚– _ ≑ x) β†’ PathP (Ξ» i β†’ path n x p i ≑ 0β‚– _) (rCancelβ‚– _ x) (sym p) helper zero x = J (Ξ» x p β†’ PathP (Ξ» i β†’ path 0 x p i ≑ 0β‚– _) (rCancelβ‚– _ x) (sym p)) Ξ» i j β†’ rUnit (rUnit (Ξ» _ β†’ 0β‚– 1) (~ j)) (~ j) i helper (suc n) x = J (Ξ» x p β†’ PathP (Ξ» i β†’ path (suc n) x p i ≑ 0β‚– _) (rCancelβ‚– _ x) (sym p)) Ξ» i j β†’ rCancelβ‚– (suc (suc n)) (0β‚– (suc (suc n))) (~ i ∧ ~ j) +βˆ™β‰‘+ : (n : β„•) {A : Pointed β„“} (x y : coHomRed (suc n) A) β†’ Iso.fun (Iso-coHom-coHomRed n) (x +β‚•βˆ™ y) ≑ Iso.fun (Iso-coHom-coHomRed n) x +β‚• Iso.fun (Iso-coHom-coHomRed n) y +βˆ™β‰‘+ zero = sElim2 (Ξ» _ _ β†’ isOfHLevelPath 2 Β§ _ _) Ξ» _ _ β†’ refl +βˆ™β‰‘+ (suc n) = sElim2 (Ξ» _ _ β†’ isOfHLevelPath 2 Β§ _ _) Ξ» _ _ β†’ refl private homhelp : βˆ€ {β„“} (n : β„•) (A : Pointed β„“) (x y : coHom (suc n) (typ A)) β†’ Iso.inv (Iso-coHom-coHomRed {A = A} n) (x +β‚• y) ≑ Iso.inv (Iso-coHom-coHomRed n) x +β‚•βˆ™ Iso.inv (Iso-coHom-coHomRed n) y homhelp n A = morphLemmas.isMorphInv _+β‚•βˆ™_ _+β‚•_ (Iso.fun (Iso-coHom-coHomRed n)) (+βˆ™β‰‘+ n) _ (Iso.rightInv (Iso-coHom-coHomRed n)) (Iso.leftInv (Iso-coHom-coHomRed n)) coHomGrβ‰…coHomRedGr : βˆ€ {β„“} (n : β„•) (A : Pointed β„“) β†’ GroupEquiv (coHomRedGrDir (suc n) A) (coHomGr (suc n) (typ A)) fst (coHomGrβ‰…coHomRedGr n A) = isoToEquiv (Iso-coHom-coHomRed n) snd (coHomGrβ‰…coHomRedGr n A) = makeIsGroupHom (+βˆ™β‰‘+ n) coHomRedGroup : βˆ€ {β„“} (n : β„•) (A : Pointed β„“) β†’ AbGroup β„“ coHomRedGroup zero A = coHomRedGroupDir zero A coHomRedGroup (suc n) A = InducedAbGroup (coHomGroup (suc n) (typ A)) _+β‚•βˆ™_ (isoToEquiv (invIso (Iso-coHom-coHomRed n))) (homhelp n A) abstract coHomGroup≑coHomRedGroup : βˆ€ {β„“} (n : β„•) (A : Pointed β„“) β†’ coHomGroup (suc n) (typ A) ≑ coHomRedGroup (suc n) A coHomGroup≑coHomRedGroup n A = InducedAbGroupPath (coHomGroup (suc n) (typ A)) _+β‚•βˆ™_ (isoToEquiv (invIso (Iso-coHom-coHomRed n))) (homhelp n A) ------------------- Kβ‚™ ≃ Ξ©Kβ‚™β‚Šβ‚ --------------------- -- This proof uses the encode-decode method rather than Freudenthal -- We define the map Οƒ : Kβ‚™ β†’ Ξ©Kβ‚™β‚Šβ‚ and prove that it is a morphism private module _ (n : β„•) where Οƒ : {n : β„•} β†’ coHomK (suc n) β†’ Path (coHomK (2 + n)) ∣ north ∣ ∣ north ∣ Οƒ {n = n} = trRec (isOfHLevelTrunc (4 + n) _ _) Ξ» a β†’ cong ∣_∣ (merid a βˆ™ sym (merid (ptSn (suc n)))) Οƒ-hom-helper : βˆ€ {β„“} {A : Type β„“} {a : A} (p : a ≑ a) (r : refl ≑ p) β†’ lUnit p βˆ™ cong (_βˆ™ p) r ≑ rUnit p βˆ™ cong (p βˆ™_) r Οƒ-hom-helper p = J (Ξ» p r β†’ lUnit p βˆ™ cong (_βˆ™ p) r ≑ rUnit p βˆ™ cong (p βˆ™_) r) refl Οƒ-hom : {n : β„•} (x y : coHomK (suc n)) β†’ Οƒ (x +β‚– y) ≑ Οƒ x βˆ™ Οƒ y Οƒ-hom {n = zero} = elim2 (Ξ» _ _ β†’ isOfHLevelPath 3 (isOfHLevelTrunc 4 _ _) _ _) (wedgeconFun _ _ (Ξ» _ _ β†’ isOfHLevelTrunc 4 _ _ _ _) (Ξ» x β†’ lUnit _ βˆ™ cong (_βˆ™ Οƒ ∣ x ∣) (cong (cong ∣_∣) (sym (rCancel (merid base))))) (Ξ» y β†’ cong Οƒ (rUnitβ‚– 1 ∣ y ∣) βˆ™βˆ™ rUnit _ βˆ™βˆ™ cong (Οƒ ∣ y ∣ βˆ™_) (cong (cong ∣_∣) (sym (rCancel (merid base))))) (sym (Οƒ-hom-helper (Οƒ ∣ base ∣) (cong (cong ∣_∣) (sym (rCancel (merid base))))))) Οƒ-hom {n = suc n} = elim2 (Ξ» _ _ β†’ isOfHLevelPath (4 + n) (isOfHLevelTrunc (5 + n) _ _) _ _) (wedgeconFun _ _ (Ξ» _ _ β†’ isOfHLevelPath ((2 + n) + (2 + n)) (wedgeConHLev' n) _ _) (Ξ» x β†’ lUnit _ βˆ™ cong (_βˆ™ Οƒ ∣ x ∣) (cong (cong ∣_∣) (sym (rCancel (merid north))))) (Ξ» y β†’ cong Οƒ (rUnitβ‚– (2 + n) ∣ y ∣) βˆ™βˆ™ rUnit _ βˆ™βˆ™ cong (Οƒ ∣ y ∣ βˆ™_) (cong (cong ∣_∣) (sym (rCancel (merid north))))) (sym (Οƒ-hom-helper (Οƒ ∣ north ∣) (cong (cong ∣_∣) (sym (rCancel (merid north))))))) -- We will need to following lemma Οƒ-minusDistr : {n : β„•} (x y : coHomK (suc n)) β†’ Οƒ (x -β‚– y) ≑ Οƒ x βˆ™ sym (Οƒ y) Οƒ-minusDistr {n = n} = morphLemmas.distrMinus' _+β‚–_ _βˆ™_ Οƒ Οƒ-hom ∣ (ptSn (suc n)) ∣ refl -β‚–_ sym (Ξ» x β†’ sym (lUnit x)) (Ξ» x β†’ sym (rUnit x)) (rUnitβ‚– (suc n)) (lCancelβ‚– (suc n)) rCancel (assocβ‚– (suc n)) assocβˆ™ (cong (cong ∣_∣) (rCancel (merid (ptSn (suc n))))) -- we define the code using addIso Code : (n : β„•) β†’ coHomK (2 + n) β†’ Typeβ‚€ Code n x = (trRec {B = TypeOfHLevel β„“-zero (3 + n)} (isOfHLevelTypeOfHLevel (3 + n)) Ξ» a β†’ Code' a , hLevCode' a) x .fst where Code' : (Sβ‚Š (2 + n)) β†’ Typeβ‚€ Code' north = coHomK (suc n) Code' south = coHomK (suc n) Code' (merid a i) = isoToPath (addIso (suc n) ∣ a ∣) i hLevCode' : (x : Sβ‚Š (2 + n)) β†’ isOfHLevel (3 + n) (Code' x) hLevCode' = suspToPropElim (ptSn (suc n)) (Ξ» _ β†’ isPropIsOfHLevel (3 + n)) (isOfHLevelTrunc (3 + n)) symMeridLem : (n : β„•) β†’ (x : Sβ‚Š (suc n)) (y : coHomK (suc n)) β†’ subst (Code n) (cong ∣_∣ (sym (merid x))) y ≑ y -β‚– ∣ x ∣ symMeridLem n x = trElim (Ξ» _ β†’ isOfHLevelPath (3 + n) (isOfHLevelTrunc (3 + n)) _ _) (Ξ» y β†’ cong (_-β‚– ∣ x ∣) (transportRefl ∣ y ∣)) decode : {n : β„•} (x : coHomK (2 + n)) β†’ Code n x β†’ ∣ north ∣ ≑ x decode {n = n} = trElim (Ξ» _ β†’ isOfHLevelΞ  (4 + n) Ξ» _ β†’ isOfHLevelPath (4 + n) (isOfHLevelTrunc (4 + n)) _ _) decode-elim where north≑merid : (a : Sβ‚Š (suc n)) β†’ Path (coHomK (2 + n)) ∣ north ∣ ∣ north ∣ ≑ (Path (coHomK (2 + n)) ∣ north ∣ ∣ south ∣) north≑merid a i = Path (coHomK (2 + n)) ∣ north ∣ ∣ merid a i ∣ decode-elim : (a : Sβ‚Š (2 + n)) β†’ Code n ∣ a ∣ β†’ Path (coHomK (2 + n)) ∣ north ∣ ∣ a ∣ decode-elim north = Οƒ decode-elim south = trRec (isOfHLevelTrunc (4 + n) _ _) Ξ» a β†’ cong ∣_∣ (merid a) decode-elim (merid a i) = hcomp (Ξ» k β†’ Ξ» { (i = i0) β†’ Οƒ ; (i = i1) β†’ mainPath a k}) (funTypeTransp (Code n) (Ξ» x β†’ ∣ north ∣ ≑ x) (cong ∣_∣ (merid a)) Οƒ i) where mainPath : (a : (Sβ‚Š (suc n))) β†’ transport (north≑merid a) ∘ Οƒ ∘ transport (Ξ» i β†’ Code n ∣ merid a (~ i) ∣) ≑ trRec (isOfHLevelTrunc (4 + n) _ _) Ξ» a β†’ cong ∣_∣ (merid a) mainPath a = funExt (trElim (Ξ» _ β†’ isOfHLevelPath (3 + n) (isOfHLevelTrunc (4 + n) _ _) _ _) (Ξ» x β†’ (Ξ» i β†’ transport (north≑merid a) (Οƒ (symMeridLem n a ∣ x ∣ i))) βˆ™βˆ™ cong (transport (north≑merid a)) (-distrHelp x) βˆ™βˆ™ (substAbove x))) where -distrHelp : (x : Sβ‚Š (suc n)) β†’ Οƒ (∣ x ∣ -β‚– ∣ a ∣) ≑ cong ∣_∣ (merid x) βˆ™ cong ∣_∣ (sym (merid a)) -distrHelp x = Οƒ-minusDistr ∣ x ∣ ∣ a ∣ βˆ™ (Ξ» i β†’ (cong ∣_∣ (compPath-filler (merid x) (Ξ» j β†’ merid (ptSn (suc n)) (~ j ∨ i)) (~ i))) βˆ™ (cong ∣_∣ (sym (compPath-filler (merid a) (Ξ» j β†’ merid (ptSn (suc n)) (~ j ∨ i)) (~ i))))) substAbove : (x : Sβ‚Š (suc n)) β†’ transport (north≑merid a) (cong ∣_∣ (merid x) βˆ™ cong ∣_∣ (sym (merid a))) ≑ cong ∣_∣ (merid x) substAbove x i = transp (Ξ» j β†’ north≑merid a (i ∨ j)) i (compPath-filler (cong ∣_∣ (merid x)) (Ξ» j β†’ ∣ merid a (~ j ∨ i) ∣) (~ i)) encode : {n : β„•} {x : coHomK (2 + n)} β†’ Path (coHomK (2 + n)) ∣ north ∣ x β†’ Code n x encode {n = n} p = transport (cong (Code n) p) ∣ (ptSn (suc n)) ∣ decode-encode : {n : β„•} {x : coHomK (2 + n)} (p : Path (coHomK (2 + n)) ∣ north ∣ x) β†’ decode _ (encode p) ≑ p decode-encode {n = n} = J (Ξ» y p β†’ decode _ (encode p) ≑ p) (cong (decode ∣ north ∣) (transportRefl ∣ ptSn (suc n) ∣) βˆ™ cong (cong ∣_∣) (rCancel (merid (ptSn (suc n))))) -- We define an addition operation on Code which we can use in order to show that encode is a -- morphism (in a very loose sense) hLevCode : {n : β„•} (x : coHomK (2 + n)) β†’ isOfHLevel (3 + n) (Code n x) hLevCode {n = n} = trElim (Ξ» _ β†’ isPropβ†’isOfHLevelSuc (3 + n) (isPropIsOfHLevel (3 + n))) (sphereToPropElim _ (Ξ» _ β†’ (isPropIsOfHLevel (3 + n))) (isOfHLevelTrunc (3 + n))) Code-add' : {n : β„•} (x : _) β†’ Code n ∣ north ∣ β†’ Code n ∣ x ∣ β†’ Code n ∣ x ∣ Code-add' {n = n} north = _+β‚–_ Code-add' {n = n} south = _+β‚–_ Code-add' {n = n} (merid a i) = helper n a i where help : (n : β„•) β†’ (x y a : Sβ‚Š (suc n)) β†’ transport (Ξ» i β†’ Code n ∣ north ∣ β†’ Code n ∣ merid a i ∣ β†’ Code n ∣ merid a i ∣) (_+β‚–_) ∣ x ∣ ∣ y ∣ ≑ ∣ x ∣ +β‚– ∣ y ∣ help n x y a = (Ξ» i β†’ transportRefl ((∣ transportRefl x i ∣ +β‚– (∣ transportRefl y i ∣ -β‚– ∣ a ∣)) +β‚– ∣ a ∣) i) βˆ™βˆ™ cong (_+β‚– ∣ a ∣) (assocβ‚– _ ∣ x ∣ ∣ y ∣ (-β‚– ∣ a ∣)) βˆ™βˆ™ sym (assocβ‚– _ (∣ x ∣ +β‚– ∣ y ∣) (-β‚– ∣ a ∣) ∣ a ∣) βˆ™βˆ™ cong ((∣ x ∣ +β‚– ∣ y ∣) +β‚–_) (lCancelβ‚– _ ∣ a ∣) βˆ™βˆ™ rUnitβ‚– _ _ helper : (n : β„•) (a : Sβ‚Š (suc n)) β†’ PathP (Ξ» i β†’ Code n ∣ north ∣ β†’ Code n ∣ merid a i ∣ β†’ Code n ∣ merid a i ∣) _+β‚–_ _+β‚–_ helper n a = toPathP (funExt (trElim (Ξ» _ β†’ isOfHLevelPath (3 + n) (isOfHLevelΞ  (3 + n) (Ξ» _ β†’ isOfHLevelTrunc (3 + n))) _ _) Ξ» x β†’ funExt (trElim (Ξ» _ β†’ isOfHLevelPath (3 + n) (isOfHLevelTrunc (3 + n)) _ _) Ξ» y β†’ help n x y a))) Code-add : {n : β„•} (x : _) β†’ Code n ∣ north ∣ β†’ Code n x β†’ Code n x Code-add {n = n} = trElim (Ξ» x β†’ isOfHLevelΞ  (4 + n) Ξ» _ β†’ isOfHLevelΞ  (4 + n) Ξ» _ β†’ isOfHLevelSuc (3 + n) (hLevCode {n = n} x)) Code-add' encode-hom : {n : β„•} {x : _} (q : 0β‚– _ ≑ 0β‚– _) (p : 0β‚– _ ≑ x) β†’ encode (q βˆ™ p) ≑ Code-add {n = n} x (encode q) (encode p) encode-hom {n = n} q = J (Ξ» x p β†’ encode (q βˆ™ p) ≑ Code-add {n = n} x (encode q) (encode p)) (cong encode (sym (rUnit q)) βˆ™βˆ™ sym (rUnitβ‚– _ (encode q)) βˆ™βˆ™ cong (encode q +β‚–_) (cong ∣_∣ (sym (transportRefl _)))) stabSpheres : (n : β„•) β†’ Iso (coHomK (suc n)) (typ (Ξ© (coHomK-ptd (2 + n)))) fun (stabSpheres n) = decode _ inv' (stabSpheres n) = encode rightInv (stabSpheres n) p = decode-encode p leftInv (stabSpheres n) = trElim (Ξ» _ β†’ isOfHLevelPath (3 + n) (isOfHLevelTrunc (3 + n)) _ _) Ξ» a β†’ cong encode (congFunct ∣_∣ (merid a) (sym (merid (ptSn (suc n))))) βˆ™βˆ™ (Ξ» i β†’ transport (congFunct (Code n) (cong ∣_∣ (merid a)) (cong ∣_∣ (sym (merid (ptSn (suc n))))) i) ∣ ptSn (suc n) ∣) βˆ™βˆ™ (substComposite (Ξ» x β†’ x) (cong (Code n) (cong ∣_∣ (merid a))) (cong (Code n) (cong ∣_∣ (sym (merid (ptSn (suc n)))))) ∣ ptSn (suc n) ∣ βˆ™βˆ™ cong (transport (Ξ» i β†’ Code n ∣ merid (ptSn (suc n)) (~ i) ∣)) (transportRefl (∣ (ptSn (suc n)) ∣ +β‚– ∣ a ∣) βˆ™ lUnitβ‚– (suc n) ∣ a ∣) βˆ™βˆ™ symMeridLem n (ptSn (suc n)) ∣ a ∣ βˆ™βˆ™ cong (∣ a ∣ +β‚–_) -0β‚– βˆ™βˆ™ rUnitβ‚– (suc n) ∣ a ∣) Iso-Kn-Ξ©Kn+1 : (n : HLevel) β†’ Iso (coHomK n) (typ (Ξ© (coHomK-ptd (suc n)))) Iso-Kn-Ξ©Kn+1 zero = invIso (compIso (congIso (truncIdempotentIso _ isGroupoidSΒΉ)) Ξ©SΒΉIsoInt) Iso-Kn-Ξ©Kn+1 (suc n) = stabSpheres n Kn≃ΩKn+1 : {n : β„•} β†’ coHomK n ≃ typ (Ξ© (coHomK-ptd (suc n))) Kn≃ΩKn+1 {n = n} = isoToEquiv (Iso-Kn-Ξ©Kn+1 n) -- Some properties of the Iso Knβ†’Ξ©Kn+1 : (n : β„•) β†’ coHomK n β†’ typ (Ξ© (coHomK-ptd (suc n))) Knβ†’Ξ©Kn+1 n = Iso.fun (Iso-Kn-Ξ©Kn+1 n) Ξ©Kn+1β†’Kn : (n : β„•) β†’ typ (Ξ© (coHomK-ptd (suc n))) β†’ coHomK n Ξ©Kn+1β†’Kn n = Iso.inv (Iso-Kn-Ξ©Kn+1 n) Knβ†’Ξ©Kn+10β‚– : (n : β„•) β†’ Knβ†’Ξ©Kn+1 n (0β‚– n) ≑ refl Knβ†’Ξ©Kn+10β‚– zero = sym (rUnit refl) Knβ†’Ξ©Kn+10β‚– (suc n) i j = ∣ (rCancel (merid (ptSn (suc n))) i j) ∣ Ξ©Kn+1β†’Kn-refl : (n : β„•) β†’ Ξ©Kn+1β†’Kn n refl ≑ 0β‚– n Ξ©Kn+1β†’Kn-refl zero = refl Ξ©Kn+1β†’Kn-refl (suc zero) = refl Ξ©Kn+1β†’Kn-refl (suc (suc n)) = refl Knβ†’Ξ©Kn+1-hom : (n : β„•) (x y : coHomK n) β†’ Knβ†’Ξ©Kn+1 n (x +[ n ]β‚– y) ≑ Knβ†’Ξ©Kn+1 n x βˆ™ Knβ†’Ξ©Kn+1 n y Knβ†’Ξ©Kn+1-hom zero x y = (Ξ» j i β†’ hfill (doubleComp-faces (Ξ» i₁ β†’ ∣ base ∣) (Ξ» _ β†’ ∣ base ∣) i) (inS (∣ intLoop (x β„€+ y) i ∣)) (~ j)) βˆ™βˆ™ (Ξ» j i β†’ ∣ intLoop-hom x y (~ j) i ∣) βˆ™βˆ™ (congFunct ∣_∣ (intLoop x) (intLoop y) βˆ™ congβ‚‚ _βˆ™_ (Ξ» j i β†’ hfill (doubleComp-faces (Ξ» i₁ β†’ ∣ base ∣) (Ξ» _ β†’ ∣ base ∣) i) (inS (∣ intLoop x i ∣)) j) Ξ» j i β†’ hfill (doubleComp-faces (Ξ» i₁ β†’ ∣ base ∣) (Ξ» _ β†’ ∣ base ∣) i) (inS (∣ intLoop y i ∣)) j) Knβ†’Ξ©Kn+1-hom (suc n) = Οƒ-hom Ξ©Kn+1β†’Kn-hom : (n : β„•) (x y : Path (coHomK (suc n)) (0β‚– _) (0β‚– _)) β†’ Ξ©Kn+1β†’Kn n (x βˆ™ y) ≑ Ξ©Kn+1β†’Kn n x +[ n ]β‚– Ξ©Kn+1β†’Kn n y Ξ©Kn+1β†’Kn-hom zero p q = cong winding (congFunct (trRec isGroupoidSΒΉ (Ξ» x β†’ x)) p q) βˆ™ winding-hom (cong (trRec isGroupoidSΒΉ (Ξ» x β†’ x)) p) (cong (trRec isGroupoidSΒΉ (Ξ» x β†’ x)) q) Ξ©Kn+1β†’Kn-hom (suc n) = encode-hom isHomogeneousKn : (n : HLevel) β†’ isHomogeneous (coHomK-ptd n) isHomogeneousKn n = subst isHomogeneous (sym (Ξ£PathP (ua Kn≃ΩKn+1 , ua-gluePath _ (Knβ†’Ξ©Kn+10β‚– n)))) (isHomogeneousPath _ _) -- With the equivalence Kn≃ΩKn+1, we get that the two definitions of cohomology groups agree open IsGroupHom coHomβ‰…coHomΞ© : βˆ€ {β„“} (n : β„•) (A : Type β„“) β†’ GroupIso (coHomGr n A) (coHomGrΞ© n A) fun (fst (coHomβ‰…coHomΞ© n A)) = map Ξ» f a β†’ Knβ†’Ξ©Kn+1 n (f a) inv' (fst (coHomβ‰…coHomΞ© n A)) = map Ξ» f a β†’ Ξ©Kn+1β†’Kn n (f a) rightInv (fst (coHomβ‰…coHomΞ© n A)) = sElim (Ξ» _ β†’ isOfHLevelPath 2 Β§ _ _) Ξ» f β†’ cong ∣_βˆ£β‚‚ (funExt Ξ» x β†’ rightInv (Iso-Kn-Ξ©Kn+1 n) (f x)) leftInv (fst (coHomβ‰…coHomΞ© n A)) = sElim (Ξ» _ β†’ isOfHLevelPath 2 Β§ _ _) Ξ» f β†’ cong ∣_βˆ£β‚‚ (funExt Ξ» x β†’ leftInv (Iso-Kn-Ξ©Kn+1 n) (f x)) snd (coHomβ‰…coHomΞ© n A) = makeIsGroupHom (sElim2 (Ξ» _ _ β†’ isOfHLevelPath 2 Β§ _ _) Ξ» f g β†’ cong ∣_βˆ£β‚‚ (funExt Ξ» x β†’ Knβ†’Ξ©Kn+1-hom n (f x) (g x))) module lockedKnIso (key : Unit') where Knβ†’Ξ©Kn+1' : (n : β„•) β†’ coHomK n β†’ typ (Ξ© (coHomK-ptd (suc n))) Knβ†’Ξ©Kn+1' n = lock key (Iso.fun (Iso-Kn-Ξ©Kn+1 n)) Ξ©Kn+1β†’Kn' : (n : β„•) β†’ typ (Ξ© (coHomK-ptd (suc n))) β†’ coHomK n Ξ©Kn+1β†’Kn' n = lock key (Iso.inv (Iso-Kn-Ξ©Kn+1 n)) Ξ©Kn+1β†’Knβ†’Ξ©Kn+1 : (n : β„•) β†’ (x : typ (Ξ© (coHomK-ptd (suc n)))) β†’ Knβ†’Ξ©Kn+1' n (Ξ©Kn+1β†’Kn' n x) ≑ x Ξ©Kn+1β†’Knβ†’Ξ©Kn+1 n x = pm key where pm : (key : Unit') β†’ lock key (Iso.fun (Iso-Kn-Ξ©Kn+1 n)) (lock key (Iso.inv (Iso-Kn-Ξ©Kn+1 n)) x) ≑ x pm unlock = Iso.rightInv (Iso-Kn-Ξ©Kn+1 n) x Knβ†’Ξ©Kn+1β†’Kn : (n : β„•) β†’ (x : coHomK n) β†’ Ξ©Kn+1β†’Kn' n (Knβ†’Ξ©Kn+1' n x) ≑ x Knβ†’Ξ©Kn+1β†’Kn n x = pm key where pm : (key : Unit') β†’ lock key (Iso.inv (Iso-Kn-Ξ©Kn+1 n)) (lock key (Iso.fun (Iso-Kn-Ξ©Kn+1 n)) x) ≑ x pm unlock = Iso.leftInv (Iso-Kn-Ξ©Kn+1 n) x -distrLemma : βˆ€ {β„“ β„“'} {A : Type β„“} {B : Type β„“'} (n m : β„•) (f : GroupHom (coHomGr n A) (coHomGr m B)) (x y : coHom n A) β†’ fst f (x -[ n ]β‚• y) ≑ fst f x -[ m ]β‚• fst f y -distrLemma n m f' x y = sym (-cancelRβ‚• m (f y) (f (x -[ n ]β‚• y))) βˆ™βˆ™ cong (Ξ» x β†’ x -[ m ]β‚• f y) (sym (f' .snd .presΒ· (x -[ n ]β‚• y) y)) βˆ™βˆ™ cong (Ξ» x β†’ x -[ m ]β‚• f y) ( cong f (-+cancelβ‚• n _ _)) where f = fst f'
Require Import Coq.micromega.Lia. Require Import Coq.NArith.NArith. Module N. Lemma testbit_ones n i : N.testbit (N.ones n) i = N.ltb i n. Proof using Type. pose proof N.ones_spec_iff n i. destruct (N.testbit _ _) eqn:? in*; destruct (N.ltb_spec i n); trivial. { pose proof (proj1 H eq_refl); lia. } { pose proof (proj2 H H0). inversion H1. } Qed. Lemma ones_min m n : N.ones (N.min m n) = N.land (N.ones m) (N.ones n). Proof using Type. eapply N.bits_inj_iff; intro i. rewrite N.land_spec. rewrite !N.testbit_ones. destruct (N.ltb_spec0 i (N.min m n)); destruct (N.ltb_spec0 i m); destruct (N.ltb_spec0 i n); try reflexivity; lia. Qed. End N.
It doesn’t quite feel like summer in Seattle until the fourth of July. This weekend in the 80β€²s confirmed it. Thursday night kick off after work celebrating Marky’s birthday with beers and Thai food with his family. Friday morning brunch at our house with ZoΓ« and Eric over. Paper shopping and a facial at U-Village. Surprise sneak peak of fireworks at home. Saturday was errands, running into Val at Elliott Bay, crafting Ernelyn’s gift, followed by amazing evening at Dahlia Lounge celebrating her 40th birthday with family. Sunday was dim sum with Jules, doing chores around the house, naps, mass, and then pizza dinner with Courtney and Sean at Z & E’s rooftop as the sun set. All while Lincoln crawled, screeched, laughed, kept us up late, played, impressed, and generally became a major handful. It was a good long weekend.
/- Copyright (c) 2022 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro -/ import Lean import Mathlib.Tactic.OpenPrivate import Mathlib.Data.List.Defs /-! # Backward compatible implementation of lean 3 `cases` tactic This tactic is similar to the `cases` tactic in lean 4 core, but the syntax for giving names is different: ``` example (h : p ∨ q) : q ∨ p := by cases h with | inl hp => exact Or.inr hp | inr hq => exact Or.inl hq example (h : p ∨ q) : q ∨ p := by cases' h with hp hq Β· exact Or.inr hp Β· exact Or.inl hq example (h : p ∨ q) : q ∨ p := by rcases h with hp | hq Β· exact Or.inr hp Β· exact Or.inl hq ``` Prefer `cases` or `rcases` when possible, because these tactics promote structured proofs. -/ namespace Lean.Parser.Tactic open Meta Elab Elab.Tactic open private getAltNumFields in evalCases ElimApp.evalAlts.go in def ElimApp.evalNames (elimInfo : ElimInfo) (alts : Array (Name Γ— MVarId)) (withArg : Syntax) (numEqs := 0) (numGeneralized := 0) (toClear : Array FVarId := #[]) : TermElabM (Array MVarId) := do let mut names := if withArg.isNone then [] else withArg[1].getArgs.map (getNameOfIdent' Β·[0]) |>.toList let mut subgoals := #[] for (altName, g) in alts do let numFields ← getAltNumFields elimInfo altName let (altVarNames, names') := names.splitAtD numFields `_ names := names' let (_, g) ← introN g numFields altVarNames let some (g, _) ← Cases.unifyEqs numEqs g {} | pure () let (_, g) ← introNP g numGeneralized let g ← liftM $ toClear.foldlM tryClear g subgoals := subgoals.push g pure subgoals open private getElimNameInfo generalizeTargets generalizeVars in evalInduction in elab (name := induction') tk:"induction' " tgts:(casesTarget,+) usingArg:(" using " ident)? withArg:(" with " (colGt binderIdent)+)? genArg:(" generalizing " (colGt ident)+)? : tactic => do let targets ← elabCasesTargets tgts.getSepArgs let (elimName, elimInfo) ← getElimNameInfo usingArg targets (induction := true) let g ← getMainGoal withMVarContext g do let targets ← addImplicitTargets elimInfo targets evalInduction.checkTargets targets let targetFVarIds := targets.map (Β·.fvarId!) withMVarContext g do let genArgs ← if genArg.isNone then pure #[] else getFVarIds genArg[1].getArgs let forbidden ← mkGeneralizationForbiddenSet targets let mut s ← getFVarSetToGeneralize targets forbidden for v in genArgs do if forbidden.contains v then throwError "variable cannot be generalized because target depends on it{indentExpr (mkFVar v)}" if s.contains v then throwError "unnecessary 'generalizing' argument, variable '{mkFVar v}' is generalized automatically" s := s.insert v let (fvarIds, g) ← Meta.revert g (← sortFVarIds s.toArray) let result ← withRef tgts <| ElimApp.mkElimApp elimName elimInfo targets (← getMVarTag g) let elimArgs := result.elimApp.getAppArgs ElimApp.setMotiveArg g elimArgs[elimInfo.motivePos].mvarId! targetFVarIds assignExprMVar g result.elimApp let subgoals ← ElimApp.evalNames elimInfo result.alts withArg (numGeneralized := fvarIds.size) (toClear := targetFVarIds) setGoals (subgoals ++ result.others).toList open private getElimNameInfo in evalCases in elab (name := cases') "cases' " tgts:(casesTarget,+) usingArg:(" using " ident)? withArg:(" with " (colGt binderIdent)+)? : tactic => do let targets ← elabCasesTargets tgts.getSepArgs let (elimName, elimInfo) ← getElimNameInfo usingArg targets (induction := false) let g ← getMainGoal withMVarContext g do let targets ← addImplicitTargets elimInfo targets let result ← withRef tgts <| ElimApp.mkElimApp elimName elimInfo targets (← getMVarTag g) let elimArgs := result.elimApp.getAppArgs let targets ← elimInfo.targetsPos.mapM (instantiateMVars elimArgs[Β·]) let motive := elimArgs[elimInfo.motivePos] let g ← generalizeTargetsEq g (← inferType motive) targets let (targetsNew, g) ← introN g targets.size withMVarContext g do ElimApp.setMotiveArg g motive.mvarId! targetsNew assignExprMVar g result.elimApp let subgoals ← ElimApp.evalNames elimInfo result.alts withArg (numEqs := targets.size) (toClear := targetsNew) setGoals subgoals.toList
function pseudo_marginal_full(prng, data, choices, scale, σ², ϡ², β„“Β², u) #= Filippone, Maurizio, and Mark Girolami. "Pseudo-marginal Bayesian inference for Gaussian processes." IEEE Transactions on Pattern Analysis and Machine Intelligence (2014) =## try K = compute_gram_matrix(data, σ², ϡ², β„“Β²) K = PDMats.PDMat(K) ΞΌ, Ξ£, a, B = laplace_approximation(K, choices, zeros(length(u)), scale; verbose=false) Ξ£ = PDMats.PDMat(Ξ£) q = MvNormal(ΞΌ, Ξ£) f_sample = PDMats.unwhiten(q.Ξ£, u) + q.ΞΌ joint = logjointlike(K, choices, f_sample, scale) logpml = joint - logpdf(q, f_sample) return logpml, f_sample, q, K, Ξ£, a catch err # if(isa(err, LinearAlgebra.PosDefException)) # @warn "Cholesky failed. Rejecting proposal" # return -Inf, nothing, nothing, nothing, nothing, nothing # else # throw(err) # end @warn "Cholesky or determinant failed. Rejecting proposal" return -Inf, nothing, nothing, nothing, nothing, nothing end end @inline function pseudo_marginal_partial(prng, choices, q, K, scale, u) #= Filippone, Maurizio, and Mark Girolami. "Pseudo-marginal Bayesian inference for Gaussian processes." IEEE Transactions on Pattern Analysis and Machine Intelligence (2014) =## f_sample = PDMats.unwhiten(q.Ξ£, u) + q.ΞΌ joint = logjointlike(K, choices, f_sample, scale) logpml = joint - logpdf(q, f_sample) logpml end function ess_transition(prng, loglike, prev_ΞΈ, prev_like, prior) #= Murray, Iain, Ryan Adams, and David MacKay. "Elliptical slice sampling." Artificial Intelligence and Statistics. 2010. =## @label propose chol_fail = 0 Ξ½ = rand(prng, prior) ΞΌ = mean(prior) u = rand(prng) logy = prev_like + log(u) Ο΅ = rand(prng)*2*Ο€ Ο΅_min = Ο΅ - 2*Ο€ Ο΅_max = deepcopy(Ο΅) proposals = 1 while(true) cosΟ΅ = cos(Ο΅) sinΟ΅ = sin(Ο΅) a = 1 - (cosΟ΅ + sinΟ΅) prop_ΞΈ = @. cosΟ΅*prev_ΞΈ + sinΟ΅*Ξ½ + a*ΞΌ prop_logp = loglike(prop_ΞΈ) if(isinf(prop_logp)) chol_fail += 1 if(chol_fail > 10) throw(LinearAlgebra.PosDefException(1)) end @goto propose end if(prop_logp > logy) return prop_ΞΈ, prop_logp, proposals else if(Ο΅ < 0) Ο΅_min = deepcopy(Ο΅) else Ο΅_max = deepcopy(Ο΅) end Ο΅ = rand(prng, Uniform(Ο΅_min, Ο΅_max)) proposals += 1 end end end function pm_ess(prng, samples::Int, warmup::Int, thinning::Int, initial_ΞΈ::Vector{<:Real}, initial_f::Vector{<:Real}, prior, scale::Real, data::Matrix{<:Real}, choices::Matrix{<:Int}) #= Murray, Iain, and Matthew Graham. Pseudo-marginal slice sampling. Artificial Intelligence and Statistics. 2016. =## ΞΈ_samples = zeros(length(initial_ΞΈ), samples) f_samples = zeros(length(initial_f), samples) a_samples = zeros(length(initial_f), samples) K_samples = Array{PDMats.PDMat}(undef, samples) prev_logpml = -Inf u_prior = MvNormal(length(initial_f), 1.0) ΞΈ_map, f, Ξ£, a, B, K = map_laplace(data, choices, initial_ΞΈ, scale, prior; verbose=true) ΞΈ = ΞΈ_map u = rand(prng, u_prior) q = MvNormal(f, Ξ£) logpml = pseudo_marginal_partial(prng, choices, q, K, scale, u) u_acc_mavg = OnlineStats.Mean() ΞΈ_acc_mavg = OnlineStats.Mean() prog = ProgressMeter.Progress(samples+warmup) for i = 1:(samples+warmup) Lu = u_in->begin pseudo_marginal_partial(prng, choices, q, K, scale, u_in) end u, logpml, u_nprop = ess_transition(prng, Lu, u, logpml, u_prior) LΞΈ = ΞΈ_in->begin logpml, f, q, K, Ξ£, a = pseudo_marginal_full( prng, data, choices, scale, ΞΈ_in[1], ΞΈ_in[2], ΞΈ_in[3:end], u) logpml end ΞΈ, logpml, ΞΈ_nprop = ess_transition(prng, LΞΈ, ΞΈ, logpml, prior) if(i > warmup) ΞΈ_samples[:,i-warmup] = ΞΈ f_samples[:,i-warmup] = f a_samples[:,i-warmup] = a K_samples[i-warmup] = K end u_acc = 1/u_nprop ΞΈ_acc = 1/ΞΈ_nprop OnlineStats.fit!(u_acc_mavg, u_acc) OnlineStats.fit!(ΞΈ_acc_mavg, ΞΈ_acc) ProgressMeter.next!( prog; showvalues=[(:iteration, i), (:pseudo_marginal_loglikelihood, logpml), (:u_acceptance, u_acc), (:ΞΈ_acceptance, ΞΈ_acc), (:u_average_acceptance, u_acc_mavg.ΞΌ), (:ΞΈ_average_acceptance, ΞΈ_acc_mavg.ΞΌ) ]) end ΞΈ_samples = ΞΈ_samples[:,1:thinning:end] f_samples = f_samples[:,1:thinning:end] a_samples = a_samples[:,1:thinning:end] K_samples = K_samples[1:thinning:end] ΞΈ_samples, f_samples, a_samples, K_samples end
(* Title: HOL/Analysis/Borel_Space.thy Author: Johannes HΓΆlzl, TU MΓΌnchen Author: Armin Heller, TU MΓΌnchen *) section \<open>Borel Space\<close> theory Borel_Space imports Measurable Derivative Ordered_Euclidean_Space Extended_Real_Limits begin lemma is_interval_real_ereal_oo: "is_interval (real_of_ereal ` {N<..<M::ereal})" by (auto simp: real_atLeastGreaterThan_eq) lemma sets_Collect_eventually_sequentially[measurable]: "(\<And>i. {x\<in>space M. P x i} \<in> sets M) \<Longrightarrow> {x\<in>space M. eventually (P x) sequentially} \<in> sets M" unfolding eventually_sequentially by simp lemma topological_basis_trivial: "topological_basis {A. open A}" by (auto simp: topological_basis_def) proposition open_prod_generated: "open = generate_topology {A \<times> B | A B. open A \<and> open B}" proof - have "{A \<times> B :: ('a \<times> 'b) set | A B. open A \<and> open B} = ((\<lambda>(a, b). a \<times> b) ` ({A. open A} \<times> {A. open A}))" by auto then show ?thesis by (auto intro: topological_basis_prod topological_basis_trivial topological_basis_imp_subbasis) qed proposition mono_on_imp_deriv_nonneg: assumes mono: "mono_on A f" and deriv: "(f has_real_derivative D) (at x)" assumes "x \<in> interior A" shows "D \<ge> 0" proof (rule tendsto_lowerbound) let ?A' = "(\<lambda>y. y - x) ` interior A" from deriv show "((\<lambda>h. (f (x + h) - f x) / h) \<longlongrightarrow> D) (at 0)" by (simp add: field_has_derivative_at has_field_derivative_def) from mono have mono': "mono_on (interior A) f" by (rule mono_on_subset) (rule interior_subset) show "eventually (\<lambda>h. (f (x + h) - f x) / h \<ge> 0) (at 0)" proof (subst eventually_at_topological, intro exI conjI ballI impI) have "open (interior A)" by simp hence "open ((+) (-x) ` interior A)" by (rule open_translation) also have "((+) (-x) ` interior A) = ?A'" by auto finally show "open ?A'" . next from \<open>x \<in> interior A\<close> show "0 \<in> ?A'" by auto next fix h assume "h \<in> ?A'" hence "x + h \<in> interior A" by auto with mono' and \<open>x \<in> interior A\<close> show "(f (x + h) - f x) / h \<ge> 0" by (cases h rule: linorder_cases[of _ 0]) (simp_all add: divide_nonpos_neg divide_nonneg_pos mono_onD field_simps) qed qed simp proposition mono_on_ctble_discont: fixes f :: "real \<Rightarrow> real" fixes A :: "real set" assumes "mono_on A f" shows "countable {a\<in>A. \<not> continuous (at a within A) f}" proof - have mono: "\<And>x y. x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<le> f y" using \<open>mono_on A f\<close> by (simp add: mono_on_def) have "\<forall>a \<in> {a\<in>A. \<not> continuous (at a within A) f}. \<exists>q :: nat \<times> rat. (fst q = 0 \<and> of_rat (snd q) < f a \<and> (\<forall>x \<in> A. x < a \<longrightarrow> f x < of_rat (snd q))) \<or> (fst q = 1 \<and> of_rat (snd q) > f a \<and> (\<forall>x \<in> A. x > a \<longrightarrow> f x > of_rat (snd q)))" proof (clarsimp simp del: One_nat_def) fix a assume "a \<in> A" assume "\<not> continuous (at a within A) f" thus "\<exists>q1 q2. q1 = 0 \<and> real_of_rat q2 < f a \<and> (\<forall>x\<in>A. x < a \<longrightarrow> f x < real_of_rat q2) \<or> q1 = 1 \<and> f a < real_of_rat q2 \<and> (\<forall>x\<in>A. a < x \<longrightarrow> real_of_rat q2 < f x)" proof (auto simp add: continuous_within order_tendsto_iff eventually_at) fix l assume "l < f a" then obtain q2 where q2: "l < of_rat q2" "of_rat q2 < f a" using of_rat_dense by blast assume * [rule_format]: "\<forall>d>0. \<exists>x\<in>A. x \<noteq> a \<and> dist x a < d \<and> \<not> l < f x" from q2 have "real_of_rat q2 < f a \<and> (\<forall>x\<in>A. x < a \<longrightarrow> f x < real_of_rat q2)" proof auto fix x assume "x \<in> A" "x < a" with q2 *[of "a - x"] show "f x < real_of_rat q2" apply (auto simp add: dist_real_def not_less) apply (subgoal_tac "f x \<le> f xa") by (auto intro: mono) qed thus ?thesis by auto next fix u assume "u > f a" then obtain q2 where q2: "f a < of_rat q2" "of_rat q2 < u" using of_rat_dense by blast assume *[rule_format]: "\<forall>d>0. \<exists>x\<in>A. x \<noteq> a \<and> dist x a < d \<and> \<not> u > f x" from q2 have "real_of_rat q2 > f a \<and> (\<forall>x\<in>A. x > a \<longrightarrow> f x > real_of_rat q2)" proof auto fix x assume "x \<in> A" "x > a" with q2 *[of "x - a"] show "f x > real_of_rat q2" apply (auto simp add: dist_real_def) apply (subgoal_tac "f x \<ge> f xa") by (auto intro: mono) qed thus ?thesis by auto qed qed then obtain g :: "real \<Rightarrow> nat \<times> rat" where "\<forall>a \<in> {a\<in>A. \<not> continuous (at a within A) f}. (fst (g a) = 0 \<and> of_rat (snd (g a)) < f a \<and> (\<forall>x \<in> A. x < a \<longrightarrow> f x < of_rat (snd (g a)))) | (fst (g a) = 1 \<and> of_rat (snd (g a)) > f a \<and> (\<forall>x \<in> A. x > a \<longrightarrow> f x > of_rat (snd (g a))))" by (rule bchoice [THEN exE]) blast hence g: "\<And>a x. a \<in> A \<Longrightarrow> \<not> continuous (at a within A) f \<Longrightarrow> x \<in> A \<Longrightarrow> (fst (g a) = 0 \<and> of_rat (snd (g a)) < f a \<and> (x < a \<longrightarrow> f x < of_rat (snd (g a)))) | (fst (g a) = 1 \<and> of_rat (snd (g a)) > f a \<and> (x > a \<longrightarrow> f x > of_rat (snd (g a))))" by auto have "inj_on g {a\<in>A. \<not> continuous (at a within A) f}" proof (auto simp add: inj_on_def) fix w z assume 1: "w \<in> A" and 2: "\<not> continuous (at w within A) f" and 3: "z \<in> A" and 4: "\<not> continuous (at z within A) f" and 5: "g w = g z" from g [OF 1 2 3] g [OF 3 4 1] 5 show "w = z" by auto qed thus ?thesis by (rule countableI') qed lemma mono_on_ctble_discont_open: fixes f :: "real \<Rightarrow> real" fixes A :: "real set" assumes "open A" "mono_on A f" shows "countable {a\<in>A. \<not>isCont f a}" proof - have "{a\<in>A. \<not>isCont f a} = {a\<in>A. \<not>(continuous (at a within A) f)}" by (auto simp add: continuous_within_open [OF _ \<open>open A\<close>]) thus ?thesis apply (elim ssubst) by (rule mono_on_ctble_discont, rule assms) qed lemma mono_ctble_discont: fixes f :: "real \<Rightarrow> real" assumes "mono f" shows "countable {a. \<not> isCont f a}" using assms mono_on_ctble_discont [of UNIV f] unfolding mono_on_def mono_def by auto lemma has_real_derivative_imp_continuous_on: assumes "\<And>x. x \<in> A \<Longrightarrow> (f has_real_derivative f' x) (at x)" shows "continuous_on A f" apply (intro differentiable_imp_continuous_on, unfold differentiable_on_def) using assms differentiable_at_withinI real_differentiable_def by blast lemma continuous_interval_vimage_Int: assumes "continuous_on {a::real..b} g" and mono: "\<And>x y. a \<le> x \<Longrightarrow> x \<le> y \<Longrightarrow> y \<le> b \<Longrightarrow> g x \<le> g y" assumes "a \<le> b" "(c::real) \<le> d" "{c..d} \<subseteq> {g a..g b}" obtains c' d' where "{a..b} \<inter> g -` {c..d} = {c'..d'}" "c' \<le> d'" "g c' = c" "g d' = d" proof- let ?A = "{a..b} \<inter> g -` {c..d}" from IVT'[of g a c b, OF _ _ \<open>a \<le> b\<close> assms(1)] assms(4,5) obtain c'' where c'': "c'' \<in> ?A" "g c'' = c" by auto from IVT'[of g a d b, OF _ _ \<open>a \<le> b\<close> assms(1)] assms(4,5) obtain d'' where d'': "d'' \<in> ?A" "g d'' = d" by auto hence [simp]: "?A \<noteq> {}" by blast define c' where "c' = Inf ?A" define d' where "d' = Sup ?A" have "?A \<subseteq> {c'..d'}" unfolding c'_def d'_def by (intro subsetI) (auto intro: cInf_lower cSup_upper) moreover from assms have "closed ?A" using continuous_on_closed_vimage[of "{a..b}" g] by (subst Int_commute) simp hence c'd'_in_set: "c' \<in> ?A" "d' \<in> ?A" unfolding c'_def d'_def by ((intro closed_contains_Inf closed_contains_Sup, simp_all)[])+ hence "{c'..d'} \<subseteq> ?A" using assms by (intro subsetI) (auto intro!: order_trans[of c "g c'" "g x" for x] order_trans[of "g x" "g d'" d for x] intro!: mono) moreover have "c' \<le> d'" using c'd'_in_set(2) unfolding c'_def by (intro cInf_lower) auto moreover have "g c' \<le> c" "g d' \<ge> d" apply (insert c'' d'' c'd'_in_set) apply (subst c''(2)[symmetric]) apply (auto simp: c'_def intro!: mono cInf_lower c'') [] apply (subst d''(2)[symmetric]) apply (auto simp: d'_def intro!: mono cSup_upper d'') [] done with c'd'_in_set have "g c' = c" "g d' = d" by auto ultimately show ?thesis using that by blast qed subsection \<open>Generic Borel spaces\<close> definition\<^marker>\<open>tag important\<close> (in topological_space) borel :: "'a measure" where "borel = sigma UNIV {S. open S}" abbreviation "borel_measurable M \<equiv> measurable M borel" lemma in_borel_measurable: "f \<in> borel_measurable M \<longleftrightarrow> (\<forall>S \<in> sigma_sets UNIV {S. open S}. f -` S \<inter> space M \<in> sets M)" by (auto simp add: measurable_def borel_def) lemma in_borel_measurable_borel: "f \<in> borel_measurable M \<longleftrightarrow> (\<forall>S \<in> sets borel. f -` S \<inter> space M \<in> sets M)" by (auto simp add: measurable_def borel_def) lemma space_borel[simp]: "space borel = UNIV" unfolding borel_def by auto lemma space_in_borel[measurable]: "UNIV \<in> sets borel" unfolding borel_def by auto lemma sets_borel: "sets borel = sigma_sets UNIV {S. open S}" unfolding borel_def by (rule sets_measure_of) simp lemma measurable_sets_borel: "\<lbrakk>f \<in> measurable borel M; A \<in> sets M\<rbrakk> \<Longrightarrow> f -` A \<in> sets borel" by (drule (1) measurable_sets) simp lemma pred_Collect_borel[measurable (raw)]: "Measurable.pred borel P \<Longrightarrow> {x. P x} \<in> sets borel" unfolding borel_def pred_def by auto lemma borel_open[measurable (raw generic)]: assumes "open A" shows "A \<in> sets borel" proof - have "A \<in> {S. open S}" unfolding mem_Collect_eq using assms . thus ?thesis unfolding borel_def by auto qed lemma borel_closed[measurable (raw generic)]: assumes "closed A" shows "A \<in> sets borel" proof - have "space borel - (- A) \<in> sets borel" using assms unfolding closed_def by (blast intro: borel_open) thus ?thesis by simp qed lemma borel_singleton[measurable]: "A \<in> sets borel \<Longrightarrow> insert x A \<in> sets (borel :: 'a::t1_space measure)" unfolding insert_def by (rule sets.Un) auto lemma sets_borel_eq_count_space: "sets (borel :: 'a::{countable, t2_space} measure) = count_space UNIV" proof - have "(\<Union>a\<in>A. {a}) \<in> sets borel" for A :: "'a set" by (intro sets.countable_UN') auto then show ?thesis by auto qed lemma borel_comp[measurable]: "A \<in> sets borel \<Longrightarrow> - A \<in> sets borel" unfolding Compl_eq_Diff_UNIV by simp lemma borel_measurable_vimage: fixes f :: "'a \<Rightarrow> 'x::t2_space" assumes borel[measurable]: "f \<in> borel_measurable M" shows "f -` {x} \<inter> space M \<in> sets M" by simp lemma borel_measurableI: fixes f :: "'a \<Rightarrow> 'x::topological_space" assumes "\<And>S. open S \<Longrightarrow> f -` S \<inter> space M \<in> sets M" shows "f \<in> borel_measurable M" unfolding borel_def proof (rule measurable_measure_of, simp_all) fix S :: "'x set" assume "open S" thus "f -` S \<inter> space M \<in> sets M" using assms[of S] by simp qed lemma borel_measurable_const: "(\<lambda>x. c) \<in> borel_measurable M" by auto lemma borel_measurable_indicator: assumes A: "A \<in> sets M" shows "indicator A \<in> borel_measurable M" unfolding indicator_def [abs_def] using A by (auto intro!: measurable_If_set) lemma borel_measurable_count_space[measurable (raw)]: "f \<in> borel_measurable (count_space S)" unfolding measurable_def by auto lemma borel_measurable_indicator'[measurable (raw)]: assumes [measurable]: "{x\<in>space M. f x \<in> A x} \<in> sets M" shows "(\<lambda>x. indicator (A x) (f x)) \<in> borel_measurable M" unfolding indicator_def[abs_def] by (auto intro!: measurable_If) lemma borel_measurable_indicator_iff: "(indicator A :: 'a \<Rightarrow> 'x::{t1_space, zero_neq_one}) \<in> borel_measurable M \<longleftrightarrow> A \<inter> space M \<in> sets M" (is "?I \<in> borel_measurable M \<longleftrightarrow> _") proof assume "?I \<in> borel_measurable M" then have "?I -` {1} \<inter> space M \<in> sets M" unfolding measurable_def by auto also have "?I -` {1} \<inter> space M = A \<inter> space M" unfolding indicator_def [abs_def] by auto finally show "A \<inter> space M \<in> sets M" . next assume "A \<inter> space M \<in> sets M" moreover have "?I \<in> borel_measurable M \<longleftrightarrow> (indicator (A \<inter> space M) :: 'a \<Rightarrow> 'x) \<in> borel_measurable M" by (intro measurable_cong) (auto simp: indicator_def) ultimately show "?I \<in> borel_measurable M" by auto qed lemma borel_measurable_subalgebra: assumes "sets N \<subseteq> sets M" "space N = space M" "f \<in> borel_measurable N" shows "f \<in> borel_measurable M" using assms unfolding measurable_def by auto lemma borel_measurable_restrict_space_iff_ereal: fixes f :: "'a \<Rightarrow> ereal" assumes \<Omega>[measurable, simp]: "\<Omega> \<inter> space M \<in> sets M" shows "f \<in> borel_measurable (restrict_space M \<Omega>) \<longleftrightarrow> (\<lambda>x. f x * indicator \<Omega> x) \<in> borel_measurable M" by (subst measurable_restrict_space_iff) (auto simp: indicator_def of_bool_def if_distrib[where f="\<lambda>x. a * x" for a] cong del: if_weak_cong) lemma borel_measurable_restrict_space_iff_ennreal: fixes f :: "'a \<Rightarrow> ennreal" assumes \<Omega>[measurable, simp]: "\<Omega> \<inter> space M \<in> sets M" shows "f \<in> borel_measurable (restrict_space M \<Omega>) \<longleftrightarrow> (\<lambda>x. f x * indicator \<Omega> x) \<in> borel_measurable M" by (subst measurable_restrict_space_iff) (auto simp: indicator_def of_bool_def if_distrib[where f="\<lambda>x. a * x" for a] cong del: if_weak_cong) lemma borel_measurable_restrict_space_iff: fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" assumes \<Omega>[measurable, simp]: "\<Omega> \<inter> space M \<in> sets M" shows "f \<in> borel_measurable (restrict_space M \<Omega>) \<longleftrightarrow> (\<lambda>x. indicator \<Omega> x *\<^sub>R f x) \<in> borel_measurable M" by (subst measurable_restrict_space_iff) (auto simp: indicator_def of_bool_def if_distrib[where f="\<lambda>x. x *\<^sub>R a" for a] ac_simps cong del: if_weak_cong) lemma cbox_borel[measurable]: "cbox a b \<in> sets borel" by (auto intro: borel_closed) lemma box_borel[measurable]: "box a b \<in> sets borel" by (auto intro: borel_open) lemma borel_compact: "compact (A::'a::t2_space set) \<Longrightarrow> A \<in> sets borel" by (auto intro: borel_closed dest!: compact_imp_closed) lemma borel_sigma_sets_subset: "A \<subseteq> sets borel \<Longrightarrow> sigma_sets UNIV A \<subseteq> sets borel" using sets.sigma_sets_subset[of A borel] by simp lemma borel_eq_sigmaI1: fixes F :: "'i \<Rightarrow> 'a::topological_space set" and X :: "'a::topological_space set set" assumes borel_eq: "borel = sigma UNIV X" assumes X: "\<And>x. x \<in> X \<Longrightarrow> x \<in> sets (sigma UNIV (F ` A))" assumes F: "\<And>i. i \<in> A \<Longrightarrow> F i \<in> sets borel" shows "borel = sigma UNIV (F ` A)" unfolding borel_def proof (intro sigma_eqI antisym) have borel_rev_eq: "sigma_sets UNIV {S::'a set. open S} = sets borel" unfolding borel_def by simp also have "\<dots> = sigma_sets UNIV X" unfolding borel_eq by simp also have "\<dots> \<subseteq> sigma_sets UNIV (F`A)" using X by (intro sigma_algebra.sigma_sets_subset[OF sigma_algebra_sigma_sets]) auto finally show "sigma_sets UNIV {S. open S} \<subseteq> sigma_sets UNIV (F`A)" . show "sigma_sets UNIV (F`A) \<subseteq> sigma_sets UNIV {S. open S}" unfolding borel_rev_eq using F by (intro borel_sigma_sets_subset) auto qed auto lemma borel_eq_sigmaI2: fixes F :: "'i \<Rightarrow> 'j \<Rightarrow> 'a::topological_space set" and G :: "'l \<Rightarrow> 'k \<Rightarrow> 'a::topological_space set" assumes borel_eq: "borel = sigma UNIV ((\<lambda>(i, j). G i j)`B)" assumes X: "\<And>i j. (i, j) \<in> B \<Longrightarrow> G i j \<in> sets (sigma UNIV ((\<lambda>(i, j). F i j) ` A))" assumes F: "\<And>i j. (i, j) \<in> A \<Longrightarrow> F i j \<in> sets borel" shows "borel = sigma UNIV ((\<lambda>(i, j). F i j) ` A)" using assms by (intro borel_eq_sigmaI1[where X="(\<lambda>(i, j). G i j) ` B" and F="(\<lambda>(i, j). F i j)"]) auto lemma borel_eq_sigmaI3: fixes F :: "'i \<Rightarrow> 'j \<Rightarrow> 'a::topological_space set" and X :: "'a::topological_space set set" assumes borel_eq: "borel = sigma UNIV X" assumes X: "\<And>x. x \<in> X \<Longrightarrow> x \<in> sets (sigma UNIV ((\<lambda>(i, j). F i j) ` A))" assumes F: "\<And>i j. (i, j) \<in> A \<Longrightarrow> F i j \<in> sets borel" shows "borel = sigma UNIV ((\<lambda>(i, j). F i j) ` A)" using assms by (intro borel_eq_sigmaI1[where X=X and F="(\<lambda>(i, j). F i j)"]) auto lemma borel_eq_sigmaI4: fixes F :: "'i \<Rightarrow> 'a::topological_space set" and G :: "'l \<Rightarrow> 'k \<Rightarrow> 'a::topological_space set" assumes borel_eq: "borel = sigma UNIV ((\<lambda>(i, j). G i j)`A)" assumes X: "\<And>i j. (i, j) \<in> A \<Longrightarrow> G i j \<in> sets (sigma UNIV (range F))" assumes F: "\<And>i. F i \<in> sets borel" shows "borel = sigma UNIV (range F)" using assms by (intro borel_eq_sigmaI1[where X="(\<lambda>(i, j). G i j) ` A" and F=F]) auto lemma borel_eq_sigmaI5: fixes F :: "'i \<Rightarrow> 'j \<Rightarrow> 'a::topological_space set" and G :: "'l \<Rightarrow> 'a::topological_space set" assumes borel_eq: "borel = sigma UNIV (range G)" assumes X: "\<And>i. G i \<in> sets (sigma UNIV (range (\<lambda>(i, j). F i j)))" assumes F: "\<And>i j. F i j \<in> sets borel" shows "borel = sigma UNIV (range (\<lambda>(i, j). F i j))" using assms by (intro borel_eq_sigmaI1[where X="range G" and F="(\<lambda>(i, j). F i j)"]) auto theorem second_countable_borel_measurable: fixes X :: "'a::second_countable_topology set set" assumes eq: "open = generate_topology X" shows "borel = sigma UNIV X" unfolding borel_def proof (intro sigma_eqI sigma_sets_eqI) interpret X: sigma_algebra UNIV "sigma_sets UNIV X" by (rule sigma_algebra_sigma_sets) simp fix S :: "'a set" assume "S \<in> Collect open" then have "generate_topology X S" by (auto simp: eq) then show "S \<in> sigma_sets UNIV X" proof induction case (UN K) then have K: "\<And>k. k \<in> K \<Longrightarrow> open k" unfolding eq by auto from ex_countable_basis obtain B :: "'a set set" where B: "\<And>b. b \<in> B \<Longrightarrow> open b" "\<And>X. open X \<Longrightarrow> \<exists>b\<subseteq>B. (\<Union>b) = X" and "countable B" by (auto simp: topological_basis_def) from B(2)[OF K] obtain m where m: "\<And>k. k \<in> K \<Longrightarrow> m k \<subseteq> B" "\<And>k. k \<in> K \<Longrightarrow> \<Union>(m k) = k" by metis define U where "U = (\<Union>k\<in>K. m k)" with m have "countable U" by (intro countable_subset[OF _ \<open>countable B\<close>]) auto have "\<Union>U = (\<Union>A\<in>U. A)" by simp also have "\<dots> = \<Union>K" unfolding U_def UN_simps by (simp add: m) finally have "\<Union>U = \<Union>K" . have "\<forall>b\<in>U. \<exists>k\<in>K. b \<subseteq> k" using m by (auto simp: U_def) then obtain u where u: "\<And>b. b \<in> U \<Longrightarrow> u b \<in> K" and "\<And>b. b \<in> U \<Longrightarrow> b \<subseteq> u b" by metis then have "(\<Union>b\<in>U. u b) \<subseteq> \<Union>K" "\<Union>U \<subseteq> (\<Union>b\<in>U. u b)" by auto then have "\<Union>K = (\<Union>b\<in>U. u b)" unfolding \<open>\<Union>U = \<Union>K\<close> by auto also have "\<dots> \<in> sigma_sets UNIV X" using u UN by (intro X.countable_UN' \<open>countable U\<close>) auto finally show "\<Union>K \<in> sigma_sets UNIV X" . qed auto qed (auto simp: eq intro: generate_topology.Basis) lemma borel_eq_closed: "borel = sigma UNIV (Collect closed)" unfolding borel_def proof (intro sigma_eqI sigma_sets_eqI, safe) fix x :: "'a set" assume "open x" hence "x = UNIV - (UNIV - x)" by auto also have "\<dots> \<in> sigma_sets UNIV (Collect closed)" by (force intro: sigma_sets.Compl simp: \<open>open x\<close>) finally show "x \<in> sigma_sets UNIV (Collect closed)" by simp next fix x :: "'a set" assume "closed x" hence "x = UNIV - (UNIV - x)" by auto also have "\<dots> \<in> sigma_sets UNIV (Collect open)" by (force intro: sigma_sets.Compl simp: \<open>closed x\<close>) finally show "x \<in> sigma_sets UNIV (Collect open)" by simp qed simp_all proposition borel_eq_countable_basis: fixes B::"'a::topological_space set set" assumes "countable B" assumes "topological_basis B" shows "borel = sigma UNIV B" unfolding borel_def proof (intro sigma_eqI sigma_sets_eqI, safe) interpret countable_basis "open" B using assms by (rule countable_basis_openI) fix X::"'a set" assume "open X" from open_countable_basisE[OF this] obtain B' where B': "B' \<subseteq> B" "X = \<Union> B'" . then show "X \<in> sigma_sets UNIV B" by (blast intro: sigma_sets_UNION \<open>countable B\<close> countable_subset) next fix b assume "b \<in> B" hence "open b" by (rule topological_basis_open[OF assms(2)]) thus "b \<in> sigma_sets UNIV (Collect open)" by auto qed simp_all lemma borel_measurable_continuous_on_restrict: fixes f :: "'a::topological_space \<Rightarrow> 'b::topological_space" assumes f: "continuous_on A f" shows "f \<in> borel_measurable (restrict_space borel A)" proof (rule borel_measurableI) fix S :: "'b set" assume "open S" with f obtain T where "f -` S \<inter> A = T \<inter> A" "open T" by (metis continuous_on_open_invariant) then show "f -` S \<inter> space (restrict_space borel A) \<in> sets (restrict_space borel A)" by (force simp add: sets_restrict_space space_restrict_space) qed lemma borel_measurable_continuous_onI: "continuous_on UNIV f \<Longrightarrow> f \<in> borel_measurable borel" by (drule borel_measurable_continuous_on_restrict) simp lemma borel_measurable_continuous_on_if: "A \<in> sets borel \<Longrightarrow> continuous_on A f \<Longrightarrow> continuous_on (- A) g \<Longrightarrow> (\<lambda>x. if x \<in> A then f x else g x) \<in> borel_measurable borel" by (auto simp add: measurable_If_restrict_space_iff Collect_neg_eq intro!: borel_measurable_continuous_on_restrict) lemma borel_measurable_continuous_countable_exceptions: fixes f :: "'a::t1_space \<Rightarrow> 'b::topological_space" assumes X: "countable X" assumes "continuous_on (- X) f" shows "f \<in> borel_measurable borel" proof (rule measurable_discrete_difference[OF _ X]) have "X \<in> sets borel" by (rule sets.countable[OF _ X]) auto then show "(\<lambda>x. if x \<in> X then undefined else f x) \<in> borel_measurable borel" by (intro borel_measurable_continuous_on_if assms continuous_intros) qed auto lemma borel_measurable_continuous_on: assumes f: "continuous_on UNIV f" and g: "g \<in> borel_measurable M" shows "(\<lambda>x. f (g x)) \<in> borel_measurable M" using measurable_comp[OF g borel_measurable_continuous_onI[OF f]] by (simp add: comp_def) lemma borel_measurable_continuous_on_indicator: fixes f g :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector" shows "A \<in> sets borel \<Longrightarrow> continuous_on A f \<Longrightarrow> (\<lambda>x. indicator A x *\<^sub>R f x) \<in> borel_measurable borel" by (subst borel_measurable_restrict_space_iff[symmetric]) (auto intro: borel_measurable_continuous_on_restrict) lemma borel_measurable_Pair[measurable (raw)]: fixes f :: "'a \<Rightarrow> 'b::second_countable_topology" and g :: "'a \<Rightarrow> 'c::second_countable_topology" assumes f[measurable]: "f \<in> borel_measurable M" assumes g[measurable]: "g \<in> borel_measurable M" shows "(\<lambda>x. (f x, g x)) \<in> borel_measurable M" proof (subst borel_eq_countable_basis) let ?B = "SOME B::'b set set. countable B \<and> topological_basis B" let ?C = "SOME B::'c set set. countable B \<and> topological_basis B" let ?P = "(\<lambda>(b, c). b \<times> c) ` (?B \<times> ?C)" show "countable ?P" "topological_basis ?P" by (auto intro!: countable_basis topological_basis_prod is_basis) show "(\<lambda>x. (f x, g x)) \<in> measurable M (sigma UNIV ?P)" proof (rule measurable_measure_of) fix S assume "S \<in> ?P" then obtain b c where "b \<in> ?B" "c \<in> ?C" and S: "S = b \<times> c" by auto then have borel: "open b" "open c" by (auto intro: is_basis topological_basis_open) have "(\<lambda>x. (f x, g x)) -` S \<inter> space M = (f -` b \<inter> space M) \<inter> (g -` c \<inter> space M)" unfolding S by auto also have "\<dots> \<in> sets M" using borel by simp finally show "(\<lambda>x. (f x, g x)) -` S \<inter> space M \<in> sets M" . qed auto qed lemma borel_measurable_continuous_Pair: fixes f :: "'a \<Rightarrow> 'b::second_countable_topology" and g :: "'a \<Rightarrow> 'c::second_countable_topology" assumes [measurable]: "f \<in> borel_measurable M" assumes [measurable]: "g \<in> borel_measurable M" assumes H: "continuous_on UNIV (\<lambda>x. H (fst x) (snd x))" shows "(\<lambda>x. H (f x) (g x)) \<in> borel_measurable M" proof - have eq: "(\<lambda>x. H (f x) (g x)) = (\<lambda>x. (\<lambda>x. H (fst x) (snd x)) (f x, g x))" by auto show ?thesis unfolding eq by (rule borel_measurable_continuous_on[OF H]) auto qed subsection \<open>Borel spaces on order topologies\<close> lemma [measurable]: fixes a b :: "'a::linorder_topology" shows lessThan_borel: "{..< a} \<in> sets borel" and greaterThan_borel: "{a <..} \<in> sets borel" and greaterThanLessThan_borel: "{a<..<b} \<in> sets borel" and atMost_borel: "{..a} \<in> sets borel" and atLeast_borel: "{a..} \<in> sets borel" and atLeastAtMost_borel: "{a..b} \<in> sets borel" and greaterThanAtMost_borel: "{a<..b} \<in> sets borel" and atLeastLessThan_borel: "{a..<b} \<in> sets borel" unfolding greaterThanAtMost_def atLeastLessThan_def by (blast intro: borel_open borel_closed open_lessThan open_greaterThan open_greaterThanLessThan closed_atMost closed_atLeast closed_atLeastAtMost)+ lemma borel_Iio: "borel = sigma UNIV (range lessThan :: 'a::{linorder_topology, second_countable_topology} set set)" unfolding second_countable_borel_measurable[OF open_generated_order] proof (intro sigma_eqI sigma_sets_eqI) obtain D :: "'a set" where D: "countable D" "\<And>X. open X \<Longrightarrow> X \<noteq> {} \<Longrightarrow> \<exists>d\<in>D. d \<in> X" by (rule countable_dense_setE) blast interpret L: sigma_algebra UNIV "sigma_sets UNIV (range lessThan)" by (rule sigma_algebra_sigma_sets) simp fix A :: "'a set" assume "A \<in> range lessThan \<union> range greaterThan" then obtain y where "A = {y <..} \<or> A = {..< y}" by blast then show "A \<in> sigma_sets UNIV (range lessThan)" proof assume A: "A = {y <..}" show ?thesis proof cases assume "\<forall>x>y. \<exists>d. y < d \<and> d < x" with D(2)[of "{y <..< x}" for x] have "\<forall>x>y. \<exists>d\<in>D. y < d \<and> d < x" by (auto simp: set_eq_iff) then have "A = UNIV - (\<Inter>d\<in>{d\<in>D. y < d}. {..< d})" by (auto simp: A) (metis less_asym) also have "\<dots> \<in> sigma_sets UNIV (range lessThan)" using D(1) by (intro L.Diff L.top L.countable_INT'') auto finally show ?thesis . next assume "\<not> (\<forall>x>y. \<exists>d. y < d \<and> d < x)" then obtain x where "y < x" "\<And>d. y < d \<Longrightarrow> \<not> d < x" by auto then have "A = UNIV - {..< x}" unfolding A by (auto simp: not_less[symmetric]) also have "\<dots> \<in> sigma_sets UNIV (range lessThan)" by auto finally show ?thesis . qed qed auto qed auto lemma borel_Ioi: "borel = sigma UNIV (range greaterThan :: 'a::{linorder_topology, second_countable_topology} set set)" unfolding second_countable_borel_measurable[OF open_generated_order] proof (intro sigma_eqI sigma_sets_eqI) obtain D :: "'a set" where D: "countable D" "\<And>X. open X \<Longrightarrow> X \<noteq> {} \<Longrightarrow> \<exists>d\<in>D. d \<in> X" by (rule countable_dense_setE) blast interpret L: sigma_algebra UNIV "sigma_sets UNIV (range greaterThan)" by (rule sigma_algebra_sigma_sets) simp fix A :: "'a set" assume "A \<in> range lessThan \<union> range greaterThan" then obtain y where "A = {y <..} \<or> A = {..< y}" by blast then show "A \<in> sigma_sets UNIV (range greaterThan)" proof assume A: "A = {..< y}" show ?thesis proof cases assume "\<forall>x<y. \<exists>d. x < d \<and> d < y" with D(2)[of "{x <..< y}" for x] have "\<forall>x<y. \<exists>d\<in>D. x < d \<and> d < y" by (auto simp: set_eq_iff) then have "A = UNIV - (\<Inter>d\<in>{d\<in>D. d < y}. {d <..})" by (auto simp: A) (metis less_asym) also have "\<dots> \<in> sigma_sets UNIV (range greaterThan)" using D(1) by (intro L.Diff L.top L.countable_INT'') auto finally show ?thesis . next assume "\<not> (\<forall>x<y. \<exists>d. x < d \<and> d < y)" then obtain x where "x < y" "\<And>d. y > d \<Longrightarrow> x \<ge> d" by (auto simp: not_less[symmetric]) then have "A = UNIV - {x <..}" unfolding A Compl_eq_Diff_UNIV[symmetric] by auto also have "\<dots> \<in> sigma_sets UNIV (range greaterThan)" by auto finally show ?thesis . qed qed auto qed auto lemma borel_measurableI_less: fixes f :: "'a \<Rightarrow> 'b::{linorder_topology, second_countable_topology}" shows "(\<And>y. {x\<in>space M. f x < y} \<in> sets M) \<Longrightarrow> f \<in> borel_measurable M" unfolding borel_Iio by (rule measurable_measure_of) (auto simp: Int_def conj_commute) lemma borel_measurableI_greater: fixes f :: "'a \<Rightarrow> 'b::{linorder_topology, second_countable_topology}" shows "(\<And>y. {x\<in>space M. y < f x} \<in> sets M) \<Longrightarrow> f \<in> borel_measurable M" unfolding borel_Ioi by (rule measurable_measure_of) (auto simp: Int_def conj_commute) lemma borel_measurableI_le: fixes f :: "'a \<Rightarrow> 'b::{linorder_topology, second_countable_topology}" shows "(\<And>y. {x\<in>space M. f x \<le> y} \<in> sets M) \<Longrightarrow> f \<in> borel_measurable M" by (rule borel_measurableI_greater) (auto simp: not_le[symmetric]) lemma borel_measurableI_ge: fixes f :: "'a \<Rightarrow> 'b::{linorder_topology, second_countable_topology}" shows "(\<And>y. {x\<in>space M. y \<le> f x} \<in> sets M) \<Longrightarrow> f \<in> borel_measurable M" by (rule borel_measurableI_less) (auto simp: not_le[symmetric]) lemma borel_measurable_less[measurable]: fixes f :: "'a \<Rightarrow> 'b::{second_countable_topology, linorder_topology}" assumes "f \<in> borel_measurable M" assumes "g \<in> borel_measurable M" shows "{w \<in> space M. f w < g w} \<in> sets M" proof - have "{w \<in> space M. f w < g w} = (\<lambda>x. (f x, g x)) -` {x. fst x < snd x} \<inter> space M" by auto also have "\<dots> \<in> sets M" by (intro measurable_sets[OF borel_measurable_Pair borel_open, OF assms open_Collect_less] continuous_intros) finally show ?thesis . qed lemma fixes f :: "'a \<Rightarrow> 'b::{second_countable_topology, linorder_topology}" assumes f[measurable]: "f \<in> borel_measurable M" assumes g[measurable]: "g \<in> borel_measurable M" shows borel_measurable_le[measurable]: "{w \<in> space M. f w \<le> g w} \<in> sets M" and borel_measurable_eq[measurable]: "{w \<in> space M. f w = g w} \<in> sets M" and borel_measurable_neq: "{w \<in> space M. f w \<noteq> g w} \<in> sets M" unfolding eq_iff not_less[symmetric] by measurable lemma borel_measurable_SUP[measurable (raw)]: fixes F :: "_ \<Rightarrow> _ \<Rightarrow> _::{complete_linorder, linorder_topology, second_countable_topology}" assumes [simp]: "countable I" assumes [measurable]: "\<And>i. i \<in> I \<Longrightarrow> F i \<in> borel_measurable M" shows "(\<lambda>x. SUP i\<in>I. F i x) \<in> borel_measurable M" by (rule borel_measurableI_greater) (simp add: less_SUP_iff) lemma borel_measurable_INF[measurable (raw)]: fixes F :: "_ \<Rightarrow> _ \<Rightarrow> _::{complete_linorder, linorder_topology, second_countable_topology}" assumes [simp]: "countable I" assumes [measurable]: "\<And>i. i \<in> I \<Longrightarrow> F i \<in> borel_measurable M" shows "(\<lambda>x. INF i\<in>I. F i x) \<in> borel_measurable M" by (rule borel_measurableI_less) (simp add: INF_less_iff) lemma borel_measurable_cSUP[measurable (raw)]: fixes F :: "_ \<Rightarrow> _ \<Rightarrow> 'a::{conditionally_complete_linorder, linorder_topology, second_countable_topology}" assumes [simp]: "countable I" assumes [measurable]: "\<And>i. i \<in> I \<Longrightarrow> F i \<in> borel_measurable M" assumes bdd: "\<And>x. x \<in> space M \<Longrightarrow> bdd_above ((\<lambda>i. F i x) ` I)" shows "(\<lambda>x. SUP i\<in>I. F i x) \<in> borel_measurable M" proof cases assume "I = {}" then show ?thesis unfolding \<open>I = {}\<close> image_empty by simp next assume "I \<noteq> {}" show ?thesis proof (rule borel_measurableI_le) fix y have "{x \<in> space M. \<forall>i\<in>I. F i x \<le> y} \<in> sets M" by measurable also have "{x \<in> space M. \<forall>i\<in>I. F i x \<le> y} = {x \<in> space M. (SUP i\<in>I. F i x) \<le> y}" by (simp add: cSUP_le_iff \<open>I \<noteq> {}\<close> bdd cong: conj_cong) finally show "{x \<in> space M. (SUP i\<in>I. F i x) \<le> y} \<in> sets M" . qed qed lemma borel_measurable_cINF[measurable (raw)]: fixes F :: "_ \<Rightarrow> _ \<Rightarrow> 'a::{conditionally_complete_linorder, linorder_topology, second_countable_topology}" assumes [simp]: "countable I" assumes [measurable]: "\<And>i. i \<in> I \<Longrightarrow> F i \<in> borel_measurable M" assumes bdd: "\<And>x. x \<in> space M \<Longrightarrow> bdd_below ((\<lambda>i. F i x) ` I)" shows "(\<lambda>x. INF i\<in>I. F i x) \<in> borel_measurable M" proof cases assume "I = {}" then show ?thesis unfolding \<open>I = {}\<close> image_empty by simp next assume "I \<noteq> {}" show ?thesis proof (rule borel_measurableI_ge) fix y have "{x \<in> space M. \<forall>i\<in>I. y \<le> F i x} \<in> sets M" by measurable also have "{x \<in> space M. \<forall>i\<in>I. y \<le> F i x} = {x \<in> space M. y \<le> (INF i\<in>I. F i x)}" by (simp add: le_cINF_iff \<open>I \<noteq> {}\<close> bdd cong: conj_cong) finally show "{x \<in> space M. y \<le> (INF i\<in>I. F i x)} \<in> sets M" . qed qed lemma borel_measurable_lfp[consumes 1, case_names continuity step]: fixes F :: "('a \<Rightarrow> 'b) \<Rightarrow> ('a \<Rightarrow> 'b::{complete_linorder, linorder_topology, second_countable_topology})" assumes "sup_continuous F" assumes *: "\<And>f. f \<in> borel_measurable M \<Longrightarrow> F f \<in> borel_measurable M" shows "lfp F \<in> borel_measurable M" proof - { fix i have "((F ^^ i) bot) \<in> borel_measurable M" by (induct i) (auto intro!: *) } then have "(\<lambda>x. SUP i. (F ^^ i) bot x) \<in> borel_measurable M" by measurable also have "(\<lambda>x. SUP i. (F ^^ i) bot x) = (SUP i. (F ^^ i) bot)" by (auto simp add: image_comp) also have "(SUP i. (F ^^ i) bot) = lfp F" by (rule sup_continuous_lfp[symmetric]) fact finally show ?thesis . qed lemma borel_measurable_gfp[consumes 1, case_names continuity step]: fixes F :: "('a \<Rightarrow> 'b) \<Rightarrow> ('a \<Rightarrow> 'b::{complete_linorder, linorder_topology, second_countable_topology})" assumes "inf_continuous F" assumes *: "\<And>f. f \<in> borel_measurable M \<Longrightarrow> F f \<in> borel_measurable M" shows "gfp F \<in> borel_measurable M" proof - { fix i have "((F ^^ i) top) \<in> borel_measurable M" by (induct i) (auto intro!: * simp: bot_fun_def) } then have "(\<lambda>x. INF i. (F ^^ i) top x) \<in> borel_measurable M" by measurable also have "(\<lambda>x. INF i. (F ^^ i) top x) = (INF i. (F ^^ i) top)" by (auto simp add: image_comp) also have "\<dots> = gfp F" by (rule inf_continuous_gfp[symmetric]) fact finally show ?thesis . qed lemma borel_measurable_max[measurable (raw)]: "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. max (g x) (f x) :: 'b::{second_countable_topology, linorder_topology}) \<in> borel_measurable M" by (rule borel_measurableI_less) simp lemma borel_measurable_min[measurable (raw)]: "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. min (g x) (f x) :: 'b::{second_countable_topology, linorder_topology}) \<in> borel_measurable M" by (rule borel_measurableI_greater) simp lemma borel_measurable_Min[measurable (raw)]: "finite I \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> f i \<in> borel_measurable M) \<Longrightarrow> (\<lambda>x. Min ((\<lambda>i. f i x)`I) :: 'b::{second_countable_topology, linorder_topology}) \<in> borel_measurable M" proof (induct I rule: finite_induct) case (insert i I) then show ?case by (cases "I = {}") auto qed auto lemma borel_measurable_Max[measurable (raw)]: "finite I \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> f i \<in> borel_measurable M) \<Longrightarrow> (\<lambda>x. Max ((\<lambda>i. f i x)`I) :: 'b::{second_countable_topology, linorder_topology}) \<in> borel_measurable M" proof (induct I rule: finite_induct) case (insert i I) then show ?case by (cases "I = {}") auto qed auto lemma borel_measurable_sup[measurable (raw)]: "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. sup (g x) (f x) :: 'b::{lattice, second_countable_topology, linorder_topology}) \<in> borel_measurable M" unfolding sup_max by measurable lemma borel_measurable_inf[measurable (raw)]: "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. inf (g x) (f x) :: 'b::{lattice, second_countable_topology, linorder_topology}) \<in> borel_measurable M" unfolding inf_min by measurable lemma [measurable (raw)]: fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> 'b::{complete_linorder, second_countable_topology, linorder_topology}" assumes "\<And>i. f i \<in> borel_measurable M" shows borel_measurable_liminf: "(\<lambda>x. liminf (\<lambda>i. f i x)) \<in> borel_measurable M" and borel_measurable_limsup: "(\<lambda>x. limsup (\<lambda>i. f i x)) \<in> borel_measurable M" unfolding liminf_SUP_INF limsup_INF_SUP using assms by auto lemma measurable_convergent[measurable (raw)]: fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> 'b::{complete_linorder, second_countable_topology, linorder_topology}" assumes [measurable]: "\<And>i. f i \<in> borel_measurable M" shows "Measurable.pred M (\<lambda>x. convergent (\<lambda>i. f i x))" unfolding convergent_ereal by measurable lemma sets_Collect_convergent[measurable]: fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> 'b::{complete_linorder, second_countable_topology, linorder_topology}" assumes f[measurable]: "\<And>i. f i \<in> borel_measurable M" shows "{x\<in>space M. convergent (\<lambda>i. f i x)} \<in> sets M" by measurable lemma borel_measurable_lim[measurable (raw)]: fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> 'b::{complete_linorder, second_countable_topology, linorder_topology}" assumes [measurable]: "\<And>i. f i \<in> borel_measurable M" shows "(\<lambda>x. lim (\<lambda>i. f i x)) \<in> borel_measurable M" proof - have "\<And>x. lim (\<lambda>i. f i x) = (if convergent (\<lambda>i. f i x) then limsup (\<lambda>i. f i x) else (THE i. False))" by (simp add: lim_def convergent_def convergent_limsup_cl) then show ?thesis by simp qed lemma borel_measurable_LIMSEQ_order: fixes u :: "nat \<Rightarrow> 'a \<Rightarrow> 'b::{complete_linorder, second_countable_topology, linorder_topology}" assumes u': "\<And>x. x \<in> space M \<Longrightarrow> (\<lambda>i. u i x) \<longlonglongrightarrow> u' x" and u: "\<And>i. u i \<in> borel_measurable M" shows "u' \<in> borel_measurable M" proof - have "\<And>x. x \<in> space M \<Longrightarrow> u' x = liminf (\<lambda>n. u n x)" using u' by (simp add: lim_imp_Liminf[symmetric]) with u show ?thesis by (simp cong: measurable_cong) qed subsection \<open>Borel spaces on topological monoids\<close> lemma borel_measurable_add[measurable (raw)]: fixes f g :: "'a \<Rightarrow> 'b::{second_countable_topology, topological_monoid_add}" assumes f: "f \<in> borel_measurable M" assumes g: "g \<in> borel_measurable M" shows "(\<lambda>x. f x + g x) \<in> borel_measurable M" using f g by (rule borel_measurable_continuous_Pair) (intro continuous_intros) lemma borel_measurable_sum[measurable (raw)]: fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> 'b::{second_countable_topology, topological_comm_monoid_add}" assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> borel_measurable M" shows "(\<lambda>x. \<Sum>i\<in>S. f i x) \<in> borel_measurable M" proof cases assume "finite S" thus ?thesis using assms by induct auto qed simp lemma borel_measurable_suminf_order[measurable (raw)]: fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> 'b::{complete_linorder, second_countable_topology, linorder_topology, topological_comm_monoid_add}" assumes f[measurable]: "\<And>i. f i \<in> borel_measurable M" shows "(\<lambda>x. suminf (\<lambda>i. f i x)) \<in> borel_measurable M" unfolding suminf_def sums_def[abs_def] lim_def[symmetric] by simp subsection \<open>Borel spaces on Euclidean spaces\<close> lemma borel_measurable_inner[measurable (raw)]: fixes f g :: "'a \<Rightarrow> 'b::{second_countable_topology, real_inner}" assumes "f \<in> borel_measurable M" assumes "g \<in> borel_measurable M" shows "(\<lambda>x. f x \<bullet> g x) \<in> borel_measurable M" using assms by (rule borel_measurable_continuous_Pair) (intro continuous_intros) notation eucl_less (infix "<e" 50) lemma box_oc: "{x. a <e x \<and> x \<le> b} = {x. a <e x} \<inter> {..b}" and box_co: "{x. a \<le> x \<and> x <e b} = {a..} \<inter> {x. x <e b}" by auto lemma eucl_ivals[measurable]: fixes a b :: "'a::ordered_euclidean_space" shows "{x. x <e a} \<in> sets borel" and "{x. a <e x} \<in> sets borel" and "{..a} \<in> sets borel" and "{a..} \<in> sets borel" and "{a..b} \<in> sets borel" and "{x. a <e x \<and> x \<le> b} \<in> sets borel" and "{x. a \<le> x \<and> x <e b} \<in> sets borel" unfolding box_oc box_co by (auto intro: borel_open borel_closed) lemma fixes i :: "'a::{second_countable_topology, real_inner}" shows hafspace_less_borel: "{x. a < x \<bullet> i} \<in> sets borel" and hafspace_greater_borel: "{x. x \<bullet> i < a} \<in> sets borel" and hafspace_less_eq_borel: "{x. a \<le> x \<bullet> i} \<in> sets borel" and hafspace_greater_eq_borel: "{x. x \<bullet> i \<le> a} \<in> sets borel" by simp_all lemma borel_eq_box: "borel = sigma UNIV (range (\<lambda> (a, b). box a b :: 'a :: euclidean_space set))" (is "_ = ?SIGMA") proof (rule borel_eq_sigmaI1[OF borel_def]) fix M :: "'a set" assume "M \<in> {S. open S}" then have "open M" by simp show "M \<in> ?SIGMA" apply (subst open_UNION_box[OF \<open>open M\<close>]) apply (safe intro!: sets.countable_UN' countable_PiE countable_Collect) apply (auto intro: countable_rat) done qed (auto simp: box_def) lemma halfspace_gt_in_halfspace: assumes i: "i \<in> A" shows "{x::'a. a < x \<bullet> i} \<in> sigma_sets UNIV ((\<lambda> (a, i). {x::'a::euclidean_space. x \<bullet> i < a}) ` (UNIV \<times> A))" (is "?set \<in> ?SIGMA") proof - interpret sigma_algebra UNIV ?SIGMA by (intro sigma_algebra_sigma_sets) simp_all have *: "?set = (\<Union>n. UNIV - {x::'a. x \<bullet> i < a + 1 / real (Suc n)})" proof (safe, simp_all add: not_less del: of_nat_Suc) fix x :: 'a assume "a < x \<bullet> i" with reals_Archimedean[of "x \<bullet> i - a"] obtain n where "a + 1 / real (Suc n) < x \<bullet> i" by (auto simp: field_simps) then show "\<exists>n. a + 1 / real (Suc n) \<le> x \<bullet> i" by (blast intro: less_imp_le) next fix x n have "a < a + 1 / real (Suc n)" by auto also assume "\<dots> \<le> x" finally show "a < x" . qed show "?set \<in> ?SIGMA" unfolding * by (auto intro!: Diff sigma_sets_Inter i) qed lemma borel_eq_halfspace_less: "borel = sigma UNIV ((\<lambda>(a, i). {x::'a::euclidean_space. x \<bullet> i < a}) ` (UNIV \<times> Basis))" (is "_ = ?SIGMA") proof (rule borel_eq_sigmaI2[OF borel_eq_box]) fix a b :: 'a have "box a b = {x\<in>space ?SIGMA. \<forall>i\<in>Basis. a \<bullet> i < x \<bullet> i \<and> x \<bullet> i < b \<bullet> i}" by (auto simp: box_def) also have "\<dots> \<in> sets ?SIGMA" by (intro sets.sets_Collect_conj sets.sets_Collect_finite_All sets.sets_Collect_const) (auto intro!: halfspace_gt_in_halfspace countable_PiE countable_rat) finally show "box a b \<in> sets ?SIGMA" . qed auto lemma borel_eq_halfspace_le: "borel = sigma UNIV ((\<lambda> (a, i). {x::'a::euclidean_space. x \<bullet> i \<le> a}) ` (UNIV \<times> Basis))" (is "_ = ?SIGMA") proof (rule borel_eq_sigmaI2[OF borel_eq_halfspace_less]) fix a :: real and i :: 'a assume "(a, i) \<in> UNIV \<times> Basis" then have i: "i \<in> Basis" by auto have *: "{x::'a. x\<bullet>i < a} = (\<Union>n. {x. x\<bullet>i \<le> a - 1/real (Suc n)})" proof (safe, simp_all del: of_nat_Suc) fix x::'a assume *: "x\<bullet>i < a" with reals_Archimedean[of "a - x\<bullet>i"] obtain n where "x \<bullet> i < a - 1 / (real (Suc n))" by (auto simp: field_simps) then show "\<exists>n. x \<bullet> i \<le> a - 1 / (real (Suc n))" by (blast intro: less_imp_le) next fix x::'a and n assume "x\<bullet>i \<le> a - 1 / real (Suc n)" also have "\<dots> < a" by auto finally show "x\<bullet>i < a" . qed show "{x. x\<bullet>i < a} \<in> ?SIGMA" unfolding * by (intro sets.countable_UN) (auto intro: i) qed auto lemma borel_eq_halfspace_ge: "borel = sigma UNIV ((\<lambda> (a, i). {x::'a::euclidean_space. a \<le> x \<bullet> i}) ` (UNIV \<times> Basis))" (is "_ = ?SIGMA") proof (rule borel_eq_sigmaI2[OF borel_eq_halfspace_less]) fix a :: real and i :: 'a assume i: "(a, i) \<in> UNIV \<times> Basis" have *: "{x::'a. x\<bullet>i < a} = space ?SIGMA - {x::'a. a \<le> x\<bullet>i}" by auto show "{x. x\<bullet>i < a} \<in> ?SIGMA" unfolding * using i by (intro sets.compl_sets) auto qed auto lemma borel_eq_halfspace_greater: "borel = sigma UNIV ((\<lambda> (a, i). {x::'a::euclidean_space. a < x \<bullet> i}) ` (UNIV \<times> Basis))" (is "_ = ?SIGMA") proof (rule borel_eq_sigmaI2[OF borel_eq_halfspace_le]) fix a :: real and i :: 'a assume "(a, i) \<in> (UNIV \<times> Basis)" then have i: "i \<in> Basis" by auto have *: "{x::'a. x\<bullet>i \<le> a} = space ?SIGMA - {x::'a. a < x\<bullet>i}" by auto show "{x. x\<bullet>i \<le> a} \<in> ?SIGMA" unfolding * by (intro sets.compl_sets) (auto intro: i) qed auto lemma borel_eq_atMost: "borel = sigma UNIV (range (\<lambda>a. {..a::'a::ordered_euclidean_space}))" (is "_ = ?SIGMA") proof (rule borel_eq_sigmaI4[OF borel_eq_halfspace_le]) fix a :: real and i :: 'a assume "(a, i) \<in> UNIV \<times> Basis" then have "i \<in> Basis" by auto then have *: "{x::'a. x\<bullet>i \<le> a} = (\<Union>k::nat. {.. (\<Sum>n\<in>Basis. (if n = i then a else real k)*\<^sub>R n)})" proof (safe, simp_all add: eucl_le[where 'a='a] split: if_split_asm) fix x :: 'a obtain k where "Max ((\<bullet>) x ` Basis) \<le> real k" using real_arch_simple by blast then have "\<And>i. i \<in> Basis \<Longrightarrow> x\<bullet>i \<le> real k" by (subst (asm) Max_le_iff) auto then show "\<exists>k::nat. \<forall>ia\<in>Basis. ia \<noteq> i \<longrightarrow> x \<bullet> ia \<le> real k" by (auto intro!: exI[of _ k]) qed show "{x. x\<bullet>i \<le> a} \<in> ?SIGMA" unfolding * by (intro sets.countable_UN) auto qed auto lemma borel_eq_greaterThan: "borel = sigma UNIV (range (\<lambda>a::'a::ordered_euclidean_space. {x. a <e x}))" (is "_ = ?SIGMA") proof (rule borel_eq_sigmaI4[OF borel_eq_halfspace_le]) fix a :: real and i :: 'a assume "(a, i) \<in> UNIV \<times> Basis" then have i: "i \<in> Basis" by auto have "{x::'a. x\<bullet>i \<le> a} = UNIV - {x::'a. a < x\<bullet>i}" by auto also have *: "{x::'a. a < x\<bullet>i} = (\<Union>k::nat. {x. (\<Sum>n\<in>Basis. (if n = i then a else -real k) *\<^sub>R n) <e x})" using i proof (safe, simp_all add: eucl_less_def split: if_split_asm) fix x :: 'a obtain k where k: "Max ((\<bullet>) (- x) ` Basis) < real k" using reals_Archimedean2 by blast { fix i :: 'a assume "i \<in> Basis" then have "-x\<bullet>i < real k" using k by (subst (asm) Max_less_iff) auto then have "- real k < x\<bullet>i" by simp } then show "\<exists>k::nat. \<forall>ia\<in>Basis. ia \<noteq> i \<longrightarrow> -real k < x \<bullet> ia" by (auto intro!: exI[of _ k]) qed finally show "{x. x\<bullet>i \<le> a} \<in> ?SIGMA" apply (simp only:) apply (intro sets.countable_UN sets.Diff) apply (auto intro: sigma_sets_top) done qed auto lemma borel_eq_lessThan: "borel = sigma UNIV (range (\<lambda>a::'a::ordered_euclidean_space. {x. x <e a}))" (is "_ = ?SIGMA") proof (rule borel_eq_sigmaI4[OF borel_eq_halfspace_ge]) fix a :: real and i :: 'a assume "(a, i) \<in> UNIV \<times> Basis" then have i: "i \<in> Basis" by auto have "{x::'a. a \<le> x\<bullet>i} = UNIV - {x::'a. x\<bullet>i < a}" by auto also have *: "{x::'a. x\<bullet>i < a} = (\<Union>k::nat. {x. x <e (\<Sum>n\<in>Basis. (if n = i then a else real k) *\<^sub>R n)})" using \<open>i\<in> Basis\<close> proof (safe, simp_all add: eucl_less_def split: if_split_asm) fix x :: 'a obtain k where k: "Max ((\<bullet>) x ` Basis) < real k" using reals_Archimedean2 by blast { fix i :: 'a assume "i \<in> Basis" then have "x\<bullet>i < real k" using k by (subst (asm) Max_less_iff) auto then have "x\<bullet>i < real k" by simp } then show "\<exists>k::nat. \<forall>ia\<in>Basis. ia \<noteq> i \<longrightarrow> x \<bullet> ia < real k" by (auto intro!: exI[of _ k]) qed finally show "{x. a \<le> x\<bullet>i} \<in> ?SIGMA" apply (simp only:) apply (intro sets.countable_UN sets.Diff) apply (auto intro: sigma_sets_top ) done qed auto lemma borel_eq_atLeastAtMost: "borel = sigma UNIV (range (\<lambda>(a,b). {a..b} ::'a::ordered_euclidean_space set))" (is "_ = ?SIGMA") proof (rule borel_eq_sigmaI5[OF borel_eq_atMost]) fix a::'a have *: "{..a} = (\<Union>n::nat. {- real n *\<^sub>R One .. a})" proof (safe, simp_all add: eucl_le[where 'a='a]) fix x :: 'a obtain k where k: "Max ((\<bullet>) (- x) ` Basis) \<le> real k" using real_arch_simple by blast { fix i :: 'a assume "i \<in> Basis" with k have "- x\<bullet>i \<le> real k" by (subst (asm) Max_le_iff) (auto simp: field_simps) then have "- real k \<le> x\<bullet>i" by simp } then show "\<exists>n::nat. \<forall>i\<in>Basis. - real n \<le> x \<bullet> i" by (auto intro!: exI[of _ k]) qed show "{..a} \<in> ?SIGMA" unfolding * by (intro sets.countable_UN) (auto intro!: sigma_sets_top) qed auto lemma borel_set_induct[consumes 1, case_names empty interval compl union]: assumes "A \<in> sets borel" assumes empty: "P {}" and int: "\<And>a b. a \<le> b \<Longrightarrow> P {a..b}" and compl: "\<And>A. A \<in> sets borel \<Longrightarrow> P A \<Longrightarrow> P (-A)" and un: "\<And>f. disjoint_family f \<Longrightarrow> (\<And>i. f i \<in> sets borel) \<Longrightarrow> (\<And>i. P (f i)) \<Longrightarrow> P (\<Union>i::nat. f i)" shows "P (A::real set)" proof - let ?G = "range (\<lambda>(a,b). {a..b::real})" have "Int_stable ?G" "?G \<subseteq> Pow UNIV" "A \<in> sigma_sets UNIV ?G" using assms(1) by (auto simp add: borel_eq_atLeastAtMost Int_stable_def) thus ?thesis proof (induction rule: sigma_sets_induct_disjoint) case (union f) from union.hyps(2) have "\<And>i. f i \<in> sets borel" by (auto simp: borel_eq_atLeastAtMost) with union show ?case by (auto intro: un) next case (basic A) then obtain a b where "A = {a .. b}" by auto then show ?case by (cases "a \<le> b") (auto intro: int empty) qed (auto intro: empty compl simp: Compl_eq_Diff_UNIV[symmetric] borel_eq_atLeastAtMost) qed lemma borel_sigma_sets_Ioc: "borel = sigma UNIV (range (\<lambda>(a, b). {a <.. b::real}))" proof (rule borel_eq_sigmaI5[OF borel_eq_atMost]) fix i :: real have "{..i} = (\<Union>j::nat. {-j <.. i})" by (auto simp: minus_less_iff reals_Archimedean2) also have "\<dots> \<in> sets (sigma UNIV (range (\<lambda>(i, j). {i<..j})))" by (intro sets.countable_nat_UN) auto finally show "{..i} \<in> sets (sigma UNIV (range (\<lambda>(i, j). {i<..j})))" . qed simp lemma eucl_lessThan: "{x::real. x <e a} = lessThan a" by (simp add: eucl_less_def lessThan_def) lemma borel_eq_atLeastLessThan: "borel = sigma UNIV (range (\<lambda>(a, b). {a ..< b :: real}))" (is "_ = ?SIGMA") proof (rule borel_eq_sigmaI5[OF borel_eq_lessThan]) have move_uminus: "\<And>x y::real. -x \<le> y \<longleftrightarrow> -y \<le> x" by auto fix x :: real have "{..<x} = (\<Union>i::nat. {-real i ..< x})" by (auto simp: move_uminus real_arch_simple) then show "{y. y <e x} \<in> ?SIGMA" by (auto intro: sigma_sets.intros(2-) simp: eucl_lessThan) qed auto lemma borel_measurable_halfspacesI: fixes f :: "'a \<Rightarrow> 'c::euclidean_space" assumes F: "borel = sigma UNIV (F ` (UNIV \<times> Basis))" and S_eq: "\<And>a i. S a i = f -` F (a,i) \<inter> space M" shows "f \<in> borel_measurable M = (\<forall>i\<in>Basis. \<forall>a::real. S a i \<in> sets M)" proof safe fix a :: real and i :: 'b assume i: "i \<in> Basis" and f: "f \<in> borel_measurable M" then show "S a i \<in> sets M" unfolding assms by (auto intro!: measurable_sets simp: assms(1)) next assume a: "\<forall>i\<in>Basis. \<forall>a. S a i \<in> sets M" then show "f \<in> borel_measurable M" by (auto intro!: measurable_measure_of simp: S_eq F) qed lemma borel_measurable_iff_halfspace_le: fixes f :: "'a \<Rightarrow> 'c::euclidean_space" shows "f \<in> borel_measurable M = (\<forall>i\<in>Basis. \<forall>a. {w \<in> space M. f w \<bullet> i \<le> a} \<in> sets M)" by (rule borel_measurable_halfspacesI[OF borel_eq_halfspace_le]) auto lemma borel_measurable_iff_halfspace_less: fixes f :: "'a \<Rightarrow> 'c::euclidean_space" shows "f \<in> borel_measurable M \<longleftrightarrow> (\<forall>i\<in>Basis. \<forall>a. {w \<in> space M. f w \<bullet> i < a} \<in> sets M)" by (rule borel_measurable_halfspacesI[OF borel_eq_halfspace_less]) auto lemma borel_measurable_iff_halfspace_ge: fixes f :: "'a \<Rightarrow> 'c::euclidean_space" shows "f \<in> borel_measurable M = (\<forall>i\<in>Basis. \<forall>a. {w \<in> space M. a \<le> f w \<bullet> i} \<in> sets M)" by (rule borel_measurable_halfspacesI[OF borel_eq_halfspace_ge]) auto lemma borel_measurable_iff_halfspace_greater: fixes f :: "'a \<Rightarrow> 'c::euclidean_space" shows "f \<in> borel_measurable M \<longleftrightarrow> (\<forall>i\<in>Basis. \<forall>a. {w \<in> space M. a < f w \<bullet> i} \<in> sets M)" by (rule borel_measurable_halfspacesI[OF borel_eq_halfspace_greater]) auto lemma borel_measurable_iff_le: "(f::'a \<Rightarrow> real) \<in> borel_measurable M = (\<forall>a. {w \<in> space M. f w \<le> a} \<in> sets M)" using borel_measurable_iff_halfspace_le[where 'c=real] by simp lemma borel_measurable_iff_less: "(f::'a \<Rightarrow> real) \<in> borel_measurable M = (\<forall>a. {w \<in> space M. f w < a} \<in> sets M)" using borel_measurable_iff_halfspace_less[where 'c=real] by simp lemma borel_measurable_iff_ge: "(f::'a \<Rightarrow> real) \<in> borel_measurable M = (\<forall>a. {w \<in> space M. a \<le> f w} \<in> sets M)" using borel_measurable_iff_halfspace_ge[where 'c=real] by simp lemma borel_measurable_iff_greater: "(f::'a \<Rightarrow> real) \<in> borel_measurable M = (\<forall>a. {w \<in> space M. a < f w} \<in> sets M)" using borel_measurable_iff_halfspace_greater[where 'c=real] by simp lemma borel_measurable_euclidean_space: fixes f :: "'a \<Rightarrow> 'c::euclidean_space" shows "f \<in> borel_measurable M \<longleftrightarrow> (\<forall>i\<in>Basis. (\<lambda>x. f x \<bullet> i) \<in> borel_measurable M)" proof safe assume f: "\<forall>i\<in>Basis. (\<lambda>x. f x \<bullet> i) \<in> borel_measurable M" then show "f \<in> borel_measurable M" by (subst borel_measurable_iff_halfspace_le) auto qed auto subsection "Borel measurable operators" lemma borel_measurable_norm[measurable]: "norm \<in> borel_measurable borel" by (intro borel_measurable_continuous_onI continuous_intros) lemma borel_measurable_sgn [measurable]: "(sgn::'a::real_normed_vector \<Rightarrow> 'a) \<in> borel_measurable borel" by (rule borel_measurable_continuous_countable_exceptions[where X="{0}"]) (auto intro!: continuous_on_sgn continuous_on_id) lemma borel_measurable_uminus[measurable (raw)]: fixes g :: "'a \<Rightarrow> 'b::{second_countable_topology, real_normed_vector}" assumes g: "g \<in> borel_measurable M" shows "(\<lambda>x. - g x) \<in> borel_measurable M" by (rule borel_measurable_continuous_on[OF _ g]) (intro continuous_intros) lemma borel_measurable_diff[measurable (raw)]: fixes f :: "'a \<Rightarrow> 'b::{second_countable_topology, real_normed_vector}" assumes f: "f \<in> borel_measurable M" assumes g: "g \<in> borel_measurable M" shows "(\<lambda>x. f x - g x) \<in> borel_measurable M" using borel_measurable_add [of f M "- g"] assms by (simp add: fun_Compl_def) lemma borel_measurable_times[measurable (raw)]: fixes f :: "'a \<Rightarrow> 'b::{second_countable_topology, real_normed_algebra}" assumes f: "f \<in> borel_measurable M" assumes g: "g \<in> borel_measurable M" shows "(\<lambda>x. f x * g x) \<in> borel_measurable M" using f g by (rule borel_measurable_continuous_Pair) (intro continuous_intros) lemma borel_measurable_prod[measurable (raw)]: fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> 'b::{second_countable_topology, real_normed_field}" assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> borel_measurable M" shows "(\<lambda>x. \<Prod>i\<in>S. f i x) \<in> borel_measurable M" proof cases assume "finite S" thus ?thesis using assms by induct auto qed simp lemma borel_measurable_dist[measurable (raw)]: fixes g f :: "'a \<Rightarrow> 'b::{second_countable_topology, metric_space}" assumes f: "f \<in> borel_measurable M" assumes g: "g \<in> borel_measurable M" shows "(\<lambda>x. dist (f x) (g x)) \<in> borel_measurable M" using f g by (rule borel_measurable_continuous_Pair) (intro continuous_intros) lemma borel_measurable_scaleR[measurable (raw)]: fixes g :: "'a \<Rightarrow> 'b::{second_countable_topology, real_normed_vector}" assumes f: "f \<in> borel_measurable M" assumes g: "g \<in> borel_measurable M" shows "(\<lambda>x. f x *\<^sub>R g x) \<in> borel_measurable M" using f g by (rule borel_measurable_continuous_Pair) (intro continuous_intros) lemma borel_measurable_uminus_eq [simp]: fixes f :: "'a \<Rightarrow> 'b::{second_countable_topology, real_normed_vector}" shows "(\<lambda>x. - f x) \<in> borel_measurable M \<longleftrightarrow> f \<in> borel_measurable M" (is "?l = ?r") proof assume ?l from borel_measurable_uminus[OF this] show ?r by simp qed auto lemma affine_borel_measurable_vector: fixes f :: "'a \<Rightarrow> 'x::real_normed_vector" assumes "f \<in> borel_measurable M" shows "(\<lambda>x. a + b *\<^sub>R f x) \<in> borel_measurable M" proof (rule borel_measurableI) fix S :: "'x set" assume "open S" show "(\<lambda>x. a + b *\<^sub>R f x) -` S \<inter> space M \<in> sets M" proof cases assume "b \<noteq> 0" with \<open>open S\<close> have "open ((\<lambda>x. (- a + x) /\<^sub>R b) ` S)" (is "open ?S") using open_affinity [of S "inverse b" "- a /\<^sub>R b"] by (auto simp: algebra_simps) hence "?S \<in> sets borel" by auto moreover from \<open>b \<noteq> 0\<close> have "(\<lambda>x. a + b *\<^sub>R f x) -` S = f -` ?S" apply auto by (rule_tac x="a + b *\<^sub>R f x" in image_eqI, simp_all) ultimately show ?thesis using assms unfolding in_borel_measurable_borel by auto qed simp qed lemma borel_measurable_const_scaleR[measurable (raw)]: "f \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. b *\<^sub>R f x ::'a::real_normed_vector) \<in> borel_measurable M" using affine_borel_measurable_vector[of f M 0 b] by simp lemma borel_measurable_const_add[measurable (raw)]: "f \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. a + f x ::'a::real_normed_vector) \<in> borel_measurable M" using affine_borel_measurable_vector[of f M a 1] by simp lemma borel_measurable_inverse[measurable (raw)]: fixes f :: "'a \<Rightarrow> 'b::real_normed_div_algebra" assumes f: "f \<in> borel_measurable M" shows "(\<lambda>x. inverse (f x)) \<in> borel_measurable M" apply (rule measurable_compose[OF f]) apply (rule borel_measurable_continuous_countable_exceptions[of "{0}"]) apply (auto intro!: continuous_on_inverse continuous_on_id) done lemma borel_measurable_divide[measurable (raw)]: "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. f x / g x::'b::{second_countable_topology, real_normed_div_algebra}) \<in> borel_measurable M" by (simp add: divide_inverse) lemma borel_measurable_abs[measurable (raw)]: "f \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. \<bar>f x :: real\<bar>) \<in> borel_measurable M" unfolding abs_real_def by simp lemma borel_measurable_nth[measurable (raw)]: "(\<lambda>x::real^'n. x $ i) \<in> borel_measurable borel" by (simp add: cart_eq_inner_axis) lemma convex_measurable: fixes A :: "'a :: euclidean_space set" shows "X \<in> borel_measurable M \<Longrightarrow> X ` space M \<subseteq> A \<Longrightarrow> open A \<Longrightarrow> convex_on A q \<Longrightarrow> (\<lambda>x. q (X x)) \<in> borel_measurable M" by (rule measurable_compose[where f=X and N="restrict_space borel A"]) (auto intro!: borel_measurable_continuous_on_restrict convex_on_continuous measurable_restrict_space2) lemma borel_measurable_ln[measurable (raw)]: assumes f: "f \<in> borel_measurable M" shows "(\<lambda>x. ln (f x :: real)) \<in> borel_measurable M" apply (rule measurable_compose[OF f]) apply (rule borel_measurable_continuous_countable_exceptions[of "{0}"]) apply (auto intro!: continuous_on_ln continuous_on_id) done lemma borel_measurable_log[measurable (raw)]: "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. log (g x) (f x)) \<in> borel_measurable M" unfolding log_def by auto lemma borel_measurable_exp[measurable]: "(exp::'a::{real_normed_field,banach}\<Rightarrow>'a) \<in> borel_measurable borel" by (intro borel_measurable_continuous_onI continuous_at_imp_continuous_on ballI isCont_exp) lemma measurable_real_floor[measurable]: "(floor :: real \<Rightarrow> int) \<in> measurable borel (count_space UNIV)" proof - have "\<And>a x. \<lfloor>x\<rfloor> = a \<longleftrightarrow> (real_of_int a \<le> x \<and> x < real_of_int (a + 1))" by (auto intro: floor_eq2) then show ?thesis by (auto simp: vimage_def measurable_count_space_eq2_countable) qed lemma measurable_real_ceiling[measurable]: "(ceiling :: real \<Rightarrow> int) \<in> measurable borel (count_space UNIV)" unfolding ceiling_def[abs_def] by simp lemma borel_measurable_real_floor: "(\<lambda>x::real. real_of_int \<lfloor>x\<rfloor>) \<in> borel_measurable borel" by simp lemma borel_measurable_root [measurable]: "root n \<in> borel_measurable borel" by (intro borel_measurable_continuous_onI continuous_intros) lemma borel_measurable_sqrt [measurable]: "sqrt \<in> borel_measurable borel" by (intro borel_measurable_continuous_onI continuous_intros) lemma borel_measurable_power [measurable (raw)]: fixes f :: "_ \<Rightarrow> 'b::{power,real_normed_algebra}" assumes f: "f \<in> borel_measurable M" shows "(\<lambda>x. (f x) ^ n) \<in> borel_measurable M" by (intro borel_measurable_continuous_on [OF _ f] continuous_intros) lemma borel_measurable_Re [measurable]: "Re \<in> borel_measurable borel" by (intro borel_measurable_continuous_onI continuous_intros) lemma borel_measurable_Im [measurable]: "Im \<in> borel_measurable borel" by (intro borel_measurable_continuous_onI continuous_intros) lemma borel_measurable_of_real [measurable]: "(of_real :: _ \<Rightarrow> (_::real_normed_algebra)) \<in> borel_measurable borel" by (intro borel_measurable_continuous_onI continuous_intros) lemma borel_measurable_sin [measurable]: "(sin :: _ \<Rightarrow> (_::{real_normed_field,banach})) \<in> borel_measurable borel" by (intro borel_measurable_continuous_onI continuous_intros) lemma borel_measurable_cos [measurable]: "(cos :: _ \<Rightarrow> (_::{real_normed_field,banach})) \<in> borel_measurable borel" by (intro borel_measurable_continuous_onI continuous_intros) lemma borel_measurable_arctan [measurable]: "arctan \<in> borel_measurable borel" by (intro borel_measurable_continuous_onI continuous_intros) lemma\<^marker>\<open>tag important\<close> borel_measurable_complex_iff: "f \<in> borel_measurable M \<longleftrightarrow> (\<lambda>x. Re (f x)) \<in> borel_measurable M \<and> (\<lambda>x. Im (f x)) \<in> borel_measurable M" apply auto apply (subst fun_complex_eq) apply (intro borel_measurable_add) apply auto done lemma powr_real_measurable [measurable]: assumes "f \<in> measurable M borel" "g \<in> measurable M borel" shows "(\<lambda>x. f x powr g x :: real) \<in> measurable M borel" using assms by (simp_all add: powr_def) lemma measurable_of_bool[measurable]: "of_bool \<in> count_space UNIV \<rightarrow>\<^sub>M borel" by simp subsection "Borel space on the extended reals" lemma borel_measurable_ereal[measurable (raw)]: assumes f: "f \<in> borel_measurable M" shows "(\<lambda>x. ereal (f x)) \<in> borel_measurable M" using continuous_on_ereal f by (rule borel_measurable_continuous_on) (rule continuous_on_id) lemma borel_measurable_real_of_ereal[measurable (raw)]: fixes f :: "'a \<Rightarrow> ereal" assumes f: "f \<in> borel_measurable M" shows "(\<lambda>x. real_of_ereal (f x)) \<in> borel_measurable M" apply (rule measurable_compose[OF f]) apply (rule borel_measurable_continuous_countable_exceptions[of "{\<infinity>, -\<infinity> }"]) apply (auto intro: continuous_on_real simp: Compl_eq_Diff_UNIV) done lemma borel_measurable_ereal_cases: fixes f :: "'a \<Rightarrow> ereal" assumes f: "f \<in> borel_measurable M" assumes H: "(\<lambda>x. H (ereal (real_of_ereal (f x)))) \<in> borel_measurable M" shows "(\<lambda>x. H (f x)) \<in> borel_measurable M" proof - let ?F = "\<lambda>x. if f x = \<infinity> then H \<infinity> else if f x = - \<infinity> then H (-\<infinity>) else H (ereal (real_of_ereal (f x)))" { fix x have "H (f x) = ?F x" by (cases "f x") auto } with f H show ?thesis by simp qed lemma fixes f :: "'a \<Rightarrow> ereal" assumes f[measurable]: "f \<in> borel_measurable M" shows borel_measurable_ereal_abs[measurable(raw)]: "(\<lambda>x. \<bar>f x\<bar>) \<in> borel_measurable M" and borel_measurable_ereal_inverse[measurable(raw)]: "(\<lambda>x. inverse (f x) :: ereal) \<in> borel_measurable M" and borel_measurable_uminus_ereal[measurable(raw)]: "(\<lambda>x. - f x :: ereal) \<in> borel_measurable M" by (auto simp del: abs_real_of_ereal simp: borel_measurable_ereal_cases[OF f] measurable_If) lemma borel_measurable_uminus_eq_ereal[simp]: "(\<lambda>x. - f x :: ereal) \<in> borel_measurable M \<longleftrightarrow> f \<in> borel_measurable M" (is "?l = ?r") proof assume ?l from borel_measurable_uminus_ereal[OF this] show ?r by simp qed auto lemma set_Collect_ereal2: fixes f g :: "'a \<Rightarrow> ereal" assumes f: "f \<in> borel_measurable M" assumes g: "g \<in> borel_measurable M" assumes H: "{x \<in> space M. H (ereal (real_of_ereal (f x))) (ereal (real_of_ereal (g x)))} \<in> sets M" "{x \<in> space borel. H (-\<infinity>) (ereal x)} \<in> sets borel" "{x \<in> space borel. H (\<infinity>) (ereal x)} \<in> sets borel" "{x \<in> space borel. H (ereal x) (-\<infinity>)} \<in> sets borel" "{x \<in> space borel. H (ereal x) (\<infinity>)} \<in> sets borel" shows "{x \<in> space M. H (f x) (g x)} \<in> sets M" proof - let ?G = "\<lambda>y x. if g x = \<infinity> then H y \<infinity> else if g x = -\<infinity> then H y (-\<infinity>) else H y (ereal (real_of_ereal (g x)))" let ?F = "\<lambda>x. if f x = \<infinity> then ?G \<infinity> x else if f x = -\<infinity> then ?G (-\<infinity>) x else ?G (ereal (real_of_ereal (f x))) x" { fix x have "H (f x) (g x) = ?F x" by (cases "f x" "g x" rule: ereal2_cases) auto } note * = this from assms show ?thesis by (subst *) (simp del: space_borel split del: if_split) qed lemma borel_measurable_ereal_iff: shows "(\<lambda>x. ereal (f x)) \<in> borel_measurable M \<longleftrightarrow> f \<in> borel_measurable M" proof assume "(\<lambda>x. ereal (f x)) \<in> borel_measurable M" from borel_measurable_real_of_ereal[OF this] show "f \<in> borel_measurable M" by auto qed auto lemma borel_measurable_erealD[measurable_dest]: "(\<lambda>x. ereal (f x)) \<in> borel_measurable M \<Longrightarrow> g \<in> measurable N M \<Longrightarrow> (\<lambda>x. f (g x)) \<in> borel_measurable N" unfolding borel_measurable_ereal_iff by simp theorem borel_measurable_ereal_iff_real: fixes f :: "'a \<Rightarrow> ereal" shows "f \<in> borel_measurable M \<longleftrightarrow> ((\<lambda>x. real_of_ereal (f x)) \<in> borel_measurable M \<and> f -` {\<infinity>} \<inter> space M \<in> sets M \<and> f -` {-\<infinity>} \<inter> space M \<in> sets M)" proof safe assume *: "(\<lambda>x. real_of_ereal (f x)) \<in> borel_measurable M" "f -` {\<infinity>} \<inter> space M \<in> sets M" "f -` {-\<infinity>} \<inter> space M \<in> sets M" have "f -` {\<infinity>} \<inter> space M = {x\<in>space M. f x = \<infinity>}" "f -` {-\<infinity>} \<inter> space M = {x\<in>space M. f x = -\<infinity>}" by auto with * have **: "{x\<in>space M. f x = \<infinity>} \<in> sets M" "{x\<in>space M. f x = -\<infinity>} \<in> sets M" by simp_all let ?f = "\<lambda>x. if f x = \<infinity> then \<infinity> else if f x = -\<infinity> then -\<infinity> else ereal (real_of_ereal (f x))" have "?f \<in> borel_measurable M" using * ** by (intro measurable_If) auto also have "?f = f" by (auto simp: fun_eq_iff ereal_real) finally show "f \<in> borel_measurable M" . qed simp_all lemma borel_measurable_ereal_iff_Iio: "(f::'a \<Rightarrow> ereal) \<in> borel_measurable M \<longleftrightarrow> (\<forall>a. f -` {..< a} \<inter> space M \<in> sets M)" by (auto simp: borel_Iio measurable_iff_measure_of) lemma borel_measurable_ereal_iff_Ioi: "(f::'a \<Rightarrow> ereal) \<in> borel_measurable M \<longleftrightarrow> (\<forall>a. f -` {a <..} \<inter> space M \<in> sets M)" by (auto simp: borel_Ioi measurable_iff_measure_of) lemma vimage_sets_compl_iff: "f -` A \<inter> space M \<in> sets M \<longleftrightarrow> f -` (- A) \<inter> space M \<in> sets M" proof - { fix A assume "f -` A \<inter> space M \<in> sets M" moreover have "f -` (- A) \<inter> space M = space M - f -` A \<inter> space M" by auto ultimately have "f -` (- A) \<inter> space M \<in> sets M" by auto } from this[of A] this[of "-A"] show ?thesis by (metis double_complement) qed lemma borel_measurable_iff_Iic_ereal: "(f::'a\<Rightarrow>ereal) \<in> borel_measurable M \<longleftrightarrow> (\<forall>a. f -` {..a} \<inter> space M \<in> sets M)" unfolding borel_measurable_ereal_iff_Ioi vimage_sets_compl_iff[where A="{a <..}" for a] by simp lemma borel_measurable_iff_Ici_ereal: "(f::'a \<Rightarrow> ereal) \<in> borel_measurable M \<longleftrightarrow> (\<forall>a. f -` {a..} \<inter> space M \<in> sets M)" unfolding borel_measurable_ereal_iff_Iio vimage_sets_compl_iff[where A="{..< a}" for a] by simp lemma borel_measurable_ereal2: fixes f g :: "'a \<Rightarrow> ereal" assumes f: "f \<in> borel_measurable M" assumes g: "g \<in> borel_measurable M" assumes H: "(\<lambda>x. H (ereal (real_of_ereal (f x))) (ereal (real_of_ereal (g x)))) \<in> borel_measurable M" "(\<lambda>x. H (-\<infinity>) (ereal (real_of_ereal (g x)))) \<in> borel_measurable M" "(\<lambda>x. H (\<infinity>) (ereal (real_of_ereal (g x)))) \<in> borel_measurable M" "(\<lambda>x. H (ereal (real_of_ereal (f x))) (-\<infinity>)) \<in> borel_measurable M" "(\<lambda>x. H (ereal (real_of_ereal (f x))) (\<infinity>)) \<in> borel_measurable M" shows "(\<lambda>x. H (f x) (g x)) \<in> borel_measurable M" proof - let ?G = "\<lambda>y x. if g x = \<infinity> then H y \<infinity> else if g x = - \<infinity> then H y (-\<infinity>) else H y (ereal (real_of_ereal (g x)))" let ?F = "\<lambda>x. if f x = \<infinity> then ?G \<infinity> x else if f x = - \<infinity> then ?G (-\<infinity>) x else ?G (ereal (real_of_ereal (f x))) x" { fix x have "H (f x) (g x) = ?F x" by (cases "f x" "g x" rule: ereal2_cases) auto } note * = this from assms show ?thesis unfolding * by simp qed lemma [measurable(raw)]: fixes f :: "'a \<Rightarrow> ereal" assumes [measurable]: "f \<in> borel_measurable M" "g \<in> borel_measurable M" shows borel_measurable_ereal_add: "(\<lambda>x. f x + g x) \<in> borel_measurable M" and borel_measurable_ereal_times: "(\<lambda>x. f x * g x) \<in> borel_measurable M" by (simp_all add: borel_measurable_ereal2) lemma [measurable(raw)]: fixes f g :: "'a \<Rightarrow> ereal" assumes "f \<in> borel_measurable M" assumes "g \<in> borel_measurable M" shows borel_measurable_ereal_diff: "(\<lambda>x. f x - g x) \<in> borel_measurable M" and borel_measurable_ereal_divide: "(\<lambda>x. f x / g x) \<in> borel_measurable M" using assms by (simp_all add: minus_ereal_def divide_ereal_def) lemma borel_measurable_ereal_sum[measurable (raw)]: fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> ereal" assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> borel_measurable M" shows "(\<lambda>x. \<Sum>i\<in>S. f i x) \<in> borel_measurable M" using assms by (induction S rule: infinite_finite_induct) auto lemma borel_measurable_ereal_prod[measurable (raw)]: fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> ereal" assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> borel_measurable M" shows "(\<lambda>x. \<Prod>i\<in>S. f i x) \<in> borel_measurable M" using assms by (induction S rule: infinite_finite_induct) auto lemma borel_measurable_extreal_suminf[measurable (raw)]: fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> ereal" assumes [measurable]: "\<And>i. f i \<in> borel_measurable M" shows "(\<lambda>x. (\<Sum>i. f i x)) \<in> borel_measurable M" unfolding suminf_def sums_def[abs_def] lim_def[symmetric] by simp subsection "Borel space on the extended non-negative reals" text \<open> \<^type>\<open>ennreal\<close> is a topological monoid, so no rules for plus are required, also all order statements are usually done on type classes. \<close> lemma measurable_enn2ereal[measurable]: "enn2ereal \<in> borel \<rightarrow>\<^sub>M borel" by (intro borel_measurable_continuous_onI continuous_on_enn2ereal) lemma measurable_e2ennreal[measurable]: "e2ennreal \<in> borel \<rightarrow>\<^sub>M borel" by (intro borel_measurable_continuous_onI continuous_on_e2ennreal) lemma borel_measurable_enn2real[measurable (raw)]: "f \<in> M \<rightarrow>\<^sub>M borel \<Longrightarrow> (\<lambda>x. enn2real (f x)) \<in> M \<rightarrow>\<^sub>M borel" unfolding enn2real_def[abs_def] by measurable definition\<^marker>\<open>tag important\<close> [simp]: "is_borel f M \<longleftrightarrow> f \<in> borel_measurable M" lemma is_borel_transfer[transfer_rule]: "rel_fun (rel_fun (=) pcr_ennreal) (=) is_borel is_borel" unfolding is_borel_def[abs_def] proof (safe intro!: rel_funI ext dest!: rel_fun_eq_pcr_ennreal[THEN iffD1]) fix f and M :: "'a measure" show "f \<in> borel_measurable M" if f: "enn2ereal \<circ> f \<in> borel_measurable M" using measurable_compose[OF f measurable_e2ennreal] by simp qed simp context includes ennreal.lifting begin lemma measurable_ennreal[measurable]: "ennreal \<in> borel \<rightarrow>\<^sub>M borel" unfolding is_borel_def[symmetric] by transfer simp lemma borel_measurable_ennreal_iff[simp]: assumes [simp]: "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> f x" shows "(\<lambda>x. ennreal (f x)) \<in> M \<rightarrow>\<^sub>M borel \<longleftrightarrow> f \<in> M \<rightarrow>\<^sub>M borel" proof safe assume "(\<lambda>x. ennreal (f x)) \<in> M \<rightarrow>\<^sub>M borel" then have "(\<lambda>x. enn2real (ennreal (f x))) \<in> M \<rightarrow>\<^sub>M borel" by measurable then show "f \<in> M \<rightarrow>\<^sub>M borel" by (rule measurable_cong[THEN iffD1, rotated]) auto qed measurable lemma borel_measurable_times_ennreal[measurable (raw)]: fixes f g :: "'a \<Rightarrow> ennreal" shows "f \<in> M \<rightarrow>\<^sub>M borel \<Longrightarrow> g \<in> M \<rightarrow>\<^sub>M borel \<Longrightarrow> (\<lambda>x. f x * g x) \<in> M \<rightarrow>\<^sub>M borel" unfolding is_borel_def[symmetric] by transfer simp lemma borel_measurable_inverse_ennreal[measurable (raw)]: fixes f :: "'a \<Rightarrow> ennreal" shows "f \<in> M \<rightarrow>\<^sub>M borel \<Longrightarrow> (\<lambda>x. inverse (f x)) \<in> M \<rightarrow>\<^sub>M borel" unfolding is_borel_def[symmetric] by transfer simp lemma borel_measurable_divide_ennreal[measurable (raw)]: fixes f :: "'a \<Rightarrow> ennreal" shows "f \<in> M \<rightarrow>\<^sub>M borel \<Longrightarrow> g \<in> M \<rightarrow>\<^sub>M borel \<Longrightarrow> (\<lambda>x. f x / g x) \<in> M \<rightarrow>\<^sub>M borel" unfolding divide_ennreal_def by simp lemma borel_measurable_minus_ennreal[measurable (raw)]: fixes f :: "'a \<Rightarrow> ennreal" shows "f \<in> M \<rightarrow>\<^sub>M borel \<Longrightarrow> g \<in> M \<rightarrow>\<^sub>M borel \<Longrightarrow> (\<lambda>x. f x - g x) \<in> M \<rightarrow>\<^sub>M borel" unfolding is_borel_def[symmetric] by transfer simp lemma borel_measurable_power_ennreal [measurable (raw)]: fixes f :: "_ \<Rightarrow> ennreal" assumes f: "f \<in> borel_measurable M" shows "(\<lambda>x. (f x) ^ n) \<in> borel_measurable M" by (induction n) (use f in auto) lemma borel_measurable_prod_ennreal[measurable (raw)]: fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> ennreal" assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> borel_measurable M" shows "(\<lambda>x. \<Prod>i\<in>S. f i x) \<in> borel_measurable M" using assms by (induction S rule: infinite_finite_induct) auto end hide_const (open) is_borel subsection \<open>LIMSEQ is borel measurable\<close> lemma borel_measurable_LIMSEQ_real: fixes u :: "nat \<Rightarrow> 'a \<Rightarrow> real" assumes u': "\<And>x. x \<in> space M \<Longrightarrow> (\<lambda>i. u i x) \<longlonglongrightarrow> u' x" and u: "\<And>i. u i \<in> borel_measurable M" shows "u' \<in> borel_measurable M" proof - have "\<And>x. x \<in> space M \<Longrightarrow> liminf (\<lambda>n. ereal (u n x)) = ereal (u' x)" using u' by (simp add: lim_imp_Liminf) moreover from u have "(\<lambda>x. liminf (\<lambda>n. ereal (u n x))) \<in> borel_measurable M" by auto ultimately show ?thesis by (simp cong: measurable_cong add: borel_measurable_ereal_iff) qed lemma borel_measurable_LIMSEQ_metric: fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> 'b :: metric_space" assumes [measurable]: "\<And>i. f i \<in> borel_measurable M" assumes lim: "\<And>x. x \<in> space M \<Longrightarrow> (\<lambda>i. f i x) \<longlonglongrightarrow> g x" shows "g \<in> borel_measurable M" unfolding borel_eq_closed proof (safe intro!: measurable_measure_of) fix A :: "'b set" assume "closed A" have [measurable]: "(\<lambda>x. infdist (g x) A) \<in> borel_measurable M" proof (rule borel_measurable_LIMSEQ_real) show "\<And>x. x \<in> space M \<Longrightarrow> (\<lambda>i. infdist (f i x) A) \<longlonglongrightarrow> infdist (g x) A" by (intro tendsto_infdist lim) show "\<And>i. (\<lambda>x. infdist (f i x) A) \<in> borel_measurable M" by (intro borel_measurable_continuous_on[where f="\<lambda>x. infdist x A"] continuous_at_imp_continuous_on ballI continuous_infdist continuous_ident) auto qed show "g -` A \<inter> space M \<in> sets M" proof cases assume "A \<noteq> {}" then have "\<And>x. infdist x A = 0 \<longleftrightarrow> x \<in> A" using \<open>closed A\<close> by (simp add: in_closed_iff_infdist_zero) then have "g -` A \<inter> space M = {x\<in>space M. infdist (g x) A = 0}" by auto also have "\<dots> \<in> sets M" by measurable finally show ?thesis . qed simp qed auto lemma sets_Collect_Cauchy[measurable]: fixes f :: "nat \<Rightarrow> 'a => 'b::{metric_space, second_countable_topology}" assumes f[measurable]: "\<And>i. f i \<in> borel_measurable M" shows "{x\<in>space M. Cauchy (\<lambda>i. f i x)} \<in> sets M" unfolding metric_Cauchy_iff2 using f by auto lemma borel_measurable_lim_metric[measurable (raw)]: fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> 'b::{banach, second_countable_topology}" assumes f[measurable]: "\<And>i. f i \<in> borel_measurable M" shows "(\<lambda>x. lim (\<lambda>i. f i x)) \<in> borel_measurable M" proof - define u' where "u' x = lim (\<lambda>i. if Cauchy (\<lambda>i. f i x) then f i x else 0)" for x then have *: "\<And>x. lim (\<lambda>i. f i x) = (if Cauchy (\<lambda>i. f i x) then u' x else (THE x. False))" by (auto simp: lim_def convergent_eq_Cauchy[symmetric]) have "u' \<in> borel_measurable M" proof (rule borel_measurable_LIMSEQ_metric) fix x have "convergent (\<lambda>i. if Cauchy (\<lambda>i. f i x) then f i x else 0)" by (cases "Cauchy (\<lambda>i. f i x)") (auto simp add: convergent_eq_Cauchy[symmetric] convergent_def) then show "(\<lambda>i. if Cauchy (\<lambda>i. f i x) then f i x else 0) \<longlonglongrightarrow> u' x" unfolding u'_def by (rule convergent_LIMSEQ_iff[THEN iffD1]) qed measurable then show ?thesis unfolding * by measurable qed lemma borel_measurable_suminf[measurable (raw)]: fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> 'b::{banach, second_countable_topology}" assumes f[measurable]: "\<And>i. f i \<in> borel_measurable M" shows "(\<lambda>x. suminf (\<lambda>i. f i x)) \<in> borel_measurable M" unfolding suminf_def sums_def[abs_def] lim_def[symmetric] by simp lemma Collect_closed_imp_pred_borel: "closed {x. P x} \<Longrightarrow> Measurable.pred borel P" by (simp add: pred_def) (* Proof by Jeremy Avigad and Luke Serafin *) lemma isCont_borel_pred[measurable]: fixes f :: "'b::metric_space \<Rightarrow> 'a::metric_space" shows "Measurable.pred borel (isCont f)" proof (subst measurable_cong) let ?I = "\<lambda>j. inverse(real (Suc j))" show "isCont f x = (\<forall>i. \<exists>j. \<forall>y z. dist x y < ?I j \<and> dist x z < ?I j \<longrightarrow> dist (f y) (f z) \<le> ?I i)" for x unfolding continuous_at_eps_delta proof safe fix i assume "\<forall>e>0. \<exists>d>0. \<forall>y. dist y x < d \<longrightarrow> dist (f y) (f x) < e" moreover have "0 < ?I i / 2" by simp ultimately obtain d where d: "0 < d" "\<And>y. dist x y < d \<Longrightarrow> dist (f y) (f x) < ?I i / 2" by (metis dist_commute) then obtain j where j: "?I j < d" by (metis reals_Archimedean) show "\<exists>j. \<forall>y z. dist x y < ?I j \<and> dist x z < ?I j \<longrightarrow> dist (f y) (f z) \<le> ?I i" proof (safe intro!: exI[where x=j]) fix y z assume *: "dist x y < ?I j" "dist x z < ?I j" have "dist (f y) (f z) \<le> dist (f y) (f x) + dist (f z) (f x)" by (rule dist_triangle2) also have "\<dots> < ?I i / 2 + ?I i / 2" by (intro add_strict_mono d less_trans[OF _ j] *) also have "\<dots> \<le> ?I i" by (simp add: field_simps) finally show "dist (f y) (f z) \<le> ?I i" by simp qed next fix e::real assume "0 < e" then obtain n where n: "?I n < e" by (metis reals_Archimedean) assume "\<forall>i. \<exists>j. \<forall>y z. dist x y < ?I j \<and> dist x z < ?I j \<longrightarrow> dist (f y) (f z) \<le> ?I i" from this[THEN spec, of "Suc n"] obtain j where j: "\<And>y z. dist x y < ?I j \<Longrightarrow> dist x z < ?I j \<Longrightarrow> dist (f y) (f z) \<le> ?I (Suc n)" by auto show "\<exists>d>0. \<forall>y. dist y x < d \<longrightarrow> dist (f y) (f x) < e" proof (safe intro!: exI[of _ "?I j"]) fix y assume "dist y x < ?I j" then have "dist (f y) (f x) \<le> ?I (Suc n)" by (intro j) (auto simp: dist_commute) also have "?I (Suc n) < ?I n" by simp also note n finally show "dist (f y) (f x) < e" . qed simp qed qed (intro pred_intros_countable closed_Collect_all closed_Collect_le open_Collect_less Collect_closed_imp_pred_borel closed_Collect_imp open_Collect_conj continuous_intros) lemma isCont_borel: fixes f :: "'b::metric_space \<Rightarrow> 'a::metric_space" shows "{x. isCont f x} \<in> sets borel" by simp lemma is_real_interval: assumes S: "is_interval S" shows "\<exists>a b::real. S = {} \<or> S = UNIV \<or> S = {..<b} \<or> S = {..b} \<or> S = {a<..} \<or> S = {a..} \<or> S = {a<..<b} \<or> S = {a<..b} \<or> S = {a..<b} \<or> S = {a..b}" using S unfolding is_interval_1 by (blast intro: interval_cases) lemma real_interval_borel_measurable: assumes "is_interval (S::real set)" shows "S \<in> sets borel" proof - from assms is_real_interval have "\<exists>a b::real. S = {} \<or> S = UNIV \<or> S = {..<b} \<or> S = {..b} \<or> S = {a<..} \<or> S = {a..} \<or> S = {a<..<b} \<or> S = {a<..b} \<or> S = {a..<b} \<or> S = {a..b}" by auto then show ?thesis by auto qed text \<open>The next lemmas hold in any second countable linorder (including ennreal or ereal for instance), but in the current state they are restricted to reals.\<close> lemma borel_measurable_mono_on_fnc: fixes f :: "real \<Rightarrow> real" and A :: "real set" assumes "mono_on A f" shows "f \<in> borel_measurable (restrict_space borel A)" apply (rule measurable_restrict_countable[OF mono_on_ctble_discont[OF assms]]) apply (auto intro!: image_eqI[where x="{x}" for x] simp: sets_restrict_space) apply (auto simp add: sets_restrict_restrict_space continuous_on_eq_continuous_within cong: measurable_cong_sets intro!: borel_measurable_continuous_on_restrict intro: continuous_within_subset) done lemma borel_measurable_piecewise_mono: fixes f::"real \<Rightarrow> real" and C::"real set set" assumes "countable C" "\<And>c. c \<in> C \<Longrightarrow> c \<in> sets borel" "\<And>c. c \<in> C \<Longrightarrow> mono_on c f" "(\<Union>C) = UNIV" shows "f \<in> borel_measurable borel" by (rule measurable_piecewise_restrict[of C], auto intro: borel_measurable_mono_on_fnc simp: assms) lemma borel_measurable_mono: fixes f :: "real \<Rightarrow> real" shows "mono f \<Longrightarrow> f \<in> borel_measurable borel" using borel_measurable_mono_on_fnc[of UNIV f] by (simp add: mono_def mono_on_def) lemma measurable_bdd_below_real[measurable (raw)]: fixes F :: "'a \<Rightarrow> 'i \<Rightarrow> real" assumes [simp]: "countable I" and [measurable]: "\<And>i. i \<in> I \<Longrightarrow> F i \<in> M \<rightarrow>\<^sub>M borel" shows "Measurable.pred M (\<lambda>x. bdd_below ((\<lambda>i. F i x)`I))" proof (subst measurable_cong) show "bdd_below ((\<lambda>i. F i x)`I) \<longleftrightarrow> (\<exists>q\<in>\<int>. \<forall>i\<in>I. q \<le> F i x)" for x by (auto simp: bdd_below_def intro!: bexI[of _ "of_int (floor _)"] intro: order_trans of_int_floor_le) show "Measurable.pred M (\<lambda>w. \<exists>q\<in>\<int>. \<forall>i\<in>I. q \<le> F i w)" using countable_int by measurable qed lemma borel_measurable_cINF_real[measurable (raw)]: fixes F :: "_ \<Rightarrow> _ \<Rightarrow> real" assumes [simp]: "countable I" assumes F[measurable]: "\<And>i. i \<in> I \<Longrightarrow> F i \<in> borel_measurable M" shows "(\<lambda>x. INF i\<in>I. F i x) \<in> borel_measurable M" proof (rule measurable_piecewise_restrict) let ?\<Omega> = "{x\<in>space M. bdd_below ((\<lambda>i. F i x)`I)}" show "countable {?\<Omega>, - ?\<Omega>}" "space M \<subseteq> \<Union>{?\<Omega>, - ?\<Omega>}" "\<And>X. X \<in> {?\<Omega>, - ?\<Omega>} \<Longrightarrow> X \<inter> space M \<in> sets M" by auto fix X assume "X \<in> {?\<Omega>, - ?\<Omega>}" then show "(\<lambda>x. INF i\<in>I. F i x) \<in> borel_measurable (restrict_space M X)" proof safe show "(\<lambda>x. INF i\<in>I. F i x) \<in> borel_measurable (restrict_space M ?\<Omega>)" by (intro borel_measurable_cINF measurable_restrict_space1 F) (auto simp: space_restrict_space) show "(\<lambda>x. INF i\<in>I. F i x) \<in> borel_measurable (restrict_space M (-?\<Omega>))" proof (subst measurable_cong) fix x assume "x \<in> space (restrict_space M (-?\<Omega>))" then have "\<not> (\<forall>i\<in>I. - F i x \<le> y)" for y by (auto simp: space_restrict_space bdd_above_def bdd_above_uminus[symmetric]) then show "(INF i\<in>I. F i x) = - (THE x. False)" by (auto simp: space_restrict_space Inf_real_def Sup_real_def Least_def simp del: Set.ball_simps(10)) qed simp qed qed lemma borel_Ici: "borel = sigma UNIV (range (\<lambda>x::real. {x ..}))" proof (safe intro!: borel_eq_sigmaI1[OF borel_Iio]) fix x :: real have eq: "{..<x} = space (sigma UNIV (range atLeast)) - {x ..}" by auto show "{..<x} \<in> sets (sigma UNIV (range atLeast))" unfolding eq by (intro sets.compl_sets) auto qed auto lemma borel_measurable_pred_less[measurable (raw)]: fixes f :: "'a \<Rightarrow> 'b::{second_countable_topology, linorder_topology}" shows "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> Measurable.pred M (\<lambda>w. f w < g w)" unfolding Measurable.pred_def by (rule borel_measurable_less) no_notation eucl_less (infix "<e" 50) lemma borel_measurable_Max2[measurable (raw)]: fixes f::"_ \<Rightarrow> _ \<Rightarrow> 'a::{second_countable_topology, dense_linorder, linorder_topology}" assumes "finite I" and [measurable]: "\<And>i. f i \<in> borel_measurable M" shows "(\<lambda>x. Max{f i x |i. i \<in> I}) \<in> borel_measurable M" by (simp add: borel_measurable_Max[OF assms(1), where ?f=f and ?M=M] Setcompr_eq_image) lemma measurable_compose_n [measurable (raw)]: assumes "T \<in> measurable M M" shows "(T^^n) \<in> measurable M M" by (induction n, auto simp add: measurable_compose[OF _ assms]) lemma measurable_real_imp_nat: fixes f::"'a \<Rightarrow> nat" assumes [measurable]: "(\<lambda>x. real(f x)) \<in> borel_measurable M" shows "f \<in> measurable M (count_space UNIV)" proof - let ?g = "(\<lambda>x. real(f x))" have "\<And>(n::nat). ?g-`({real n}) \<inter> space M = f-`{n} \<inter> space M" by auto moreover have "\<And>(n::nat). ?g-`({real n}) \<inter> space M \<in> sets M" using assms by measurable ultimately have "\<And>(n::nat). f-`{n} \<inter> space M \<in> sets M" by simp then show ?thesis using measurable_count_space_eq2_countable by blast qed lemma measurable_equality_set [measurable]: fixes f g::"_\<Rightarrow> 'a::{second_countable_topology, t2_space}" assumes [measurable]: "f \<in> borel_measurable M" "g \<in> borel_measurable M" shows "{x \<in> space M. f x = g x} \<in> sets M" proof - define A where "A = {x \<in> space M. f x = g x}" define B where "B = {y. \<exists>x::'a. y = (x,x)}" have "A = (\<lambda>x. (f x, g x))-`B \<inter> space M" unfolding A_def B_def by auto moreover have "(\<lambda>x. (f x, g x)) \<in> borel_measurable M" by simp moreover have "B \<in> sets borel" unfolding B_def by (simp add: closed_diagonal) ultimately have "A \<in> sets M" by simp then show ?thesis unfolding A_def by simp qed lemma measurable_inequality_set [measurable]: fixes f g::"_ \<Rightarrow> 'a::{second_countable_topology, linorder_topology}" assumes [measurable]: "f \<in> borel_measurable M" "g \<in> borel_measurable M" shows "{x \<in> space M. f x \<le> g x} \<in> sets M" "{x \<in> space M. f x < g x} \<in> sets M" "{x \<in> space M. f x \<ge> g x} \<in> sets M" "{x \<in> space M. f x > g x} \<in> sets M" proof - define F where "F = (\<lambda>x. (f x, g x))" have * [measurable]: "F \<in> borel_measurable M" unfolding F_def by simp have "{x \<in> space M. f x \<le> g x} = F-`{(x, y) | x y. x \<le> y} \<inter> space M" unfolding F_def by auto moreover have "{(x, y) | x y. x \<le> (y::'a)} \<in> sets borel" using closed_subdiagonal borel_closed by blast ultimately show "{x \<in> space M. f x \<le> g x} \<in> sets M" using * by (metis (mono_tags, lifting) measurable_sets) have "{x \<in> space M. f x < g x} = F-`{(x, y) | x y. x < y} \<inter> space M" unfolding F_def by auto moreover have "{(x, y) | x y. x < (y::'a)} \<in> sets borel" using open_subdiagonal borel_open by blast ultimately show "{x \<in> space M. f x < g x} \<in> sets M" using * by (metis (mono_tags, lifting) measurable_sets) have "{x \<in> space M. f x \<ge> g x} = F-`{(x, y) | x y. x \<ge> y} \<inter> space M" unfolding F_def by auto moreover have "{(x, y) | x y. x \<ge> (y::'a)} \<in> sets borel" using closed_superdiagonal borel_closed by blast ultimately show "{x \<in> space M. f x \<ge> g x} \<in> sets M" using * by (metis (mono_tags, lifting) measurable_sets) have "{x \<in> space M. f x > g x} = F-`{(x, y) | x y. x > y} \<inter> space M" unfolding F_def by auto moreover have "{(x, y) | x y. x > (y::'a)} \<in> sets borel" using open_superdiagonal borel_open by blast ultimately show "{x \<in> space M. f x > g x} \<in> sets M" using * by (metis (mono_tags, lifting) measurable_sets) qed proposition measurable_limit [measurable]: fixes f::"nat \<Rightarrow> 'a \<Rightarrow> 'b::first_countable_topology" assumes [measurable]: "\<And>n::nat. f n \<in> borel_measurable M" shows "Measurable.pred M (\<lambda>x. (\<lambda>n. f n x) \<longlonglongrightarrow> c)" proof - obtain A :: "nat \<Rightarrow> 'b set" where A: "\<And>i. open (A i)" "\<And>i. c \<in> A i" "\<And>S. open S \<Longrightarrow> c \<in> S \<Longrightarrow> eventually (\<lambda>i. A i \<subseteq> S) sequentially" by (rule countable_basis_at_decseq) blast have [measurable]: "\<And>N i. (f N)-`(A i) \<inter> space M \<in> sets M" using A(1) by auto then have mes: "(\<Inter>i. \<Union>n. \<Inter>N\<in>{n..}. (f N)-`(A i) \<inter> space M) \<in> sets M" by blast have "(u \<longlonglongrightarrow> c) \<longleftrightarrow> (\<forall>i. eventually (\<lambda>n. u n \<in> A i) sequentially)" for u::"nat \<Rightarrow> 'b" proof assume "u \<longlonglongrightarrow> c" then have "eventually (\<lambda>n. u n \<in> A i) sequentially" for i using A(1)[of i] A(2)[of i] by (simp add: topological_tendstoD) then show "(\<forall>i. eventually (\<lambda>n. u n \<in> A i) sequentially)" by auto next assume H: "(\<forall>i. eventually (\<lambda>n. u n \<in> A i) sequentially)" show "(u \<longlonglongrightarrow> c)" proof (rule topological_tendstoI) fix S assume "open S" "c \<in> S" with A(3)[OF this] obtain i where "A i \<subseteq> S" using eventually_False_sequentially eventually_mono by blast moreover have "eventually (\<lambda>n. u n \<in> A i) sequentially" using H by simp ultimately show "\<forall>\<^sub>F n in sequentially. u n \<in> S" by (simp add: eventually_mono subset_eq) qed qed then have "{x. (\<lambda>n. f n x) \<longlonglongrightarrow> c} = (\<Inter>i. \<Union>n. \<Inter>N\<in>{n..}. (f N)-`(A i))" by (auto simp add: atLeast_def eventually_at_top_linorder) then have "{x \<in> space M. (\<lambda>n. f n x) \<longlonglongrightarrow> c} = (\<Inter>i. \<Union>n. \<Inter>N\<in>{n..}. (f N)-`(A i) \<inter> space M)" by auto then have "{x \<in> space M. (\<lambda>n. f n x) \<longlonglongrightarrow> c} \<in> sets M" using mes by simp then show ?thesis by auto qed lemma measurable_limit2 [measurable]: fixes u::"nat \<Rightarrow> 'a \<Rightarrow> real" assumes [measurable]: "\<And>n. u n \<in> borel_measurable M" "v \<in> borel_measurable M" shows "Measurable.pred M (\<lambda>x. (\<lambda>n. u n x) \<longlonglongrightarrow> v x)" proof - define w where "w = (\<lambda>n x. u n x - v x)" have [measurable]: "w n \<in> borel_measurable M" for n unfolding w_def by auto have "((\<lambda>n. u n x) \<longlonglongrightarrow> v x) \<longleftrightarrow> ((\<lambda>n. w n x) \<longlonglongrightarrow> 0)" for x unfolding w_def using Lim_null by auto then show ?thesis using measurable_limit by auto qed lemma measurable_P_restriction [measurable (raw)]: assumes [measurable]: "Measurable.pred M P" "A \<in> sets M" shows "{x \<in> A. P x} \<in> sets M" proof - have "A \<subseteq> space M" using sets.sets_into_space[OF assms(2)]. then have "{x \<in> A. P x} = A \<inter> {x \<in> space M. P x}" by blast then show ?thesis by auto qed lemma measurable_sum_nat [measurable (raw)]: fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> nat" assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> measurable M (count_space UNIV)" shows "(\<lambda>x. \<Sum>i\<in>S. f i x) \<in> measurable M (count_space UNIV)" proof cases assume "finite S" then show ?thesis using assms by induct auto qed simp lemma measurable_abs_powr [measurable]: fixes p::real assumes [measurable]: "f \<in> borel_measurable M" shows "(\<lambda>x. \<bar>f x\<bar> powr p) \<in> borel_measurable M" by simp text \<open>The next one is a variation around \<open>measurable_restrict_space\<close>.\<close> lemma measurable_restrict_space3: assumes "f \<in> measurable M N" and "f \<in> A \<rightarrow> B" shows "f \<in> measurable (restrict_space M A) (restrict_space N B)" proof - have "f \<in> measurable (restrict_space M A) N" using assms(1) measurable_restrict_space1 by auto then show ?thesis by (metis Int_iff funcsetI funcset_mem measurable_restrict_space2[of f, of "restrict_space M A", of B, of N] assms(2) space_restrict_space) qed lemma measurable_restrict_mono: assumes f: "f \<in> restrict_space M A \<rightarrow>\<^sub>M N" and "B \<subseteq> A" shows "f \<in> restrict_space M B \<rightarrow>\<^sub>M N" by (rule measurable_compose[OF measurable_restrict_space3 f]) (insert \<open>B \<subseteq> A\<close>, auto) text \<open>The next one is a variation around \<open>measurable_piecewise_restrict\<close>.\<close> lemma measurable_piecewise_restrict2: assumes [measurable]: "\<And>n. A n \<in> sets M" and "space M = (\<Union>(n::nat). A n)" "\<And>n. \<exists>h \<in> measurable M N. (\<forall>x \<in> A n. f x = h x)" shows "f \<in> measurable M N" proof (rule measurableI) fix B assume [measurable]: "B \<in> sets N" { fix n::nat obtain h where [measurable]: "h \<in> measurable M N" and "\<forall>x \<in> A n. f x = h x" using assms(3) by blast then have *: "f-`B \<inter> A n = h-`B \<inter> A n" by auto have "h-`B \<inter> A n = h-`B \<inter> space M \<inter> A n" using assms(2) sets.sets_into_space by auto then have "h-`B \<inter> A n \<in> sets M" by simp then have "f-`B \<inter> A n \<in> sets M" using * by simp } then have "(\<Union>n. f-`B \<inter> A n) \<in> sets M" by measurable moreover have "f-`B \<inter> space M = (\<Union>n. f-`B \<inter> A n)" using assms(2) by blast ultimately show "f-`B \<inter> space M \<in> sets M" by simp next fix x assume "x \<in> space M" then obtain n where "x \<in> A n" using assms(2) by blast obtain h where [measurable]: "h \<in> measurable M N" and "\<forall>x \<in> A n. f x = h x" using assms(3) by blast then have "f x = h x" using \<open>x \<in> A n\<close> by blast moreover have "h x \<in> space N" by (metis measurable_space \<open>x \<in> space M\<close> \<open>h \<in> measurable M N\<close>) ultimately show "f x \<in> space N" by simp qed end
##plots=group ##showplots ##Layer=vector ##Value=field Layer boxplot(Layer[[Value]], col="red", main="Cajas y Bigotes")
(* * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230) * * SPDX-License-Identifier: GPL-2.0-only *) theory AutoCorresModifiesProofs imports "L4VerifiedLinks" "CLib.SIMPL_Lemmas" begin text \<open> Generate modifies specs, i.e. specifications of which globals fields may potentially be modified by each function. It turns out that ac_corres is not strong enough to automagically transfer C-parser's modifies theorems across to the AutoCorres functions. This is because the modifies specs are unconditional, whereas our ac_corres theorems have preconditions on the initial states. In other words, the modifies spec is a syntactic property of a function rather than a semantic one. Fortunately, this also makes it straightforward to prove them from scratch over our newly-generated functions. \<close> section \<open>Rules for modifies proof method\<close> text \<open> Transferring modifies rules for un-translated functions. These functions are defined to be equivalent to their SIMPL specs (via L1_call_simpl), so the limitations of ac_corres do not apply. \<close> lemma autocorres_modifies_transfer: notes select_wp[wp] hoare_seq_ext[wp] fixes \<Gamma> globals f' f_'proc modifies_eqn P xf assumes f'_def: "f' \<equiv> AC_call_L1 P globals xf (L1_call_simpl check_termination \<Gamma> f_'proc)" assumes f_modifies: "\<forall>\<sigma>. \<Gamma>\<turnstile>\<^bsub>/UNIV\<^esub> {\<sigma>} Call f_'proc {t. modifies_eqn (globals t) (globals \<sigma>)}" shows "\<lbrace> \<lambda>s. s = \<sigma> \<rbrace> f' \<lbrace> \<lambda>_ s. modifies_eqn s \<sigma> \<rbrace>" apply (clarsimp simp: f'_def AC_call_L1_def L2_call_L1_def L1_call_simpl_def) apply (simp add: liftM_def bind_assoc) apply wpsimp apply (clarsimp simp: in_monad select_def split: xstate.splits) by (case_tac xa; clarsimp dest!: exec_normal[OF singletonI _ f_modifies[rule_format]]) text \<open> A monadic Hoare triple for a modifies spec looks like "\<lbrace>\<lambda>s. s = \<sigma>\<rbrace> prog \<lbrace>\<lambda>s. \<exists>x1 x2... s = \<sigma>\<lparr>field1 := x1, ...\<rparr>\<rbrace>" where (fieldk, xk) are the possibly-modified fields. To prove it, we rewrite the precondition to an invariant: \<lbrace>\<lambda>s. \<exists>x1 x2... s = \<sigma>\<lparr>field1 := x1, ...\<rparr> \<rbrace> prog \<lbrace>\<lambda>_ s. \<exists>x1 x2... s = \<sigma>\<lparr>field1 := x1, ...\<rparr> \<rbrace> Then we carry the invariant through each statement of the program. \<close> text \<open> Adapter for apply rules to an invariant goal. We allow "I" and "I'" to be different (in our modifies proof, "I" will have \<exists>-quantified vars lifted out). \<close> lemma valid_inv_weaken: "\<lbrakk> valid P f (\<lambda>_. R); \<And>s. I s \<Longrightarrow> P s; \<And>s. R s \<Longrightarrow> I' s \<rbrakk> \<Longrightarrow> valid I f (\<lambda>_. I')" by (fastforce simp: valid_def) text \<open> Our function modifies rules have a schematic precond, so this rule avoids weakening the invariant when applying those rules and ending up with an underspecified P. \<close> lemma valid_inv_weaken': "\<lbrakk> valid I f (\<lambda>_. Q); \<And>s. Q s \<Longrightarrow> I' s \<rbrakk> \<Longrightarrow> valid I f (\<lambda>_. I')" by (rule valid_inv_weaken) text \<open> Used by modifies_initial_tac to instantiate a schematic precondition to an invariant. \<close> lemma valid_invI: "valid I f (\<lambda>_. I) \<Longrightarrow> valid I f (\<lambda>_. I)" by - text \<open>For rewriting foralls in premises.\<close> lemma All_to_all: "Trueprop (\<forall>x. P x) \<equiv> (\<And>x. P x)" by presburger subsection \<open>Hoare rules for state invariants\<close> named_theorems valid_inv lemmas [valid_inv] = fail_inv gets_inv return_inv hoare_K_bind lemma when_inv[valid_inv]: "\<lbrace>I\<rbrace> f \<lbrace>\<lambda>_. I\<rbrace> \<Longrightarrow> \<lbrace>I\<rbrace> when c f \<lbrace>\<lambda>_. I\<rbrace>" apply wp apply auto done lemma bind_inv[valid_inv]: "\<lbrace>I\<rbrace> f \<lbrace>\<lambda>_. I\<rbrace> \<Longrightarrow> (\<And>x. \<lbrace>I\<rbrace> g x \<lbrace>\<lambda>_. I\<rbrace>) \<Longrightarrow> \<lbrace>I\<rbrace> f >>= g \<lbrace>\<lambda>_. I\<rbrace>" apply (wp; assumption) done lemma guard_inv[valid_inv]: "\<lbrace>I\<rbrace> guard G \<lbrace>\<lambda>_. I\<rbrace>" by (fastforce simp: valid_def) lemma modify_inv[valid_inv]: "(\<And>s. I s \<Longrightarrow> I (f s)) \<Longrightarrow> \<lbrace>I\<rbrace> modify f \<lbrace>\<lambda>_. I\<rbrace>" apply wp by simp lemma skip_inv[valid_inv]: "\<lbrace>I\<rbrace> skip \<lbrace>\<lambda>_. I\<rbrace>" by (rule skip_wp) lemma select_inv[valid_inv]: "\<lbrace>I\<rbrace> select f \<lbrace>\<lambda>_. I\<rbrace>" by (rule hoare_weaken_pre, rule select_wp, blast) lemma condition_inv[valid_inv]: "\<lbrace>I\<rbrace> t \<lbrace>\<lambda>_. I\<rbrace> \<Longrightarrow> \<lbrace>I\<rbrace> f \<lbrace>\<lambda>_. I\<rbrace> \<Longrightarrow> \<lbrace>I\<rbrace> condition c t f\<lbrace>\<lambda>_. I\<rbrace>" apply (rule hoare_weaken_pre) apply (rule condition_wp) apply auto done lemma whileLoop_inv[valid_inv]: "\<lbrakk>\<And>r. \<lbrace>I\<rbrace> b r \<lbrace>\<lambda>_. I\<rbrace> \<rbrakk> \<Longrightarrow> \<lbrace>I\<rbrace> whileLoop c b r \<lbrace>\<lambda>_. I\<rbrace>" apply (rule whileLoop_wp) apply (blast intro: hoare_weaken_pre) apply assumption done lemma valid_case_prod_inv[valid_inv]: "(\<And>x y. \<lbrace>I\<rbrace> f x y \<lbrace>\<lambda>_. I\<rbrace>) \<Longrightarrow> \<lbrace>I\<rbrace> case v of (x, y) \<Rightarrow> f x y \<lbrace>\<lambda>_. I\<rbrace>" apply wp apply auto done lemma unknown_inv[valid_inv]: "\<lbrace>I\<rbrace> unknown \<lbrace>\<lambda>_. I\<rbrace>" apply (unfold unknown_def) apply (rule select_inv) done lemma throwError_inv[valid_inv]: "\<lbrace>I\<rbrace> throwError e \<lbrace>\<lambda>_. I\<rbrace>" by wp lemma catch_inv[valid_inv]: "\<lbrakk> \<lbrace>I\<rbrace> f \<lbrace>\<lambda>_. I\<rbrace>; \<And>e. \<lbrace>I\<rbrace> h e \<lbrace>\<lambda>_. I\<rbrace> \<rbrakk> \<Longrightarrow> \<lbrace>I\<rbrace> catch f h \<lbrace>\<lambda>_. I\<rbrace>" apply wpsimp apply assumption apply (simp add: validE_def) by assumption lemma whileLoopE_inv[valid_inv]: "(\<And>r. \<lbrace>I\<rbrace> b r \<lbrace>\<lambda>_. I\<rbrace>) \<Longrightarrow> \<lbrace>I\<rbrace> whileLoopE c b r \<lbrace>\<lambda>_. I\<rbrace>" apply (unfold whileLoopE_def) apply (rule whileLoop_inv) apply (auto simp: lift_def split: sum.splits intro: throwError_inv) done lemma bindE_inv[valid_inv]: "\<lbrakk> \<lbrace>I\<rbrace> f \<lbrace>\<lambda>_. I\<rbrace>; \<And>x. \<lbrace>I\<rbrace> g x \<lbrace>\<lambda>_. I\<rbrace> \<rbrakk> \<Longrightarrow> \<lbrace>I\<rbrace> f >>=E g \<lbrace>\<lambda>_. I\<rbrace>" apply (unfold bindE_def) apply (rule bind_inv) apply (auto simp: lift_def split: sum.splits intro: throwError_inv) done lemma returnOk_inv[valid_inv]: "\<lbrace>I\<rbrace> returnOk x \<lbrace>\<lambda>_. I\<rbrace>" apply (simp add: returnOk_def) done lemma liftE_inv[valid_inv]: "\<lbrace>I\<rbrace> f \<lbrace>\<lambda>_. I\<rbrace> \<Longrightarrow> \<lbrace>I\<rbrace> liftE f \<lbrace>\<lambda>_. I\<rbrace>" by wp lemma getsE_inv[valid_inv]: "\<lbrace>I\<rbrace> getsE f \<lbrace>\<lambda>r. I\<rbrace>" apply (unfold getsE_def) apply (blast intro: liftE_inv gets_inv) done lemma skipE_inv[valid_inv]: "\<lbrace>I\<rbrace> skipE \<lbrace>\<lambda>r. I\<rbrace>" apply (unfold skipE_def) apply (blast intro: liftE_inv returnOk_inv) done lemma modifyE_inv[valid_inv]: "(\<And>s. I s \<Longrightarrow> I (f s)) \<Longrightarrow> \<lbrace>I\<rbrace> modifyE f \<lbrace>\<lambda>_. I\<rbrace>" apply (unfold modifyE_def) apply (blast intro: liftE_inv modify_inv) done lemma guardE_inv[valid_inv]: "\<lbrace>I\<rbrace> guardE G \<lbrace>\<lambda>_. I\<rbrace>" apply (unfold guardE_def) apply (blast intro: liftE_inv guard_inv) done lemma whenE_inv[valid_inv]: "\<lbrace>I\<rbrace> f \<lbrace>\<lambda>_. I\<rbrace> \<Longrightarrow> \<lbrace>I\<rbrace> whenE c f \<lbrace>\<lambda>_. I\<rbrace>" apply (unfold whenE_def) apply (auto intro: returnOk_inv) done lemma unless_inv[valid_inv]: "\<lbrace>I\<rbrace> f \<lbrace>\<lambda>_. I\<rbrace> \<Longrightarrow> \<lbrace>I\<rbrace> unless c f \<lbrace>\<lambda>_. I\<rbrace>" apply (unfold unless_def) by (rule when_inv) lemma unlessE_inv[valid_inv]: "\<lbrace>I\<rbrace> f \<lbrace>\<lambda>_. I\<rbrace> \<Longrightarrow> \<lbrace>I\<rbrace> unlessE c f \<lbrace>\<lambda>_. I\<rbrace>" apply (unfold unlessE_def) by (auto intro: returnOk_inv) lemma handleE'_inv[valid_inv]: "\<lbrakk> \<lbrace>I\<rbrace> f \<lbrace>\<lambda>_. I\<rbrace>; \<And>e. \<lbrace>I\<rbrace> h e \<lbrace>\<lambda>_. I\<rbrace> \<rbrakk> \<Longrightarrow> \<lbrace>I\<rbrace> handleE' f h \<lbrace>\<lambda>_. I\<rbrace>" by (fastforce simp: handleE'_def intro: return_inv bind_inv split: sum.splits) lemma handleE_inv[valid_inv]: "\<lbrakk> \<lbrace>I\<rbrace> f \<lbrace>\<lambda>_. I\<rbrace>; \<And>e. \<lbrace>I\<rbrace> h e \<lbrace>\<lambda>_. I\<rbrace> \<rbrakk> \<Longrightarrow> \<lbrace>I\<rbrace> handleE f h \<lbrace>\<lambda>_. I\<rbrace>" apply (unfold handleE_def) by (rule handleE'_inv) text \<open>@{term measure_call} appears in AutoCorres-generated calls to recursive functions.\<close> lemma measure_call_inv[valid_inv]: "\<lbrakk>\<And>m. \<lbrace>I\<rbrace> f m \<lbrace>\<lambda>_. I\<rbrace>\<rbrakk> \<Longrightarrow> \<lbrace>I\<rbrace> measure_call f \<lbrace>\<lambda>_. I\<rbrace>" by (fastforce simp: measure_call_def valid_def) text \<open> Recursion base case for AutoCorres-generated specs. NB: we don't make this valid_inv because it conflicts with bind_inv. Instead we apply it manually. \<close> lemma modifies_recursive_0: "\<lbrace>I\<rbrace> do guard (\<lambda>_. (0 :: nat) < 0); f od \<lbrace>\<lambda>_. I\<rbrace>" by simp text \<open>These rules are currently sufficient for all the kernel code.\<close> thm valid_inv section \<open>Modifies proof procedure\<close> text \<open> The most important assumptions are currently: - skip_heap_abs is set; we don't deal with lifted_globals - all functions are translated to the nondet_monad - we assume a specific format of modifies rule from the C-parser (see comment for gen_modifies_prop) - function_name_prefix="" and function_name_suffix="'" as per default (FIXME: get these from function_info once it's been fixed) The top-level procedure gets all kernel functions in topological order, then does the modifies proofs for each function (or recursive function group). The "scope" option should be supported (TODO: but not yet tested) and in that case the C-parser modifies rules will be transferred directly. \<close> ML \<open> structure AutoCorresModifiesProofs = struct (* Translate a term, top-down, stopping once a conversion has been applied. * trans is an assoc-list of terms to translate. * Bound vars in trans are interpreted relative to outside t. *) fun translate_term trans t = case assoc (trans, t) of SOME t' => t' | NONE => case t of f $ x => translate_term trans f $ translate_term trans x | Abs (v, vT, b) => Abs (v, vT, translate_term (map (apply2 (incr_boundvars 1)) trans) b) | _ => t; (* Remove "Hoare.meq" and "Hoare.mex" scaffolding from SIMPL modifies specs *) fun modifies_simp ctxt = Conv.fconv_rule (Raw_Simplifier.rewrite ctxt true @{thms meq_def[THEN eq_reflection] mex_def[THEN eq_reflection]}); fun modifies_simp_term ctxt = Raw_Simplifier.rewrite_term (Proof_Context.theory_of ctxt) @{thms meq_def[THEN eq_reflection] mex_def[THEN eq_reflection]} []; (* Translate c-parser's "modifies" specs of the form * \<forall>\<sigma>. \<Gamma>\<turnstile>\<^bsub>/UNIV\<^esub> {\<sigma>} Call f_'proc {t. mex x1... meq (globals t) ((globals s)\<lparr>f1 := x1...\<rparr>)} * to specs on the AutoCorres-generated monad * \<lbrace>\<lambda>s. s = \<sigma>\<rbrace> f' \<lbrace>\<lambda>_ s. \<exists>x1... \<sigma> = s\<lparr>f1 := x1...\<rparr>\<rbrace> * * This involves: * - talking about the "globals" state instead of "globals myvars" * - removing "meq" and "mex" which are unnecessary for our proof method * and have buggy syntax translations * - using the monadic hoare predicate * * Returns tuple of (state var, function arg vars, measure var, prop). * The returned vars are Free in the prop; the measure var is NONE for non-recursive functions. *) fun gen_modifies_prop ctxt (fn_info: FunctionInfo.function_info Symtab.table) (prog_info: ProgramInfo.prog_info) f_name c_prop = let val f_info = the (Symtab.lookup fn_info f_name); val globals_type = #globals_type prog_info; val globals_term = #globals_getter prog_info; val ac_ret_type = #return_type f_info; val state0_var = Free ("\<sigma>", globals_type); val @{term_pat "Trueprop (\<forall>\<sigma>. _\<turnstile>\<^bsub>/UNIV\<^esub> {\<sigma>} Call ?f_'proc {t. ?c_modifies_eqn})"} = c_prop; (* Bound 0 = s, Bound 1 = \<sigma> in c_prop *) val modifies_eqn = c_modifies_eqn |> translate_term [(globals_term $ Bound 0, Bound 0), (globals_term $ Bound 1, state0_var)]; val modifies_postcond = Abs (Name.uu_, ac_ret_type, Abs ("s", globals_type, modifies_eqn)) |> modifies_simp_term ctxt; val arg_vars = map Free (#args f_info); val measure_var = if FunctionInfo.is_function_recursive f_info (* will not clash with arg_vars as C identifiers do not contain primes *) then SOME (Free ("measure'", @{typ nat})) else NONE; val f_const = #const f_info val f_call = betapplys (f_const, (case measure_var of SOME v => [v] | NONE => []) @ arg_vars); val modifies_prop = @{mk_term "Trueprop (\<lbrace>\<lambda>s. s = ?state\<rbrace> ?call \<lbrace>?postcond\<rbrace>)" (state, call, postcond)} (state0_var, f_call, modifies_postcond); in (state0_var, arg_vars, measure_var, modifies_prop) end; (* Solve invariant goals of the form * \<And>s. (\<exists>x1 x2... s = \<sigma>\<lparr>field1 := x1, field2 := x2, ...\<rparr>) \<Longrightarrow> * (\<exists>x1 x2... f s = \<sigma>\<lparr>field1 := x1, field2 := x2, ...\<rparr>) * where f is some update function (usually id, but for modify statements * it is the modifying function). * We assume that s is all-quantified and \<sigma> is free. *) fun modifies_invariant_tac quiet_fail ctxt n st = if Thm.nprems_of st = 0 then no_tac st else let val globals_typ = Syntax.read_typ ctxt "globals"; val globals_cases = Proof_Context.get_thm ctxt "globals.cases"; val globals_splits = hd (Proof_Context.get_thms ctxt "globals.splits"); (* The fastest way (so far) is manually splitting s and \<sigma>, then simplifying. * The Isar analogue would be * elim exE, case_tac "s", case_tac "\<sigma>", simp *) (* \<sigma> is free, so obtaining the split rule is straightforward *) val sigma_free = Free ("\<sigma>", globals_typ); val case_sigma = Drule.infer_instantiate' ctxt [SOME (Thm.cterm_of ctxt sigma_free)] globals_cases; (* However, s is bound and accessing it requires some awkward contortions *) (* globals.splits is an equation that looks like * (\<And>r. ?P r) \<equiv> (\<And>fields... ?P {fields}) * We walk down the current goal and apply globals.splits to the quantifier for the correct s. * The correct s would be the one that appears in our invariant assumption of the form * s = \<sigma>\<lparr>updates...\<rparr> * (We removed the preceding \<exists>'s using exE beforehand.) *) fun split_s_tac st = let val subgoal = Logic.get_goal (Thm.prop_of st) n; val prems = Logic.strip_assums_hyp subgoal; val env = Term.strip_all_vars subgoal |> map snd |> rev; fun find @{term_pat "Trueprop (?s = _)"} = (case s of Bound s_idx => if fastype_of1 (env, s) = globals_typ then [s_idx] else [] | _ => []) | find _ = [] val s_idx = case maps find prems of [] => raise THM ("modifies_invariant_tac: failed to find invariant assumption", n, [st]) | idx::_ => idx; fun split_conv idx (Const ("Pure.all", _) $ Abs (_, _, body)) ct = if idx > s_idx then Conv.forall_conv (fn _ => split_conv (idx - 1) body) ctxt ct else let val (_, cP) = Thm.dest_comb ct val inst = Drule.infer_instantiate' ctxt [SOME cP] globals_splits (*val _ = @{trace} (cP, inst, case Thm.prop_of inst of @{term_pat "?x \<equiv> _"} => x, Thm.term_of ct);*) in inst end | split_conv _ _ ct = Conv.no_conv ct; (* shouldn't happen *) in Conv.gconv_rule (split_conv (length env - 1) subgoal) n st |> Seq.single end handle e as THM _ => if quiet_fail then no_tac st else Exn.reraise e; (* avoid contextual rules, like split_pair_Ex, that lead simp down the garden path *) val globals_record_simps = maps (Proof_Context.get_thms ctxt) ["globals.ext_inject", "globals.update_convs"]; in st |> (DETERM (REPEAT (eresolve_tac ctxt @{thms exE} n)) THEN split_s_tac THEN resolve_tac ctxt [case_sigma] n THEN SOLVES (asm_full_simp_tac (put_simpset HOL_ss ctxt addsimps globals_record_simps) n)) end (* Convert initial modifies goal of the form * \<lbrace>\<lambda>s. s = \<sigma>\<rbrace> prog \<lbrace>\<lambda>_ s. \<exists>x1... s = \<sigma>\<lparr>field1 := x1, ...\<rparr> \<rbrace> * to one where the modifies is expressed as an invariant: * \<lbrace>\<lambda>s. \<exists>x1... s = \<sigma>\<lparr>field1 := x1, ...\<rparr> \<rbrace> prog \<lbrace>\<lambda>_ s. \<exists>x1... s = \<sigma>\<lparr>field1 := x1, ...\<rparr> \<rbrace> *) fun modifies_initial_tac ctxt n = resolve_tac ctxt @{thms hoare_weaken_pre} n THEN resolve_tac ctxt @{thms valid_invI} n; (* Incremental nets. (Why isn't this standard??) *) type incr_net = (int * thm) Net.net * int; fun build_incr_net rls = (Tactic.build_net rls, length rls); fun add_to_incr_net th (net, sz) = (Net.insert_term (K false) (Thm.concl_of th, (sz + 1, th)) net, sz + 1); (* guessed from tactic.ML *) fun net_of (n: incr_net) = fst n; (* Apply a callee's modifies rule to its call site. * The current goal should be expressed as an invariant: * \<lbrace>\<lambda>s. \<exists>x1... s = \<sigma>\<lparr>field1 := x1, ...\<rparr> \<rbrace> f args... \<lbrace>\<lambda>_ s. \<exists>x1... s = \<sigma>\<lparr>field1 := x1, ...\<rparr> \<rbrace> * We assume that callee_modifies contains the correct modifies rule * and is unique (no backtracking). *) fun modifies_call_tac (callee_modifies: incr_net) ctxt n = DETERM ( (* We move the existentials out of the precondition: \<And>x1... \<lbrace>\<lambda>s. s = \<sigma>\<lparr>field1 := x1, ...\<rparr> \<rbrace> f args... \<lbrace>\<lambda>_ s. \<exists>x1... s = \<sigma>\<lparr>field1 := x1, ...\<rparr> \<rbrace> *) REPEAT (resolve_tac ctxt @{thms hoare_ex_pre} n) THEN resolve_tac ctxt @{thms valid_inv_weaken'} n THEN (* Then we can apply the modifies rule, which looks like: \<lbrace>\<lambda>s. s = ?\<sigma>\<rbrace> f ?args... \<lbrace>\<lambda>_ s. \<exists>x1... s = ?\<sigma>\<lparr>field1 := x1, ...\<rparr> \<rbrace> *) DETERM (resolve_from_net_tac ctxt (net_of callee_modifies) n) THEN modifies_invariant_tac true ctxt n); (* VCG for trivial state invariants, such as globals modifies specs. * Takes vcg rules from "valid_inv". *) val valid_invN = Context.theory_name @{theory} ^ ".valid_inv" fun modifies_vcg_tac leaf_tac ctxt n = let val vcg_rules = Named_Theorems.get ctxt valid_invN |> Tactic.build_net; fun vcg n st = Seq.make (fn () => let (* do not backtrack once we have matched vcg_rules *) val st' = DETERM (resolve_from_net_tac ctxt vcg_rules n) st; in Seq.pull ((case Seq.pull st' of NONE => leaf_tac ctxt n | SOME _ => (K (K st') THEN_ALL_NEW vcg) n) st) end); in vcg n end; (* Specify and prove modifies for one (non-recursive) function. *) fun do_modifies_one ctxt fn_info (prog_info: ProgramInfo.prog_info) callee_modifies f_name = let val c_modifies_prop = Thm.prop_of (Proof_Context.get_thm ctxt (f_name ^ "_modifies")); val (state0_var, arg_vars, measure_var, ac_modifies_prop) = gen_modifies_prop ctxt fn_info prog_info f_name c_modifies_prop; val _ = if isSome measure_var then error ("do_modifies_one bug: got recursive function " ^ f_name) else (); val f_def = the (Symtab.lookup fn_info f_name) |> #definition; fun leaf_tac ctxt n = FIRST [modifies_call_tac callee_modifies ctxt n, modifies_invariant_tac true ctxt n, print_tac ctxt ("do_modifies_one failed (goal " ^ string_of_int n ^ ")")]; val thm = Goal.prove ctxt (map (fn (Free (v, _)) => v) (state0_var :: arg_vars)) [] ac_modifies_prop (K (Method.NO_CONTEXT_TACTIC ctxt (Method.unfold [f_def] ctxt []) THEN modifies_initial_tac ctxt 1 THEN modifies_vcg_tac leaf_tac ctxt 1 THEN leaf_tac ctxt 1)); in thm end; (* Make a list of conjunctions. *) fun mk_conj_list [] = @{term "HOL.True"} | mk_conj_list [x] = x | mk_conj_list (x::xs) = HOLogic.mk_conj (x, (mk_conj_list xs)) (* Specify and prove modifies for a recursive function group. *) fun do_modifies_recursive ctxt fn_info (prog_info: ProgramInfo.prog_info) (callee_modifies: incr_net) f_names = let (* Collect information *) val c_modifies_props = map (fn f_name => Thm.prop_of (Proof_Context.get_thm ctxt (f_name ^ "_modifies"))) f_names; val modifies_props = map2 (gen_modifies_prop ctxt fn_info prog_info) f_names c_modifies_props; val f_defs = map (fn f_name => the (Symtab.lookup fn_info f_name) |> #definition) f_names; fun free_name (Free (v, _)) = v; (* * We do the proof in three parts. * * First, we prove modifies on the base case (measure' = 0) for each function. * This is trivially handled by @{thm modifies_recursive_0}. *) val base_case_props = map (fn (state0_var, arg_vars, SOME measure_var, prop) => (state0_var, arg_vars, subst_free [(measure_var, @{term "0 :: nat"})] prop)) modifies_props; val base_case_leaf_tac = modifies_invariant_tac true; val base_case_thms = map2 (fn (state0_var, arg_vars, prop) => fn f_def => Goal.prove ctxt (map free_name (state0_var :: arg_vars)) [] prop (K (EqSubst.eqsubst_tac ctxt [0] [f_def] 1 THEN modifies_initial_tac ctxt 1 THEN resolve_tac ctxt @{thms modifies_recursive_0} 1 THEN base_case_leaf_tac ctxt 1))) base_case_props f_defs; (* * Next, we prove the induction step "measure'" \<rightarrow> "Suc measure'". * We create an induction hypothesis for each function, quantifying * over its variables: * \<And>\<sigma> arg1 arg2... \<lbrace>\<lambda>s. s = \<sigma>\<rbrace> f measure' arg1 arg2... \<lbrace>\<lambda>s. \<exists>x1... s = \<sigma>\<lparr>f1 := x1...\<rparr>\<rbrace> * Then, we can perform the VCG-based proof as usual, using these * hypotheses in modifies_call_tac. *) val inductive_hyps = map (fn (state0_var, arg_vars, SOME measure_var, prop) => fold Logic.all (state0_var :: arg_vars) prop) modifies_props; val inductive_props = map (fn (state0_var, arg_vars, SOME measure_var, prop) => (state0_var, arg_vars, measure_var, subst_free [(measure_var, @{term "Suc"} $ measure_var)] prop)) modifies_props; val inductive_thms = map2 (fn (state0_var, arg_vars, measure_var, prop) => fn f_def => Goal.prove ctxt (map free_name (state0_var :: measure_var :: arg_vars)) inductive_hyps prop (fn {context, prems} => let val callee_modifies' = fold add_to_incr_net prems callee_modifies; fun inductive_leaf_tac ctxt n = FIRST [modifies_call_tac callee_modifies' ctxt n, modifies_invariant_tac true ctxt n]; in EqSubst.eqsubst_tac ctxt [0] [f_def] 1 THEN (* AutoCorres specifies recursive calls to use "measure - 1", * which in our case becomes "Suc measure - 1". Simplify to "measure". *) Method.NO_CONTEXT_TACTIC ctxt (Method.unfold @{thms diff_Suc_1} ctxt []) THEN modifies_initial_tac ctxt 1 THEN modifies_vcg_tac inductive_leaf_tac ctxt 1 THEN inductive_leaf_tac ctxt 1 end)) inductive_props f_defs (* * Third, we create a combined modifies prop * (\<forall>\<sigma> arg1... \<lbrace>\<lambda>s. s = \<sigma>\<rbrace> f1 measure' arg1... \<lbrace>...\<rbrace>) \<and> * (\<forall>\<sigma> arg1... \<lbrace>\<lambda>s. s = \<sigma>\<rbrace> f2 measure' arg1... \<lbrace>...\<rbrace>) \<and> ... * and apply induction on measure', solving the subgoals using the * theorems from before. * Note that we quantify over args because arg names may clash between functions. * * We pre-proved the induction steps separately for convenience * (e.g. so we can access the hypotheses as facts instead of premises). *) fun hd_of_equal [x] = x | hd_of_equal (x::xs) = if forall (fn x' => x = x') xs then x else raise TERM ("do_modifies_group bug: unequal terms", xs); val (measure_var, final_props) = modifies_props |> map (fn (state0_var, arg_vars, SOME measure_var, prop) => (measure_var, fold (fn Free (v, T) => fn P => HOLogic.mk_all (v, T, P)) (state0_var :: arg_vars) (HOLogic.dest_Trueprop prop))) |> (fn xs => let val props = map snd xs; val measure_var = map fst xs |> hd_of_equal; in (measure_var, props) end); val combined_prop = HOLogic.mk_Trueprop (mk_conj_list final_props); fun intro_tac ctxt rls n = TRY ((resolve_tac ctxt rls THEN_ALL_NEW intro_tac ctxt rls) n); fun elim_tac ctxt rls n = TRY ((eresolve_tac ctxt rls THEN_ALL_NEW elim_tac ctxt rls) n); (*fun maybe_print_tac msg ctxt = print_tac ctxt msg;*) fun maybe_print_tac msg ctxt = all_tac; (*val _ = @{trace} ("inductive thms", inductive_thms);*) val combined_thm = Goal.prove ctxt [free_name measure_var] [] combined_prop (K (Induct.induct_tac ctxt false (* simplifier *) [[SOME (NONE, (measure_var, false))]] (* variables *) [] (* arbitrary: *) [] (* ??? *) (SOME @{thms nat.induct}) (* induct rule *) [] (* extra thms *) 1 THEN maybe_print_tac "base case" ctxt THEN (* base case *) SOLVES ( (((DETERM o intro_tac ctxt @{thms conjI allI}) THEN' K (maybe_print_tac "base case'" ctxt)) THEN_ALL_NEW resolve_tac ctxt base_case_thms) 1 ) THEN maybe_print_tac "inductive case" ctxt THEN (* recursive case *) SOLVE ( (((DETERM o (intro_tac ctxt @{thms conjI allI} THEN_ALL_NEW elim_tac ctxt @{thms conjE}) THEN_ALL_NEW (fn n => Conv.gconv_rule (Raw_Simplifier.rewrite ctxt true @{thms All_to_all}) n #> Seq.succeed)) THEN' K (maybe_print_tac "inductive case'" ctxt)) THEN_ALL_NEW (resolve_tac ctxt inductive_thms THEN_ALL_NEW Method.assm_tac ctxt)) 1 ))); (* Finally, we extract theorems for individual functions. *) val final_thms = HOLogic.conj_elims ctxt combined_thm |> map (fn thm => thm |> Thm.equal_elim (Raw_Simplifier.rewrite ctxt true @{thms All_to_all} (Thm.cprop_of thm)) |> Thm.forall_elim_vars 0); in final_thms end; (* Prove and store modifies rules for one function or recursive function group. *) fun prove_modifies (fn_info: FunctionInfo.function_info Symtab.table) (prog_info: ProgramInfo.prog_info) (callee_modifies: incr_net) (results: thm Symtab.table) (f_names: string list) (thm_names: string list) ctxt : (thm list * Proof.context) option = let val f_infos = map (the o Symtab.lookup fn_info) f_names; val maybe_thms = if length f_names = 1 andalso #is_simpl_wrapper (hd f_infos) then let val f_name = hd f_names; val _ = tracing (f_name ^ " is un-translated; transferring C-parser's modifies rule directly"); val f_def = the (Symtab.lookup fn_info f_name) |> #definition; val orig_modifies = Proof_Context.get_thm ctxt (f_name ^ "_modifies"); val transfer_thm = @{thm autocorres_modifies_transfer}; val thm = transfer_thm OF [f_def, orig_modifies]; in SOME [modifies_simp ctxt thm] end else let val callees = map (FunctionInfo.all_callees o the o Symtab.lookup fn_info) f_names |> Symset.union_sets |> Symset.dest; val missing_callees = callees |> filter_out (fn callee => Symtab.defined results callee orelse member (=) f_names callee); in if not (null missing_callees) then (warning ("Can't prove modifies; depends on functions without modifies proofs: " ^ commas missing_callees); NONE) else if length f_names = 1 then SOME ([do_modifies_one ctxt fn_info prog_info callee_modifies (hd f_names)]) else SOME (do_modifies_recursive ctxt fn_info prog_info callee_modifies f_names) end; in case maybe_thms of SOME thms => let val (_, ctxt) = Local_Theory.notes (map2 (fn thm_name => fn thm => ((Binding.name thm_name, []), [([thm], [])])) thm_names thms) ctxt; in SOME (thms, ctxt) end | NONE => NONE end; fun define_modifies_group fn_info prog_info f_names (acc as (callee_modifies, results, ctxt)) = (tracing ("Doing modifies proof for: " ^ commas f_names); case f_names |> filter (fn f_name => not (isSome (try (Proof_Context.get_thm ctxt) (f_name ^ "_modifies")))) of [] => (case prove_modifies fn_info prog_info callee_modifies results f_names (map (fn f_name => f_name ^ "'_modifies") f_names) ctxt of NONE => acc | SOME (thms, ctxt') => (fold add_to_incr_net thms callee_modifies, fold Symtab.update_new (f_names ~~ thms) results, ctxt')) | missing => (warning ("Can't do proof because C-parser modifies rules are missing for: " ^ commas missing); acc)); (* * This is the top-level wrapper that generates modifies rules for the most * recently translated set of functions from a given C file. *) fun new_modifies_rules filename ctxt = let val all_fn_info = Symtab.lookup (AutoCorresFunctionInfo.get (Proof_Context.theory_of ctxt)) filename |> the; val ts_info = FunctionInfo.Phasetab.lookup all_fn_info FunctionInfo.TS |> the; val prog_info = ProgramInfo.get_prog_info ctxt filename; (* Assume that the user has already generated and named modifies rules * for previously-translated callees. *) val existing_modifies = Symtab.dest ts_info |> List.mapPartial (fn (fn_name, fn_def) => try (fn _ => (fn_name, Proof_Context.get_thm ctxt (fn_name ^ "'_modifies"))) ()) |> Symtab.make; (* We will do modifies proofs for these functions *) val pending_fn_info = Symtab.dest ts_info |> List.mapPartial (fn (f, info) => if Symtab.defined existing_modifies f then NONE else SOME (f, info)) |> Symtab.make; val (call_graph, _) = FunctionInfo.calc_call_graph pending_fn_info; val (callee_modifies, results, ctxt') = fold (define_modifies_group ts_info prog_info) (#topo_sorted_functions call_graph |> map Symset.dest) (build_incr_net (Symtab.dest existing_modifies |> map snd), existing_modifies, ctxt) in ctxt' end end; \<close> end
State Before: m : Type u_1 β†’ Type u_2 ρ α✝ : Type u_1 p : α✝ β†’ Prop x : ReaderT ρ m α✝ inst✝ : Monad m a : ReaderT ρ m { a // p a } ⊒ Subtype.val <$> a = x ↔ βˆ€ (x_1 : ρ), Subtype.val <$> a x_1 = x x_1 State After: no goals Tactic: exact ⟨fun eq _ => eq β–Έ rfl, funext⟩
lemma Complex_in_Reals: "Complex x 0 \<in> \<real>"
(* Definitions for public key encryption. *) Set Implicit Arguments. Require Import Crypto. Local Open Scope rat_scope. Section IND_CPA. Variable Plaintext : Set. Variable Ciphertext : Set. Variable PrivateKey : Set. Variable PublicKey : Set. Variable KeyGen : Comp (PrivateKey * PublicKey). Variable Encrypt : Plaintext -> PublicKey -> Comp Ciphertext. Variable A_state : Set. Variable A1 : PublicKey -> Comp (Plaintext * Plaintext * A_state). Variable A2 : (Ciphertext * A_state) -> Comp bool. Definition IND_CPA_G := [prikey, pubkey] <-$2 KeyGen; [p0, p1, a_state] <-$3 (A1 pubkey); b <-$ {0, 1}; pb <- if b then p0 else p1; c <-$ (Encrypt pb pubkey); b' <-$ (A2 (c, a_state)); ret (eqb b b'). Definition IND_CPA_Advantage := | Pr[IND_CPA_G] - 1 / 2 |. Definition IND_CPA (epsilon : Rat) := | Pr[IND_CPA_G] - 1 / 2 | <= epsilon. End IND_CPA.
> module Nat.DivisorOperations > import Nat.Divisor > %default total > %access public export > ||| Exact integer division > quotient : (m : Nat) -> (d : Nat) -> d `Divisor` m -> Nat > quotient _ _ (Element q _) = q
lemma zero_le_sgn_iff [simp]: "0 \<le> sgn x \<longleftrightarrow> 0 \<le> x" for x :: real
module Main greet : Eff () [STDIO] greet = do putStrLn "Hello world" putStrLn "What is your name?" x <- getStr putStrLn ("Welcome, " ++ trim x) main : IO () main = run greet --Run: --$ idris greet.idr -o greet --$ ./greet
[GOAL] Οƒ : Type u K : Type v inst✝ : Field K I : Ideal (MvPolynomial Οƒ K) hI : I β‰  ⊀ ⊒ Function.Injective ↑(RingHom.comp (Ideal.Quotient.mk I) C) [PROOFSTEP] refine' (injective_iff_map_eq_zero _).2 fun x hx => _ [GOAL] Οƒ : Type u K : Type v inst✝ : Field K I : Ideal (MvPolynomial Οƒ K) hI : I β‰  ⊀ x : K hx : ↑(RingHom.comp (Ideal.Quotient.mk I) C) x = 0 ⊒ x = 0 [PROOFSTEP] rw [RingHom.comp_apply, Ideal.Quotient.eq_zero_iff_mem] at hx [GOAL] Οƒ : Type u K : Type v inst✝ : Field K I : Ideal (MvPolynomial Οƒ K) hI : I β‰  ⊀ x : K hx : ↑C x ∈ I ⊒ x = 0 [PROOFSTEP] refine' _root_.by_contradiction fun hx0 => absurd (I.eq_top_iff_one.2 _) hI [GOAL] Οƒ : Type u K : Type v inst✝ : Field K I : Ideal (MvPolynomial Οƒ K) hI : I β‰  ⊀ x : K hx : ↑C x ∈ I hx0 : Β¬x = 0 ⊒ 1 ∈ I [PROOFSTEP] have := I.mul_mem_left (MvPolynomial.C x⁻¹) hx [GOAL] Οƒ : Type u K : Type v inst✝ : Field K I : Ideal (MvPolynomial Οƒ K) hI : I β‰  ⊀ x : K hx : ↑C x ∈ I hx0 : Β¬x = 0 this : ↑C x⁻¹ * ↑C x ∈ I ⊒ 1 ∈ I [PROOFSTEP] rwa [← MvPolynomial.C.map_mul, inv_mul_cancel hx0, MvPolynomial.C_1] at this [GOAL] Οƒ K : Type u inst✝ : Field K ⊒ Module.rank K (MvPolynomial Οƒ K) = Cardinal.mk (Οƒ β†’β‚€ β„•) [PROOFSTEP] rw [← Cardinal.lift_inj, ← (basisMonomials Οƒ K).mk_eq_rank]
import float.basic -- Following https://isabelle.in.tum.de/website-Isabelle2013/dist/library/HOL/HOL-Library/Float.html variable (prec : β„•) def round_up (x : β„š) : 𝔽 := float.mk (⌈x * 2 ^ precβŒ‰) (-prec) def round_down (x : β„š) : 𝔽 := float.mk (⌊x * 2 ^ precβŒ‹) (-prec) lemma round_up_zero : round_up prec 0 = 0 := by { apply quotient.sound, show to_rat _ = _, simp [to_rat], } lemma round_down_zero : round_down prec 0 = 0 := by { apply quotient.sound, show to_rat _ = _, simp [to_rat], } lemma round_up_diff_round_down (x : β„š) : round_up prec x - round_down prec x ≀ float.mk 1 (-prec) := begin show float.eval _ ≀ _, simp [float.eval_sub, round_up, round_down, float.eval_mk], suffices hsuff : ↑(⌈x * 2 ^ precβŒ‰ - ⌊x * 2 ^ precβŒ‹) * ((2 : β„š) ^ prec)⁻¹ ≀ 1 * ((2 : β„š) ^ prec)⁻¹, { push_cast at hsuff, rw [sub_mul, one_mul] at hsuff, exact hsuff, }, have h : 0 < ((2 : β„š) ^ prec)⁻¹, { norm_num, }, rw [mul_le_mul_right h], show _ ≀ ↑(1 : β„€), simp [coe], rw [sub_le_iff_le_add, add_comm], exact ceil_le_floor_add_one _, end
[GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² h : Inducing f ⊒ Inducing (restrictPreimage s f) [PROOFSTEP] simp_rw [inducing_subtype_val.inducing_iff, inducing_iff_nhds, restrictPreimage, MapsTo.coe_restrict, restrict_eq, ← @Filter.comap_comap _ _ _ _ _ f, Function.comp_apply] at h ⊒ [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² h : βˆ€ (a : Ξ±), 𝓝 a = comap f (𝓝 (f a)) ⊒ βˆ€ (a : ↑(f ⁻¹' s)), 𝓝 a = comap Subtype.val (comap f (𝓝 (f ↑a))) [PROOFSTEP] intro a [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² h : βˆ€ (a : Ξ±), 𝓝 a = comap f (𝓝 (f a)) a : ↑(f ⁻¹' s) ⊒ 𝓝 a = comap Subtype.val (comap f (𝓝 (f ↑a))) [PROOFSTEP] rw [← h, ← inducing_subtype_val.nhds_eq_comap] [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² H : IsClosedMap f ⊒ IsClosedMap (restrictPreimage s f) [PROOFSTEP] rintro t ⟨u, hu, e⟩ [GOAL] case mk.intro.intro Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² H : IsClosedMap f t : Set ↑(f ⁻¹' s) u : Set Ξ± hu : IsOpen u e : Subtype.val ⁻¹' u = tᢜ ⊒ IsClosed (restrictPreimage s f '' t) [PROOFSTEP] refine' ⟨⟨_, (H _ (IsOpen.isClosed_compl hu)).1, _⟩⟩ [GOAL] case mk.intro.intro Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² H : IsClosedMap f t : Set ↑(f ⁻¹' s) u : Set Ξ± hu : IsOpen u e : Subtype.val ⁻¹' u = tᢜ ⊒ Subtype.val ⁻¹' (f '' uᢜ)ᢜ = (restrictPreimage s f '' t)ᢜ [PROOFSTEP] rw [← (congr_arg HasCompl.compl e).trans (compl_compl t)] [GOAL] case mk.intro.intro Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² H : IsClosedMap f t : Set ↑(f ⁻¹' s) u : Set Ξ± hu : IsOpen u e : Subtype.val ⁻¹' u = tᢜ ⊒ Subtype.val ⁻¹' (f '' uᢜ)ᢜ = (restrictPreimage s f '' (Subtype.val ⁻¹' u)ᢜ)ᢜ [PROOFSTEP] simp only [Set.preimage_compl, compl_inj_iff] [GOAL] case mk.intro.intro Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² H : IsClosedMap f t : Set ↑(f ⁻¹' s) u : Set Ξ± hu : IsOpen u e : Subtype.val ⁻¹' u = tᢜ ⊒ Subtype.val ⁻¹' (f '' uᢜ) = restrictPreimage s f '' (Subtype.val ⁻¹' u)ᢜ [PROOFSTEP] ext ⟨x, hx⟩ [GOAL] case mk.intro.intro.h.mk Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² H : IsClosedMap f t : Set ↑(f ⁻¹' s) u : Set Ξ± hu : IsOpen u e : Subtype.val ⁻¹' u = tᢜ x : Ξ² hx : x ∈ s ⊒ { val := x, property := hx } ∈ Subtype.val ⁻¹' (f '' uᢜ) ↔ { val := x, property := hx } ∈ restrictPreimage s f '' (Subtype.val ⁻¹' u)ᢜ [PROOFSTEP] suffices (βˆƒ y, y βˆ‰ u ∧ f y = x) ↔ βˆƒ y, y βˆ‰ u ∧ f y ∈ s ∧ f y = x by simpa [Set.restrictPreimage, ← Subtype.coe_inj] [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² H : IsClosedMap f t : Set ↑(f ⁻¹' s) u : Set Ξ± hu : IsOpen u e : Subtype.val ⁻¹' u = tᢜ x : Ξ² hx : x ∈ s this : (βˆƒ y, Β¬y ∈ u ∧ f y = x) ↔ βˆƒ y, Β¬y ∈ u ∧ f y ∈ s ∧ f y = x ⊒ { val := x, property := hx } ∈ Subtype.val ⁻¹' (f '' uᢜ) ↔ { val := x, property := hx } ∈ restrictPreimage s f '' (Subtype.val ⁻¹' u)ᢜ [PROOFSTEP] simpa [Set.restrictPreimage, ← Subtype.coe_inj] [GOAL] case mk.intro.intro.h.mk Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² H : IsClosedMap f t : Set ↑(f ⁻¹' s) u : Set Ξ± hu : IsOpen u e : Subtype.val ⁻¹' u = tᢜ x : Ξ² hx : x ∈ s ⊒ (βˆƒ y, Β¬y ∈ u ∧ f y = x) ↔ βˆƒ y, Β¬y ∈ u ∧ f y ∈ s ∧ f y = x [PROOFSTEP] exact ⟨fun ⟨a, b, c⟩ => ⟨a, b, c.symm β–Έ hx, c⟩, fun ⟨a, b, _, c⟩ => ⟨a, b, c⟩⟩ [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² ⊒ IsOpen s ↔ βˆ€ (i : ΞΉ), IsOpen (s ∩ ↑(U i)) [PROOFSTEP] constructor [GOAL] case mp Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² ⊒ IsOpen s β†’ βˆ€ (i : ΞΉ), IsOpen (s ∩ ↑(U i)) [PROOFSTEP] exact fun H i => H.inter (U i).2 [GOAL] case mpr Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² ⊒ (βˆ€ (i : ΞΉ), IsOpen (s ∩ ↑(U i))) β†’ IsOpen s [PROOFSTEP] intro H [GOAL] case mpr Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² H : βˆ€ (i : ΞΉ), IsOpen (s ∩ ↑(U i)) ⊒ IsOpen s [PROOFSTEP] have : ⋃ i, (U i : Set Ξ²) = Set.univ := by convert congr_arg (SetLike.coe) hU simp [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² H : βˆ€ (i : ΞΉ), IsOpen (s ∩ ↑(U i)) ⊒ ⋃ (i : ΞΉ), ↑(U i) = univ [PROOFSTEP] convert congr_arg (SetLike.coe) hU [GOAL] case h.e'_2 Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² H : βˆ€ (i : ΞΉ), IsOpen (s ∩ ↑(U i)) ⊒ ⋃ (i : ΞΉ), ↑(U i) = ↑(iSup U) [PROOFSTEP] simp [GOAL] case mpr Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² H : βˆ€ (i : ΞΉ), IsOpen (s ∩ ↑(U i)) this : ⋃ (i : ΞΉ), ↑(U i) = univ ⊒ IsOpen s [PROOFSTEP] rw [← s.inter_univ, ← this, Set.inter_iUnion] [GOAL] case mpr Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² H : βˆ€ (i : ΞΉ), IsOpen (s ∩ ↑(U i)) this : ⋃ (i : ΞΉ), ↑(U i) = univ ⊒ IsOpen (⋃ (i : ΞΉ), s ∩ ↑(U i)) [PROOFSTEP] exact isOpen_iUnion H [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² ⊒ IsOpen s ↔ βˆ€ (i : ΞΉ), IsOpen (Subtype.val ⁻¹' s) [PROOFSTEP] rw [isOpen_iff_inter_of_iSup_eq_top hU s] [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² ⊒ (βˆ€ (i : ΞΉ), IsOpen (s ∩ ↑(U i))) ↔ βˆ€ (i : ΞΉ), IsOpen (Subtype.val ⁻¹' s) [PROOFSTEP] refine forall_congr' fun i => ?_ [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² i : ΞΉ ⊒ IsOpen (s ∩ ↑(U i)) ↔ IsOpen (Subtype.val ⁻¹' s) [PROOFSTEP] rw [(U _).2.openEmbedding_subtype_val.open_iff_image_open] [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² i : ΞΉ ⊒ IsOpen (s ∩ ↑(U i)) ↔ IsOpen (Subtype.val '' (Subtype.val ⁻¹' s)) [PROOFSTEP] erw [Set.image_preimage_eq_inter_range] [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² i : ΞΉ ⊒ IsOpen (s ∩ ↑(U i)) ↔ IsOpen (s ∩ range Subtype.val) [PROOFSTEP] rw [Subtype.range_coe, Opens.carrier_eq_coe] [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ s : Set Ξ² ⊒ IsClosed s ↔ βˆ€ (i : ΞΉ), IsClosed (Subtype.val ⁻¹' s) [PROOFSTEP] simpa using isOpen_iff_coe_preimage_of_iSup_eq_top hU sᢜ [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ ⊒ IsClosedMap f ↔ βˆ€ (i : ΞΉ), IsClosedMap (restrictPreimage (U i).carrier f) [PROOFSTEP] refine' ⟨fun h i => Set.restrictPreimage_isClosedMap _ h, _⟩ [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ ⊒ (βˆ€ (i : ΞΉ), IsClosedMap (restrictPreimage (U i).carrier f)) β†’ IsClosedMap f [PROOFSTEP] rintro H s hs [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ H : βˆ€ (i : ΞΉ), IsClosedMap (restrictPreimage (U i).carrier f) s : Set Ξ± hs : IsClosed s ⊒ IsClosed (f '' s) [PROOFSTEP] rw [isClosed_iff_coe_preimage_of_iSup_eq_top hU] [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ H : βˆ€ (i : ΞΉ), IsClosedMap (restrictPreimage (U i).carrier f) s : Set Ξ± hs : IsClosed s ⊒ βˆ€ (i : ΞΉ), IsClosed (Subtype.val ⁻¹' (f '' s)) [PROOFSTEP] intro i [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ H : βˆ€ (i : ΞΉ), IsClosedMap (restrictPreimage (U i).carrier f) s : Set Ξ± hs : IsClosed s i : ΞΉ ⊒ IsClosed (Subtype.val ⁻¹' (f '' s)) [PROOFSTEP] convert H i _ ⟨⟨_, hs.1, eq_compl_comm.mpr rfl⟩⟩ [GOAL] case h.e'_3.h Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ H : βˆ€ (i : ΞΉ), IsClosedMap (restrictPreimage (U i).carrier f) s : Set Ξ± hs : IsClosed s i : ΞΉ e_1✝ : { x // x ∈ U i } = ↑(U i).carrier ⊒ Subtype.val ⁻¹' (f '' s) = restrictPreimage (U i).carrier f '' (Subtype.val ⁻¹' sᢜ)ᢜ [PROOFSTEP] ext ⟨x, hx⟩ [GOAL] case h.e'_3.h.h.mk Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ H : βˆ€ (i : ΞΉ), IsClosedMap (restrictPreimage (U i).carrier f) s : Set Ξ± hs : IsClosed s i : ΞΉ e_1✝ : { x // x ∈ U i } = ↑(U i).carrier x : Ξ² hx : x ∈ U i ⊒ { val := x, property := hx } ∈ Subtype.val ⁻¹' (f '' s) ↔ { val := x, property := hx } ∈ restrictPreimage (U i).carrier f '' (Subtype.val ⁻¹' sᢜ)ᢜ [PROOFSTEP] suffices (βˆƒ y, y ∈ s ∧ f y = x) ↔ βˆƒ y, y ∈ s ∧ f y ∈ U i ∧ f y = x by simpa [Set.restrictPreimage, ← Subtype.coe_inj] [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ H : βˆ€ (i : ΞΉ), IsClosedMap (restrictPreimage (U i).carrier f) s : Set Ξ± hs : IsClosed s i : ΞΉ e_1✝ : { x // x ∈ U i } = ↑(U i).carrier x : Ξ² hx : x ∈ U i this : (βˆƒ y, y ∈ s ∧ f y = x) ↔ βˆƒ y, y ∈ s ∧ f y ∈ U i ∧ f y = x ⊒ { val := x, property := hx } ∈ Subtype.val ⁻¹' (f '' s) ↔ { val := x, property := hx } ∈ restrictPreimage (U i).carrier f '' (Subtype.val ⁻¹' sᢜ)ᢜ [PROOFSTEP] simpa [Set.restrictPreimage, ← Subtype.coe_inj] [GOAL] case h.e'_3.h.h.mk Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s✝ : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ H : βˆ€ (i : ΞΉ), IsClosedMap (restrictPreimage (U i).carrier f) s : Set Ξ± hs : IsClosed s i : ΞΉ e_1✝ : { x // x ∈ U i } = ↑(U i).carrier x : Ξ² hx : x ∈ U i ⊒ (βˆƒ y, y ∈ s ∧ f y = x) ↔ βˆƒ y, y ∈ s ∧ f y ∈ U i ∧ f y = x [PROOFSTEP] exact ⟨fun ⟨a, b, c⟩ => ⟨a, b, c.symm β–Έ hx, c⟩, fun ⟨a, b, _, c⟩ => ⟨a, b, c⟩⟩ [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ Inducing f ↔ βˆ€ (i : ΞΉ), Inducing (restrictPreimage (U i).carrier f) [PROOFSTEP] simp_rw [inducing_subtype_val.inducing_iff, inducing_iff_nhds, restrictPreimage, MapsTo.coe_restrict, restrict_eq, ← @Filter.comap_comap _ _ _ _ _ f] [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ (βˆ€ (a : Ξ±), 𝓝 a = comap f (𝓝 (f a))) ↔ βˆ€ (i : ΞΉ) (a : ↑(f ⁻¹' (U i).carrier)), 𝓝 a = comap Subtype.val (comap f (𝓝 ((f ∘ Subtype.val) a))) [PROOFSTEP] constructor [GOAL] case mp Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ (βˆ€ (a : Ξ±), 𝓝 a = comap f (𝓝 (f a))) β†’ βˆ€ (i : ΞΉ) (a : ↑(f ⁻¹' (U i).carrier)), 𝓝 a = comap Subtype.val (comap f (𝓝 ((f ∘ Subtype.val) a))) [PROOFSTEP] intro H i x [GOAL] case mp Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f H : βˆ€ (a : Ξ±), 𝓝 a = comap f (𝓝 (f a)) i : ΞΉ x : ↑(f ⁻¹' (U i).carrier) ⊒ 𝓝 x = comap Subtype.val (comap f (𝓝 ((f ∘ Subtype.val) x))) [PROOFSTEP] rw [Function.comp_apply, ← H, ← inducing_subtype_val.nhds_eq_comap] [GOAL] case mpr Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ (βˆ€ (i : ΞΉ) (a : ↑(f ⁻¹' (U i).carrier)), 𝓝 a = comap Subtype.val (comap f (𝓝 ((f ∘ Subtype.val) a)))) β†’ βˆ€ (a : Ξ±), 𝓝 a = comap f (𝓝 (f a)) [PROOFSTEP] intro H x [GOAL] case mpr Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f H : βˆ€ (i : ΞΉ) (a : ↑(f ⁻¹' (U i).carrier)), 𝓝 a = comap Subtype.val (comap f (𝓝 ((f ∘ Subtype.val) a))) x : Ξ± ⊒ 𝓝 x = comap f (𝓝 (f x)) [PROOFSTEP] obtain ⟨i, hi⟩ := Opens.mem_iSup.mp (show f x ∈ iSup U by rw [hU] triv) [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f H : βˆ€ (i : ΞΉ) (a : ↑(f ⁻¹' (U i).carrier)), 𝓝 a = comap Subtype.val (comap f (𝓝 ((f ∘ Subtype.val) a))) x : Ξ± ⊒ f x ∈ iSup U [PROOFSTEP] rw [hU] [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f H : βˆ€ (i : ΞΉ) (a : ↑(f ⁻¹' (U i).carrier)), 𝓝 a = comap Subtype.val (comap f (𝓝 ((f ∘ Subtype.val) a))) x : Ξ± ⊒ f x ∈ ⊀ [PROOFSTEP] triv [GOAL] case mpr.intro Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f H : βˆ€ (i : ΞΉ) (a : ↑(f ⁻¹' (U i).carrier)), 𝓝 a = comap Subtype.val (comap f (𝓝 ((f ∘ Subtype.val) a))) x : Ξ± i : ΞΉ hi : f x ∈ U i ⊒ 𝓝 x = comap f (𝓝 (f x)) [PROOFSTEP] erw [← OpenEmbedding.map_nhds_eq (h.1 _ (U i).2).openEmbedding_subtype_val ⟨x, hi⟩] [GOAL] case mpr.intro Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f H : βˆ€ (i : ΞΉ) (a : ↑(f ⁻¹' (U i).carrier)), 𝓝 a = comap Subtype.val (comap f (𝓝 ((f ∘ Subtype.val) a))) x : Ξ± i : ΞΉ hi : f x ∈ U i ⊒ map Subtype.val (𝓝 { val := x, property := hi }) = comap f (𝓝 (f x)) [PROOFSTEP] rw [(H i) ⟨x, hi⟩, Filter.subtype_coe_map_comap, Function.comp_apply, Subtype.coe_mk, inf_eq_left, Filter.le_principal_iff] [GOAL] case mpr.intro Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f H : βˆ€ (i : ΞΉ) (a : ↑(f ⁻¹' (U i).carrier)), 𝓝 a = comap Subtype.val (comap f (𝓝 ((f ∘ Subtype.val) a))) x : Ξ± i : ΞΉ hi : f x ∈ U i ⊒ f ⁻¹' (U i).carrier ∈ comap f (𝓝 (f x)) [PROOFSTEP] exact Filter.preimage_mem_comap ((U i).2.mem_nhds hi) [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ Embedding f ↔ βˆ€ (i : ΞΉ), Embedding (restrictPreimage (U i).carrier f) [PROOFSTEP] simp_rw [embedding_iff] [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ Inducing f ∧ Function.Injective f ↔ βˆ€ (i : ΞΉ), Inducing (restrictPreimage (U i).carrier f) ∧ Function.Injective (restrictPreimage (U i).carrier f) [PROOFSTEP] rw [forall_and] [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ Inducing f ∧ Function.Injective f ↔ (βˆ€ (x : ΞΉ), Inducing (restrictPreimage (U x).carrier f)) ∧ βˆ€ (x : ΞΉ), Function.Injective (restrictPreimage (U x).carrier f) [PROOFSTEP] apply and_congr [GOAL] case h₁ Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ Inducing f ↔ βˆ€ (x : ΞΉ), Inducing (restrictPreimage (U x).carrier f) [PROOFSTEP] apply inducing_iff_inducing_of_iSup_eq_top [GOAL] case h₁.hU Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ ⨆ (i : ΞΉ), U i = ⊀ [PROOFSTEP] assumption [GOAL] case h₁.h Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ Continuous f [PROOFSTEP] assumption [GOAL] case hβ‚‚ Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ Function.Injective f ↔ βˆ€ (x : ΞΉ), Function.Injective (restrictPreimage (U x).carrier f) [PROOFSTEP] apply Set.injective_iff_injective_of_iUnion_eq_univ [GOAL] case hβ‚‚.hU Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ ⋃ (i : ΞΉ), (U i).carrier = univ [PROOFSTEP] convert congr_arg SetLike.coe hU [GOAL] case h.e'_2 Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ ⋃ (i : ΞΉ), (U i).carrier = ↑(iSup U) [PROOFSTEP] simp [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ OpenEmbedding f ↔ βˆ€ (i : ΞΉ), OpenEmbedding (restrictPreimage (U i).carrier f) [PROOFSTEP] simp_rw [openEmbedding_iff] [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ Embedding f ∧ IsOpen (range f) ↔ βˆ€ (i : ΞΉ), Embedding (restrictPreimage (U i).carrier f) ∧ IsOpen (range (restrictPreimage (U i).carrier f)) [PROOFSTEP] rw [forall_and] [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ Embedding f ∧ IsOpen (range f) ↔ (βˆ€ (x : ΞΉ), Embedding (restrictPreimage (U x).carrier f)) ∧ βˆ€ (x : ΞΉ), IsOpen (range (restrictPreimage (U x).carrier f)) [PROOFSTEP] apply and_congr [GOAL] case h₁ Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ Embedding f ↔ βˆ€ (x : ΞΉ), Embedding (restrictPreimage (U x).carrier f) [PROOFSTEP] apply embedding_iff_embedding_of_iSup_eq_top [GOAL] case h₁.hU Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ ⨆ (i : ΞΉ), U i = ⊀ [PROOFSTEP] assumption [GOAL] case h₁.h Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ Continuous f [PROOFSTEP] assumption [GOAL] case hβ‚‚ Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ IsOpen (range f) ↔ βˆ€ (x : ΞΉ), IsOpen (range (restrictPreimage (U x).carrier f)) [PROOFSTEP] simp_rw [Set.range_restrictPreimage] [GOAL] case hβ‚‚ Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ IsOpen (range f) ↔ βˆ€ (x : ΞΉ), IsOpen (Subtype.val ⁻¹' range f) [PROOFSTEP] apply isOpen_iff_coe_preimage_of_iSup_eq_top hU [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ ClosedEmbedding f ↔ βˆ€ (i : ΞΉ), ClosedEmbedding (restrictPreimage (U i).carrier f) [PROOFSTEP] simp_rw [closedEmbedding_iff] [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ Embedding f ∧ IsClosed (range f) ↔ βˆ€ (i : ΞΉ), Embedding (restrictPreimage (U i).carrier f) ∧ IsClosed (range (restrictPreimage (U i).carrier f)) [PROOFSTEP] rw [forall_and] [GOAL] Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ Embedding f ∧ IsClosed (range f) ↔ (βˆ€ (x : ΞΉ), Embedding (restrictPreimage (U x).carrier f)) ∧ βˆ€ (x : ΞΉ), IsClosed (range (restrictPreimage (U x).carrier f)) [PROOFSTEP] apply and_congr [GOAL] case h₁ Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ Embedding f ↔ βˆ€ (x : ΞΉ), Embedding (restrictPreimage (U x).carrier f) [PROOFSTEP] apply embedding_iff_embedding_of_iSup_eq_top [GOAL] case h₁.hU Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ ⨆ (i : ΞΉ), U i = ⊀ [PROOFSTEP] assumption [GOAL] case h₁.h Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ Continuous f [PROOFSTEP] assumption [GOAL] case hβ‚‚ Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ IsClosed (range f) ↔ βˆ€ (x : ΞΉ), IsClosed (range (restrictPreimage (U x).carrier f)) [PROOFSTEP] simp_rw [Set.range_restrictPreimage] [GOAL] case hβ‚‚ Ξ± : Type u_1 Ξ² : Type u_2 inst✝¹ : TopologicalSpace Ξ± inst✝ : TopologicalSpace Ξ² f : Ξ± β†’ Ξ² s : Set Ξ² ΞΉ : Type u_3 U : ΞΉ β†’ Opens Ξ² hU : iSup U = ⊀ h : Continuous f ⊒ IsClosed (range f) ↔ βˆ€ (x : ΞΉ), IsClosed (Subtype.val ⁻¹' range f) [PROOFSTEP] apply isClosed_iff_coe_preimage_of_iSup_eq_top hU
/- Copyright (c) 2022 MarΓ­a InΓ©s de Frutos-FernΓ‘ndez. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: MarΓ­a InΓ©s de Frutos-FernΓ‘ndez ! This file was ported from Lean 3 source module ring_theory.dedekind_domain.adic_valuation ! leanprover-community/mathlib commit a8e7ac804fc39df0340c64906075787e0c90fa60 ! Please do not edit these lines, except to modify the commit id ! if you have ported upstream changes. -/ import Mathbin.RingTheory.DedekindDomain.Ideal import Mathbin.RingTheory.Valuation.ExtendToLocalization import Mathbin.RingTheory.Valuation.ValuationSubring import Mathbin.RingTheory.Polynomial.Cyclotomic.Basic import Mathbin.Topology.Algebra.ValuedField /-! # Adic valuations on Dedekind domains Given a Dedekind domain `R` of Krull dimension 1 and a maximal ideal `v` of `R`, we define the `v`-adic valuation on `R` and its extension to the field of fractions `K` of `R`. We prove several properties of this valuation, including the existence of uniformizers. We define the completion of `K` with respect to the `v`-adic valuation, denoted `v.adic_completion`,and its ring of integers, denoted `v.adic_completion_integers`. ## Main definitions - `is_dedekind_domain.height_one_spectrum.int_valuation v` is the `v`-adic valuation on `R`. - `is_dedekind_domain.height_one_spectrum.valuation v` is the `v`-adic valuation on `K`. - `is_dedekind_domain.height_one_spectrum.adic_completion v` is the completion of `K` with respect to its `v`-adic valuation. - `is_dedekind_domain.height_one_spectrum.adic_completion_integers v` is the ring of integers of `v.adic_completion`. ## Main results - `is_dedekind_domain.height_one_spectrum.int_valuation_le_one` : The `v`-adic valuation on `R` is bounded above by 1. - `is_dedekind_domain.height_one_spectrum.int_valuation_lt_one_iff_dvd` : The `v`-adic valuation of `r ∈ R` is less than 1 if and only if `v` divides the ideal `(r)`. - `is_dedekind_domain.height_one_spectrum.int_valuation_le_pow_iff_dvd` : The `v`-adic valuation of `r ∈ R` is less than or equal to `multiplicative.of_add (-n)` if and only if `vⁿ` divides the ideal `(r)`. - `is_dedekind_domain.height_one_spectrum.int_valuation_exists_uniformizer` : There exists `Ο€ ∈ R` with `v`-adic valuation `multiplicative.of_add (-1)`. - `is_dedekind_domain.height_one_spectrum.valuation_of_mk'` : The `v`-adic valuation of `r/s ∈ K` is the valuation of `r` divided by the valuation of `s`. - `is_dedekind_domain.height_one_spectrum.valuation_of_algebra_map` : The `v`-adic valuation on `K` extends the `v`-adic valuation on `R`. - `is_dedekind_domain.height_one_spectrum.valuation_exists_uniformizer` : There exists `Ο€ ∈ K` with `v`-adic valuation `multiplicative.of_add (-1)`. ## Implementation notes We are only interested in Dedekind domains with Krull dimension 1. ## References * [G. J. Janusz, *Algebraic Number Fields*][janusz1996] * [J.W.S. Cassels, A. FrΓΆlich, *Algebraic Number Theory*][cassels1967algebraic] * [J. Neukirch, *Algebraic Number Theory*][Neukirch1992] ## Tags dedekind domain, dedekind ring, adic valuation -/ noncomputable section open Classical DiscreteValuation open Multiplicative IsDedekindDomain variable {R : Type _} [CommRing R] [IsDomain R] [IsDedekindDomain R] {K : Type _} [Field K] [Algebra R K] [IsFractionRing R K] (v : HeightOneSpectrum R) namespace IsDedekindDomain.HeightOneSpectrum /-! ### Adic valuations on the Dedekind domain R -/ /-- The additive `v`-adic valuation of `r ∈ R` is the exponent of `v` in the factorization of the ideal `(r)`, if `r` is nonzero, or infinity, if `r = 0`. `int_valuation_def` is the corresponding multiplicative valuation. -/ def intValuationDef (r : R) : β„€β‚˜β‚€ := if r = 0 then 0 else Multiplicative.ofAdd (-(Associates.mk v.asIdeal).count (Associates.mk (Ideal.span {r} : Ideal R)).factors : β„€) #align is_dedekind_domain.height_one_spectrum.int_valuation_def IsDedekindDomain.HeightOneSpectrum.intValuationDef theorem intValuationDef_if_pos {r : R} (hr : r = 0) : v.intValuationDef r = 0 := if_pos hr #align is_dedekind_domain.height_one_spectrum.int_valuation_def_if_pos IsDedekindDomain.HeightOneSpectrum.intValuationDef_if_pos theorem intValuationDef_if_neg {r : R} (hr : r β‰  0) : v.intValuationDef r = Multiplicative.ofAdd (-(Associates.mk v.asIdeal).count (Associates.mk (Ideal.span {r} : Ideal R)).factors : β„€) := if_neg hr #align is_dedekind_domain.height_one_spectrum.int_valuation_def_if_neg IsDedekindDomain.HeightOneSpectrum.intValuationDef_if_neg /-- Nonzero elements have nonzero adic valuation. -/ theorem int_valuation_ne_zero (x : R) (hx : x β‰  0) : v.intValuationDef x β‰  0 := by rw [int_valuation_def, if_neg hx] exact WithZero.coe_ne_zero #align is_dedekind_domain.height_one_spectrum.int_valuation_ne_zero IsDedekindDomain.HeightOneSpectrum.int_valuation_ne_zero /-- Nonzero divisors have nonzero valuation. -/ theorem int_valuation_ne_zero' (x : nonZeroDivisors R) : v.intValuationDef x β‰  0 := v.int_valuation_ne_zero x (nonZeroDivisors.coe_ne_zero x) #align is_dedekind_domain.height_one_spectrum.int_valuation_ne_zero' IsDedekindDomain.HeightOneSpectrum.int_valuation_ne_zero' /-- Nonzero divisors have valuation greater than zero. -/ theorem int_valuation_zero_le (x : nonZeroDivisors R) : 0 < v.intValuationDef x := by rw [v.int_valuation_def_if_neg (nonZeroDivisors.coe_ne_zero x)] exact WithZero.zero_lt_coe _ #align is_dedekind_domain.height_one_spectrum.int_valuation_zero_le IsDedekindDomain.HeightOneSpectrum.int_valuation_zero_le /-- The `v`-adic valuation on `R` is bounded above by 1. -/ theorem int_valuation_le_one (x : R) : v.intValuationDef x ≀ 1 := by rw [int_valuation_def] by_cases hx : x = 0 Β· rw [if_pos hx] exact WithZero.zero_le 1 Β· rw [if_neg hx, ← WithZero.coe_one, ← ofAdd_zero, WithZero.coe_le_coe, of_add_le, Right.neg_nonpos_iff] exact Int.coe_nat_nonneg _ #align is_dedekind_domain.height_one_spectrum.int_valuation_le_one IsDedekindDomain.HeightOneSpectrum.int_valuation_le_one /-- The `v`-adic valuation of `r ∈ R` is less than 1 if and only if `v` divides the ideal `(r)`. -/ theorem int_valuation_lt_one_iff_dvd (r : R) : v.intValuationDef r < 1 ↔ v.asIdeal ∣ Ideal.span {r} := by rw [int_valuation_def] split_ifs with hr Β· simpa [hr] using WithZero.zero_lt_coe _ Β· rw [← WithZero.coe_one, ← ofAdd_zero, WithZero.coe_lt_coe, of_add_lt, neg_lt_zero, ← Int.ofNat_zero, Int.ofNat_lt, zero_lt_iff] have h : (Ideal.span {r} : Ideal R) β‰  0 := by rw [Ne.def, Ideal.zero_eq_bot, Ideal.span_singleton_eq_bot] exact hr apply Associates.count_ne_zero_iff_dvd h (by apply v.irreducible) #align is_dedekind_domain.height_one_spectrum.int_valuation_lt_one_iff_dvd IsDedekindDomain.HeightOneSpectrum.int_valuation_lt_one_iff_dvd /-- The `v`-adic valuation of `r ∈ R` is less than `multiplicative.of_add (-n)` if and only if `vⁿ` divides the ideal `(r)`. -/ theorem int_valuation_le_pow_iff_dvd (r : R) (n : β„•) : v.intValuationDef r ≀ Multiplicative.ofAdd (-(n : β„€)) ↔ v.asIdeal ^ n ∣ Ideal.span {r} := by rw [int_valuation_def] split_ifs with hr Β· simp_rw [hr, Ideal.dvd_span_singleton, zero_le', Submodule.zero_mem] Β· rw [WithZero.coe_le_coe, of_add_le, neg_le_neg_iff, Int.ofNat_le, Ideal.dvd_span_singleton, ← Associates.le_singleton_iff, Associates.prime_pow_dvd_iff_le (associates.mk_ne_zero'.mpr hr) (by apply v.associates_irreducible)] #align is_dedekind_domain.height_one_spectrum.int_valuation_le_pow_iff_dvd IsDedekindDomain.HeightOneSpectrum.int_valuation_le_pow_iff_dvd /-- The `v`-adic valuation of `0 : R` equals 0. -/ theorem IntValuation.map_zero' : v.intValuationDef 0 = 0 := v.intValuationDef_if_pos (Eq.refl 0) #align is_dedekind_domain.height_one_spectrum.int_valuation.map_zero' IsDedekindDomain.HeightOneSpectrum.IntValuation.map_zero' /-- The `v`-adic valuation of `1 : R` equals 1. -/ theorem IntValuation.map_one' : v.intValuationDef 1 = 1 := by rw [v.int_valuation_def_if_neg (zero_ne_one.symm : (1 : R) β‰  0), Ideal.span_singleton_one, ← Ideal.one_eq_top, Associates.mk_one, Associates.factors_one, Associates.count_zero (by apply v.associates_irreducible), Int.ofNat_zero, neg_zero, ofAdd_zero, WithZero.coe_one] #align is_dedekind_domain.height_one_spectrum.int_valuation.map_one' IsDedekindDomain.HeightOneSpectrum.IntValuation.map_one' /-- The `v`-adic valuation of a product equals the product of the valuations. -/ theorem IntValuation.map_mul' (x y : R) : v.intValuationDef (x * y) = v.intValuationDef x * v.intValuationDef y := by simp only [int_valuation_def] by_cases hx : x = 0 Β· rw [hx, MulZeroClass.zero_mul, if_pos (Eq.refl _), MulZeroClass.zero_mul] Β· by_cases hy : y = 0 Β· rw [hy, MulZeroClass.mul_zero, if_pos (Eq.refl _), MulZeroClass.mul_zero] Β· rw [if_neg hx, if_neg hy, if_neg (mul_ne_zero hx hy), ← WithZero.coe_mul, WithZero.coe_inj, ← ofAdd_add, ← Ideal.span_singleton_mul_span_singleton, ← Associates.mk_mul_mk, ← neg_add, Associates.count_mul (by apply associates.mk_ne_zero'.mpr hx) (by apply associates.mk_ne_zero'.mpr hy) (by apply v.associates_irreducible)] rfl #align is_dedekind_domain.height_one_spectrum.int_valuation.map_mul' IsDedekindDomain.HeightOneSpectrum.IntValuation.map_mul' theorem IntValuation.le_max_iff_min_le {a b c : β„•} : Multiplicative.ofAdd (-c : β„€) ≀ max (Multiplicative.ofAdd (-a : β„€)) (Multiplicative.ofAdd (-b : β„€)) ↔ min a b ≀ c := by rw [le_max_iff, of_add_le, of_add_le, neg_le_neg_iff, neg_le_neg_iff, Int.ofNat_le, Int.ofNat_le, ← min_le_iff] #align is_dedekind_domain.height_one_spectrum.int_valuation.le_max_iff_min_le IsDedekindDomain.HeightOneSpectrum.IntValuation.le_max_iff_min_le /-- The `v`-adic valuation of a sum is bounded above by the maximum of the valuations. -/ theorem IntValuation.map_add_le_max' (x y : R) : v.intValuationDef (x + y) ≀ max (v.intValuationDef x) (v.intValuationDef y) := by by_cases hx : x = 0 Β· rw [hx, zero_add] conv_rhs => rw [int_valuation_def, if_pos (Eq.refl _)] rw [max_eq_right (WithZero.zero_le (v.int_valuation_def y))] exact le_refl _ Β· by_cases hy : y = 0 Β· rw [hy, add_zero] conv_rhs => rw [max_comm, int_valuation_def, if_pos (Eq.refl _)] rw [max_eq_right (WithZero.zero_le (v.int_valuation_def x))] exact le_refl _ Β· by_cases hxy : x + y = 0 Β· rw [int_valuation_def, if_pos hxy] exact zero_le' Β· rw [v.int_valuation_def_if_neg hxy, v.int_valuation_def_if_neg hx, v.int_valuation_def_if_neg hy, [anonymous], int_valuation.le_max_iff_min_le] set nmin := min ((Associates.mk v.as_ideal).count (Associates.mk (Ideal.span {x})).factors) ((Associates.mk v.as_ideal).count (Associates.mk (Ideal.span {y})).factors) have h_dvd_x : x ∈ v.as_ideal ^ nmin := by rw [← Associates.le_singleton_iff x nmin _, Associates.prime_pow_dvd_iff_le (associates.mk_ne_zero'.mpr hx) _] exact min_le_left _ _ apply v.associates_irreducible have h_dvd_y : y ∈ v.as_ideal ^ nmin := by rw [← Associates.le_singleton_iff y nmin _, Associates.prime_pow_dvd_iff_le (associates.mk_ne_zero'.mpr hy) _] exact min_le_right _ _ apply v.associates_irreducible have h_dvd_xy : Associates.mk v.as_ideal ^ nmin ≀ Associates.mk (Ideal.span {x + y}) := by rw [Associates.le_singleton_iff] exact Ideal.add_mem (v.as_ideal ^ nmin) h_dvd_x h_dvd_y rw [Associates.prime_pow_dvd_iff_le (associates.mk_ne_zero'.mpr hxy) _] at h_dvd_xy exact h_dvd_xy apply v.associates_irreducible #align is_dedekind_domain.height_one_spectrum.int_valuation.map_add_le_max' IsDedekindDomain.HeightOneSpectrum.IntValuation.map_add_le_max' /-- The `v`-adic valuation on `R`. -/ def intValuation : Valuation R β„€β‚˜β‚€ where toFun := v.intValuationDef map_zero' := IntValuation.map_zero' v map_one' := IntValuation.map_one' v map_mul' := IntValuation.map_mul' v map_add_le_max' := IntValuation.map_add_le_max' v #align is_dedekind_domain.height_one_spectrum.int_valuation IsDedekindDomain.HeightOneSpectrum.intValuation /-- There exists `Ο€ ∈ R` with `v`-adic valuation `multiplicative.of_add (-1)`. -/ theorem int_valuation_exists_uniformizer : βˆƒ Ο€ : R, v.intValuationDef Ο€ = Multiplicative.ofAdd (-1 : β„€) := by have hv : _root_.irreducible (Associates.mk v.as_ideal) := v.associates_irreducible have hlt : v.as_ideal ^ 2 < v.as_ideal := by rw [← Ideal.dvdNotUnit_iff_lt] exact ⟨v.ne_bot, v.as_ideal, (not_congr Ideal.isUnit_iff).mpr (Ideal.IsPrime.ne_top v.is_prime), sq v.as_ideal⟩ obtain βŸ¨Ο€, mem, nmem⟩ := SetLike.exists_of_lt hlt have hΟ€ : Associates.mk (Ideal.span {Ο€}) β‰  0 := by rw [Associates.mk_ne_zero'] intro h rw [h] at nmem exact nmem (Submodule.zero_mem (v.as_ideal ^ 2)) use Ο€ rw [int_valuation_def, if_neg (associates.mk_ne_zero'.mp hΟ€), WithZero.coe_inj] apply congr_arg rw [neg_inj, ← Int.ofNat_one, Int.coe_nat_inj'] rw [← Ideal.dvd_span_singleton, ← Associates.mk_le_mk_iff_dvd_iff] at mem nmem rw [← pow_one (Associates.mk v.as_ideal), Associates.prime_pow_dvd_iff_le hΟ€ hv] at mem rw [Associates.mk_pow, Associates.prime_pow_dvd_iff_le hΟ€ hv, not_le] at nmem exact Nat.eq_of_le_of_lt_succ mem nmem #align is_dedekind_domain.height_one_spectrum.int_valuation_exists_uniformizer IsDedekindDomain.HeightOneSpectrum.int_valuation_exists_uniformizer /-! ### Adic valuations on the field of fractions `K` -/ /-- The `v`-adic valuation of `x ∈ K` is the valuation of `r` divided by the valuation of `s`, where `r` and `s` are chosen so that `x = r/s`. -/ def valuation (v : HeightOneSpectrum R) : Valuation K β„€β‚˜β‚€ := v.intValuation.extendToLocalization (fun r hr => Set.mem_compl <| v.int_valuation_ne_zero' ⟨r, hr⟩) K #align is_dedekind_domain.height_one_spectrum.valuation IsDedekindDomain.HeightOneSpectrum.valuation theorem valuation_def (x : K) : v.Valuation x = v.intValuation.extendToLocalization (fun r hr => Set.mem_compl (v.int_valuation_ne_zero' ⟨r, hr⟩)) K x := rfl #align is_dedekind_domain.height_one_spectrum.valuation_def IsDedekindDomain.HeightOneSpectrum.valuation_def /-- The `v`-adic valuation of `r/s ∈ K` is the valuation of `r` divided by the valuation of `s`. -/ theorem valuation_of_mk' {r : R} {s : nonZeroDivisors R} : v.Valuation (IsLocalization.mk' K r s) = v.intValuation r / v.intValuation s := by erw [valuation_def, (IsLocalization.toLocalizationMap (nonZeroDivisors R) K).lift_mk', div_eq_mul_inv, mul_eq_mul_left_iff] left rw [Units.val_inv_eq_inv_val, inv_inj] rfl #align is_dedekind_domain.height_one_spectrum.valuation_of_mk' IsDedekindDomain.HeightOneSpectrum.valuation_of_mk' /-- The `v`-adic valuation on `K` extends the `v`-adic valuation on `R`. -/ theorem valuation_of_algebraMap (r : R) : v.Valuation (algebraMap R K r) = v.intValuation r := by rw [valuation_def, Valuation.extendToLocalization_apply_map_apply] #align is_dedekind_domain.height_one_spectrum.valuation_of_algebra_map IsDedekindDomain.HeightOneSpectrum.valuation_of_algebraMap /-- The `v`-adic valuation on `R` is bounded above by 1. -/ theorem valuation_le_one (r : R) : v.Valuation (algebraMap R K r) ≀ 1 := by rw [valuation_of_algebra_map] exact v.int_valuation_le_one r #align is_dedekind_domain.height_one_spectrum.valuation_le_one IsDedekindDomain.HeightOneSpectrum.valuation_le_one /-- The `v`-adic valuation of `r ∈ R` is less than 1 if and only if `v` divides the ideal `(r)`. -/ theorem valuation_lt_one_iff_dvd (r : R) : v.Valuation (algebraMap R K r) < 1 ↔ v.asIdeal ∣ Ideal.span {r} := by rw [valuation_of_algebra_map] exact v.int_valuation_lt_one_iff_dvd r #align is_dedekind_domain.height_one_spectrum.valuation_lt_one_iff_dvd IsDedekindDomain.HeightOneSpectrum.valuation_lt_one_iff_dvd variable (K) /-- There exists `Ο€ ∈ K` with `v`-adic valuation `multiplicative.of_add (-1)`. -/ theorem valuation_exists_uniformizer : βˆƒ Ο€ : K, v.Valuation Ο€ = Multiplicative.ofAdd (-1 : β„€) := by obtain ⟨r, hr⟩ := v.int_valuation_exists_uniformizer use algebraMap R K r rw [valuation_def, Valuation.extendToLocalization_apply_map_apply] exact hr #align is_dedekind_domain.height_one_spectrum.valuation_exists_uniformizer IsDedekindDomain.HeightOneSpectrum.valuation_exists_uniformizer /-- Uniformizers are nonzero. -/ theorem valuation_uniformizer_ne_zero : Classical.choose (v.valuation_exists_uniformizer K) β‰  0 := haveI hu := Classical.choose_spec (v.valuation_exists_uniformizer K) (Valuation.ne_zero_iff _).mp (ne_of_eq_of_ne hu WithZero.coe_ne_zero) #align is_dedekind_domain.height_one_spectrum.valuation_uniformizer_ne_zero IsDedekindDomain.HeightOneSpectrum.valuation_uniformizer_ne_zero /-! ### Completions with respect to adic valuations Given a Dedekind domain `R` with field of fractions `K` and a maximal ideal `v` of `R`, we define the completion of `K` with respect to its `v`-adic valuation, denoted `v.adic_completion`, and its ring of integers, denoted `v.adic_completion_integers`. -/ variable {K} /-- `K` as a valued field with the `v`-adic valuation. -/ def adicValued : Valued K β„€β‚˜β‚€ := Valued.mk' v.Valuation #align is_dedekind_domain.height_one_spectrum.adic_valued IsDedekindDomain.HeightOneSpectrum.adicValued theorem adicValued_apply {x : K} : (v.adicValued.V : _) x = v.Valuation x := rfl #align is_dedekind_domain.height_one_spectrum.adic_valued_apply IsDedekindDomain.HeightOneSpectrum.adicValued_apply variable (K) /-- The completion of `K` with respect to its `v`-adic valuation. -/ def AdicCompletion := @UniformSpace.Completion K v.adicValued.toUniformSpace #align is_dedekind_domain.height_one_spectrum.adic_completion IsDedekindDomain.HeightOneSpectrum.AdicCompletion instance : Field (v.adicCompletion K) := @UniformSpace.Completion.field K _ v.adicValued.toUniformSpace _ _ v.adicValued.to_uniformAddGroup instance : Inhabited (v.adicCompletion K) := ⟨0⟩ instance valuedAdicCompletion : Valued (v.adicCompletion K) β„€β‚˜β‚€ := @Valued.valuedCompletion _ _ _ _ v.adicValued #align is_dedekind_domain.height_one_spectrum.valued_adic_completion IsDedekindDomain.HeightOneSpectrum.valuedAdicCompletion theorem valuedAdicCompletion_def {x : v.adicCompletion K} : Valued.v x = @Valued.extension K _ _ _ (adicValued v) x := rfl #align is_dedekind_domain.height_one_spectrum.valued_adic_completion_def IsDedekindDomain.HeightOneSpectrum.valuedAdicCompletion_def instance adicCompletion_completeSpace : CompleteSpace (v.adicCompletion K) := @UniformSpace.Completion.completeSpace K v.adicValued.toUniformSpace #align is_dedekind_domain.height_one_spectrum.adic_completion_complete_space IsDedekindDomain.HeightOneSpectrum.adicCompletion_completeSpace instance AdicCompletion.hasLiftT : HasLiftT K (v.adicCompletion K) := (inferInstance : HasLiftT K (@UniformSpace.Completion K v.adicValued.toUniformSpace)) #align is_dedekind_domain.height_one_spectrum.adic_completion.has_lift_t IsDedekindDomain.HeightOneSpectrum.AdicCompletion.hasLiftT /-- The ring of integers of `adic_completion`. -/ def adicCompletionIntegers : ValuationSubring (v.adicCompletion K) := Valued.v.ValuationSubring #align is_dedekind_domain.height_one_spectrum.adic_completion_integers IsDedekindDomain.HeightOneSpectrum.adicCompletionIntegers instance : Inhabited (adicCompletionIntegers K v) := ⟨0⟩ variable (R K) theorem mem_adicCompletionIntegers {x : v.adicCompletion K} : x ∈ v.adicCompletionIntegers K ↔ (Valued.v x : β„€β‚˜β‚€) ≀ 1 := Iff.rfl #align is_dedekind_domain.height_one_spectrum.mem_adic_completion_integers IsDedekindDomain.HeightOneSpectrum.mem_adicCompletionIntegers section AlgebraInstances instance (priority := 100) adicValued.has_uniform_continuous_const_smul' : @UniformContinuousConstSMul R K v.adicValued.toUniformSpace _ := @uniformContinuousConstSMul_of_continuousConstSMul R K _ _ _ v.adicValued.toUniformSpace _ _ #align is_dedekind_domain.height_one_spectrum.adic_valued.has_uniform_continuous_const_smul' IsDedekindDomain.HeightOneSpectrum.adicValued.has_uniform_continuous_const_smul' instance adicValued.uniformContinuousConstSMul : @UniformContinuousConstSMul K K v.adicValued.toUniformSpace _ := @Ring.uniformContinuousConstSMul K _ v.adicValued.toUniformSpace _ _ #align is_dedekind_domain.height_one_spectrum.adic_valued.has_uniform_continuous_const_smul IsDedekindDomain.HeightOneSpectrum.adicValued.uniformContinuousConstSMul instance AdicCompletion.algebra' : Algebra R (v.adicCompletion K) := @UniformSpace.Completion.algebra K _ v.adicValued.toUniformSpace _ _ R _ _ (adicValued.has_uniform_continuous_const_smul' R K v) #align is_dedekind_domain.height_one_spectrum.adic_completion.algebra' IsDedekindDomain.HeightOneSpectrum.AdicCompletion.algebra' @[simp] theorem coe_smul_adicCompletion (r : R) (x : K) : (↑(r β€’ x) : v.adicCompletion K) = r β€’ (↑x : v.adicCompletion K) := @UniformSpace.Completion.coe_smul R K v.adicValued.toUniformSpace _ _ r x #align is_dedekind_domain.height_one_spectrum.coe_smul_adic_completion IsDedekindDomain.HeightOneSpectrum.coe_smul_adicCompletion instance : Algebra K (v.adicCompletion K) := @UniformSpace.Completion.algebra' K _ v.adicValued.toUniformSpace _ _ theorem algebraMap_adic_completion' : ⇑(algebraMap R <| v.adicCompletion K) = coe ∘ algebraMap R K := rfl #align is_dedekind_domain.height_one_spectrum.algebra_map_adic_completion' IsDedekindDomain.HeightOneSpectrum.algebraMap_adic_completion' theorem algebraMap_adicCompletion : ⇑(algebraMap K <| v.adicCompletion K) = coe := rfl #align is_dedekind_domain.height_one_spectrum.algebra_map_adic_completion IsDedekindDomain.HeightOneSpectrum.algebraMap_adicCompletion instance : IsScalarTower R K (v.adicCompletion K) := @UniformSpace.Completion.isScalarTower R K K v.adicValued.toUniformSpace _ _ _ (adicValued.has_uniform_continuous_const_smul' R K v) _ _ instance : Algebra R (v.adicCompletionIntegers K) where smul r x := ⟨r β€’ (x : v.adicCompletion K), by have h : (algebraMap R (adicCompletion K v)) r = (coe <| algebraMap R K r) := rfl rw [Algebra.smul_def] refine' ValuationSubring.mul_mem _ _ _ _ x.2 rw [mem_adic_completion_integers, h, Valued.valuedCompletion_apply] exact v.valuation_le_one _⟩ toFun r := ⟨coe <| algebraMap R K r, by simpa only [mem_adic_completion_integers, Valued.valuedCompletion_apply] using v.valuation_le_one _⟩ map_one' := by simp only [map_one] <;> rfl map_mul' x y := by ext simp_rw [RingHom.map_mul, Subring.coe_mul, Subtype.coe_mk, UniformSpace.Completion.coe_mul] map_zero' := by simp only [map_zero] <;> rfl map_add' x y := by ext simp_rw [RingHom.map_add, Subring.coe_add, Subtype.coe_mk, UniformSpace.Completion.coe_add] commutes' r x := by rw [mul_comm] smul_def' r x := by ext simp only [Subring.coe_mul, [anonymous], Algebra.smul_def] rfl @[simp] theorem coe_smul_adicCompletionIntegers (r : R) (x : v.adicCompletionIntegers K) : (↑(r β€’ x) : v.adicCompletion K) = r β€’ (x : v.adicCompletion K) := rfl #align is_dedekind_domain.height_one_spectrum.coe_smul_adic_completion_integers IsDedekindDomain.HeightOneSpectrum.coe_smul_adicCompletionIntegers instance : NoZeroSMulDivisors R (v.adicCompletionIntegers K) where eq_zero_or_eq_zero_of_smul_eq_zero c x hcx := by rw [Algebra.smul_def, mul_eq_zero] at hcx refine' hcx.imp_left fun hc => _ letI : UniformSpace K := v.adic_valued.to_uniform_space rw [← map_zero (algebraMap R (v.adic_completion_integers K))] at hc exact IsFractionRing.injective R K (UniformSpace.Completion.coe_injective K (subtype.ext_iff.mp hc)) instance AdicCompletion.is_scalar_tower' : IsScalarTower R (v.adicCompletionIntegers K) (v.adicCompletion K) where smul_assoc x y z := by simp only [Algebra.smul_def] apply mul_assoc #align is_dedekind_domain.height_one_spectrum.adic_completion.is_scalar_tower' IsDedekindDomain.HeightOneSpectrum.AdicCompletion.is_scalar_tower' end AlgebraInstances end IsDedekindDomain.HeightOneSpectrum
Class Monad (m : Type -> Type) : Type := { return_ : forall {A}, A -> m A ; bind : forall {A}, m A -> forall {B}, (A -> m B) -> m B (* monad laws *) ; right_unit : forall A (a : m A), a = bind a (@return_ A) ; left_unit : forall A (a : A) B (f : A -> m B), f a = bind (return_ a) f ; associativity : forall A (ma : m A) B f C (g : B -> m C), bind ma (fun x => bind (f x) g) = bind (bind ma f) g }. Notation "a >>= f" := (bind a f) (at level 50, left associativity). Notation "a >> b" := (a >>= (fun _ => b)) (at level 50, left associativity). Notation "'do' a <- e ; c" := (e >>= (fun a => c)) (at level 60, right associativity). Instance OptionMonad : Monad option := { return_ := Some ; bind A m B f := match m with | None => None | Some a => f a end }. Proof. destruct a; reflexivity. reflexivity. destruct ma. intros B f C g. destruct (f a); reflexivity. reflexivity. Defined.
Le Bouchon Des Batignolles also called BB 17, a brewery located in the heart of the Batignolles district, at 2 rue Lemercier, angle with the rue des Dames, welcomes you in a friendly and festive decor. The Boss, Marseille offers a cuisine with straight came from Corsica. Good small Mediterranean dishes that take you to the dry landscape and brings warmth. The concept: An endless tapas menu of any kind to eat alone or with friends, perfect with a good bottle of "CuvΓ©e Castellu Vecchiu" straight from the mountains Corsica. BUT .... The BB17 is not only a restaurant but also a wine bar where we just drink shots with friends listening to good music. IN BB17 you can privatize part or all of the restaurant to come and celebrate your birthday or other festive event. The BB17 or subtle blend between Corsica and Marseille. The sun, the accent singing and good humor.
lemma continuous_on_closed_Union: assumes "finite I" "\<And>i. i \<in> I \<Longrightarrow> closed (U i)" "\<And>i. i \<in> I \<Longrightarrow> continuous_on (U i) f" shows "continuous_on (\<Union> i \<in> I. U i) f"
module Main where import Mandelbrot import Data.Complex (Complex((:+))) import Graphics.UI.SDL.Video import Graphics.UI.SDL.Event (quitRequested) import Graphics.UI.SDL.Types (Surface(surfacePixels)) import Foreign.C.String (newCString) import Foreign.C.Types (CInt(..)) import Foreign.Ptr import Foreign.Storable import Data.Int (Int32(..), Int64(..)) import Data.Word import Control.Monad import Control.Concurrent (threadDelay) import Data.Array import Data.Array.MArray import Data.Array.IO import Data.IORef import System.Random import System.IO.Unsafe sdlWindowPosCentered :: CInt sdlWindowPosCentered = 0x2fff0000 iterations :: Int iterations = 100 width :: Int width = 1024 height :: Int height = 786 widthF :: Double widthF = fromIntegral width heightF :: Double heightF = fromIntegral height mandelbrotI :: RealFloat a => Complex a -> Int mandelbrotI = mandelbrot iterations {-# INLINE mandelbrotI #-} while :: Monad m => m Bool -> m a -> m () while test action = do val <- test if val then action >> while test action else return () main :: IO () main = do videoInit nullPtr title <- (newCString "Handelbrot") palette <- array (1, iterations) <$> sequence ( [sequence (i, (fromIntegral <$> randomRIO (0 :: Word, 0xffffff)) :: IO Word32) | i <- [1..iterations-1]] ++ [return (iterations, 0)] ) window <- createWindow title sdlWindowPosCentered sdlWindowPosCentered (CInt $ fromIntegral width) (CInt $ fromIntegral height) 0 surface <- getWindowSurface window lockSurface surface pixels <- liftM (castPtr.surfacePixels) $ peek surface :: IO (Ptr Word32) forM_ [0..height-1] (\y_ -> do forM_ [0..width-1] (\x_ -> do let x = 3/widthF * (fromIntegral x_) - 2 y = -2/heightF * (fromIntegral y_) + 1 mand = mandelbrotI (x :+ y) pokeElemOff pixels (x_ + y_*width) $ palette ! mand) updateWindowSurface window) unlockSurface surface updateWindowSurface window while (liftM not $ quitRequested) $ threadDelay 100000
/- Copyright (c) 2018 Andreas Swerdlow. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andreas Swerdlow -/ import Mathlib.PrePort import Mathlib.Lean3Lib.init.default import Mathlib.deprecated.subring import Mathlib.algebra.group_with_zero.power import Mathlib.PostPort universes u_1 l u_2 namespace Mathlib class is_subfield {F : Type u_1} [field F] (S : set F) extends is_subring S where inv_mem : βˆ€ {x : F}, x ∈ S β†’ x⁻¹ ∈ S protected instance is_subfield.field {F : Type u_1} [field F] (S : set F) [is_subfield S] : field β†₯S := let cr_inst : comm_ring β†₯S := subset.comm_ring; field.mk comm_ring.add sorry comm_ring.zero sorry sorry comm_ring.neg comm_ring.sub sorry sorry comm_ring.mul sorry comm_ring.one sorry sorry sorry sorry sorry (fun (x : β†₯S) => { val := ↑x⁻¹, property := sorry }) sorry sorry sorry theorem is_subfield.pow_mem {F : Type u_1} [field F] {a : F} {n : β„€} {s : set F} [is_subfield s] (h : a ∈ s) : a ^ n ∈ s := int.cases_on n (fun (n : β„•) => is_submonoid.pow_mem h) fun (n : β„•) => is_subfield.inv_mem (is_submonoid.pow_mem h) protected instance univ.is_subfield {F : Type u_1} [field F] : is_subfield set.univ := is_subfield.mk fun (x : F) (αΎ° : x ∈ set.univ) => trivial /- note: in the next two declarations, if we let type-class inference figure out the instance `ring_hom.is_subring_preimage` then that instance only applies when particular instances of `is_add_subgroup _` and `is_submonoid _` are chosen (which are not the default ones). If we specify it explicitly, then it doesn't complain. -/ protected instance preimage.is_subfield {F : Type u_1} [field F] {K : Type u_2} [field K] (f : F β†’+* K) (s : set K) [is_subfield s] : is_subfield (⇑f ⁻¹' s) := is_subfield.mk fun (a : F) (ha : coe_fn f a ∈ s) => (fun (this : coe_fn f (a⁻¹) ∈ s) => this) (eq.mpr (id (Eq._oldrec (Eq.refl (coe_fn f (a⁻¹) ∈ s)) (ring_hom.map_inv f a))) (is_subfield.inv_mem ha)) protected instance image.is_subfield {F : Type u_1} [field F] {K : Type u_2} [field K] (f : F β†’+* K) (s : set F) [is_subfield s] : is_subfield (⇑f '' s) := is_subfield.mk fun (a : K) (_x : a ∈ ⇑f '' s) => sorry protected instance range.is_subfield {F : Type u_1} [field F] {K : Type u_2} [field K] (f : F β†’+* K) : is_subfield (set.range ⇑f) := eq.mpr (id (Eq._oldrec (Eq.refl (is_subfield (set.range ⇑f))) (Eq.symm set.image_univ))) (image.is_subfield f set.univ) namespace field /-- `field.closure s` is the minimal subfield that includes `s`. -/ def closure {F : Type u_1} [field F] (S : set F) : set F := set_of fun (x : F) => βˆƒ (y : F), βˆƒ (H : y ∈ ring.closure S), βˆƒ (z : F), βˆƒ (H : z ∈ ring.closure S), y / z = x theorem ring_closure_subset {F : Type u_1} [field F] {S : set F} : ring.closure S βŠ† closure S := fun (x : F) (hx : x ∈ ring.closure S) => Exists.intro x (Exists.intro hx (Exists.intro 1 (Exists.intro is_submonoid.one_mem (div_one x)))) protected instance closure.is_submonoid {F : Type u_1} [field F] {S : set F} : is_submonoid (closure S) := sorry protected instance closure.is_subfield {F : Type u_1} [field F] {S : set F} : is_subfield (closure S) := sorry theorem mem_closure {F : Type u_1} [field F] {S : set F} {a : F} (ha : a ∈ S) : a ∈ closure S := ring_closure_subset (ring.mem_closure ha) theorem subset_closure {F : Type u_1} [field F] {S : set F} : S βŠ† closure S := fun (_x : F) => mem_closure theorem closure_subset {F : Type u_1} [field F] {S : set F} {T : set F} [is_subfield T] (H : S βŠ† T) : closure S βŠ† T := sorry theorem closure_subset_iff {F : Type u_1} [field F] (s : set F) (t : set F) [is_subfield t] : closure s βŠ† t ↔ s βŠ† t := { mp := set.subset.trans subset_closure, mpr := closure_subset } theorem closure_mono {F : Type u_1} [field F] {s : set F} {t : set F} (H : s βŠ† t) : closure s βŠ† closure t := closure_subset (set.subset.trans H subset_closure) end field theorem is_subfield_Union_of_directed {F : Type u_1} [field F] {ΞΉ : Type u_2} [hΞΉ : Nonempty ΞΉ] (s : ΞΉ β†’ set F) [βˆ€ (i : ΞΉ), is_subfield (s i)] (directed : βˆ€ (i j : ΞΉ), βˆƒ (k : ΞΉ), s i βŠ† s k ∧ s j βŠ† s k) : is_subfield (set.Union fun (i : ΞΉ) => s i) := sorry protected instance is_subfield.inter {F : Type u_1} [field F] (S₁ : set F) (Sβ‚‚ : set F) [is_subfield S₁] [is_subfield Sβ‚‚] : is_subfield (S₁ ∩ Sβ‚‚) := is_subfield.mk fun (x : F) (hx : x ∈ S₁ ∩ Sβ‚‚) => { left := is_subfield.inv_mem (and.left hx), right := is_subfield.inv_mem (and.right hx) } protected instance is_subfield.Inter {F : Type u_1} [field F] {ΞΉ : Sort u_2} (S : ΞΉ β†’ set F) [h : βˆ€ (y : ΞΉ), is_subfield (S y)] : is_subfield (set.Inter S) := is_subfield.mk fun (x : F) (hx : x ∈ set.Inter S) => iff.mpr set.mem_Inter fun (y : ΞΉ) => is_subfield.inv_mem (iff.mp set.mem_Inter hx y) end Mathlib
/- Copyright (c) 2018 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import tactic.suggest -- No other imports, for fast testing /- Turn off trace messages so they don't pollute the test build: -/ set_option trace.silence_library_search true /- For debugging purposes, we can display the list of lemmas: -/ -- set_option trace.suggest true namespace test.library_search -- Check that `library_search` fails if there are no goals. example : true := begin trivial, success_if_fail { library_search }, end -- Verify that `library_search` solves goals via `solve_by_elim` when the library isn't -- even needed. example (P : Prop) (p : P) : P := by library_search example (P : Prop) (p : P) (np : Β¬P) : false := by library_search example (X : Type) (P : Prop) (x : X) (h : Ξ  x : X, x = x β†’ P) : P := by library_search example (Ξ± : Prop) : Ξ± β†’ Ξ± := by library_search -- says: `exact id` example (p : Prop) [decidable p] : (¬¬p) β†’ p := by library_search -- says: `exact not_not.mp` example (a b : Prop) (h : a ∧ b) : a := by library_search -- says: `exact h.left` example (P Q : Prop) [decidable P] [decidable Q]: (Β¬ Q β†’ Β¬ P) β†’ (P β†’ Q) := by library_search -- says: `exact not_imp_not.mp` example (a b : β„•) : a + b = b + a := by library_search -- says: `exact add_comm a b` example (n m k : β„•) : n * (m - k) = n * m - n * k := by library_search -- says: `exact mul_tsub n m k` example (n m k : β„•) : n * m - n * k = n * (m - k) := by library_search -- says: `exact eq.symm (mul_tsub n m k)` example {Ξ± : Type} (x y : Ξ±) : x = y ↔ y = x := by library_search -- says: `exact eq_comm` example (a b : β„•) (ha : 0 < a) (hb : 0 < b) : 0 < a + b := by library_search -- says: `exact add_pos ha hb` section synonym -- Synonym `>` for `<` in another part of the goal example (a b : β„•) (ha : a > 0) (hb : 0 < b) : 0 < a + b := by library_search -- says: `exact add_pos ha hb` example (a b : β„•) (h : a ∣ b) (w : b > 0) : a ≀ b := by library_search -- says: `exact nat.le_of_dvd w h` example (a b : β„•) (h : a ∣ b) (w : b > 0) : b β‰₯ a := by library_search -- says: `exact nat.le_of_dvd w h` -- A lemma with head symbol `Β¬` can be used to prove `Β¬ p` or `βŠ₯` example (a : β„•) : Β¬ (a < 0) := by library_search -- says `exact not_lt_bot` example (a : β„•) (h : a < 0) : false := by library_search -- says `exact not_lt_bot h` -- An inductive type hides the constructor's arguments enough -- so that `library_search` doesn't accidentally close the goal. inductive P : β„• β†’ Prop | gt_in_head {n : β„•} : n < 0 β†’ P n -- This lemma with `>` as its head symbol should also be found for goals with head symbol `<`. lemma lemma_with_gt_in_head (a : β„•) (h : P a) : 0 > a := by { cases h, assumption } -- This lemma with `false` as its head symbols should also be found for goals with head symbol `Β¬`. lemma lemma_with_false_in_head (a b : β„•) (h1 : a < b) (h2 : P a) : false := by { apply nat.not_lt_zero, cases h2, assumption } example (a : β„•) (h : P a) : 0 > a := by library_search -- says `exact lemma_with_gt_in_head a h` example (a : β„•) (h : P a) : a < 0 := by library_search -- says `exact lemma_with_gt_in_head a h` example (a b : β„•) (h1 : a < b) (h2 : P a) : false := by library_search -- says `exact lemma_with_false_in_head a b h1 h2` example (a b : β„•) (h1 : a < b) : Β¬ (P a) := by library_search! -- says `exact lemma_with_false_in_head a b h1` end synonym -- We even find `iff` results: example : βˆ€ P : Prop, Β¬(P ↔ Β¬P) := by library_search! -- says: `Ξ» (a : Prop), (iff_not_self a).mp` example {a b c : β„•} (h₁ : a ∣ c) (hβ‚‚ : a ∣ b + c) : a ∣ b := by library_search -- says `exact (nat.dvd_add_left h₁).mp hβ‚‚` -- Checking examples from issue #2220 example {Ξ± : Sort*} (h : empty) : Ξ± := by library_search example {Ξ± : Type*} (h : empty) : Ξ± := by library_search def map_from_sum {A B C : Type} (f : A β†’ C) (g : B β†’ C) : (A βŠ• B) β†’ C := by library_search -- Test that we can set the transparency level in `apply` -- to change how aggressively we unfold definitions while trying to apply lemmas. lemma bind_singleton {Ξ± Ξ²} (x : Ξ±) (f : Ξ± β†’ list Ξ²) : list.bind [x] f = f x := begin success_if_fail { library_search { md := tactic.transparency.reducible }, }, library_search!, end constant f : β„• β†’ β„• axiom F (a b : β„•) : f a ≀ f b ↔ a ≀ b example (a b : β„•) (h : a ≀ b) : f a ≀ f b := by library_search -- Test #3432 theorem nonzero_gt_one (n : β„•) : Β¬ n = 0 β†’ n β‰₯ 1 := by library_search! -- `exact nat.pos_of_ne_zero` example (L : list (list β„•)) : list β„• := by library_search using L example (n m : β„•) : β„• := by library_search using n m example (P Q : list β„•) (h : β„•) : list β„• := by library_search using h Q example (P Q : list β„•) (h : β„•) : list β„• := by library_search using P Q -- Make sure `library_search` finds nothing when we list too many hypotheses after `using`. example (P Q R S T : list β„•) : list β„• := begin success_if_fail { library_search using P Q R S T, }, exact [] end -- Tests for #3428 constants (x y w z : β„•) axiom not_axiom : Β¬ x = y axiom ne_axiom : w β‰  z example : x β‰  y := by library_search example : Β¬ w = z := by library_search structure foo := (a : nat) (b : nat) constants (k l : foo) axiom ne_axiom' (h : k.a β‰  0) : k.b β‰  0 axiom not_axiom' (h : l.a β‰  0) : Β¬ l.b = 0 example (hq : k.a β‰  0) : k.b β‰  0 := by library_search example (hq : l.a β‰  0) : Β¬ l.b = 0 := by library_search end test.library_search
lemmas prime_dvd_power_int_iff = prime_dvd_power_iff[where ?'a = int]
{-# OPTIONS --cumulativity #-} open import Agda.Primitive postulate X : Set P : (A : Set) β†’ A β†’ Set id : βˆ€ a (A : Set a) β†’ A β†’ A works : P (X β†’ X) (id (lsuc lzero) X) fails : P _ (id (lsuc lzero) X)
/- Copyright (c) 2019 Johan Commelin. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Riccardo Brasca, Johan Commelin ! This file was ported from Lean 3 source module field_theory.minpoly.field ! leanprover-community/mathlib commit cbdf7b565832144d024caa5a550117c6df0204a5 ! Please do not edit these lines, except to modify the commit id ! if you have ported upstream changes. -/ import Mathbin.Data.Polynomial.FieldDivision import Mathbin.FieldTheory.Minpoly.Basic import Mathbin.RingTheory.Algebraic /-! # Minimal polynomials on an algebra over a field This file specializes the theory of minpoly to the setting of field extensions and derives some well-known properties, amongst which the fact that minimal polynomials are irreducible, and uniquely determined by their defining property. -/ open Classical Polynomial open Polynomial Set Function minpoly namespace minpoly variable {A B : Type _} variable (A) [Field A] section Ring variable [Ring B] [Algebra A B] (x : B) /-- If an element `x` is a root of a nonzero polynomial `p`, then the degree of `p` is at least the degree of the minimal polynomial of `x`. See also `gcd_domain_degree_le_of_ne_zero` which relaxes the assumptions on `A` in exchange for stronger assumptions on `B`. -/ theorem degree_le_of_ne_zero {p : A[X]} (pnz : p β‰  0) (hp : Polynomial.aeval x p = 0) : degree (minpoly A x) ≀ degree p := calc degree (minpoly A x) ≀ degree (p * C (leadingCoeff p)⁻¹) := min A x (monic_mul_leadingCoeff_inv pnz) (by simp [hp]) _ = degree p := degree_mul_leadingCoeff_inv p pnz #align minpoly.degree_le_of_ne_zero minpoly.degree_le_of_ne_zero theorem ne_zero_of_finite_field_extension (e : B) [FiniteDimensional A B] : minpoly A e β‰  0 := minpoly.ne_zero <| isIntegral_of_noetherian (IsNoetherian.iff_fg.2 inferInstance) _ #align minpoly.ne_zero_of_finite_field_extension minpoly.ne_zero_of_finite_field_extension /-- The minimal polynomial of an element `x` is uniquely characterized by its defining property: if there is another monic polynomial of minimal degree that has `x` as a root, then this polynomial is equal to the minimal polynomial of `x`. See also `minpoly.gcd_unique` which relaxes the assumptions on `A` in exchange for stronger assumptions on `B`. -/ theorem unique {p : A[X]} (pmonic : p.Monic) (hp : Polynomial.aeval x p = 0) (pmin : βˆ€ q : A[X], q.Monic β†’ Polynomial.aeval x q = 0 β†’ degree p ≀ degree q) : p = minpoly A x := by have hx : IsIntegral A x := ⟨p, pmonic, hp⟩ symm; apply eq_of_sub_eq_zero by_contra hnz have := degree_le_of_ne_zero A x hnz (by simp [hp]) contrapose! this apply degree_sub_lt _ (NeZero hx) Β· rw [(monic hx).leadingCoeff, pmonic.leading_coeff] Β· exact le_antisymm (min A x pmonic hp) (pmin (minpoly A x) (monic hx) (aeval A x)) #align minpoly.unique minpoly.unique /-- If an element `x` is a root of a polynomial `p`, then the minimal polynomial of `x` divides `p`. See also `minpoly.gcd_domain_dvd` which relaxes the assumptions on `A` in exchange for stronger assumptions on `B`. -/ theorem dvd {p : A[X]} (hp : Polynomial.aeval x p = 0) : minpoly A x ∣ p := by by_cases hp0 : p = 0 Β· simp only [hp0, dvd_zero] have hx : IsIntegral A x := by rw [← isAlgebraic_iff_isIntegral] exact ⟨p, hp0, hp⟩ rw [← dvd_iff_mod_by_monic_eq_zero (monic hx)] by_contra hnz have := degree_le_of_ne_zero A x hnz _ Β· contrapose! this exact degree_mod_by_monic_lt _ (monic hx) Β· rw [← mod_by_monic_add_div p (monic hx)] at hp simpa using hp #align minpoly.dvd minpoly.dvd theorem dvd_map_of_isScalarTower (A K : Type _) {R : Type _} [CommRing A] [Field K] [CommRing R] [Algebra A K] [Algebra A R] [Algebra K R] [IsScalarTower A K R] (x : R) : minpoly K x ∣ (minpoly A x).map (algebraMap A K) := by refine' minpoly.dvd K x _ rw [aeval_map_algebra_map, minpoly.aeval] #align minpoly.dvd_map_of_is_scalar_tower minpoly.dvd_map_of_isScalarTower theorem dvd_map_of_is_scalar_tower' (R : Type _) {S : Type _} (K L : Type _) [CommRing R] [CommRing S] [Field K] [CommRing L] [Algebra R S] [Algebra R K] [Algebra S L] [Algebra K L] [Algebra R L] [IsScalarTower R K L] [IsScalarTower R S L] (s : S) : minpoly K (algebraMap S L s) ∣ map (algebraMap R K) (minpoly R s) := by apply minpoly.dvd K (algebraMap S L s) rw [← map_aeval_eq_aeval_map, minpoly.aeval, map_zero] rw [← IsScalarTower.algebraMap_eq, ← IsScalarTower.algebraMap_eq] #align minpoly.dvd_map_of_is_scalar_tower' minpoly.dvd_map_of_is_scalar_tower' /-- If `y` is a conjugate of `x` over a field `K`, then it is a conjugate over a subring `R`. -/ theorem aeval_of_isScalarTower (R : Type _) {K T U : Type _} [CommRing R] [Field K] [CommRing T] [Algebra R K] [Algebra K T] [Algebra R T] [IsScalarTower R K T] [CommSemiring U] [Algebra K U] [Algebra R U] [IsScalarTower R K U] (x : T) (y : U) (hy : Polynomial.aeval y (minpoly K x) = 0) : Polynomial.aeval y (minpoly R x) = 0 := aeval_map_algebraMap K y (minpoly R x) β–Έ evalβ‚‚_eq_zero_of_dvd_of_evalβ‚‚_eq_zero (algebraMap K U) y (minpoly.dvd_map_of_isScalarTower R K x) hy #align minpoly.aeval_of_is_scalar_tower minpoly.aeval_of_isScalarTower variable {A x} theorem eq_of_irreducible_of_monic [Nontrivial B] {p : A[X]} (hp1 : Irreducible p) (hp2 : Polynomial.aeval x p = 0) (hp3 : p.Monic) : p = minpoly A x := let ⟨q, hq⟩ := dvd A x hp2 eq_of_monic_of_associated hp3 (monic ⟨p, ⟨hp3, hp2⟩⟩) <| mul_one (minpoly A x) β–Έ hq.symm β–Έ Associated.mul_left _ <| associated_one_iff_isUnit.2 <| (hp1.isUnit_or_isUnit hq).resolve_left <| not_isUnit A x #align minpoly.eq_of_irreducible_of_monic minpoly.eq_of_irreducible_of_monic theorem eq_of_irreducible [Nontrivial B] {p : A[X]} (hp1 : Irreducible p) (hp2 : Polynomial.aeval x p = 0) : p * C p.leadingCoeff⁻¹ = minpoly A x := by have : p.leading_coeff β‰  0 := leading_coeff_ne_zero.mpr hp1.ne_zero apply eq_of_irreducible_of_monic Β· exact Associated.irreducible ⟨⟨C p.leading_coeff⁻¹, C p.leading_coeff, by rwa [← C_mul, inv_mul_cancel, C_1], by rwa [← C_mul, mul_inv_cancel, C_1]⟩, rfl⟩ hp1 Β· rw [aeval_mul, hp2, MulZeroClass.zero_mul] Β· rwa [Polynomial.Monic, leading_coeff_mul, leading_coeff_C, mul_inv_cancel] #align minpoly.eq_of_irreducible minpoly.eq_of_irreducible /-- If `y` is the image of `x` in an extension, their minimal polynomials coincide. We take `h : y = algebra_map L T x` as an argument because `rw h` typically fails since `is_integral R y` depends on y. -/ theorem eq_of_algebraMap_eq {K S T : Type _} [Field K] [CommRing S] [CommRing T] [Algebra K S] [Algebra K T] [Algebra S T] [IsScalarTower K S T] (hST : Function.Injective (algebraMap S T)) {x : S} {y : T} (hx : IsIntegral K x) (h : y = algebraMap S T x) : minpoly K x = minpoly K y := minpoly.unique _ _ (minpoly.monic hx) (by rw [h, aeval_algebra_map_apply, minpoly.aeval, RingHom.map_zero]) fun q q_monic root_q => minpoly.min _ _ q_monic ((aeval_algebraMap_eq_zero_iff_of_injective hST).mp (h β–Έ root_q : Polynomial.aeval (algebraMap S T x) q = 0)) #align minpoly.eq_of_algebra_map_eq minpoly.eq_of_algebraMap_eq theorem add_algebraMap {B : Type _} [CommRing B] [Algebra A B] {x : B} (hx : IsIntegral A x) (a : A) : minpoly A (x + algebraMap A B a) = (minpoly A x).comp (X - C a) := by refine' (minpoly.unique _ _ ((minpoly.monic hx).comp_X_sub_C _) _ fun q qmo hq => _).symm Β· simp [aeval_comp] Β· have : (Polynomial.aeval x) (q.comp (X + C a)) = 0 := by simpa [aeval_comp] using hq have H := minpoly.min A x (qmo.comp_X_add_C _) this rw [degree_eq_nat_degree qmo.ne_zero, degree_eq_nat_degree ((minpoly.monic hx).comp_X_sub_C _).NeZero, WithBot.coe_le_coe, nat_degree_comp, nat_degree_X_sub_C, mul_one] rwa [degree_eq_nat_degree (minpoly.ne_zero hx), degree_eq_nat_degree (qmo.comp_X_add_C _).NeZero, WithBot.coe_le_coe, nat_degree_comp, nat_degree_X_add_C, mul_one] at H #align minpoly.add_algebra_map minpoly.add_algebraMap theorem sub_algebraMap {B : Type _} [CommRing B] [Algebra A B] {x : B} (hx : IsIntegral A x) (a : A) : minpoly A (x - algebraMap A B a) = (minpoly A x).comp (X + C a) := by simpa [sub_eq_add_neg] using add_algebra_map hx (-a) #align minpoly.sub_algebra_map minpoly.sub_algebraMap section AlgHomFintype /-- A technical finiteness result. -/ noncomputable def Fintype.subtypeProd {E : Type _} {X : Set E} (hX : X.Finite) {L : Type _} (F : E β†’ Multiset L) : Fintype (βˆ€ x : X, { l : L // l ∈ F x }) := let hX := Finite.fintype hX Pi.fintype #align minpoly.fintype.subtype_prod minpoly.Fintype.subtypeProd variable (F E K : Type _) [Field F] [Ring E] [CommRing K] [IsDomain K] [Algebra F E] [Algebra F K] [FiniteDimensional F E] -- Marked as `noncomputable!` since this definition takes multiple seconds to compile, -- and isn't very computable in practice (since neither `finrank` nor `fin_basis` are). /-- Function from Hom_K(E,L) to pi type Ξ  (x : basis), roots of min poly of x -/ noncomputable def rootsOfMinPolyPiType (Ο† : E →ₐ[F] K) (x : range (FiniteDimensional.finBasis F E : _ β†’ E)) : { l : K // l ∈ (((minpoly F x.1).map (algebraMap F K)).roots : Multiset K) } := βŸ¨Ο† x, by rw [mem_roots_map (minpoly.ne_zero_of_finite_field_extension F x.val), Subtype.val_eq_coe, ← aeval_def, aeval_alg_hom_apply, minpoly.aeval, map_zero]⟩ #align minpoly.roots_of_min_poly_pi_type minpoly.rootsOfMinPolyPiType theorem aux_inj_roots_of_min_poly : Injective (rootsOfMinPolyPiType F E K) := by intro f g h suffices (f : E β†’β‚—[F] K) = g by rwa [FunLike.ext'_iff] at this⊒ rw [funext_iff] at h exact LinearMap.ext_on (FiniteDimensional.finBasis F E).span_eq fun e he => subtype.ext_iff.mp (h ⟨e, he⟩) #align minpoly.aux_inj_roots_of_min_poly minpoly.aux_inj_roots_of_min_poly /-- Given field extensions `E/F` and `K/F`, with `E/F` finite, there are finitely many `F`-algebra homomorphisms `E →ₐ[K] K`. -/ noncomputable instance AlgHom.fintype : Fintype (E →ₐ[F] K) := @Fintype.ofInjective _ _ (Fintype.subtypeProd (finite_range (FiniteDimensional.finBasis F E)) fun e => ((minpoly F e).map (algebraMap F K)).roots) _ (aux_inj_roots_of_min_poly F E K) #align minpoly.alg_hom.fintype minpoly.AlgHom.fintype end AlgHomFintype variable (B) [Nontrivial B] /-- If `B/K` is a nontrivial algebra over a field, and `x` is an element of `K`, then the minimal polynomial of `algebra_map K B x` is `X - C x`. -/ theorem eq_x_sub_c (a : A) : minpoly A (algebraMap A B a) = X - C a := eq_x_sub_c_of_algebraMap_inj a (algebraMap A B).Injective #align minpoly.eq_X_sub_C minpoly.eq_x_sub_c theorem eq_x_sub_C' (a : A) : minpoly A a = X - C a := eq_x_sub_c A a #align minpoly.eq_X_sub_C' minpoly.eq_x_sub_C' variable (A) /-- The minimal polynomial of `0` is `X`. -/ @[simp] theorem zero : minpoly A (0 : B) = X := by simpa only [add_zero, C_0, sub_eq_add_neg, neg_zero, RingHom.map_zero] using eq_X_sub_C B (0 : A) #align minpoly.zero minpoly.zero /-- The minimal polynomial of `1` is `X - 1`. -/ @[simp] theorem one : minpoly A (1 : B) = X - 1 := by simpa only [RingHom.map_one, C_1, sub_eq_add_neg] using eq_X_sub_C B (1 : A) #align minpoly.one minpoly.one end Ring section IsDomain variable [Ring B] [IsDomain B] [Algebra A B] variable {A} {x : B} /-- A minimal polynomial is prime. -/ theorem prime (hx : IsIntegral A x) : Prime (minpoly A x) := by refine' ⟨NeZero hx, not_is_unit A x, _⟩ rintro p q ⟨d, h⟩ have : Polynomial.aeval x (p * q) = 0 := by simp [h, aeval A x] replace : Polynomial.aeval x p = 0 ∨ Polynomial.aeval x q = 0 := by simpa exact Or.imp (dvd A x) (dvd A x) this #align minpoly.prime minpoly.prime /-- If `L/K` is a field extension and an element `y` of `K` is a root of the minimal polynomial of an element `x ∈ L`, then `y` maps to `x` under the field embedding. -/ theorem root {x : B} (hx : IsIntegral A x) {y : A} (h : IsRoot (minpoly A x) y) : algebraMap A B y = x := by have key : minpoly A x = X - C y := eq_of_monic_of_associated (monic hx) (monic_X_sub_C y) (associated_of_dvd_dvd ((irreducible_X_sub_C y).dvd_symm (irreducible hx) (dvd_iff_isRoot.2 h)) (dvd_iff_isRoot.2 h)) have := aeval A x rwa [key, AlgHom.map_sub, aeval_X, aeval_C, sub_eq_zero, eq_comm] at this #align minpoly.root minpoly.root /-- The constant coefficient of the minimal polynomial of `x` is `0` if and only if `x = 0`. -/ @[simp] theorem coeff_zero_eq_zero (hx : IsIntegral A x) : coeff (minpoly A x) 0 = 0 ↔ x = 0 := by constructor Β· intro h have zero_root := zero_is_root_of_coeff_zero_eq_zero h rw [← root hx zero_root] exact RingHom.map_zero _ Β· rintro rfl simp #align minpoly.coeff_zero_eq_zero minpoly.coeff_zero_eq_zero /-- The minimal polynomial of a nonzero element has nonzero constant coefficient. -/ theorem coeff_zero_ne_zero (hx : IsIntegral A x) (h : x β‰  0) : coeff (minpoly A x) 0 β‰  0 := by contrapose! h simpa only [hx, coeff_zero_eq_zero] using h #align minpoly.coeff_zero_ne_zero minpoly.coeff_zero_ne_zero end IsDomain end minpoly
g1 : Nat -> Nat g1 x = 5 --g1 _ = 6 g2 : (Nat, Nat) -> Nat g2 (x, y) = x --g2 (a, b) = 6 g3 : (Nat, Nat) -> Nat g3 (x, y) = x g3 _ = 6 f : Monad m => m (Nat, Nat) h2 : Monad m => m Nat h2 = do (x, y) <- f -- | (a, b) => pure 5 pure x h3 : Monad m => m Nat h3 = do (x, y) <- f | _ => pure 5 pure x
module index where -- For a brief presentation of every single module, head over to import Everything -- Otherwise, here is an exhaustive, stern list of all the available modules.
data Baz : Int -> Type where AddThings : (x : Int) -> (y : Int) -> Baz (x + y) addBaz : (x : Int) -> Baz x -> Int addBaz (x + y) (AddThings x z) = x + y
_throw_table_error() = throw(ArgumentError("Please specify the column that contains the targets explicitly, or provide a target-extraction-function as first parameter. see parameter 'f' in ?targets.")) # required data container interface LearnBase.nobs(dt::AbstractDataFrame) = DataFrames.nrow(dt) LearnBase.getobs(dt::AbstractDataFrame, idx) = dt[idx,:] LearnBase.nobs(dt::DataFrameRow) = 1 # it is a observation function LearnBase.getobs(dt::DataFrameRow, idx) idx == 1:1 || throw(ArgumentError( "Attempting to read multiple rows ($idx) with a single row")) return dt end # custom data subset in form of SubDataFrame LearnBase.datasubset(dt::AbstractDataFrame, idx, ::ObsDim.Undefined) = @view dt[idx, :] # throw error if no target extraction function is supplied LearnBase.gettarget(::typeof(identity), dt::AbstractDataFrame) = _throw_table_error() LearnBase.gettarget(::typeof(identity), dt::DataFrameRow) = _throw_table_error() # convenience syntax to allow column name LearnBase.gettarget(col::Symbol, dt::AbstractDataFrame) = dt[1, col] LearnBase.gettarget(col::Symbol, dt::DataFrameRow) = dt[col] LearnBase.gettarget(fun, dt::AbstractDataFrame) = fun(dt) # avoid copy when target extraction function is supplied MLDataPattern.getobs_targetfun(dt::AbstractDataFrame) = dt # -------------------------------------------------------------------- #= Use Requires.jl once fixed for 0.6 import DataTables: DataTables, AbstractDataTable # required data container interface LearnBase.nobs(dt::AbstractDataTable) = DataTables.nrow(dt) LearnBase.getobs(dt::AbstractDataTable, idx) = dt[idx,:] # custom data subset in form of SubDataFrame LearnBase.datasubset(dt::AbstractDataTable, idx, ::ObsDim.Undefined) = view(dt, idx) # throw error if no target extraction function is supplied LearnBase.gettarget(dt::AbstractDataTable) = _throw_table_error() # convenience syntax to allow column name LearnBase.gettarget(col::Symbol, dt::AbstractDataTable) = dt[1, col] # avoid copy when target extraction function is supplied MLDataPattern.getobs_targetfun(dt::AbstractDataTable) = dt =#
* MB04UD EXAMPLE PROGRAM TEXT * Copyright (c) 2002-2020 NICONET e.V. * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, NMAX PARAMETER ( MMAX = 20, NMAX = 20 ) INTEGER LDA, LDE, LDQ, LDZ PARAMETER ( LDA = MMAX, LDE = MMAX, LDQ = MMAX, $ LDZ = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( NMAX,MMAX ) ) * PARAMETER ( LDWORK = NMAX+MMAX ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, J, M, N, RANKE CHARACTER*1 JOBQ, JOBZ * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), DWORK(LDWORK), E(LDE,NMAX), $ Q(LDQ,MMAX), Z(LDZ,NMAX) INTEGER ISTAIR(MMAX) * .. External Subroutines .. EXTERNAL MB04UD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, N, TOL IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99993 ) M ELSE IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99992 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,M ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,M ) JOBQ = 'N' JOBZ = 'N' * Reduce E to column echelon form and compute Q'*A*Z. CALL MB04UD( JOBQ, JOBZ, M, N, A, LDA, E, LDE, Q, LDQ, Z, LDZ, $ RANKE, ISTAIR, TOL, DWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99991 ) DO 10 I = 1, M WRITE ( NOUT, FMT = 99996 ) ( A(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99997 ) DO 100 I = 1, M WRITE ( NOUT, FMT = 99996 ) ( E(I,J), J = 1,N ) 100 CONTINUE WRITE ( NOUT, FMT = 99995 ) RANKE WRITE ( NOUT, FMT = 99994 ) ( ISTAIR(I), I = 1,M ) END IF END IF STOP * 99999 FORMAT (' MB04UD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB04UD = ',I2) 99997 FORMAT (' The transformed matrix E is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' The computed rank of E = ',I2) 99994 FORMAT (/' ISTAIR is ',/20(1X,I5)) 99993 FORMAT (/' M is out of range.',/' M = ',I5) 99992 FORMAT (/' N is out of range.',/' N = ',I5) 99991 FORMAT (' The transformed matrix A is ') END
function weight = subset_weight ( n, t ) %*****************************************************************************80 % %% SUBSET_WEIGHT computes the Hamming weight of a set. % % Discussion: % % The Hamming weight is simply the number of elements in the set. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 22 August 2011 % % Author: % % John Burkardt % % Reference: % % Donald Kreher, Douglas Simpson, % Combinatorial Algorithms, % CRC Press, 1998, % ISBN: 0-8493-3988-X, % LC: QA164.K73. % % Parameters: % % Input, integer N, the order of the master set, of which T % is a subset. N must be positive. % % Input, integer T(N), defines the subset T. % T(I) is 1 if I is an element of T, and 0 otherwise. % % Output, integer WEIGHT, the Hamming weight of the subset T. % % % Check. % subset_check ( n, t ); weight = sum ( t(1:n) ); return end
%% Copyright (C) 2014-2016, 2019, 2022-2023 Colin B. Macdonald %% Copyright (C) 2016 Lagu %% Copyright (C) 2016 Abhinav Tripathi %% Copyright (C) 2017 NVS Abhilash %% Copyright (C) 2020 Fernando Alvarruiz %% %% This file is part of OctSymPy. %% %% OctSymPy is free software; you can redistribute it and/or modify %% it under the terms of the GNU General Public License as published %% by the Free Software Foundation; either version 3 of the License, %% or (at your option) any later version. %% %% This software is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied warranty %% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See %% the GNU General Public License for more details. %% %% You should have received a copy of the GNU General Public %% License along with this software; see the file COPYING. %% If not, see <http://www.gnu.org/licenses/>. %% -*- texinfo -*- %% @defun mat_replace (@var{A}, @var{subs}, @var{rhs}) %% Private helper routine for setting symbolic array entries. %% %% @end defun function z = mat_replace(A, subs, b) if (length (subs) == 1 && islogical (subs{1})) %% A(logical) = B subs{1} = find (subs{1}); if isempty (subs{1}) z = A; return; end end %% Check when b is [] if (isempty(b)) switch length(subs) case 1 if strcmp(subs{1}, ':') z = sym([]); return end if (isempty (subs{1})) z = A; return end if rows(A) == 1 z = delete_col(A, subs{1}); return elseif columns(A) == 1 z = delete_row(A, subs{1}); return else z = sym([]); for i=1:A.size(2) z = [z subsref(A, substruct ('()', {':', i})).']; end z = subsasgn (z, substruct ('()', {subs{1}}), []); return end case 2 if (isempty (subs{1}) || isempty (subs{2})) z = A; return end if strcmp(subs{1}, ':') if strcmp(subs{2}, ':') z = sym(zeros(0,columns(A))); return else z = delete_col(A, subs{2}); return end elseif strcmp(subs{2}, ':') z = delete_row(A, subs{1}); return else error('A null assignment can only have one non-colon index.'); % Standard octave error end otherwise error('Unexpected subs input') end end if (length(subs) == 1 && strcmp(subs{1}, ':') && length(b) == 1) z = pycall_sympy__ ('return ones(_ins[0], _ins[1])*_ins[2],', uint64(A.size(1)), uint64(A.size(2)), sym(b)); return elseif (length(subs) == 1) % can use a single index to grow a vector, so we carefully deal with % vector vs linear index to matrix (not required for access) [n,m] = size(A); if (n == 0 || n == 1) c = subs{1}; r = ones(size(c)); elseif (m == 1) r = subs{1}; c = ones(size(r)); else % linear indices into 2D array % Octave 8 does not raise error from ind2sub so we do it ourselves sz = size (A); i = subs{1}; if (i > prod (sz)) error ('%d is out of bound %d (dimensions are %dx%d)\n', i, prod (sz), sz) end [r, c] = ind2sub (size (A), i); % keep all the indices in a row vector r = reshape (r, 1, []); c = reshape (c, 1, []); end elseif (length(subs) == 2) r = subs{1}; c = subs{2}; [n,m] = size(A); if (isnumeric(r) && ((isvector(r) || isempty(r)))) % no-op elseif (strcmp(r,':')) r = 1:n; elseif (islogical(r) && isvector(r) && (length(r) == n)) I = r; r = 1:n; r = r(I); else error('unknown 2d-indexing in rows') end if (isnumeric(c) && ((isvector(c) || isempty(c)))) % no-op elseif (strcmp(c,':')) c = 1:m; elseif (islogical(c) && isvector(c) && (length(c) == m)) J = c; c = 1:m; c = c(J); else error('unknown 2d-indexing in columns') end [r,c] = ndgrid(r,c); if ~(isscalar (b) || (isvector (r) && isvector (b)) || is_same_shape (r, b)) % vectors may have diff orientations but if we have matrices then % they must have the same shape (Octave/Matlab do this for double) error('A(I,J,...) = X: dimensions mismatch') end r = r(:); c = c(:); else error('unknown indexing') end z = mat_rclist_asgn(A, r, c, b); end function z = delete_col(A, subs) if isscalar (A) z = sym(zeros (1, 0)); else cmd = { 'A, subs = _ins' 'if isinstance(subs, Integer):' ' A.col_del(subs - 1)' ' return A,' 'for i in sorted(subs, reverse=True):' ' A.col_del(i - 1)' 'return A,' }; z = pycall_sympy__ (cmd, A, sym(subs)); end end function z = delete_row(A, subs) if isscalar (A) % no test coverage: not sure how to hit this z = sym(zeros (0, 1)); else cmd = { 'A, subs = _ins' 'if isinstance(subs, Integer):' ' A.row_del(subs - 1)' ' return A,' 'for i in sorted(subs, reverse=True):' ' A.row_del(i - 1)' 'return A,' }; z = pycall_sympy__ (cmd, A, sym(subs)); end end
/- Copyright (c) 2017 Johannes HΓΆlzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes HΓΆlzl, Mario Carneiro, Patrick Massot -/ import order.filter.small_sets import topology.subset_properties /-! # Uniform spaces Uniform spaces are a generalization of metric spaces and topological groups. Many concepts directly generalize to uniform spaces, e.g. * uniform continuity (in this file) * completeness (in `cauchy.lean`) * extension of uniform continuous functions to complete spaces (in `uniform_embedding.lean`) * totally bounded sets (in `cauchy.lean`) * totally bounded complete sets are compact (in `cauchy.lean`) A uniform structure on a type `X` is a filter `𝓀 X` on `X Γ— X` satisfying some conditions which makes it reasonable to say that `βˆ€αΆ  (p : X Γ— X) in 𝓀 X, ...` means "for all p.1 and p.2 in X close enough, ...". Elements of this filter are called entourages of `X`. The two main examples are: * If `X` is a metric space, `V ∈ 𝓀 X ↔ βˆƒ Ξ΅ > 0, { p | dist p.1 p.2 < Ξ΅ } βŠ† V` * If `G` is an additive topological group, `V ∈ 𝓀 G ↔ βˆƒ U ∈ 𝓝 (0 : G), {p | p.2 - p.1 ∈ U} βŠ† V` Those examples are generalizations in two different directions of the elementary example where `X = ℝ` and `V ∈ 𝓀 ℝ ↔ βˆƒ Ξ΅ > 0, { p | |p.2 - p.1| < Ξ΅ } βŠ† V` which features both the topological group structure on `ℝ` and its metric space structure. Each uniform structure on `X` induces a topology on `X` characterized by > `nhds_eq_comap_uniformity : βˆ€ {x : X}, 𝓝 x = comap (prod.mk x) (𝓀 X)` where `prod.mk x : X β†’ X Γ— X := (Ξ» y, (x, y))` is the partial evaluation of the product constructor. The dictionary with metric spaces includes: * an upper bound for `dist x y` translates into `(x, y) ∈ V` for some `V ∈ 𝓀 X` * a ball `ball x r` roughly corresponds to `uniform_space.ball x V := {y | (x, y) ∈ V}` for some `V ∈ 𝓀 X`, but the later is more general (it includes in particular both open and closed balls for suitable `V`). In particular we have: `is_open_iff_ball_subset {s : set X} : is_open s ↔ βˆ€ x ∈ s, βˆƒ V ∈ 𝓀 X, ball x V βŠ† s` The triangle inequality is abstracted to a statement involving the composition of relations in `X`. First note that the triangle inequality in a metric space is equivalent to `βˆ€ (x y z : X) (r r' : ℝ), dist x y ≀ r β†’ dist y z ≀ r' β†’ dist x z ≀ r + r'`. Then, for any `V` and `W` with type `set (X Γ— X)`, the composition `V β—‹ W : set (X Γ— X)` is defined as `{ p : X Γ— X | βˆƒ z, (p.1, z) ∈ V ∧ (z, p.2) ∈ W }`. In the metric space case, if `V = { p | dist p.1 p.2 ≀ r }` and `W = { p | dist p.1 p.2 ≀ r' }` then the triangle inequality, as reformulated above, says `V β—‹ W` is contained in `{p | dist p.1 p.2 ≀ r + r'}` which is the entourage associated to the radius `r + r'`. In general we have `mem_ball_comp (h : y ∈ ball x V) (h' : z ∈ ball y W) : z ∈ ball x (V β—‹ W)`. Note that this discussion does not depend on any axiom imposed on the uniformity filter, it is simply captured by the definition of composition. The uniform space axioms ask the filter `𝓀 X` to satisfy the following: * every `V ∈ 𝓀 X` contains the diagonal `id_rel = { p | p.1 = p.2 }`. This abstracts the fact that `dist x x ≀ r` for every non-negative radius `r` in the metric space case and also that `x - x` belongs to every neighborhood of zero in the topological group case. * `V ∈ 𝓀 X β†’ prod.swap '' V ∈ 𝓀 X`. This is tightly related the fact that `dist x y = dist y x` in a metric space, and to continuity of negation in the topological group case. * `βˆ€ V ∈ 𝓀 X, βˆƒ W ∈ 𝓀 X, W β—‹ W βŠ† V`. In the metric space case, it corresponds to cutting the radius of a ball in half and applying the triangle inequality. In the topological group case, it comes from continuity of addition at `(0, 0)`. These three axioms are stated more abstractly in the definition below, in terms of operations on filters, without directly manipulating entourages. ##Β Main definitions * `uniform_space X` is a uniform space structure on a type `X` * `uniform_continuous f` is a predicate saying a function `f : Ξ± β†’ Ξ²` between uniform spaces is uniformly continuous : `βˆ€ r ∈ 𝓀 Ξ², βˆ€αΆ  (x : Ξ± Γ— Ξ±) in 𝓀 Ξ±, (f x.1, f x.2) ∈ r` In this file we also define a complete lattice structure on the type `uniform_space X` of uniform structures on `X`, as well as the pullback (`uniform_space.comap`) of uniform structures coming from the pullback of filters. Like distance functions, uniform structures cannot be pushed forward in general. ## Notations Localized in `uniformity`, we have the notation `𝓀 X` for the uniformity on a uniform space `X`, and `β—‹` for composition of relations, seen as terms with type `set (X Γ— X)`. ## Implementation notes There is already a theory of relations in `data/rel.lean` where the main definition is `def rel (Ξ± Ξ² : Type*) := Ξ± β†’ Ξ² β†’ Prop`. The relations used in the current file involve only one type, but this is not the reason why we don't reuse `data/rel.lean`. We use `set (Ξ± Γ— Ξ±)` instead of `rel Ξ± Ξ±` because we really need sets to use the filter library, and elements of filters on `Ξ± Γ— Ξ±` have type `set (Ξ± Γ— Ξ±)`. The structure `uniform_space X` bundles a uniform structure on `X`, a topology on `X` and an assumption saying those are compatible. This may not seem mathematically reasonable at first, but is in fact an instance of the forgetful inheritance pattern. See Note [forgetful inheritance] below. ## References The formalization uses the books: * [N. Bourbaki, *General Topology*][bourbaki1966] * [I. M. James, *Topologies and Uniformities*][james1999] But it makes a more systematic use of the filter library. -/ open set filter classical open_locale classical topological_space filter set_option eqn_compiler.zeta true universes u /-! ### Relations, seen as `set (Ξ± Γ— Ξ±)` -/ variables {Ξ± : Type*} {Ξ² : Type*} {Ξ³ : Type*} {Ξ΄ : Type*} {ΞΉ : Sort*} /-- The identity relation, or the graph of the identity function -/ def id_rel {Ξ± : Type*} := {p : Ξ± Γ— Ξ± | p.1 = p.2} @[simp] theorem mem_id_rel {a b : Ξ±} : (a, b) ∈ @id_rel Ξ± ↔ a = b := iff.rfl @[simp] theorem id_rel_subset {s : set (Ξ± Γ— Ξ±)} : id_rel βŠ† s ↔ βˆ€ a, (a, a) ∈ s := by simp [subset_def]; exact forall_congr (Ξ» a, by simp) /-- The composition of relations -/ def comp_rel {Ξ± : Type u} (r₁ rβ‚‚ : set (Ξ±Γ—Ξ±)) := {p : Ξ± Γ— Ξ± | βˆƒz:Ξ±, (p.1, z) ∈ r₁ ∧ (z, p.2) ∈ rβ‚‚} localized "infix ` β—‹ `:55 := comp_rel" in uniformity @[simp] theorem mem_comp_rel {r₁ rβ‚‚ : set (Ξ±Γ—Ξ±)} {x y : Ξ±} : (x, y) ∈ r₁ β—‹ rβ‚‚ ↔ βˆƒ z, (x, z) ∈ r₁ ∧ (z, y) ∈ rβ‚‚ := iff.rfl @[simp] theorem swap_id_rel : prod.swap '' id_rel = @id_rel Ξ± := set.ext $ assume ⟨a, b⟩, by simp [image_swap_eq_preimage_swap]; exact eq_comm theorem monotone_comp_rel [preorder Ξ²] {f g : Ξ² β†’ set (Ξ±Γ—Ξ±)} (hf : monotone f) (hg : monotone g) : monotone (Ξ»x, (f x) β—‹ (g x)) := assume a b h p ⟨z, h₁, hβ‚‚βŸ©, ⟨z, hf h h₁, hg h hβ‚‚βŸ© @[mono] lemma comp_rel_mono {f g h k: set (Ξ±Γ—Ξ±)} (h₁ : f βŠ† h) (hβ‚‚ : g βŠ† k) : f β—‹ g βŠ† h β—‹ k := Ξ» ⟨x, y⟩ ⟨z, h, h'⟩, ⟨z, h₁ h, hβ‚‚ h'⟩ lemma prod_mk_mem_comp_rel {a b c : Ξ±} {s t : set (Ξ±Γ—Ξ±)} (h₁ : (a, c) ∈ s) (hβ‚‚ : (c, b) ∈ t) : (a, b) ∈ s β—‹ t := ⟨c, h₁, hβ‚‚βŸ© @[simp] lemma id_comp_rel {r : set (Ξ±Γ—Ξ±)} : id_rel β—‹ r = r := set.ext $ assume ⟨a, b⟩, by simp lemma comp_rel_assoc {r s t : set (Ξ±Γ—Ξ±)} : (r β—‹ s) β—‹ t = r β—‹ (s β—‹ t) := by ext p; cases p; simp only [mem_comp_rel]; tauto lemma left_subset_comp_rel {s t : set (Ξ± Γ— Ξ±)} (h : id_rel βŠ† t) : s βŠ† s β—‹ t := Ξ» ⟨x, y⟩ xy_in, ⟨y, xy_in, h $ by exact rfl⟩ lemma right_subset_comp_rel {s t : set (Ξ± Γ— Ξ±)} (h : id_rel βŠ† s) : t βŠ† s β—‹ t := Ξ» ⟨x, y⟩ xy_in, ⟨x, h $ by exact rfl, xy_in⟩ lemma subset_comp_self {s : set (Ξ± Γ— Ξ±)} (h : id_rel βŠ† s) : s βŠ† s β—‹ s := left_subset_comp_rel h lemma subset_iterate_comp_rel {s t : set (Ξ± Γ— Ξ±)} (h : id_rel βŠ† s) (n : β„•) : t βŠ† (((β—‹) s) ^[n] t) := begin induction n with n ihn generalizing t, exacts [subset.rfl, (right_subset_comp_rel h).trans ihn] end /-- The relation is invariant under swapping factors. -/ def symmetric_rel (V : set (Ξ± Γ— Ξ±)) : Prop := prod.swap ⁻¹' V = V /-- The maximal symmetric relation contained in a given relation. -/ def symmetrize_rel (V : set (Ξ± Γ— Ξ±)) : set (Ξ± Γ— Ξ±) := V ∩ prod.swap ⁻¹' V lemma symmetric_symmetrize_rel (V : set (Ξ± Γ— Ξ±)) : symmetric_rel (symmetrize_rel V) := by simp [symmetric_rel, symmetrize_rel, preimage_inter, inter_comm, ← preimage_comp] lemma symmetrize_rel_subset_self (V : set (Ξ± Γ— Ξ±)) : symmetrize_rel V βŠ† V := sep_subset _ _ @[mono] lemma symmetrize_mono {V W: set (Ξ± Γ— Ξ±)} (h : V βŠ† W) : symmetrize_rel V βŠ† symmetrize_rel W := inter_subset_inter h $ preimage_mono h lemma symmetric_rel.mk_mem_comm {V : set (Ξ± Γ— Ξ±)} (hV : symmetric_rel V) {x y : Ξ±} : (x, y) ∈ V ↔ (y, x) ∈ V := set.ext_iff.1 hV (y, x) lemma symmetric_rel_inter {U V : set (Ξ± Γ— Ξ±)} (hU : symmetric_rel U) (hV : symmetric_rel V) : symmetric_rel (U ∩ V) := begin unfold symmetric_rel at *, rw [preimage_inter, hU, hV], end /-- This core description of a uniform space is outside of the type class hierarchy. It is useful for constructions of uniform spaces, when the topology is derived from the uniform space. -/ structure uniform_space.core (Ξ± : Type u) := (uniformity : filter (Ξ± Γ— Ξ±)) (refl : π“Ÿ id_rel ≀ uniformity) (symm : tendsto prod.swap uniformity uniformity) (comp : uniformity.lift' (Ξ»s, s β—‹ s) ≀ uniformity) /-- An alternative constructor for `uniform_space.core`. This version unfolds various `filter`-related definitions. -/ def uniform_space.core.mk' {Ξ± : Type u} (U : filter (Ξ± Γ— Ξ±)) (refl : βˆ€ (r ∈ U) x, (x, x) ∈ r) (symm : βˆ€ r ∈ U, prod.swap ⁻¹' r ∈ U) (comp : βˆ€ r ∈ U, βˆƒ t ∈ U, t β—‹ t βŠ† r) : uniform_space.core Ξ± := ⟨U, Ξ» r ru, id_rel_subset.2 (refl _ ru), symm, begin intros r ru, rw [mem_lift'_sets], exact comp _ ru, apply monotone_comp_rel; exact monotone_id, end⟩ /-- Defining an `uniform_space.core` from a filter basis satisfying some uniformity-like axioms. -/ def uniform_space.core.mk_of_basis {Ξ± : Type u} (B : filter_basis (Ξ± Γ— Ξ±)) (refl : βˆ€ (r ∈ B) x, (x, x) ∈ r) (symm : βˆ€ r ∈ B, βˆƒ t ∈ B, t βŠ† prod.swap ⁻¹' r) (comp : βˆ€ r ∈ B, βˆƒ t ∈ B, t β—‹ t βŠ† r) : uniform_space.core Ξ± := { uniformity := B.filter, refl := B.has_basis.ge_iff.mpr (Ξ» r ru, id_rel_subset.2 $ refl _ ru), symm := (B.has_basis.tendsto_iff B.has_basis).mpr symm, comp := (has_basis.le_basis_iff (B.has_basis.lift' (monotone_comp_rel monotone_id monotone_id)) B.has_basis).mpr comp } /-- A uniform space generates a topological space -/ def uniform_space.core.to_topological_space {Ξ± : Type u} (u : uniform_space.core Ξ±) : topological_space Ξ± := { is_open := Ξ»s, βˆ€x∈s, { p : Ξ± Γ— Ξ± | p.1 = x β†’ p.2 ∈ s } ∈ u.uniformity, is_open_univ := by simp; intro; exact univ_mem, is_open_inter := assume s t hs ht x ⟨xs, xt⟩, by filter_upwards [hs x xs, ht x xt]; simp {contextual := tt}, is_open_sUnion := assume s hs x ⟨t, ts, xt⟩, by filter_upwards [hs t ts x xt] with p ph h using ⟨t, ts, ph h⟩ } lemma uniform_space.core_eq : βˆ€{u₁ uβ‚‚ : uniform_space.core Ξ±}, u₁.uniformity = uβ‚‚.uniformity β†’ u₁ = uβ‚‚ | ⟨u₁, _, _, _⟩ ⟨uβ‚‚, _, _, _⟩ h := by { congr, exact h } -- the topological structure is embedded in the uniform structure -- to avoid instance diamond issues. See Note [forgetful inheritance]. /-- A uniform space is a generalization of the "uniform" topological aspects of a metric space. It consists of a filter on `Ξ± Γ— Ξ±` called the "uniformity", which satisfies properties analogous to the reflexivity, symmetry, and triangle properties of a metric. A metric space has a natural uniformity, and a uniform space has a natural topology. A topological group also has a natural uniformity, even when it is not metrizable. -/ class uniform_space (Ξ± : Type u) extends topological_space Ξ±, uniform_space.core Ξ± := (is_open_uniformity : βˆ€s, is_open s ↔ (βˆ€x∈s, { p : Ξ± Γ— Ξ± | p.1 = x β†’ p.2 ∈ s } ∈ uniformity)) /-- Alternative constructor for `uniform_space Ξ±` when a topology is already given. -/ @[pattern] def uniform_space.mk' {Ξ±} (t : topological_space Ξ±) (c : uniform_space.core Ξ±) (is_open_uniformity : βˆ€s:set Ξ±, t.is_open s ↔ (βˆ€x∈s, { p : Ξ± Γ— Ξ± | p.1 = x β†’ p.2 ∈ s } ∈ c.uniformity)) : uniform_space Ξ± := ⟨c, is_open_uniformity⟩ /-- Construct a `uniform_space` from a `uniform_space.core`. -/ def uniform_space.of_core {Ξ± : Type u} (u : uniform_space.core Ξ±) : uniform_space Ξ± := { to_core := u, to_topological_space := u.to_topological_space, is_open_uniformity := assume a, iff.rfl } /-- Construct a `uniform_space` from a `u : uniform_space.core` and a `topological_space` structure that is equal to `u.to_topological_space`. -/ def uniform_space.of_core_eq {Ξ± : Type u} (u : uniform_space.core Ξ±) (t : topological_space Ξ±) (h : t = u.to_topological_space) : uniform_space Ξ± := { to_core := u, to_topological_space := t, is_open_uniformity := assume a, h.symm β–Έ iff.rfl } lemma uniform_space.to_core_to_topological_space (u : uniform_space Ξ±) : u.to_core.to_topological_space = u.to_topological_space := topological_space_eq $ funext $ assume s, by rw [uniform_space.core.to_topological_space, uniform_space.is_open_uniformity] @[ext] lemma uniform_space_eq : βˆ€{u₁ uβ‚‚ : uniform_space Ξ±}, u₁.uniformity = uβ‚‚.uniformity β†’ u₁ = uβ‚‚ | (uniform_space.mk' t₁ u₁ o₁) (uniform_space.mk' tβ‚‚ uβ‚‚ oβ‚‚) h := have u₁ = uβ‚‚, from uniform_space.core_eq h, have t₁ = tβ‚‚, from topological_space_eq $ funext $ assume s, by rw [o₁, oβ‚‚]; simp [this], by simp [*] lemma uniform_space.of_core_eq_to_core (u : uniform_space Ξ±) (t : topological_space Ξ±) (h : t = u.to_core.to_topological_space) : uniform_space.of_core_eq u.to_core t h = u := uniform_space_eq rfl /-- Replace topology in a `uniform_space` instance with a propositionally (but possibly not definitionally) equal one. -/ @[reducible] def uniform_space.replace_topology {Ξ± : Type*} [i : topological_space Ξ±] (u : uniform_space Ξ±) (h : i = u.to_topological_space) : uniform_space Ξ± := uniform_space.of_core_eq u.to_core i $ h.trans u.to_core_to_topological_space.symm lemma uniform_space.replace_topology_eq {Ξ± : Type*} [i : topological_space Ξ±] (u : uniform_space Ξ±) (h : i = u.to_topological_space) : u.replace_topology h = u := u.of_core_eq_to_core _ _ section uniform_space variables [uniform_space Ξ±] /-- The uniformity is a filter on Ξ± Γ— Ξ± (inferred from an ambient uniform space structure on Ξ±). -/ def uniformity (Ξ± : Type u) [uniform_space Ξ±] : filter (Ξ± Γ— Ξ±) := (@uniform_space.to_core Ξ± _).uniformity localized "notation `𝓀` := uniformity" in uniformity lemma is_open_uniformity {s : set Ξ±} : is_open s ↔ (βˆ€x∈s, { p : Ξ± Γ— Ξ± | p.1 = x β†’ p.2 ∈ s } ∈ 𝓀 Ξ±) := uniform_space.is_open_uniformity s lemma refl_le_uniformity : π“Ÿ id_rel ≀ 𝓀 Ξ± := (@uniform_space.to_core Ξ± _).refl instance uniformity.ne_bot [nonempty Ξ±] : ne_bot (𝓀 Ξ±) := begin inhabit Ξ±, refine (principal_ne_bot_iff.2 _).mono refl_le_uniformity, exact ⟨(default, default), rfl⟩ end lemma refl_mem_uniformity {x : Ξ±} {s : set (Ξ± Γ— Ξ±)} (h : s ∈ 𝓀 Ξ±) : (x, x) ∈ s := refl_le_uniformity h rfl lemma mem_uniformity_of_eq {x y : Ξ±} {s : set (Ξ± Γ— Ξ±)} (h : s ∈ 𝓀 Ξ±) (hx : x = y) : (x, y) ∈ s := hx β–Έ refl_mem_uniformity h lemma symm_le_uniformity : map (@prod.swap Ξ± Ξ±) (𝓀 _) ≀ (𝓀 _) := (@uniform_space.to_core Ξ± _).symm lemma comp_le_uniformity : (𝓀 Ξ±).lift' (Ξ»s:set (Ξ±Γ—Ξ±), s β—‹ s) ≀ 𝓀 Ξ± := (@uniform_space.to_core Ξ± _).comp lemma tendsto_swap_uniformity : tendsto (@prod.swap Ξ± Ξ±) (𝓀 Ξ±) (𝓀 Ξ±) := symm_le_uniformity lemma comp_mem_uniformity_sets {s : set (Ξ± Γ— Ξ±)} (hs : s ∈ 𝓀 Ξ±) : βˆƒ t ∈ 𝓀 Ξ±, t β—‹ t βŠ† s := have s ∈ (𝓀 Ξ±).lift' (Ξ»t:set (Ξ±Γ—Ξ±), t β—‹ t), from comp_le_uniformity hs, (mem_lift'_sets $ monotone_comp_rel monotone_id monotone_id).mp this /-- If `s ∈ 𝓀 Ξ±`, then for any natural `n`, for a subset `t` of a sufficiently small set in `𝓀 Ξ±`, we have `t β—‹ t β—‹ ... β—‹ t βŠ† s` (`n` compositions). -/ lemma eventually_uniformity_iterate_comp_subset {s : set (Ξ± Γ— Ξ±)} (hs : s ∈ 𝓀 Ξ±) (n : β„•) : βˆ€αΆ  t in (𝓀 Ξ±).small_sets, ((β—‹) t) ^[n] t βŠ† s := begin suffices : βˆ€αΆ  t in (𝓀 Ξ±).small_sets, t βŠ† s ∧ (((β—‹) t) ^[n] t βŠ† s), from (eventually_and.1 this).2, induction n with n ihn generalizing s, { simpa }, rcases comp_mem_uniformity_sets hs with ⟨t, htU, hts⟩, refine (ihn htU).mono (Ξ» U hU, _), rw [function.iterate_succ_apply'], exact ⟨hU.1.trans $ (subset_comp_self $ refl_le_uniformity htU).trans hts, (comp_rel_mono hU.1 hU.2).trans hts⟩ end /-- If `s ∈ 𝓀 Ξ±`, then for any natural `n`, for a subset `t` of a sufficiently small set in `𝓀 Ξ±`, we have `t β—‹ t βŠ† s`. -/ lemma eventually_uniformity_comp_subset {s : set (Ξ± Γ— Ξ±)} (hs : s ∈ 𝓀 Ξ±) : βˆ€αΆ  t in (𝓀 Ξ±).small_sets, t β—‹ t βŠ† s := eventually_uniformity_iterate_comp_subset hs 1 /-- Relation `Ξ» f g, tendsto (Ξ» x, (f x, g x)) l (𝓀 Ξ±)` is transitive. -/ lemma filter.tendsto.uniformity_trans {l : filter Ξ²} {f₁ fβ‚‚ f₃ : Ξ² β†’ Ξ±} (h₁₂ : tendsto (Ξ» x, (f₁ x, fβ‚‚ x)) l (𝓀 Ξ±)) (h₂₃ : tendsto (Ξ» x, (fβ‚‚ x, f₃ x)) l (𝓀 Ξ±)) : tendsto (Ξ» x, (f₁ x, f₃ x)) l (𝓀 Ξ±) := begin refine le_trans (le_lift' $ Ξ» s hs, mem_map.2 _) comp_le_uniformity, filter_upwards [h₁₂ hs, h₂₃ hs] with x hx₁₂ hx₂₃ using ⟨_, hx₁₂, hxβ‚‚β‚ƒβŸ©, end /-- Relation `Ξ» f g, tendsto (Ξ» x, (f x, g x)) l (𝓀 Ξ±)` is symmetric -/ lemma filter.tendsto.uniformity_symm {l : filter Ξ²} {f : Ξ² β†’ Ξ± Γ— Ξ±} (h : tendsto f l (𝓀 Ξ±)) : tendsto (Ξ» x, ((f x).2, (f x).1)) l (𝓀 Ξ±) := tendsto_swap_uniformity.comp h /-- Relation `Ξ» f g, tendsto (Ξ» x, (f x, g x)) l (𝓀 Ξ±)` is reflexive. -/ lemma tendsto_diag_uniformity (f : Ξ² β†’ Ξ±) (l : filter Ξ²) : tendsto (Ξ» x, (f x, f x)) l (𝓀 Ξ±) := assume s hs, mem_map.2 $ univ_mem' $ Ξ» x, refl_mem_uniformity hs lemma tendsto_const_uniformity {a : Ξ±} {f : filter Ξ²} : tendsto (Ξ» _, (a, a)) f (𝓀 Ξ±) := tendsto_diag_uniformity (Ξ» _, a) f lemma symm_of_uniformity {s : set (Ξ± Γ— Ξ±)} (hs : s ∈ 𝓀 Ξ±) : βˆƒ t ∈ 𝓀 Ξ±, (βˆ€a b, (a, b) ∈ t β†’ (b, a) ∈ t) ∧ t βŠ† s := have preimage prod.swap s ∈ 𝓀 Ξ±, from symm_le_uniformity hs, ⟨s ∩ preimage prod.swap s, inter_mem hs this, Ξ» a b ⟨h₁, hβ‚‚βŸ©, ⟨hβ‚‚, hβ‚βŸ©, inter_subset_left _ _⟩ lemma comp_symm_of_uniformity {s : set (Ξ± Γ— Ξ±)} (hs : s ∈ 𝓀 Ξ±) : βˆƒ t ∈ 𝓀 Ξ±, (βˆ€{a b}, (a, b) ∈ t β†’ (b, a) ∈ t) ∧ t β—‹ t βŠ† s := let ⟨t, ht₁, htβ‚‚βŸ© := comp_mem_uniformity_sets hs in let ⟨t', ht', ht'₁, ht'β‚‚βŸ© := symm_of_uniformity ht₁ in ⟨t', ht', ht'₁, subset.trans (monotone_comp_rel monotone_id monotone_id ht'β‚‚) htβ‚‚βŸ© lemma uniformity_le_symm : 𝓀 Ξ± ≀ (@prod.swap Ξ± Ξ±) <$> 𝓀 Ξ± := by rw [map_swap_eq_comap_swap]; from map_le_iff_le_comap.1 tendsto_swap_uniformity lemma uniformity_eq_symm : 𝓀 Ξ± = (@prod.swap Ξ± Ξ±) <$> 𝓀 Ξ± := le_antisymm uniformity_le_symm symm_le_uniformity @[simp] lemma comap_swap_uniformity : comap (@prod.swap Ξ± Ξ±) (𝓀 Ξ±) = 𝓀 Ξ± := (congr_arg _ uniformity_eq_symm).trans $ comap_map prod.swap_injective lemma symmetrize_mem_uniformity {V : set (Ξ± Γ— Ξ±)} (h : V ∈ 𝓀 Ξ±) : symmetrize_rel V ∈ 𝓀 Ξ± := begin apply (𝓀 Ξ±).inter_sets h, rw [← image_swap_eq_preimage_swap, uniformity_eq_symm], exact image_mem_map h, end theorem uniformity_lift_le_swap {g : set (Ξ±Γ—Ξ±) β†’ filter Ξ²} {f : filter Ξ²} (hg : monotone g) (h : (𝓀 Ξ±).lift (Ξ»s, g (preimage prod.swap s)) ≀ f) : (𝓀 Ξ±).lift g ≀ f := calc (𝓀 Ξ±).lift g ≀ (filter.map (@prod.swap Ξ± Ξ±) $ 𝓀 Ξ±).lift g : lift_mono uniformity_le_symm le_rfl ... ≀ _ : by rw [map_lift_eq2 hg, image_swap_eq_preimage_swap]; exact h lemma uniformity_lift_le_comp {f : set (Ξ±Γ—Ξ±) β†’ filter Ξ²} (h : monotone f) : (𝓀 Ξ±).lift (Ξ»s, f (s β—‹ s)) ≀ (𝓀 Ξ±).lift f := calc (𝓀 Ξ±).lift (Ξ»s, f (s β—‹ s)) = ((𝓀 Ξ±).lift' (Ξ»s:set (Ξ±Γ—Ξ±), s β—‹ s)).lift f : begin rw [lift_lift'_assoc], exact monotone_comp_rel monotone_id monotone_id, exact h end ... ≀ (𝓀 Ξ±).lift f : lift_mono comp_le_uniformity le_rfl lemma comp_le_uniformity3 : (𝓀 Ξ±).lift' (Ξ»s:set (Ξ±Γ—Ξ±), s β—‹ (s β—‹ s)) ≀ (𝓀 Ξ±) := calc (𝓀 Ξ±).lift' (Ξ»d, d β—‹ (d β—‹ d)) = (𝓀 Ξ±).lift (Ξ»s, (𝓀 Ξ±).lift' (Ξ»t:set(Ξ±Γ—Ξ±), s β—‹ (t β—‹ t))) : begin rw [lift_lift'_same_eq_lift'], exact (assume x, monotone_comp_rel monotone_const $ monotone_comp_rel monotone_id monotone_id), exact (assume x, monotone_comp_rel monotone_id monotone_const), end ... ≀ (𝓀 Ξ±).lift (Ξ»s, (𝓀 Ξ±).lift' (Ξ»t:set(Ξ±Γ—Ξ±), s β—‹ t)) : lift_mono' $ assume s hs, @uniformity_lift_le_comp Ξ± _ _ (π“Ÿ ∘ (β—‹) s) $ monotone_principal.comp (monotone_comp_rel monotone_const monotone_id) ... = (𝓀 Ξ±).lift' (Ξ»s:set(Ξ±Γ—Ξ±), s β—‹ s) : lift_lift'_same_eq_lift' (assume s, monotone_comp_rel monotone_const monotone_id) (assume s, monotone_comp_rel monotone_id monotone_const) ... ≀ (𝓀 Ξ±) : comp_le_uniformity /-- See also `comp_open_symm_mem_uniformity_sets`. -/ lemma comp_symm_mem_uniformity_sets {s : set (Ξ± Γ— Ξ±)} (hs : s ∈ 𝓀 Ξ±) : βˆƒ t ∈ 𝓀 Ξ±, symmetric_rel t ∧ t β—‹ t βŠ† s := begin obtain ⟨w, w_in, w_sub⟩ : βˆƒ w ∈ 𝓀 Ξ±, w β—‹ w βŠ† s := comp_mem_uniformity_sets hs, use [symmetrize_rel w, symmetrize_mem_uniformity w_in, symmetric_symmetrize_rel w], have : symmetrize_rel w βŠ† w := symmetrize_rel_subset_self w, calc symmetrize_rel w β—‹ symmetrize_rel w βŠ† w β—‹ w : by mono ... βŠ† s : w_sub, end lemma subset_comp_self_of_mem_uniformity {s : set (Ξ± Γ— Ξ±)} (h : s ∈ 𝓀 Ξ±) : s βŠ† s β—‹ s := subset_comp_self (refl_le_uniformity h) lemma comp_comp_symm_mem_uniformity_sets {s : set (Ξ± Γ— Ξ±)} (hs : s ∈ 𝓀 Ξ±) : βˆƒ t ∈ 𝓀 Ξ±, symmetric_rel t ∧ t β—‹ t β—‹ t βŠ† s := begin rcases comp_symm_mem_uniformity_sets hs with ⟨w, w_in, w_symm, w_sub⟩, rcases comp_symm_mem_uniformity_sets w_in with ⟨t, t_in, t_symm, t_sub⟩, use [t, t_in, t_symm], have : t βŠ† t β—‹ t := subset_comp_self_of_mem_uniformity t_in, calc t β—‹ t β—‹ t βŠ† w β—‹ t : by mono ... βŠ† w β—‹ (t β—‹ t) : by mono ... βŠ† w β—‹ w : by mono ... βŠ† s : w_sub, end /-! ###Β Balls in uniform spaces -/ /-- The ball around `(x : Ξ²)` with respect to `(V : set (Ξ² Γ— Ξ²))`. Intended to be used for `V ∈ 𝓀 Ξ²`, but this is not needed for the definition. Recovers the notions of metric space ball when `V = {p | dist p.1 p.2 < r }`. -/ def uniform_space.ball (x : Ξ²) (V : set (Ξ² Γ— Ξ²)) : set Ξ² := (prod.mk x) ⁻¹' V open uniform_space (ball) lemma uniform_space.mem_ball_self (x : Ξ±) {V : set (Ξ± Γ— Ξ±)} (hV : V ∈ 𝓀 Ξ±) : x ∈ ball x V := refl_mem_uniformity hV /-- The triangle inequality for `uniform_space.ball` -/ lemma mem_ball_comp {V W : set (Ξ² Γ— Ξ²)} {x y z} (h : y ∈ ball x V) (h' : z ∈ ball y W) : z ∈ ball x (V β—‹ W) := prod_mk_mem_comp_rel h h' lemma ball_subset_of_comp_subset {V W : set (Ξ² Γ— Ξ²)} {x y} (h : x ∈ ball y W) (h' : W β—‹ W βŠ† V) : ball x W βŠ† ball y V := Ξ» z z_in, h' (mem_ball_comp h z_in) lemma ball_mono {V W : set (Ξ² Γ— Ξ²)} (h : V βŠ† W) (x : Ξ²) : ball x V βŠ† ball x W := by tauto lemma ball_inter_left (x : Ξ²) (V W : set (Ξ² Γ— Ξ²)) : ball x (V ∩ W) βŠ† ball x V := ball_mono (inter_subset_left V W) x lemma ball_inter_right (x : Ξ²) (V W : set (Ξ² Γ— Ξ²)) : ball x (V ∩ W) βŠ† ball x W := ball_mono (inter_subset_right V W) x lemma mem_ball_symmetry {V : set (Ξ² Γ— Ξ²)} (hV : symmetric_rel V) {x y} : x ∈ ball y V ↔ y ∈ ball x V := show (x, y) ∈ prod.swap ⁻¹' V ↔ (x, y) ∈ V, by { unfold symmetric_rel at hV, rw hV } lemma ball_eq_of_symmetry {V : set (Ξ² Γ— Ξ²)} (hV : symmetric_rel V) {x} : ball x V = {y | (y, x) ∈ V} := by { ext y, rw mem_ball_symmetry hV, exact iff.rfl } lemma mem_comp_of_mem_ball {V W : set (Ξ² Γ— Ξ²)} {x y z : Ξ²} (hV : symmetric_rel V) (hx : x ∈ ball z V) (hy : y ∈ ball z W) : (x, y) ∈ V β—‹ W := begin rw mem_ball_symmetry hV at hx, exact ⟨z, hx, hy⟩ end lemma uniform_space.is_open_ball (x : Ξ±) {V : set (Ξ± Γ— Ξ±)} (hV : is_open V) : is_open (ball x V) := hV.preimage $ continuous_const.prod_mk continuous_id lemma mem_comp_comp {V W M : set (Ξ² Γ— Ξ²)} (hW' : symmetric_rel W) {p : Ξ² Γ— Ξ²} : p ∈ V β—‹ M β—‹ W ↔ ((ball p.1 V Γ—Λ’ ball p.2 W) ∩ M).nonempty := begin cases p with x y, split, { rintros ⟨z, ⟨w, hpw, hwz⟩, hzy⟩, exact ⟨(w, z), ⟨hpw, by rwa mem_ball_symmetry hW'⟩, hwz⟩, }, { rintro ⟨⟨w, z⟩, ⟨w_in, z_in⟩, hwz⟩, rwa mem_ball_symmetry hW' at z_in, use [z, w] ; tauto }, end /-! ### Neighborhoods in uniform spaces -/ lemma mem_nhds_uniformity_iff_right {x : Ξ±} {s : set Ξ±} : s ∈ 𝓝 x ↔ {p : Ξ± Γ— Ξ± | p.1 = x β†’ p.2 ∈ s} ∈ 𝓀 Ξ± := begin refine ⟨_, Ξ» hs, _⟩, { simp only [mem_nhds_iff, is_open_uniformity, and_imp, exists_imp_distrib], intros t ts ht xt, filter_upwards [ht x xt] using Ξ» y h eq, ts (h eq) }, { refine mem_nhds_iff.mpr ⟨{x | {p : Ξ± Γ— Ξ± | p.1 = x β†’ p.2 ∈ s} ∈ 𝓀 Ξ±}, _, _, hs⟩, { exact Ξ» y hy, refl_mem_uniformity hy rfl }, { refine is_open_uniformity.mpr (Ξ» y hy, _), rcases comp_mem_uniformity_sets hy with ⟨t, ht, tr⟩, filter_upwards [ht], rintro ⟨a, b⟩ hp' rfl, filter_upwards [ht], rintro ⟨a', b'⟩ hp'' rfl, exact @tr (a, b') ⟨a', hp', hp''⟩ rfl } } end lemma mem_nhds_uniformity_iff_left {x : Ξ±} {s : set Ξ±} : s ∈ 𝓝 x ↔ {p : Ξ± Γ— Ξ± | p.2 = x β†’ p.1 ∈ s} ∈ 𝓀 Ξ± := by { rw [uniformity_eq_symm, mem_nhds_uniformity_iff_right], refl } lemma nhds_eq_comap_uniformity_aux {Ξ± : Type u} {x : Ξ±} {s : set Ξ±} {F : filter (Ξ± Γ— Ξ±)} : {p : Ξ± Γ— Ξ± | p.fst = x β†’ p.snd ∈ s} ∈ F ↔ s ∈ comap (prod.mk x) F := by rw mem_comap ; from iff.intro (assume hs, ⟨_, hs, assume x hx, hx rfl⟩) (assume ⟨t, h, ht⟩, F.sets_of_superset h $ assume ⟨p₁, pβ‚‚βŸ© hp (h : p₁ = x), ht $ by simp [h.symm, hp]) lemma nhds_eq_comap_uniformity {x : Ξ±} : 𝓝 x = (𝓀 Ξ±).comap (prod.mk x) := by { ext s, rw [mem_nhds_uniformity_iff_right], exact nhds_eq_comap_uniformity_aux } /-- See also `is_open_iff_open_ball_subset`. -/ lemma is_open_iff_ball_subset {s : set Ξ±} : is_open s ↔ βˆ€ x ∈ s, βˆƒ V ∈ 𝓀 Ξ±, ball x V βŠ† s := begin simp_rw [is_open_iff_mem_nhds, nhds_eq_comap_uniformity], exact iff.rfl, end lemma nhds_basis_uniformity' {p : ΞΉ β†’ Prop} {s : ΞΉ β†’ set (Ξ± Γ— Ξ±)} (h : (𝓀 Ξ±).has_basis p s) {x : Ξ±} : (𝓝 x).has_basis p (Ξ» i, ball x (s i)) := by { rw [nhds_eq_comap_uniformity], exact h.comap (prod.mk x) } lemma nhds_basis_uniformity {p : ΞΉ β†’ Prop} {s : ΞΉ β†’ set (Ξ± Γ— Ξ±)} (h : (𝓀 Ξ±).has_basis p s) {x : Ξ±} : (𝓝 x).has_basis p (Ξ» i, {y | (y, x) ∈ s i}) := begin replace h := h.comap prod.swap, rw [← map_swap_eq_comap_swap, ← uniformity_eq_symm] at h, exact nhds_basis_uniformity' h end lemma uniform_space.mem_nhds_iff {x : Ξ±} {s : set Ξ±} : s ∈ 𝓝 x ↔ βˆƒ V ∈ 𝓀 Ξ±, ball x V βŠ† s := begin rw [nhds_eq_comap_uniformity, mem_comap], exact iff.rfl, end lemma uniform_space.ball_mem_nhds (x : Ξ±) ⦃V : set (Ξ± Γ— Ξ±)⦄ (V_in : V ∈ 𝓀 Ξ±) : ball x V ∈ 𝓝 x := begin rw uniform_space.mem_nhds_iff, exact ⟨V, V_in, subset.refl _⟩ end lemma uniform_space.mem_nhds_iff_symm {x : Ξ±} {s : set Ξ±} : s ∈ 𝓝 x ↔ βˆƒ V ∈ 𝓀 Ξ±, symmetric_rel V ∧ ball x V βŠ† s := begin rw uniform_space.mem_nhds_iff, split, { rintros ⟨V, V_in, V_sub⟩, use [symmetrize_rel V, symmetrize_mem_uniformity V_in, symmetric_symmetrize_rel V], exact subset.trans (ball_mono (symmetrize_rel_subset_self V) x) V_sub }, { rintros ⟨V, V_in, V_symm, V_sub⟩, exact ⟨V, V_in, V_sub⟩ } end lemma uniform_space.has_basis_nhds (x : Ξ±) : has_basis (𝓝 x) (Ξ» s : set (Ξ± Γ— Ξ±), s ∈ 𝓀 Ξ± ∧ symmetric_rel s) (Ξ» s, ball x s) := ⟨λ t, by simp [uniform_space.mem_nhds_iff_symm, and_assoc]⟩ open uniform_space lemma uniform_space.mem_closure_iff_symm_ball {s : set Ξ±} {x} : x ∈ closure s ↔ βˆ€ {V}, V ∈ 𝓀 Ξ± β†’ symmetric_rel V β†’ (s ∩ ball x V).nonempty := by simp [mem_closure_iff_nhds_basis (has_basis_nhds x), set.nonempty] lemma uniform_space.mem_closure_iff_ball {s : set Ξ±} {x} : x ∈ closure s ↔ βˆ€ {V}, V ∈ 𝓀 Ξ± β†’ (ball x V ∩ s).nonempty := by simp [mem_closure_iff_nhds_basis' (nhds_basis_uniformity' (𝓀 Ξ±).basis_sets)] lemma uniform_space.has_basis_nhds_prod (x y : Ξ±) : has_basis (𝓝 (x, y)) (Ξ» s, s ∈ 𝓀 Ξ± ∧ symmetric_rel s) $ Ξ» s, ball x s Γ—Λ’ ball y s := begin rw nhds_prod_eq, apply (has_basis_nhds x).prod' (has_basis_nhds y), rintro U V ⟨U_in, U_symm⟩ ⟨V_in, V_symm⟩, exact ⟨U ∩ V, ⟨(𝓀 Ξ±).inter_sets U_in V_in, symmetric_rel_inter U_symm V_symm⟩, ball_inter_left x U V, ball_inter_right y U V⟩, end lemma nhds_eq_uniformity {x : Ξ±} : 𝓝 x = (𝓀 Ξ±).lift' (ball x) := (nhds_basis_uniformity' (𝓀 Ξ±).basis_sets).eq_binfi lemma mem_nhds_left (x : Ξ±) {s : set (Ξ±Γ—Ξ±)} (h : s ∈ 𝓀 Ξ±) : {y : Ξ± | (x, y) ∈ s} ∈ 𝓝 x := ball_mem_nhds x h lemma mem_nhds_right (y : Ξ±) {s : set (Ξ±Γ—Ξ±)} (h : s ∈ 𝓀 Ξ±) : {x : Ξ± | (x, y) ∈ s} ∈ 𝓝 y := mem_nhds_left _ (symm_le_uniformity h) lemma tendsto_right_nhds_uniformity {a : Ξ±} : tendsto (Ξ»a', (a', a)) (𝓝 a) (𝓀 Ξ±) := assume s, mem_nhds_right a lemma tendsto_left_nhds_uniformity {a : Ξ±} : tendsto (Ξ»a', (a, a')) (𝓝 a) (𝓀 Ξ±) := assume s, mem_nhds_left a lemma lift_nhds_left {x : Ξ±} {g : set Ξ± β†’ filter Ξ²} (hg : monotone g) : (𝓝 x).lift g = (𝓀 Ξ±).lift (Ξ»s:set (Ξ±Γ—Ξ±), g {y | (x, y) ∈ s}) := eq.trans begin rw [nhds_eq_uniformity], exact (filter.lift_assoc $ monotone_principal.comp $ monotone_preimage.comp monotone_preimage ) end (congr_arg _ $ funext $ assume s, filter.lift_principal hg) lemma lift_nhds_right {x : Ξ±} {g : set Ξ± β†’ filter Ξ²} (hg : monotone g) : (𝓝 x).lift g = (𝓀 Ξ±).lift (Ξ»s:set (Ξ±Γ—Ξ±), g {y | (y, x) ∈ s}) := calc (𝓝 x).lift g = (𝓀 Ξ±).lift (Ξ»s:set (Ξ±Γ—Ξ±), g {y | (x, y) ∈ s}) : lift_nhds_left hg ... = ((@prod.swap Ξ± Ξ±) <$> (𝓀 Ξ±)).lift (Ξ»s:set (Ξ±Γ—Ξ±), g {y | (x, y) ∈ s}) : by rw [←uniformity_eq_symm] ... = (𝓀 Ξ±).lift (Ξ»s:set (Ξ±Γ—Ξ±), g {y | (x, y) ∈ image prod.swap s}) : map_lift_eq2 $ hg.comp monotone_preimage ... = _ : by simp [image_swap_eq_preimage_swap] lemma nhds_nhds_eq_uniformity_uniformity_prod {a b : Ξ±} : 𝓝 a Γ—αΆ  𝓝 b = (𝓀 Ξ±).lift (Ξ»s:set (Ξ±Γ—Ξ±), (𝓀 Ξ±).lift' (Ξ»t:set (Ξ±Γ—Ξ±), {y : Ξ± | (y, a) ∈ s} Γ—Λ’ {y : Ξ± | (b, y) ∈ t})) := begin rw [prod_def], show (𝓝 a).lift (Ξ»s:set Ξ±, (𝓝 b).lift (Ξ»t:set Ξ±, π“Ÿ (s Γ—Λ’ t))) = _, rw [lift_nhds_right], apply congr_arg, funext s, rw [lift_nhds_left], refl, exact monotone_principal.comp (monotone_prod monotone_const monotone_id), exact (monotone_lift' monotone_const $ monotone_lam $ assume x, monotone_prod monotone_id monotone_const) end lemma nhds_eq_uniformity_prod {a b : Ξ±} : 𝓝 (a, b) = (𝓀 Ξ±).lift' (Ξ»s:set (Ξ±Γ—Ξ±), {y : Ξ± | (y, a) ∈ s} Γ—Λ’ {y : Ξ± | (b, y) ∈ s}) := begin rw [nhds_prod_eq, nhds_nhds_eq_uniformity_uniformity_prod, lift_lift'_same_eq_lift'], { intro s, exact monotone_prod monotone_const monotone_preimage }, { intro t, exact monotone_prod monotone_preimage monotone_const } end lemma nhdset_of_mem_uniformity {d : set (Ξ±Γ—Ξ±)} (s : set (Ξ±Γ—Ξ±)) (hd : d ∈ 𝓀 Ξ±) : βˆƒ(t : set (Ξ±Γ—Ξ±)), is_open t ∧ s βŠ† t ∧ t βŠ† {p | βˆƒx y, (p.1, x) ∈ d ∧ (x, y) ∈ s ∧ (y, p.2) ∈ d} := let cl_d := {p:Ξ±Γ—Ξ± | βˆƒx y, (p.1, x) ∈ d ∧ (x, y) ∈ s ∧ (y, p.2) ∈ d} in have βˆ€p ∈ s, βˆƒt βŠ† cl_d, is_open t ∧ p ∈ t, from assume ⟨x, y⟩ hp, _root_.mem_nhds_iff.mp $ show cl_d ∈ 𝓝 (x, y), begin rw [nhds_eq_uniformity_prod, mem_lift'_sets], exact ⟨d, hd, assume ⟨a, b⟩ ⟨ha, hb⟩, ⟨x, y, ha, hp, hb⟩⟩, exact monotone_prod monotone_preimage monotone_preimage end, have βˆƒt:(Ξ (p:Ξ±Γ—Ξ±) (h:p ∈ s), set (Ξ±Γ—Ξ±)), βˆ€p, βˆ€h:p ∈ s, t p h βŠ† cl_d ∧ is_open (t p h) ∧ p ∈ t p h, by simp [classical.skolem] at this; simp; assumption, match this with | ⟨t, ht⟩ := ⟨(⋃ p:Ξ±Γ—Ξ±, ⋃ h : p ∈ s, t p h : set (Ξ±Γ—Ξ±)), is_open_Union $ assume (p:Ξ±Γ—Ξ±), is_open_Union $ assume hp, (ht p hp).right.left, assume ⟨a, b⟩ hp, begin simp; exact ⟨a, b, hp, (ht (a,b) hp).right.right⟩ end, Union_subset $ assume p, Union_subset $ assume hp, (ht p hp).left⟩ end /-- Entourages are neighborhoods of the diagonal. -/ lemma nhds_le_uniformity (x : Ξ±) : 𝓝 (x, x) ≀ 𝓀 Ξ± := begin intros V V_in, rcases comp_symm_mem_uniformity_sets V_in with ⟨w, w_in, w_symm, w_sub⟩, have : ball x w Γ—Λ’ ball x w ∈ 𝓝 (x, x), { rw nhds_prod_eq, exact prod_mem_prod (ball_mem_nhds x w_in) (ball_mem_nhds x w_in) }, apply mem_of_superset this, rintros ⟨u, v⟩ ⟨u_in, v_in⟩, exact w_sub (mem_comp_of_mem_ball w_symm u_in v_in) end /-- Entourages are neighborhoods of the diagonal. -/ lemma supr_nhds_le_uniformity : (⨆ x : Ξ±, 𝓝 (x, x)) ≀ 𝓀 Ξ± := supr_le nhds_le_uniformity /-! ### Closure and interior in uniform spaces -/ lemma closure_eq_uniformity (s : set $ Ξ± Γ— Ξ±) : closure s = β‹‚ V ∈ {V | V ∈ 𝓀 Ξ± ∧ symmetric_rel V}, V β—‹ s β—‹ V := begin ext ⟨x, y⟩, simp_rw [mem_closure_iff_nhds_basis (uniform_space.has_basis_nhds_prod x y), mem_Inter, mem_set_of_eq], refine forallβ‚‚_congr (Ξ» V, _), rintros ⟨V_in, V_symm⟩, simp_rw [mem_comp_comp V_symm, inter_comm, exists_prop], exact iff.rfl, end lemma uniformity_has_basis_closed : has_basis (𝓀 Ξ±) (Ξ» V : set (Ξ± Γ— Ξ±), V ∈ 𝓀 Ξ± ∧ is_closed V) id := begin refine filter.has_basis_self.2 (Ξ» t h, _), rcases comp_comp_symm_mem_uniformity_sets h with ⟨w, w_in, w_symm, r⟩, refine ⟨closure w, mem_of_superset w_in subset_closure, is_closed_closure, _⟩, refine subset.trans _ r, rw closure_eq_uniformity, apply Inter_subset_of_subset, apply Inter_subset, exact ⟨w_in, w_symm⟩ end /-- Closed entourages form a basis of the uniformity filter. -/ lemma uniformity_has_basis_closure : has_basis (𝓀 Ξ±) (Ξ» V : set (Ξ± Γ— Ξ±), V ∈ 𝓀 Ξ±) closure := ⟨begin intro t, rw uniformity_has_basis_closed.mem_iff, split, { rintros ⟨r, ⟨r_in, r_closed⟩, r_sub⟩, use [r, r_in], convert r_sub, rw r_closed.closure_eq, refl }, { rintros ⟨r, r_in, r_sub⟩, exact ⟨closure r, ⟨mem_of_superset r_in subset_closure, is_closed_closure⟩, r_sub⟩ } end⟩ lemma closure_eq_inter_uniformity {t : set (Ξ±Γ—Ξ±)} : closure t = (β‹‚ d ∈ 𝓀 Ξ±, d β—‹ (t β—‹ d)) := set.ext $ assume ⟨a, b⟩, calc (a, b) ∈ closure t ↔ (𝓝 (a, b) βŠ“ π“Ÿ t β‰  βŠ₯) : mem_closure_iff_nhds_ne_bot ... ↔ (((@prod.swap Ξ± Ξ±) <$> 𝓀 Ξ±).lift' (Ξ» (s : set (Ξ± Γ— Ξ±)), {x : Ξ± | (x, a) ∈ s} Γ—Λ’ {y : Ξ± | (b, y) ∈ s}) βŠ“ π“Ÿ t β‰  βŠ₯) : by rw [←uniformity_eq_symm, nhds_eq_uniformity_prod] ... ↔ ((map (@prod.swap Ξ± Ξ±) (𝓀 Ξ±)).lift' (Ξ» (s : set (Ξ± Γ— Ξ±)), {x : Ξ± | (x, a) ∈ s} Γ—Λ’ {y : Ξ± | (b, y) ∈ s}) βŠ“ π“Ÿ t β‰  βŠ₯) : by refl ... ↔ ((𝓀 Ξ±).lift' (Ξ» (s : set (Ξ± Γ— Ξ±)), {y : Ξ± | (a, y) ∈ s} Γ—Λ’ {x : Ξ± | (x, b) ∈ s}) βŠ“ π“Ÿ t β‰  βŠ₯) : begin rw [map_lift'_eq2], simp [image_swap_eq_preimage_swap, function.comp], exact monotone_prod monotone_preimage monotone_preimage end ... ↔ (βˆ€s ∈ 𝓀 Ξ±, ({y : Ξ± | (a, y) ∈ s} Γ—Λ’ {x : Ξ± | (x, b) ∈ s} ∩ t).nonempty) : begin rw [lift'_inf_principal_eq, ← ne_bot_iff, lift'_ne_bot_iff], exact (monotone_prod monotone_preimage monotone_preimage).inter monotone_const end ... ↔ (βˆ€ s ∈ 𝓀 Ξ±, (a, b) ∈ s β—‹ (t β—‹ s)) : forallβ‚‚_congr $ Ξ» s hs, ⟨assume ⟨⟨x, y⟩, ⟨⟨hx, hy⟩, hxyt⟩⟩, ⟨x, hx, y, hxyt, hy⟩, assume ⟨x, hx, y, hxyt, hy⟩, ⟨⟨x, y⟩, ⟨⟨hx, hy⟩, hxyt⟩⟩⟩ ... ↔ _ : by simp lemma uniformity_eq_uniformity_closure : 𝓀 Ξ± = (𝓀 Ξ±).lift' closure := le_antisymm (le_infi $ assume s, le_infi $ assume hs, by simp; filter_upwards [hs] using subset_closure) (calc (𝓀 Ξ±).lift' closure ≀ (𝓀 Ξ±).lift' (Ξ»d, d β—‹ (d β—‹ d)) : lift'_mono' (by intros s hs; rw [closure_eq_inter_uniformity]; exact bInter_subset_of_mem hs) ... ≀ (𝓀 Ξ±) : comp_le_uniformity3) lemma uniformity_eq_uniformity_interior : 𝓀 Ξ± = (𝓀 Ξ±).lift' interior := le_antisymm (le_infi $ assume d, le_infi $ assume hd, let ⟨s, hs, hs_comp⟩ := (mem_lift'_sets $ monotone_comp_rel monotone_id $ monotone_comp_rel monotone_id monotone_id).mp (comp_le_uniformity3 hd) in let ⟨t, ht, hst, ht_comp⟩ := nhdset_of_mem_uniformity s hs in have s βŠ† interior d, from calc s βŠ† t : hst ... βŠ† interior d : (subset_interior_iff_subset_of_open ht).mpr $ Ξ» x (hx : x ∈ t), let ⟨x, y, h₁, hβ‚‚, hβ‚ƒβŸ© := ht_comp hx in hs_comp ⟨x, h₁, y, hβ‚‚, hβ‚ƒβŸ©, have interior d ∈ 𝓀 Ξ±, by filter_upwards [hs] using this, by simp [this]) (assume s hs, ((𝓀 Ξ±).lift' interior).sets_of_superset (mem_lift' hs) interior_subset) lemma interior_mem_uniformity {s : set (Ξ± Γ— Ξ±)} (hs : s ∈ 𝓀 Ξ±) : interior s ∈ 𝓀 Ξ± := by rw [uniformity_eq_uniformity_interior]; exact mem_lift' hs lemma mem_uniformity_is_closed {s : set (Ξ±Γ—Ξ±)} (h : s ∈ 𝓀 Ξ±) : βˆƒt ∈ 𝓀 Ξ±, is_closed t ∧ t βŠ† s := let ⟨t, ⟨ht_mem, htc⟩, hts⟩ := uniformity_has_basis_closed.mem_iff.1 h in ⟨t, ht_mem, htc, hts⟩ lemma is_open_iff_open_ball_subset {s : set Ξ±} : is_open s ↔ βˆ€ x ∈ s, βˆƒ V ∈ 𝓀 Ξ±, is_open V ∧ ball x V βŠ† s := begin rw is_open_iff_ball_subset, split; intros h x hx, { obtain ⟨V, hV, hV'⟩ := h x hx, exact ⟨interior V, interior_mem_uniformity hV, is_open_interior, (ball_mono interior_subset x).trans hV'⟩, }, { obtain ⟨V, hV, -, hV'⟩ := h x hx, exact ⟨V, hV, hV'⟩, }, end /-- The uniform neighborhoods of all points of a dense set cover the whole space. -/ lemma dense.bUnion_uniformity_ball {s : set Ξ±} {U : set (Ξ± Γ— Ξ±)} (hs : dense s) (hU : U ∈ 𝓀 Ξ±) : (⋃ x ∈ s, ball x U) = univ := begin refine Unionβ‚‚_eq_univ_iff.2 (Ξ» y, _), rcases hs.inter_nhds_nonempty (mem_nhds_right y hU) with ⟨x, hxs, hxy : (x, y) ∈ U⟩, exact ⟨x, hxs, hxy⟩ end /-! ### Uniformity bases -/ /-- Open elements of `𝓀 Ξ±` form a basis of `𝓀 Ξ±`. -/ lemma uniformity_has_basis_open : has_basis (𝓀 Ξ±) (Ξ» V : set (Ξ± Γ— Ξ±), V ∈ 𝓀 Ξ± ∧ is_open V) id := has_basis_self.2 $ Ξ» s hs, ⟨interior s, interior_mem_uniformity hs, is_open_interior, interior_subset⟩ lemma filter.has_basis.mem_uniformity_iff {p : Ξ² β†’ Prop} {s : Ξ² β†’ set (Ξ±Γ—Ξ±)} (h : (𝓀 Ξ±).has_basis p s) {t : set (Ξ± Γ— Ξ±)} : t ∈ 𝓀 Ξ± ↔ βˆƒ i (hi : p i), βˆ€ a b, (a, b) ∈ s i β†’ (a, b) ∈ t := h.mem_iff.trans $ by simp only [prod.forall, subset_def] /-- Symmetric entourages form a basis of `𝓀 Ξ±` -/ lemma uniform_space.has_basis_symmetric : (𝓀 Ξ±).has_basis (Ξ» s : set (Ξ± Γ— Ξ±), s ∈ 𝓀 Ξ± ∧ symmetric_rel s) id := has_basis_self.2 $ Ξ» t t_in, ⟨symmetrize_rel t, symmetrize_mem_uniformity t_in, symmetric_symmetrize_rel t, symmetrize_rel_subset_self t⟩ /-- Open elements `s : set (Ξ± Γ— Ξ±)` of `𝓀 Ξ±` such that `(x, y) ∈ s ↔ (y, x) ∈ s` form a basis of `𝓀 Ξ±`. -/ lemma uniformity_has_basis_open_symmetric : has_basis (𝓀 Ξ±) (Ξ» V : set (Ξ± Γ— Ξ±), V ∈ 𝓀 Ξ± ∧ is_open V ∧ symmetric_rel V) id := begin simp only [← and_assoc], refine uniformity_has_basis_open.restrict (Ξ» s hs, ⟨symmetrize_rel s, _⟩), exact ⟨⟨symmetrize_mem_uniformity hs.1, is_open.inter hs.2 (hs.2.preimage continuous_swap)⟩, symmetric_symmetrize_rel s, symmetrize_rel_subset_self s⟩ end lemma comp_open_symm_mem_uniformity_sets {s : set (Ξ± Γ— Ξ±)} (hs : s ∈ 𝓀 Ξ±) : βˆƒ t ∈ 𝓀 Ξ±, is_open t ∧ symmetric_rel t ∧ t β—‹ t βŠ† s := begin obtain ⟨t, ht₁, htβ‚‚βŸ© := comp_mem_uniformity_sets hs, obtain ⟨u, ⟨hu₁, huβ‚‚, huβ‚ƒβŸ©, huβ‚„ : u βŠ† t⟩ := uniformity_has_basis_open_symmetric.mem_iff.mp ht₁, exact ⟨u, hu₁, huβ‚‚, hu₃, (comp_rel_mono huβ‚„ huβ‚„).trans htβ‚‚βŸ©, end section variable (Ξ±) lemma uniform_space.has_seq_basis [is_countably_generated $ 𝓀 Ξ±] : βˆƒ V : β„• β†’ set (Ξ± Γ— Ξ±), has_antitone_basis (𝓀 Ξ±) V ∧ βˆ€ n, symmetric_rel (V n) := let ⟨U, hsym, hbasis⟩ := uniform_space.has_basis_symmetric.exists_antitone_subbasis in ⟨U, hbasis, Ξ» n, (hsym n).2⟩ end lemma filter.has_basis.bInter_bUnion_ball {p : ΞΉ β†’ Prop} {U : ΞΉ β†’ set (Ξ± Γ— Ξ±)} (h : has_basis (𝓀 Ξ±) p U) (s : set Ξ±) : (β‹‚ i (hi : p i), ⋃ x ∈ s, ball x (U i)) = closure s := begin ext x, simp [mem_closure_iff_nhds_basis (nhds_basis_uniformity h), ball] end /-! ### Uniform continuity -/ /-- A function `f : Ξ± β†’ Ξ²` is *uniformly continuous* if `(f x, f y)` tends to the diagonal as `(x, y)` tends to the diagonal. In other words, if `x` is sufficiently close to `y`, then `f x` is close to `f y` no matter where `x` and `y` are located in `Ξ±`. -/ def uniform_continuous [uniform_space Ξ²] (f : Ξ± β†’ Ξ²) := tendsto (Ξ»x:Ξ±Γ—Ξ±, (f x.1, f x.2)) (𝓀 Ξ±) (𝓀 Ξ²) /-- A function `f : Ξ± β†’ Ξ²` is *uniformly continuous* on `s : set Ξ±` if `(f x, f y)` tends to the diagonal as `(x, y)` tends to the diagonal while remaining in `s Γ—Λ’ s`. In other words, if `x` is sufficiently close to `y`, then `f x` is close to `f y` no matter where `x` and `y` are located in `s`.-/ def uniform_continuous_on [uniform_space Ξ²] (f : Ξ± β†’ Ξ²) (s : set Ξ±) : Prop := tendsto (Ξ» x : Ξ± Γ— Ξ±, (f x.1, f x.2)) (𝓀 Ξ± βŠ“ principal (s Γ—Λ’ s)) (𝓀 Ξ²) theorem uniform_continuous_def [uniform_space Ξ²] {f : Ξ± β†’ Ξ²} : uniform_continuous f ↔ βˆ€ r ∈ 𝓀 Ξ², { x : Ξ± Γ— Ξ± | (f x.1, f x.2) ∈ r} ∈ 𝓀 Ξ± := iff.rfl theorem uniform_continuous_iff_eventually [uniform_space Ξ²] {f : Ξ± β†’ Ξ²} : uniform_continuous f ↔ βˆ€ r ∈ 𝓀 Ξ², βˆ€αΆ  (x : Ξ± Γ— Ξ±) in 𝓀 Ξ±, (f x.1, f x.2) ∈ r := iff.rfl theorem uniform_continuous_on_univ [uniform_space Ξ²] {f : Ξ± β†’ Ξ²} : uniform_continuous_on f univ ↔ uniform_continuous f := by rw [uniform_continuous_on, uniform_continuous, univ_prod_univ, principal_univ, inf_top_eq] lemma uniform_continuous_of_const [uniform_space Ξ²] {c : Ξ± β†’ Ξ²} (h : βˆ€a b, c a = c b) : uniform_continuous c := have (Ξ» (x : Ξ± Γ— Ξ±), (c (x.fst), c (x.snd))) ⁻¹' id_rel = univ, from eq_univ_iff_forall.2 $ assume ⟨a, b⟩, h a b, le_trans (map_le_iff_le_comap.2 $ by simp [comap_principal, this, univ_mem]) refl_le_uniformity lemma uniform_continuous_id : uniform_continuous (@id Ξ±) := by simp [uniform_continuous]; exact tendsto_id lemma uniform_continuous_const [uniform_space Ξ²] {b : Ξ²} : uniform_continuous (Ξ»a:Ξ±, b) := uniform_continuous_of_const $ Ξ» _ _, rfl lemma uniform_continuous.comp [uniform_space Ξ²] [uniform_space Ξ³] {g : Ξ² β†’ Ξ³} {f : Ξ± β†’ Ξ²} (hg : uniform_continuous g) (hf : uniform_continuous f) : uniform_continuous (g ∘ f) := hg.comp hf lemma filter.has_basis.uniform_continuous_iff [uniform_space Ξ²] {p : Ξ³ β†’ Prop} {s : Ξ³ β†’ set (Ξ±Γ—Ξ±)} (ha : (𝓀 Ξ±).has_basis p s) {q : Ξ΄ β†’ Prop} {t : Ξ΄ β†’ set (Ξ²Γ—Ξ²)} (hb : (𝓀 Ξ²).has_basis q t) {f : Ξ± β†’ Ξ²} : uniform_continuous f ↔ βˆ€ i (hi : q i), βˆƒ j (hj : p j), βˆ€ x y, (x, y) ∈ s j β†’ (f x, f y) ∈ t i := (ha.tendsto_iff hb).trans $ by simp only [prod.forall] lemma filter.has_basis.uniform_continuous_on_iff [uniform_space Ξ²] {p : Ξ³ β†’ Prop} {s : Ξ³ β†’ set (Ξ±Γ—Ξ±)} (ha : (𝓀 Ξ±).has_basis p s) {q : Ξ΄ β†’ Prop} {t : Ξ΄ β†’ set (Ξ²Γ—Ξ²)} (hb : (𝓀 Ξ²).has_basis q t) {f : Ξ± β†’ Ξ²} {S : set Ξ±} : uniform_continuous_on f S ↔ βˆ€ i (hi : q i), βˆƒ j (hj : p j), βˆ€ x y ∈ S, (x, y) ∈ s j β†’ (f x, f y) ∈ t i := ((ha.inf_principal (S Γ—Λ’ S)).tendsto_iff hb).trans $ by simp [prod.forall, set.inter_comm (s _), ball_mem_comm] end uniform_space open_locale uniformity section constructions instance : partial_order (uniform_space Ξ±) := { le := Ξ»t s, t.uniformity ≀ s.uniformity, le_antisymm := assume t s h₁ hβ‚‚, uniform_space_eq $ le_antisymm h₁ hβ‚‚, le_refl := assume t, le_rfl, le_trans := assume a b c h₁ hβ‚‚, le_trans h₁ hβ‚‚ } instance : has_Inf (uniform_space Ξ±) := ⟨assume s, uniform_space.of_core { uniformity := (β¨…u∈s, @uniformity Ξ± u), refl := le_infi $ assume u, le_infi $ assume hu, u.refl, symm := le_infi $ assume u, le_infi $ assume hu, le_trans (map_mono $ infi_le_of_le _ $ infi_le _ hu) u.symm, comp := le_infi $ assume u, le_infi $ assume hu, le_trans (lift'_mono (infi_le_of_le _ $ infi_le _ hu) $ le_rfl) u.comp }⟩ private lemma Inf_le {tt : set (uniform_space Ξ±)} {t : uniform_space Ξ±} (h : t ∈ tt) : Inf tt ≀ t := show (β¨…u∈tt, @uniformity Ξ± u) ≀ t.uniformity, from infi_le_of_le t $ infi_le _ h private lemma le_Inf {tt : set (uniform_space Ξ±)} {t : uniform_space Ξ±} (h : βˆ€t'∈tt, t ≀ t') : t ≀ Inf tt := show t.uniformity ≀ (β¨…u∈tt, @uniformity Ξ± u), from le_infi $ assume t', le_infi $ assume ht', h t' ht' instance : has_top (uniform_space Ξ±) := ⟨uniform_space.of_core { uniformity := ⊀, refl := le_top, symm := le_top, comp := le_top }⟩ instance : has_bot (uniform_space Ξ±) := ⟨{ to_topological_space := βŠ₯, uniformity := π“Ÿ id_rel, refl := le_rfl, symm := by simp [tendsto]; apply subset.refl, comp := begin rw [lift'_principal], {simp}, exact monotone_comp_rel monotone_id monotone_id end, is_open_uniformity := assume s, by simp [is_open_fold, subset_def, id_rel] {contextual := tt } } ⟩ instance : complete_lattice (uniform_space Ξ±) := { sup := Ξ»a b, Inf {x | a ≀ x ∧ b ≀ x}, le_sup_left := Ξ» a b, le_Inf (Ξ» _ ⟨h, _⟩, h), le_sup_right := Ξ» a b, le_Inf (Ξ» _ ⟨_, h⟩, h), sup_le := Ξ» a b c h₁ hβ‚‚, Inf_le ⟨h₁, hβ‚‚βŸ©, inf := Ξ» a b, Inf {a, b}, le_inf := Ξ» a b c h₁ hβ‚‚, le_Inf (Ξ» u h, by { cases h, exact h.symm β–Έ h₁, exact (mem_singleton_iff.1 h).symm β–Έ hβ‚‚ }), inf_le_left := Ξ» a b, Inf_le (by simp), inf_le_right := Ξ» a b, Inf_le (by simp), top := ⊀, le_top := Ξ» a, show a.uniformity ≀ ⊀, from le_top, bot := βŠ₯, bot_le := Ξ» u, u.refl, Sup := Ξ» tt, Inf {t | βˆ€ t' ∈ tt, t' ≀ t}, le_Sup := Ξ» s u h, le_Inf (Ξ» u' h', h' u h), Sup_le := Ξ» s u h, Inf_le h, Inf := Inf, le_Inf := Ξ» s a hs, le_Inf hs, Inf_le := Ξ» s a ha, Inf_le ha, ..uniform_space.partial_order } lemma infi_uniformity {ΞΉ : Sort*} {u : ΞΉ β†’ uniform_space Ξ±} : (infi u).uniformity = (β¨…i, (u i).uniformity) := show (β¨…a (h : βˆƒi:ΞΉ, u i = a), a.uniformity) = _, from le_antisymm (le_infi $ assume i, infi_le_of_le (u i) $ infi_le _ ⟨i, rfl⟩) (le_infi $ assume a, le_infi $ assume ⟨i, (ha : u i = a)⟩, ha β–Έ infi_le _ _) lemma infi_uniformity' {ΞΉ : Sort*} {u : ΞΉ β†’ uniform_space Ξ±} : @uniformity Ξ± (infi u) = (β¨…i, @uniformity Ξ± (u i)) := infi_uniformity lemma inf_uniformity {u v : uniform_space Ξ±} : (u βŠ“ v).uniformity = u.uniformity βŠ“ v.uniformity := have (u βŠ“ v) = (β¨…i (h : i = u ∨ i = v), i), by simp [infi_or, infi_inf_eq], calc (u βŠ“ v).uniformity = ((β¨…i (h : i = u ∨ i = v), i) : uniform_space Ξ±).uniformity : by rw [this] ... = _ : by simp [infi_uniformity, infi_or, infi_inf_eq] lemma inf_uniformity' {u v : uniform_space Ξ±} : @uniformity Ξ± (u βŠ“ v) = @uniformity Ξ± u βŠ“ @uniformity Ξ± v := inf_uniformity instance inhabited_uniform_space : inhabited (uniform_space Ξ±) := ⟨βŠ₯⟩ instance inhabited_uniform_space_core : inhabited (uniform_space.core Ξ±) := ⟨@uniform_space.to_core _ default⟩ /-- Given `f : Ξ± β†’ Ξ²` and a uniformity `u` on `Ξ²`, the inverse image of `u` under `f` is the inverse image in the filter sense of the induced function `Ξ± Γ— Ξ± β†’ Ξ² Γ— Ξ²`. -/ def uniform_space.comap (f : Ξ± β†’ Ξ²) (u : uniform_space Ξ²) : uniform_space Ξ± := { uniformity := u.uniformity.comap (Ξ»p:Ξ±Γ—Ξ±, (f p.1, f p.2)), to_topological_space := u.to_topological_space.induced f, refl := le_trans (by simp; exact assume ⟨a, b⟩ (h : a = b), h β–Έ rfl) (comap_mono u.refl), symm := by simp [tendsto_comap_iff, prod.swap, (∘)]; exact tendsto_swap_uniformity.comp tendsto_comap, comp := le_trans begin rw [comap_lift'_eq, comap_lift'_eq2], exact (lift'_mono' $ assume s hs ⟨a₁, aβ‚‚βŸ© ⟨x, h₁, hβ‚‚βŸ©, ⟨f x, h₁, hβ‚‚βŸ©), exact monotone_comp_rel monotone_id monotone_id end (comap_mono u.comp), is_open_uniformity := Ξ» s, begin change (@is_open Ξ± (u.to_topological_space.induced f) s ↔ _), simp [is_open_iff_nhds, nhds_induced, mem_nhds_uniformity_iff_right, filter.comap, and_comm], refine ball_congr (Ξ» x hx, ⟨_, _⟩), { rintro ⟨t, hts, ht⟩, refine ⟨_, ht, _⟩, rintro ⟨x₁, xβ‚‚βŸ© h rfl, exact hts (h rfl) }, { rintro ⟨t, ht, hts⟩, exact ⟨{y | (f x, y) ∈ t}, Ξ» y hy, @hts (x, y) hy rfl, mem_nhds_uniformity_iff_right.1 $ mem_nhds_left _ ht⟩ } end } lemma uniformity_comap [uniform_space Ξ±] [uniform_space Ξ²] {f : Ξ± β†’ Ξ²} (h : β€Ήuniform_space Ξ±β€Ί = uniform_space.comap f β€Ήuniform_space Ξ²β€Ί) : 𝓀 Ξ± = comap (prod.map f f) (𝓀 Ξ²) := by { rw h, refl } lemma uniform_space_comap_id {Ξ± : Type*} : uniform_space.comap (id : Ξ± β†’ Ξ±) = id := by ext u ; dsimp only [uniform_space.comap, id] ; rw [prod.id_prod, filter.comap_id] lemma uniform_space.comap_comap {Ξ± Ξ² Ξ³} [uΞ³ : uniform_space Ξ³] {f : Ξ± β†’ Ξ²} {g : Ξ² β†’ Ξ³} : uniform_space.comap (g ∘ f) uΞ³ = uniform_space.comap f (uniform_space.comap g uΞ³) := by ext ; dsimp only [uniform_space.comap] ; rw filter.comap_comap lemma uniform_space.comap_inf {Ξ± Ξ³} {u₁ uβ‚‚ : uniform_space Ξ³} {f : Ξ± β†’ Ξ³} : (u₁ βŠ“ uβ‚‚).comap f = u₁.comap f βŠ“ uβ‚‚.comap f := begin ext : 1, change (𝓀 _) = (𝓀 _), simp [uniformity_comap rfl, inf_uniformity'], end lemma uniform_space.comap_infi {ΞΉ Ξ± Ξ³} {u : ΞΉ β†’ uniform_space Ξ³} {f : Ξ± β†’ Ξ³} : (β¨… i, u i).comap f = β¨… i, (u i).comap f := begin ext : 1, change (𝓀 _) = (𝓀 _), simp [uniformity_comap rfl, infi_uniformity'] end lemma uniform_space.comap_mono {Ξ± Ξ³} {f : Ξ± β†’ Ξ³} : monotone (Ξ» u : uniform_space Ξ³, u.comap f) := begin intros u₁ uβ‚‚ hu, change (𝓀 _) ≀ (𝓀 _), rw uniformity_comap rfl, exact comap_mono hu end lemma uniform_continuous_iff {Ξ± Ξ²} [uΞ± : uniform_space Ξ±] [uΞ² : uniform_space Ξ²] {f : Ξ± β†’ Ξ²} : uniform_continuous f ↔ uΞ± ≀ uΞ².comap f := filter.map_le_iff_le_comap lemma le_iff_uniform_continuous_id {u v : uniform_space Ξ±} : u ≀ v ↔ @uniform_continuous _ _ u v id := by rw [uniform_continuous_iff, uniform_space_comap_id, id] lemma uniform_continuous_comap {f : Ξ± β†’ Ξ²} [u : uniform_space Ξ²] : @uniform_continuous Ξ± Ξ² (uniform_space.comap f u) u f := tendsto_comap theorem to_topological_space_comap {f : Ξ± β†’ Ξ²} {u : uniform_space Ξ²} : @uniform_space.to_topological_space _ (uniform_space.comap f u) = topological_space.induced f (@uniform_space.to_topological_space Ξ² u) := rfl lemma uniform_continuous_comap' {f : Ξ³ β†’ Ξ²} {g : Ξ± β†’ Ξ³} [v : uniform_space Ξ²] [u : uniform_space Ξ±] (h : uniform_continuous (f ∘ g)) : @uniform_continuous Ξ± Ξ³ u (uniform_space.comap f v) g := tendsto_comap_iff.2 h lemma to_nhds_mono {u₁ uβ‚‚ : uniform_space Ξ±} (h : u₁ ≀ uβ‚‚) (a : Ξ±) : @nhds _ (@uniform_space.to_topological_space _ u₁) a ≀ @nhds _ (@uniform_space.to_topological_space _ uβ‚‚) a := by rw [@nhds_eq_uniformity Ξ± u₁ a, @nhds_eq_uniformity Ξ± uβ‚‚ a]; exact (lift'_mono h le_rfl) lemma to_topological_space_mono {u₁ uβ‚‚ : uniform_space Ξ±} (h : u₁ ≀ uβ‚‚) : @uniform_space.to_topological_space _ u₁ ≀ @uniform_space.to_topological_space _ uβ‚‚ := le_of_nhds_le_nhds $ to_nhds_mono h lemma uniform_continuous.continuous [uniform_space Ξ±] [uniform_space Ξ²] {f : Ξ± β†’ Ξ²} (hf : uniform_continuous f) : continuous f := continuous_iff_le_induced.mpr $ to_topological_space_mono $ uniform_continuous_iff.1 hf lemma to_topological_space_bot : @uniform_space.to_topological_space Ξ± βŠ₯ = βŠ₯ := rfl lemma to_topological_space_top : @uniform_space.to_topological_space Ξ± ⊀ = ⊀ := top_unique $ assume s hs, s.eq_empty_or_nonempty.elim (assume : s = βˆ…, this.symm β–Έ @is_open_empty _ ⊀) (assume ⟨x, hx⟩, have s = univ, from top_unique $ assume y hy, hs x hx (x, y) rfl, this.symm β–Έ @is_open_univ _ ⊀) lemma to_topological_space_infi {ΞΉ : Sort*} {u : ΞΉ β†’ uniform_space Ξ±} : (infi u).to_topological_space = β¨…i, (u i).to_topological_space := begin refine (eq_of_nhds_eq_nhds $ assume a, _), rw [nhds_infi, nhds_eq_uniformity], change (infi u).uniformity.lift' (preimage $ prod.mk a) = _, rw [infi_uniformity, lift'_infi_of_map_univ _ preimage_univ], { simp only [nhds_eq_uniformity], refl }, { exact Ξ» a b, preimage_inter } end lemma to_topological_space_Inf {s : set (uniform_space Ξ±)} : (Inf s).to_topological_space = (β¨…i∈s, @uniform_space.to_topological_space Ξ± i) := begin rw [Inf_eq_infi], simp only [← to_topological_space_infi], end lemma to_topological_space_inf {u v : uniform_space Ξ±} : (u βŠ“ v).to_topological_space = u.to_topological_space βŠ“ v.to_topological_space := by rw [to_topological_space_Inf, infi_pair] /-- A uniform space with the discrete uniformity has the discrete topology. -/ lemma discrete_topology_of_discrete_uniformity [hΞ± : uniform_space Ξ±] (h : uniformity Ξ± = π“Ÿ id_rel) : discrete_topology Ξ± := ⟨(uniform_space_eq h.symm : βŠ₯ = hΞ±) β–Έ rfl⟩ instance : uniform_space empty := βŠ₯ instance : uniform_space punit := βŠ₯ instance : uniform_space bool := βŠ₯ instance : uniform_space β„• := βŠ₯ instance : uniform_space β„€ := βŠ₯ instance {p : Ξ± β†’ Prop} [t : uniform_space Ξ±] : uniform_space (subtype p) := uniform_space.comap subtype.val t lemma uniformity_subtype {p : Ξ± β†’ Prop} [t : uniform_space Ξ±] : 𝓀 (subtype p) = comap (Ξ»q:subtype p Γ— subtype p, (q.1.1, q.2.1)) (𝓀 Ξ±) := rfl lemma uniform_continuous_subtype_val {p : Ξ± β†’ Prop} [uniform_space Ξ±] : uniform_continuous (subtype.val : {a : Ξ± // p a} β†’ Ξ±) := uniform_continuous_comap lemma uniform_continuous_subtype_coe {p : Ξ± β†’ Prop} [uniform_space Ξ±] : uniform_continuous (coe : {a : Ξ± // p a} β†’ Ξ±) := uniform_continuous_subtype_val lemma uniform_continuous_subtype_mk {p : Ξ± β†’ Prop} [uniform_space Ξ±] [uniform_space Ξ²] {f : Ξ² β†’ Ξ±} (hf : uniform_continuous f) (h : βˆ€x, p (f x)) : uniform_continuous (Ξ»x, ⟨f x, h x⟩ : Ξ² β†’ subtype p) := uniform_continuous_comap' hf lemma uniform_continuous_on_iff_restrict [uniform_space Ξ±] [uniform_space Ξ²] {f : Ξ± β†’ Ξ²} {s : set Ξ±} : uniform_continuous_on f s ↔ uniform_continuous (s.restrict f) := begin unfold uniform_continuous_on set.restrict uniform_continuous tendsto, rw [show (Ξ» x : s Γ— s, (f x.1, f x.2)) = prod.map f f ∘ coe, by ext x; cases x; refl, uniformity_comap rfl, show prod.map subtype.val subtype.val = (coe : s Γ— s β†’ Ξ± Γ— Ξ±), by ext x; cases x; refl], conv in (map _ (comap _ _)) { rw ← filter.map_map }, rw subtype_coe_map_comap_prod, refl, end lemma tendsto_of_uniform_continuous_subtype [uniform_space Ξ±] [uniform_space Ξ²] {f : Ξ± β†’ Ξ²} {s : set Ξ±} {a : Ξ±} (hf : uniform_continuous (Ξ»x:s, f x.val)) (ha : s ∈ 𝓝 a) : tendsto f (𝓝 a) (𝓝 (f a)) := by rw [(@map_nhds_subtype_coe_eq Ξ± _ s a (mem_of_mem_nhds ha) ha).symm]; exact tendsto_map' (continuous_iff_continuous_at.mp hf.continuous _) lemma uniform_continuous_on.continuous_on [uniform_space Ξ±] [uniform_space Ξ²] {f : Ξ± β†’ Ξ²} {s : set Ξ±} (h : uniform_continuous_on f s) : continuous_on f s := begin rw uniform_continuous_on_iff_restrict at h, rw continuous_on_iff_continuous_restrict, exact h.continuous end @[to_additive] instance [uniform_space Ξ±] : uniform_space (αᡐᡒᡖ) := uniform_space.comap mul_opposite.unop β€Ή_β€Ί @[to_additive] lemma uniformity_mul_opposite [uniform_space Ξ±] : 𝓀 (αᡐᡒᡖ) = comap (Ξ» q : αᡐᡒᡖ Γ— αᡐᡒᡖ, (q.1.unop, q.2.unop)) (𝓀 Ξ±) := rfl @[simp, to_additive] lemma comap_uniformity_mul_opposite [uniform_space Ξ±] : comap (Ξ» p : Ξ± Γ— Ξ±, (mul_opposite.op p.1, mul_opposite.op p.2)) (𝓀 αᡐᡒᡖ) = 𝓀 Ξ± := by simpa [uniformity_mul_opposite, comap_comap, (∘)] using comap_id namespace mul_opposite @[to_additive] lemma uniform_continuous_unop [uniform_space Ξ±] : uniform_continuous (unop : αᡐᡒᡖ β†’ Ξ±) := uniform_continuous_comap @[to_additive] lemma uniform_continuous_op [uniform_space Ξ±] : uniform_continuous (op : Ξ± β†’ αᡐᡒᡖ) := uniform_continuous_comap' uniform_continuous_id end mul_opposite section prod /- a similar product space is possible on the function space (uniformity of pointwise convergence), but we want to have the uniformity of uniform convergence on function spaces -/ instance [u₁ : uniform_space Ξ±] [uβ‚‚ : uniform_space Ξ²] : uniform_space (Ξ± Γ— Ξ²) := uniform_space.of_core_eq (u₁.comap prod.fst βŠ“ uβ‚‚.comap prod.snd).to_core prod.topological_space (calc prod.topological_space = (u₁.comap prod.fst βŠ“ uβ‚‚.comap prod.snd).to_topological_space : by rw [to_topological_space_inf, to_topological_space_comap, to_topological_space_comap]; refl ... = _ : by rw [uniform_space.to_core_to_topological_space]) theorem uniformity_prod [uniform_space Ξ±] [uniform_space Ξ²] : 𝓀 (Ξ± Γ— Ξ²) = (𝓀 Ξ±).comap (Ξ»p:(Ξ± Γ— Ξ²) Γ— Ξ± Γ— Ξ², (p.1.1, p.2.1)) βŠ“ (𝓀 Ξ²).comap (Ξ»p:(Ξ± Γ— Ξ²) Γ— Ξ± Γ— Ξ², (p.1.2, p.2.2)) := inf_uniformity lemma uniformity_prod_eq_prod [uniform_space Ξ±] [uniform_space Ξ²] : 𝓀 (Ξ± Γ— Ξ²) = map (Ξ» p : (Ξ± Γ— Ξ±) Γ— (Ξ² Γ— Ξ²), ((p.1.1, p.2.1), (p.1.2, p.2.2))) (𝓀 Ξ± Γ—αΆ  𝓀 Ξ²) := by rw [map_swap4_eq_comap, uniformity_prod, filter.prod, comap_inf, comap_comap, comap_comap] lemma mem_map_iff_exists_image' {Ξ± : Type*} {Ξ² : Type*} {f : filter Ξ±} {m : Ξ± β†’ Ξ²} {t : set Ξ²} : t ∈ (map m f).sets ↔ (βˆƒs∈f, m '' s βŠ† t) := mem_map_iff_exists_image lemma mem_uniformity_of_uniform_continuous_invariant [uniform_space Ξ±] {s:set (Ξ±Γ—Ξ±)} {f : Ξ± β†’ Ξ± β†’ Ξ±} (hf : uniform_continuous (Ξ»p:Ξ±Γ—Ξ±, f p.1 p.2)) (hs : s ∈ 𝓀 Ξ±) : βˆƒuβˆˆπ“€ Ξ±, βˆ€a b c, (a, b) ∈ u β†’ (f a c, f b c) ∈ s := begin rw [uniform_continuous, uniformity_prod_eq_prod, tendsto_map'_iff, (∘)] at hf, rcases mem_map_iff_exists_image'.1 (hf hs) with ⟨t, ht, hts⟩, clear hf, rcases mem_prod_iff.1 ht with ⟨u, hu, v, hv, huvt⟩, clear ht, refine ⟨u, hu, assume a b c hab, hts $ (mem_image _ _ _).2 ⟨⟨⟨a, b⟩, ⟨c, c⟩⟩, huvt ⟨_, _⟩, _⟩⟩, exact hab, exact refl_mem_uniformity hv, refl end lemma mem_uniform_prod [t₁ : uniform_space Ξ±] [tβ‚‚ : uniform_space Ξ²] {a : set (Ξ± Γ— Ξ±)} {b : set (Ξ² Γ— Ξ²)} (ha : a ∈ 𝓀 Ξ±) (hb : b ∈ 𝓀 Ξ²) : {p:(Ξ±Γ—Ξ²)Γ—(Ξ±Γ—Ξ²) | (p.1.1, p.2.1) ∈ a ∧ (p.1.2, p.2.2) ∈ b } ∈ (@uniformity (Ξ± Γ— Ξ²) _) := by rw [uniformity_prod]; exact inter_mem_inf (preimage_mem_comap ha) (preimage_mem_comap hb) lemma tendsto_prod_uniformity_fst [uniform_space Ξ±] [uniform_space Ξ²] : tendsto (Ξ»p:(Ξ±Γ—Ξ²)Γ—(Ξ±Γ—Ξ²), (p.1.1, p.2.1)) (𝓀 (Ξ± Γ— Ξ²)) (𝓀 Ξ±) := le_trans (map_mono (@inf_le_left (uniform_space (Ξ±Γ—Ξ²)) _ _ _)) map_comap_le lemma tendsto_prod_uniformity_snd [uniform_space Ξ±] [uniform_space Ξ²] : tendsto (Ξ»p:(Ξ±Γ—Ξ²)Γ—(Ξ±Γ—Ξ²), (p.1.2, p.2.2)) (𝓀 (Ξ± Γ— Ξ²)) (𝓀 Ξ²) := le_trans (map_mono (@inf_le_right (uniform_space (Ξ±Γ—Ξ²)) _ _ _)) map_comap_le lemma uniform_continuous_fst [uniform_space Ξ±] [uniform_space Ξ²] : uniform_continuous (Ξ»p:Ξ±Γ—Ξ², p.1) := tendsto_prod_uniformity_fst lemma uniform_continuous_snd [uniform_space Ξ±] [uniform_space Ξ²] : uniform_continuous (Ξ»p:Ξ±Γ—Ξ², p.2) := tendsto_prod_uniformity_snd variables [uniform_space Ξ±] [uniform_space Ξ²] [uniform_space Ξ³] lemma uniform_continuous.prod_mk {f₁ : Ξ± β†’ Ξ²} {fβ‚‚ : Ξ± β†’ Ξ³} (h₁ : uniform_continuous f₁) (hβ‚‚ : uniform_continuous fβ‚‚) : uniform_continuous (Ξ»a, (f₁ a, fβ‚‚ a)) := by rw [uniform_continuous, uniformity_prod]; exact tendsto_inf.2 ⟨tendsto_comap_iff.2 h₁, tendsto_comap_iff.2 hβ‚‚βŸ© lemma uniform_continuous.prod_mk_left {f : Ξ± Γ— Ξ² β†’ Ξ³} (h : uniform_continuous f) (b) : uniform_continuous (Ξ» a, f (a,b)) := h.comp (uniform_continuous_id.prod_mk uniform_continuous_const) lemma uniform_continuous.prod_mk_right {f : Ξ± Γ— Ξ² β†’ Ξ³} (h : uniform_continuous f) (a) : uniform_continuous (Ξ» b, f (a,b)) := h.comp (uniform_continuous_const.prod_mk uniform_continuous_id) lemma uniform_continuous.prod_map [uniform_space Ξ΄] {f : Ξ± β†’ Ξ³} {g : Ξ² β†’ Ξ΄} (hf : uniform_continuous f) (hg : uniform_continuous g) : uniform_continuous (prod.map f g) := (hf.comp uniform_continuous_fst).prod_mk (hg.comp uniform_continuous_snd) lemma to_topological_space_prod {Ξ±} {Ξ²} [u : uniform_space Ξ±] [v : uniform_space Ξ²] : @uniform_space.to_topological_space (Ξ± Γ— Ξ²) prod.uniform_space = @prod.topological_space Ξ± Ξ² u.to_topological_space v.to_topological_space := rfl end prod section open uniform_space function variables {Ξ΄' : Type*} [uniform_space Ξ±] [uniform_space Ξ²] [uniform_space Ξ³] [uniform_space Ξ΄] [uniform_space Ξ΄'] local notation f `βˆ˜β‚‚` g := function.bicompr f g /-- Uniform continuity for functions of two variables. -/ def uniform_continuousβ‚‚ (f : Ξ± β†’ Ξ² β†’ Ξ³) := uniform_continuous (uncurry f) lemma uniform_continuousβ‚‚_def (f : Ξ± β†’ Ξ² β†’ Ξ³) : uniform_continuousβ‚‚ f ↔ uniform_continuous (uncurry f) := iff.rfl lemma uniform_continuousβ‚‚.uniform_continuous {f : Ξ± β†’ Ξ² β†’ Ξ³} (h : uniform_continuousβ‚‚ f) : uniform_continuous (uncurry f) := h lemma uniform_continuousβ‚‚_curry (f : Ξ± Γ— Ξ² β†’ Ξ³) : uniform_continuousβ‚‚ (function.curry f) ↔ uniform_continuous f := by rw [uniform_continuousβ‚‚, uncurry_curry] lemma uniform_continuousβ‚‚.comp {f : Ξ± β†’ Ξ² β†’ Ξ³} {g : Ξ³ β†’ Ξ΄} (hg : uniform_continuous g) (hf : uniform_continuousβ‚‚ f) : uniform_continuousβ‚‚ (g βˆ˜β‚‚ f) := hg.comp hf lemma uniform_continuousβ‚‚.bicompl {f : Ξ± β†’ Ξ² β†’ Ξ³} {ga : Ξ΄ β†’ Ξ±} {gb : Ξ΄' β†’ Ξ²} (hf : uniform_continuousβ‚‚ f) (hga : uniform_continuous ga) (hgb : uniform_continuous gb) : uniform_continuousβ‚‚ (bicompl f ga gb) := hf.uniform_continuous.comp (hga.prod_map hgb) end lemma to_topological_space_subtype [u : uniform_space Ξ±] {p : Ξ± β†’ Prop} : @uniform_space.to_topological_space (subtype p) subtype.uniform_space = @subtype.topological_space Ξ± p u.to_topological_space := rfl section sum variables [uniform_space Ξ±] [uniform_space Ξ²] open sum /-- Uniformity on a disjoint union. Entourages of the diagonal in the union are obtained by taking independently an entourage of the diagonal in the first part, and an entourage of the diagonal in the second part. -/ def uniform_space.core.sum : uniform_space.core (Ξ± βŠ• Ξ²) := uniform_space.core.mk' (map (Ξ» p : Ξ± Γ— Ξ±, (inl p.1, inl p.2)) (𝓀 Ξ±) βŠ” map (Ξ» p : Ξ² Γ— Ξ², (inr p.1, inr p.2)) (𝓀 Ξ²)) (Ξ» r ⟨H₁, Hβ‚‚βŸ© x, by cases x; [apply refl_mem_uniformity H₁, apply refl_mem_uniformity Hβ‚‚]) (Ξ» r ⟨H₁, Hβ‚‚βŸ©, ⟨symm_le_uniformity H₁, symm_le_uniformity Hβ‚‚βŸ©) (Ξ» r ⟨HrΞ±, Hrβ⟩, begin rcases comp_mem_uniformity_sets HrΞ± with ⟨tΞ±, htΞ±, Htα⟩, rcases comp_mem_uniformity_sets HrΞ² with ⟨tΞ², htΞ², Htβ⟩, refine ⟨_, ⟨mem_map_iff_exists_image.2 ⟨tΞ±, htΞ±, subset_union_left _ _⟩, mem_map_iff_exists_image.2 ⟨tΞ², htΞ², subset_union_right _ _⟩⟩, _⟩, rintros ⟨_, _⟩ ⟨z, ⟨⟨a, b⟩, hab, ⟨⟩⟩ | ⟨⟨a, b⟩, hab, ⟨⟩⟩, ⟨⟨_, c⟩, hbc, ⟨⟩⟩ | ⟨⟨_, c⟩, hbc, ⟨⟩⟩⟩, { have A : (a, c) ∈ tΞ± β—‹ tΞ± := ⟨b, hab, hbc⟩, exact HtΞ± A }, { have A : (a, c) ∈ tΞ² β—‹ tΞ² := ⟨b, hab, hbc⟩, exact HtΞ² A } end) /-- The union of an entourage of the diagonal in each set of a disjoint union is again an entourage of the diagonal. -/ lemma union_mem_uniformity_sum {a : set (Ξ± Γ— Ξ±)} (ha : a ∈ 𝓀 Ξ±) {b : set (Ξ² Γ— Ξ²)} (hb : b ∈ 𝓀 Ξ²) : ((Ξ» p : (Ξ± Γ— Ξ±), (inl p.1, inl p.2)) '' a βˆͺ (Ξ» p : (Ξ² Γ— Ξ²), (inr p.1, inr p.2)) '' b) ∈ (@uniform_space.core.sum Ξ± Ξ² _ _).uniformity := ⟨mem_map_iff_exists_image.2 ⟨_, ha, subset_union_left _ _⟩, mem_map_iff_exists_image.2 ⟨_, hb, subset_union_right _ _⟩⟩ /- To prove that the topology defined by the uniform structure on the disjoint union coincides with the disjoint union topology, we need two lemmas saying that open sets can be characterized by the uniform structure -/ lemma uniformity_sum_of_open_aux {s : set (Ξ± βŠ• Ξ²)} (hs : is_open s) {x : Ξ± βŠ• Ξ²} (xs : x ∈ s) : { p : ((Ξ± βŠ• Ξ²) Γ— (Ξ± βŠ• Ξ²)) | p.1 = x β†’ p.2 ∈ s } ∈ (@uniform_space.core.sum Ξ± Ξ² _ _).uniformity := begin cases x, { refine mem_of_superset (union_mem_uniformity_sum (mem_nhds_uniformity_iff_right.1 (is_open.mem_nhds hs.1 xs)) univ_mem) (union_subset _ _); rintro _ ⟨⟨_, b⟩, h, ⟨⟩⟩ ⟨⟩, exact h rfl }, { refine mem_of_superset (union_mem_uniformity_sum univ_mem (mem_nhds_uniformity_iff_right.1 (is_open.mem_nhds hs.2 xs))) (union_subset _ _); rintro _ ⟨⟨a, _⟩, h, ⟨⟩⟩ ⟨⟩, exact h rfl }, end lemma open_of_uniformity_sum_aux {s : set (Ξ± βŠ• Ξ²)} (hs : βˆ€x ∈ s, { p : ((Ξ± βŠ• Ξ²) Γ— (Ξ± βŠ• Ξ²)) | p.1 = x β†’ p.2 ∈ s } ∈ (@uniform_space.core.sum Ξ± Ξ² _ _).uniformity) : is_open s := begin split, { refine (@is_open_iff_mem_nhds Ξ± _ _).2 (Ξ» a ha, mem_nhds_uniformity_iff_right.2 _), rcases mem_map_iff_exists_image.1 (hs _ ha).1 with ⟨t, ht, st⟩, refine mem_of_superset ht _, rintro p pt rfl, exact st ⟨_, pt, rfl⟩ rfl }, { refine (@is_open_iff_mem_nhds Ξ² _ _).2 (Ξ» b hb, mem_nhds_uniformity_iff_right.2 _), rcases mem_map_iff_exists_image.1 (hs _ hb).2 with ⟨t, ht, st⟩, refine mem_of_superset ht _, rintro p pt rfl, exact st ⟨_, pt, rfl⟩ rfl } end /- We can now define the uniform structure on the disjoint union -/ instance sum.uniform_space : uniform_space (Ξ± βŠ• Ξ²) := { to_core := uniform_space.core.sum, is_open_uniformity := Ξ» s, ⟨uniformity_sum_of_open_aux, open_of_uniformity_sum_aux⟩ } lemma sum.uniformity : 𝓀 (Ξ± βŠ• Ξ²) = map (Ξ» p : Ξ± Γ— Ξ±, (inl p.1, inl p.2)) (𝓀 Ξ±) βŠ” map (Ξ» p : Ξ² Γ— Ξ², (inr p.1, inr p.2)) (𝓀 Ξ²) := rfl end sum end constructions -- For a version of the Lebesgue number lemma assuming only a sequentially compact space, -- see topology/sequences.lean /-- Let `c : ΞΉ β†’ set Ξ±` be an open cover of a compact set `s`. Then there exists an entourage `n` such that for each `x ∈ s` its `n`-neighborhood is contained in some `c i`. -/ lemma lebesgue_number_lemma {Ξ± : Type u} [uniform_space Ξ±] {s : set Ξ±} {ΞΉ} {c : ΞΉ β†’ set Ξ±} (hs : is_compact s) (hc₁ : βˆ€ i, is_open (c i)) (hcβ‚‚ : s βŠ† ⋃ i, c i) : βˆƒ n ∈ 𝓀 Ξ±, βˆ€ x ∈ s, βˆƒ i, {y | (x, y) ∈ n} βŠ† c i := begin let u := Ξ» n, {x | βˆƒ i (m ∈ 𝓀 Ξ±), {y | (x, y) ∈ m β—‹ n} βŠ† c i}, have hu₁ : βˆ€ n ∈ 𝓀 Ξ±, is_open (u n), { refine Ξ» n hn, is_open_uniformity.2 _, rintro x ⟨i, m, hm, h⟩, rcases comp_mem_uniformity_sets hm with ⟨m', hm', mm'⟩, apply (𝓀 Ξ±).sets_of_superset hm', rintros ⟨x, y⟩ hp rfl, refine ⟨i, m', hm', Ξ» z hz, h (monotone_comp_rel monotone_id monotone_const mm' _)⟩, dsimp [-mem_comp_rel] at hz ⊒, rw comp_rel_assoc, exact ⟨y, hp, hz⟩ }, have huβ‚‚ : s βŠ† ⋃ n ∈ 𝓀 Ξ±, u n, { intros x hx, rcases mem_Union.1 (hcβ‚‚ hx) with ⟨i, h⟩, rcases comp_mem_uniformity_sets (is_open_uniformity.1 (hc₁ i) x h) with ⟨m', hm', mm'⟩, exact mem_bUnion hm' ⟨i, _, hm', Ξ» y hy, mm' hy rfl⟩ }, rcases hs.elim_finite_subcover_image hu₁ huβ‚‚ with ⟨b, bu, b_fin, b_cover⟩, refine ⟨_, (bInter_mem b_fin).2 bu, Ξ» x hx, _⟩, rcases mem_Unionβ‚‚.1 (b_cover hx) with ⟨n, bn, i, m, hm, h⟩, refine ⟨i, Ξ» y hy, h _⟩, exact prod_mk_mem_comp_rel (refl_mem_uniformity hm) (bInter_subset_of_mem bn hy) end /-- Let `c : set (set Ξ±)` be an open cover of a compact set `s`. Then there exists an entourage `n` such that for each `x ∈ s` its `n`-neighborhood is contained in some `t ∈ c`. -/ lemma lebesgue_number_lemma_sUnion {Ξ± : Type u} [uniform_space Ξ±] {s : set Ξ±} {c : set (set Ξ±)} (hs : is_compact s) (hc₁ : βˆ€ t ∈ c, is_open t) (hcβ‚‚ : s βŠ† ⋃₀ c) : βˆƒ n ∈ 𝓀 Ξ±, βˆ€ x ∈ s, βˆƒ t ∈ c, βˆ€ y, (x, y) ∈ n β†’ y ∈ t := by rw sUnion_eq_Union at hcβ‚‚; simpa using lebesgue_number_lemma hs (by simpa) hcβ‚‚ /-- A useful consequence of the Lebesgue number lemma: given any compact set `K` contained in an open set `U`, we can find an (open) entourage `V` such that the ball of size `V` about any point of `K` is contained in `U`. -/ lemma lebesgue_number_of_compact_open [uniform_space Ξ±] {K U : set Ξ±} (hK : is_compact K) (hU : is_open U) (hKU : K βŠ† U) : βˆƒ V ∈ 𝓀 Ξ±, is_open V ∧ βˆ€ x ∈ K, uniform_space.ball x V βŠ† U := begin let W : K β†’ set (Ξ± Γ— Ξ±) := Ξ» k, classical.some $ is_open_iff_open_ball_subset.mp hU k.1 $ hKU k.2, have hW : βˆ€ k, W k ∈ 𝓀 Ξ± ∧ is_open (W k) ∧ uniform_space.ball k.1 (W k) βŠ† U, { intros k, obtain ⟨h₁, hβ‚‚, hβ‚ƒβŸ© := classical.some_spec (is_open_iff_open_ball_subset.mp hU k.1 (hKU k.2)), exact ⟨h₁, hβ‚‚, hβ‚ƒβŸ©, }, let c : K β†’ set Ξ± := Ξ» k, uniform_space.ball k.1 (W k), have hc₁ : βˆ€ k, is_open (c k), { exact Ξ» k, uniform_space.is_open_ball k.1 (hW k).2.1, }, have hcβ‚‚ : K βŠ† ⋃ i, c i, { intros k hk, simp only [mem_Union, set_coe.exists], exact ⟨k, hk, uniform_space.mem_ball_self k (hW ⟨k, hk⟩).1⟩, }, have hc₃ : βˆ€ k, c k βŠ† U, { exact Ξ» k, (hW k).2.2, }, obtain ⟨V, hV, hV'⟩ := lebesgue_number_lemma hK hc₁ hcβ‚‚, refine ⟨interior V, interior_mem_uniformity hV, is_open_interior, _⟩, intros k hk, obtain ⟨k', hk'⟩ := hV' k hk, exact ((ball_mono interior_subset k).trans hk').trans (hc₃ k'), end /-! ### Expressing continuity properties in uniform spaces We reformulate the various continuity properties of functions taking values in a uniform space in terms of the uniformity in the target. Since the same lemmas (essentially with the same names) also exist for metric spaces and emetric spaces (reformulating things in terms of the distance or the edistance in the target), we put them in a namespace `uniform` here. In the metric and emetric space setting, there are also similar lemmas where one assumes that both the source and the target are metric spaces, reformulating things in terms of the distance on both sides. These lemmas are generally written without primes, and the versions where only the target is a metric space is primed. We follow the same convention here, thus giving lemmas with primes. -/ namespace uniform variables [uniform_space Ξ±] theorem tendsto_nhds_right {f : filter Ξ²} {u : Ξ² β†’ Ξ±} {a : Ξ±} : tendsto u f (𝓝 a) ↔ tendsto (Ξ» x, (a, u x)) f (𝓀 Ξ±) := ⟨λ H, tendsto_left_nhds_uniformity.comp H, Ξ» H s hs, by simpa [mem_of_mem_nhds hs] using H (mem_nhds_uniformity_iff_right.1 hs)⟩ theorem tendsto_nhds_left {f : filter Ξ²} {u : Ξ² β†’ Ξ±} {a : Ξ±} : tendsto u f (𝓝 a) ↔ tendsto (Ξ» x, (u x, a)) f (𝓀 Ξ±) := ⟨λ H, tendsto_right_nhds_uniformity.comp H, Ξ» H s hs, by simpa [mem_of_mem_nhds hs] using H (mem_nhds_uniformity_iff_left.1 hs)⟩ theorem continuous_at_iff'_right [topological_space Ξ²] {f : Ξ² β†’ Ξ±} {b : Ξ²} : continuous_at f b ↔ tendsto (Ξ» x, (f b, f x)) (𝓝 b) (𝓀 Ξ±) := by rw [continuous_at, tendsto_nhds_right] theorem continuous_at_iff'_left [topological_space Ξ²] {f : Ξ² β†’ Ξ±} {b : Ξ²} : continuous_at f b ↔ tendsto (Ξ» x, (f x, f b)) (𝓝 b) (𝓀 Ξ±) := by rw [continuous_at, tendsto_nhds_left] theorem continuous_at_iff_prod [topological_space Ξ²] {f : Ξ² β†’ Ξ±} {b : Ξ²} : continuous_at f b ↔ tendsto (Ξ» x : Ξ² Γ— Ξ², (f x.1, f x.2)) (𝓝 (b, b)) (𝓀 Ξ±) := ⟨λ H, le_trans (H.prod_map' H) (nhds_le_uniformity _), Ξ» H, continuous_at_iff'_left.2 $ H.comp $ tendsto_id.prod_mk_nhds tendsto_const_nhds⟩ theorem continuous_within_at_iff'_right [topological_space Ξ²] {f : Ξ² β†’ Ξ±} {b : Ξ²} {s : set Ξ²} : continuous_within_at f s b ↔ tendsto (Ξ» x, (f b, f x)) (𝓝[s] b) (𝓀 Ξ±) := by rw [continuous_within_at, tendsto_nhds_right] theorem continuous_within_at_iff'_left [topological_space Ξ²] {f : Ξ² β†’ Ξ±} {b : Ξ²} {s : set Ξ²} : continuous_within_at f s b ↔ tendsto (Ξ» x, (f x, f b)) (𝓝[s] b) (𝓀 Ξ±) := by rw [continuous_within_at, tendsto_nhds_left] theorem continuous_on_iff'_right [topological_space Ξ²] {f : Ξ² β†’ Ξ±} {s : set Ξ²} : continuous_on f s ↔ βˆ€ b ∈ s, tendsto (Ξ» x, (f b, f x)) (𝓝[s] b) (𝓀 Ξ±) := by simp [continuous_on, continuous_within_at_iff'_right] theorem continuous_on_iff'_left [topological_space Ξ²] {f : Ξ² β†’ Ξ±} {s : set Ξ²} : continuous_on f s ↔ βˆ€ b ∈ s, tendsto (Ξ» x, (f x, f b)) (𝓝[s] b) (𝓀 Ξ±) := by simp [continuous_on, continuous_within_at_iff'_left] theorem continuous_iff'_right [topological_space Ξ²] {f : Ξ² β†’ Ξ±} : continuous f ↔ βˆ€ b, tendsto (Ξ» x, (f b, f x)) (𝓝 b) (𝓀 Ξ±) := continuous_iff_continuous_at.trans $ forall_congr $ Ξ» b, tendsto_nhds_right theorem continuous_iff'_left [topological_space Ξ²] {f : Ξ² β†’ Ξ±} : continuous f ↔ βˆ€ b, tendsto (Ξ» x, (f x, f b)) (𝓝 b) (𝓀 Ξ±) := continuous_iff_continuous_at.trans $ forall_congr $ Ξ» b, tendsto_nhds_left end uniform lemma filter.tendsto.congr_uniformity {Ξ± Ξ²} [uniform_space Ξ²] {f g : Ξ± β†’ Ξ²} {l : filter Ξ±} {b : Ξ²} (hf : tendsto f l (𝓝 b)) (hg : tendsto (Ξ» x, (f x, g x)) l (𝓀 Ξ²)) : tendsto g l (𝓝 b) := uniform.tendsto_nhds_right.2 $ (uniform.tendsto_nhds_right.1 hf).uniformity_trans hg lemma uniform.tendsto_congr {Ξ± Ξ²} [uniform_space Ξ²] {f g : Ξ± β†’ Ξ²} {l : filter Ξ±} {b : Ξ²} (hfg : tendsto (Ξ» x, (f x, g x)) l (𝓀 Ξ²)) : tendsto f l (𝓝 b) ↔ tendsto g l (𝓝 b) := ⟨λ h, h.congr_uniformity hfg, Ξ» h, h.congr_uniformity hfg.uniformity_symm⟩
namespace prop_19 variables A B : Prop theorem prop_19 : (Β¬ Β¬ A ∧ Β¬ Β¬ (A β†’ B)) β†’ Β¬ Β¬ B := assume h1: Β¬ Β¬ A ∧ Β¬ Β¬ (A β†’ B), have h2: Β¬ Β¬ A, from and.left h1, have h3: A, from (classical.by_contradiction (assume h4: Β¬ A, h2 h4)), have h5: Β¬ Β¬ (A β†’ B), from and.right h1, have h6: A β†’ B, from (classical.by_contradiction (assume h7: Β¬(A β†’ B), h5 h7)), assume h8: Β¬ B, show false, from h8 (h6 h3) -- end namespace end prop_19
theory Reihen imports Complex_Main begin lemma gauss : "(\<Sum>i=0 .. (n::nat) . i) = n*(n+1) div 2" proof (induct n) case 0 show ?case by simp next case (Suc n) assume "\<Sum>{0..n} = n * (n + 1) div 2" thus ?case by simp qed lemma "(\<Sum>i=0..(n::nat) . (2*i - 1)) = n^2" using [[simp_trace_new mode=full]] proof (induct n) case 0 show ?case by simp next fix n case (Suc n) assume a:"(\<Sum>i = 0..n. 2 * i - 1) = n\<^sup>2" have " ((\<Sum>i = 0..Suc n. 2 * i - 1) = (Suc n)\<^sup>2) = ( (2*n+1) + (\<Sum>i = 0.. n. 2 * i - 1) = (Suc n)\<^sup>2)" by auto also have " \<dots> = ( (2*n+1) + (\<Sum>i = 0.. n. 2 * i - 1) = (n + 1)^2)" by simp also have "\<dots> = ( (2*n+1) + (\<Sum>i = 0.. n. 2 * i - 1) = n^2 + 2*n + 1) " unfolding power2_sum by simp also from a have " \<dots> = ( (2*n+1) + n^2 = n^2 + 2*n + 1) " by auto finally show ?case by auto qed lemma fixes n::nat shows"(\<Sum>i = 1 .. n . i^2) = (n*(n + 1)*(2*n + 1)) div 6" proof (induct n) case 0 show ?case by simp next fix n::nat case (Suc n) assume hyp:"(\<Sum>i = 1..n. i\<^sup>2) = (n * (n + 1) * (2 * n + 1)) div 6" have "Suc n * (Suc n + 1) * (2 * Suc n + 1) = (n + 1) * (n + 2) * (2 * n + 2 + 1) " by simp also have " \<dots> = (n^2 +3*n + 2) * (2 * n + 2 +1)" by (simp add : power2_eq_square) also have "\<dots> = (n^2 +3*n + 2) * (2 * n + 3)" proof - have tmp:"(2 * n + 2 +1) = (2 * n + 3)" by auto show ?thesis by (simp only: tmp ) qed also have "\<dots> = (n^2 +3*n + 2)*2*n + (n^2 +3*n + 2)*3" by (simp only : ring_distribs) also have "\<dots> = (n^2 +3*n + 2)*2*n + 3*n^2 +9*n + 6 " by (simp only : ring_distribs) also have "\<dots> = 2*(n^2)*n +6*n^2 + 4*n + 3*n^2 +9*n + 6" by (simp add : ring_distribs power2_eq_square) also have "\<dots> = 2*n^3 +9*n^2 + 13*n + 6 " by (simp add: power2_eq_square power3_eq_cube) finally have " (Suc n * (Suc n + 1) * (2 * Suc n + 1)) div 6 = (2 * n ^ 3 + 9 * n\<^sup>2 + 13 * n + 6) div 6" by simp note tmpResult1 = this have "(\<Sum>i = 1..Suc n. i\<^sup>2) = (\<Sum>i = 1 .. (n + 1). i\<^sup>2)" by simp also have "\<dots> = (n^2 + 2*n + 1)+ (\<Sum>i = 1 .. n. i\<^sup>2)" by (simp add : power2_eq_square) also have "\<dots> = (6*(n^2 + 2*n + 1) div 6) + (\<Sum>i = 1 .. n. i\<^sup>2)" by auto also have "\<dots> = ((6*n^2 + 12*n + 6) div 6) + (\<Sum>i = 1 .. n. i\<^sup>2)" by simp also have "\<dots> = ((6*n^2 + 12*n + 6) div 6) + (n * (n + 1) * (2 * n + 1)) div 6 " unfolding hyp by simp also have "\<dots> = ((6*n^2 + 12*n + 6) + (n * (n + 1) * (2 * n + 1)))div 6 " by simp also have "\<dots> = ((6*n^2 + 12*n + 6) + ((n^2 + n)* (2 * n + 1))) div 6" by (simp add : power2_eq_square ring_distribs) also have "\<dots> = ((6*n^2 + 12*n + 6) + (2*n^3 + 3*n^2 + n)) div 6" by (simp add : power2_eq_square power3_eq_cube ring_distribs) also have "\<dots> = (2*n^3 + 9*n^2 + 13*n + 6) div 6 " by simp note tmpResult2 = calculation from tmpResult1 and tmpResult2 show ?case by simp qed theorem fixes n:: nat and p::nat and q::nat shows "\<Sum> i = 0 .. n . " lemma " suminf (\<lambda>n. c^n) = (1 / (1 - c))" proof
{-# OPTIONS --cumulativity #-} open import Agda.Primitive data Unit : Set where unit : Unit record Container a : Set (lsuc a) where constructor _◁_ field Shape : Set a Pos : Shape β†’ Set a open Container public data Free {a : Level} (C : Container a) (A : Unit β†’ Set a) : Set a where pure : A unit β†’ Free C A impure : (s : Shape C) β†’ (Pos C s β†’ Free C A) β†’ Free C A ROp : βˆ€ a β†’ Container (lsuc a) ROp a = Set a ◁ Ξ» x β†’ x rop : {a : Level} {A : Unit β†’ Set a} β†’ Free (ROp a) A rop {_} {A} = impure (A unit) pure ropβ€² : {a : Level} {A : Unit β†’ Set (lsuc a)} β†’ Free (ROp a) A ropβ€² {a} {A} = rop {a} -- This should not work, A : Set (suc a) is too large. -- Passing it as an implicit parameter {A} gives the expected error.
[STATEMENT] lemma HNF_algorithm_soundness: assumes A: "A \<in> carrier_mat m n" shows "Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> (HNF_algorithm abs_flag A) = P * A)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) [PROOF STEP] proof (cases "m\<noteq>n \<or> Determinant.det A = 0") [PROOF STATE] proof (state) goal (2 subgoals): 1. m \<noteq> n \<or> det A = 0 \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) 2. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) [PROOF STEP] case True [PROOF STATE] proof (state) this: m \<noteq> n \<or> det A = 0 goal (2 subgoals): 1. m \<noteq> n \<or> det A = 0 \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) 2. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) [PROOF STEP] have H_rw: "HNF_algorithm abs_flag A = Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<m]" [PROOF STATE] proof (prove) goal (1 subgoal): 1. HNF_algorithm abs_flag A = Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<m] [PROOF STEP] using True A [PROOF STATE] proof (prove) using this: m \<noteq> n \<or> det A = 0 A \<in> carrier_mat m n goal (1 subgoal): 1. HNF_algorithm abs_flag A = Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<m] [PROOF STEP] unfolding HNF_algorithm_def Let_def [PROOF STATE] proof (prove) using this: m \<noteq> n \<or> det A = 0 A \<in> carrier_mat m n goal (1 subgoal): 1. (if dim_row A \<noteq> dim_col A then Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<dim_row A] else if \<bar>det_int A\<bar> = 0 then Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<dim_row A] else mat_of_rows (dim_col A) (map (row (Hermite_of_list_of_rows (FindPreHNF abs_flag \<bar>det_int A\<bar> (A @\<^sub>r \<bar>det_int A\<bar> \<cdot>\<^sub>m 1\<^sub>m (dim_col A))) [0..<dim_row A + dim_col A])) [0..<dim_row A])) = Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<m] [PROOF STEP] by auto [PROOF STATE] proof (state) this: HNF_algorithm abs_flag A = Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<m] goal (2 subgoals): 1. m \<noteq> n \<or> det A = 0 \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) 2. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) [PROOF STEP] have "(\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> (HNF_algorithm abs_flag A) = P * (FindPreHNF_rectangular A))" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * FindPreHNF_rectangular A [PROOF STEP] unfolding H_rw [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<m] = P * FindPreHNF_rectangular A [PROOF STEP] proof (rule invertible_Hermite_of_list_of_rows) [PROOF STATE] proof (state) goal (2 subgoals): 1. FindPreHNF_rectangular A \<in> carrier_mat m ?n 2. echelon_form_JNF (FindPreHNF_rectangular A) [PROOF STEP] show "FindPreHNF_rectangular A \<in> carrier_mat m n" [PROOF STATE] proof (prove) goal (1 subgoal): 1. FindPreHNF_rectangular A \<in> carrier_mat m n [PROOF STEP] by (smt A FindPreHNF_rectangular_soundness mult_carrier_mat) [PROOF STATE] proof (state) this: FindPreHNF_rectangular A \<in> carrier_mat m n goal (1 subgoal): 1. echelon_form_JNF (FindPreHNF_rectangular A) [PROOF STEP] show "echelon_form_JNF (FindPreHNF_rectangular A)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. echelon_form_JNF (FindPreHNF_rectangular A) [PROOF STEP] using FindPreHNF_rectangular_soundness [PROOF STATE] proof (prove) using this: ?A \<in> carrier_mat ?m ?n \<Longrightarrow> \<exists>P. invertible_mat P \<and> P \<in> carrier_mat ?m ?m \<and> P * ?A = FindPreHNF_rectangular ?A \<and> echelon_form_JNF (FindPreHNF_rectangular ?A) goal (1 subgoal): 1. echelon_form_JNF (FindPreHNF_rectangular A) [PROOF STEP] by blast [PROOF STATE] proof (state) this: echelon_form_JNF (FindPreHNF_rectangular A) goal: No subgoals! [PROOF STEP] qed [PROOF STATE] proof (state) this: \<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * FindPreHNF_rectangular A goal (2 subgoals): 1. m \<noteq> n \<or> det A = 0 \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) 2. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) [PROOF STEP] moreover [PROOF STATE] proof (state) this: \<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * FindPreHNF_rectangular A goal (2 subgoals): 1. m \<noteq> n \<or> det A = 0 \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) 2. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) [PROOF STEP] have "(\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> (FindPreHNF_rectangular A) = P * A)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> FindPreHNF_rectangular A = P * A [PROOF STEP] by (metis A FindPreHNF_rectangular_soundness) [PROOF STATE] proof (state) this: \<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> FindPreHNF_rectangular A = P * A goal (2 subgoals): 1. m \<noteq> n \<or> det A = 0 \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) 2. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) [PROOF STEP] ultimately [PROOF STATE] proof (chain) picking this: \<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * FindPreHNF_rectangular A \<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> FindPreHNF_rectangular A = P * A [PROOF STEP] have "(\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> (HNF_algorithm abs_flag A) = P * A)" [PROOF STATE] proof (prove) using this: \<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * FindPreHNF_rectangular A \<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> FindPreHNF_rectangular A = P * A goal (1 subgoal): 1. \<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A [PROOF STEP] by (smt assms assoc_mult_mat invertible_mult_JNF mult_carrier_mat) [PROOF STATE] proof (state) this: \<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A goal (2 subgoals): 1. m \<noteq> n \<or> det A = 0 \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) 2. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) [PROOF STEP] moreover [PROOF STATE] proof (state) this: \<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A goal (2 subgoals): 1. m \<noteq> n \<or> det A = 0 \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) 2. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) [PROOF STEP] have "Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) [PROOF STEP] by (metis A FindPreHNF_rectangular_soundness H_rw Hermite_Hermite_of_list_of_rows mult_carrier_mat) [PROOF STATE] proof (state) this: Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) goal (2 subgoals): 1. m \<noteq> n \<or> det A = 0 \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) 2. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) [PROOF STEP] ultimately [PROOF STATE] proof (chain) picking this: \<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) [PROOF STEP] show ?thesis [PROOF STATE] proof (prove) using this: \<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) goal (1 subgoal): 1. Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) [PROOF STEP] by simp [PROOF STATE] proof (state) this: Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) goal (1 subgoal): 1. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) [PROOF STEP] next [PROOF STATE] proof (state) goal (1 subgoal): 1. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) [PROOF STEP] case False [PROOF STATE] proof (state) this: \<not> (m \<noteq> n \<or> det A = 0) goal (1 subgoal): 1. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) [PROOF STEP] hence mn: "m=n" and det_A_not0:"(Determinant.det A) \<noteq> 0" [PROOF STATE] proof (prove) using this: \<not> (m \<noteq> n \<or> det A = 0) goal (1 subgoal): 1. m = n &&& det A \<noteq> 0 [PROOF STEP] by auto [PROOF STATE] proof (state) this: m = n det A \<noteq> 0 goal (1 subgoal): 1. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) [PROOF STEP] have inv_RAT_A: "invertible_mat (map_mat rat_of_int A)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. invertible_mat (of_int_hom.mat_hom A) [PROOF STEP] proof - [PROOF STATE] proof (state) goal (1 subgoal): 1. invertible_mat (of_int_hom.mat_hom A) [PROOF STEP] have "det (map_mat rat_of_int A) \<noteq> 0" [PROOF STATE] proof (prove) goal (1 subgoal): 1. det (of_int_hom.mat_hom A) \<noteq> 0 [PROOF STEP] using det_A_not0 [PROOF STATE] proof (prove) using this: det A \<noteq> 0 goal (1 subgoal): 1. det (of_int_hom.mat_hom A) \<noteq> 0 [PROOF STEP] by auto [PROOF STATE] proof (state) this: det (of_int_hom.mat_hom A) \<noteq> 0 goal (1 subgoal): 1. invertible_mat (of_int_hom.mat_hom A) [PROOF STEP] thus ?thesis [PROOF STATE] proof (prove) using this: det (of_int_hom.mat_hom A) \<noteq> 0 goal (1 subgoal): 1. invertible_mat (of_int_hom.mat_hom A) [PROOF STEP] by (metis False assms dvd_field_iff invertible_iff_is_unit_JNF map_carrier_mat) [PROOF STATE] proof (state) this: invertible_mat (of_int_hom.mat_hom A) goal: No subgoals! [PROOF STEP] qed [PROOF STATE] proof (state) this: invertible_mat (of_int_hom.mat_hom A) goal (1 subgoal): 1. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) [PROOF STEP] have "HNF_algorithm abs_flag A = Hermite_mod_det abs_flag A" [PROOF STATE] proof (prove) goal (1 subgoal): 1. HNF_algorithm abs_flag A = Hermite_mod_det abs_flag A [PROOF STEP] unfolding HNF_algorithm_def Hermite_mod_det_def Let_def [PROOF STATE] proof (prove) goal (1 subgoal): 1. (if dim_row A \<noteq> dim_col A then Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<dim_row A] else if \<bar>det_int A\<bar> = 0 then Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<dim_row A] else mat_of_rows (dim_col A) (map (row (Hermite_of_list_of_rows (FindPreHNF abs_flag \<bar>det_int A\<bar> (A @\<^sub>r \<bar>det_int A\<bar> \<cdot>\<^sub>m 1\<^sub>m (dim_col A))) [0..<dim_row A + dim_col A])) [0..<dim_row A])) = mat_of_rows (dim_col A) (map (row (Hermite_of_list_of_rows (FindPreHNF abs_flag \<bar>det_int A\<bar> (A @\<^sub>r \<bar>det_int A\<bar> \<cdot>\<^sub>m 1\<^sub>m (dim_col A))) [0..<dim_row A + dim_col A])) [0..<dim_row A]) [PROOF STEP] using False A [PROOF STATE] proof (prove) using this: \<not> (m \<noteq> n \<or> det A = 0) A \<in> carrier_mat m n goal (1 subgoal): 1. (if dim_row A \<noteq> dim_col A then Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<dim_row A] else if \<bar>det_int A\<bar> = 0 then Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<dim_row A] else mat_of_rows (dim_col A) (map (row (Hermite_of_list_of_rows (FindPreHNF abs_flag \<bar>det_int A\<bar> (A @\<^sub>r \<bar>det_int A\<bar> \<cdot>\<^sub>m 1\<^sub>m (dim_col A))) [0..<dim_row A + dim_col A])) [0..<dim_row A])) = mat_of_rows (dim_col A) (map (row (Hermite_of_list_of_rows (FindPreHNF abs_flag \<bar>det_int A\<bar> (A @\<^sub>r \<bar>det_int A\<bar> \<cdot>\<^sub>m 1\<^sub>m (dim_col A))) [0..<dim_row A + dim_col A])) [0..<dim_row A]) [PROOF STEP] by simp [PROOF STATE] proof (state) this: HNF_algorithm abs_flag A = Hermite_mod_det abs_flag A goal (1 subgoal): 1. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) [PROOF STEP] then [PROOF STATE] proof (chain) picking this: HNF_algorithm abs_flag A = Hermite_mod_det abs_flag A [PROOF STEP] show ?thesis [PROOF STATE] proof (prove) using this: HNF_algorithm abs_flag A = Hermite_mod_det abs_flag A goal (1 subgoal): 1. Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) [PROOF STEP] using Hermite_mod_det_soundness[OF mn A inv_RAT_A] [PROOF STATE] proof (prove) using this: HNF_algorithm abs_flag A = Hermite_mod_det abs_flag A Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (Hermite_mod_det ?abs_flag A) \<exists>P. invertible_mat P \<and> P \<in> carrier_mat m m \<and> Hermite_mod_det ?abs_flag A = P * A goal (1 subgoal): 1. Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) [PROOF STEP] by auto [PROOF STATE] proof (state) this: Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A) goal: No subgoals! [PROOF STEP] qed
\ https://rosettacode.org/wiki/Sum_digits_of_an_integer#Forh : SUM-INT 0 BEGIN OVER WHILE SWAP BASE @ /MOD SWAP ROT + REPEAT NIP ; T{ 2 BASE ! 11110 SUM-INT -> #4 }T T{ DECIMAL 12345 SUM-INT -> #15 }T T{ HEX F0E SUM-INT -> #29 }T
Following acts are also considered as violation of the seventh commandment : price manipulation to get advantage on the harm of others , corruption , appropriation of the public goods for personal interests , work poorly carried out , tax avoidance , counterfeiting of checks or any means of payment , any forms of copyright infringement and piracy , and extravagance .
State Before: a b c : Int ⊒ (a + b) * c = a * c + b * c State After: no goals Tactic: simp [Int.mul_comm, Int.mul_add]
The Irish Football Association ( IFA ) was originally the governing body for soccer across the island . The game has been played in an organised fashion in Ireland since the 1870s , with Cliftonville F.C. in Belfast being Ireland 's oldest club . It was most popular , especially in its first decades , around Belfast and in Ulster . However , some clubs based outside Belfast thought that the IFA largely favoured Ulster @-@ based clubs in such matters as selection for the national team . In 1921 , following an incident in which , despite an earlier promise , the IFA moved an Irish Cup semi @-@ final replay from Dublin to Belfast , Dublin @-@ based clubs broke away to form the Football Association of the Irish Free State . Today the southern association is known as the Football Association of Ireland ( FAI ) . Despite being initially blacklisted by the Home Nations ' associations , the FAI was recognised by FIFA in 1923 and organised its first international fixture in 1926 ( against Italy ) . However , both the IFA and FAI continued to select their teams from the whole of Ireland , with some players earning international caps for matches with both teams . Both also referred to their respective teams as Ireland .
import algebra.periodic /-! # Big operators on periodic sequences indexed by β„• Here we just prove the following result. Let `M` be a commutative monoid and `n : β„•`. Let `a : β„• β†’ M` be an `n`-periodic sequence. Then `∏ [i < n] a(i) = ∏ [i < n] a(i + k)` for any `k : β„•`. Similar results hold when `M` is a commutative additive monoid with sums. -/ namespace IMOSL namespace extra open function finset lemma periodic_prod_const {M : Type*} [comm_monoid M] {a : β„• β†’ M} {n : β„•} (h : periodic a n) (k : β„•) : (range n).prod (Ξ» m, a (m + k)) = (range n).prod a := begin induction k with k k_ih, simp only [add_zero], conv_lhs { congr, skip, funext, rw [nat.succ_eq_one_add, ← add_assoc] }, cases n with n n, rw [prod_range_zero, prod_range_zero], rw [prod_range_succ, add_comm, h, ← k_ih, prod_range_succ', zero_add] end lemma periodic_sum_const {M : Type*} [add_comm_monoid M] {a : β„• β†’ M} {n : β„•} (h : periodic a n) (k : β„•) : (range n).sum (Ξ» m, a (m + k)) = (range n).sum a := begin induction k with k k_ih, simp only [add_zero], conv_lhs { congr, skip, funext, rw [nat.succ_eq_one_add, ← add_assoc] }, cases n with n n, rw [sum_range_zero, sum_range_zero], rw [sum_range_succ, add_comm (n + 1), h, ← k_ih, sum_range_succ', zero_add] end end extra end IMOSL
theory Exercise5p4 imports Main begin inductive ev :: "nat \<Rightarrow> bool" where ev0: "ev 0" | evSS: "ev n \<Longrightarrow> ev (Suc (Suc n))" (* Exercise 5.4 *) lemma "\<not> ev (Suc (Suc (Suc 0)))" (is "\<not>?P") proof assume "?P" then have "ev (Suc 0)" by cases (* This is the same as "proof cases qed" because there is nothing to prove *) then show False by cases qed end
(* begin hide *) Require Export HoTT Ch04. (* end hide *) (** printing <~> %\ensuremath{\eqvsym}% **) (** printing == %\ensuremath{\sim}% **) (** printing ^-1 %\ensuremath{^{-1}}% **) (** * Induction *) (** %\exerdone{5.1}{175}% Derive the induction principle for the type $\lst{A}$ of lists from its definition as an inductive type in %\S5.1%. *) (** %\soln% The induction principle constructs an element $f : \prd{\ell:\lst{A}} P(\ell)$ for some family $P : \lst{A} \to \UU$. The constructors for $\lst{A}$ are $\nil : \lst{A}$ and $\cons : A \to \lst{A} \to \lst{A}$, so the hypothesis for the induction principle is given by %\[ d : P(\nil) \to \left(\prd{h:A} \prd{t:\lst{A}}P(t) \to P(\cons(h, t))\right) \to \prd{\ell:\lst{A}}P(\ell) \]% So, given a $p_{n} : P(\nil)$ and a function $p_{c} : \prd{h:A} \prd{t:\lst{A}} P(t) \to P(\cons(h, t))$, we obtain a function $f : \prd{\ell:\lst{A}}P(\ell)$ with the following computation rules: %\begin{align*} f(\nil) &\defeq p_{n} \\ f(\cons(h, t)) &\defeq p_{c}(h, t, f(t)) \end{align*}% In Coq we can just use the pattern-matching syntax. *) Module Ex1. Section Ex1. Variable A : Type. Variable P : list A -> Type. Hypothesis d : P nil -> (forall h t, P t -> P (cons h t)) -> forall l, P l. Variable p_n : P nil. Variable p_c : forall h t, P t -> P (cons h t). Fixpoint f (l : list A) : P l := match l with | nil => p_n | cons h t => p_c h t (f t) end. End Ex1. End Ex1. (** %\exerdone{5.2}{175}% Construct two functions on natural numbers which satisfy the same recurrence $(e_{z}, e_{s})$ but are not definitionally equal. *) (** %\soln% Let $C$ be any type, with $c : C$ some element. The constant function $f' \defeq \lam{n}c$ is not definitionally equal to the function defined recursively by %\begin{align*} f(0) &\defeq c \\ f(\suc(n)) &\defeq f(n) \end{align*}% However, they both satisfy the same recurrence; namely, $e_{z} \defeq c$ and $e_{s} \defeq \lam{n}\idfunc{C}$. *) Module Ex2. Section Ex2. Variables (C : Type) (c : C). Definition f (n : nat) := c. Fixpoint f' (n : nat) := match n with | O => c | S n' => f' n' end. Theorem ex5_2_O : f O = f' O. Proof. reflexivity. Qed. Theorem ex5_2_S : forall n, f (S n) = f' (S n). Proof. intros. unfold f, f'. induction n. reflexivity. apply IHn. Qed. End Ex2. End Ex2. (** %\exerdone{5.3}{175}% Construct two different recurrences $(e_{z}, e_{s})$ on the same type $E$ which are both satisfied by the same function $f : \N \to E$. *) (** %\soln% From the previous exercise we have the recurrences %\[ e_{z} \defeq c \qquad\qquad e_{s} \defeq \lam{n}\idfunc{C} \]% which give rise to the same function as the recurrences %\[ e'_{z} \defeq c \qquad\qquad e'_{s} \defeq \lam{n}\lam{x}c \]% Clearly $f \defeq \lam{n}c$ satisfies both of these recurrences. However, suppose that $c, c' : C$ are such that $c \neq c'$. Then $\lam{n}\lam{x} \neq \lam{n}\idfunc{C}$, so $e_{s} \neq e'_{s}$, so the recurrences are not equal. *) Module Ex3. Section Ex3. Variables (C : Type) (c c' : C) (p : ~ (c = c')). Definition ez := c. Definition es (n : nat) (x : C) := x. Definition ez' := c. Definition es' (n : nat) := fun (x : C) => c. Theorem f_O : Ex2.f C c O = ez. Proof. reflexivity. Defined. Theorem f_S : forall n, Ex2.f C c (S n) = es n (Ex2.f C c n). Proof. reflexivity. Defined. Theorem f_O' : Ex2.f C c O = ez'. Proof. reflexivity. Defined. Theorem f_S' : forall n, Ex2.f C c (S n) = es' n (Ex2.f C c n). Proof. reflexivity. Defined. Theorem ex5_3 : ~ ((ez, es) = (ez', es')). Proof. intro q. apply (ap snd) in q. simpl in q. unfold es, es' in q. assert (idmap = fun x:C => c) as r. apply (apD10 q O). assert (c' = c) as s. apply (apD10 r). symmetry in s. contradiction p. Defined. End Ex3. End Ex3. (** %\exerdone{5.4}{175}% Show that for any type family $E : \bool \to \UU$, the induction operator %\[ \ind{\bool}(E) : (E(0_{\bool}) \times E(1_{\bool})) \to \prd{b : \bool} E(b) \]% is an equivalence. *) (** %\soln% For a quasi-inverse, suppose that $f : \prd{b:\bool} E(b)$. To provide an element of $E(0_{\bool}) \times E(1_{\bool})$, we take the pair $(f(0_{\bool}), f(1_{\bool}))$. For one direction around the loop, consider an element $(e_{0}, e_{1})$ of the domain. We then have %\[ \left( \ind{\bool}(E, e_{0}, e_{1}, 0_{\bool}), \ind{\bool}(E, e_{0}, e_{1}, 1_{\bool}) \right) \equiv ( e_{0}, e_{1} ) \]% by the computation rule for $\ind{\bool}$. For the other direction, suppose that $f : \prd{b:\bool} E(b)$, so that once around the loop gives $\ind{\bool}(E, f(0_{\bool}), f(1_{\bool}))$. Suppose that $b : \bool$. Then there are two cases: - $b \equiv 0_{\bool}$ gives $\ind{\bool}(E, f(0_{\bool}), f(1_{\bool}), 0_{\bool}) \equiv f(0_{\bool})$ - $b \equiv 1_{\bool}$ gives $\ind{\bool}(E, f(0_{\bool}), f(1_{\bool}), 1_{\bool}) \equiv f(1_{\bool})$ by the computational rule for $\ind{\bool}$. By function extensionality, then, the result is equal to $f$. *) Definition Bool_rect_uncurried (E : Bool -> Type) : (E false) * (E true) -> (forall b, E b). intros p b. destruct b; [apply (snd p) | apply (fst p)]. Defined. Definition Bool_rect_uncurried_inv (E : Bool -> Type) : (forall b, E b) -> (E false) * (E true). intro f. split; [apply (f false) | apply (f true)]. Defined. Theorem ex5_4 `{Funext} (E : Bool -> Type) : IsEquiv (Bool_rect_uncurried E). Proof. refine (isequiv_adjointify _ (Bool_rect_uncurried_inv E) _ _); unfold Bool_rect_uncurried, Bool_rect_uncurried_inv. intro f. apply path_forall; intro b. destruct b; reflexivity. intro p. apply eta_prod. Qed. (** %\exerdone{5.5}{175}% Show that the analogous statement to Exercise 5.4 for $\N$ fails. *) (** %\soln% The analogous statement is that %\[ \ind{\N}(E) : \left(E(0) \times \prd{n:\N}E(n) \to E(\suc(n))\right) \to \prd{n:\N}E(n) \]% is an equivalence. To show that it fails, note that an element of the domain is a recurrence $(e_{z}, e_{s})$. Recalling the solution to Exercise 5.3, we have recurrences $(e_{z}, e_{s})$ and $(e'_{z}, e'_{s})$ such that $(e_{z}, e_{s}) \neq (e'_{z}, e'_{s})$, but such that $\ind{\N}(E, e_{z}, e_{s}) = \ind{\N}(E, e'_{z}, e'_{s})$. Suppose for contradiction that $\ind{\N}(E)$ has a quasi-inverse $\ind{\N}^{-1}(E)$. Then %\[ (e_{z}, e_{s}) = \ind{\N}^{-1}(E, \ind{\N}(E, e_{z}, e_{s})) = \ind{\N}^{-1}(E, \ind{\N}(E, e'_{z}, e'_{s})) = (e'_{z}, e'_{s}) \]% The first and third equality are from the fact that a quasi-inverse is a left inverse. The second comes from the fact that $\ind{\N}(E)$ sends the two recurrences to the same function. So we have derived a contradiction. *) Definition nat_rect_uncurried (E : nat -> Type) : (E O) * (forall n, E n -> E (S n)) -> forall n, E n. intros p n. induction n. apply (fst p). apply (snd p). apply IHn. Defined. Theorem ex5_5 `{Funext} : ~ IsEquiv (nat_rect_uncurried (fun _ => Bool)). Proof. intro e. destruct e. set (ez := (Ex3.ez Bool true)). set (es := (Ex3.es Bool)). set (ez' := (Ex3.ez' Bool true)). set (es' := (Ex3.es' Bool true)). assert ((ez, es) = (ez', es')) as H'. transitivity (equiv_inv (nat_rect_uncurried (fun _ => Bool) (ez, es))). symmetry. apply eissect. transitivity (equiv_inv (nat_rect_uncurried (fun _ => Bool) (ez', es'))). apply (ap equiv_inv). apply path_forall; intro n. induction n. reflexivity. simpl. rewrite IHn. unfold Ex3.es, Ex3.es'. induction n; reflexivity. apply eissect. assert (~ ((ez, es) = (ez', es'))) as nH. apply (Ex3.ex5_3 Bool true false). apply true_ne_false. contradiction nH. Qed. (** %\exer{5.6}{175}% Show that if we assume simple instead of dependent elimination for $\w$-types, the uniqueness property fails to hold. That is, exhibit a type satisfying the recursion principle of a $\w$-type, but for which functions are not determined uniquely by their recurrence. *) (** %\exerdone{5.7}{175}% Suppose that in the ``inductive definition'' of the type $C$ at the beginning of %\S5.6%, we replace the type $\N$ by $\emptyt$. Analogously to 5.6.1, we might consider a recursion principle for this type with hypothesis %\[ h : (C \to \emptyt) \to (P \to \emptyt) \to P. \]% Show that even without a computation rule, this recursion principle is inconsistent, %i.e.~it% allows us to construct an element of $\emptyt$. *) (** %\soln% The constructor for $C$ is $g : (C \to \emptyt) \to C$, and the associated recursion principle is %\[ \rec{C} : \prd{P:\UU} ((C \to \emptyt) \to (P \to \emptyt) \to P) \to C \to P \]% Note first that the relevant recursion hypothesis can be constructed from $g$: %\[ h \defeq \lam{f:C \to \emptyt}{i:\emptyt \to \emptyt}f(g(f)) : ((C \to \emptyt) \to (\emptyt \to \emptyt) \to \emptyt) \to \emptyt \]% And so we have $\rec{C}(\emptyt, h) : C \to \emptyt$. But then %\[ \rec{C}(\emptyt, h, g(\rec{C}(\emptyt, h))) : \emptyt \]% meaning that our recursion principle is inconsistent. Alternatively, note that there is an equivalence %\begin{align*} (C \to \emptyt) \to (\emptyt \to \emptyt) \to \emptyt &\eqvsym (C \to \emptyt) \times (\emptyt \to \emptyt) \to \emptyt \eqvsym (C \to \emptyt) \times \unit \to \emptyt \eqvsym (C \to \emptyt) \to \emptyt \equiv \lnot\lnot C \end{align*}% so the recursion principle says $\lnot\lnot C \to \lnot C$. By double negation introduction composed with this we get $C \to \lnot C$. On the other hand, by $g$ we have $\lnot C \to C$, and composing this with the recursion principle gives $\lnot\lnot C \to C$. So $C$ is decidable, and in both cases we have a contradiction because $C \to \lnot C$ and $\lnot C \to C$. *) Section Ex7. Variable (C : Type) (g : (C -> Empty) -> C). Variable (rec : forall P, ((C -> Empty) -> (P -> Empty) -> P) -> C -> P). Theorem ex7 : Empty. Proof. set (h := (fun k i => k (g k)): ((C -> Empty) -> (Empty -> Empty) -> Empty)). apply (rec Empty h). apply g. apply (rec Empty h). Defined. End Ex7. (** %\exerdone{5.8}{175}% Consider now an ``inductive type'' $D$ with one constructor $\mathsf{scott} : (D \to D) \to D$. The second recursor for $C$ suggested in %\S5.6% leads to the following recursor for $D$: %\[ \rec{D} : \prd{P:\UU} ((D \to D) \to (D \to P) \to P) \to D \to P \]% with computation rule $\rec{D}(P, h, \mathsf{scott}(\alpha)) \equiv h(\alpha, (\lam{d}\rec{D}(P, h, \alpha(d))))$. Show that this also leads to a contradiction. *) (** %\soln% As in the previous problem, we can construct the recursion hypothesis from the constructor: %\[ h \defeq \lam{f : D \to D}{g : D \to \emptyt}g(\mathsf{scott}(f)) : (D \to D) \to (D \to \emptyt) \to \emptyt \]% Then by $h(\idfunc{D})$ it suffices to give a function $D \to \emptyt$ to construct an element of $\emptyt$, which we have in $\lam{d:D}\rec{D}(\emptyt, h, d) : \emptyt$. So, putting it all together, we have %\[ h(\idfunc{D}, \lam{d}\rec{D}(\emptyt, h, d)) \]% which by the computation rule is judgementally equal to %\[ \rec{D}(\emptyt, h, \mathsf{scott}(\idfunc{D})). \]% *) Section Ex8. Variable (D : Type) (scott : (D -> D) -> D). Hypothesis (rec : forall P, ((D -> D) -> (D -> P) -> P) -> D -> P). Theorem ex8 : Empty. Proof. set (h := (fun f g => g (scott f)) : (D -> D) -> (D -> Empty) -> Empty). apply (h idmap). intro d. apply (rec Empty h d). Defined. End Ex8. (** %\exerdone{5.9}{176}% Let $A$ be an arbitrary type and consider generally an ``inductive definition'' of a type $L_{A}$ with constructor $\mathsf{lawvere}:(L_{A} \to A) \to L_{A}$. The second recursor for $C$ suggested in %\S5.6% leads to the following recursor for $L_{A}$: %\[ \rec{L_{A}} : \prd{P:\UU} ((L_{A} \to A) \to P) \to L_{A} \to P \]% with computation rule $\rec{L_{A}}(P, h, \mathsf{lawvere}(\alpha)) \equiv h(\alpha)$. Using this, show that $A$ has a _fixed-point property_, %i.e.~for% every function $f : A \to A$ there exists an $a : A$ such that $f(a) = a$. In particular, $L_{A}$ is inconsistent if $A$ is a type without the fixed-point property, such as $\emptyt$, $\bool$, $\N$. *) (** %\soln% This is an instance of Lawvere's fixed-point theorem, which says that in a cartesian closed category, if there is a point-surjective map $T \to A^{T}$, then every endomorphism $f : A \to A$ has a fixed point. Working at an intuitive level, the recursion principle ensures that we have the required properties of a point-surjective map in a CCC. In particular, we have the map $\phi : (L_{A} \to A) \to A^{L_{A} \to A}$ given by %\[ \phi \defeq \lam{f : L_{A} \to A}{\alpha : L_{A} \to A}f(\mathsf{lawvere}(\alpha)) \]% and for any $h : A^{L_{A} \to A}$, we have %\[ \phi(\rec{L_{A}}(A, h)) \equiv \lam{\alpha : L_{A} \to A}\rec{L_{A}}(A, h, \mathsf{lawvere}(\alpha)) \equiv \lam{\alpha : L_{A} \to A}h(\alpha) = h \]% So we can recap the proof of Lawvere's fixed-point theorem with this $\phi$. Suppose that $f : A \to A$, and define %\begin{align*} q &\defeq \lam{\alpha:L_{A} \to A}f(\phi(\alpha, \alpha)) : (L_{A} \to A) \to A \\ p &\defeq \rec{L_{A}}(A, q) : L_{A} \to A \end{align*}% so that $p$ lifts $q$: %\[ \phi(p) \equiv \lam{\alpha : L_{A} \to A}\rec{L_{A}}(A, q, \mathsf{lawvere}(\alpha)) \equiv \lam{\alpha : L_{A} \to A}q(\alpha) = q \]% This make $\phi(p, p)$ a fixed point of $f$: %\[ f(\phi(p, p)) = (\lam{\alpha : L_{A} \to A}f(\phi(\alpha, \alpha)))(p) = q(p) = \phi(p, p) \]% *) Definition onto {X Y} (f : X -> Y) := forall y : Y, {x : X & f x = y}. Lemma LawvereFP {X Y} (phi : X -> (X -> Y)) : onto phi -> forall (f : Y -> Y), {y : Y & f y = y}. Proof. intros Hphi f. set (q := fun x => f (phi x x)). set (p := Hphi q). destruct p as [p Hp]. exists (phi p p). change (f (phi p p)) with ((fun x => f (phi x x)) p). change (fun x => f (phi x x)) with q. symmetry. apply (apD10 Hp). Defined. Module Ex9. Section Ex9. Variable (L A : Type). Variable lawvere : (L -> A) -> L. Variable rec : forall P, ((L -> A) -> P) -> L -> P. Hypothesis rec_comp : forall P h alpha, rec P h (lawvere alpha) = h alpha. Definition phi : (L -> A) -> ((L -> A) -> A) := fun f alpha => f (lawvere alpha). Theorem ex5_9 `{Funext} : forall (f : A -> A), {a : A & f a = a}. Proof. intro f. apply (LawvereFP phi). intro q. exists (rec A q). unfold phi. change q with (fun alpha => q alpha). apply path_forall; intro alpha. apply rec_comp. Defined. End Ex9. End Ex9. (** %\exerdone{5.10}{176}% Continuing from Exercise 5.9, consider $L_{\unit}$, which is not obviously inconsistent since $\unit$ does have the fixed-point property. Formulate an induction principle for $L_{\unit}$ and its computation rule, analogously to its recursor, and using this, prove that it is contractible. *) (** %\soln% The induction principle for $L_{\unit}$ is %\[ \ind{L_{\unit}} : \prd{P : L_{\unit} \to \UU} \left(\prd{\alpha : L_{\unit} \to \unit} P(\mathsf{lawvere}(\alpha))\right) \to \prd{\ell : L_{\unit}}P(\ell) \]% and it has the computation rule %\[ \ind{L_{\unit}}(P, f, \mathsf{lawvere}(\alpha)) \equiv f(\alpha) \]% for all $f : \prd{\alpha : L_{\unit} \to \unit} P(\mathsf{lawvere}(\alpha))$ and $\alpha : L_{\unit} \to \unit$. Let ${!} : L_{\unit} \to \unit$ be the unique terminal arrow. $L_{\unit}$ is contractible with center $\mathsf{lawvere}({!})$. By $\ind{L_{\unit}}$, it suffices to show that $\mathsf{lawvere}({!}) = \mathsf{lawvere}(\alpha)$ for any $\alpha : L_{\unit} \to \unit$. And by the universal property of the terminal object, $\alpha = {!}$, so we're done. *) Module Ex10. Section Ex10. Variable L : Type. Variable lawvere : (L -> Unit) -> L. Variable indL : forall P, (forall alpha, P (lawvere alpha)) -> forall l, P l. Hypothesis ind_comp : forall P f alpha, indL P f (lawvere alpha) = f alpha. Theorem ex5_10 `{Funext} : Contr L. Proof. apply (BuildContr L (lawvere (fun _ => tt))). apply indL; intro alpha. apply (ap lawvere). apply path_ishprop. Defined. End Ex10. End Ex10. (** %\exerdone{5.11}{176}% In %\S5.1% we defined the type $\lst{A}$ of finite lists of elements of some type $A$. Consider a similiar inductive definition of a type $\lost{A}$, whose only constructor is %\[ \cons : A \to \lost{A} \to \lost{A}. \]% Show that $\lost{A}$ is equivalent to $\emptyt$. *) (** %\soln% Consider the recursor for $\lost{A}$, given by %\[ \rec{\lost{A}} : \prd{P : \UU} (A \to \lost{A} \to P \to P) \to \lost{A} \to P \]% with computation rule %\[ \rec{\lost{A}}(P, f, \cons(h, t)) \equiv f(h, \rec{\lost{A}}(P, f, t)) \]% Now $\rec{\lost{A}}(\emptyt, \lam{a}{\ell}\idfunc{\emptyt}) : \lost{A} \to \emptyt$, so $\lnot \lost{A}$ is inhabited, thus $\lost{A} \eqvsym \emptyt$. *) Theorem not_equiv_empty (A : Type) : ~ A -> (A <~> Empty). Proof. intro nA. refine (equiv_adjointify nA (Empty_rect (fun _ => A)) _ _); intro; contradiction. Defined. Module Ex11. Inductive lost (A : Type) := cons : A -> lost A -> lost A. Theorem ex5_11 (A : Type) : lost A <~> Empty. Proof. apply not_equiv_empty. intro l. apply (lost_rect A). auto. apply l. Defined. End Ex11.
Require Import Algebra.Semigroup. Require Import Algebra.Monoid. Section GroupTheory. Context {G: Set}(mult: G -> G -> G)(ident: G)(inv: G -> G). Class Group := { group_assoc: forall (a b c: G), mult (mult a b) c = mult a (mult b c); group_ident_left: forall (a: G), mult ident a = a; group_ident_right: forall (a: G), mult a ident = a; group_inv_left: forall (a: G), mult (inv a) a = ident; group_inv_right: forall (a: G), mult a (inv a) = ident; }. Theorem group_monoid: Group -> Monoid mult ident. Proof. intros Ggroup. constructor. { apply group_assoc. } { apply group_ident_left. } { apply group_ident_right. } Qed. Theorem group_semigroup: Group -> Semigroup mult. Proof. intros Ggroup. constructor. apply group_assoc. Qed. Context `{Ggroup: Group}. Lemma group_left_mult (a b: G): a = b -> forall (c: G), mult c a = mult c b. Proof. intros <-; reflexivity. Qed. Lemma group_right_mult (a b: G): a = b -> forall (c: G), mult a c = mult b c. Proof. intros <-; reflexivity. Qed. Theorem group_ident_unique (ident': G): (forall (a: G), mult ident' a = a) -> (forall (a: G), mult a ident' = a) -> ident' = ident. Proof. intros Hlident' Hrident'. rewrite <- (Hrident' ident). rewrite <- (group_ident_left ident'). rewrite (group_ident_left (mult ident ident')). reflexivity. Qed. Theorem group_idemp_ident (a: G): mult a a = a -> a = ident. Proof. intros Hidemp. apply group_right_mult with (c := inv a) in Hidemp. rewrite group_assoc in Hidemp. rewrite group_inv_right in Hidemp. rewrite group_ident_right in Hidemp. assumption. Qed. Theorem group_left_cancel (a b c: G): mult c a = mult c b -> a = b. Proof. intros Hcacb. apply group_left_mult with (c := inv c) in Hcacb. rewrite <- 2 group_assoc in Hcacb. rewrite group_inv_left in Hcacb. rewrite 2 group_ident_left in Hcacb. assumption. Qed. Theorem group_right_cancel (a b c: G): mult a c = mult b c -> a = b. Proof. intros Hacbc. apply group_right_mult with (c := inv c) in Hacbc. rewrite 2 group_assoc in Hacbc. rewrite group_inv_right in Hacbc. rewrite 2 group_ident_right in Hacbc. assumption. Qed. Theorem group_inv_unique (a aInv: G): mult aInv a = ident -> mult a aInv = ident -> aInv = inv a. Proof. intros Hlinv Hrinv. rewrite <- (group_inv_right a) in Hrinv. apply group_left_cancel in Hrinv. assumption. Qed. Theorem group_inv_involute (a: G): inv (inv a) = a. Proof. symmetry. apply group_inv_unique. { apply group_inv_right. } { apply group_inv_left. } Qed. Theorem group_inv_mult (a b: G): inv (mult a b) = mult (inv b) (inv a). Proof. symmetry. apply group_inv_unique; rewrite group_assoc. { remember (mult (inv a) (mult a b)) as b'. rewrite <- group_assoc in Heqb'. rewrite group_inv_left in Heqb'. rewrite group_ident_left in Heqb'. subst b'. apply group_inv_left. } { remember (mult b (mult (inv b) (inv a))) as inva. rewrite <- group_assoc in Heqinva. rewrite group_inv_right in Heqinva. rewrite group_ident_left in Heqinva. subst inva. apply group_inv_right. } Qed. Theorem group_left_mult_soln (a b: G): exists! (x: G), mult a x = b. Proof. exists (mult (inv a) b). split. { rewrite <- group_assoc. rewrite group_inv_right. rewrite group_ident_left. reflexivity. } { intros x Haxb. apply group_left_mult with (c := inv a) in Haxb. rewrite <- group_assoc in Haxb. rewrite group_inv_left in Haxb. rewrite group_ident_left in Haxb. symmetry. assumption. } Qed. Theorem group_right_mult_soln (a b: G): exists! (x: G), mult x a = b. Proof. exists (mult b (inv a)). split. { rewrite group_assoc. rewrite group_inv_left. rewrite group_ident_right. reflexivity. } { intros x Hxab. apply group_right_mult with (c := inv a) in Hxab. rewrite group_assoc in Hxab. rewrite group_inv_right in Hxab. rewrite group_ident_right in Hxab. symmetry. assumption. } Qed. Theorem group_inv_ident: inv ident = ident. Proof. symmetry. apply group_inv_unique; apply group_ident_right. Qed. End GroupTheory. Section SemigroupTheory. Context {G: Set}(mult: G -> G -> G). Context `{Gsubgroup: Semigroup G mult}. Context (ident: G)(inv: G -> G). Theorem group_semigroup_left_ident_left_inv: (Monoid mult ident /\ Group mult ident inv) -> forall (a: G), mult ident a = a /\ mult (inv a) a = ident. Proof. intros [Gmonoid Ggroup] a. split; [apply monoid_ident_left | apply group_inv_left]; assumption. Qed. Theorem group_semigroup_right_ident_right_inv: (Monoid mult ident /\ Group mult ident inv) -> forall (a: G), mult a ident = a /\ mult a (inv a) = ident. Proof. intros [Gmonoid Ggroup] a. split; [apply monoid_ident_right | apply group_inv_right]; assumption. Qed. Lemma semigroup_left_ident_left_inv_idemp_ident: (forall (a: G), mult ident a = a) -> (forall (a: G), mult (inv a) a = ident) -> forall (a: G), mult a a = a -> a = ident. Proof. intros Hlident Hlinv a Hidemp. apply semigroup_left_mult with (c := inv a)(mult0 := mult) in Hidemp. rewrite <- semigroup_assoc in Hidemp; try assumption. rewrite Hlinv in Hidemp. rewrite Hlident in Hidemp. assumption. Qed. Lemma semigroup_right_ident_right_inv_idemp_ident: (forall (a: G), mult a ident = a) -> (forall (a: G), mult a (inv a) = ident) -> forall (a: G), mult a a = a -> a = ident. Proof. intros Hrident Hrinv a Hidemp. apply semigroup_right_mult with (c := inv a)(mult0 := mult) in Hidemp. rewrite semigroup_assoc in Hidemp; try assumption. rewrite Hrinv in Hidemp. rewrite Hrident in Hidemp. assumption. Qed. Theorem semigroup_left_ident_left_inv_group: (forall (a: G), mult ident a = a) -> (forall (a: G), mult (inv a) a = ident) -> Monoid mult ident /\ Group mult ident inv. Proof. intros Hlident Hlinv. cut (forall (a: G), mult a (inv a) = ident). { intros Hrinv. split; constructor; try apply semigroup_assoc; try assumption; intros a; rewrite <- (Hlinv a); rewrite <- semigroup_assoc; try assumption; rewrite Hrinv; apply Hlident. } { intros a. apply semigroup_left_ident_left_inv_idemp_ident; try assumption. rewrite semigroup_assoc; try assumption. remember (mult (inv a) (mult a (inv a))) as inva. rewrite <- semigroup_assoc in Heqinva; try assumption. rewrite Hlinv in Heqinva. rewrite Hlident in Heqinva. subst inva. reflexivity. } Qed. Theorem semigroup_right_ident_right_inv_group: (forall (a: G), mult a ident = a) -> (forall (a: G), mult a (inv a) = ident) -> Monoid mult ident /\ Group mult ident inv. Proof. intros Hrident Hrinv. cut (forall (a: G), mult (inv a) a = ident). { intros Hlinv. split; constructor; try apply semigroup_assoc; try assumption; intros a; rewrite <- (Hrinv a); rewrite semigroup_assoc; try assumption; rewrite Hlinv; rewrite Hrident; reflexivity. } { intros a. apply semigroup_right_ident_right_inv_idemp_ident; try assumption. rewrite <- semigroup_assoc; try assumption. remember (mult (mult (inv a) a) (inv a)) as inva. rewrite semigroup_assoc in Heqinva; try assumption. rewrite Hrinv in Heqinva. rewrite Hrident in Heqinva. subst inva. reflexivity. } Qed. End SemigroupTheory. Section SubgroupTheory. Context {G: Set}(mult: G -> G -> G)(ident: G)(inv: G -> G). Context `{Gsubgroup: Semigroup G mult}. Context `{Gmonoid: Monoid G mult ident}. Context `{Ggroup: Group G mult ident inv}. Context (P: G -> Prop). Class Subgroup := { subgroup_mult_closed: forall (a b: G), P a -> P b -> P (mult a b); subgroup_ident: P ident; subgroup_inv_closed: forall (a: G), P a -> P (inv a); }. Theorem subgroup_mult_inv_closed: Subgroup -> forall (a b: G), P a -> P b -> P (mult a (inv b)). Proof. intros Psubgroup a b Pa Pb. apply subgroup_mult_closed; try assumption. apply subgroup_inv_closed; assumption. Qed. Lemma subset_mult_inv_closed_ident: {a: G | P a} -> (forall (a b: G), P a -> P b -> P (mult a (inv b))) -> P ident. Proof. intros [a Ha] Hmultinv. rewrite <- (group_inv_right mult ident inv a). apply Hmultinv; assumption. Qed. Theorem subset_mult_inv_closed_subgroup: {a: G | P a} -> (forall (a b: G), P a -> P b -> P (mult a (inv b))) -> Subgroup. Proof. intros [g Pg] Hmultinv. constructor. { intros a b Pa Pb. rewrite <- (group_inv_involute mult ident inv b). apply Hmultinv; try assumption. rewrite <- (monoid_ident_left mult ident). apply Hmultinv; try assumption. apply subset_mult_inv_closed_ident; try exists g; try assumption. } { apply subset_mult_inv_closed_ident; try exists g; try assumption. } { intros a Pa. rewrite <- (monoid_ident_left mult ident). apply Hmultinv; try assumption. apply subset_mult_inv_closed_ident; try exists g; try assumption. } Qed. End SubgroupTheory.
SUBROUTINE zmultu6 ( IFLTAB, LOCK, LFLUSH) implicit none C C zmultu6 takes care of all multiple user access C and loads in the permanent section of the file, C when called to lock the file for a write request. C It also dumps changed buffers to disk when an C unlock request is made. C C This routine is always called at the beginning C and end of every change to the DSS file. C C **** THIS ROUTINE IS SYSTEM DEPENDENT ***** C C LOCK IS A FLAG TO INDICATE IF THE OPERATION IS C TO BEGIN LOCK, OR HAS BEEN COMPLETED C C LOCK = TRUE, BEGIN WRITE REQUEST C LOCK = FALSE, WRITE COMPLETE C C LFLUSH = TRUE, Force read of permanent section on Lock, C and flush buffers on un-lock C LFLUSH = FALSE, Only lock and un-lock file C C C IF IFLTAB(KMULT) = 0, Exclusive open / Single user only mode C (The file was opened so that no one else can access the file) C IF IFLTAB(KMULT) = 1, Read only mode, but locks are supported C (someone else can lock the file) C IF IFLTAB(KMULT) = 2, Standard multi-user mode with locks C IF IFLTAB(KMULT) = 3, Multi-user "advisory". This locks the C file on the first write and only un-locks on close, or if C someone else requests access (where the mode goes to 2). C This is much faster if we might be the only one using the file. C IF IFLTAB(KMULT) = 4, Exclusive access with locks for WRITING only C IF IFLTAB(KMULT) = 5, Exclusive access with locks for both reading C and writing. NOT ACTIVE!!! C IF IFLTAB(KMULT) = 6, Release exclusive access (internal flag) C C IF IFLTAB(KLOCK) = 1, The file is currently not locked C IF IFLTAB(KLOCK) = 2, The file is currently locked C C IFLTAB(KLOCKB) contains the first byte position of the C record used in the file for locking C The first word indicates the file is locked C The second word is a request to lock the file (another C program already has the file locked, and need to check C this occasionally) C The third word, when combined with the first two, indicate C that the file is exclusively locked and is unaccessible C to other programs until it is closed. This is used, for C example, when a squeeze is going on. Other programs C should generally gracefully exit. C C The MODE (second) argument for LOCKDSS is as follows: C 0 - Unlock C 1 - Lock. Wait if unavailable. C 2 - Lock. Do not wait if unavailable. C 3 - Test for lock. (Do not lock.) C C C LOGICAL LOCK, LFLUSH INTEGER IFLTAB(*) integer I,J,IADD,IERR,ISIZE,IUNIT,JERR,KERR,IWORD integer*8 IBYTE INCLUDE 'zdsskz.h' C INCLUDE 'zdssnz.h' C INCLUDE 'zdssmz.h' C INCLUDE 'zdsslz.h' C COMMON /WORDS/ IWORD(10) C C C C IUNIT = IFLTAB(KUNIT) IF (MLEVEL.GE.12) WRITE (MUNIT, 20) IUNIT, IFLTAB(KMULT), * IFLTAB(KLOCK), LOCK, LFLUSH 20 FORMAT (T5,'----DSS--- DEBUG: Enter zmultu6; Unit:',I5,/, * T12,'KMULT:',I3,', KLOCK:',I3,' LOCK: ',L1,' FLUSH:',L1) C C C Check that this is a multiple user access file IF (IFLTAB(KMULT).GT.1) THEN C IF (LOCK) THEN C C If the file has already been locked, ignore this request C (this allows a smart program to lock and save buffers C before zwrite6 does) IF (IFLTAB(KLOCK).NE.2) THEN C C Only lock a small part of the file for DOS and unix IF (IFLTAB(KMULT).EQ.4) THEN C Exclusive lock - lock the lock record ISIZE = IWORD(2) * 3 IBYTE = IFLTAB(KLOCKB) CALL lockdss (IFLTAB(KHANDL), 2, IBYTE, ISIZE, IERR) IF (IERR.NE.0) THEN WRITE ( MUNIT, 30) IUNIT 30 FORMAT (/,' ----- DSS ERROR ----*',/ * ' Unable to lock file for Exclusive access. Unit: ',I5) CALL zabort6 (IFLTAB, 210, 'zmultu6', IUNIT, IFLTAB(KLOCK), * 'Can not EXCLUSIVELY lock file') RETURN ENDIF ELSE C IBYTE = IFLTAB(KLOCKB) CALL lockdss (IFLTAB(KHANDL), 2, IBYTE, IWORD(2), IERR) ENDIF C C C If we have an "advisory lock" (IFLTAB(KMULT) = 3), and cannot C access the file because it is in use, place a lock request on C the word following the locked word, and see if the other user C will unlock the file (go to mode 2) IF (IERR.NE.0) THEN C C Do a quick test to see if we have access to the file C (Does someone else have the file in exclusive access mode?) IBYTE = IFLTAB(KLOCKB) + (IWORD(2) * 2) CALL lockdss (IFLTAB(KHANDL), 3, IBYTE, IWORD(2), JERR) IF (JERR.NE.0) THEN C Can not lock the exclusive access word. Be sure this C is not just a fluke (someone else could be testing lock C at the same time! C DO 32 I=1,10 u C CALL WAITS (1.0) u C CALL lockdss (IFLTAB(KHANDL), 3, IBYTE, IWORD(2), JERR) u C IF (JERR.EQ.0) GO TO 35 u C32 CONTINUE u CALL lockdss (IFLTAB(KHANDL), 1, IBYTE, IWORD(2), JERR) Md CALL lockdss (IFLTAB(KHANDL), 0, IBYTE, IWORD(2), KERR) Md IF (JERR.EQ.0) GO TO 35 Md C We do not have access to lock this file! WRITE ( MUNIT, 60) IUNIT CALL zabort6 (IFLTAB, 210, 'zmultu6', IUNIT, IFLTAB(KLOCK), * 'Can not lock file') RETURN ENDIF C 35 CONTINUE IF (IFLTAB(KMULT).EQ.3) THEN IFLTAB(KMULT) = 2 IF (MLEVEL.GE.1) WRITE (MUNIT, 36) IFLTAB(KUNIT) 36 FORMAT(' -----DSS--- File set to multi-user access, unit:', * I6) ENDIF IBYTE = IFLTAB(KLOCKB) + IWORD(2) CALL lockdss (IFLTAB(KHANDL), 2, IBYTE, IWORD(2), JERR) IF (JERR.EQ.0) IFLTAB(KLOCKR) = 1 C C Now try to re-lock the original area until the other program C releases it, or we time out (5 minutes!) DO 50 I=1,30 C On MS Windows, this lock will wait up to 10 seconds IBYTE = IFLTAB(KLOCKB) CALL lockdss (IFLTAB(KHANDL), 1,IBYTE, * IWORD(2), JERR) IF (JERR.EQ.0) THEN C Have a release and the file is locked! C Leave the request area locked and move on (if locked). GO TO 70 ELSE C Write a message every 30 seconds J = MOD (I, 3) IF ((J.EQ.1).AND.(MLEVEL.GE.1)) WRITE (MUNIT, 40) 40 FORMAT (' -----DSS--- Waiting for file access...') ENDIF 50 CONTINUE C Hmmm. Failed lock. Error out WRITE ( MUNIT, 60) IUNIT 60 FORMAT (//,' ***** DSS ERROR *****',/ * ' UNABLE TO LOCK FILE FOR MULTIPLE USER ACCESS; UNIT: ',I5) CALL zabort6 (IFLTAB, 210, 'zmultu6', IUNIT, IFLTAB(KLOCK), * 'Can not lock file') RETURN C 70 CONTINUE C C ELSE C Successful lock. Lock the request area just in case C another program begins to access this file IF (IFLTAB(KMULT).EQ.2) THEN IBYTE = IFLTAB(KLOCKB) + IWORD(2) CALL lockdss (IFLTAB(KHANDL), 2, IBYTE, IWORD(2), JERR) IF (JERR.EQ.0) IFLTAB(KLOCKR) = 1 ENDIF ENDIF C C On unix, we need to be compatiable with DSS versions prior to 6-K C call oldLockDSS (IFLTAB(KHANDL), 1,IFLTAB(KLOCKB),IWORD(2), JERR) u IFLTAB(KLOCK) = 2 IF (MLEVEL.GE.12) WRITE (MUNIT,*)'---DSS: File Locked' C C C Read the permanent section of the file C On Multiple users systems, be sure this is a C phyical read (not just a buffer in memory)!! IF (LFLUSH) THEN IF (MLEVEL.GE.10) WRITE (MUNIT,*)'---DSS: zmultu6: Read Perm' CALL zrdprm6 (IFLTAB, .TRUE.) ENDIF C ENDIF C ELSE C C Unlock the file. C C C If we are in an exclusive write lock mode, don't unlock file IF ((IFLTAB(KWLOCK).NE.1).AND.(IFLTAB(KMULT).NE.4)) THEN C C First dump all buffers to disk IF (LFLUSH) THEN IF (MLEVEL.GE.10)WRITE(MUNIT,*)'---DSS: zmultu6: Dump Buffs' CALL zbdump6 (IFLTAB, 1) ENDIF C C If we have the request area locked, unlock it IF (IFLTAB(KLOCKR).NE.0) THEN IBYTE = IFLTAB(KLOCKB) + IWORD(2) CALL lockdss (IFLTAB(KHANDL), 0, IBYTE, IWORD(2), JERR) IFLTAB(KLOCKR) = 0 ENDIF C C For DOS, check that if un-lock request has been issued IF (IFLTAB(KMULT).EQ.3) THEN IBYTE = IFLTAB(KLOCKB) + IWORD(2) CALL lockdss (IFLTAB(KHANDL), 3, IBYTE, IWORD(2), IERR) IF (IERR.NE.0) IFLTAB(KMULT) = 2 ENDIF C C IF ((IFLTAB(KLOCK).EQ.2).AND.(IFLTAB(KMULT).LE.2)) THEN Md C Compatability for unix DSS versions prior to 6-K C IF ((IFLTAB(KLOCK).EQ.2).AND.(IFLTAB(KMULT).LE.3)) THEN u C C Be sure buffers are written to disk!! IF (LFLUSH) THEN IF(MLEVEL.GE.11)WRITE(MUNIT,*)'---DSS: File Buffers Flushed' CALL flushf (IFLTAB(KHANDL), IERR) IF (IERR.EQ.-1) THEN C If the network goes down, we will come here. Wait for C a few seconds then try again. CALL WAITS (5.0) CALL flushf (IFLTAB(KHANDL), IERR) ENDIF IF ((IERR.NE.0).AND.(MLEVEL.GT.0)) WRITE (MUNIT,75) IUNIT, * IERR 75 FORMAT (' ---DSS - Error: Unable to flush DSS file', * ' to disk.',/,' Unit:',I5,' Code:',I5) ENDIF C C On unix, we need to be compatiable with DSS versions prior to 6-K C call oldLockDSS (IFLTAB(KHANDL), 0,IFLTAB(KLOCKB),IWORD(2), JERR) u C CALL lockdss (IFLTAB(KHANDL), 0,IFLTAB(KLOCKB),IWORD(2),IERR) C IFLTAB(KLOCK) = 1 IF (MLEVEL.GE.10) WRITE (MUNIT,*)'---DSS: File Unlocked' C If we have an error unlocking, I don't know what to do! IF ((IERR.NE.0).AND.(MLEVEL.GE.3)) THEN WRITE ( MUNIT, 80) IUNIT, IERR 80 FORMAT (' ---DSS - Caution: Unable to unlock DSS file', * ' for multiple user access.',/,' Unit:',I5,' Code:',I5) ENDIF ELSE IF (IFLTAB(KMULT).EQ.6) THEN C Release exclusive access IF (LFLUSH) THEN IF(MLEVEL.GE.10)WRITE(MUNIT,*)'---DSS: zmultu6: Dump Buffs' CALL zbdump6 (IFLTAB, 1) CALL flushf (IFLTAB(KHANDL), IERR) ENDIF ISIZE = IWORD(2) * 3 CALL lockdss (IFLTAB(KHANDL), 0, IFLTAB(KLOCKB), ISIZE, IERR) IFLTAB(KLOCK) = 1 ENDIF ENDIF ENDIF C C C ELSE C IF (LOCK) THEN IF (IFLTAB(KLOCK).NE.2) THEN IFLTAB(KLOCK) = 2 C C Read the permanent section of the file (Always!) C Don't need to force (not multi-user) IF (LFLUSH) THEN IF (MLEVEL.GE.10) WRITE (MUNIT,*)'---DSS: zmultu6: Read Perm' IADD = 1 CALL zgtrec6 (IFLTAB, IFLTAB(KPERM), NPERM, IADD, .TRUE.) ENDIF ENDIF C ELSE IF (LFLUSH) THEN IF (MLEVEL.GE.10) WRITE(MUNIT,*)'---DSS: zmultu6: Dump Buffs' CALL zbdump6 (IFLTAB, 1) ENDIF IFLTAB(KLOCK) = 1 ENDIF C ENDIF C IF (MLEVEL.GE.12) WRITE (MUNIT, 120) IUNIT, IFLTAB(KMULT), * IFLTAB(KLOCK), LOCK 120 FORMAT (T5,'----DSS--- DEBUG: Exit zmultu6; Unit:',I5,/, * T12,'KMULT:',I3,', KLOCK:',I3,' LOCK: ',L1) C RETURN END C subroutine oldLockDSS (ihandle, mode, position, size, istat) u c C integer ihandle, mode, position, size, istat u C integer oldPosition u c c Compatability for versions of dss prior to 6-K c C irec = position / 512 u C ibyte = position - (irec * 512) u C oldPosition = (irec * 127) + 1 + ibyte u c C call lockdss (ihandle, mode, oldPosition, size, istat) u c C return u C end u