Skip to content

Instantly share code, notes, and snippets.

View kontheocharis's full-sized avatar
〰️
[Object object]

Constantine Theocharis kontheocharis

〰️
[Object object]
  • University of St Andrews
  • UK
  • 06:19 (UTC)
View GitHub Profile
@kontheocharis
kontheocharis / Para.idr
Created November 2, 2025 14:36
Algebras and paramorphisms for a simple class of signatures in Idris2
import Data.Fin
import Data.Vect
import Data.Vect.Quantifiers
-- No telescopes, no indexing (parameters still possible), no displayed
-- algebras, just paramorphisms.
-- This is the type of descriptions/signatures for constructor data.
-- Each operation (constructor) is a sequence of arguments, either data or
-- recursive calls.
@kontheocharis
kontheocharis / Russell.idr
Last active October 29, 2025 16:32
Russell's paradox in Idris2
%default total
-- A set is an index type, and a set for each index, inductively.
record Set where
constructor MkSet
i : Type
f : i -> Set
-- Set `a` is contained in set `b` if there is an index in `b` at which we find
-- a set equal to `a`
@kontheocharis
kontheocharis / PropTrunc.idr
Created July 24, 2025 12:47
Propositional truncation in Idris2
import Data.DPair
import Decidable.Equality
interface IsProp a where
prop : (0 x : a) -> (0 y : a) -> x = y
0 IsPropD : {a : Type} -> (p : a -> Type) -> Type
IsPropD {a} p = (0 m : a) -> IsProp (p m)
-- POSTULATES
@kontheocharis
kontheocharis / QTTinTT.agda
Last active July 13, 2025 11:10
Dependent type theory with irrelevant binders, in the style of QTT
-- Definition of a CWF with irrelevant binders in Agda, in the style of QTT.
----------------------------------------------------------------------------
-- The CWF formulation of quantitative type theory (Atkey 2018) is basically a
-- base CWF B, a resourced CWF-like thing E, and a functor U : E → B that
-- preserves everything.
--
-- It is really annoying to define this directly as two syntaxes and a functor
-- between them. Instead, we can define a base CWF B, and a displayed CWF E over B.
-- We can recover the usual functorial formulation by taking the total space of E.
@kontheocharis
kontheocharis / FakeSOGAT.agda
Last active June 11, 2025 19:26
Dependent type theory in Agda without explicit contexts
module FakeSOGAT where
open import Relation.Binary.PropositionalEquality
infixr 3 _⇒_
_⇒_ : ∀ {I : Set} → (A : I → Set) → (I → Set) → (I → Set)
(A ⇒ B) j = A j → B j
∀[_] : ∀ {I : Set} → (I → Set) → Set
∀[_] {I} P = {Γ : I} → P Γ
@kontheocharis
kontheocharis / DecidableSTLC.agda
Last active March 17, 2025 22:17
Deciding the explicit substitution calculus in Agda
{-# OPTIONS --rewriting --prop --backtracking-instance-search #-}
open import Agda.Primitive
open import Agda.Builtin.Equality
open import Agda.Builtin.String
-- Problem:
--
-- HOAS (i.e. shallow embedding) is nice to work with because we can re-use the
-- host's functions. However, it does not allow us to inspect the contextual
[colors]
background = #00000000
foreground = #88ffffff
highlight = #33ffffff
error = ${xrdb:color1:#ff7070}
[barsetup]
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 2
@kontheocharis
kontheocharis / newpp
Last active October 14, 2018 13:08
Creates a new pandoc project based on preset (https://github.com/kontheocharis/pandoc-presets)
#!/bin/bash
# Usage: newpp [NAME OF PRESET] [NAME OF NEW PROJECT]
PRESET_DIR=$HOME/.pandoc-presets
mkdir "$2"
cp -rT $PRESET_DIR/"$1" "$2"