Skip to content

Instantly share code, notes, and snippets.

View 5HT's full-sized avatar
🌐
I'm very skeptical that person without empathy can create beautiful mathematics.

Namdak Tonpa 5HT

🌐
I'm very skeptical that person without empathy can create beautiful mathematics.
View GitHub Profile
@rzrn
rzrn / Experiments.agda
Created July 5, 2021 10:05
Experiments with cubical subtypes in Agda
{-# OPTIONS --cubical #-}
module Experiments where
open import Agda.Builtin.Cubical.Path public
open import Agda.Builtin.Cubical.Sub public renaming (primSubOut to ouc)
open import Agda.Primitive.Cubical public
renaming ( primIMin to _∧_ -- I → I → I
; primIMax to _∨_ -- I → I → I
; primINeg to -_ -- I → I
; isOneEmpty to empty
@rzrn
rzrn / nbe.ml
Last active November 27, 2021 15:33
Hyperprover in 150 LOC
type expr =
| EVar of string
| EApp of expr * expr
| EPi of string * expr * expr
| ESig of string * expr * expr
| ELam of string * expr * expr
| EPair of expr * expr
| EFst of expr
| ESnd of expr
| ESet of int
@bencbartlett
bencbartlett / hydrogen_orbitals.nb
Last active November 27, 2021 03:10
Mathematica code for this animation of transitions in hydrogen wavefunctions: https://twitter.com/bencbartlett/status/1287802625602117632
<< MaTeX`
SetOptions[MaTeX, "Preamble" -> {"\\usepackage{color,txfonts}"}];
SetDirectory[NotebookDirectory[]];
Clear[drawLadder];
drawLadder[n_, l_, m_, imsize_: 500] := Module[{maxrungs = 5, mag = 4},
Graphics[{
White, Opacity[1], Thickness[.02], Dashing[None],
Table[Line[{{0, k}, {1, k}}], {k, maxrungs}], (*draw n lines*)
@johnchandlerburnham
johnchandlerburnham / Path.fm
Created May 28, 2020 22:27
Path involution, connection
I: Type
i<P: (i:I) -> Type> ->
(I0: P(I.0)) ->
(I1: P(I.1)) ->
(IE: Path(P, I0, I1)) ->
P(i)
I.0: I
<P> (i0) (i1) (ie) i0
@akhtarraza
akhtarraza / RSAEncryptor.swift
Created August 21, 2019 10:57
RSA Key-Pair generator with Encryption/Decryption support
//Reference: https://stackoverflow.com/questions/53906275/rsa-public-key-created-in-ios-swift-and-exported-as-base64-not-recognized-in-jav
import SwiftyRSA
class RSAKeyEncoding: NSObject {
// ASN.1 identifiers
private let kASNBitStringIdentifier: UInt8 = 0x03
private let kASNSequenceIdentifier: UInt8 = 0x30
@Gabriella439
Gabriella439 / ackermann.dhall
Last active April 26, 2020 00:00
Ackermann function in Dhall
-- Credit to: https://news.ycombinator.com/item?id=15186988
let iterate
: (Natural → Natural) → Natural → Natural
= λ(f : Natural → Natural)
→ λ(n : Natural)
→ Natural/fold (n + 1) Natural f 1
let increment : Natural → Natural = λ(n : Natural) → n + 1
@hfossli
hfossli / ASN1.swift
Created November 9, 2018 13:37
ASN1 DER encoder and decoder in swift
//
// ASN1.swift
// ASN1
//
// Created by Håvard Fossli on 29.08.2018.
// Copyright © 2018 Håvard Fossli. All rights reserved.
//
import Foundation
@AndyShiue
AndyShiue / CuTT.md
Last active July 4, 2025 05:39
Cubical type theory for dummies

I think I’ve figured out most parts of the cubical type theory papers; I’m going to take a shot to explain it informally in the format of Q&As. I prefer using syntax or terminologies that fit better rather than the more standard ones.

Q: What is cubical type theory?

A: It’s a type theory giving homotopy type theory its computational meaning.

Q: What is homotopy type theory then?

A: It’s traditional type theory (which refers to Martin-Löf type theory in this Q&A) augmented with higher inductive types and the univalence axiom.

module mltt where
open import Data.Nat
import Data.Fin as F
open import Data.Sum
open import Data.Product
open import Relation.Nullary
open import Relation.Binary.PropositionalEquality
data Tm : ℕ → Set where
var : ∀ {n} → F.Fin n → Tm n