9 Commits

Author SHA1 Message Date
Dane Sabo
5050b9e71e fat-entry scram: n decays 0.047→0.009 over 60s from fat X_entry
Scram PJ reach from the bounding-box union of:
  - hot-standby box (mode_boundaries.q_shutdown)
  - heatup-tight reach envelope (results/reach_heatup_pj_tight.mat)
  - operation-LQR reach envelope (results/reach_operation_result.mat)
  - LOCA operation envelope (results/reach_loca_operation.mat, 3s)

with precursor + temperature outliers clamped to physical bounds.

Results at probe horizons:
  T=10s: 10890 sets in 480s wall — n ∈ [-8e-4, 0.047]   T_c [231, 362]
  T=30s: 16925 sets in 2892s wall — n ∈ [-4e-4, 0.021]  T_c [229, 361]
  T=60s: 23919 sets in 705s wall  — n ∈ [-2e-4, 0.009]  T_c [226, 359]

Monotone n decay, factor-of-5-per-minute even from the wide union.
This is the defensible scram-obligation version: starts from anywhere
the plant could plausibly be (including LOCA-perturbed operation
state), proves n decays. X_exit(scram)=n≤1e-4 still not reached in
60s — same T_max-vs-plant-decay mismatch previously flagged.

Fixed: missing Printf import that had failed the summary block on the
first run (results still computed correctly, just the final print
errored; the matwrite is after the print so the mat file wasn't
saved on that run).

Journal entry for 2026-04-21 extended with the fat-entry result +
the LOCA-reach 3s-horizon numerical-looseness apass. 38 pages.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 21:40:04 -04:00
Dane Sabo
ef7ae06ffc point 2 + 3: LOCA entry reach + scram fat-entry + steam-dump heatup
Morning-review items 2 and 3.

Point 2 (scram X_entry expansion):
  - reach_loca_operation.jl: LQR reach under Q_sg widened to
    [0, 1.5*P_0] (steam-line break envelope) for 3 s horizon.
    Longer horizons cause numerical blowup in the box-hull
    reach propagator due to slow precursor modes amplifying
    under large disturbance — documented in the script.
  - reach_scram_pj_fat.jl: computes bounding-box union of
    hot-standby + heatup-tight + operation + LOCA reach
    envelopes, clamps obvious numerical outliers on precursors
    and temperatures, builds a fat X_entry(scram), runs scram
    PJ reach. Result pending (TMJets compiling).

Point 3 (heatup steam-dump Q_sg):
  - configs/heatup/with_steam_dump.toml: Q_sg ∈ [0, 0.05·P_0]
    as bounded parameter.
  - reach_heatup_pj_sd.jl: 12-state RHS with x[10]=Q_sg (dx=0,
    augmented bounded param) and x[11]=t. Running in
    background.

Tight-entry heatup via the new TOML-config reach_heatup_pj.jl
reproduces the previous all-6-halfspaces-discharged result
(300s horizon, T_c envelope [281.05, 291.0]). Refactor
preserves semantics.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 20:28:43 -04:00
Dane Sabo
2bbb1871cc refactor: scripts subdivision + TOML configs + results/ split + presentation outline
Architecture restructure from morning review:

1. code/scripts/ subdivided into sim/, reach/, barrier/, plot/.
   Easier nav; `barrier/` is the natural place for SOS scale-up scripts.
2. Heatup PJ reach variants consolidated behind TOML configs.
   reach_heatup_pj.jl now takes `--config path/to/config.toml`;
   configs/heatup/baseline.toml (wide entry, from predicates.json) and
   configs/heatup/tight.toml (narrow entry, reproduces all-6-halfspaces
   discharged result). Old reach_heatup_pj_tight.jl and
   reach_heatup_pj_tight_full.jl deleted (superseded).
3. Reach output .mat files moved from reachability/ to results/.
   reachability/ now = specs + docs; results/ = ephemeral outputs
   (gitignored *.mat). README added.
4. OVERNIGHT_NOTES.md archived to claude_memory/2026-04-20-21-overnight-
   session-summary.md (date range in the filename makes the history clearer).

All include() / Pkg.activate() paths in scripts updated for the new
depth. Smoke tests pass (reach_operation.jl generates its .mat in
the new results/ location; sim_sanity.jl matches MATLAB).

Presentation outline for the 20-min prelim talk landed in
presentations/prelim-presentation/outline.md. 14-slide assertion-
evidence format targeting OT-informed cybersecurity audience. Each
slide: one declarative assertion + one figure. Outline includes
which figures already exist and which need to be created, timing
checkpoints, cybersecurity angle to emphasize, and Q&A prep.

New config configs/heatup/with_steam_dump.toml + its companion
scripts/reach/reach_heatup_pj_sd.jl (12-state RHS with Q_sg as an
augmented bounded parameter x[10] and time as x[11]). Kicks off
point 3 from morning review.

