2
module Data.Real.Complete where
13
Complete A = Gauge -> A
15
unit : {A : Set} -> A -> Complete A
18
join : {A : Set} -> Complete (Complete A) -> Complete A
25
data _==>_ (A B : Set) : Set where
26
uniformCts : (Gauge -> Gauge) -> (A -> B) -> A ==> B
28
modulus : {A B : Set} -> (A ==> B) -> Gauge -> Gauge
29
modulus (uniformCts μ _) = μ
31
forgetUniformCts : {A B : Set} -> (A ==> B) -> A -> B
32
forgetUniformCts (uniformCts _ f) = f
34
mapC : {A B : Set} -> (A ==> B) -> Complete A -> Complete B
35
mapC (uniformCts μ f) x ε = f (x (μ ε))
37
bind : {A B : Set} -> (A ==> Complete B) -> Complete A -> Complete B
38
bind f x = join $ mapC f x
40
mapC2 : {A B C : Set} -> (A ==> B ==> C) -> Complete A -> Complete B -> Complete C
41
mapC2 f x y ε = mapC ≈fx y ε2
46
_○_ : {A B C : Set} -> (B ==> C) -> (A ==> B) -> A ==> C
47
f ○ g = uniformCts μ h
49
μ = modulus f ∘ modulus g
50
h = forgetUniformCts f ∘ forgetUniformCts g
52
constCts : {A B : Set} -> A -> B ==> A
53
constCts a = uniformCts (const $ fromNat 1) (const a)