# app — Predicate Explorer (Pluto.jl)

A local-server visual companion to `reachability/predicates.json`. Maps
the FRET-spec boolean predicates to their numerical halfspaces over the
10-state continuous vector, shows mode invariants as conjunctions of
named safety limits, and previews a UI for editing them.

**v1: read-only.** Sliders display in the edit panel but do not write
back to the JSON. v2 will add live write-through. v3 (the dream) will
derive halfspaces automatically from the FRET spec.

This is the FRET-adjacent piece — the "hybrid-systems group tab" we
talked about. Stand-alone for now; integration into the upstream FRET
UI is a later story.

## Run

First time:

```bash
cd app
julia --project=. -e 'using Pkg; Pkg.instantiate()'
```

Subsequent:

```bash
julia --project=. -e 'using Pluto; Pluto.run()'
```

A browser window opens (default `http://localhost:1234`). Pick
`predicate_explorer.jl` from the file list. The notebook is reactive —
edit any cell, dependent cells re-run.

## What you can do today (v1)

- Inspect every operational deadband, safety limit, mode invariant,
  and mode boundary.
- See the boolean ↔ continuous mapping for each predicate.
- View a 2D projection (T_avg × n) showing the operating polytope.
- Read the reach-status traceability table — which artifact has tried
  to discharge which obligation, with link.
- Move sliders to feel out the editing workflow.

## What lands in v2

- Sliders write back to `predicates.json` with an "are you sure" gate.
- Diff view: pending changes vs.\ the on-disk version.
- Re-run reach scripts in-place from the notebook.

## What's the dream (v3)

- The FRET spec at `../fret-pipeline/pwr_hybrid_3.json` declares
  predicate names without numerical concretization.  Could we use a
  structured ontology of physical bounds (fuel limits, trip setpoints,
  rate limits) plus the FRET text to *derive* the concretization?
- Round-tripping changes back into the FRET model so the synthesis side
  stays consistent.

## Caveats

- Pluto notebooks aren't great in version control — they're long files
  with cell UUIDs and order metadata.  The notebook is committed because
  it's small and the cell order matters.
- Manifest.toml is gitignored; regenerate locally.
