Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tactic] outline #473

Merged
merged 1 commit into from
Dec 15, 2023
Merged

[tactic] outline #473

merged 1 commit into from
Dec 15, 2023

Conversation

Cameron-Low
Copy link
Contributor

The main idea is to provide an inverse to inline when proving an equiv.

Currently, it supports basic procedure unification that requires manual selection of the program slice to unify with, as well as, requiring near exact matches on program structure. An optional return value can be supplied for situations where the return expression is just a program variable and needs to be renamed/deconstructed.

There is also support for statement outlining although, this is more of a transitivity * with program slicing so may require change.

Syntax and variants:

  • Procedure outlining: outline {m} [s - e] M.foo or outline {m} [s - e] M.foo @ lv
  • Statement outlining: outline {m} [s - e] { s1; s2; ... }

m: 1 or 2
s,e: code position
M.foo: path to procedure
lv: a left-value

when s = e, one can use [s] instead of [s-s]

For example usage see: examples/tactics/outline.ec

@fdupress
Copy link
Member

fdupress commented Dec 1, 2023

To note, this is part of the re-engineering of rewrite equiv into separate code matching and contextual call rewriting (as per discussions on the old PR).

Providing smarter code matching could help in reduction steps. Providing better contextual call rewriting could help in Hoare goals. (Where we rewrite a procedure call into another procedure on which we may already have a useful lemma.)

@fdupress
Copy link
Member

fdupress commented Dec 1, 2023

@Cameron-Low Not a fan of the @ notation for the LV. Does the following work?

outline {m} [s - e] lv <@ M.foo

@Cameron-Low
Copy link
Contributor Author

Without playing shift/reduce whack-a-mole, I can get outline {m} [s - e] lv <@ M.foo but for the non LV variant it would need to be something like outline {m} [s - e] _ <@ M.foo.

@fdupress
Copy link
Member

fdupress commented Dec 7, 2023

@strub and @bgregoir do you have opinions on the syntax?

It would also be good to have a quick look at code if you have time.
Cameron will be removing zip soon, and creating a wiki page once generally content with quality.

Copy link
Member

@strub strub left a comment

Choose a reason for hiding this comment

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

I left 2 comments. Otherwise, LGTM.

examples/tactics/outline.ec Outdated Show resolved Hide resolved
src/phl/ecPhlOutline.ml Show resolved Hide resolved
@strub
Copy link
Member

strub commented Dec 12, 2023

Also, your PR description should be in the commit description.

@Cameron-Low
Copy link
Contributor Author

@strub, the most recent commit should address all the comments you had.

The main idea is to provide an inverse to inline when proving an equiv.

Currently, it supports basic procedure unification that requires
manual selection of the program slice to unify with, as well as,
requiring near exact matches on program structure.

An optional return value can be supplied for situations where the
return expression is just a program variable and needs to be
renamed/deconstructed.

There is also support for statement outlining although, this is more
of a transitivity * with program slicing so may require change.

Syntax and variants:

 - Procedure outlining:
   outline {m} [s - e] lv? <@ M.foo

 - Statement outlining:
   outline {m} [s - e] { s1; s2; ... }

with

 - m: 1 or 2
 - s,e: code position
 - M.foo: path to procedure
 - lv: a left-value

when `s = e`, one can use `[s]` instead of `[s-s]`

For example usage see: tests/outline.ec
@Cameron-Low
Copy link
Contributor Author

Most recent push was just an amendment to the commit message. Otherwise shall I merge this?

@fdupress
Copy link
Member

fdupress commented Dec 15, 2023

It's approved: merge and add doc to the wiki. (Not necessarily in that order, but merging is probably best done with a bit of padding before people leave for the holidays.)

@Cameron-Low Cameron-Low merged commit 12af606 into main Dec 15, 2023
14 checks passed
@Cameron-Low Cameron-Low deleted the outline-tactic branch December 15, 2023 10:45
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.

3 participants