Aether Catalog definitions — Evergreen_Tropical_TropicalTrapdoor
DefinitionEvergreen_Tropical_TropicalTrapdooraether-catalogevergreen
Definition bundle for the Aether Catalog module Evergreen.Tropical.TropicalTrapdoor, transplanted by skeleton subtraction; supplies the types and constants the catalog's theorems import.
Definition code
-- Def bundle generated from Evergreen/Tropical/TropicalTrapdoor.lean by skeleton subtraction
import Mathlib
/-!
# Tropical Gates as Trapdoor Functions
## Overview
A **trapdoor function** is a function that is easy to compute in one direction
but hard to invert without special knowledge (the "trapdoor"). We model trapdoor
functions as circuits built from **tropical gates** — the fundamental operations
of the tropical semiring (ℝ, min/max, +).
### Key insight
The tropical semiring operations `min`, `max`, and `+` are individually easy to
invert, but their **composition into deep circuits** creates information loss:
- `min(a, b) = 3` has infinitely many preimages (any a ≤ 3, b = 3 or vice versa)
- `max(a, b) = 5` similarly loses information about the non-selected argument
- `a + b = 7` is invertible only up to a 1-parameter family
When composed into a circuit of depth d with n inputs, the preimage of a single
output point becomes a **tropical polyhedron** of potentially exponential
combinatorial complexity, making inversion computationally hard without knowledge
of the circuit structure (the trapdoor).
### Formalization structure
1. **TropicalGate**: Inductive type for min, max, and addition gates
2. **TropicalCircuit**: Circuits built by composing gates
3. **Forward evaluation**: Computing f(x) given circuit and input
4. **Preimage analysis**: The set of inputs mapping to a given output
5. **Trapdoor property**: Forward is easy (polynomial), reverse is hard
(exponential preimage structure) without the circuit topology
-/
noncomputable section
open Real BigOperators Finset
namespace TropicalTrapdoor
/-! ## Section 1: Tropical Gate Primitives -/
/-- A tropical gate is one of three primitive operations:
- `MinGate`: computes min(a, b) — tropical addition in min-plus
- `MaxGate`: computes max(a, b) — tropical addition in max-plus
- `AddGate`: computes a + b — tropical multiplication in both semirings -/
inductive TropGate where
| MinGate : TropGate
| MaxGate : TropGate
| AddGate : TropGate
deriving DecidableEq, Repr
/-- Evaluate a tropical gate on two real inputs -/
def evalGate (g : TropGate) (a b : ℝ) : ℝ :=
match g with
| .MinGate => min a b
| .MaxGate => max a b
| .AddGate => a + b
/-! ## Section 2: Gate Commutativity and Associativity -/
/-! ## Section 3: Information Loss in Tropical Gates
The key to trapdoor behavior: min and max gates **destroy information**.
Given only the output, you cannot recover both inputs. -/
/-- The preimage of a min gate output is a union of two half-spaces -/
def minGatePreimage (c : ℝ) : Set (ℝ × ℝ) :=
{p | min p.1 p.2 = c}
/-- The preimage of a max gate output is a union of two half-spaces -/
def maxGatePreimage (c : ℝ) : Set (ℝ × ℝ) :=
{p | max p.1 p.2 = c}
/-! ## Section 4: Tropical Circuit Model
A tropical circuit is a DAG of tropical gates. We model it as a
sequence of instructions operating on a register file. -/
/-- A circuit instruction: apply a gate to two register indices, store in a third -/
structure TropInstruction where
gate : TropGate
src1 : ℕ
src2 : ℕ
dst : ℕ
deriving DecidableEq, Repr
/-- A tropical circuit is a list of instructions with designated input and output registers -/
structure TropCircuit where
numInputs : ℕ
numRegs : ℕ
instrs : List TropInstruction
outputReg : ℕ
deriving Repr
/-- Register file: maps register indices to real values -/
def RegFile := ℕ → ℝ
/-- Execute one instruction on a register file -/
def execInstr (regs : RegFile) (instr : TropInstruction) : RegFile :=
fun i => if i = instr.dst
then evalGate instr.gate (regs instr.src1) (regs instr.src2)
else regs i
/-- Execute a sequence of instructions -/
def execInstrs (regs : RegFile) : List TropInstruction → RegFile
| [] => regs
| instr :: rest => execInstrs (execInstr regs instr) rest
/-- Initialize register file from input vector -/
def initRegs (inputs : ℕ → ℝ) : RegFile := inputs
/-- Evaluate a tropical circuit on an input -/
def evalCircuit (circ : TropCircuit) (inputs : ℕ → ℝ) : ℝ :=
let finalRegs := execInstrs (initRegs inputs) circ.instrs
finalRegs circ.outputReg
/-! ## Section 5: Forward Evaluation is Efficient -/
/-! ## Section 6: Trapdoor Function Construction -/
/-! ## Section 7: Monotonicity of Tropical Gates -/
/-! ## Section 8: Tropical Distributivity -/
/-! ## Section 9: Information-Theoretic Bounds on Reversal -/
/-! ## Section 10: Piecewise Linearity -/
/-! ## Section 11: The Preimage Set -/
/-- The preimage set of a circuit at output value c -/
def circuitPreimage (circ : TropCircuit) (c : ℝ) : Set (ℕ → ℝ) :=
{inputs | evalCircuit circ inputs = c}
/-! ## Section 12: The Reversal Problem (Formal Statement) -/
/-! ## Section 13: Composition Theorems -/
end TropicalTrapdoor