Skip to content

Instantly share code, notes, and snippets.

View bond15's full-sized avatar

bond15

View GitHub Profile
@bond15
bond15 / python.agda
Last active August 27, 2021 23:55
Not Python
data Python : Set where
def_⦅_⦆⦂_ : {A B : Set} → A → B → Python → Python
for_in̂_⦂_ : {A B : Set} → A → B → Python → Python
if_⦂_ : Python → Python → Python
if_⦂_else⦂_ : Python → Python → Python → Python
_≕_ : {A B : Set} → A → B → Python
return_ : {A : Set} → A → Python
foo : {A B C D E : Set} → A → B → C → D → E → Python
foo a b c d e = def a ⦅ b ⦆⦂
@bond15
bond15 / CTTeq.agda
Last active October 16, 2021 01:28
Cubical Type Theory - transport Bool proof
{-# OPTIONS --cubical #-}
module CTTeq where
open import Cubical.Core.Everything
data Bool : Set where
tt ff : Bool
data FooBar : Set where
Foo Bar : FooBar
@bond15
bond15 / WTypes.agda
Created November 8, 2021 01:48
W-Types
{-# OPTIONS --type-in-type #-}
module WTypes where
data Nada : Set where
data Unit : Set where
unit : Unit
data Pos₂ : Set where
P₁ P₂ : Pos₂
@bond15
bond15 / Ex.agda
Created November 15, 2021 22:03
Nand to Not
module Ex where
data Unit : Set where
unit : Unit
data Bool : Set where
tt ff : Bool
nand : Bool → Bool → Bool
nand tt tt = ff
nand _ _ = tt
@bond15
bond15 / SIPmonoid.agda
Last active November 22, 2021 01:09
Structure Identity Principal - Boolean Monoids
module SIPmonoid where
-- Uses Agdas reflection mechanism and generic programming
-- to automatically generate definitions of..
-- structured equivalences
-- proofs that they are univalent
-- See https://github.com/agda/cubical/blob/master/Cubical/Papers/RepresentationIndependence.agda
-- and Internalizing Representation Independence with Univalence
-- for details
@bond15
bond15 / EckmannHiltonWithK.agda
Created December 4, 2021 19:22
Eckmann Hilton With K
{-# OPTIONS --with-K #-}
module EckmannHiltonWithK where
open import Agda.Primitive
data _≡_ {ℓ : Level} {A : Set ℓ} : A → A → Set ℓ where
refl : {a : A } → a ≡ a
Ω : (A : Set₀) (a : A) → Set₀
Ω A a = a ≡ a
@bond15
bond15 / proofalg.agda
Last active December 30, 2021 14:21
Proof Algebra example
module proofalg where
import Relation.Binary.PropositionalEquality as Eq
open Eq using (_≡_; refl; cong)
open import Data.Product using (Σ ; Σ-syntax ; _,_ ; proj₁ ; proj₂)
postulate Extensionality : {A : Set} {B : A → Set} {f g : (x : A) → B x} → (∀ x → f x ≡ g x) → f ≡ g
_∘_ : {X Y Z : Set} → (f : Y → Z) → (g : X → Y) → X → Z
f ∘ g = λ x → f(g x)
@bond15
bond15 / List.Agda
Last active January 11, 2022 22:26
List as Funtor
{-# OPTIONS --type-in-type #-}
{-# OPTIONS --no-import-sorts #-}
module Foo where
open import Agda.Primitive renaming (Set to Type)
import Relation.Binary.PropositionalEquality as Eq
open Eq using (_≡_; refl; cong; cong₂)
open import Data.Product using (_×_; _,_) renaming (proj₁ to π₁; proj₂ to π₂)
postulate Extensionality : {A : Type} {B : A → Type} {f g : (x : A) → B x} → (∀ x → f x ≡ g x) → f ≡ g
@bond15
bond15 / WITS22.agda
Created January 22, 2022 16:41
WITS22 tutorial copied
open import Data.Bool.Base
open import Data.List.Base
open import Data.Nat.Base
open import Data.Product
open import Data.Unit
open import Function
open import Reflection
@bond15
bond15 / tutorial.agda
Last active January 26, 2022 23:43
PolyWiringDiagrams
{-# OPTIONS --guardedness #-}
module tutorial where
open import Poly
open import Data.Product
open import Dynamics
open Systems
postulate A B C D S T : Set