Skip to content

Conversation

@fabiomadge
Copy link
Contributor

Summary

Expands the Laurel language with additional operators, data types, and verification constructs. Improves formatting across multiple dialects.

Key Changes

Laurel Grammar & Translator

  • New operators: -, *, /, %, /t, %t (truncating), ==>, !, unary -
  • Array support: Array<T> type, indexing, length
  • Sequence operations: Seq.From, Seq.Take, Seq.Drop, Seq.Contains
  • Constrained types with constraint injection into quantifiers
  • Quantifiers: forall, exists
  • While loops with multiple invariants
  • Multiple requires/ensures clauses per procedure
  • Metadata (StmtExprMd, HighTypeMd) threaded through AST

Infrastructure

  • NewlineSepBy separator type for formatting preservation
  • Java codegen: list separator preservation, SourceRange overloads
  • Improved pretty printing for C_Simp, B3, Core

CLI Commands

  • laurelParse, laurelAnalyze, laurelToCore, laurelPrint

Bug Fixes

  • Fixed insideCondition flag not resetting after conditionals
  • Fixed SMT encoding for multi-argument functions and Map type
  • Added substFvarLifting for proper de Bruijn index handling

Tests

  • Reorganized Laurel tests T01-T17
  • Added regression test for assignment lifting

@fabiomadge fabiomadge force-pushed the jverify-strata-backend branch from 2924fc9 to 8122075 Compare February 6, 2026 00:52
…t assignments

Feature changes:
- Assign AST now takes a list of targets for multi-output procedure calls
- Remove Determinism enum from Body.Opaque
- TField replaced with TTypedField carrying the value type
- Heap parameterization uses explicit $heap_in/$heap_out parameters
  instead of a single global $heap variable
- Heap-writing calls in expressions produce multi-target assignments
- Expression assignment lifting uses per-variable snapshots for
  correct evaluation order
- Composite type parsing implemented (was a TODO)
- New tests: caller, expression-context heap calls, sequential
  mutations, implicit equality

Bug fixes:
- Remove stale $heap global references in LaurelToCoreTranslator
- Remove unused global $heap variable declaration and modifies clause
- Fix .get! crash in HeapParameterization FieldSelect read path
- Use actual callee return type for fresh variables instead of
  hardcoded TInt
- Fix incorrect .reverse in transformProcedureBody
- Remove dead SequenceM.setInsideCondition
@fabiomadge fabiomadge force-pushed the jverify-strata-backend branch 2 times, most recently from db4618f to 1ecb548 Compare February 10, 2026 01:51
# Conflicts:
#	Strata/DDM/Integration/Lean/Gen.lean
#	Strata/DL/Util/Func.lean
#	Strata/Languages/C_Simp/DDMTransform/Parse.lean
#	Strata/Languages/Laurel/Grammar/ConcreteToAbstractTreeTranslator.lean
#	Strata/Languages/Laurel/Grammar/LaurelGrammar.st
#	Strata/Languages/Laurel/HeapParameterization.lean
#	Strata/Languages/Laurel/Laurel.lean
#	Strata/Languages/Laurel/LaurelFormat.lean
#	Strata/Languages/Laurel/LaurelToCoreTranslator.lean
#	Strata/Languages/Laurel/LiftExpressionAssignments.lean
#	StrataTest/Languages/C_Simp/Examples/Coprime.lean
#	StrataTest/Languages/C_Simp/Examples/LinearSearch.lean
#	StrataTest/Languages/C_Simp/Examples/LoopSimple.lean
#	StrataTest/Languages/C_Simp/Examples/LoopTrivial.lean
#	StrataTest/Languages/C_Simp/Examples/Min.lean
#	StrataTest/Languages/C_Simp/Examples/SimpleTest.lean
#	StrataTest/Languages/C_Simp/Examples/Trivial.lean
#	StrataTest/Languages/Core/Examples/DDMAxiomsExtraction.lean
#	StrataTest/Languages/Laurel/Examples/Objects/T1_MutableFields.lean
@fabiomadge fabiomadge force-pushed the jverify-strata-backend branch from 1ecb548 to 7517b51 Compare February 10, 2026 01:53
- Remove dead mkStmtExprMdEmpty' in LiftExpressionAssignments
- Move duplicate StmtExprMd.sizeOf_val_lt theorem to Laurel.lean
- Restore type info in TTypedField formatting
- Fix StmtExprMd doc comment (was copy-pasted from HighTypeMd)
…necessary Strata. qualifications in MetaData
…lication

- Remove local boolImpliesOp duplicate; use Core.boolImpliesOp via open
- Remove dead translateParameterToCore (unused, superseded by WithCT variant)
- Remove dead HighType.isHeap (zero call sites)
- Remove dead fnTy binding (always none)
- Remove heapWriters param from translateStmt (never read, only forwarded)
- Fix isPureExpr: reject IfThenElse without else branch (wrong default in
  function translation path)
- Remove stale debug comment and blank line
…ent decreases/invariant in C_Simp while loops
Add HighTypeMd.sizeOf_val_lt lemma and use it to prove translateType
terminates. The remaining partial defs recurse through List StmtExprMd
which requires the same sizeOf bridging pattern that is a known issue
across the codebase (see PR #396).
Make translateTypeWithCT, translateSimpleExpr, translateSeqBounds,
translateExpr, collectConstrainedArrayAccesses, translateStmt, and
isPureExpr total using the match _h : e.val pattern with
StmtExprMd.sizeOf_val_lt + rw/simp in decreasing_by.

For list recursion (args.mapM, args.all, args.flatMap), use
args.attach.{mapM,all,flatMap} to provide membership proofs,
combined with List.sizeOf_lt_of_mem.

Only resolveBaseType remains partial (needs acyclicity assumption
on ConstrainedTypeMap).
…ion proofs

Replace 6 identical decreasing_by blocks with a shared tactic macro.
Also unify the two HighTypeMd decreasing_by proofs.
@fabiomadge fabiomadge marked this pull request as ready for review February 10, 2026 19:50
@fabiomadge fabiomadge requested a review from a team as a code owner February 10, 2026 19:50
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.

5 participants