Systematically identify and verify all relevant limiting cases for a result or phase
Codex shell compatibility:
gpd on PATH.GPD_ACTIVE_RUNTIME=codex uv run gpd ....
</codex_runtime_notes><codex_questioning>
Why a dedicated command: Checking limiting cases ad hoc misses limits. A systematic audit ensures every physically meaningful limit is checked. When a result fails a known limit, the error is localized: something in the derivation breaks in that regime, which dramatically narrows the search space for debugging.
Every new result must reduce to known results in appropriate limits. If it doesn't, the new result is wrong (or the known result is wrong, which is rare but possible). There are no exceptions to this principle. </objective>
<context> Target: $ARGUMENTS </context> <!-- [included: limiting-cases.md] --> <purpose> Systematically identify all relevant limiting cases for a physics result and verify that each limit is correctly recovered. This is the single most powerful verification tool in theoretical physics. <process>Interpretation:
Load known framework:
cat .gpd/research-map/FORMALISM.md 2>/dev/null | grep -A 20 "Known Limiting Cases"
cat .gpd/research-map/VALIDATION.md 2>/dev/null | grep -A 30 "Limiting Cases"
<execution_context>
Called from $gpd-limiting-cases command. Produces LIMITING-CASES.md report.
Every new result must reduce to known results in appropriate limits. If it doesn't, the new result is wrong (or the known result is wrong, which is rare but possible). There are no exceptions to this principle. </purpose>
Load project state and conventions to identify applicable limits:
INIT=$(/home/qol/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local init phase-op --include state,config)
if [ $? -ne 0 ]; then
echo "ERROR: gpd initialization failed: $INIT"
# STOP — display the error to the user and do not proceed.
fi
state_exists: true): Extract convention_lock for unit system and sign conventions. Extract intermediate_results from state for previously verified expressions. Extract active approximations and their validity ranges — these define the limits to check.state_exists is false (standalone usage): Proceed with explicit convention declarations required from user via ask_user.Active approximations from the project state directly inform which limits are most important to verify (e.g., if a perturbative approximation is active, the free-theory limit g→0 is mandatory).
Convention verification (if project exists):
CONV_CHECK=$(/home/qol/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local --raw convention check 2>/dev/null)
if [ $? -ne 0 ]; then
echo "WARNING: Convention verification failed — review before checking limits"
echo "$CONV_CHECK"
fi
Limiting case checks depend on conventions — e.g., the sign of k^2 = m^2 vs k^2 = -m^2 in the non-relativistic limit depends on metric signature.
Scan the target for the main physics results:
# Final expressions, key results
grep -n "result\|final\|=.*\\\\frac\|=.*\\\\sqrt\|=.*\\\\sum\|=.*\\\\int\|E\s*=\|Z\s*=\|sigma\s*=\|Gamma\s*=" "$TARGET_FILE" 2>/dev/null
# Named equations
grep -n "\\\\label\|\\\\tag\|# Eq\." "$TARGET_FILE" 2>/dev/null
For each result, identify:
For each result, systematically enumerate limits organized by physics domain:
| Limit | Parameter | Expected Behavior |
|---|---|---|
| Free theory | coupling g -> 0 | Reduce to non-interacting result |
| Classical | hbar -> 0 | Reduce to classical expression |
| Static | omega -> 0 or v -> 0 | Reduce to time-independent result |
| Single particle | N -> 1 | Reduce to one-body problem |
| Limit | Parameter | Expected Behavior |
|---|---|---|
| High temperature | T -> infinity (beta -> 0) | Classical equipartition |
| Low temperature | T -> 0 (beta -> infinity) | Ground state dominance |
| Thermodynamic | N -> infinity, V -> infinity, N/V fixed | Intensive quantities well-defined |
| Ideal gas | interactions -> 0 | PV = NkT or quantum ideal gas |
| Dilute | density -> 0 | Ideal gas behavior |
| Limit | Parameter | Expected Behavior |
|---|---|---|
| Non-relativistic | v/c -> 0 or E << mc^2 | Schrodinger equation |
| Semiclassical | large quantum numbers | Correspondence principle |
| Weak field | perturbation -> 0 | Unperturbed result + linear correction |
| Strong field | perturbation -> infinity | Known strong-coupling result (if exists) |
| Harmonic | anharmonicity -> 0 | Equally spaced levels |
| Limit | Parameter | Expected Behavior |
|---|---|---|
| Tree level | hbar -> 0 or g -> 0 | Classical field theory |
| Free field | all couplings -> 0 | Free propagators, no scattering |
| Non-relativistic | p << mc | Schrodinger field theory |
| Low energy | E << Lambda | Effective field theory |
| Large N | N -> infinity | Saddle point / mean field |
| Abelian | gauge group -> U(1) | QED-like result |
| Limit | Parameter | Expected Behavior |
|---|---|---|
| Continuum | lattice spacing a -> 0 | Continuum field theory |
| Single-site | hopping -> 0 | Atomic limit |
| Mean-field | d -> infinity | Saddle point exact |
| Non-interacting | U -> 0 | Band structure |
| Half-filling | n = 1 | Particle-hole symmetry |
| Limit | Parameter | Expected Behavior |
|---|---|---|
| Newtonian | weak field, slow motion | Newton's gravity |
| Flat spacetime | G -> 0 | Special relativity |
| Non-relativistic | v << c | Galilean invariance |
| Schwarzschild | spherical symmetry | Known exact solution |
| Cosmological | large scales | FRW metric |
| Limit | Parameter | Expected Behavior |
|---|---|---|
| 1D | d = 1 | Often exactly solvable |
| 2D | d = 2 | Special features (BKT, conformal symmetry) |
| Large distance | r -> infinity | Asymptotic behavior (decay, scattering) |
| Short distance | r -> 0 | UV behavior, contact terms |
| Infinite volume | L -> infinity | No finite-size effects |
Not all limits apply to every result. Select based on:
Present the selected limits:
## Limiting Cases for {Result Name}
Selected {N} applicable limits:
| # | Limit | Parameter | Known Result | Source |
|---|-------|-----------|--------------|--------|
| 1 | {limit} | {param -> value} | {known expression} | {textbook/paper} |
| 2 | ... | ... | ... | ... |
Ask the user once using a single compact prompt block if:
For each selected limit:
# Template for numerical limit check
import numpy as np
def result_function(params):
"""The result being checked."""
...
def known_limit(params):
"""The known limiting expression."""
...
# Approach the limit systematically
param_values = [1.0, 0.1, 0.01, 0.001, 0.0001]
for val in param_values:
computed = result_function({..., limit_param: val})
expected = known_limit({..., limit_param: val})
ratio = computed / expected
rel_error = abs(computed - expected) / abs(expected)
print(f"param={val:.0e} computed={computed:.10f} expected={expected:.10f} ratio={ratio:.10f} rel_err={rel_error:.2e}")
# Expected: ratio -> 1 and rel_error -> 0 as param -> limiting value
# Red flags: ratio not approaching 1, oscillating, or diverging
| Status | Meaning |
|---|---|
| EXACT MATCH | Analytical limit reproduces known result identically |
| NUMERICAL MATCH | Converges to known result within numerical precision |
| CORRECT ORDER | Leading term matches; subleading terms expected to differ |
| DISCREPANCY | Does not match -- error in derivation or in known result identification |
| DIVERGENT | Limit does not exist (may be physical or may indicate error) |
| CANNOT CHECK | Limit is intractable analytically and numerically |
For any limit that fails:
Characterize the discrepancy:
Localize the error:
Suggest cause:
Write LIMITING-CASES.md:
---