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

Further fix for #3213 #3215

Merged
merged 8 commits into from
Feb 12, 2024
Merged

Further fix for #3213 #3215

merged 8 commits into from
Feb 12, 2024

Conversation

mtzguido
Copy link
Member

Followup of #3213 and #3214. Given forall x1 .. xn. p x1 .. xn we cannot rewrite p to fun x1 .. xn -> True even if the types match, or we can also obtain an inconsistentency:

let also_bad ()
  : Lemma (forall (f : (nat -> Type0)). (forall (x : nat). f x) ==> (fun (_:nat) -> True) == f) = ()
  
let eq_fun (f1 f2 : 'a -> 'b) (x : 'a) (_ : squash (f1 == f2)) : Lemma (f1 x == f2 x) = ()

let bad2 () =
  let f0 : int -> Type0 = fun x -> True in
  let f1 : int -> Type0 = fun x -> x >= 0 in
  also_bad ();
  let f0' : nat -> Type0 = f0 in
  let f1' : nat -> Type0 = f1 in
  forall_elim #(nat -> Type0) (fun f -> (forall (x : nat). f x) ==> (fun (_:nat) -> True) == f) f0';
  forall_elim #(nat -> Type0) (fun f -> (forall (x : nat). f x) ==> (fun (_:nat) -> True) == f) f1';
  assert (f0' == (fun (_:nat) -> True));
  assert (f1' == (fun (_:nat) -> True));
  assert (eq2 #(nat -> Type0) f0' f0);
  assert (eq2 #(nat -> Type0) f1' f1);
  assert (f0 == f1);
  eq_fun f0 f1 (-1) ();
  assert False;
  ()

This PR makes it so that we only rewrite full applications of p to n arguments into True.

@mtzguido mtzguido merged commit 85aa684 into FStarLang:master Feb 12, 2024
2 checks passed
@mtzguido mtzguido deleted the 3213b branch February 12, 2024 23:43
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