Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
426 commits
Select commit Hold shift + click to select a range
8dbe5c3
[refactor] Fix tuple unpack scope hoisting + needsDecl for Hole assigns
ssomayyajula May 7, 2026
fa50d0b
[refactor] FieldSelect without heap must fail (forces heap grade disc…
ssomayyajula May 7, 2026
664ea37
[refactor] Move procGrades from ElabState to ElabEnv (reader)
ssomayyajula May 7, 2026
230cbf5
[refactor] Add synthValue grade check: grade(f)=1 for value calls
ssomayyajula May 7, 2026
16eed39
[refactor] Add checkArgsK for ANF lifting (unused — causes regressions)
ssomayyajula May 7, 2026
0aa6d0d
[refactor] Handle Opaque proc bodies + ANF fallback infrastructure
ssomayyajula May 7, 2026
3627e35
[refactor] Add runtime field to ElabEnv + Opaque body handling
ssomayyajula May 7, 2026
f5a922b
[refactor] Pre-compute runtime error grades for multi-output procs
ssomayyajula May 7, 2026
080ebb1
[refactor] Cleanup: revert checkArgsK as default (causes regressions)
ssomayyajula May 7, 2026
60ec17a
[refactor] Add discoveryMode flag to ElabState
ssomayyajula May 7, 2026
be11c24
[refactor] Fix checkArgsK excess-args handling (self param)
ssomayyajula May 7, 2026
0752b24
[refactor] Fix TFloat64 Core translation + Field constructor naming
ssomayyajula May 7, 2026
6b2895c
[refactor] discoverGrade skips isFunctional procs + excess-args fix
ssomayyajula May 7, 2026
5795a74
[refactor] Grade from runtime output signature + defunctionalized syn…
ssomayyajula May 7, 2026
17a8d55
[refactor] Two-pass elaboration: synth grades first, then check
ssomayyajula May 7, 2026
aec12c7
[doc] Architecture: coinductive fixpoint grade inference, textbook ty…
ssomayyajula May 8, 2026
00932d6
[refactor] Textbook typing rules + coinductive fixpoint grade inference
ssomayyajula May 8, 2026
17b6cdf
[refactor] checkArgsK with sig/none split (interim state)
ssomayyajula May 8, 2026
03b1873
[refactor] User/runtime separation: full TypeEnv to elaboration, stru…
ssomayyajula May 8, 2026
e55756f
[refactor] FGL terms carry source metadata (correct by construction)
ssomayyajula May 8, 2026
1682b8f
[doc] Architecture: metadata by construction, eraseType, gradeFromSig…
ssomayyajula May 8, 2026
1a1f7ea
[doc] Architecture: prose overview, FGCBV/graded effects/bidir typing…
ssomayyajula May 8, 2026
31ce878
[doc] Architecture: analytical comparison with old pipeline, current …
ssomayyajula May 8, 2026
63c055c
[doc] Architecture: correct false claim — 4 new passes are vacuous (0…
ssomayyajula May 8, 2026
49d04e6
[refactor] Labeled blocks: thread continuation AFTER block, not inside
ssomayyajula May 8, 2026
671e1b9
[refactor] If/else with continuation field, no duplication
ssomayyajula May 8, 2026
35dade4
[refactor] IfThenElse in elabAssign + subscript assignment translation
ssomayyajula May 8, 2026
11c5705
[refactor] __main__ metadata + slice translation + constructor FuncSigs
ssomayyajula May 8, 2026
dc6de05
[refactor] Self typing in method FuncSigs + BoxAny for Any-typed fields
ssomayyajula May 8, 2026
5d48cdd
[refactor] New: coerce Composite→targetTy, Block RHS desugaring
ssomayyajula May 8, 2026
af913d5
[doc] Architecture: fill all gaps before elaborator rewrite
ssomayyajula May 8, 2026
43b4a5c
[refactor] Elaborator rewrite: proc grade with declared outputs
ssomayyajula May 8, 2026
d881fda
[refactor] Unified mkGradedCall: all grades use declared outputs
ssomayyajula May 8, 2026
5583454
[doc+code] Architecture: illegal states unrepresentable, no strings, …
ssomayyajula May 8, 2026
0a02ff3
[doc] Architecture: fix stale refs, engineering principles at top, fr…
ssomayyajula May 8, 2026
da0db1f
[refactor] Zero crashes: Union types → Any, unresolved methods → Hole…
ssomayyajula May 8, 2026
e05d1ab
[doc] Architecture: update status — zero crashes, 4 encoding gaps remain
ssomayyajula May 8, 2026
038f674
[doc] Executive summary rewrite: evidence-driven case for the refactor
ssomayyajula May 8, 2026
11eaf2a
[doc] Executive summary: fact-check PR claims against GitHub
ssomayyajula May 8, 2026
02a6fea
[doc] Executive summary: sober rewrite, single-source-of-truth framing
ssomayyajula May 8, 2026
62a397c
[doc] Executive summary: correct PR #835 description (lifting discipl…
ssomayyajula May 8, 2026
edfb827
[doc] Executive summary: verify and correct PR #918 description
ssomayyajula May 8, 2026
bcd16ac
[doc] Executive summary: compare with existing doc PRs (#1136, #1144)
ssomayyajula May 8, 2026
e5ff03a
[doc] Executive summary: soften tone on existing doc PRs
ssomayyajula May 8, 2026
f577652
[doc] Executive summary: note undocumented tech debt and coverage gaps
ssomayyajula May 8, 2026
3b917c1
[doc] Executive summary: frame coercion as representative of endemic …
ssomayyajula May 8, 2026
d6276d6
[doc] Executive summary: rename section 1 to reflect endemic error fr…
ssomayyajula May 8, 2026
b4577cf
[doc] Traceability table + Python construct coverage
ssomayyajula May 8, 2026
d209814
[doc] Executive summary: highlight explicit Python coverage as sellin…
ssomayyajula May 8, 2026
975c2a1
[doc] Executive summary: cleanup pass (tighten section 5, fix traceab…
ssomayyajula May 8, 2026
ea206df
[doc] Executive summary: blast radius containment enables front-end v…
ssomayyajula May 8, 2026
1d01626
[doc] Executive summary: add context paragraph before traceability table
ssomayyajula May 8, 2026
42f6ef1
[doc] Executive summary: add vignette — proc grade bug diagnosed via …
ssomayyajula May 8, 2026
5949a41
[doc] Executive summary: agentic flow, review cost, predictability ar…
ssomayyajula May 8, 2026
cb89890
[doc] Expand new architecture section + define GFGL acronym
ssomayyajula May 8, 2026
ade7ae1
[doc] Architecture: consistent GFGL definition throughout
ssomayyajula May 8, 2026
56c304a
[doc] Architecture: GFGL = Graded Fine-Grain Laurel (based on graded …
ssomayyajula May 8, 2026
bfaa66c
[doc] Executive summary: 1 lowering pass (Laurel→GFGL), not 0
ssomayyajula May 8, 2026
3434f4c
[doc] Remove HOAS jargon from exec summary, fix FGL→GFGL everywhere
ssomayyajula May 8, 2026
1ea2f3b
[doc] Replace "coinductive fixpoint iteration" with "coinduction on t…
ssomayyajula May 8, 2026
311e8be
[doc] Architecture: remove all "fixpoint" — just say coinduction
ssomayyajula May 8, 2026
8331595
[doc] Architecture: reframe status as parity with old pipeline (42/46…
ssomayyajula May 8, 2026
3e6f6fe
[doc] Executive summary: benchmark fluctuation without traceable cause
ssomayyajula May 8, 2026
d7d14df
[doc] Executive summary: tone down — ask is about continuing developm…
ssomayyajula May 8, 2026
95a28e3
[doc] Executive summary: downplay refactor framing
ssomayyajula May 8, 2026
3538919
[doc] Rename docs/refactor → docs/architecture
ssomayyajula May 8, 2026
74d2b6e
[doc] Remove stale docs, replace "old pipeline" with "current pipeline"
ssomayyajula May 8, 2026
a5a7fe5
[doc] Rename ARCHITECTURE_V2 → ARCHITECTURE, remove all "old pipeline"
ssomayyajula May 8, 2026
6fe37a5
[doc] Remove (v2) from architecture title
ssomayyajula May 8, 2026
83a05fb
[doc] Fix stale ARCHITECTURE_V2.md references in executive summary
ssomayyajula May 8, 2026
160f079
[doc] Fix GFGL = Graded Fine-Grain Laurel (not CBV) in executive summary
ssomayyajula May 8, 2026
6ce5ed6
[doc] Fix GGFGL typo → GFGL in architecture
ssomayyajula May 8, 2026
56fa08b
[doc] Architecture: fix test count (41/46 replicated, 4 gaps, 1 impro…
ssomayyajula May 8, 2026
c2912df
[doc] Architecture: revert count fix — was correct at 42/46 + 3 gaps …
ssomayyajula May 8, 2026
752899f
[doc] Update exec summary with benchmark time series, fix stale statu…
ssomayyajula May 8, 2026
bb021c1
[refactor] Architecture: elaboration as translation on derivations, f…
ssomayyajula May 11, 2026
3b03605
[doc] Architecture: rewrite elaboration as derivation-to-derivation t…
ssomayyajula May 11, 2026
4ee2b5a
[doc] Architecture: show continuation K in all producer clause inputs
ssomayyajula May 11, 2026
34f8224
[doc] Architecture: rewrite elaboration as four distinct translation …
ssomayyajula May 11, 2026
72772e5
[doc] Architecture: complete rewrite of elaboration — derivation tree…
ssomayyajula May 11, 2026
b4737f7
[doc] Architecture: three sections — Laurel types, GFGL types, elabor…
ssomayyajula May 11, 2026
519db1c
[doc] Laurel is impure CBV, not 'unsorted implicitly-effectful'
ssomayyajula May 11, 2026
6989271
[doc] Architecture: add producer synthesis and producer subsumption t…
ssomayyajula May 11, 2026
be1a844
[doc] Architecture: unified label/continuation treatment for exit and…
ssomayyajula May 11, 2026
f31ce2d
[doc] Architecture: rewrite GFGL type system and elaboration from scr…
ssomayyajula May 11, 2026
9669d80
[doc] Architecture: top-down elaboration rewrite, move unit to checking
ssomayyajula May 11, 2026
c9e7837
[doc] Architecture: complete rewrite of elaboration section from scratch
ssomayyajula May 11, 2026
8e440d2
[doc] Architecture: final elaboration rewrite — connected, no loose ends
ssomayyajula May 11, 2026
1889137
[doc] Architecture: final rewrite — labels typed, producer subsumptio…
ssomayyajula May 11, 2026
74c43c4
[doc] Architecture: complete rewrite from scratch
ssomayyajula May 11, 2026
eeb1e14
[doc] Architecture: full rewrite with all content restored
ssomayyajula May 11, 2026
cb7d626
Remove duplicate --- separators
ssomayyajula May 11, 2026
a05683b
Remove all --- separators
ssomayyajula May 11, 2026
356f92f
[doc] Fix producer subsumption and assignment clauses
ssomayyajula May 11, 2026
bb70c63
Remove orphaned duplicate gradeFromSignature (already in Grade Infere…
ssomayyajula May 11, 2026
acd7ff0
Fix entry point: bind params, body, returnType from procedure declara…
ssomayyajula May 11, 2026
f192142
[doc] Replace all prose-in-formal-context with rules
ssomayyajula May 11, 2026
d20a113
[doc] Add subgrading table, fix code block for remaining clauses
ssomayyajula May 11, 2026
a30e381
[doc] Fix all remaining formal errors in elaboration section
ssomayyajula May 11, 2026
fcda1af
[doc] Rewrite elaboration section: mode discipline, context growth, a…
ssomayyajula May 11, 2026
0eb8c3b
[doc] Restore ⟦Γ⟧ context translation throughout elaboration clauses
ssomayyajula May 11, 2026
b100e77
[doc] Fix elaboration description: inputs/outputs, inherited type/con…
ssomayyajula May 11, 2026
31e895c
[doc] Fix ⟦·⟧⇐ᵥ: not a separate function, just synth + subsume
ssomayyajula May 11, 2026
2a0baa9
[doc] Just give ⟦·⟧⇐ᵥ its signature
ssomayyajula May 11, 2026
ecb77e1
[doc] Fix ⟦·⟧⇐ᵥ signature: target is ⟦A⟧ from the derivation, not a f…
ssomayyajula May 11, 2026
56ec707
[doc] Restore witness tables for subgrading and subsumption
ssomayyajula May 11, 2026
025409b
[doc] Fix subgrading witness table, entry point, ⟦·⟧⇐ᵥ clause, remove…
ssomayyajula May 11, 2026
84eedd4
[doc] Unify subtyping/subgrading: adjacent sections, consistent A ≤ B…
ssomayyajula May 11, 2026
260ec03
[doc] Fix ⟦·⟧⇐ᵥ rule to match GFGL value checking: synth A, coerce A …
ssomayyajula May 11, 2026
c2c38fe
[doc] Fix ⟦·⟧⇐ᵥ rule: both types come from translation (⟦A⟧, ⟦B⟧)
ssomayyajula May 11, 2026
b475909
[doc] Fix mode discipline in translation signatures
ssomayyajula May 11, 2026
12f221b
[doc] Fix synthesis signatures to existentially quantify output type
ssomayyajula May 11, 2026
fdd471b
[doc] Fix translation signatures: ∃A. (Γ ⊢_L e : A) → ...
ssomayyajula May 11, 2026
69f0430
[doc] Fix all four translation signatures to proper mode discipline
ssomayyajula May 11, 2026
42b9d7f
[doc] Fix synthesis signatures: take Γ and e as inputs before ∃A
ssomayyajula May 11, 2026
ed71b2d
[doc] Type Γ and e in synthesis sigs, ∃(A' : HighType) with ⟦A'⟧ as o…
ssomayyajula May 11, 2026
f893e51
[doc] Fix Expr → StmtExpr in synthesis signatures
ssomayyajula May 11, 2026
6781d70
[doc] Fix prose to match new signatures: synth discovers A, check tak…
ssomayyajula May 11, 2026
84c9c9d
[doc] Fix resultIdx (0-indexed), fix ⟦·⟧⇐ᵥ clause to match signature
ssomayyajula May 11, 2026
ca5ce9f
[doc] Fix checking signatures: Laurel derivation at HighType A' where…
ssomayyajula May 11, 2026
664731d
[doc] Revert overcomplicated ⟦A'⟧=A nonsense, back to simple signatures
ssomayyajula May 11, 2026
8b21a75
[doc] Fix checking signatures: A : HighType, output at ⟦A⟧
ssomayyajula May 11, 2026
235c9b5
[doc] Rename eraseType section to "Translation on types (⟦·⟧)", remov…
ssomayyajula May 11, 2026
629aa32
[doc] Fix ⟦·⟧⇐ᵥ clause: checking target is ⟦A⟧ (matching signature)
ssomayyajula May 11, 2026
9391184
Thread retTy : HighType through checkProducer/elabRest/checkAssign
ssomayyajula May 11, 2026
ea60596
Fix elaborator to match architecture: Return, New, hole/havoc, multi-…
ssomayyajula May 11, 2026
e845d2a
Remove standalone New case — elaboration failure (breaks inversion)
ssomayyajula May 11, 2026
b3fac14
Remove unused retTy param from dispatchCall, clean up warnings
ssomayyajula May 11, 2026
d53c4f9
Replace args-exceed-params fallback with failure
ssomayyajula May 11, 2026
48108f4
Revert args-exceed-params failure — Translation doesn't guarantee ali…
ssomayyajula May 11, 2026
74828e8
Remove standalone New case — elaboration failure (breaks inversion)
ssomayyajula May 12, 2026
541c10f
Thread retTy : HighType through checkProducer/elabRest/checkAssign
ssomayyajula May 12, 2026
be621f1
Fix .Return to use synthExpr dispatch and check at retTy
ssomayyajula May 12, 2026
2a0dc13
synthValue Hole: emit $hole_N/$havoc_N staticCalls, declare in output…
ssomayyajula May 12, 2026
9395d58
[doc] Document tech debt: multi-output heuristic, hole post-hoc, entr…
ssomayyajula May 12, 2026
1a485ac
Fix unused variable warnings in NameResolution.lean
ssomayyajula May 12, 2026
7540065
Fix diff_test.sh: NEW_PIPELINE was pyAnalyzeLaurelRefactored (never e…
ssomayyajula May 12, 2026
93170de
[doc] Update status to 2026-05-11: 63/69 parity, 2 crashes, 4 inconcl…
ssomayyajula May 12, 2026
4719f3f
Add Any_type_to_Any to runtime (Python type() builtin)
ssomayyajula May 12, 2026
7624962
[doc] Move The Ask to top of executive summary
ssomayyajula May 12, 2026
d58f3fe
[doc] Streamline executive summary: Ask + context at top
ssomayyajula May 12, 2026
0240de0
[doc] Update executive summary status table to 2026-05-11 (63/69 parity)
ssomayyajula May 12, 2026
0e416e4
[doc] Fix status: 45/54 parity, 9 regressions (not 63/69)
ssomayyajula May 12, 2026
8d8983d
Fix hole declarations: UserDefined Any (not TCore), isFunctional true
ssomayyajula May 12, 2026
854827e
[doc] Update status: 52/54 parity after hole declaration fix
ssomayyajula May 12, 2026
e4f529c
[doc] Reframe The Ask: commit to architecture-driven development, not…
ssomayyajula May 12, 2026
e449356
[doc] Clean up executive summary: remove status, fix architecture sec…
ssomayyajula May 12, 2026
1e8bf8d
[doc] Reframe: structural problem (no architectural check), not contr…
ssomayyajula May 12, 2026
e885cfc
[doc] Rewrite pipeline section: formal type signatures, resolved AST …
ssomayyajula May 12, 2026
561db19
[doc] Update Overview + Translation section to match new pipeline design
ssomayyajula May 12, 2026
65035e1
[doc] Fix inconsistencies: GFGL output, projection in diagram, arg ma…
ssomayyajula May 12, 2026
622d176
[doc] Fix contradiction: Translation DOES match args to params using …
ssomayyajula May 12, 2026
a323ede
[doc] Fix: add project signature, ordered params (List not HashMap), …
ssomayyajula May 12, 2026
f8e7862
[doc] Fix pipeline types: elaborate is Laurel.Program → Laurel.Program
ssomayyajula May 12, 2026
79f2d68
[doc] Move Projection under Elaboration (it's an internal step, not a…
ssomayyajula May 12, 2026
90a40f9
[doc] Remove redundant "(internal to Elaboration)" from Projection he…
ssomayyajula May 12, 2026
1cae0f1
[doc] Remove 'state monad' language — Resolution is a fold with accum…
ssomayyajula May 12, 2026
68e43aa
[doc] Replace 'catamorphism' with 'fold' throughout
ssomayyajula May 12, 2026
2c3d237
[doc] Tech debt: Elaboration builds internal lookup from program decl…
ssomayyajula May 12, 2026
7f17646
Decouple Elaborate from NameResolution, new Resolution types
ssomayyajula May 12, 2026
4106c98
Full pipeline compiles: Resolution → Translation → Elaboration (no Ty…
ssomayyajula May 12, 2026
b7fd5b3
Rename NameResolution.lean → Resolution.lean
ssomayyajula May 12, 2026
5cd149d
Clean up Resolution types: proper abbreviations, fix ordering, remove…
ssomayyajula May 12, 2026
49f5f6c
Make pattern matching exhaustive in Resolution (no catch-all cases)
ssomayyajula May 12, 2026
854bb2d
Fix: nested FunctionDef/ClassDef bind their name as a local in enclos…
ssomayyajula May 12, 2026
1e82fdc
Fix: Import/ImportFrom bind names as locals in enclosing scope
ssomayyajula May 12, 2026
3d230e6
Fix: TypeAlias binds its name as a local
ssomayyajula May 12, 2026
22976f0
Remove catch-all from TypeAlias: use collectLocalsFromExpr (already e…
ssomayyajula May 12, 2026
3a78e59
Fix: NamedExpr binds target, For/While/AsyncFor include orelse blocks
ssomayyajula May 12, 2026
25ea0a6
Split collectLocalsFromExpr into collectNamesFromTarget + collectWalr…
ssomayyajula May 12, 2026
e3456a8
Walk all expression subterms for walrus bindings in collectLocalsFrom…
ssomayyajula May 12, 2026
bac17ce
[doc] Document incompleteness: match case pattern bindings not yet ex…
ssomayyajula May 12, 2026
eff8281
Add NameInfo.none variant, clean up resolve stub
ssomayyajula May 12, 2026
bc156ab
Add mapAnn helpers for AST annotation mapping, resolve still sorry
ssomayyajula May 12, 2026
8b63729
Implement full resolve traversal: AST annotation mapping + context th…
ssomayyajula May 12, 2026
7a95cbe
Fix: Assign/AnnAssign extend context with assigned variable names
ssomayyajula May 12, 2026
40218f0
Fix scoping: resolveBlock threads context sequentially, function bodi…
ssomayyajula May 12, 2026
0586514
Pre-compute module-level locals before resolving (same scoping as fun…
ssomayyajula May 12, 2026
1bf095d
[refactor] Resolution: fix bugs, add method resolution, register clas…
ssomayyajula May 13, 2026
27b94a3
[refactor] Translation: architecture-compliant rewrite consuming Reso…
ssomayyajula May 13, 2026
793bb20
[fix] Elaboration: register datatype constructors in env lookup
ssomayyajula May 13, 2026
bcd50a1
[fix] Translation: emit LocalVariable declarations for __main__ scope
ssomayyajula May 13, 2026
c2ea991
Revert "[fix] Translation: emit LocalVariable declarations for __main…
ssomayyajula May 13, 2026
6f299b1
[refactor] Resolution: expose moduleLocals on ResolvedPythonProgram
ssomayyajula May 13, 2026
eb850af
[test] Add class-body-level field annotations to class tests
ssomayyajula May 13, 2026
2ba07be
[doc+refactor] Architecture: NodeInfo redesign, Resolution produces L…
ssomayyajula May 13, 2026
a1a2d50
[refactor] Resolution: NodeInfo with Laurel.Identifier, correct by co…
ssomayyajula May 13, 2026
3450646
[refactor] Translation: pattern match on NodeInfo, no string fabrication
ssomayyajula May 13, 2026
7c55f2e
[fix] Resolution: annotate AugAssign with .operator callee
ssomayyajula May 13, 2026
1348c16
[wip] Resolution/Translation: fieldAccess, spine resolution, pure fun…
ssomayyajula May 13, 2026
b7239b9
[arch+wip] Phase distinction: Resolution stores Python-only data, acc…
ssomayyajula May 13, 2026
7ddeb73
[wip] Phase distinction implemented, 13 regressions remaining
ssomayyajula May 13, 2026
eb3c4a2
[wip] matchArgs moved to Resolution, fills defaults, 12 regressions
ssomayyajula May 13, 2026
e773f2a
[wip] Defaults are resolved expressions, matchArgs is a zip-fold, 17 …
ssomayyajula May 13, 2026
0562875
[wip] Top-level functions no longer treated as instance methods, 11 r…
ssomayyajula May 13, 2026
3e92ef8
[wip] Prepend receiver for method calls, 11 regressions (receiver not…
ssomayyajula May 13, 2026
5299121
[wip] Method calls and classNew properly pass receiver through matchA…
ssomayyajula May 13, 2026
1436750
[fix] toLaurel is identity — builtin mapping only in FuncSig.laurelName
ssomayyajula May 14, 2026
849186b
[cleanup] Remove dead code: mkLaurelId, insertParamIfMoreSpecific, is…
ssomayyajula May 14, 2026
44751d1
[arch] Revert with-statement corruption: __enter__/__exit__ are metho…
ssomayyajula May 14, 2026
dfeef0f
[feat] with-statement: resolve __enter__/__exit__ as method calls
ssomayyajula May 14, 2026
2900e4c
[test] test_with_void_enter: add class-body-level field annotation
ssomayyajula May 14, 2026
44a2dc4
[infra] diff_test.sh regenerates Ion files from Python sources automa…
ssomayyajula May 14, 2026
427e89d
[infra] Always regenerate Ion files unconditionally
ssomayyajula May 14, 2026
f2f203b
[test] test_with_statement: add class-body-level field annotation for…
ssomayyajula May 14, 2026
7babda4
[feat] Writer monad for Translation, classNew expression position
ssomayyajula May 14, 2026
cc1cce5
[feat] Operator sigs have correct params, Translation uses matchArgs
ssomayyajula May 14, 2026
c8a6876
[fix] Remove manual Any..as_int! coercions from slice handling
ssomayyajula May 14, 2026
a206ebe
[fix] FunctionDef/AsyncFunctionDef/ClassDef not included in computeLo…
ssomayyajula May 14, 2026
ab47bb3
[arch] Update Current Status section to reflect actual state
ssomayyajula May 14, 2026
13d9178
[arch] Update intermediate types to match actual code
ssomayyajula May 14, 2026
f3c18c5
[fix] Params as mutable locals: inputs get $in_ prefix, body uses bar…
ssomayyajula May 14, 2026
984808f
[arch] Update status: 4 regressions, document hole collection bug
ssomayyajula May 14, 2026
5d43963
[fix] Add usedHoles tracking for deterministic holes in checkAssign
ssomayyajula May 14, 2026
3876377
[fix] Hole declarations carry correct output type, collected at all s…
ssomayyajula May 14, 2026
6219ad8
[fix] Deduplicate hole declarations in allHoles aggregation
ssomayyajula May 14, 2026
5221d9c
[arch] Revert .attribute to bare name, document field access rule
ssomayyajula May 14, 2026
c941eb6
[arch] Elaboration architecture: GFGL type system, translation rules,…
ssomayyajula May 15, 2026
308e489
[elab] Complete implementation plan: writer monad, dead code removal
ssomayyajula May 15, 2026
6c534b8
[elab] Architectural rewrite: DPS projection, correct checkAssign, au…
ssomayyajula May 21, 2026
8e4fdd3
[elab] Fix regressions: holes, coercions, declaration hoisting, field…
ssomayyajula May 21, 2026
e2b85b4
[trans] Fix for-loop tuple unpacking: declare iterator temp variable
ssomayyajula May 21, 2026
96ae53d
[elab] Fix field access on non-class types (Any, UserDefined without …
ssomayyajula May 21, 2026
eac15cf
[trans] Extract leading asserts as preconditions
ssomayyajula May 21, 2026
257e13f
[res] Add importedContext parameter to Resolution.resolve
ssomayyajula May 21, 2026
da3f04f
[pipeline] WIP: stub loading infrastructure for import resolution
ssomayyajula May 21, 2026
aca8584
[pipeline] Import resolution: load stub Ions for imported modules
ssomayyajula May 21, 2026
00a4e0d
[test] Add Python stubs for imported modules (datetime, re, test_helper)
ssomayyajula May 21, 2026
f7f7495
[pipeline] Dynamic import resolution with module loading and caching
ssomayyajula May 29, 2026
5d4c1bb
[pipeline] Demand-driven import resolution: fully monadic resolveExpr
ssomayyajula Jun 1, 2026
dda122f
[pipeline] Overload resolution: match @overload signatures at call sites
ssomayyajula Jun 1, 2026
156f8e1
[pipeline] Query-based module resolution: index-only scan with thunke…
ssomayyajula Jun 1, 2026
abb365e
[pipeline] Query-based module resolution: per-method lazy, no caching
ssomayyajula Jun 5, 2026
06015e7
[pipeline] Emit demanded imported functions/classes; map Literal/Unpa…
ssomayyajula Jun 5, 2026
5c99db6
[pipeline] Resolve qualified return-type classes via submodule load
ssomayyajula Jun 5, 2026
a281f4f
[pipeline] Revert **kwargs-as-param (risked matchArgs); keep submodul…
ssomayyajula Jun 5, 2026
69eb0f9
[pipeline] Declare **kwargs input; rewrite precondition params to $in…
ssomayyajula Jun 5, 2026
3307ae0
[pipeline] Elaborate imported demanded methods (don't bypass the elab…
ssomayyajula Jun 5, 2026
163bca2
[pipeline] Prepend call receiver based on sig, not syntactic .Attribute
ssomayyajula Jun 5, 2026
70b97f2
[elaborate] Elaborate preconditions; apply deterministic holes to inputs
ssomayyajula Jun 5, 2026
3442096
[translate] Subscripted dict[...]/list[...] map to DictStrAny/ListAny
ssomayyajula Jun 5, 2026
cc1f5de
[elaborate] Holes in pure value position are deterministic; construct…
ssomayyajula Jun 5, 2026
402d873
[elaborate] Procedure bodies are commands: check at TVoid, optional p…
ssomayyajula Jun 5, 2026
f9ee82a
[elaborate] Make subtype a total case analysis of the coercion relation
ssomayyajula Jun 5, 2026
90c8fdb
[resolution] Saturate: function/class name in value position resolves…
ssomayyajula Jun 5, 2026
06c4bbb
[pipeline] Elaboration fails fast; saturate sys.argv and subscript au…
ssomayyajula Jun 5, 2026
1fe2b87
[cleanup] Remove stale dbg_trace in checkProducer catch-all; gen pyth…
ssomayyajula Jun 5, 2026
f15be96
[doc] Remove refactor-internal docs from the PR
ssomayyajula Jun 5, 2026
4f579e8
[doc] translateMinimal: document old resolve + inferHoleTypes as tech…
ssomayyajula Jun 6, 2026
972c2f4
[doc] Move old-resolver tech debt to PythonDoc Tech Debt section
ssomayyajula Jun 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,662 changes: 1,662 additions & 0 deletions Strata/Languages/FineGrainLaurel/Elaborate.lean

Large diffs are not rendered by default.

213 changes: 213 additions & 0 deletions Strata/Languages/FineGrainLaurel/FineGrainLaurel.dialect.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
// FineGrainLaurel Dialect: FGCBV (Fine-Grain Call-By-Value) with explicit polarity
// This dialect extends Laurel with separate Value and Producer categories,
// making polarity a representation-level invariant rather than a runtime predicate.
//
// Changes in this file are not automatically tracked by the build system.
// Modify FineGrainLaurel.lean (e.g. update its comment) to trigger a rebuild after changing this file.

dialect FineGrainLaurel;
// Note: Not importing Laurel for now - FineGrainLaurel is self-contained

// Import Laurel types for reuse
category LaurelType;
op intType : LaurelType => "int";
op boolType : LaurelType => "bool";
op realType : LaurelType => "real";
op float64Type : LaurelType => "float64";
op stringType : LaurelType => "string";
op coreType (name: Ident): LaurelType => "Core " name;
op mapType (keyType: LaurelType, valueType: LaurelType): LaurelType => "Map " keyType " " valueType;
op compositeType (name: Ident): LaurelType => name;

// ===========================================================================
// FGCBV Core: Separate Value and Producer categories
// ===========================================================================

// Value category: inert terms (no effects, can be duplicated/discarded)
category Value;

// Producer category: effectful terms (must be sequenced, single-use)
category Producer;

// ===========================================================================
// Value Operators (Inert Terms)
// ===========================================================================

// Literals
op valLiteralInt (n: Num): Value => n;
op valLiteralBool (b: Bool): Value => b;
op valLiteralReal (d: Decimal): Value => d;
op valLiteralString (s: Str): Value => s;

// Variables
op valVar (name: Ident): Value => name;

// Pure binary operations (no effects)
op valAdd (lhs: Value, rhs: Value): Value => @[prec(60), leftassoc] lhs " + " rhs;
op valSub (lhs: Value, rhs: Value): Value => @[prec(60), leftassoc] lhs " - " rhs;
op valMul (lhs: Value, rhs: Value): Value => @[prec(70), leftassoc] lhs " * " rhs;
op valDiv (lhs: Value, rhs: Value): Value => @[prec(70), leftassoc] lhs " / " rhs;
op valMod (lhs: Value, rhs: Value): Value => @[prec(70), leftassoc] lhs " % " rhs;

// Pure comparison operations
op valEq (lhs: Value, rhs: Value): Value => @[prec(40)] lhs " == " rhs;
op valNeq (lhs: Value, rhs: Value): Value => @[prec(40)] lhs " != " rhs;
op valLt (lhs: Value, rhs: Value): Value => @[prec(40)] lhs " < " rhs;
op valLe (lhs: Value, rhs: Value): Value => @[prec(40)] lhs " <= " rhs;
op valGt (lhs: Value, rhs: Value): Value => @[prec(40)] lhs " > " rhs;
op valGe (lhs: Value, rhs: Value): Value => @[prec(40)] lhs " >= " rhs;

// Pure logical operations
op valAnd (lhs: Value, rhs: Value): Value => @[prec(30), leftassoc] lhs " & " rhs;
op valOr (lhs: Value, rhs: Value): Value => @[prec(20), leftassoc] lhs " | " rhs;
op valNot (inner: Value): Value => @[prec(80)] "!" inner;

// Pure unary operations
op valNeg (inner: Value): Value => @[prec(80)] "-" inner;

// Field access (pure)
op valFieldAccess (obj: Value, field: Ident): Value => @[prec(90)] obj "#" field;

// Parenthesis (for grouping)
op valParens (inner: Value): Value => "(" inner ")";

// ===========================================================================
// Producer Operators (Effectful Terms)
// ===========================================================================

// Return a value (terminal producer)
op prodReturnValue (value: Value): Producer => @[prec(0)] "return " value:0;

// Call a procedure (effectful)
op prodCall (callee: Ident, args: CommaSepBy Value): Producer => callee "(" args ")";

// Let-binding for producers (sequence effects)
// let x: ty = prod in body
op prodLetProd (var: Ident, ty: LaurelType, prod: Producer, body: Producer): Producer =>
@[prec(0)] "let " var ": " ty " = " prod:0 " in " body:0;

// Let-binding for values (introduce binding for a value)
// let x: ty = value in body
op prodLetValue (var: Ident, ty: LaurelType, value: Value, body: Producer): Producer =>
@[prec(0)] "let " var ": " ty " = " value:0 " in " body:0;

// Assignment (mutation)
op prodAssign (target: Value, value: Value, body: Producer): Producer =>
@[prec(0)] target " := " value:0 ";" body:0;

// Variable declaration with initialization
op prodVarDecl (name: Ident, ty: LaurelType, init: Value, body: Producer): Producer =>
@[prec(0)] "var " name ": " ty " := " init:0 ";" body:0;

// Conditional (if-then-else)
op prodIfThenElse (cond: Value, thenBranch: Producer, elseBranch: Producer): Producer =>
@[prec(0)] "if " cond " then " thenBranch:0 " else " elseBranch:0;

// Assert (specification)
op prodAssert (cond: Value, body: Producer): Producer =>
@[prec(0)] "assert " cond:0 ";" body:0;

// Assume (specification)
op prodAssume (cond: Value, body: Producer): Producer =>
@[prec(0)] "assume " cond:0 ";" body:0;

// While loop
category Invariant;
op invariant (cond: Value): Invariant => "invariant " cond:0;

op prodWhile (cond: Value, invariants: Seq Invariant, body: Producer, after: Producer): Producer =>
@[prec(0)] "while (" cond ")" invariants " " body:0 after:0;

// Instantiation (heap allocation)
op prodNew (name: Ident, resultVar: Ident, ty: LaurelType, body: Producer): Producer =>
@[prec(0)] "let " resultVar ": " ty " = new " name " in " body:0;

// Call with error handling
op prodCallWithError (callee: Ident, args: CommaSepBy Value,
resultVar: Ident, errorVar: Ident,
resultTy: LaurelType, errorTy: LaurelType,
body: Producer): Producer =>
@[prec(0)] "let [" resultVar ": " resultTy ", " errorVar ": " errorTy "] = " callee "(" args ") in " body:0;

// Sequence (statement sequencing)
op prodSeq (first: Producer, second: Producer): Producer =>
@[prec(5)] first:5 ";" second:5;

// Block with multiple producers
op prodBlock (stmts: SemicolonSepBy Producer): Producer =>
@[prec(1000)] "{" stmts "}";

// Exit a labelled block (break/continue control flow)
op prodExit (label: Str): Producer => "exit " label;

// Labeled block (target of prodExit — models break/continue)
op prodLabeledBlock (label: Str, body: Producer): Producer =>
@[prec(0)] "block " label " {" body:0 "}";

// ===========================================================================
// Top-level Declarations (reuse Laurel structure)
// ===========================================================================

category Parameter;
op parameter (name: Ident, paramType: LaurelType): Parameter => name ":" paramType;

category ReturnParameters;
op returnParameters (parameters: CommaSepBy Parameter): ReturnParameters => "returns" "(" parameters ")";

category ErrorSummary;
op errorSummary (msg: Str): ErrorSummary => "summary" msg;

category RequiresClause;
op requiresClause (cond: Value, errorMessage: Option ErrorSummary): RequiresClause => "requires" cond:0 errorMessage;

category EnsuresClause;
op ensuresClause (cond: Value, errorMessage: Option ErrorSummary): EnsuresClause => "ensures" cond:0 errorMessage;

category ModifiesClause;
op modifiesClause (refs: CommaSepBy Value): ModifiesClause => "modifies" refs;

category ProcedureBody;
op procedureBody (body: Producer): ProcedureBody => body:0;
op externalBody: ProcedureBody => "external";

category Procedure;
op procedure (name: Ident, parameters: CommaSepBy Parameter,
returnParameters: Option ReturnParameters,
requires: Seq RequiresClause,
ensures: Seq EnsuresClause,
modifies: Seq ModifiesClause,
body: Option ProcedureBody): Procedure =>
"procedure " name "(" parameters ")" returnParameters requires ensures modifies body ";";

category Field;
op mutableField (name: Ident, fieldType: LaurelType): Field => "var " name ":" fieldType;
op immutableField (name: Ident, fieldType: LaurelType): Field => name ":" fieldType;

category Extends;
op extends (parents: CommaSepBy Ident): Extends => "extends " parents;

category Composite;
op composite (name: Ident, extending: Option Extends, fields: Seq Field, procedures: Seq Procedure): Composite =>
"composite " name extending "{" fields procedures "}";

// ===========================================================================
// Value-Level Coercion Operators (Subtyping: infallible, value→value)
// ===========================================================================

// Upcasts: inject concrete types into Any (pure injections into the sum type)
op valFromInt (inner: Value): Value => "from_int(" inner ")";
op valFromStr (inner: Value): Value => "from_str(" inner ")";
op valFromBool (inner: Value): Value => "from_bool(" inner ")";
op valFromFloat (inner: Value): Value => "from_float(" inner ")";
op valFromComposite (inner: Value): Value => "from_Composite(" inner ")";
op valFromListAny (inner: Value): Value => "from_ListAny(" inner ")";
op valFromDictStrAny (inner: Value): Value => "from_DictStrAny(" inner ")";
op valFromNone: Value => "from_None()";

// ===========================================================================
// Top-level Declarations
// ===========================================================================

// Top-level commands
op compositeCommand (composite: Composite): Command => composite;
op procedureCommand (procedure: Procedure): Command => procedure;
24 changes: 24 additions & 0 deletions Strata/Languages/FineGrainLaurel/FineGrainLaurel.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/-
Copyright Strata Contributors

SPDX-License-Identifier: Apache-2.0 OR MIT
-/
-- FineGrainLaurel dialect definition, loaded from FineGrainLaurel.dialect.st
-- NOTE: Changes to FineGrainLaurel.dialect.st are not automatically tracked by the build system.
-- Update this file (e.g. this comment) to trigger a recompile after modifying FineGrainLaurel.dialect.st.
-- Last grammar change: added prodExit for break/continue control flow preservation.

module

public import Strata.DDM.Integration.Lean
public meta import Strata.DDM.Integration.Lean

namespace Strata.FineGrainLaurel

public section

#load_dialect "./FineGrainLaurel.dialect.st"

#strata_gen FineGrainLaurel

end
2 changes: 1 addition & 1 deletion Strata/Languages/Laurel/FilterPrelude.lean
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private def addTypeName (name : String) : CollectM Unit :=
private partial def collectHighTypeNames (ty : HighTypeMd) : CollectM Unit := do
match ty.val with
| .UserDefined name => addTypeName name.text
| .TCore _ => pure ()
| .TCore name => addTypeName name
| .TTypedField vt => collectHighTypeNames vt
| .TSet et => collectHighTypeNames et
| .TMap kt vt => collectHighTypeNames kt; collectHighTypeNames vt
Expand Down
63 changes: 48 additions & 15 deletions Strata/Languages/Laurel/HeapParameterizationConstants.lean
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,40 @@ namespace Strata.Laurel
public section

/--
The Laurel Core prelude defines the heap model types and operations
used by the Laurel-to-Core translator. These declarations are expressed
in Laurel syntax via the `#strata program Laurel` macro and parsed into
a `Laurel.Program` at compile time.

The heap model uses:
- `Composite` - datatype with a reference (int) and a runtime type tag
- `Field` - abstract type for field names (zero-constructor datatype)
- `TypeTag` - abstract type for type tags (zero-constructor datatype)
- `Heap` - datatype with a `data` map and a `nextReference` for allocation
- `readField` / `updateField` / `increment` - heap access functions

Note: The `Box` datatype is generated dynamically by `heapParameterization`
based on which field types are actually used in the program.
The heap model runtime interface. These are the types and functions that
elaboration relies on when translating field access, field write, and
heap allocation.

Types:
```
datatype Composite { MkComposite(ref: int) }
datatype Heap { MkHeap(data: Map Composite (Map Field Box), nextReference: int) }
datatype Field { ... } (zero-arity constructors generated per class field)
datatype TypeTag { ... } (zero-arity constructors generated per class)
datatype Box { ... } (generated dynamically: BoxInt(intVal: int), BoxString(stringVal: string), etc.)
```

Functions (all pure, grade = pure):
```
readField : (Heap, Composite, Field) → Box
updateField : (Heap, Composite, Field, Box) → Heap
increment : (Heap) → Heap
MkComposite : (int) → Composite
MkHeap : (Map …, int) → Heap
Heap..data! : (Heap) → Map Composite (Map Field Box)
Heap..nextReference! : (Heap) → int
```

Datatype accessors/testers follow the DDM pattern:
```
$field.C.f : () → Field (zero-arity, one per class field)
C_TypeTag : () → TypeTag (zero-arity, one per class)
box_T : (T) → Box (e.g. BoxInt, BoxString, BoxComposite)
unbox_T : (Box) → T (e.g. Box..intVal!, Box..stringVal!)
```

Note: `Box` and `Field` constructors are generated dynamically by the
elaborator based on which field types and classes are actually used.
-/

private def laurelPreludeDDM :=
Expand Down Expand Up @@ -66,7 +86,20 @@ function increment(heap: Heap): Heap {

#end

/-- The Laurel Core prelude as a Laurel Program. -/
/-- The heap model runtime as a Laurel Program. Elaboration looks up
these functions when translating field access, field write, and allocation.
```
readField : (Heap, Composite, Field) → Box & pure
updateField : (Heap, Composite, Field, Box) → Heap & pure
increment : (Heap) → Heap & pure
MkComposite : (int, TypeTag) → Composite & pure
Heap..nextReference! : (Heap) → int & pure
$field.C.f : () → Field & pure (generated per class field)
C_TypeTag : () → TypeTag & pure (generated per class)
box_T : (T) → Box & pure (generated per field type used)
unbox_T : (Box) → T & pure (generated per field type used)
```
-/
def heapConstants : Program :=
match Laurel.TransM.run none (Laurel.parseProgram laurelPreludeDDM) with
| .ok program => program
Expand Down
Loading
Loading