Skip to content

Instantly share code, notes, and snippets.

View ice1000's full-sized avatar
♾️
Generalizing something

Tesla Zhang‮ ice1000

♾️
Generalizing something
View GitHub Profile
@ice1000
ice1000 / ZzsSolver.java
Last active October 1, 2021 03:37
ZZS tql
package org;
// Copyright (c) 2020-2021 Yinsen (Tesla) Zhang.
// Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file.
import java.util.*;
import java.util.stream.Collectors;
/**
* @author danihao123
\newcommand{\lrbracket}[1]{\llbracket #1 \rrbracket}
\newcommand{\Tm}[2]{\text{Tm}(#1, #2)}
\newcommand{\FF}{\mathcal F}
\newcommand{\CC}{\mathcal C}
\newcommand{\EE}{\mathcal E}
\newcommand{\lrangle}[1]{\langle#1\rangle}
\newcommand{\Prop}{\text{Prop}}
\newcommand{\El}[1]{\text{El}(#1)}
\newcommand{\eqlzSimp}{\mathrm{eq}}
\newcommand{\eqlz}[2]{\eqlzSimp(#1,#2)}
@ice1000
ice1000 / ProblemEquation.java
Created May 8, 2021 10:05
Random graph theory problem
import java.util.List;
import java.util.Map;
public class Main {
interface Level {
// Pattern matcher
interface Visitor<P, R> {
R visitConst(Const c, P p);
R visitInfinity(P p);
R visitRef(Reference r, P p);
}
@ice1000
ice1000 / MultiplyCircle.agda
Created April 19, 2021 05:06
Credit to Lambda Duck, I'm just posting it here for sharing convenience
{-# OPTIONS --cubical #-}
open import Cubical.Core.Everything
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Function
open import Cubical.HITs.S1
SInt : Type₀
SInt = base ≡ base
@ice1000
ice1000 / MHLLeanTIZAgdaCompetition.agda
Created February 5, 2021 16:46
Implementing a lean example in Agda
{- Lean 4
open list
#eval filter (= 4) [1, 2, 4]
-}
open import Data.Nat renaming (ℕ to Nat; _≟_ to decEqNat)
open import Data.List using (List; []; _∷_)
open import Data.Bool using (true; false)
open import Relation.Nullary
open import Relation.Binary.PropositionalEquality
@ice1000
ice1000 / EgbertPropTrunc.agda
Created January 15, 2021 15:59
Solution to some propositional truncation problems :)
-- twitter thread: https://twitter.com/EgbertRijke/status/1349865209591173120
{-# OPTIONS --cubical #-}
open import Cubical.HITs.PropositionalTruncation using (∥_∥; ∣_∣; squash; rec)
open import Cubical.Relation.Nullary
open import Cubical.Foundations.Function using (_∘_; idfun)
open import Cubical.Data.Sigma using (_×_; fst; snd)
import Cubical.Data.Empty as ⊥ using (elim)
@ice1000
ice1000 / arend-ascii-big-text.md
Created April 28, 2020 20:51
A collection of ASCII art for "Arend"

A collection of ASCII art for "Arend"

... that doesn't look crazy to me.

Speed

_______                   _________
___    |________________________  /
__ /| |_ ___/ _ \_ __ \ __ / 
@ice1000
ice1000 / repl-goal.md
Last active May 6, 2020 01:14
Comparison among several REPLs with goal support
@ice1000
ice1000 / Bools.ard
Created April 24, 2020 20:04
Transport over Bool.not
\data Bool1 | tt1 | ff1 \where {
\func to2 (b : Bool1) : Bool2
| tt1 => Bool2.tt2
| ff1 => Bool2.ff2
\lemma lemma (b : Bool1) : Bool2.to1 (to2 b) = b
| tt1 => idp
| ff1 => idp
}
\data Bool2 | tt2 | ff2 \where {
\func to1 (b : Bool2) : Bool1
{-# LANGUAGE LambdaCase #-}
data Term
= TmVar Integer
| TmAbs String Term
| TmApp Term Term
deriving (Show, Eq)
termShift :: Integer -> Term -> Term
termShift d = walk 0