Debian Codegraph @

test-suite/bugs/bug_16957.v

raw
1 Module Test1.
2
3 Goal True.
4 Proof.
5 evar (x:nat).
6 generalize (eq_refl:x = x).
7 vm_compute.
8 intros _.
9 generalize (eq_refl:x + 1 = x + 1).
10 let x := constr:(eq_refl : x = 0) in idtac.
11 vm_compute.
12 (* vm_compute still thinks variable x is defined to an undefined evar, so computes to a blocked fix *)
13
14 match goal with |- 1 = 1 -> True => idtac end.
15 Abort.
16
17 Goal False.
18 Proof.
19 evar (x:nat).
20 assert_succeeds (
21 let y := constr:(eq_refl : x = 1) in
22 generalize (eq_refl:x = x);
23 vm_compute).
24 (* vm_compute now believes x = 1 *)
25 generalize (eq_refl:x = 0).
26 vm_compute.
27 match goal with |- 0 = 0 -> False => idtac end.
28 Abort.
29
30 End Test1.
31
32 Module Test2.
33 Section S.
34
35 Let x := 0.
36
37 (* Notes:
38 - using a Proof. instead of ltac:() would make the context go through
39 Declare.initialize_named_context_for_proof which renews the lazy_vals
40 and so prevents proof time mutation from affecting the kernel.
41 - we could use the previous examples of the bug to get a variable y := false
42 but believed by vm_compute to be true, then use that to get change to turn
43 x := 0 into x := 1 up to vm_compute.
44 However change goes through Logic.reorder_val_context which renewes the lazy_vals
45 before we can get vm_compute to believe in x := 1.
46 Since this means we have to use change_no_check, we don't bother with the trickery
47 and just change 0 with 1.
48 *)
49 Fail Definition foo : x = 1
50 := ltac:(
51 change_no_check 0 with 1 in x;
52 vm_compute;
53 reflexivity).
54
55 End S.
56 End Test2.
57
58 Module Test3.
59 Section S.
60 Let x := 0.
61 Fail Definition foo : x = 1 := ltac:(change_no_check 0 with 1 in x; vm_compute).
62 Fail Definition foo : x = 1 := ltac:(vm_cast_no_check (eq_refl 1)).
63 End S.
64 End Test3.