| 1 |
(* A few tests of the syntax of clauses and of the interpretation of change *) |
| 2 |
|
| 3 |
Goal let a := 0+0 in a=a. |
| 4 |
intro. |
| 5 |
change 0 in (value of a). |
| 6 |
change ((fun A:Type => A) nat) in (type of a). |
| 7 |
Abort. |
| 8 |
|
| 9 |
Goal forall x, 2 + S x = 1 + S x. |
| 10 |
intro. |
| 11 |
change (?u + S x) with (S (u + x)). |
| 12 |
Abort. |
| 13 |
|
| 14 |
(* Check the combination of at, with and in (see bug #2146) *) |
| 15 |
|
| 16 |
Goal 3=3 -> 3=3. intro H. |
| 17 |
change 3 with (1+2) at 2. |
| 18 |
change 3 with (1+2) in H at 2 |-. |
| 19 |
change 3 with (1+2) in H at 1 |- * at 1. |
| 20 |
(* Now check that there are no more 3's *) |
| 21 |
change 3 with (1+2) in * || reflexivity. |
| 22 |
Qed. |
| 23 |
|
| 24 |
(* Note: the following is invalid and must fail |
| 25 |
change 3 at 1 with (1+2) at 3. |
| 26 |
change 3 at 1 with (1+2) in *. |
| 27 |
change 3 at 1 with (1+2) in H at 2 |-. |
| 28 |
change 3 at 1 with (1+2) at 3. |
| 29 |
change 3 at 1 with (1+2) in H |- *. |
| 30 |
change 3 at 1 with (1+2) in H, H|-. |
| 31 |
change 3 at 1. |
| 32 |
*) |
| 33 |
|
| 34 |
(* Test that pretyping checks allowed elimination sorts *) |
| 35 |
|
| 36 |
Goal True. |
| 37 |
Fail change True with (let (x,a) := ex_intro _ True (eq_refl True) in x). |
| 38 |
Fail change True with |
| 39 |
match ex_intro _ True (eq_refl True) with ex_intro x _ => x end. |
| 40 |
Abort. |
| 41 |
|
| 42 |
(* Check absence of loop in identity substitution (was failing up to |
| 43 |
Sep 2014, see #3641) *) |
| 44 |
|
| 45 |
Goal True. |
| 46 |
change ?x with x. |
| 47 |
Abort. |
| 48 |
|
| 49 |
(* Check typability after change of type subterms *) |
| 50 |
Goal nat = nat :> Set. |
| 51 |
Fail change nat with (@id Type nat). (* would otherwise be ill-typed *) |
| 52 |
Abort. |
| 53 |
|
| 54 |
(* Check typing env for rhs is the correct one *) |
| 55 |
|
| 56 |
Goal forall n, let x := n in id (fun n => n + x) 0 = 0. |
| 57 |
intros. |
| 58 |
unfold x. |
| 59 |
(* check that n in 0+n is not interpreted as the n from "fun n" *) |
| 60 |
change n with (0+n). |
| 61 |
Abort. |
| 62 |
|
| 63 |
(* Check non-collision of non-normalized defined evars with pattern variables *) |
| 64 |
|
| 65 |
Goal exists x, 1=1 -> x=1/\x=1. |
| 66 |
eexists ?[n]; intros; split. |
| 67 |
eassumption. |
| 68 |
match goal with |- ?x=1 => change (x=1) with (0+x=1) end. |
| 69 |
match goal with |- 0+1=1 => trivial end. |
| 70 |
Qed. |
| 71 |
|
| 72 |
(* Mini-check that no_check does not check *) |
| 73 |
|
| 74 |
Goal True -> False. |
| 75 |
intro H. |
| 76 |
change_no_check nat. |
| 77 |
apply S. |
| 78 |
change_no_check nat with bool. |
| 79 |
change_no_check nat in H. |
| 80 |
change_no_check nat with (bool->bool) in H. |
| 81 |
exact (H true). |
| 82 |
Fail Qed. |
| 83 |
Abort. |