Copyright | (c) Justus Sagemüller 2013 |
---|---|
License | GPL v3 |
Maintainer | (@) sagemueller $ geo.uni-koeln.de |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
This is something of a first attempt at formalising manifolds and continuous mappings thereon. They work (check out http://hackage.haskell.org/package/dynamic-plot-0.1.0.0 for a use case), but aren't very efficient. The interface might well change considerably in the future.
- data domain :--> codomain where
- Continuous :: (Manifold d, Manifold c, v ~ TangentSpace d, u ~ TangentSpace c, δ ~ Metric v, ε ~ Metric u) => {
- runContinuous :: Chart d -> v -> (Chart c, u, ε -> Option δ)
- Continuous :: (Manifold d, Manifold c, v ~ TangentSpace d, u ~ TangentSpace c, δ ~ Metric v, ε ~ Metric u) => {
- continuous_id' :: Manifold m => m :--> m
- const__ :: (Manifold c, Manifold d) => c -> d :--> c
- flatContinuous :: (FlatManifold v, FlatManifold w, δ ~ Metric v, ε ~ Metric w) => (v -> (w, ε -> Option δ)) -> v :--> w
- runFlatContinuous :: (FlatManifold v, FlatManifold w, δ ~ Metric v, ε ~ Metric w) => (v :--> w) -> v -> (w, ε -> Option δ)
- data Chart :: * -> * where
- IdChart :: FlatManifold v => Chart v
- Chart :: (Manifold m, v ~ TangentSpace m, FlatManifold v) => {
- chartInMap :: v :--> m
- chartOutMap :: m -> Maybe (m :--> v)
- chartKind :: ChartKind
- data ChartKind
- type FlatManifold v = (MetricSpace v, Manifold v, v ~ TangentSpace v)
- type EuclidSpace v = (HasBasis v, EqFloating (Scalar v), Eq v)
- isInUpperHemi :: EuclidSpace v => v -> Bool
- type Atlas m = [Chart m]
- class (MetricSpace (TangentSpace m), Metric (TangentSpace m) ~ ℝ) => Manifold m where
- type TangentSpace m :: *
- localAtlas :: m -> Atlas m
- vectorSpaceAtlas :: FlatManifold v => v -> Atlas v
- type Representsℝ r = (EqFloating r, FlatManifold r, r ~ Scalar r, r ~ Metric r)
- continuousFlatFunction :: (FlatManifold d, FlatManifold c, ε ~ Metric c, δ ~ Metric d) => (d -> (c, ε -> Option δ)) -> d :--> c
- type CntnRealFunction = Representsℝ r => r :--> r
- sin__ :: CntnRealFunction
- asinh__ :: CntnRealFunction
- tanh__ :: CntnRealFunction
- cosh__ :: CntnRealFunction
- sinh__ :: CntnRealFunction
- exp__ :: CntnRealFunction
- atan__ :: CntnRealFunction
- cos__ :: CntnRealFunction
- cntnFuncsCombine :: forall d v c c' c'' ε ε' ε''. (FlatManifold c, FlatManifold c', FlatManifold c'', ε ~ Metric c, ε' ~ Metric c', ε'' ~ Metric c'', ε ~ ε', ε ~ ε'') => (c' -> c'' -> (c, ε -> (ε', ε''))) -> (d :--> c') -> (d :--> c'') -> d :--> c
- data CntnFuncValue d c
- = CntnFuncValue {
- runCntnFuncValue :: d :--> c
- | CntnFuncConst c
- = CntnFuncValue {
- cntnFnValsFunc :: (FlatManifold c, FlatManifold c', Manifold d, ε ~ Metric c, ε ~ Metric c') => (c' -> (c, ε -> Option ε)) -> CntnFuncValue d c' -> CntnFuncValue d c
- cntnFnValsCombine :: forall d c c' c'' ε ε' ε''. (FlatManifold c, FlatManifold c', FlatManifold c'', Manifold d, ε ~ Metric c, ε' ~ Metric c', ε'' ~ Metric c'', ε ~ ε', ε ~ ε'') => (c' -> c'' -> (c, ε -> (ε', (ε', ε''), ε''))) -> CntnFuncValue d c' -> CntnFuncValue d c'' -> CntnFuncValue d c
- finiteGraphContinℝtoℝ :: GraphWindowSpec -> (Double :--> Double) -> [(Double, Double)]
- finiteGraphContinℝtoℝ² :: GraphWindowSpec -> (Double :--> (Double, Double)) -> [[(Double, Double)]]
- midBetween :: (VectorSpace v, Fractional (Scalar v)) => [v] -> v
- (.:) :: (c -> d) -> (a -> b -> c) -> a -> b -> d
- just :: a -> Option a
- nothing :: Option a
- class (RealFloat (Metric v), InnerSpace v) => MetricSpace v where
- type Real0 = ℝ⁰
- type Real1 = ℝ
- type RealPlus = ℝay
- type Real2 = ℝ²
- type Real3 = ℝ³
- type Sphere0 = S⁰
- type Sphere1 = S¹
- type Sphere2 = S²
- type Projective1 = ℝP¹
- type Projective2 = ℝP²
- type Disk1 = D¹
- type Disk2 = D²
- type Cone = CD¹
- type OpenCone = Cℝay
- data ZeroDim k = Origin
- type ℝ⁰ = ZeroDim ℝ
- type ℝ = Double
- type ℝ² = (ℝ, ℝ)
- type ℝ³ = (ℝ², ℝ)
- data S⁰
- newtype S¹ = S¹ {}
- data S² = S² {}
- type ℝP¹ = S¹
- data ℝP² = ℝP² {}
- newtype D¹ = D¹ {}
- data D² = D² {}
- type ℝay = Cℝay ℝ⁰
- data CD¹ x = CD¹ {}
- data Cℝay x = Cℝay {
- hParamCℝay :: !Double
- pParamCℝay :: !x
- class NaturallyEmbedded m v where
- data GraphWindowSpec = GraphWindowSpec {}
- type Endomorphism a = a -> a
- (^) :: Num a => a -> Int -> a
- type EqFloating f = (Eq f, Ord f, Floating f)
Documentation
data domain :--> codomain where Source
Continuous mapping.
Continuous :: (Manifold d, Manifold c, v ~ TangentSpace d, u ~ TangentSpace c, δ ~ Metric v, ε ~ Metric u) => (Chart d -> v -> (Chart c, u, ε -> Option δ)) -> d :--> c | |
|
Morphism (:-->) | |
PreArrow (:-->) | |
CartesianAgent (:-->) | |
Category (:-->) | |
Cartesian (:-->) | |
HasAgent (:-->) | |
EnhancedCat (->) (:-->) | |
PointAgent CntnFuncValue (:-->) d c | |
type UnitObject (:-->) = () | |
type Object (:-->) t = Manifold t | |
type PairObjects (:-->) a b = (FlatManifold a, FlatManifold b, Manifold (a, b)) | |
type AgentVal (:-->) d c = CntnFuncValue d c |
continuous_id' :: Manifold m => m :--> m Source
flatContinuous :: (FlatManifold v, FlatManifold w, δ ~ Metric v, ε ~ Metric w) => (v -> (w, ε -> Option δ)) -> v :--> w Source
runFlatContinuous :: (FlatManifold v, FlatManifold w, δ ~ Metric v, ε ~ Metric w) => (v :--> w) -> v -> (w, ε -> Option δ) Source
data Chart :: * -> * where Source
A chart is a homeomorphism from a connected, open subset Q ⊂ M of
an n-manifold M to either the open unit disk Dⁿ ⊂ V ≃ ℝⁿ, or
the half-disk Hⁿ = {x ∊ Dⁿ: x₀≥0}. In e.g. the former case, chartInMap
is thus defined ∀ v ∊ V : |v| < 1, while 'chartOutMap p' will yield Just x
with x ∊ Dⁿ provided p is in Q, and Nothing
otherwise.
Obviously, fromJust .
should be equivalent to chartOutMap
. chartInMap
id
on Dⁿ, and
to chartInMap
. fromJust . chartOutMap
id
on Q.
IdChart :: FlatManifold v => Chart v | |
Chart :: (Manifold m, v ~ TangentSpace m, FlatManifold v) => (v :--> m) -> (m -> Maybe (m :--> v)) -> ChartKind -> Chart m | |
|
LandlockedChart | A M ⇆ Dⁿ chart, for ordinary manifolds |
RimChart | A M ⇆ Hⁿ chart, for manifolds with a rim |
type FlatManifold v = (MetricSpace v, Manifold v, v ~ TangentSpace v) Source
type EuclidSpace v = (HasBasis v, EqFloating (Scalar v), Eq v) Source
isInUpperHemi :: EuclidSpace v => v -> Bool Source
class (MetricSpace (TangentSpace m), Metric (TangentSpace m) ~ ℝ) => Manifold m where Source
type TangentSpace m :: * Source
localAtlas :: m -> Atlas m Source
Manifold Double | |
Manifold () | |
(FlatManifold v₁, FlatManifold v₂, (~) * (Scalar v₁) (Scalar v₂), MetricSpace (Scalar v₁), (~) * (Metric (Scalar v₁)) ℝ, VectorSpace (v₁, v₂), (~) * (Scalar (v₁, v₂)) (Scalar v₁)) => Manifold (v₁, v₂) |
vectorSpaceAtlas :: FlatManifold v => v -> Atlas v Source
type Representsℝ r = (EqFloating r, FlatManifold r, r ~ Scalar r, r ~ Metric r) Source
continuousFlatFunction :: (FlatManifold d, FlatManifold c, ε ~ Metric c, δ ~ Metric d) => (d -> (c, ε -> Option δ)) -> d :--> c Source
type CntnRealFunction = Representsℝ r => r :--> r Source
cntnFuncsCombine :: forall d v c c' c'' ε ε' ε''. (FlatManifold c, FlatManifold c', FlatManifold c'', ε ~ Metric c, ε' ~ Metric c', ε'' ~ Metric c'', ε ~ ε', ε ~ ε'') => (c' -> c'' -> (c, ε -> (ε', ε''))) -> (d :--> c') -> (d :--> c'') -> d :--> c Source
data CntnFuncValue d c Source
CntnFuncValue | |
| |
CntnFuncConst c |
PointAgent CntnFuncValue (:-->) d c | |
(Representsℝ r, Manifold d) => Floating (CntnFuncValue d r) | |
(Representsℝ r, Manifold d) => Fractional (CntnFuncValue d r) | |
(Representsℝ r, Manifold d) => Num (CntnFuncValue d r) | |
(FlatManifold v, MetricSpace v, (~) * (Metric v) ℝ, FlatManifold (Scalar v), MetricSpace (Scalar v), (~) * (Metric (Scalar v)) ℝ, Manifold d) => VectorSpace (CntnFuncValue d v) | |
(FlatManifold v, Manifold d) => AdditiveGroup (CntnFuncValue d v) | |
type Scalar (CntnFuncValue d v) = CntnFuncValue d (Scalar v) |
cntnFnValsFunc :: (FlatManifold c, FlatManifold c', Manifold d, ε ~ Metric c, ε ~ Metric c') => (c' -> (c, ε -> Option ε)) -> CntnFuncValue d c' -> CntnFuncValue d c Source
cntnFnValsCombine :: forall d c c' c'' ε ε' ε''. (FlatManifold c, FlatManifold c', FlatManifold c'', Manifold d, ε ~ Metric c, ε' ~ Metric c', ε'' ~ Metric c'', ε ~ ε', ε ~ ε'') => (c' -> c'' -> (c, ε -> (ε', (ε', ε''), ε''))) -> CntnFuncValue d c' -> CntnFuncValue d c'' -> CntnFuncValue d c Source
finiteGraphContinℝtoℝ :: GraphWindowSpec -> (Double :--> Double) -> [(Double, Double)] Source
finiteGraphContinℝtoℝ² :: GraphWindowSpec -> (Double :--> (Double, Double)) -> [[(Double, Double)]] Source
midBetween :: (VectorSpace v, Fractional (Scalar v)) => [v] -> v Source
class (RealFloat (Metric v), InnerSpace v) => MetricSpace v where Source
metric :: v -> Metric v Source
metricSq :: v -> Metric v Source
(|*^) :: Metric v -> v -> v Source
metricToScalar :: v -> Metric v -> Scalar v Source
MetricSpace () | |
MetricSpace ℝ | |
(RealFloat r, MetricSpace r, (~) * (Scalar (Complex r)) (Metric r)) => MetricSpace (Complex r) | |
(MetricSpace v, MetricSpace (Scalar v), MetricSpace w, (~) * (Scalar v) (Scalar w), (~) * (Metric v) (Metric (Scalar v)), (~) * (Metric w) (Metric v), (~) * (Metric (Scalar w)) (Metric v), RealFloat (Metric v)) => MetricSpace (v, w) |
Index / ASCII names
type Projective1 = ℝP¹ Source
type Projective2 = ℝP² Source
Linear manifolds
A single point. Can be considered a zero-dimensional vector space, WRT any scalar.
Eq (ZeroDim k) | |
Show (ZeroDim k) | |
Monoid (ZeroDim k) | |
HasBasis (ZeroDim k) | |
VectorSpace (ZeroDim k) | |
AdditiveGroup (ZeroDim k) | |
SmoothScalar k => FiniteDimensional (ZeroDim k) | |
MetricScalar k => HasMetric' (ZeroDim k) | |
PseudoAffine (ZeroDim k) | |
Semimanifold (ZeroDim k) | |
type Basis (ZeroDim k) = Void | |
type Scalar (ZeroDim k) = k | |
type DualSpace (ZeroDim k) = ZeroDim k | |
type Needle (ZeroDim k) = ZeroDim k |
Hyperspheres
The zero-dimensional sphere is actually just two points. Implementation might
therefore change to ℝ⁰
: the disjoint sum of two
single-point spaces.+
ℝ⁰
Eq S⁰ | |
Show S⁰ | |
PseudoAffine S⁰ | |
Semimanifold S⁰ | |
NaturallyEmbedded S⁰ ℝ | |
type Needle S⁰ = ℝ⁰ |
The unit circle.
Show S¹ | |
PseudoAffine S¹ | |
Semimanifold S¹ | |
NaturallyEmbedded S¹ ℝ² | |
type Needle S¹ = ℝ |
The ordinary unit sphere.
Show S² | |
PseudoAffine S² | |
Semimanifold S² | |
NaturallyEmbedded S² ℝ³ | |
type Needle S² = ℝ² |
Projective spaces
The two-dimensional real projective space, implemented as a unit disk with opposing points on the rim glued together.
Show ℝP² | |
PseudoAffine ℝP² | |
Semimanifold ℝP² | |
NaturallyEmbedded ℝP² ℝ³ | |
type Needle ℝP² = ℝ² |
Intervals/disks/cones
The “one-dimensional disk” – really just the line segment between the two points -1 and 1 of 'S⁰', i.e. this is simply a closed interval.
The standard, closed unit disk. Homeomorphic to the cone over 'S¹', but not in the the obvious, “flat” way. (And not at all, despite the identical ADT definition, to the projective space 'ℝP²'!)
Better known as ℝ⁺ (which is not a legal Haskell name), the ray of positive numbers (including zero, i.e. closed on one end).
A (closed) cone over a space x
is the product of x
with the closed interval 'D¹'
of “heights”,
except on its “tip”: here, x
is smashed to a single point.
This construct becomes (homeomorphic-to-) an actual geometric cone (and to 'D²') in the
special case x = 'S¹'
.
(PseudoAffine m, VectorSpace (Needle m), (~) * (Scalar (Needle m)) ℝ) => PseudoAffine (CD¹ m) | |
(PseudoAffine m, VectorSpace (Needle m), (~) * (Scalar (Needle m)) ℝ) => Semimanifold (CD¹ m) | |
type Needle (CD¹ m) = (Needle m, ℝ) |
An open cone is homeomorphic to a closed cone without the “lid”,
i.e. without the “last copy” of x
, at the far end of the height
interval. Since that means the height does not include its supremum, it is actually
more natural to express it as the entire real ray, hence the name.
Cℝay | |
|
NaturallyEmbedded x p => NaturallyEmbedded (Cℝay x) (p, ℝ) |
Utility (deprecated)
class NaturallyEmbedded m v where Source
NaturallyEmbedded D¹ ℝ | |
NaturallyEmbedded ℝP² ℝ³ | |
NaturallyEmbedded S² ℝ³ | |
NaturallyEmbedded S¹ ℝ² | |
NaturallyEmbedded S⁰ ℝ | |
(VectorSpace y, VectorSpace z) => NaturallyEmbedded x ((x, y), z) | |
VectorSpace y => NaturallyEmbedded x (x, y) | |
(HasUnitSphere v, (~) * v (DualSpace v)) => NaturallyEmbedded (Stiefel1 v) v | |
NaturallyEmbedded x p => NaturallyEmbedded (Cℝay x) (p, ℝ) |
type Endomorphism a = a -> a Source
type EqFloating f = (Eq f, Ord f, Floating f) Source