aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins/nsatz
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/nsatz
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/nsatz')
-rw-r--r--plugins/nsatz/Nsatz.v4
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/nsatz/Nsatz.v b/plugins/nsatz/Nsatz.v
index 21a94afca..2a287556b 100644
--- a/plugins/nsatz/Nsatz.v
+++ b/plugins/nsatz/Nsatz.v
@@ -98,7 +98,7 @@ Definition PhiR : list R -> PolZ -> R :=
(InitialRing.gen_phiZ ring0 ring1 add mul opp)).
Definition PEevalR : list R -> PEZ -> R :=
- PEeval ring0 add mul sub opp
+ PEeval ring0 ring1 add mul sub opp
(gen_phiZ ring0 ring1 add mul opp)
N.to_nat pow.
@@ -241,6 +241,8 @@ Fixpoint interpret3 t fv {struct t}: R :=
| (PEpow t1 t2) =>
let v1 := interpret3 t1 fv in pow v1 (N.to_nat t2)
| (PEc t1) => (IZR1 t1)
+ | PEO => 0
+ | PEI => 1
| (PEX _ n) => List.nth (pred (Pos.to_nat n)) fv 0
end.