blob: 3033381431245cab22726d1741e42f97cfe584e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
(* $Id$ *)
open Util
open Names
open Term
open Evd
open Sign
open Proof_trees
open Refiner
(******************************************)
(* Instantiation of existential variables *)
(******************************************)
(* w_tactic pour instantiate *)
let w_refine env ev rawc evd =
if Evd.is_defined (evars_of evd) ev then
error "Instantiate called on already-defined evar";
let e_info = Evd.map (evars_of evd) ev in
let env = Evd.evar_env e_info in
let sigma,typed_c =
Pretyping.understand_gen_tcc (evars_of evd) env []
(Some e_info.evar_concl) rawc in
let inst_info = {e_info with evar_body = Evar_defined typed_c } in
evar_define ev typed_c (evars_reset_evd sigma evd)
(* vernac command Existential *)
let instantiate_pf_com n com pfts =
let gls = top_goal_of_pftreestate pfts in
let sigma = gls.sigma in
let (sp,evi) (* as evc *) =
try
List.nth (Evarutil.non_instantiated sigma) (n-1)
with Failure _ ->
error "not so many uninstantiated existential variables" in
let env = Evd.evar_env evi in
let rawc = Constrintern.interp_rawconstr sigma env com in
let evd = create_evar_defs sigma in
let evd' = w_refine env sp rawc evd in
change_constraints_pftreestate (evars_of evd') pfts
|