aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Dénès2017-08-31 12:41:58 +0200
committerMaxime Dénès2017-08-31 12:41:58 +0200
commitf0b9359069de1223b9ffc8fedc557b87f919b24a (patch)
treeb8f6672b55415afef2ac4eea5789f6e283f7c54c
parentbdfcbceb57cb8d04fea02da39dee6b8e7f75ad29 (diff)
parent4bbe2e4e2a9d5dea1a07f8cf0d7e3aeeed609201 (diff)
Merge PR #996: Fix BZ#5697: Congruence does not work with primitive projections
-rw-r--r--plugins/cc/cctac.ml3
-rw-r--r--tactics/equality.ml3
-rw-r--r--test-suite/bugs/closed/5697.v19
3 files changed, 23 insertions, 2 deletions
diff --git a/plugins/cc/cctac.ml b/plugins/cc/cctac.ml
index 11d3a6d1f4..5a4c52456d 100644
--- a/plugins/cc/cctac.ml
+++ b/plugins/cc/cctac.ml
@@ -84,7 +84,8 @@ let rec decompose_term env sigma t=
| Proj (p, c) ->
let canon_const kn = Constant.make1 (Constant.canonical kn) in
let p' = Projection.map canon_const p in
- (Appli (Symb (Term.mkConst (Projection.constant p')), decompose_term env sigma c))
+ let c = Retyping.expand_projection env sigma p' c [] in
+ decompose_term env sigma c
| _ ->
let t = Termops.strip_outer_cast sigma t in
if closed0 sigma t then Symb (EConstr.to_constr sigma t) else raise Not_found
diff --git a/tactics/equality.ml b/tactics/equality.ml
index ad6abfa1f6..3ea9538f38 100644
--- a/tactics/equality.ml
+++ b/tactics/equality.ml
@@ -922,7 +922,8 @@ let build_selector env sigma dirn c ind special default =
let brl =
List.map build_branch(List.interval 1 (Array.length mip.mind_consnames)) in
let ci = make_case_info env ind RegularStyle in
- mkCase (ci, p, c, Array.of_list brl)
+ let ans = Inductiveops.make_case_or_project env sigma indf ci p c (Array.of_list brl) in
+ ans
let build_coq_False () = pf_constr_of_global (build_coq_False ())
let build_coq_True () = pf_constr_of_global (build_coq_True ())
diff --git a/test-suite/bugs/closed/5697.v b/test-suite/bugs/closed/5697.v
new file mode 100644
index 0000000000..c653f992af
--- /dev/null
+++ b/test-suite/bugs/closed/5697.v
@@ -0,0 +1,19 @@
+Set Primitive Projections.
+
+Record foo : Type := Foo { foo_car: nat }.
+
+Goal forall x y : nat, x <> y -> Foo x <> Foo y.
+Proof.
+intros.
+intros H'.
+congruence.
+Qed.
+
+Record bar (A : Type) : Type := Bar { bar_car: A }.
+
+Goal forall x y : nat, x <> y -> Bar nat x <> Bar nat y.
+Proof.
+intros.
+intros H'.
+congruence.
+Qed.