wtf
This commit is contained in:
parent
42d3b9452b
commit
a18f581ff0
11 changed files with 95 additions and 1 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
*.agdai
|
2
cubical-playground.agda-lib
Normal file
2
cubical-playground.agda-lib
Normal file
|
@ -0,0 +1,2 @@
|
|||
include: src
|
||||
depend: standard-library
|
|
@ -1,5 +1,5 @@
|
|||
```
|
||||
{#- OPTIONS --cubical -#}
|
||||
{-# OPTIONS --cubical #-}
|
||||
|
||||
----------
|
||||
|
8
src/2022-10-10-notes.lagda.md
Normal file
8
src/2022-10-10-notes.lagda.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
2022 Oct 10
|
||||
===
|
||||
|
||||
```agda
|
||||
{-# OPTIONS --cubical #-}
|
||||
|
||||
-- Hello
|
||||
```
|
8
src/Dedekind/Bool.agda
Normal file
8
src/Dedekind/Bool.agda
Normal file
|
@ -0,0 +1,8 @@
|
|||
module Dedekind.Bool where
|
||||
|
||||
-- Booleans
|
||||
data Bool : Set where
|
||||
true : Bool
|
||||
false : Bool
|
||||
|
||||
|
8
src/Dedekind/Integer.agda
Normal file
8
src/Dedekind/Integer.agda
Normal file
|
@ -0,0 +1,8 @@
|
|||
module Dedekind.Integer where
|
||||
|
||||
open import Dedekind.Natural using (ℕ)
|
||||
|
||||
-- Integers
|
||||
data ℤ : Set where
|
||||
pos : ℕ → ℤ
|
||||
negsuc : ℕ → ℤ
|
15
src/Dedekind/Natural.agda
Normal file
15
src/Dedekind/Natural.agda
Normal file
|
@ -0,0 +1,15 @@
|
|||
module Dedekind.Natural where
|
||||
|
||||
open import Dedekind.Set using (⊤; ⊥)
|
||||
|
||||
-- Natural
|
||||
data ℕ : Set where
|
||||
zero : ℕ
|
||||
suc : ℕ → ℕ
|
||||
|
||||
NonZero : ℕ → Set
|
||||
NonZero zero = ⊥
|
||||
NonZero (suc n) = ⊤
|
||||
|
||||
gcd : (x y : ℕ) .{{ _ : NonZero x }} .{{ _ : NonZero y }} → ℕ
|
||||
gcd x y = ?
|
12
src/Dedekind/Rational.agda
Normal file
12
src/Dedekind/Rational.agda
Normal file
|
@ -0,0 +1,12 @@
|
|||
module Dedekind.Rational where
|
||||
|
||||
open import Dedekind.Bool using (Bool)
|
||||
open import Dedekind.Integer using (ℤ)
|
||||
open import Dedekind.Natural using (ℕ; NonZero)
|
||||
|
||||
-- Rational
|
||||
data ℚ : Set where
|
||||
rat : ℤ → (d : ℕ) .{{ _ : NonZero d }} → ℚ
|
||||
|
||||
_<_ : ℚ → ℚ → Bool
|
||||
x < y = ?
|
20
src/Dedekind/Real.agda
Normal file
20
src/Dedekind/Real.agda
Normal file
|
@ -0,0 +1,20 @@
|
|||
-- Dedekind cuts using Cubical Agda
|
||||
{-# OPTIONS --cubical #-}
|
||||
|
||||
module Dedekind.Real where
|
||||
|
||||
open import Dedekind.Rational using (ℚ; _<_)
|
||||
|
||||
-- Dedekind cuts
|
||||
record ℝ : Set where
|
||||
constructor real
|
||||
field
|
||||
lower : (ℚ → Bool)
|
||||
closed : ∀ (x y : ℚ) → x < y
|
||||
|
||||
-- Operations on reals
|
||||
_+_ : ℝ → ℝ → ℝ
|
||||
a + b = real
|
||||
(λ q → ℝ.lower a q)
|
||||
|
||||
-- Properties of reals
|
6
src/Dedekind/Set.agda
Normal file
6
src/Dedekind/Set.agda
Normal file
|
@ -0,0 +1,6 @@
|
|||
module Dedekind.Set where
|
||||
|
||||
record ⊥ : Set where
|
||||
|
||||
record ⊤ : Set where
|
||||
instance constructor tt
|
14
src/main.agda
Normal file
14
src/main.agda
Normal file
|
@ -0,0 +1,14 @@
|
|||
{-# OPTIONS --guardedness #-}
|
||||
|
||||
module main where
|
||||
|
||||
open import Agda.Builtin.IO using (IO)
|
||||
open import Agda.Builtin.Unit using (⊤)
|
||||
open import Agda.Builtin.String using (String)
|
||||
|
||||
postulate putStrLn : String → IO ⊤
|
||||
{-# FOREIGN GHC import qualified Data.Text as T #-}
|
||||
{-# COMPILE GHC putStrLn = putStrLn . T.unpack #-}
|
||||
|
||||
main : IO ⊤
|
||||
main = putStrLn "Hello world!"
|
Loading…
Reference in a new issue