Skip to content

Comments

Add Generator for Cedar Terms#43

Merged
ngernest merged 29 commits intometaprogrammingfrom
cedar
Aug 15, 2025
Merged

Add Generator for Cedar Terms#43
ngernest merged 29 commits intometaprogrammingfrom
cedar

Conversation

@ngernest
Copy link
Owner

@ngernest ngernest commented Aug 14, 2025

This PR adds a Lean formalization of a subset of Cedar to the list of examples in the Test directory.

Relevant files:

Note: Chamelean can only handle 23 out of the 41 typing rules -- if we give it all 41 typing rules, it takes > 5 minutes to derive a generator.

The remaining 18 rules which Chamelean takes too long to handle are rules involving multiple constraints expressed via auxiliary relations, e.g.:

-- Chamelean has trouble handling the `TContainsAll` constructor since it involves multiple constraints
-- expressed via auxiliary inductive relations, e.g. `DefinedEntities`, `WfCedarType`, `SubType`
inductive HasType : PathSet → Environment → (CedarExpr × PathSet) → CedarType → Prop where
| TContainsAll : ∀ a x1 x2 V E1 E2 ets acts R ns T1 T2 T,
    V = (Environment.MkEnvironment (Schema.MkSchema ets acts) R) →
    DefinedEntities ets ns →
    WfCedarType ns T →
    SubType T1 T → SubType T2 T →
    HasType a V (E1, x1) (CedarType.setType T1) →
    HasType a V (E2, x2) (CedarType.setType T2) →
    HasType a V ((CedarExpr.binaryApp BinaryOp.containsAll E1 E2), PathSet.somepaths []) (CedarType.boolType BoolType.anyBool)
| ...

Since some of the typing rules have been commented out, the generator for Cedar terms doesn't produce well-typed terms at the moment (see the comments in CedarWellTypedTermGenerator.lean for details).

@ngernest ngernest changed the title WIP: Test Chamelean on Cedar Formalization Add Generator for Well-Typed Cedar Terms Aug 15, 2025
@ngernest ngernest marked this pull request as ready for review August 15, 2025 19:51
@ngernest ngernest merged commit 449caa1 into metaprogramming Aug 15, 2025
2 checks passed
@ngernest ngernest deleted the cedar branch August 15, 2025 19:52
@ngernest ngernest changed the title Add Generator for Well-Typed Cedar Terms Add Generator for Cedar Terms Aug 15, 2025
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