1 (* Copyright (C) 2000, HELM Team.
3 * This file is part of HELM, an Hypertextual, Electronic
4 * Library of Mathematics, developed at the Computer Science
5 * Department, University of Bologna, Italy.
7 * HELM is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * HELM is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HELM; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 * For details, see the HELM World-Wide-Web page,
23 * http://cs.unibo.it/helm/.
26 exception UnificationFailed
31 Cic.context -> Cic.metasenv -> (Cic.term option) list -> Cic.term -> Cic.term * Cic.metasenv
33 (* The entry (i,t) in a substitution means that *)
34 (* (META i) have been instantiated with t. *)
35 type substitution = (int * Cic.term) list
37 (* fo_unif metasenv context t1 t2 *)
38 (* unifies [t1] and [t2] in a context [context]. *)
39 (* Only the metavariables declared in [metasenv] *)
40 (* can be used in [t1] and [t2]. *)
41 (* The returned substitution can be directly *)
42 (* withouth first unwinding it. *)
44 Cic.metasenv -> Cic.context -> Cic.term -> Cic.term ->
45 substitution * Cic.metasenv
47 (* fo_unif_subst metasenv subst context t1 t2 *)
48 (* unifies [t1] and [t2] in a context [context] *)
49 (* and with [subst] as the current substitution *)
50 (* (i.e. unifies ([subst] [t1]) and *)
51 (* ([subst] [t2]) in a context *)
52 (* ([subst] [context]) using the metasenv *)
53 (* ([subst] [metasenv]) *)
54 (* Only the metavariables declared in [metasenv] *)
55 (* can be used in [t1] and [t2]. *)
56 (* [subst] and the substitution returned are not *)
58 (*CSC: fare un tipo unione Unwinded o ToUnwind e fare gestire la
59 cosa all'apply_subst!!!*)
61 substitution -> Cic.context -> Cic.metasenv -> Cic.term -> Cic.term ->
62 substitution * Cic.metasenv
64 (* unwind_subst metasenv subst *)
65 (* unwinds [subst] w.r.t. itself. *)
66 (* It can restrict some metavariable in the [metasenv] *)
67 val unwind_subst : Cic.metasenv -> substitution -> substitution * Cic.metasenv
69 (* apply_subst subst t *)
70 (* applies the substitution [subst] to [t] *)
71 (* [subst] must be already unwinded *)
72 val apply_subst : substitution -> Cic.term -> Cic.term
74 (* apply_subst_reducing subst (Some (mtr,reductions_no)) t *)
75 (* performs as (apply_subst subst t) until it finds an application of *)
76 (* (META [mtr]) that, once unwinding is performed, creates a new *)
77 (* beta-redex; in this case up to [reductions_no] consecutive *)
78 (* beta-reductions are performed. *)
79 (* Hint: this function is usually called when [reductions_no] *)
80 (* eta-expansions have been performed and the head of the new *)
81 (* application has been unified with (META [meta_to_reduce]): *)
82 (* during the unwinding the eta-expansions are undone. *)
83 (* [subst] must be already unwinded *)
84 val apply_subst_reducing :
85 substitution -> (int * int) option -> Cic.term -> Cic.term