aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins/romega/const_omega.ml
diff options
context:
space:
mode:
authorGravatar Pierre Letouzey <pierre.letouzey@inria.fr>2017-05-24 18:04:10 +0200
committerGravatar Pierre Letouzey <pierre.letouzey@inria.fr>2017-10-05 23:30:05 +0200
commit87539cd9f8ce912e5e084dfbed5fa366555b6006 (patch)
treec6d088147366f7be5fb6f660d0cfaa37b54ca06b /plugins/romega/const_omega.ml
parent87a63ffc6dd36be0ef2e757b46f3c81f67f96207 (diff)
romega: takes advantage of context variables with body
When a context variable x is of the form "x := body : Z", romega is now made aware of this body. Technically, we reify an equation x = body, and push a corresponding (eq_refl x) as argument of the final do_omega. See also the previous commit adding this same feature to omega (fixing bug 142).
Diffstat (limited to 'plugins/romega/const_omega.ml')
-rw-r--r--plugins/romega/const_omega.ml11
1 files changed, 7 insertions, 4 deletions
diff --git a/plugins/romega/const_omega.ml b/plugins/romega/const_omega.ml
index 4ffbd5aa8..c27ac2ea4 100644
--- a/plugins/romega/const_omega.ml
+++ b/plugins/romega/const_omega.ml
@@ -221,6 +221,7 @@ let mk_N = function
module type Int = sig
val typ : Term.constr Lazy.t
+ val is_int_typ : [ `NF ] Proofview.Goal.t -> Term.constr -> bool
val plus : Term.constr Lazy.t
val mult : Term.constr Lazy.t
val opp : Term.constr Lazy.t
@@ -287,12 +288,14 @@ let pf_nf gl c =
EConstr.Unsafe.to_constr
(Tacmach.New.pf_apply Tacred.simpl gl (EConstr.of_constr c))
+let is_int_typ gl t =
+ match destructurate (pf_nf gl t) with
+ | Kapp("Z",[]) -> true
+ | _ -> false
+
let parse_rel gl t =
match destructurate t with
- | Kapp("eq",[typ;t1;t2]) ->
- (match destructurate (pf_nf gl typ) with
- | Kapp("Z",[]) -> Req (t1,t2)
- | _ -> Rother)
+ | Kapp("eq",[typ;t1;t2]) when is_int_typ gl typ -> Req (t1,t2)
| Kapp("Zne",[t1;t2]) -> Rne (t1,t2)
| Kapp("Z.le",[t1;t2]) -> Rle (t1,t2)
| Kapp("Z.lt",[t1;t2]) -> Rlt (t1,t2)