Skip to content

Conversation

@joscoh
Copy link
Contributor

@joscoh joscoh commented Jan 30, 2026

Description of changes:
This PR adds a mechanism for mutually recursive types to the DDM and uses that to implement mutually recursive datatypes in Strata Core's concrete syntax.

This mechanism involves two changes to the DDM:

  1. Adds a "forward type declaration" to the DDM. This produces types which are added to the global context but which do not produce AST nodes. This prevents the problem of trying to handle forward references to mutually recursive types via multiple passes.
  2. Adds a name field to .fvar. This arises from the fact that there is no longer a 1-1 mapping between decls and global names, since a mutual block decl defines multiple names. This name field is used to look up the specific datatype in the mutual block in Core/DDM/Translate.lean.

This PR also refactors some of the datatype handling in Core/DDM/Translate.lean to abstract common functionality for single datatypes and mutual blocks, fixes an issue where datatype names were added to the context as type variables, and includes tests demonstrating the new DDM features in StrataTest/DDM/MutualDatatypes.lean and tests implementing the full verification pipeline in StrataTest/Languages/Core/Examples/MutualDatatypes.lean.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Josh Cohen added 17 commits January 28, 2026 13:58
No polymorphism yet
Add forward declarations to DDM
Add name to fvar to keep track within block
Change Translate to translate to mutual blocks
Add rose tree test
Fix poly+destructor names+mutual rec
Add some more tests
Temp - fix bug in SMT poly encoding
Make datatypes handle type arguments appropriately in parser
Remove scoping workaroudn with local/declared
Some formatting fixes
Factor out common functionality with mutual/single datatypes
Require that mutual datatypes are forward declared
@joscoh joscoh requested a review from a team as a code owner January 30, 2026 17:32
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