Skip to content
This repository was archived by the owner on Nov 13, 2021. It is now read-only.

Commit b2eade3

Browse files
author
notin
committed
Correction du bug #1680: ajout d'un champ avoid_ids dans interp_sign;
modification de interp_ltac_reference pour passer les ids utilisées dans le contexte d'appel d'une tactique. git-svn-id: svn://scm.gforge.inria.fr/svn/coq/trunk@10076 85f007b7-540e-0410-9357-904b9bb8a0f7
1 parent 1a2df7e commit b2eade3

File tree

5 files changed

+22
-18
lines changed

5 files changed

+22
-18
lines changed

contrib/field/field.ml4

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ let field g =
159159
| Some (eq,t::args) when eq = (Coqlib.build_coq_eq_data()).Coqlib.eq -> t
160160
| _ -> error "The statement is not built from Leibniz' equality" in
161161
let th = VConstr (lookup (pf_env g) typ) in
162-
(interp_tac_gen [(id_of_string "FT",th)] (get_debug ())
162+
(interp_tac_gen [(id_of_string "FT",th)] [] (get_debug ())
163163
<:tactic< match goal with |- (@eq _ _ _) => field_gen FT end >>) g
164164

165165
(* Verifies that all the terms have the same type and gives the right theory *)

contrib/romega/ReflOmegaCore.v

+4-4
Original file line numberDiff line numberDiff line change
@@ -2160,7 +2160,7 @@ Theorem not_exact_divide_valid :
21602160
Proof.
21612161
unfold valid_hyps, not_exact_divide in |- *; intros;
21622162
generalize (nth_valid ep e i lp); Simplify.
2163-
rewrite (scalar_norm_add_stable t e), <-H0.
2163+
rewrite (scalar_norm_add_stable t e), <-H1.
21642164
do 2 rewrite <- scalar_norm_add_stable; simpl in *; intros.
21652165
absurd (interp_term e body * k1 + k2 = 0);
21662166
[ now apply OMEGA4 | symmetry; auto ].
@@ -2370,9 +2370,9 @@ Theorem exact_divide_valid :
23702370
Proof.
23712371
unfold valid1, exact_divide in |- *; intros k1 k2 t ep e p1;
23722372
Simplify; simpl; auto; subst;
2373-
rewrite <- scalar_norm_stable; simpl; intros;
2374-
[ destruct (mult_integral _ _ (sym_eq H)); intuition
2375-
| swap H; rewrite <- H1, mult_0_l; auto
2373+
rewrite <- scalar_norm_stable; simpl; intros;
2374+
[ destruct (mult_integral _ _ (sym_eq H0)); intuition
2375+
| swap H0; rewrite <- H1, mult_0_l; auto
23762376
].
23772377
Qed.
23782378

tactics/tacinterp.ml

+15-12
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,10 @@ let catch_error loc tac g =
101101

102102
(* Signature for interpretation: val_interp and interpretation functions *)
103103
type interp_sign =
104-
{ lfun : (identifier * value) list;
105-
debug : debug_info }
104+
{ lfun : (identifier * value) list;
105+
avoid_ids : identifier list; (* ids inherited fromm the call context
106+
(needed to get fresh ids) *)
107+
debug : debug_info }
106108

107109
let check_is_value = function
108110
| VRTactic _ -> (* These are goals produced by Match *)
@@ -1243,7 +1245,7 @@ let rec constr_list_aux env = function
12431245

12441246
let constr_list ist env = constr_list_aux env ist.lfun
12451247

1246-
(*Extract the identifier list from lfun: join all branches (what to do else?)*)
1248+
(* Extract the identifier list from lfun: join all branches (what to do else?)*)
12471249
let rec intropattern_ids = function
12481250
| IntroIdentifier id -> [id]
12491251
| IntroOrAndPattern ll ->
@@ -1260,7 +1262,7 @@ let default_fresh_id = id_of_string "H"
12601262

12611263
let interp_fresh_id ist gl l =
12621264
let ids = map_succeed (function ArgVar(_,id) -> id | _ -> failwith "") l in
1263-
let avoid = extract_ids ids ist.lfun in
1265+
let avoid = (extract_ids ids ist.lfun) @ ist.avoid_ids in
12641266
let id =
12651267
if l = [] then default_fresh_id
12661268
else
@@ -1613,7 +1615,8 @@ and interp_ltac_reference isapplied mustbetac ist gl = function
16131615
let v = List.assoc id ist.lfun in
16141616
if mustbetac then coerce_to_tactic loc id v else v
16151617
| ArgArg (loc,r) ->
1616-
let v = val_interp {lfun=[];debug=ist.debug} gl (lookup r) in
1618+
let ids = extract_ids [] ist.lfun in
1619+
let v = val_interp {lfun=[];avoid_ids=ids; debug=ist.debug} gl (lookup r) in
16171620
if isapplied then v else locate_tactic_call loc v
16181621

16191622
and interp_tacarg ist gl = function
@@ -2263,18 +2266,18 @@ let make_empty_glob_sign () =
22632266
gsigma = Evd.empty; genv = Global.env() }
22642267

22652268
(* Initial call for interpretation *)
2266-
let interp_tac_gen lfun debug t gl =
2267-
interp_tactic { lfun=lfun; debug=debug }
2269+
let interp_tac_gen lfun avoid_ids debug t gl =
2270+
interp_tactic { lfun=lfun; avoid_ids=avoid_ids; debug=debug }
22682271
(intern_tactic {
22692272
ltacvars = (List.map fst lfun, []); ltacrecvars = [];
22702273
gsigma = project gl; genv = pf_env gl } t) gl
22712274

2272-
let eval_tactic t gls = interp_tactic { lfun=[]; debug=get_debug() } t gls
2275+
let eval_tactic t gls = interp_tactic { lfun=[]; avoid_ids=[]; debug=get_debug() } t gls
22732276

2274-
let interp t = interp_tac_gen [] (get_debug()) t
2277+
let interp t = interp_tac_gen [] [] (get_debug()) t
22752278

22762279
let eval_ltac_constr gl t =
2277-
interp_ltac_constr { lfun=[]; debug=get_debug() } gl
2280+
interp_ltac_constr { lfun=[]; avoid_ids=[]; debug=get_debug() } gl
22782281
(intern_tactic (make_empty_glob_sign ()) t )
22792282

22802283
(* Hides interpretation for pretty-print *)
@@ -2674,7 +2677,7 @@ let glob_tactic_env l env x =
26742677
x
26752678

26762679
let interp_redexp env sigma r =
2677-
let ist = { lfun=[]; debug=get_debug () } in
2680+
let ist = { lfun=[]; avoid_ids=[]; debug=get_debug () } in
26782681
let gist = {(make_empty_glob_sign ()) with genv = env; gsigma = sigma } in
26792682
interp_red_expr ist sigma env (intern_red_expr gist r)
26802683

@@ -2684,7 +2687,7 @@ let interp_redexp env sigma r =
26842687
let _ = Auto.set_extern_interp
26852688
(fun l ->
26862689
let l = List.map (fun (id,c) -> (id,VConstr c)) l in
2687-
interp_tactic {lfun=l;debug=get_debug()})
2690+
interp_tactic {lfun=l;avoid_ids=[];debug=get_debug()})
26882691
let _ = Auto.set_extern_intern_tac
26892692
(fun l ->
26902693
Options.with_option strict_check

tactics/tacinterp.mli

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ type value =
4040
(* Signature for interpretation: val\_interp and interpretation functions *)
4141
and interp_sign =
4242
{ lfun : (identifier * value) list;
43+
avoid_ids : identifier list;
4344
debug : debug_info }
4445

4546
(* Transforms an id into a constr if possible *)
@@ -119,7 +120,7 @@ val interp_ltac_constr : interp_sign -> goal sigma -> glob_tactic_expr ->
119120
val interp_redexp : Environ.env -> Evd.evar_map -> raw_red_expr -> red_expr
120121

121122
(* Interprets tactic expressions *)
122-
val interp_tac_gen : (identifier * value) list ->
123+
val interp_tac_gen : (identifier * value) list -> identifier list ->
123124
debug_info -> raw_tactic_expr -> tactic
124125

125126
val interp_hyp : interp_sign -> goal sigma -> identifier located -> identifier

0 commit comments

Comments
 (0)