Skip to content

Commit 34920a3

Browse files
shigoelclaudeMikaelMayer
authored
Rewrite Core language reference and add transforms doc (#1084)
## Summary - Rewrites `LangDefDoc.lean` as a proper 5-section language reference: Introduction, Lambda (syntax + type system), Imperative (commands, statements, KleeneStmt, metadata), Strata Core (expressions, built-in types, built-in operators, type declarations, ADTs, functions, recursive functions, axioms, commands, procedures, programs), and Semantics (Lambda operational + denotational, command, statement, KleeneStmt). - Adds `TransformsDoc.lean` documenting program transforms (`strata transform` CLI), analysis modes, and the SMT analysis pipeline. - Adds missing docstrings to `CmdExt`, `CallArg`, `Decl`, `Program`, `LSort`, `StepKleene`, and `StepKleeneStar` in the source. - Adds deprecation notes to `Datatypes.md`, `RecursiveFunctions.md`, and `VerificationModes.md` pointing to the canonical Verso docs. - Cross-document links point to rendered HTML output rather than GitHub source files. --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Mikael Mayer <mimayere@amazon.com>
1 parent d95396f commit 34920a3

13 files changed

Lines changed: 647 additions & 147 deletions

Strata/DL/Imperative/KleeneStmtSemantics.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ section
5252

5353
variable {CmdT : Type} (P : PureExpr) [HasBool P] [HasNot P]
5454

55+
/-- A single execution step for non-deterministic (Kleene) statements. -/
5556
inductive StepKleene
5657
(EvalCmd : EvalCmdParam P CmdT) :
5758
KleeneConfig P CmdT → KleeneConfig P CmdT → Prop where
@@ -113,6 +114,8 @@ end
113114

114115
/-! ## Multi-step relation -/
115116

117+
/-- Multi-step execution for non-deterministic statements: the reflexive,
118+
transitive closure of `StepKleene`. -/
116119
abbrev StepKleeneStar (P : PureExpr) [HasBool P] [HasNot P]
117120
(EvalCmd : EvalCmdParam P CmdT) :
118121
KleeneConfig P CmdT → KleeneConfig P CmdT → Prop :=

Strata/DL/Lambda/Denote/LExprDenote.lean

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ namespace Lambda
3333
variables. We use a separate type rather than `LMonoTy` to avoid carrying
3434
around proofs that a type has no type variables. -/
3535
public inductive LSort where
36+
/-- A named type constructor applied to sort arguments. -/
3637
| tcons (name : String) (args : List LSort)
38+
/-- A bit vector sort of the given size. -/
3739
| bitvec (size : Nat)
3840

3941
def LSort_eqb (s1 s2: LSort) : Bool :=

Strata/Languages/Core/Program.lean

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,17 @@ A Strata Core declaration.
4545
Note: constants are 0-ary functions.
4646
-/
4747
inductive Decl where
48+
/-- A type declaration (abstract type, type synonym, or algebraic datatype). -/
4849
| type (t : TypeDecl) (md : MetaData Core.Expression)
50+
/-- An axiom declaration. -/
4951
| ax (a : Axiom) (md : MetaData Core.Expression)
50-
-- The following is temporary, until we have lists and can encode `distinct` in Lambda.
52+
/-- A `distinct` assertion: the given expressions are pairwise distinct. -/
5153
| distinct (name : Expression.Ident) (es : List Expression.Expr) (md : MetaData Core.Expression)
54+
/-- A procedure declaration. -/
5255
| proc (d : Procedure) (md : MetaData Core.Expression)
56+
/-- A function declaration. -/
5357
| func (f : Function) (md : MetaData Core.Expression)
58+
/-- A mutually recursive function block. -/
5459
| recFuncBlock (fs : List Function) (md : MetaData Core.Expression)
5560
deriving Inhabited
5661

@@ -159,8 +164,9 @@ def Decl.formatWithMetaData (decl : Decl) : Format :=
159164

160165
@[expose] abbrev Decls := List Decl
161166

162-
/-- A Core.Program -/
167+
/-- A Core.Program is an ordered list of declarations. -/
163168
structure Program where
169+
/-- The declarations that make up this program. -/
164170
{ decls : Decls }
165171

166172
@[expose]

Strata/Languages/Core/Statement.lean

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,20 @@ A call argument is either an input expression, an in-out variable, or an
2929
output variable.
3030
-/
3131
inductive CallArg (P : PureExpr) where
32+
/-- An input argument: a by-value expression. -/
3233
| inArg (e : P.Expr)
34+
/-- An input-output argument: a mutable variable passed by reference. -/
3335
| inoutArg (id : P.Ident)
36+
/-- An output-only argument: a variable whose final value is returned to the caller. -/
3437
| outArg (id : P.Ident)
3538

3639
/--
3740
Extend Imperative's commands by adding a procedure call.
3841
-/
3942
inductive CmdExt (P : PureExpr) where
43+
/-- A standard imperative command. -/
4044
| cmd (c : Imperative.Cmd P)
45+
/-- A procedure call with the given name and arguments. -/
4146
| call (procName : String) (args : List (CallArg P))
4247
(md : MetaData P)
4348

docs/Datatypes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
> **Note:** The canonical reference for datatypes is now the
2+
> [Strata Core Language Definition](verso/LangDefDoc.lean) (Section 4, "Type Declarations").
3+
> This file is retained for additional detail not yet migrated. It may be removed in the future.
4+
15
# Datatypes in Strata
26

37
This document describes the datatype system in Strata Core.

docs/RecursiveFunctions.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
> **Note:** The canonical reference for recursive function syntax is now the
2+
> [Strata Core Language Definition](verso/LangDefDoc.lean) (Section 4, "Recursive Functions").
3+
> SMT encoding details are in [Transforms and Analysis](verso/TransformsDoc.lean).
4+
> This file is retained for additional detail not yet migrated. It may be removed in the future.
5+
16
# Recursive Functions in Strata
27

38
This document describes the recursive function infrastructure in Strata Core.

docs/VerificationModes.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
> **Note:** The canonical reference for verification modes is now
2+
> [Transforms and Analysis](verso/TransformsDoc.lean).
3+
> This file is retained for the detailed error classification table not yet migrated.
4+
> It may be removed in the future.
5+
16
# Verification Modes
27

38
Strata supports three verification modes, selected via `--check-mode`:

0 commit comments

Comments
 (0)