move helper agda files

This commit is contained in:
Leon Vatthauer 2024-02-15 21:52:47 +01:00
parent e4af840dc2
commit ed594af9a5
Signed by: leonv
SSH key fingerprint: SHA256:G4+ddwoZmhLPRB1agvXzZMXIzkVJ36dUYZXf5NxT+u8
2 changed files with 47 additions and 75 deletions

View file

@ -1,75 +0,0 @@
{-# OPTIONS --guardedness #-}
-- Take this example as motivation:
-- https://stackoverflow.com/questions/21808186/agda-reading-a-line-of-standard-input-as-a-string-instead-of-a-costring
open import Level
open import Agda.Builtin.Coinduction
module thesis.motivation where
module old-delay where
private
variable
a : Level
data _⊥ (A : Set a) : Set a where
now : A A
later : (A ) A
never : {A : Set a} A
never = later ( never)
module ReverseInput where
open import Data.Char
open import Data.Nat
open import Data.List using (List; []; _∷_)
open import Data.String
open import Data.Unit.Polymorphic
open import Codata.Musical.Costring
open import Codata.Musical.Colist using ([]; _∷_)
-- open import IO using (IO; seq; bind; return; Main; run; putStrLn)
open import IO.Primitive
open import IO.Primitive.Infinite using (getContents)
open import Agda.Builtin.IO using ()
open old-delay
-- IDEA: start in haskell, then motivate in agda and define delay type
-- next talk about bisimilarity.
-- idea for slide title: dlrowolleh.hs and dlrowolleh.agda
private
variable
a : Level
-- reverse : Costring → String ⊥
-- reverse = go []
-- where
-- go : List Char → Costring → String ⊥
-- go acc [] = now (fromList acc)
-- go acc (x ∷ xs) = later (♯ go (x ∷ acc) (♭ xs))
-- putStrLn⊥ : String ⊥ → IO {a}
-- putStrLn⊥ (now s) = putStrLn s
-- putStrLn⊥ (later s) = seq (♯ return tt) (♯ putStrLn⊥ (♭ s))
-- main : Main
-- main = run (bind (♯ {! getContents !}) {! !}) --(λ c → ♯ putStrLn⊥ (reverse c)))
-- NOTE: This is not very understandable... Better stick to the outdated syntax
module delay where
mutual
data _⊥ (A : Set) : Set where
now : A A
later : A ⊥' A
record _⊥' (A : Set) : Set where
coinductive
field
force : A
open _⊥'
mutual
never : {A : Set} A
never = later never'
never' : {A : Set} A ⊥'
force never' = never

47
thesis/agda/setoids.agda Normal file
View file

@ -0,0 +1,47 @@
module Foo where
open import Level
record _×_ {a b} (A : Set a) (B : Set b) : Set (a b) where
constructor _,_
field
fst : A
snd : B
open _×_
<_,_> : {a b c} {A : Set a} {B : Set b} {C : Set c}
(A B) (A C) A (B × C)
< f , g > x = (f x , g x)
record {l} : Set l where
constructor tt
! : {l} {X : Set l} X {l}
! _ = tt
data _+_ {a b} (A : Set a) (B : Set b) : Set (a b) where
i₁ : A A + B
i₂ : B A + B
[_,_] : {a b c} {A : Set a} {B : Set b} {C : Set c}
(A C) (B C) (A + B) C
[ f , g ] (i₁ x) = f x
[ f , g ] (i₂ x) = g x
data {l} : Set l where
¡ : {l} {X : Set l} {l} X
¡ ()
distributeˡ⁻¹ : {a b c} {A : Set a} {B : Set b} {C : Set c} (A × B) + (A × C) A × (B + C)
distributeˡ⁻¹ (i₁ (x , y)) = (x , i₁ y)
distributeˡ⁻¹ (i₂ (x , y)) = (x , i₂ y)
distributeˡ : {a b c} {A : Set a} {B : Set b} {C : Set c} A × (B + C) (A × B) + (A × C)
distributeˡ (x , i₁ y) = i₁ (x , y)
distributeˡ (x , i₂ y) = i₂ (x , y)
curry : {a b c} {A : Set a} {B : Set b} {C : Set c} (C × A B) C A B
curry f x y = f (x , y)
eval : {a b} {A : Set a} {B : Set b} ((A B) × A) B
eval (f , x) = f x