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

Inverting twice makes a meta-context variable become in scope #221

Open
MartyO256 opened this issue Jun 15, 2020 · 0 comments
Open

Inverting twice makes a meta-context variable become in scope #221

MartyO256 opened this issue Jun 15, 2020 · 0 comments
Labels
A | core affecting the typechecker A | harpoon affecting the Harpoon interactive prover B | bug unexpected or incorrect behaviour

Comments

@MartyO256
Copy link
Member

Loading this signature in Harpoon:

LF nat : type =
| zero : nat
| succ : nat -> nat
;
--name nat N.

LF lt : nat -> nat -> type =
| lt/z : lt zero (succ N)
| lt/s : lt N1 N2 -> lt (succ N1) (succ N2)
;

LF location : type =
| location/i : nat -> location
;

LF loc-lt : location -> location -> type =
| loc-lt/i : lt N N' -> loc-lt (location/i N) (location/i N')
;

LF loc-succ : location -> location -> type =
| loc-succ/i : loc-succ (location/i N) (location/i (succ N))
;

proof lt-succ : { N : [|- nat] } [ |- lt N (succ N)] =
/ total 1 /
intros
{ N : ( |- nat)
|
; split [ |- N] as
  case succ:
  { N1 : ( |- nat)
  |
  ; by lt-succ [ |- N1] as L unboxed;
    solve [ |- lt/s L]
  }
  case zero:
  {
  |
  ; solve [ |- lt/z ]
  }
}
;

proof loc-succ-lt : [ |- loc-succ L L'] -> [ |- loc-lt L L'] =
/ total /
?
;

loc-succ-lt can be incorrectly proven using

invert x
invert x
by lt-succ [ |- N] as Q unboxed
solve [|- loc-lt/i Q]

which produces the program

  fn y =>
  let [ |- loc-succ/i ] = y in
  let [ |- loc-succ/i ] = y in
  let [ |- Q] = lt-succ [ |- N] in [ |- loc-lt/i Q]

After the first invert x, the meta-context variable N : ( |- nat) is not in scope.
It becomes in scope after the second invert x, which is why it can be accessed directly in by lt-succ [ |- N] as Q unboxed.

For any x, it should not be possible to perform a case analysis for x while being in a case analysis for x.

@tsani tsani added A | core affecting the typechecker A | harpoon affecting the Harpoon interactive prover B | bug unexpected or incorrect behaviour labels Jun 17, 2020
@tsani tsani self-assigned this Jun 17, 2020
@tsani tsani removed their assignment Sep 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A | core affecting the typechecker A | harpoon affecting the Harpoon interactive prover B | bug unexpected or incorrect behaviour
Projects
None yet
Development

No branches or pull requests

2 participants