Skip to content

Tactics incorrectly synthesizes identity #1447

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

Closed
isovector opened this issue Feb 26, 2021 · 7 comments · Fixed by #1505
Closed

Tactics incorrectly synthesizes identity #1447

isovector opened this issue Feb 26, 2021 · 7 comments · Fixed by #1505
Labels
component: wingman type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@isovector
Copy link
Collaborator

data Synthesized b a = Synthesized
  { syn_trace :: b
  , syn_val   :: a
  }
  deriving (Eq, Show, Functor, Foldable, Traversable)
  

mapTrace :: (b -> b) -> Synthesized b a -> Synthesized b a
mapTrace = _

Not sure what's going on here; haven't dug in. The real example uses Trace instead of b.

@isovector isovector added type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. component: wingman labels Feb 26, 2021
@isovector isovector changed the title Tactics can't synthesize a function Tactics incorrectly synthesizes identity Feb 26, 2021
@isovector
Copy link
Collaborator Author

isovector commented Feb 26, 2021

In my currently installed version it produces mapTrace _ sa = sa

@isovector
Copy link
Collaborator Author

[Synthesized {syn_trace = auto
`- intros {frl_crl_c, sa}
   `- destruct(auto)
      `- destruct sa
         `- match Synthesized {rl_c, a}
            `- split(auto)
               `- splitDataCon:Synthesized
                  `- Synthesized
                     `- assume rl_c
, syn_val = \ frl_crl_c sa
  -> case sa of {
       (Synthesized rl_c a)
         -> Synthesized {syn_trace = rl_c, syn_val = a} }},Synthesized {syn_trace = auto
`- intros {frl_crl_c, sa}
   `- assume sa
, syn_val = \ frl_crl_c sa -> sa}]

@isovector
Copy link
Collaborator Author

It's not even trying to apply the function; my guess is that it's a type-synonym problem

@isovector
Copy link
Collaborator Author

It's not a type-synonym problem, and it doesn't appear to be running out of gas --- although I didn't explicitly test it with more gas.

@isovector
Copy link
Collaborator Author

I actually programmed this in intentionally! The offending combinator is requireNewHoles in the apply tactic. In an attempt to prevent infinite regress, we don't apply a function if it doesn't lead to any new holes. This is a good check in general, but should be toned down for locally-bound variables, and make it respect linearity instead.

@isovector
Copy link
Collaborator Author

At the very least, "optimizations" like these should leave a trail somewhere.

@isovector
Copy link
Collaborator Author

The test suite and this failing case both pass after removing requireNewHoles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: wingman type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant