Skip to content

Instantly share code, notes, and snippets.

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define pi 3.141592653589793
#define solar_mass (4 * pi * pi)
#define days_per_year 365.24
struct planet {
double x, y, z;
open import Relation.Binary.PropositionalEquality
open import Data.Product
open import Data.Bool
open import Relation.Nullary.Negation
open import Data.Sum
open import Data.Empty
postulate LEM : ∀ {ℓ} (A : Set ℓ) → A ⊎ (¬ A)
postulate funext : ∀ {ℓ} {A B : Set ℓ} {f g : A → B} → (∀ x → f x ≡ g x) → f ≡ g

V2:

theory Isabelle_little_compiler
  imports Main
begin

datatype lang = 
  Lit nat
  | Plus lang lang
@jake-87
jake-87 / AlgoJ.hs
Last active September 3, 2025 16:41
{-# LANGUAGE StrictData, OverloadedStrings #-}
{-# OPTIONS_GHC -Wall #-}
{-# OPTIONS_GHC -Wno-unused-matches -Wno-unused-top-binds #-}
{-# OPTIONS_GHC -Wno-unused-imports -Wno-name-shadowing #-}
{-# LANGUAGE PartialTypeSignatures #-}
import Data.STRef
import Control.Monad.ST
import Text.Show.Functions
import Control.Monad.Except
import Control.Monad.Trans.Class
let rand =
let x = ref 10 in
fun () ->
x := (!x * 27527 + 27791) mod 41231;
!x
type tree =
| Leaf
| Branch of int * tree * tree
open import Relation.Binary.PropositionalEquality
open import Data.Nat
open import Data.Nat.Properties
open import Data.Maybe
open import Data.Fin
open import Relation.Nullary.Decidable
open import Data.Product
data Con : ℕ → Set
data Tm : ℕ → Set
width = 20
height = 20
score = 0
import os
import sys
import tty
import termios
@jake-87
jake-87 / systemf.md
Last active February 27, 2024 03:09

A somewhat brief overview of typechecking System F

This document comprises an example of typechecking a type system based on System F, in a small ML-like language.

You can skip the below section if you already understand System F itself.

A brief overview of System F

System F is the name given to an extension of the simply typed lambda calclus.

@jake-87
jake-87 / SPL
Last active June 17, 2021 04:18
3 Clause BSD Based Licence
Copyright <YEAR> <COPYRIGHT HOLDER>
Redistribution and use in source and binary forms, with or without modification, are permitted provided that
the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
2. Redistributions in binary form are permitted only under the following conditions: