Skip to content

Instantly share code, notes, and snippets.

View utensil's full-sized avatar

Utensil utensil

  • 20:29 (UTC +08:00)
View GitHub Profile
@pedrominicz
pedrominicz / quotient_group_cardinality.lean
Last active July 24, 2020 18:22
Let G be an infinite group and let H be a subgroup s.t. |H| < |G|. Then |G/H| = |G|.
import group_theory.quotient_group
import set_theory.ordinal
-- https://math.stackexchange.com/a/370073/783124
namespace cardinal
open quotient_group
variables {α : Type*} [group α] {s : set α} [is_subgroup s]
import linear_algebra.basic
linear_algebra.direct_sum_module
linear_algebra.basis
linear_algebra.finsupp_vector_space
ring_theory.noetherian
data.finsupp
tactic
open_locale classical
@fpvandoorn
fpvandoorn / typeclass_stats.lean
Last active December 3, 2020 02:33
prints stats about typeclasses and instances
import tactic -- all
open tactic declaration environment native
meta def pos_line (p : option pos) : string :=
match p with
| some x := to_string x.line
| _ := ""
end
@geo2a
geo2a / EquationalReasoningTacticNotation.v
Created January 4, 2020 18:42
Equational Reasoning in Coq using Tactic Notations
Tactic Notation
"`Begin " constr(lhs) := idtac.
Tactic Notation
"≡⟨ " tactic(proof) "⟩" constr(lhs) :=
(stepl lhs by proof).
Tactic Notation
"≡⟨ " tactic(proof) "⟩" constr(lhs) "`End" :=
(now stepl lhs by proof).
@hashbrowncipher
hashbrowncipher / coredump_uploader.sh
Created November 11, 2019 03:38
Example coredump uploader
#!/bin/bash
# Depends on zstd (>1.3.6) and aws-cli
set -o errexit
set -o nounset
set -o pipefail
# Set kernel.core_pattern = | coredump_uploader.sh %P %s %E
PID=$1
shift
SIGNAL=$1
@kbuzzard
kbuzzard / quotient_group.lean
Created July 11, 2019 14:12
quotient_group documented
/-
Copyright (c) 2018 Kevin Buzzard and Patrick Massot. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Buzzard, Patrick Massot.
This file is to a certain extent based on `quotient_module.lean` by Johannes Hölzl.
Quotient groups
===============
@edmundsmith
edmundsmith / writeup.md
Created July 7, 2019 20:47
Method for Emulating Higher-Kinded Types in Rust

Method for Emulating Higher-Kinded Types in Rust

Intro

I've been fiddling about with an idea lately, looking at how higher-kinded types can be represented in such a way that we can reason with them in Rust here and now, without having to wait a couple years for what would be a significant change to the language and compiler.

There have been multiple discussions on introducing higher-ranked polymorphism into Rust, using Haskell-style Higher-Kinded Types (HKTs) or Scala-looking Generalised Associated Types (GATs). The benefit of higher-ranked polymorphism is to allow higher-level, richer abstractions and pattern expression than just the rank-1 polymorphism we have today.

As an example, currently we can express this type:

@kbuzzard
kbuzzard / cdga.lean
Last active May 13, 2020 12:26
Reid's challenge about commutative differential graded algebras
import algebra.group
import linear_algebra.tensor_product
import tactic.ring
universe u
section canonical
variables {R : Type u} [comm_ring R] {m n : ℕ} (h : m = n)
{A : ℕ → Type u} [∀ n, add_comm_group (A n)] [∀ n, module R (A n)]
@HadrienG2
HadrienG2 / High_Performance_Rust.md
Last active April 22, 2025 18:53
Making Rust a perfect fit for high-performance computations

Hello, Rust community!

My name is Hadrien and I am a software performance engineer in a particle physics lab. My daily job is to figure out ways to make scientific software use hardware more efficiently without sacrificing its correctness, primarily by adapting old-ish codebases to the changes that occured in the software and computing landscape since the days where they were designed:

  • CPU clock rates and instruction-level parallelism stopped going up, so optimizing code is now more important.
  • Multi-core CPUs went from an exotic niche to a cheap commodity, so parallelism is not optional anymore.
  • Core counts grow faster than RAM prices go down, so multi-processing is not enough anymore.
  • SIMD vectors become wider and wider, so vectorization is not a gimmick anymore.
@steveklabnik
steveklabnik / main.rs
Created October 25, 2017 16:06
The Results of the Expressive C++17 Coding Challenge in Rust
use std::env;
use std::io;
use std::io::prelude::*;
use std::fs::File;
#[derive(Debug)]
enum Error {
Io(io::Error),
Program(&'static str),
}