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

Missing substitutions in smart motive #278

Closed
rigille opened this issue Aug 18, 2021 · 1 comment
Closed

Missing substitutions in smart motive #278

rigille opened this issue Aug 18, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@rigille
Copy link
Contributor

rigille commented Aug 18, 2021

Describe the bug

Sometimes the smart motive doesn't make all the substitutions it should and that results in confusing error messages.

To Reproduce

Copy and paste the following snippet:

TestType(b: Bool): Type
  case b {
    true: Nat
    false: String
  }
ComplexType(b: Bool, t: TestType(b)): Type
  case b with t {
    true: Nat
    false: String
  }!
  
Test(b: Bool, t: TestType(b)): ComplexType(b, t)
  case b {
    true: ?a
    false: ?b
  }!

Typechecking it results in a type error

Type mismatch.
- Expected: TestType(b)
- Detected: TestType(b)

Expected behavior

I expected those goals to appear with no type errors:

Goal ?a:
With type: ComplexType(Bool.true,t)
With context:
- b: Bool
- t: TestType(b)
- t: TestType(Bool.true)

Goal ?b:
With type: ComplexType(Bool.false,t)
With context:
- b: Bool
- t: TestType(b)
- t: TestType(Bool.false)

indeed that's what happens if you manually expand the lambda encoding:

Test(b: Bool, t: TestType(b)): ComplexType(b, t)
  b(
    (mb) (mt: TestType(mb)) -> ComplexType(mb, mt),
    (t) ?a,
    (t) ?b
  )(t)

my guess is that the smart motive is just replacing the ocurrences of mb and is forgetting mt. Like this

Test(b: Bool, t: TestType(b)): ComplexType(b, t)
  b(
    (mb) (mt: TestType(mb)) -> ComplexType(mb, t),
    (t) ?a,
    (t) ?b
  )(t)

and that explains the confusing error message.

Environment (please complete the following information):

  • Ubuntu 20.04
  • kind@1.0.91
@rigille rigille added status: bug Something isn't working enhancement New feature or request and removed status: bug Something isn't working labels Aug 18, 2021
@algebraic-dev
Copy link
Contributor

Closed because the repository now only contains the code for the Kind2 language.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants