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

feat: push down lets #1111

Closed
wants to merge 34 commits into from
Closed

Conversation

brprice
Copy link
Contributor

@brprice brprice commented Aug 12, 2023

This addresses #44

This supersedes #736, which was accidentally closed.

This is in preparation for rethinking how we evaluate let bindings.

Signed-off-by: Ben Price <[email protected]>
we do this because we are changing eval a lot shortly, and want to be able to see changes. is also easier to update when bounds are broken!
…ith next commit!

This can be seen as an explicit-substitution style operational
semantics.

This change in approach means that our evaluation rules are much more
local, and will enable some future simplifications. In particular we
will avoid using the `Accum` machinery, simplify the eval `Cxt` and not
have to have a separate eval mode for substitutions.

We temporarily disable EvalFull.unit_8. It does pass (note that the step
count is bumped), but takes a long time (almost 10 minutes on my
machine!). This will be massively improved shortly, by being more
aggressive in eliding pointless `let`s.

Signed-off-by: Ben Price <[email protected]>

pushMulti opt
bump limit on unit_prim_partial_map because...

it turns out that on this workload the aggressive elision optimisation
actually takes more step. However, the trees are somewhat smaller.
this is because the optimisation makes no difference on terms like
  let x1=_ in ... let xn=_ in xi
as `xi` is a leaf. This workload has many such subterms which get created when pushing lets down. Aggressive elision will remove some of the lets early, when they are (for example)
  let x1=_ in ... let xn=_ in C xi xj
but this takes an extra step

This phenomenon is also seen in unit_type_preservation_BETA_regression
Since we are eliding aggressively, we may as well not create the
pointless lets in the first place. (Note that we may still create
pointless lets when renaming binders.)

This again noticably speeds up unit_8 and unit_9.

Signed-off-by: Ben Price <[email protected]>
This fixes unit_redexes_lettype_capture, where we want to not consider a
burried binder renamable.

Signed-off-by: Ben Price <[email protected]>
Now we are pushing down lets, we do not need so much information about
bindings. In particular, we do not need to record the original binding
location, or the original binding's context, since we do not do
long-range substitution where care is needed to avoid capture.

Signed-off-by: Ben Price <[email protected]>
This fixes a rare issue that if one has two adjacent lets with the same
name, we would only record one of them in the `Cxt`, and thus
miscalculate whether a binder they immediately contain needs to be
renamed before we can push the lets under.

Signed-off-by: Ben Price <[email protected]>
This is because we "push down lets", rather than doing long-range substitutions.

Signed-off-by: Ben Price <[email protected]>
@brprice brprice changed the base branch from main to brprice/strict-meta-id August 12, 2023 01:20
@brprice brprice force-pushed the brprice/explicit-subst branch 3 times, most recently from 025ceb9 to ac6aea5 Compare August 12, 2023 01:25
@brprice
Copy link
Contributor Author

brprice commented Aug 12, 2023

Ah, I have worked out how to re-open the old PR. Closing this one. Sorry for the noise.

FTR, the problem & timeline was

  • I accidentally deleted the remote (i.e. github) branch (via a bad invocation of git)
  • Thus github closed the old PR
  • I couldn't obviously reopen, so I pushed a new branch of the same name (with different commits)
  • I then opened this PR
  • At this point, I realised that there was actually a button on the old pr to reopen (at the bottom, where the comment box is), but it was disabled because the current branch contents did not match the last commit seen when the pr was open
  • I force-pushed the old version of the branch
  • Can now re-open the old pr
  • Thus I'll close this one

@brprice brprice closed this Aug 12, 2023
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