-
Notifications
You must be signed in to change notification settings - Fork 0
/
pervasives.agda
71 lines (51 loc) · 1.44 KB
/
pervasives.agda
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
module pervasives where
open import Agda.Primitive using (lzero; lsuc; _⊔_) public
infixr 9 _∘_
_∘_ : ∀ {a b c}
→ {A : Set a}
→ {B : A → Set b}
→ {C : {x : A} → B x → Set c}
→ (g : (∀ {x} (y : B x) → C y))
→ (f : (x : A) → B x)
→ ((x : A) → C (f x))
g ∘ f = λ x → g (f x)
const : ∀ {a b} {A : Set a} {B : Set b} → A → B → A
const a b = a
data Void{ℓ} : Set ℓ where
record Unit{ℓ} : Set ℓ where
constructor ⟨⟩
data _+_ {i j} (A : Set i) (B : Set j) : Set (i ⊔ j) where
inl : A → A + B
inr : B → A + B
data Bool : Set where
tt ff : Bool
So : Bool → Set
So tt = Unit
So ff = Void
absurd : ∀ {i} {j} {A : Set i} → Void{j} → A
absurd ()
record Σ {i j} (A : Set i) (B : A → Set j) : Set (i ⊔ j) where
constructor ⟨_,_⟩
field
fst : A
snd : B fst
syntax Σ A (λ x → B) = Σ[ x ∶ A ] B
_×_ : ∀ {i j} → (A : Set i) (B : Set j) → Set (i ⊔ j)
A × B = Σ[ _ ∶ A ] B
infixr 8 _×_
data _==_ {ℓ} {A : Set ℓ} (M : A) : A → Set ℓ where
refl : M == M
{-# BUILTIN EQUALITY _==_ #-}
{-# BUILTIN REFL refl #-}
infix 1000 ♯_
postulate
∞_ : ∀ {a} (A : Set a) → Set a
♯_ : ∀ {a} {A : Set a} → A → ∞ A
♭ : ∀ {a} {A : Set a} → ∞ A → A
{-# BUILTIN INFINITY ∞_ #-}
{-# BUILTIN SHARP ♯_ #-}
{-# BUILTIN FLAT ♭ #-}
data ℕ{ℓ} : Set ℓ where
ze : ℕ
su : ℕ → ℕ
{-# BUILTIN NATURAL ℕ #-}