aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins/setoid_ring/Cring.v
diff options
context:
space:
mode:
authorGravatar amahboub <amahboub@85f007b7-540e-0410-9357-904b9bb8a0f7>2013-08-23 11:06:12 +0000
committerGravatar amahboub <amahboub@85f007b7-540e-0410-9357-904b9bb8a0f7>2013-08-23 11:06:12 +0000
commitc3f233d95a8454155204f3cf425bc5c021de7e92 (patch)
tree515e5fc8929e738eadbe493d1ed787e0452d7f45 /plugins/setoid_ring/Cring.v
parenteb4bbd580ebcb9b2f03f9d8313b6de26819dedf7 (diff)
Fixing an incompleteness of the ring/field tactics
The problem occurs when a customized ring/field structure declared with a so-called "morphism" (see 24.5 in the manual) tactic allowing to reify (numerical) constants efficiently. When declaring a ring/field structure, the user can provide a cast function phi in order to express numerical constants in another type than the carrier of the ring. This is useful for instance when the ring is abstract (like the type R of reals) and one needs to express constants to large to be parsed in unary representation (for instance using a phi : Z -> R). Formerly, the completeness of the tactic required (phi 1) (resp. (phi 0)) to be convertible to 1 (resp. 0), which is not the case when phi is opaque. This was not documented untill recently but I moreover think this is also not desirable since the user can have good reasons to work with such an opaque case phi. Hence this commit: - adds two constructors to PExpr and FExpr for a correct reification - unplugs the optimizations in reification: optimizing reification is much less efficient than using a cast known to the tactic. TODO : It would probably be worth declaring IZR as a cast in the ring/field tactics provided for Reals in the std lib. The completeness of the tactic formerly relied on the fact that git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16730 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'plugins/setoid_ring/Cring.v')
-rw-r--r--plugins/setoid_ring/Cring.v5
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/setoid_ring/Cring.v b/plugins/setoid_ring/Cring.v
index 02194d4f1..cb2e78e42 100644
--- a/plugins/setoid_ring/Cring.v
+++ b/plugins/setoid_ring/Cring.v
@@ -21,6 +21,7 @@ Require Export Ncring_tac.
Class Cring {R:Type}`{Rr:Ring R} :=
cring_mul_comm: forall x y:R, x * y == y * x.
+
Ltac reify_goal lvar lexpr lterm:=
(*idtac lvar; idtac lexpr; idtac lterm;*)
match lexpr with
@@ -30,10 +31,10 @@ Ltac reify_goal lvar lexpr lterm:=
|- (?op ?u1 ?u2) =>
change (op
(@Ring_polynom.PEeval
- _ zero _+_ _*_ _-_ -_ Z Ncring_initial.gen_phiZ N (fun n:N => n)
+ _ zero one _+_ _*_ _-_ -_ Z Ncring_initial.gen_phiZ N (fun n:N => n)
(@Ring_theory.pow_N _ 1 multiplication) lvar e1)
(@Ring_polynom.PEeval
- _ zero _+_ _*_ _-_ -_ Z Ncring_initial.gen_phiZ N (fun n:N => n)
+ _ zero one _+_ _*_ _-_ -_ Z Ncring_initial.gen_phiZ N (fun n:N => n)
(@Ring_theory.pow_N _ 1 multiplication) lvar e2))
end
end.