Skip to content

Instantly share code, notes, and snippets.

@ntabee
ntabee / 3-7.classical.lean
Created January 23, 2020 02:12
Lean: excercises, official doc 3.7, classical logic
-- https://leanprover.github.io/theorem_proving_in_lean/propositions_and_proofs.html#exercises
open classical
variables p q r s : Prop
example : (p → r ∨ s) → ((p → r) ∨ (p → s)) :=
assume (h: p -> r ∨ s),
by_cases (
assume hp: p,
have hrs: r ∨ s, from h hp,
@ntabee
ntabee / 3-7.lean
Last active January 23, 2020 02:19
Lean: excercises, official doc 3.7
-- https://leanprover.github.io/theorem_proving_in_lean/propositions_and_proofs.html#exercises
variables p q r : Prop
-- commutativity of ∧ and ∨
example : p ∧ q ↔ q ∧ p :=
⟨ assume h: p ∧ q, ⟨h.right, h.left⟩, assume h: q ∧ p, ⟨h.right, h.left⟩ ⟩
example : p ∨ q ↔ q ∨ p :=
@ntabee
ntabee / code
Last active September 7, 2017 09:56
VSCode invoker for Bash on Ubuntu on Windows
#/bin/sh
# 1. Place wslpath (https://gist.github.com/ntabee/d7af5686dc4a99fda5a77b4ef081b102) in /usr/local/bin (or anywhere path-aware)
# 2. Place this script in "C:\Program Files\Microsoft VS Code Insiders\bin"
# 3. chmod a+x both scripts.
set +x
SCRIPTDIR=`dirname "$0"`
SCRIPTDIR=`wslpath -w -r "${SCRIPTDIR}"`
EXE="${SCRIPTDIR}\\..\\Code - Insiders.exe"
@ntabee
ntabee / wslpath
Last active September 7, 2017 09:37
A modified version of https://github.com/darealshinji/scripts/blob/master/wslpath: Replace `cmd.exe` with `powershell.exe` in `win_env()`
#!/bin/bash
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
#include <array>
#include <iostream>
#include "tempra.hpp"
template<unsigned n, typename R>
struct print_randoms {
static void print() {
typedef typename Next<R>::type RND;
std::cout << RND::value << std::endl;
print_randoms<n-1, RND>::print();