Next up: scram X_entry expansion (morning point 2) — LOCA scenario
+ union of mode reach envelopes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 20:24:48 -04:00
Dane Sabo
1eab154847 SOS + polytopic barrier exploration — first degree-4 barrier found
Polytopic (Nagumo face-by-face LP check) and SOS polynomial
(Prajna-Jadbabaie w/ CSDP) barrier attempts on operation mode.

**Polytopic (barrier_polytopic.jl):** the naive check on
inv2_holds ∩ precursor_tube_bounds fails — 16 of 18 faces can be
crossed under A_cl. This is EXPECTED: safety halfspaces alone form
a set too big for LQR to contract from everywhere.  The correct
approach is Blanchini's pre-image iteration (max robustly controllable
invariant set). Sketched in the script; 2-3 days to implement properly.

**SOS (barrier_sos_2d.jl):** a working proof of concept.

CSDP returns OPTIMAL on a 2-state projection of the operation mode
(dn, dT_c) with:
  X_entry  = |dn| ≤ 0.01, |dT_c| ≤ 0.1
  X_unsafe = dn ≥ 0.15 (high-flux-trip direction)
  Dynamics = reduced 2×2 A_cl after LQR.
  No disturbance (B_w projects to 0 in this subset).
  Global decrease condition (-(∇B·f) SOS) instead of Putinar ∂{B=0}.

Result: a degree-4 polynomial B(x) satisfying all three barrier
conditions.  Coefficients printed.  First non-quadratic barrier
artifact for this plant.

Caveats:
  - 2D projection loses precursor coupling.
  - Disturbance ignored in this projection.
  - Global-decrease is stronger than the Putinar ∂{B=0} condition;
    the latter requires bilinear σ_b·B formulation (BMI) and
    iterative solvers. Deferred.
  - Scaling to 10-state degree-4 gives SDP ~ 1000×1000; CSDP may
    choke. Mosek or MOSEK-free SDP (SCS) might handle.

JuMP, HiGHS, SumOfSquares, DynamicPolynomials, CSDP all added to
Project.toml.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 17:19:47 -04:00
Dane Sabo
244a744e67 predicates: PJ-validity halfspace as an inv1_holds conjunct + reach tube plots
Following user's review feedback (point 1):

prompt_critical_margin_heatup: a new entry under safety_limits that
proves the PJ reduction's validity condition (beta - rho > 0 with
margin) rather than hand-waving it.  Controller-specific
specialization for heatup: under feedback linearization,
rho_total = Kp*(T_ref - T_c), so rho ≤ 0.5*beta iff T_c ≥ T_ref -
32.5.  Worst-case T_ref = T_c0 at ramp end, so T_c ≥ 275.85 is
sufficient, which our tight-entry reach clears trivially.

Conjoined into inv1_holds. Safety proofs now target BOTH the
physical bounds AND the conditions that make the PJ approximation
sound. Saves Dane's rigor-over-vibes instinct (saved to memory).

plot_reach_tubes.jl: four-panel visualization of a reach-result .mat:
  (1) T_c / T_hot / T_cold envelopes overlaid
  (2) ΔT_core = T_hot - T_cold (power proxy, right-axis MW)
  (3) rho envelope in dollars, with ±1$ prompt lines
  (4) n envelope
Operation-mode plot saved to docs/figures/reach_operation_tubes.png.
Heatup PJ version pending — needs full per-step data from the
running reach_heatup_pj_tight_full.jl.

reach_heatup_pj.jl + reach_heatup_pj_tight_full.jl now save
per-timestep envelopes (t_arr, Tc_lo_ts, Tc_hi_ts, ...) so the
plotting script can overlay tubes vs time.

Next up: polytopic / SOS barriers, Tikhonov error bound for PJ.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 16:28:02 -04:00
Dane Sabo
aba017c5b1 overnight wrap: summary notes + tighter-entry heatup PJ stub
- OVERNIGHT_NOTES.md: read-this-first TL;DR for morning review.
  Points at journal.pdf (32 pages, latest entry has all results),
  validate_pj_heatup.png, and the Pluto app.  Lists priority-1 actions
  (look at data, decide on refinement vs accept-300s-tube) and
  priority-2 followups (scram reach ingestion, entry refinement,
  saturation hybrid, SOS barriers, alpha parametric).

- reach_heatup_pj_tight.jl: script committed but not yet run tonight.
  Tighter X_entry on T_c (width 6 K vs baseline 14 K) to test whether
  the low-T_avg-trip tube-looseness is entry-box-width driven or
  reach-growth driven.

Scram PJ still compiling as of this commit; will land separately
when it completes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 14:49:48 -04:00
Dane Sabo
3fdf5eed48 prompt-jump reach: 30x horizon improvement (10s -> 300s sound)
Results from the overnight TMJets run with the prompt-jump model:

  T=60s:   PASSES (10,044 reach-sets, 205 s wall)
  T=300s:  PASSES (27,375 reach-sets, 591 s wall)
  T=1800s+: partial — exhausts 100k step budget past ~300s

