Skip to content

Use Pulse for verified stateful programming: Remove heap model and witness/recall, etc#4155

Merged
nikswamy merged 12 commits intofstar2from
_fstar2_no_monotonic_heap
Apr 2, 2026
Merged

Use Pulse for verified stateful programming: Remove heap model and witness/recall, etc#4155
nikswamy merged 12 commits intofstar2from
_fstar2_no_monotonic_heap

Conversation

@nikswamy
Copy link
Copy Markdown
Collaborator

@nikswamy nikswamy commented Apr 1, 2026

With this PR, the only recommended way to build verified programs with mutable heaps is to use Pulse.

Replace the heap-based ST/ML effects with underspecified versions that are decoupled from any concrete heap model. The new FStar.All.fsti defines:

  • STATE = DIV (underspecified state, same WP as DIV)
  • ALL = EXN (underspecified state+exceptions, same WP as EXN)
  • Abstract ref type with assumed hasEq and strictly_positive attribute
  • Underspecified alloc/read/write operations
  • ML effect as trivial ALL, St effect as trivial STATE

Deleted modules:

  • FStar.Monotonic.Heap, FStar.Heap, FStar.ST, FStar.Ref, FStar.MRef
  • FStar.Monotonic.Witnessed, FStar.Witnessed.Core
  • FStar.MST, FStar.MSTTotal, FStar.NMST, FStar.NMSTTotal
  • FStar.SquashProperties, FStar.Tcp, FStar.Udp
  • ulib/legacy/ (Array, Axiomatic.Array, TwoLevelHeap, Relational.*)
  • Restored FStar.Constructive, FStar.ErasedLogic, FStar.Matrix2, FStar.Error from legacy/ to ulib/ (no heap dependencies)

Deleted examples/tests using heap model:

  • examples/preorders/ (entire directory)
  • examples/old/csl/, examples/old/seplogic/
  • examples/layeredeffects/HoareST*, RW, LatticeEff, are updated to use a SimpleHeap, without preorders
  • Various heap-dependent test files

Updated examples/tests to use FStar.All instead of FStar.ST/Heap/Ref.

Modules in examples/old ulib/legacy etc. have been deleted.

Some modules from ulib/experimental are now in ulib

nikswamy and others added 12 commits April 1, 2026 08:37
…ects

Replace the heap-based ST/ML effects with underspecified versions that are
decoupled from any concrete heap model. The new FStar.All.fsti defines:
- STATE = DIV (underspecified state, same WP as DIV)
- ALL = EXN (underspecified state+exceptions, same WP as EXN)
- Abstract ref type with assumed hasEq and strictly_positive attribute
- Underspecified alloc/read/write operations
- ML effect as trivial ALL, St effect as trivial STATE

Deleted modules:
- FStar.Monotonic.Heap, FStar.Heap, FStar.ST, FStar.Ref, FStar.MRef
- FStar.Monotonic.Witnessed, FStar.Witnessed.Core
- FStar.MST, FStar.MSTTotal, FStar.NMST, FStar.NMSTTotal
- FStar.SquashProperties, FStar.Tcp, FStar.Udp
- ulib/legacy/ (Array, Axiomatic.Array, TwoLevelHeap, Relational.*)
- Restored FStar.Constructive, FStar.ErasedLogic, FStar.Matrix2,
  FStar.Error from legacy/ to ulib/ (no heap dependencies)

Deleted examples/tests using heap model:
- examples/preorders/ (entire directory)
- examples/old/csl/, examples/old/seplogic/
- examples/layeredeffects/HoareST*, RW, LatticeEff
- Various heap-dependent test files

Updated examples/tests to use FStar.All instead of FStar.ST/Heap/Ref.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- ExampleHeap.fsti/.fst: Simple heap model where ref a is abstract
  (internally a positive nat), heap is a map from addresses to typed
  cells, with sel/upd/alloc/contains operations. sel/upd require a
  contains precondition.

- ExampleST.fst: Instantiates STATE_h with ExampleHeap.heap, providing
  ExST effect with assumed get/put/st_alloc/st_read/st_write actions.

- HoareST.fst: Hoare-style layered effect built on top of ExST, with
  library with index, upd, length, swap, and concatenation.

- TestHoareST.fst: Tests adapted from the original, covering pure lifts,
  bind composition, pattern matching, reification, and heap operations.

The original HoareST/TestHoareST files were deleted when removing
FStar.Monotonic.Heap. These restored versions use ExampleHeap instead,
without preorders or witness/recall. HoareSTPolyBind, LatticeEff, and
RW are not restored as they require deeper changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adapt the three deleted examples to use ExampleHeap/ExampleST/ExampleALL
instead of FStar.Heap/FStar.ST/FStar.All:

- HoareSTPolyBind.fst: Polymonadic binds between PURE and HoareST,
  adapted to use ExST. Removed recall/mref/preorder usage. Added
  contains preconditions to array operations.

- RW.fst: Read-only vs read-write indexed effect tracking, adapted to
  use ExST as the base state effect instead of FStar.ST.

- LatticeEff.fst: Lattice of effect labels (WR, EXN) with repr over
  ExALL (ALL_h ExampleHeap.heap). Includes catch/try_with.

- ExampleALL.fst: Instantiates ALL_h with ExampleHeap.heap, providing
  ExALL effect with get/put/raise/st_read/st_write actions, and a
  sub_effect from ExST to ExALL.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Move ExampleHeap.fsti/.fst from examples/layeredeffects/ to
  ulib/FStar.SimpleHeap.fsti/.fst
- Remove the unused contains_decidable assumption
- Update all layered effect examples to use FStar.SimpleHeap
- Restore examples/native_tactics/Simplifier.fst with:
  - Pure logic simplification tests (unchanged from original)
  - Stateful tests using FStar.All's underspecified ST effect
  - Native plugin extraction and loading works

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…aml support

- Remove examples/crypto/ (depends on deleted heap model)
- Remove doc/old/ and doc/ref/ (stale documentation)
- Remove tests that depend on old ALL/ST WP shape with heap args:
  Bug581, Bug623, Neg, Unit1.Basic
- Fix tests/micro-benchmarks/MAC.fst: ST.alloc -> alloc
- Fix tests/machine_integers/TestShift.fst: increase rlimit for
  underspecified ML effect
- Add ref, alloc, op_Bang, op_Colon_Equals, try_with to
  ulib/ml/app/FStar_All.ml for OCaml extraction support

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
It is only used by the layered effect examples, not by ulib or
anything else, so it belongs in examples/.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
These modules are clean (no admits/assumes), well-tested, and already
depended on by ulib/FStar.OrdSetProps.fst. Move them out of experimental.

Remaining in experimental:
- FStar.Reflection.Typing: has admits, not yet production-ready
- FStar.Sequence.*: clean but unused outside experimental
- FStar.Universe.PCM: clean but unused outside experimental
- FStar.ConstantTime.Integers: clean but only used by tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ulib

Clean modules with no admits. Move them out of experimental.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Stale examples that are no longer maintained.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The tools/ directory only contained diff_smt2.sh. Move it to .scripts/
where other project scripts live.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nikswamy nikswamy merged commit 0a89ee6 into fstar2 Apr 2, 2026
14 checks passed
@nikswamy nikswamy deleted the _fstar2_no_monotonic_heap branch April 2, 2026 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant