~ubuntu-branches/ubuntu/wily/coq-doc/wily

« back to all changes in this revision

Viewing changes to proofs/evar_refiner.ml

  • Committer: Bazaar Package Importer
  • Author(s): Stéphane Glondu, Stéphane Glondu, Samuel Mimram
  • Date: 2010-01-07 22:50:39 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100107225039-n3cq82589u0qt0s2
Tags: 8.2pl1-1
[ Stéphane Glondu ]
* New upstream release (Closes: #563669)
  - remove patches
* Packaging overhaul:
  - use git, advertise it in Vcs-* fields of debian/control
  - use debhelper 7 and dh with override
  - use source format 3.0 (quilt)
* debian/control:
  - set Maintainer to d-o-m, set Uploaders to Sam and myself
  - add Homepage field
  - bump Standards-Version to 3.8.3
* Register PDF documentation into doc-base
* Add debian/watch
* Update debian/copyright

[ Samuel Mimram ]
* Change coq-doc's description to mention that it provides documentation in
  pdf format, not postscript, closes: #543545.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
(************************************************************************)
 
2
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
 
3
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
 
4
(*   \VV/  **************************************************************)
 
5
(*    //   *      This file is distributed under the terms of the       *)
 
6
(*         *       GNU Lesser General Public License Version 2.1        *)
 
7
(************************************************************************)
 
8
 
 
9
(* $Id: evar_refiner.ml 12102 2009-04-24 10:48:11Z herbelin $ *)
 
10
 
 
11
open Util
 
12
open Names
 
13
open Term
 
14
open Evd
 
15
open Sign
 
16
open Proof_trees
 
17
open Refiner
 
18
open Pretyping
 
19
 
 
20
(******************************************)
 
21
(* Instantiation of existential variables *)
 
22
(******************************************)
 
23
 
 
24
(* w_tactic pour instantiate *) 
 
25
 
 
26
let w_refine evk (ltac_vars,rawc) evd =
 
27
  if Evd.is_defined (evars_of evd) evk then 
 
28
    error "Instantiate called on already-defined evar";
 
29
  let e_info = Evd.find (evars_of evd) evk in
 
30
  let env = Evd.evar_env e_info in
 
31
  let evd',typed_c =
 
32
    try Pretyping.Default.understand_ltac 
 
33
      (evars_of evd) env ltac_vars (OfType (Some e_info.evar_concl)) rawc
 
34
    with _ ->
 
35
      let loc = Rawterm.loc_of_rawconstr rawc in
 
36
      user_err_loc 
 
37
        (loc,"",Pp.str ("Instance is not well-typed in the environment of " ^
 
38
                        string_of_existential evk))
 
39
  in
 
40
    evar_define evk typed_c (evars_reset_evd (evars_of evd') evd)
 
41
 
 
42
(* vernac command Existential *)
 
43
 
 
44
let instantiate_pf_com n com pfts = 
 
45
  let gls = top_goal_of_pftreestate pfts in
 
46
  let sigma = gls.sigma in 
 
47
  let (evk,evi) = 
 
48
    let evl = Evarutil.non_instantiated sigma in
 
49
      if (n <= 0) then
 
50
        error "incorrect existential variable index"
 
51
      else if List.length evl < n then
 
52
          error "not so many uninstantiated existential variables"
 
53
      else
 
54
        List.nth evl (n-1)
 
55
  in 
 
56
  let env = Evd.evar_env evi in
 
57
  let rawc = Constrintern.intern_constr sigma env com in 
 
58
  let evd = create_goal_evar_defs sigma in
 
59
  let evd' = w_refine evk (([],[]),rawc) evd in
 
60
    change_constraints_pftreestate (evars_of evd') pfts