# Formula Extraction Template This template standardizes the extraction of mathematical formulas from code for cold review and verification. --- ## Template Structure ### 1. Function Identification ``` File: [path/to/file.ext] Function: [function_name] Line: [line_number] Language: [Rust/Python/Lean/C++ etc.] ``` ### 2. Mathematical Expression ``` [LaTeX or mathematical notation] Example: a_{t+1} = a_t \cdot e^{-\lambda t} + \sum_{i=1}^{n} w_i \cdot x_i ``` ### 3. Computational Implementation ```rust [code showing implementation] Example: pub fn exponential_decay( current: Q16_16, decay_rate: Q16_16, input: Q16_16 ) -> Q16_16 { let decayed = current * exp(-decay_rate); decayed + input } ``` ### 4. Domain Applicability - [x] Additive Basis Theory - [ ] Constraint Satisfaction - [x] Optimization Problems - [ ] Graph Theory - [ ] Number Theory - [ ] Signal Processing - [ ] Other: _________ ### 5. Validation Status - [x] Mathematically verified - [x] Computationally tested - [ ] Cross-domain validated - [ ] Peer reviewed ### 6. References - [Academic paper or source] - [Related documentation] --- ## Quick Reference Guide ### Common Mathematical Patterns | Pattern | Example | Documentation | |---------|---------|---------------| | Recurrence Relations | `a_{n+1} = f(a_n)` | Use subscripts in doc comments | | Matrix Operations | `C = A × B` | Document dimensions and types | | Optimization | `minimize f(x)` | Include constraints | | Signal Processing | `Y = FFT(X)` | Specify window, overlap | | Statistical | `μ = E[X]` | Define population vs sample | ### Documentation Checklist - [ ] Function signature documented - [ ] Mathematical formula included - [ ] Parameters explained - [ ] Return value specified - [ ] Domain tags applied - [ ] Validation status marked - [ ] References cited --- ## Usage Examples ### Example 1: DSP Function ```markdown ## FFT Spectral Analysis ### Mathematical Expression ``` X(k) = \sum_{n=0}^{N-1} x(n) \cdot e^{-j\frac{2\pi kn}{N}} ``` ### Computational Implementation [See flac_dsp_node.py:process_flac_chunk] ### Domain Applicability - [x] Signal Processing - [ ] Other domains ### Validation Status - [x] Mathematically verified - [x] Computationally tested ``` ### Example 2: State Machine ```markdown ## SLUQ State Update ### Mathematical Expression ``` a_{t+1} = a_t - (a_t >> r) + \lambda_1|e_t| + \lambda_2\Delta_t + \lambda_3m_t ``` ### Computational Implementation [See SLUQ.lean:stress_accumulation] ### Domain Applicability - [x] Optimization Problems - [x] Constraint Satisfaction - [ ] Other domains ### Validation Status - [x] Mathematically verified - [ ] Cross-domain validated ```