Skip to content

Record literals implementation and proofs added - #5

Merged
ychtao merged 3 commits into
mainfrom
record
Jun 9, 2026
Merged

Record literals implementation and proofs added#5
ychtao merged 3 commits into
mainfrom
record

Conversation

@ychtao

@ychtao ychtao commented Jun 8, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds end-to-end support for CST record literals (Primary.rInits) by extending the CST definition, implementing translation to AST records, defining CST evaluation semantics for records, and proving translation/evaluation agreement lemmas used by the existing translation correctness theorems.

Changes:

  • Extend Cedar.Spec.Cst.Primary with rInits and introduce Cst.RecInit.
  • Translate record literals to Expr.record via rInitsToMap? and add record-key validation (ExprOrSpecial.toValidAttr?).
  • Define CST-side record-key extraction (*.toAttr?) and record evaluation semantics, plus agreement proofs bridging CST evaluation and translated AST evaluation.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
cedar-lean/Cedar/Thm/Translation/ExprTranslation.lean Adds the rInits proof case for toAExpr?_evaluate, using the new record evaluation agreement lemma.
cedar-lean/Cedar/Thm/Translation/Aux.lean Adds record-key consistency lemmas and evaluation-bridge theorems needed to prove the rInits translation/evaluation agreement.
cedar-lean/Cedar/Spec/CstToAst.lean Implements record literal translation (rInitsToMap?) and record-key validation (ExprOrSpecial.toValidAttr?).
cedar-lean/Cedar/Spec/CstSemantics.lean Defines structural record-key extraction (Ident/Primary/Expr.toAttr?) and CST evaluation semantics for record literals.
cedar-lean/Cedar/Spec/Cst.lean Adds Primary.rInits and the RecInit structure to represent record initializers in the CST.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

(o.bind (fun a => some (ExprOrSpecial.expr (g a)))).bind ExprOrSpecial.toValidAttr? = none := by
cases o <;> simp [ExprOrSpecial.toValidAttr?]

set_option linter.unusedSimpArgs false in

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need this option in the final proof?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't plan to. I wanted to delete it but then forgot. I'll remove it in the next pull request.

@ychtao
ychtao merged commit 8778206 into main Jun 9, 2026
1 check passed
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.

3 participants