At T=300s the envelope is:
  n:      [-0.00156, 0.0103]  (slightly negative = sound overapprox)
  T_c:    [272.4, 295.0] C
  T_f:    [261.2, 302.7] C
  T_cold: [270.0, 289.5] C

Discharges 5/6 inv1_holds safety halfspaces at 300s:
  fuel_centerline:    +897 K margin ✓
  t_avg_high_trip:     +25 K margin ✓
  t_avg_low_trip:      VIOLATED (tube dips to 272.4, limit 280)
  n_high_trip:         huge margin ✓
  cold_leg_subcooled: +15 K margin ✓

The low_trip violation is TUBE looseness, not physical — nominal sim
only dips to ~280 transiently. Fixable by tighter X_entry, higher
orderQ, or refinement. Open item.

Journal updated with full results table + limitation box. scram PJ
reach ready to run but not yet executed (structure similar, simpler).

Fix: siunitx \degreeFahrenheit, \degree, \microsecond now work via
\DeclareSIUnit in preamble. UTF-8 passthrough in listings via
literate= map for Δ, λ, μ, α, β, ρ, Σ, Λ, ≤, ≥, →, ±, °, ×, ε.
Journal now compiles clean: 32 pages, 0 errors.

App v2 Pluto cells land under §§9b–9d: live reach-result ingestion
with computed per-halfspace margins, 2D projection chooser, PJ-reach
overlay placeholder.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 14:45:03 -04:00
Dane Sabo
645f2d8d27 prompt-jump model + app v2 + overnight journal entry (in progress)
Singular-perturbation reduction of the PKE+T/H system: set dn/dt=0,
solve algebraically n = Λ·Σλ_i·C_i / (β-ρ). State drops 10 -> 9 (no
n), removes Λ⁻¹ stiffness. Validated against full state on the heatup
scenario:

  t [s]    |Δn|/n_full   T_c err [K]
  60       3.7e-5        4e-6
  300      3.8e-4        1.9e-4
  1200     1.0e-3        2.2e-3
  3000     5.0e-4        7.2e-3

Maximum relative error 0.1% on n, peak 7 mK on temperatures over
50 minutes.  PJ approximation is excellent for slow heatup transients
(sub-prompt-critical regime).

Files:
  - code/src/pke_th_rhs_pj.jl: reduced 9-state RHS
  - code/scripts/validate_pj.jl: side-by-side sim
  - code/scripts/reach_heatup_pj.jl: TMJets reach with PJ model
    (probing T = 60, 300, 1800, 5400 s)

App v2 (Pluto):
  - §9b: live ingestion of reach_operation_result.mat with per-
    halfspace margins computed from JSON-defined inv2_holds.
  - §9c: 2D projection chooser (n, T_f, T_c, T_cold) with reach
    tube envelope overlay.
  - §9d: PJ heatup reach summary (placeholder until first run lands).

Journal:
  - Added 2026-04-20-overnight-prompt-jump.tex with PJ derivation,
    validation table, soundness ledger update.  apass markers for
    the in-progress reach results.

This commit captures state mid-run; next commit will add the
populated reach results once TMJets returns.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 22:45:24 -04:00
Dane Sabo
fbbaebff9f julia migration: port MATLAB to Julia, delete MATLAB, rename julia-port -> code
Full toolchain port. Numerical equivalence verified against MATLAB:
- main_mode_sweep.jl: every mode's final state matches MATLAB to 3-4 dp
- reach_operation.jl: per-halfspace margins match MATLAB exactly
- barrier_lyapunov.jl: per-halfspace bounds match (best Qbar from sweep
  yields max|dT_c| = 33.228 K either side)
- barrier_compare_OL_CL.jl: OL gamma 1.038e13, CL gamma 1.848e4
  matching the MATLAB result; LQR helps by ~20,000x on every halfspace.

Phase summary:
  Phase 1: pke_solver.jl, plot_pke_results.jl (Plots.jl), main_mode_sweep.jl
  Phase 2: reach_linear.jl, reach_operation.jl, barrier_lyapunov.jl,
           barrier_compare_OL_CL.jl, load_predicates.jl
  Phase 3 (this commit): delete plant-model/ entirely, delete reach
           code from reachability/ keeping predicates.json + docs,
           git mv julia-port/ -> code/, update root README + CLAUDE,
           write code/CLAUDE.md and code/README.md, update reach
           README + WALKTHROUGH file paths, journal preamble note
           that pre-port entries reference MATLAB paths.

Why now: prompt-neutron stiffness in nonlinear reach made it clear we
need TMJets, which is Julia. Already had the Julia plant model
working and matching MATLAB. Two languages = two sources of truth =
two places to drift. One language, one truth.

Manifest.toml gitignored. .mat results gitignored.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 21:44:59 -04:00