depth3_sigmoid_circuit_eval
Evaluates a depth-3 sigmoidal circuit C on a real input vector x : Fin n → ℝ using Real.sigmoid: layer 1 computes Real.sigmoid ((∑ i : Fin n, C.w₁ j i * x i) + C.b₁ j), layer 2 computes Real.sigmoid ((∑ j : Fin C.m₁, C.w₂ k j * layer1 j) + C.b₂ k), and the output gate computes Real.sigmoid ((∑ k : Fin C.m₂, C.w₃ k * layer2 k) + C.b₃), where each bias is added once to the inner product outside the summation.
Statement
noncomputable def depth3_sigmoid_circuit_eval {n : ℕ} (C : Depth3SigmoidCircuit n) (x : Fin n → ℝ) : ℝ
- Defined in
- scout/2611-21910-new-gate-weight-and-wire-complexity-bounds-for-sigmoid-neur.md:709
- Verified
- 18 Nov 2026
- Axioms
- none listed
- Built on 1
- Depth3SigmoidCircuitA feedforward circuit structure on n inputs parameterized solely by the input dimension n : ℕ, containing internal fields for the hidden…
- Used by 2
- depth3_sigmoid_circuit_eval_boolEvaluates a depth-3 sigmoidal circuit C on a Boolean input vector x : Fin n → Bool by converting false to 0 and true to 1 and evaluating C.
- symmetric_boolean_func_depth3_sigmoid_circuitFor every symmetric Boolean function f on n ≥ 1 variables, there exists a depth-3 sigmoidal circuit C on n inputs with at most 3n wires…
Read back from the Lean
The function depth3_sigmoid_circuit_eval evaluates a 3-layer neural network / circuit C on an input vector x : Fin n → ℝ, producing a real number.
Given:
- a dimension n : ℕ,
- a circuit C : Depth3SigmoidCircuit n consisting of:
- hidden layer sizes m₁, m₂ : ℕ,
- weights w₁ : Fin m₁ → Fin n → ℝ, w₂ : Fin m₂ → Fin m₁ → ℝ, and w₃ : Fin m₂ → ℝ,
- biases b₁ : Fin m₁ → ℝ, b₂ : Fin m₂ → ℝ, and b₃ : ℝ,
- an input vector x : Fin n → ℝ,
it computes the output in three stages:
1. layer1 j = Real.sigmoid ((∑ i : Fin n, C.w₁ j i * x i) + C.b₁ j) for each j : Fin C.m₁,
2. layer2 k = Real.sigmoid ((∑ j : Fin C.m₁, C.w₂ k j * layer1 j) + C.b₂ k) for each k : Fin C.m₂,
3. The final result is Real.sigmoid ((∑ k : Fin C.m₂, C.w₃ k * layer2 k) + C.b₃).
Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.
Lean source view module on GitHub
/-- Evaluation of a depth-3 sigmoidal circuit on a real input vector. -/ noncomputable def depth3_sigmoid_circuit_eval {n : ℕ} (C : Depth3SigmoidCircuit n) (x : Fin n → ℝ) : ℝ := let layer1 : Fin C.m₁ → ℝ := fun j => Real.sigmoid ((∑ i : Fin n, C.w₁ j i * x i) + C.b₁ j) let layer2 : Fin C.m₂ → ℝ := fun k => Real.sigmoid ((∑ j : Fin C.m₁, C.w₂ k j * layer1 j) + C.b₂ k) Real.sigmoid ((∑ k : Fin C.m₂, C.w₃ k * layer2 k) + C.b₃)