Skip to content

Instantly share code, notes, and snippets.

@aa755
Forked from Blaisorblade/rewrite_drops_hyps.v
Last active October 11, 2022 20:12
Show Gist options
  • Save aa755/1ebc84dc22108fecccfe1ceedb33066e to your computer and use it in GitHub Desktop.
Save aa755/1ebc84dc22108fecccfe1ceedb33066e to your computer and use it in GitHub Desktop.
Demonstrate strange rewrite behavior
Require Import List.
Import ListNotations.
Require Import ssreflect.
Lemma test1 :
length ([1] ++ [2]) = 2 ->
2 = 4.
Proof.
intros HA.
evar (N : nat).
Unshelve.
admit.
Check HA.
Undo.
Undo.
rewrite -> app_length in HA.
Unshelve.
admit.
(* Now [HA] has disappeared from the context of the second goal, unless we run [clear N]. *)
Fail Check HA.
Abort.
Lemma test2 :
length ([1] ++ [2]) = 2 ->
exists n : nat, n + 4 = 2.
Proof.
intros HA.
eexists.
Unshelve.
admit.
Check HA.
Undo.
Undo.
rewrite /= in HA.
Unshelve.
admit.
(* Now [HA] has disappeared from the context of the second goal, and we can't [clear N] to fix that. *)
Fail Check HA.
Abort.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment