Skip to content

Instantly share code, notes, and snippets.

View Iainmon's full-sized avatar
🥶

Iain Moncrief Iainmon

🥶
View GitHub Profile
import Init.Data.ToString.Basic
namespace TreePatterns
variable {γ : Type} [BEq γ] [ToString γ]
abbrev Name := String
import Init.Data.ToString.Basic
namespace TreePatterns
variable {γ : Type} [BEq γ] [ToString γ]
#check 1
abbrev Name := String
@Iainmon
Iainmon / c_cfg.py
Last active May 19, 2026 09:52
python ccfg2.py && dot -Tpng cfg2.dot -o cfg2.png; https://github.com/Iainmon/CS-261
from pycparser import c_parser, c_generator
# -----------------------------
# CFG data structures
# -----------------------------
class BasicBlock:
def __init__(self, block_id):
self.id = block_id
self.stmts = []
import Init.Core
import Init.Prelude
import Mathlib.Algebra.Group.Defs
import Mathlib.Tactic
namespace Q10
class Req (α : Type) extends Semigroup α where
eᵣ : α
Section S.
Context {A B : Set}.
Context (rel : A -> B -> Prop).
Definition determinism : Type
:= forall (a : A) (b1 b2 : B), rel a b1 -> rel a b2 -> b1 = b2.
module Prim
import Data.Vect
import Data.Fin
-- import Data.Nat
-- import Data.List
-- %hide Prelude.cong
Require Import Coq.Init.Nat.
Inductive bit : Set := I | O.
Inductive bits : nat -> Set :=
| bnil : bits 0
| bcons : forall (n : nat), bit -> bits n -> bits (S n).
Arguments bcons [n] _ _.
@Iainmon
Iainmon / daniel3.v
Last active October 22, 2024 19:16
Require Import Unicode.Utf8.
Require Import Psatz.
Require Import Coq.Arith.Arith.
Require Import Coq.Init.Nat. (* needed? it seems no, with next line. *)
Import Nat.
Open Scope nat_scope.
Ltac save h1 h2 :=
(*pose proof h1 as h2*)
let t := type of h1 in
assert (h2 : t) by (exact h1).
Tactic Notation "save" constr(h1) "as" ident(h2) :=
save h1 h2.
(* Ltac replace_equivalent a b p :=
@Iainmon
Iainmon / daniel.v
Last active September 24, 2024 18:55
Lemma my_eq_sym: forall a b : Set, a = b -> b = a.
Proof.
intros a b.
intros H.
rewrite -> H || rewrite <- H.
reflexivity.
Qed.
Ltac inv H := inversion H; clear H; try subst.