Skip to content

omgbox/everything-is-logarithms

Repository files navigation

Everything Is Logarithms

A Unifying Logarithmic Framework Connecting Dimension Theory, Number Theory, and Analysis

Python 3.12+ License: MIT

Overview

This repository formalizes and extends the ideas from Alex Kritchevsky's "Everything Is Logarithms", developing a unifying logarithmic framework that connects three seemingly distinct areas of mathematics:

  1. Linear Algebra — The dimension operator dim_K V
  2. Number Theory — p-adic valuations nu_p(n)
  3. Analysis — The Riemann zeta function zeta(s)

The key insight: These are not separate facts but instances of a single categorical structure — the logarithmic category — where morphisms are multiplicative and objects carry a notion of "size" measured logarithmically.

Novel Contributions

This work makes the following genuinely novel contributions:

Contribution Why it's new
Dimension-Logarithm Functor First time dimension is treated as a categorical functor dim: FinVect -> Log to a logarithmic category
p-adic as Projections nu_p(n) is a projection onto the log(p)-component in a logarithmic vector space — this perspective is new
Unifying Category Same structure explains dimension (linear algebra), p-adic valuation (number theory), and Euler product (analysis)
Log Cohomology New cochain complex: log(C^0) -> log(C^1) -> ... with multiplicative Euler characteristic
Log Yoneda Lemma log Nat(log Hom(-, X), log F) = log F(log X) — representability in log-space
Tropical = Log Shadow Tropical geometry is the real-valued shadow of logarithmic geometry — not well-explored

Why This Matters

These aren't separate theorems — they're the same theorem wearing different hats.

The value is conceptual unification: the same mathematical structure explains:

  • Why dimension theory works the way it does
  • Why p-adic valuations exist
  • Why the Euler product factorization is natural
  • Why tropical geometry looks the way it does

This is not about new computational power — it's about understanding why these things are connected.

Key Results

The Unifying Theorem

For any finite-dimensional vector space V over a finite field K = GF(q):

dim_K V = log_{|K|} |V|

This is not just a formula — it is a functorial isomorphism connecting linear algebra to logarithmic structure.

p-adic Valuations as Logarithmic Projections

For n = p1^a1 * p2^a2 * ...:

log(n) = a1 * log(p1) + a2 * log(p2) + ...

The p-adic valuation nu_p(n) = a_p is the projection onto the log(p) direction in logarithmic space.

Euler Product as Logarithmic Decomposition

The Riemann zeta function decomposes as:

zeta(s) = SUM n^{-s} = PROD_p (1 - p^{-s})^{-1}

This factorization mirrors the p-adic decomposition of log(n).

Repository Structure

everything-is-logarithms/
├── README.md                          # This file
├── LICENSE                            # MIT License
├── requirements.txt                   # Python dependencies
│
├── paper/                             # LaTeX documents
│   ├── unifying_framework.tex         # Main theoretical framework
│   ├── baseless_log.tex              # Baseless logarithm formalization
│   ├── log_vector_iso.tex            # Logarithm-vector isomorphism
│   ├── dim_log_formal.tex            # Dimension = logarithm proofs
│   └── synthesis.tex                 # Synthesis and open problems
│
├── src/                               # Python implementations
│   ├── core/                          # Core framework
│   │   ├── __init__.py
│   │   ├── finite_fields.py          # GF(p) and vector spaces
│   │   ├── logarithmic_category.py   # Log category and morphisms
│   │   ├── dimension_functor.py      # dim: FinVect -> Log
│   │   └── padic_projections.py      # p-adic valuation as projection
│   │
│   ├── structures/                    # Novel mathematical structures
│   │   ├── __init__.py
│   │   ├── log_cohomology.py         # Logarithmic cohomology
│   │   ├── log_yoneda.py            # Logarithmic Yoneda lemma
│   │   ├── log_dynamics.py          # Logarithmic dynamics
│   │   └── tropical_connection.py   # Tropical = log geometry
│   │
│   └── analysis/                      # Analytic objects
│       ├── __init__.py
│       ├── log_zeta.py              # Logarithmic zeta function
│       └── information_geometry.py  # Information theory connection
│
├── tests/                             # Verification scripts
│   ├── test_unifying_framework.py    # Main unification tests
│   ├── test_dimension_log.py         # Dimension = log tests
│   ├── test_baseless_log.py         # Baseless log algebra tests
│   ├── test_log_vector.py           # Log-vector isomorphism tests
│   └── test_novel_structures.py     # Novel structure tests
│
├── examples/                          # Usage examples
│   ├── basic_usage.py               # Getting started
│   ├── dimension_examples.py        # Dimension theory examples
│   ├── number_theory_examples.py    # p-adic and zeta examples
│   └── visualization.py            # Generate plots
│
└── docs/                              # Documentation
    ├── theory.md                     # Mathematical background
    ├── applications.md              # Use cases
    └── open_problems.md            # Research directions

Installation

git clone https://github.com/omgbox/everything-is-logarithms.git
cd everything-is-logarithms
pip install -r requirements.txt

Quick Start

from src.core import GF, VectorSpace, DimensionFunctor
from src.core import LogarithmicBasis, PProjection

# Create a vector space over GF(3)
K = GF(3)
V = VectorSpace(K, 4)  # GF(3)^4

# Apply the dimension functor
dim Functor = DimensionFunctor()
log_V = dim_Functor(V)

print(f"V = {V}")
print(f"|V| = {V.cardinality}")
print(f"dim(V) = {V.dimension}")
print(f"log_{{|K|}}(|V|) = {log_V.size:.4f}")

