Skip to content

Instantly share code, notes, and snippets.

View Nikolaj-K's full-sized avatar
💭
I'm combinating Why's.

Nikolaj Kuntner Nikolaj-K

💭
I'm combinating Why's.
View GitHub Profile
@Nikolaj-K
Nikolaj-K / Consequentia_Mirabilis.txt
Last active April 13, 2024 11:24
Pierce's law, Consequentia Mirabilis, ¬¬-Elimination and LEM without Explosion
Proofs discussed in the video:
https://youtu.be/h1Ikhh3J1vY
Legend and conventions:
$(P \to \bot) \lor P\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,$ ... $PEM$ ... Principle of excluded middle (a.k.a. $LEM$)
$((P \to \bot) \land P) \to Q\,\,\,$ ... $EXPL$ ... principle of explosion, a.k.a. ex falso
$((P \to Q) \to P) \to P$ ... $PP$ ... Pierce's principle
$((P \to \bot) \to P) \to P$ ... $CM$ ... consequentia mirabilis, a.k.a. Clavius's principle
@Nikolaj-K
Nikolaj-K / subcountability.tex
Last active April 8, 2024 00:04
ℕ surjects onto ℝ. Subsets of ℕ surject onto ℕ^ℕ. ℕ^ℕ injects into ℕ. All that.
Shownotes to the video:
https://youtu.be/q-mjO9Uxvy0
For a related and relevant video constructive logic basics and upshots is at
https://youtu.be/-lPrjPHElik
For a related and relevant discussion on computably enumerable sets and their compliments, see this 4yo video
https://youtu.be/Ox0tD58DTG0
For some of the non-theorems in the list it helps to understand \Pi_0^2-complete sets.
The references video on how the Axiom of Choice and Regularity each imply LEM is at
https://youtu.be/2EOW23uVcRA
@Nikolaj-K
Nikolaj-K / manual_sampling.py
Created March 12, 2024 22:44
Manually sampling from any given 1D histogram
"""
Script discussed in the video:
https://youtu.be/ndAmT8CYGDM
Links:
* https://en.wikipedia.org/wiki/Energy-based_model
* https://en.wikipedia.org/wiki/Brownian_motion
* https://www.extropic.ai/future
"""
@Nikolaj-K
Nikolaj-K / run_asyncio_example.py
Created January 28, 2024 22:00
Basic async io example
"""
Script discussed in the video
https://youtu.be/RltoGfNhex4
asyncio Enables (interleaved) sequences of functions execution within one thread.
Makes e.g. sense if you want less intensive computation results earlier (for IO) or
If some awaited computation is done in some external thread (e.g. info from a server).
"""
import asyncio
@Nikolaj-K
Nikolaj-K / ReLU_square.py
Last active January 16, 2024 05:00
Computing all polynomials via just ReLU activations (no learning needed)
"""
Script discussed in this videos:
* Video 1:
https://youtu.be/PApGm1TKFHQ
* Video 2:
https://youtu.be/1z2GRcaKSrA
==== Text for video 1 ====
@Nikolaj-K
Nikolaj-K / nnqft.tex
Last active February 18, 2024 16:48
Neural Networks as Quantum Field Theories and basic Neural Tangent Kernel Theory
Below is the sketch of my script for the video at:
https://youtu.be/ZSmORp3Bm2c
Paper discussed:
- https://arxiv.org/pdf/2307.03223.pdf
Large width network theory:
- https://en.wikipedia.org/wiki/Universal_approximation_theorem
- https://en.wikipedia.org/wiki/Gaussian_process
@Nikolaj-K
Nikolaj-K / scalargrad.py
Last active October 23, 2023 21:31
A simple implementation of reverse accumulation (back-propagation)
"""
Impelmentation of reverse accumulation (backpropagation), discussed in
https://youtu.be/BcCk8I6YAqw
Most of this script is exposition code. The reverse accumulation code still runs if you delete everything except the following 5 classes
* ValAndDVal, ExprBaseRevAcc, VarExprRevAcc, PlusExprRevAcc, MultExprRevAcc
validated using the following 2 functions:
* p, run_VarExprRevAcc_gradient_decent_demo
@Nikolaj-K
Nikolaj-K / bandit_strategies.py
Last active October 10, 2023 15:59
A small pytorch routine approaching the n-armed bandit problem
"""
Casino strategies and some pytorch. The code is explained in the video
https://youtu.be/VUVVVi9CgbI
I think you can install pytorch via `pip` or `pip3` through
`pip3 install torch torchvision`
Some mathy reading material:
* http://yuanz.web.illinois.edu/teaching/IE498fa19/
@Nikolaj-K
Nikolaj-K / zolotarev.py
Last active September 16, 2023 22:36
Zolotarev's lemma
"""
Code discussed in the video:
https://youtu.be/0A3mAUGFUow
* Motivation:
- Relation between Legendre symbol and quadratic equations on ZxZ
+ See https://en.wikipedia.org/wiki/Legendre_symbol#Table_of_values
* For any fixed number, validate
@Nikolaj-K
Nikolaj-K / copious_secret_santa.py
Last active August 19, 2023 18:01
Copious Secret Santa / Voting assignment
"""
Script used in the video
https://youtu.be/2b9fOpX0zKY
Formal structure: balanced simple digraph
(Important special properties out-degrees equals the in-degrees, no self-loops, no parallel arrows)
1. Proof task: Count them, given any assginment of out-degrees.
How does it compare to just random disgraphs with that those out-degrees?
1. Coding task: Generate one given the out-degrees, fast. (I have a bad, probabilistic solution)