Skip to content

Instantly share code, notes, and snippets.

View LittleJianCH's full-sized avatar
:octocat:
Working

LittleJianCH

:octocat:
Working
View GitHub Profile
@LittleJianCH
LittleJianCH / nat.rkt
Last active September 27, 2022 00:47
nat in miniKanren
#lang racket
(require "Racket-miniKanren/minikanren/mk.rkt")
(defrel (conso a d p)
(== (cons a d) p))
(defrel (caro p a)
(fresh (d)
(conso a d p)))
@LittleJianCH
LittleJianCH / proof.v
Created September 11, 2022 16:27
A proof of n^2 ≤ 2^n when 4 ≤ n
Require Import Coq.Arith.PeanoNat.
Require Import Lia.
Theorem lemma1 : forall (n : nat),
4 <= n ->
2 * n + 1 <= 2 ^ n.
Proof.
intros n Hle.
induction Hle.
- simpl. lia.
@LittleJianCH
LittleJianCH / drop-last.rkt
Created August 20, 2022 06:41
the Implementation of drop-last in pie by using ind-vac
#lang pie
(define destruct-Nat-with-eq
(λ (n motive motive0 motiveM)
((ind-Nat n
(λ (k) (→ (= Nat k n) (motive k)))
(λ (_) motive0)
(λ (n-1 useless eq)
(motiveM n-1 eq)))
(same n))))