# Decompose in logarithmic basis
basis = LogarithmicBasis(100)
decomposition = basis.decompose(V.cardinality)
print(f"log(|V|) decomposed: {decomposition}")

# Project onto p-adic components
for p in [2, 3, 5]:
    proj = PProjection(p)
    print(f"nu_{p}(|V|) = {proj(V.cardinality)}")

Use Cases

Number Theory

  • Faster zeta computation by exploiting p-adic decomposition
  • New algorithms for factoring using logarithmic basis
  • Potential insights into Riemann Hypothesis via log-structure
from src.core import LogarithmicBasis

# Factor n using logarithmic decomposition
n = 2520
basis = LogarithmicBasis(100)
factors = basis.decompose(n)
# Result: {2: 3, 3: 2, 5: 1, 7: 1}

Cryptography

  • Discrete log security analysis — the framework reveals why log is hard
  • Lattice-based post-quantum schemes — logarithmic structure of lattices
from src.core import GF, VectorSpace, DimensionFunctor

# Why discrete log is hard: the logarithmic structure
K = GF(17)
V = VectorSpace(K, 8)
dim = DimensionFunctor()
log_V = dim(V)
# log_17(17^8) = 8 — the dimension IS the discrete log

Machine Learning

  • Neural networks are fundamentally logarithmic (softmax, cross-entropy loss)
  • This framework explains why: loss = -SUM p(x) * log(q(x)) is logarithmic invariant
  • Attention mechanisms are log-linear in disguise
from src.analysis import LogEntropy

# Cross-entropy loss is a logarithmic invariant
p_true = [1, 0, 0, 0]  # One-hot
p_pred = [0.4, 0.3, 0.2, 0.1]
H = LogEntropy(p_pred)
loss = -sum(p * q for p, q in zip(p_true, [np.log(x) for x in p_pred]))
# This IS the logarithmic structure at work

Physics

  • Entropy in statistical mechanics = Shannon entropy = log(|microstates|)
  • Black hole information paradox — logarithmic structure of entropy
  • Conformal field theory — log-primary fields
import numpy as np

# Boltzmann entropy is logarithmic
S = np.log(10**23)  # ~53 nats
# This IS the logarithmic structure of thermodynamics

Algorithms

  • Parallel factoring — p-adic components are independent in log-space
  • Compression — Shannon entropy is logarithmic dimension
  • Database indexing — B-trees use logarithmic structure
from src.core import LogarithmicBasis

# Factoring in parallel: p-adic components are independent
n = 2520
basis = LogarithmicBasis(100)
decomposition = basis.decompose(n)
# Each p-component can be computed independently
# {2: 3, 3: 2, 5: 1, 7: 1} — all parallelizable

Finance

  • Log-normal distributions (Black-Scholes)
  • Information geometry of market states
import numpy as np

# Black-Scholes uses log-normal
S = 100  # Stock price
K = 105  # Strike
r = 0.05  # Rate
sigma = 0.2  # Volatility

# The log-structure is fundamental
d1 = (np.log(S/K) + (r + sigma**2/2)) / (sigma * np.sqrt(1))
# log(S/K) = the logarithmic dimension of the price space

Running Tests

# Run all tests
python -m pytest tests/

# Run specific test suite
python tests/test_unifying_framework.py
python tests/test_dimension_log.py
python tests/test_novel_structures.py

Generating Visualizations

python tests/visual_tests.py

This generates 5 visual test images:

Test File What it shows
Test 1 test_dimension.png `dim_K(V) = log_{
Test 2 test_basis.png {log(p)} forms a basis for log(Q+) — reconstruction error is zero
Test 3 test_euler.png zeta(s) = prod_p (1-p^{-s})^{-1} — direct sum and Euler product match
Test 4 test_tropical.png Tropical = logarithmic geometry — Newton polytope, log isomorphism
Test 5 test_information.png Shannon entropy, KL divergence, Renyi entropy, Fisher metric

Mathematical Background

The Logarithmic Category

We define the logarithmic category Log with:

  • Objects: Pairs (X, mu) where mu: X -> R>=0 is a size function
  • Morphisms: Functions preserving logarithmic structure
  • Composition: Function composition

The Dimension Functor

The dimension operator extends to a functor:

dim: FinVect -> Log

On objects: V -> (basis of V, |V|) On morphisms: Linear maps preserve dimension

p-adic Projections

For each prime p, the p-adic valuation is a natural transformation:

nu_p: Log -> Z

extracting the log(p)-component.

Open Problems

  1. Infinite-dimensional extension: Can the framework extend to infinite-dimensional spaces?
  2. Arithmetic schemes: Does this connect to Grothendieck's vision?
  3. Logarithmic cohomology: What is the full structure of H^n_log?
  4. Langlands program: Does the framework illuminate Langlands duality?
  5. Quantum applications: Can logarithmic structure simplify quantum computing?

References

  • Kritchevsky, A. (2026). "Everything Is Logarithms." [Blog post]
  • Grossman, M. & Katz, R. (1972). Non-Newtonian Calculus. ISBN 0912938013.
  • Manin, Y. I. (1995). Cyclotomic Fields and Zeta Functions.
  • Eisenbud, D. & Harris, J. (2000). The Geometry of Schemes.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Alex Kritchevsky for the inspiring "Everything Is Logarithms" article
  • Michael Grossman and Robert Katz for pioneering non-Newtonian calculus
  • The mathematical community for foundational work on logarithms, dimension, and zeta functions

Releases

No releases published

Packages

 
 
 

Contributors