Skip to content

feat(puddle): add denotational validity - #1470

Merged
math-fehr merged 1 commit into
mainfrom
math-fehr/puddle-validity
Sep 18, 2026
Merged

math-fehr merged 1 commit into
mainfrom
math-fehr/puddle-validity

Conversation

@math-fehr

Copy link
Copy Markdown
Collaborator

This change adds Pattern.PreservesSemantics, a proposition that asserts that a puddle pattern is semantically valid. With this, we can prove (in a separate PR) that once the pattern is compiled, it satisfies LocalRewritePattern.PreservesSemantics.

This change also creates simpPuddleSemantics, a simplification tactic to remove all the PreservesSemantics definitions, so the only has a clean goal to prove.

@tobiasgrosser

tobiasgrosser commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

CI failure:

 trace: .> LEAN_PATH=/home/runner/work/veir/veir/.lake/packages/Coinductive/.lake/build/lib/lean:/home/runner/work/veir/veir/lean-ctrees/.lake/build/lib/lean:/home/runner/work/veir/veir/ExArray/.lake/build/lib/lean:/home/runner/work/veir/veir/.lake/build/lib/lean /home/runner/.elan/toolchains/leanprover--lean4---v4.33.0/bin/lean --tstack=400000 /home/runner/work/veir/veir/UnitTest/Puddle.lean -o /home/runner/work/veir/veir/.lake/build/lib/lean/UnitTest/Puddle.olean -i /home/runner/work/veir/veir/.lake/build/lib/lean/UnitTest/Puddle.ilean -c /home/runner/work/veir/veir/.lake/build/ir/UnitTest/Puddle.c --setup /home/runner/work/veir/veir/.lake/build/ir/UnitTest/Puddle.setup.json --json
    error: UnitTest/Puddle.lean:36:23: Function expected at
      RuntimeValue.Conforms.integerType
    but this term has type
      RuntimeValue.Conforms ?m.68 ⟨Attribute.integerType ?m.69, ?m.70⟩ ↔
        ∃ val, ?m.68 = RuntimeValue.int (IntegerType.bitwidth ?m.69) val
    
    Note: Expected a function because this term is being applied to the argument
      hx
    error: UnitTest/Puddle.lean:36:11: Tactic `rcases` failed: `x✝ : ?m.72` is not an inductive datatype
    error: Lean exited with code 1
    Some required targets logged failures:
    - UnitTest.Puddle

... i guess this is still WIP - I wait until this is marked ready-for-review ..

@math-fehr

Copy link
Copy Markdown
Collaborator Author

Yes, I am fixing the tactic a bit (not the final version of the tactic, but at least something that works) before marking this ready. I shouldn't have requested review on a draft PR though.
Anything besides the tactic is fixed though

Base automatically changed from math-fehr/ordered-puddle-decls to main September 15, 2026 14:39
@math-fehr
math-fehr force-pushed the math-fehr/puddle-validity branch from 02e366e to 0f7a147 Compare September 15, 2026 14:52
@math-fehr
math-fehr marked this pull request as ready for review September 15, 2026 14:52
@math-fehr

Copy link
Copy Markdown
Collaborator Author

Should be good now

@math-fehr
math-fehr force-pushed the math-fehr/puddle-validity branch from 0f7a147 to deccd03 Compare September 16, 2026 15:03
@math-fehr

Copy link
Copy Markdown
Collaborator Author

@tobiasgrosser gentle ping on this, it should be ready for review now

@tobiasgrosser tobiasgrosser left a comment •

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.

Nice. We should probably organize a code-walk? But good to go for now.

@ineol ineol left a comment

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.

Really cool! only minor naming comments

Comment thread Veir/PatternRewriter/Puddle/Validity.lean Outdated
Comment thread Veir/PatternRewriter/Puddle/Validity.lean Outdated
Comment thread Veir/PatternRewriter/Puddle/Validity.lean Outdated
Comment thread Veir/PatternRewriter/Puddle/Validity.lean Outdated
Comment thread Veir/PatternRewriter/Puddle/Validity.lean Outdated
Comment thread Veir/PatternRewriter/Puddle/Validity.lean Outdated
Comment thread Veir/PatternRewriter/Puddle/Validity.lean
@math-fehr
math-fehr force-pushed the math-fehr/puddle-validity branch from deccd03 to 86cdd32 Compare September 18, 2026 13:28
@math-fehr
math-fehr force-pushed the math-fehr/puddle-validity branch from 86cdd32 to 8e1fe7d Compare September 18, 2026 13:57
@math-fehr
math-fehr added this pull request to the merge queue Sep 18, 2026
Merged via the queue into main with commit cc0166b Sep 18, 2026
6 checks passed
@math-fehr
math-fehr deleted the math-fehr/puddle-validity branch September 18, 2026 14:25
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