Skip to content

Instantly share code, notes, and snippets.

View bond15's full-sized avatar

bond15

View GitHub Profile
@bond15
bond15 / sandbox.agda
Last active September 6, 2024 20:20
Agda Typeclasses
module src.sandbox where
open import Cubical.Data.Sigma
open import Cubical.Data.Bool
record Monad (F : Set → Set) : Set₁ where
field
return : ∀ {A} → A → F A
_>>=_ : ∀{A B} → F A → (A → F B) → F B
_>>_ : ∀{A B} → F A → F B → F B
@bond15
bond15 / lfpt.agda
Created March 14, 2024 19:27
Lawvere Fixpoint Theorem
{-# OPTIONS --cubical #-}
module lfpt where
open import Cubical.Data.Unit renaming (Unit to ⊤)
open import Cubical.Data.Sigma
open import Cubical.Foundations.Prelude
_∘_ : {A B C : Set₀} → (B → C) → (A → B) → A → C
g ∘ f = λ a → g (f a)
@bond15
bond15 / NAE.thy
Last active October 13, 2023 01:57
NAE
theory hw
imports Main
begin
datatype variable = A | B | C | D | Z
(* a literal is a variable or its negation*)
datatype literal = Not variable | Id variable
(* given an assignment of variables to truth values, we can evaluate a literal to a truth value*)
#define DEBUG
#ifdef DEBUG
# define PRINT(x) errs() << x;
#else
# define PRINT(x) {};
#endif
@bond15
bond15 / Error.gr
Created November 17, 2022 23:30
Pattern Error
import List
import Maybe
data Parser (a : Type) = Parser (String → List (a , String))
parse : ∀ {a : Type}. Parser a → String → List (a , String)
parse (Parser p) = p
result : ∀{a : Type}. a → Parser a
result a = Parser (λs → Next (a,s) Empty)
@bond15
bond15 / Linearity.md
Last active November 17, 2022 23:32
Linearity

In Granule (the base calculus is linear) these two tests violate linearity:

data Foo a = Bar a

test1 : Foo Int -> (Int , Int)
test1 (Bar mustUseOnce) = (mustUseOnce, mustUseOnce)

test2 : Foo Int -> Int
test2 (Bar mustUseOnce) = 42
@bond15
bond15 / crappymod.v
Created October 19, 2022 15:33
Coq module crap
Module Type AT.
Parameter x : nat.
End AT.
Module A (Import a : AT).
Include a.
Definition y := a.x.
End A.
Print A.
@bond15
bond15 / hit.agda
Created September 2, 2022 04:40
S1
data S₁ : Set where
base : S₁
loop : base ≡ base
_ : S₁
_ = base
_ : S₁
_ = loop i0
@bond15
bond15 / Ihom.agda
Last active August 5, 2022 16:46
DepDial internal hom
record Poly : Set₁ where
constructor _◂_◂_
field
pos : Set
dir : pos → Set
α : (p : pos)(d : dir p) → Set
open import Data.Product
_⇒_ : Poly → Poly → Poly
module Multiverse where
module types where
open import Data.Nat
open import Data.String
open import Data.Bool
open import Data.Product
data Type₁ : Set where