Skip to content

Instantly share code, notes, and snippets.

View bond15's full-sized avatar

bond15

View GitHub Profile
@bond15
bond15 / cont-cwf.agda
Created January 29, 2022 20:18 — forked from bobatkey/cont-cwf.agda
Construction of the Containers / Polynomials CwF in Agda, showing that function extensionality is refuted
{-# OPTIONS --rewriting #-}
module cont-cwf where
open import Agda.Builtin.Sigma
open import Agda.Builtin.Unit
open import Agda.Builtin.Bool
open import Agda.Builtin.Nat
open import Data.Empty
import Relation.Binary.PropositionalEquality as Eq
@bond15
bond15 / Presentation.agda
Last active February 17, 2022 16:42
Taste of cubical TT
module Presentation where
{-
Topics
Agda
Cubical Agda
Interval / Paths
Univalence
@bond15
bond15 / FinClosure.agda
Last active February 17, 2022 23:52
Fin Closure
module FinClosureEx where
open import Agda.Primitive
open import Data.Bool
open import Data.Fin
open import Data.List
open import Data.Nat
open import Data.Product
open import Function.Base
private
@bond15
bond15 / dumb.v
Last active March 12, 2022 01:28
CoqUIP
Require Import PeanoNat.
Require Import Coq.Logic.Eqdep_dec.
Import EqNotations.
Require Import Coq.Logic.JMeq.
Infix "==" := JMeq (at level 70, no associativity).
Print JMeq.
Print eq.
@bond15
bond15 / box.agda
Created March 10, 2022 16:05
modal
module modal where
open import Data.Unit
open import Data.Nat
open import Data.Product
open import Data.String
open import Data.Bool
open import Agda.Builtin.String
@bond15
bond15 / Program.v
Last active March 15, 2022 18:51
Coq Extended Pattern Match - Program Definition
Require Import Program.Tactics.
Lemma prf (n : nat)(p : n = 0) : bool.
Admitted.
Program Definition huh(n : nat) : bool :=
match n with
| O => prf n _. (* Program adds the equation `n = 0` to the context of this match branch which is pickec up by the implicit *)
| S n => true
end.
@bond15
bond15 / funext.md
Last active May 20, 2022 18:01
Deriving function extensionality in Cubical Agda.

Function extensionality is not derivable in Agda or Coq. It can be postulated as an axiom that is consistent with the theory, but you cannot construct a term for the type representing function extensionality.

In Cubical Agda it is derivable and it has a tauntingly concise definition. (removing Level for a moment since that is tangental)

funext : {A B : Set}{f g : A → B} → (∀ (a : A) → f a ≡ g a) → f ≡ g
funext p i a = p a i

That said, there is a fair amount to unpack to understand what is going on here.

Cubical Agda adds an abstract Interval Type I which has two endpoints i0 and i1. (see footnote [1])

@bond15
bond15 / stuck.md
Created May 21, 2022 23:24
Question
    open import Data.Bool
    open import Data.Unit 
    open import Data.Empty
    open import Cubical.Core.Everything 

    ty : Bool → Set 
    ty false = ⊥
    ty true  = ⊤
@bond15
bond15 / cursed.agda
Last active March 14, 2025 14:32
FFIs should compose ;)
{-# OPTIONS --guardedness --type-in-type #-}
module cursed where
open import Agda.Builtin.String
open import IO
postulate
ex' : String
{-# FOREIGN GHC
{-# LANGUAGE ForeignFunctionInterface #-}
import Data.Text
record LDepDialSet {ℓ : Level}{L : Set ℓ} : Set (lsuc ℓ) where
field
pos : Set ℓ
dir : pos → Set ℓ
α : (p : pos) → dir p → L
open import Lineale
record LDepDialSetMap {ℓ}{L} (A B : LDepDialSet{ℓ}{L})
{{pl : Proset L}}
{{_ : MonProset L}}