1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
|
(************************************************************************)
(* * The Coq Proof Assistant / The Coq Development Team *)
(* v * Copyright INRIA, CNRS and contributors *)
(* <O___,, * (see version control and CREDITS file for authors & dates) *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(* * (see LICENSE file for the text of the license) *)
(************************************************************************)
Require Import Setoid.
Set Primitive Projections.
Module CoqBug.
Record foo A := Foo { foo_car : A }.
Definition bar : foo _ := Foo nat 10.
Parameter alias : forall A, foo A -> A.
Parameter e : @foo_car = alias.
Goal foo_car _ bar = alias _ bar.
Proof.
(* Coq equally fails *)
Fail rewrite -> e.
Fail rewrite e at 1.
Fail setoid_rewrite e.
Fail setoid_rewrite e at 1.
Set Keyed Unification.
Fail rewrite -> e.
Fail rewrite e at 1.
Fail setoid_rewrite e.
Fail setoid_rewrite e at 1.
Admitted.
End CoqBug.
(* ----------------------------------------------- *)
Require Import ssreflect.
Set Primitive Projections.
Module T1.
Record foo A := Foo { foo_car : A }.
Definition bar : foo _ := Foo nat 10.
Goal foo_car _ bar = 10.
Proof.
match goal with
| |- foo_car _ bar = 10 => idtac
end.
rewrite /foo_car.
(*
Fail match goal with
| |- foo_car _ bar = 10 => idtac
end.
*)
Admitted.
End T1.
Module T2.
Record foo {A} := Foo { foo_car : A }.
Definition bar : foo := Foo nat 10.
Goal foo_car bar = 10.
match goal with
| |- foo_car bar = 10 => idtac
end.
rewrite /foo_car.
(*
Fail match goal with
| |- foo_car bar = 10 => idtac
end.
*)
Admitted.
End T2.
Module T3.
Record foo {A} := Foo { foo_car : A }.
Definition bar : foo := Foo nat 10.
Goal foo_car bar = 10.
Proof.
rewrite -[foo_car _]/(id _).
match goal with |- id _ = 10 => idtac end.
Admitted.
Goal foo_car bar = 10.
Proof.
set x := foo_car _.
match goal with |- x = 10 => idtac end.
Admitted.
End T3.
Module T4.
Inductive seal {A} (f : A) := { unseal : A; seal_eq : unseal = f }.
Arguments unseal {_ _} _.
Arguments seal_eq {_ _} _.
Record uPred : Type := IProp { uPred_holds :> Prop }.
Definition uPred_or_def (P Q : uPred) : uPred :=
{| uPred_holds := P \/ Q |}.
Definition uPred_or_aux : seal (@uPred_or_def). by eexists. Qed.
Definition uPred_or := unseal uPred_or_aux.
Definition uPred_or_eq: @uPred_or = @uPred_or_def := seal_eq uPred_or_aux.
Lemma foobar (P1 P2 Q : uPred) :
(P1 <-> P2) -> (uPred_or P1 Q) <-> (uPred_or P2 Q).
Proof.
rewrite uPred_or_eq. (* This fails. *)
Admitted.
End T4.
Module DesignFlaw.
Record foo A := Foo { foo_car : A }.
Definition bar : foo _ := Foo nat 10.
Definition app (f : foo nat -> nat) x := f x.
Goal app (foo_car _) bar = 10.
Proof.
unfold app. (* mkApp should produce a Proj *)
Fail set x := (foo_car _ _).
Admitted.
End DesignFlaw.
Module Bug.
Record foo A := Foo { foo_car : A }.
Definition bar : foo _ := Foo nat 10.
Parameter alias : forall A, foo A -> A.
Parameter e : @foo_car = alias.
Goal foo_car _ bar = alias _ bar.
Proof.
Fail rewrite e. (* Issue: #86 *)
Admitted.
End Bug.
|