Skip to content

Add contextual rewrite-pattern selection#955

Open
strub wants to merge 2 commits intomainfrom
rw-pattern-ctxt
Open

Add contextual rewrite-pattern selection#955
strub wants to merge 2 commits intomainfrom
rw-pattern-ctxt

Conversation

@strub
Copy link
Copy Markdown
Member

@strub strub commented Mar 26, 2026

Allow rewrite patterns to designate a subterm inside a
larger context with the [x in pattern] syntax.

This lets rewrite target exactly the occurrence named by
the surrounding context, and adds regression coverage for
that form.

The context variable must appear exactly once in the pattern
(linearity check). Delta expansion and conversion are disabled
during contextual pattern matching to ensure position computation
remains sound.

@strub strub self-assigned this Mar 26, 2026
@strub strub force-pushed the rw-pattern-ctxt branch 5 times, most recently from f8233fc to c4fd44b Compare April 9, 2026 11:24
strub added 2 commits April 11, 2026 07:30
Add two new flags for the `easycrypt` CLI to support LLM coding agents:
- `-upto <pos>`: compile up to a given position and print goals there
- `-lastgoals`: print the last unproven goals

Also add a dedicated `llm` command mode and an LLM agent guide
(doc/llm/CLAUDE.md) documenting EasyCrypt tactics and workflow for
use with AI coding assistants.
Allow rewrite patterns to designate a subterm inside a
larger context with the [x in pattern] syntax.

This lets rewrite target exactly the occurrence named by
the surrounding context, and adds regression coverage for
that form.

The context variable must appear exactly once in the pattern
(linearity check). Delta expansion and conversion are disabled
during contextual pattern matching to ensure position computation
remains sound.
@strub strub force-pushed the rw-pattern-ctxt branch from c4fd44b to 7c7d74a Compare April 13, 2026 11:33
@Gustavo2622 Gustavo2622 self-requested a review April 13, 2026 11:38
let ctxt_modes =
match subl with
| None -> modes
| Some _ -> [{ k_keyed = true; k_conv = false; k_delta = false }]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-rewriting should be enforced more strictly to try to reduce future breaks. Maybe refactor into separate helper function to contain dependency?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants