Skip to content

Instantly share code, notes, and snippets.

@roconnor
roconnor / NbE.v
Created May 19, 2024 20:56
Normalization by Evaluation of Simply Typed Lambda Calculus including Sum and Empty Types.
(* This Normalization by Evaluation is based on mietek's <https://research.mietek.io/A201801.FullIPLNormalisation.html>.
I've removed the continuations to give a purely tree-based implementation.
This is operationally less efficent than using continuations, but it is hopefully easier to understand and potentially easier to verify correct.
Checked with Coq 8.18.0
*)
Inductive Form :=
| Zero : Form
| One : Form
@TOTBWF
TOTBWF / CartesianNbE.agda
Last active February 5, 2022 23:24
NbE for Cartesian Categories
{-# OPTIONS --without-K --safe #-}
open import Categories.Category.Core
open import Categories.Category.Cartesian
module Categories.Tactic.Cartesian.Solver {o ℓ e} {𝒞 : Category o ℓ e} (cartesian : Cartesian 𝒞) where
open import Level
open import Categories.Category.BinaryProducts
@andrejbauer
andrejbauer / Epimorphism.agda
Last active January 26, 2023 20:44
A setoid satisfies choice if, and only if its equivalence relation is equality.
open import Level
open import Relation.Binary
open import Data.Product
open import Data.Unit
open import Agda.Builtin.Sigma
open import Relation.Binary.PropositionalEquality renaming (refl to ≡-refl; trans to ≡-trans; sym to ≡-sym; cong to ≡-cong)
open import Relation.Binary.PropositionalEquality.Properties
open import Function.Equality hiding (setoid)
module Epimorphism where
@wenkokke
wenkokke / README.md
Last active March 2, 2024 10:32
A list of tactics for Agda…

Tactics in Agda

This gist is my attempt to list all projects providing proof automation for Agda.

Glossary

When I say tactic, I mean something that uses Agda's reflection to provide a smooth user experience, such as the solveZ3 tactic from Schmitty:

_ :  (x y : ℤ)  x ≤ y  y ≤ x  x ≡ y
_ = solveZ3
@andrejbauer
andrejbauer / Primrec.agda
Created July 6, 2021 10:21
Primitive recursive functions in Agda
open import Data.Nat
open import Data.Fin as Fin
module Primrec where
-- The datatype of primitive recursive function
data PR : ∀ (k : ℕ) → Set where
pr-zero : PR 0 -- zero
pr-succ : PR 1 -- successor
pr-proj : ∀ {k} (i : Fin k) → PR k -- projection
@AndrasKovacs
AndrasKovacs / NbECaseCommute.hs
Created April 16, 2021 08:01
NbE with case commutation for sum types
{-# language Strict, BangPatterns, LambdaCase, ViewPatterns, OverloadedStrings #-}
{-# options_ghc -Wincomplete-patterns #-}
-- NbE with case commutation for sum types.
import Data.Maybe
import Data.String
type Name = String
@bobatkey
bobatkey / cont-cwf.agda
Last active June 16, 2023 21:23
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
@AndrasKovacs
AndrasKovacs / CumulativeIRUniv.agda
Last active October 6, 2020 12:09
Transfinite, cumulative, Russell-style, inductive-recursive universes in Agda.
{-
Inductive-recursive universes, indexed by levels which are below an arbitrary type-theoretic ordinal number (see HoTT book 10.3). This includes all kinds of transfinite levels as well.
Checked with: Agda 2.6.1, stdlib 1.3
My original motivation was to give inductive-recursive (or equivalently: large inductive)
semantics to to Jon Sterling's cumulative algebraic TT paper:
@Blaisorblade
Blaisorblade / InconsistentImpredicativeSums.agda
Last active March 16, 2019 18:04
Why a type X cannot contain a predicate on X — via Russell's paradox
{-# OPTIONS --type-in-type --no-positivity-check #-}
module InconsistentImpredicativeSums where
open import Relation.Binary.PropositionalEquality
open import Relation.Nullary
open import Relation.Nullary.Negation
open import Data.Product
open import Data.Empty
-- hiding (⊥-elim)
-- open import Data.Empty.Irrelevant
@jespercockx
jespercockx / Fixpoints.agda
Created December 26, 2018 09:28
Small example of how to define least/greatest fixpoints in Agda
{-# OPTIONS --guardedness #-}
open import Agda.Builtin.Unit
open import Agda.Builtin.Size
record _×_ (A B : Set) : Set where
constructor _,_
field
fst : A
snd : B