\import Algebra.Group
\import Algebra.Group.GroupHom
\import Algebra.Meta
\import Algebra.Monoid
\import Algebra.Pointed
\import Function.Meta
\import Logic
\import Logic.Meta
\import Meta
\import Order.Lattice
\import Order.PartialOrder
\import Paths
\import Paths.Meta
\import Set.Set
\import Topology.CoverSpace
\import Topology.CoverSpace.Complete
\import Topology.TopSpace
\import Topology.TopSpace.Product
\import Topology.UniformSpace
\class TopAddGroup \extends TopSpace, AddGroup, UniformSpace {
| +-cont : ContMap (ProductTopSpace \this \this) \this \lam s => s.1 + s.2
| negative-cont : ContMap \this \this negative
| neighborhood-uniform {C : Set (Set E)} : isUniform C <-> ∃ (U : isOpen) (U 0) ∀ x ∃ (V : C) ∀ {y} (U (negative x + y)) (U (y - x)) (V y)
| uniform-cover Cu x => \case neighborhood-uniform.1 Cu \with {
| inP (U,Uo,U0,h) => \case h x \with {
| inP (V,CV,g) => inP (V, CV, g (transportInv U negative-left U0) (transportInv U negative-right U0))
}
}
| uniform-top => neighborhood-uniform.2 $ inP (top, open-top, (), \lam x => inP (top, idp, \lam _ _ => ()))
| uniform-refine Cu e => \case neighborhood-uniform.1 Cu \with {
| inP (U,Uo,U0,h) => neighborhood-uniform.2 $ inP (U, Uo, U0, \lam x => \case h x \with {
| inP (V,CV,g) => \case e CV \with {
| inP (W,DW,V<=W) => inP (W, DW, \lam u v => V<=W $ g u v)
}
})
}
| uniform-inter Cu Du => \case neighborhood-uniform.1 Cu, neighborhood-uniform.1 Du \with {
| inP (U,Uo,U0,g), inP (V,Vo,V0,h) => neighborhood-uniform.2 $ inP (U ∧ V, open-inter Uo Vo, (U0,V0), \lam x => \case g x, h x \with {
| inP (W,CW,f), inP (W',DW',f') => inP (W ∧ W', inP $ later (W, CW, W', DW', idp), \lam (u,u') (v,v') => (f u v, f' u' v'))
})
}
| uniform-star Cu => \case neighborhood-uniform.1 Cu \with {
| inP (U,Uo,U0,g) => \case shrink' +-cont negative-cont Uo U0 \with {
| inP (V',V'o,V'0,h') => \case shrink' +-cont negative-cont V'o V'0 \with {
| inP (V,Vo,V0,h) => inP (\lam W => ∃ (x : E) (W = \lam y => \Sigma (V (negative x + y)) (V (y - x))), neighborhood-uniform.2 $ inP (V, Vo, V0, \lam x => inP (_, inP $ later (x, idp), \lam u v => (u,v))),
\lam {_} (inP (x,idp)) => \case g x \with {
| inP (U',CU',g') => inP (U', CU', \lam {_} (inP (x',idp)) (y,((a,b),(a',b'))) {z} (c,d) =>
g' (simplify in h' (h a a') (h V0 c)) (simplify in h' (h d b') (h V0 b)))
})
}
}
}
\default cauchy-open {S} => (\lam So {x} Sx => uniform-cauchy.2 $ ClosurePrecoverSpace.closure $ neighborhood-uniform.2 \case shrink' +-cont negative-cont ((+-cont ∘ tuple id (const x)).func-cont So) (transportInv S zro-left Sx) \with {
| inP (U,Uo,U0,h) => inP (U, Uo, U0, \lam y => inP (\lam z => \Sigma (U (negative y + z)) (U (z - y)), later \lam (_,Uxy) {z} (_,Uzy) => transport S simplify (h Uzy Uxy), \lam u v => (u,v)))
}, \lam f => cover-open \lam {x} Sx => \case ClosurePrecoverSpace.closure-filter (NFilter x) (\lam Cu => \case neighborhood-uniform.1 Cu \with {
| inP (U,Uo,U0,h) => \case h x \with {
| inP (V,CV,g) => inP (V, CV, inP (\lam y => \Sigma (U (negative x + y)) (U (y - x)), open-inter ((+-cont ∘ tuple (const (negative x)) id).func-cont Uo) ((+-cont ∘ tuple id (const (negative x))).func-cont Uo),
(transportInv U negative-left U0, transportInv U negative-right U0), \lam (u,v) => g u v))
}
}) $ uniform-cauchy.1 $ f Sx \with {
| inP (U, e, inP (V,Vo,Vx,V<=U)) => inP (V, Vo, Vx, V<=U <=∘ e (V<=U Vx))
})
\default isUniform C : \Prop => ∃ (U : isOpen) (U 0) ∀ x ∃ (V : C) ∀ {y} (U (negative x + y)) (U (y - x)) (V y)
\default neighborhood-uniform \as neighborhood-uniform-impl {C} : _ <-> _ => <->refl {isUniform C}
\lemma properUniform : IsProperUniform
=> \lam Cu => \case neighborhood-uniform.1 Cu \with {
| inP (U,Uo,U0,h) => neighborhood-uniform.2 $ inP (U, Uo, U0, \lam x => \case h x \with {
| inP (V,CV,g) => inP (V, later (CV, inP (x, g (transportInv U negative-left U0) (transportInv U negative-right U0))), g)
})
}
\func topAddUniform {U : Set E} (Uo : isOpen U) (U0 : U 0) : PreuniformSpace.isUniform \lam V => ∃ (x : E) (V = \lam y => \Sigma (U (negative x + y)) (U (y - x)))
=> neighborhood-uniform.2 $ inP (U, Uo, U0, \lam x => inP (_, inP $ later (x, idp), \lam u v => (u,v)))
\lemma shrink {U : Set E} (Uo : isOpen U) (U0 : U 0) : ∃ (V : isOpen) (V 0) ∀ {x y : V} (U (x - y))
=> shrink' +-cont negative-cont Uo U0
-- | A symmetric neighborhood `V` with `V + V ⊆ U`.
\lemma shrink2 {U : Set E} (Uo : isOpen U) (U0 : U 0)
: ∃ (V : isOpen) (V 0) (\Pi {x : E} -> V x -> V (negative x)) (\Pi {x y : E} -> V x -> V y -> U (x + y))
=> \case shrink Uo U0 \with {
| inP (V,Vo,V0,h) => inP (\lam x => \Sigma (V x) (V (negative x)), open-inter Vo (negative-cont.func-cont Vo), (V0, transportInv V negative_zro V0),
\lam (a,b) => (b, transportInv V negative-isInv a), \lam (a,_) (_,b) => transport U (pmap (_ +) negative-isInv) (h a b))
}
-- | A symmetric neighborhood `V` with `V + V + V ⊆ U`.
\lemma shrink3 {U : Set E} (Uo : isOpen U) (U0 : U 0)
: ∃ (V : isOpen) (V 0) (\Pi {x : E} -> V x -> V (negative x)) (\Pi {x y z : E} -> V x -> V y -> V z -> U (x + y + z))
=> \case shrink2 Uo U0 \with {
| inP (W,Wo,W0,_,h) => \case shrink2 Wo W0 \with {
| inP (V,Vo,V0,Vs,g) => inP (V, Vo, V0, Vs, \lam Vx Vy Vz => h (g Vx Vy) (transport W zro-left (g V0 Vz)))
}
}
-- | The conjugate `a + U - a` of a neighborhood is a neighborhood.
\lemma neighborhood-conj (a : E) {U : Set E} (Uo : isOpen U) : isOpen (\lam x => U (a + x - a))
=> (+-cont ∘ tuple (+-cont ∘ tuple (const a) id) (const (negative a))).func-cont Uo
\lemma neighborhood-conj' (a : E) {U : Set E} (Uo : isOpen U) : isOpen (\lam x => U (negative a + x + a))
=> transport isOpen (ext \lam x => pmap (\lam y => U (negative a + x + y)) negative-isInv) (neighborhood-conj (negative a) Uo)
\lemma neighborhood-conj0 (a : E) {U : Set E} (U0 : U 0) : U (a + 0 - a)
=> transportInv U (pmap (- a) zro-right *> negative-right) U0
-- | A finite intersection of neighborhoods.
\lemma neighborhood-finite {n : Nat} {U : Fin n -> Set E} (Uo : \Pi (j : Fin n) -> isOpen (U j)) (U0 : \Pi (j : Fin n) -> U j 0)
: ∃ (V : isOpen) (V 0) (\Pi {x : E} -> V x -> \Pi (j : Fin n) -> U j x) \elim n
| 0 => inP (top, open-top, (), \lam _ j => \case j \with {})
| suc n => \case neighborhood-finite (\lam j => Uo (suc j)) (\lam j => U0 (suc j)) \with {
| inP (V,Vo,V0,h) => inP (U 0 ∧ V, open-inter (Uo 0) Vo, (U0 0, V0), \lam (u,v) j => \case \elim j \with {
| 0 => u
| suc j => h v j
})
}
-- | A symmetric neighborhood contained in {U}.
\lemma neighborhood-sym {U : Set E} (Uo : isOpen U) (U0 : U 0)
: ∃ (V : isOpen) (V 0) (\Pi {x : E} -> V x -> V (negative x)) (V ⊆ U)
=> \case shrink2 Uo U0 \with {
| inP (V,Vo,V0,Vs,h) => inP (V, Vo, V0, Vs, \lam Vx => transport U zro-right (h Vx V0))
}
-- | Left translation `x +` is uniformly continuous.
\func leftTranslation (x : E) : UniformMap \this \this (x +) \cowith
| func-uniform Eu => \case neighborhood-uniform.1 Eu \with {
| inP (U,Uo,U0,h) => neighborhood-uniform.2 $ inP (U ∧ (\lam z => U (x + z - x)), open-inter Uo $ (+-cont ∘ tuple (+-cont ∘ tuple (const x) id) (const (negative x))).func-cont Uo,
(U0, transportInv U simplify U0), \lam y => \case h (x + y) \with {
| inP (V,EV,g) => inP (_, inP $ later (V, EV, idp), \lam {z} (u,_) (_,u') => g (transportInv U simplify u) (transportInv U (pmap (x + z +) negative_+ *> equation) u'))
})
}
\lemma subtract-cont : ContMap (ProductTopSpace \this \this) \this \lam s => s.1 - s.2
=> +-cont ∘ prod id negative-cont
-- | {x} and {y} are {U}-close.
\func AreClose (U : Set E) (x y : E) : \Prop
=> \Sigma (U (negative x + y)) (U (y - x))
\lemma close-refl {U : Set E} (U0 : U 0) {x : E} : AreClose U x x
=> (transportInv U negative-left U0, transportInv U negative-right U0)
\lemma close-symm {U : Set E} (Us : \Pi {x : E} -> U x -> U (negative x)) {x y : E} (c : AreClose U x y) : AreClose U y x
=> (transport U simplify (Us c.1), transport U simplify (Us c.2))
\lemma close-mono {U V : Set E} (U<=V : U ⊆ V) {x y : E} (c : AreClose U x y) : AreClose V x y
=> (U<=V c.1, U<=V c.2)
-- | Inversion maps points that are close for `-U` to `U`-close points.
\lemma close-negative {U : Set E} {x y : E} (c : AreClose (\lam z => U (negative z)) x y) : AreClose U (negative x) (negative y)
=> (transportInv U simplify c.2, transportInv U simplify c.1)
-- | Left translation by {a} maps points that are close for {U} and for `-a + U + a` to `U`-close points.
\lemma close-left (a : E) {U : Set E} {x y : E} (c : AreClose (\lam z => \Sigma (U z) (U (a + z - a))) x y) : AreClose U (a + x) (a + y)
=> (transportInv U simplify c.1.1, simplify (transport U equation c.2.2))
-- | Right translation by {a} maps points that are close for {U} and for `a + U - a` to `U`-close points.
\lemma close-right (a : E) {U : Set E} {x y : E} (c : AreClose (\lam z => \Sigma (U z) (U (negative a + z + a))) x y) : AreClose U (x + a) (y + a)
=> (simplify (transport U equation c.1.2), transportInv U simplify c.2.1)
} \where {
\open ContMap
\open ProductTopSpace
\private \lemma shrink' {X : TopSpace} {A : AddGroup X} (+-cont : ContMap (ProductTopSpace X X) X \lam s => s.1 + s.2) (negative-cont : ContMap X X negative)
{U : Set X} (Uo : isOpen U) (U0 : U 0) : ∃ (V : isOpen) (V 0) ∀ {x y : V} (U (x - y))
=> \case (+-cont ∘ prod id negative-cont).func-cont Uo {0,0} (transportInv U negative-right U0) \with {
| inP (V,Vo,V0,W,Wo,W0,h) => inP (V ∧ W, open-inter Vo Wo, (V0,W0), \lam (Vx,_) (_,Wy) => h Vx Wy)
}
}
\lemma negative-uniform {A : TopAddGroup} : UniformMap A A negative \cowith
| func-uniform Eu => \case neighborhood-uniform.1 Eu \with {
| inP (U,Uo,U0,h) => neighborhood-uniform.2 $ inP (negative ^-1 U, negative-cont.func-cont Uo, transportInv U A.negative_zro U0, \lam x => \case h (negative x) \with {
| inP (V,EV,g) => inP (negative ^-1 V, inP $ later (V,EV,idp), \lam p q => g (transport U equation.addGroup q) (transport U equation.addGroup p))
})
}
\class TopAbGroup \extends TopAddGroup, AbGroup {
\lemma ab-neighborhood-uniform {C : Set (Set E)} : isUniform C <-> ∃ (U : isOpen) (U 0) ∀ x ∃ (V : C) ∀ {y} (U (x - y) -> V y)
=> <->trans neighborhood-uniform (<->sym $ ab-uniform-equiv negative-cont)
\func topAbUniform {U : Set E} (Uo : isOpen U) (U0 : U 0) : PreuniformSpace.isUniform \lam V => ∃ (x : E) (V = \lam y => U (x - y))
=> ab-neighborhood-uniform.2 $ inP (U, Uo, U0, \lam x => inP (_, inP $ later (x, idp), \lam u => u))
\func UBall (U : Set E) (x : E) : Set E => \lam x' => U (x - x')
\lemma UBall-open {U : Set E} (Uo : isOpen U) {x : E} : isOpen (UBall U x)
=> (+-cont ∘ tuple (const x) negative-cont).func-cont Uo
\lemma UBall-center {U : Set E} (U0 : U 0) {x : E} : UBall U x x
=> transportInv U negative-right U0
\lemma UBall-point {U : Set E} {x : E} (Ux : U x) : UBall U x 0
=> transportInv U simplify Ux
} \where {
\open ContMap
\open ProductTopSpace
\lemma ab-uniform-trans {X : TopSpace} {A : AbGroup X} (negative-cont : ContMap X X negative) {P : \Prop} {C : Set (Set X)}
(h : P <-> ∃ (U : isOpen) (U 0) ∀ x ∃ (V : C) ∀ {y} (U (x - y) -> V y))
: P <-> ∃ (U : isOpen) (U 0) ∀ x ∃ (V : C) ∀ {y} (U (negative x + y)) (U (y - x)) (V y)
=> <->trans h (ab-uniform-equiv negative-cont)
\lemma ab-uniform-equiv {X : TopSpace} {A : AbGroup X} (negative-cont : ContMap X X negative) {C : Set (Set X)}
: ∃ (U : isOpen) (U 0) ∀ x ∃ (V : C) ∀ {y} (U (x - y) -> V y) <-> ∃ (U : isOpen) (U 0) ∀ x ∃ (V : C) ∀ {y} (U (negative x + y)) (U (y - x)) (V y)
=> (\lam (inP (U,Uo,U0,h)) => inP (negative ^-1 U, negative-cont.func-cont Uo, transportInv U AddGroup.negative_zro U0, \lam x => \case h x \with {
| inP (V,CV,g) => inP (V, CV, \lam _ u => g $ transport U AddGroup.negative_- u)
}), \lam (inP (U,Uo,U0,h)) => inP (negative ^-1 U, negative-cont.func-cont Uo, transportInv U AddGroup.negative_zro U0, \lam x => \case h x \with {
| inP (V,CV,g) => inP (V, CV, \lam {y} u => \have v : U (y - x) => transport U AddGroup.negative_- u \in g (transport U +-comm v) v)
}))
}
\class CompleteTopAbGroup \extends TopAbGroup, CompleteUniformSpace
\func \infix 4 <=<ta {X : TopAbGroup} (V U : Set X) : \Prop
=> ∀ {x y : V} (U (x - y))
\lemma <=<ta-left {X : TopAbGroup} {V U : Set X} (V<=<U : V <=<ta U) {x y z : X} (p : V (x - z)) (q : V (y - z)) : U (x - y)
=> transport U simplify (V<=<U p q)
\lemma <=<ta-right {X : TopAbGroup} {V U : Set X} (V<=<U : V <=<ta U) {x y z : X} (p : V (x - y)) (q : V (x - z)) : U (y - z)
=> transport U (simplify +-comm) (V<=<U q p)
\lemma topAb-sub-contAt {X Y : TopAbGroup} {S : Set X} {f : Set.Total S -> Y} {x : Set.Total S}
: IsContAt {TopSub S} f x <-> ∀ {V : Y.isOpen} (V 0) ∃ (U : X.isOpen) (U 0) ∀ {x' : Set.Total S} (U (x.1 - x'.1)) (V (f x - f x'))
=> (\lam fc {V} Vo V0 => \case fc (Y.UBall-open Vo) (Y.UBall-center {V} V0) \with {
| inP (_, inP (U,Uo,idp), Ux, p) => inP (_, X.UBall-open Uo {x.1}, X.UBall-point {U} Ux, \lam u => p $ simplify in u)
}, \lam fc {V} Vo Vfx => \case fc (Y.UBall-open Vo {f x}) (Y.UBall-point {V} Vfx) \with {
| inP (U,Uo,U0,g) => inP (_, inP (_, X.UBall-open Uo {x.1}, idp), X.UBall-center {U} U0, \lam u => simplify in g u)
})
\lemma topAb-contAt {X Y : TopAbGroup} {f : X -> Y} {x : X} : IsContAt f x <-> ∀ {V : Y.isOpen} (V 0) ∃ (U : X.isOpen) (U 0) ∀ {x'} (U (x - x')) (V (f x - f x'))
=> (\lam fc {V} Vo V0 => \case fc (Y.UBall-open Vo) (Y.UBall-center {V} V0) \with {
| inP (U, Uo, Ux, p) => inP (_, X.UBall-open Uo, X.UBall-point {U} Ux, \lam u => p $ simplify in u)
}, \lam fc {V} Vo Vfx => \case fc (Y.UBall-open Vo {f x}) (Y.UBall-point {V} Vfx) \with {
| inP (U,Uo,U0,g) => inP (_, X.UBall-open Uo, X.UBall-center {U} U0, \lam u => simplify in g u)
})
\lemma <=<ta_<= {X : TopAbGroup} {V U : Set X} (V0 : V 0) (p : V <=<ta U) : V ⊆ U
=> \lam Vx => transport U simplify (p Vx V0)
\lemma <=<ta_negative {X : TopAbGroup} {V U : Set X} (p : V <=<ta U) : negative ^-1 V <=<ta negative ^-1 U
=> \lam W-x W-y => simplify $ transport U +-comm $ simplify in p W-x W-y
\lemma <=<ta_<=*-shifted {X : TopAbGroup} {W V U : Set X} (Wo : isOpen W) (W0 : W 0) (p : W <=<ta V) (q : V <=<ta U) {x : X} : X.UBall W x <=* X.UBall U x
=> inP (_, X.topAbUniform Wo W0, \lam {y} (inP (_, (inP (z,idp), (w,(Wxw,Wzw))), Wzy)) => simplify in q (p Wxw Wzw) (p W0 Wzy))
\lemma <=<ta_<=* {X : TopAbGroup} {W V U : Set X} (Wo : isOpen W) (W0 : W 0) (p : W <=<ta V) (q : V <=<ta U) : W <=* U
=> transport2 (<=*) (ext \lam x => simplify) (ext \lam x => simplify) $ <=<ta_<=*-shifted {X} {negative ^-1 W} {negative ^-1 V} {negative ^-1 U}
(negative-cont.func-cont Wo) (simplify W0) (<=<ta_negative {_} {_} {V} p) (<=<ta_negative {_} {_} {U} q) {0}
\class HausdorffTopAbGroup \extends TopAbGroup, SeparatedCoverSpace {
\lemma equals {x y : E} (p : ∀ {U : isOpen} (U 0) (U (x - y))) : x = y
=> fromZero $ isHausdorff \lam Uo Vo Ud V0 => inP (x - y, (Ud, p Vo V0))
}
\record TopAbGroupMap \extends ContMap, AddGroupHom, UniformMap {
\override Dom : TopAbGroup
\override Cod : TopAbGroup
\default func-uniform Eu => \case ab-neighborhood-uniform.1 Eu \with {
| inP (U,Uo,U0,h) => ab-neighborhood-uniform.2 $ inP (func ^-1 U, func-cont Uo, transportInv U func-zro U0, \lam x => \case h (func x) \with {
| inP (V,EV,g) => inP (func ^-1 V, inP $ later (V, EV, idp), \lam u => g $ transport U func-minus u)
})
}
\lemma embedding->uniformEmbedding (e : ContMap.IsDenseTopEmbedding) : UniformMap.IsDenseUniformEmbedding
=> (e.1, \lam Cu => \case ab-neighborhood-uniform.1 Cu \with {
| inP (U,Uo,U0,h) => \case e.2 Uo \with {
| inP (V,Vo,p) => ab-neighborhood-uniform.2 \case TopAddGroup.shrink Vo $ transport V func-zro $ rewrite p in U0 \with {
| inP (V',V'o,V'0,g) => inP (V', V'o, V'0, \lam y => inP (\lam y' => V' (y - y'), \case e.1 (UBall-open V'o {y}) (UBall-center {Cod} {V'} V'0) \with {
| inP (_, inP (x,idp),V'yfx) => \case h x \with {
| inP (W,CW,q) => inP $ later (W, CW, \lam {x'} V'yfx' => q $ rewrite p $ transport V (pmap (- _) +-comm *> simplify +-comm *> inv func-minus) $ g V'yfx' V'yfx)
}
}, \lam v => v))
}
}
})
} \where {
\open TopAbGroup
}