]> matita.cs.unibo.it Git - helm.git/blob - helm/software/components/ng_paramodulation/terms.mli
c16b6f9b7212dd564aa07c67b4a39a1ee8eb86e6
[helm.git] / helm / software / components / ng_paramodulation / terms.mli
1 (*
2     ||M||  This file is part of HELM, an Hypertextual, Electronic        
3     ||A||  Library of Mathematics, developed at the Computer Science     
4     ||T||  Department, University of Bologna, Italy.                     
5     ||I||                                                                
6     ||T||  HELM is free software; you can redistribute it and/or         
7     ||A||  modify it under the terms of the GNU General Public License   
8     \   /  version 2 or (at your option) any later version.      
9      \ /   This software is distributed as is, NO WARRANTY.     
10       V_______________________________________________________________ *)
11
12 (* $Id$ *)
13
14 type 'a foterm = 
15   | Leaf of 'a
16   | Var of int
17   | Node of ('a foterm) list
18
19 type 'a substitution = (int * 'a foterm) list
20
21 type comparison = Lt | Eq | Gt | Incomparable
22
23 type rule = SuperpositionRight | SuperpositionLeft | Demodulation
24 type direction = Left2Right | Right2Left | Nodir
25 type position = int list
26
27 type 'a proof =
28   | Exact of 'a foterm
29          (* for theorems like T : \forall x. C[x] = D[x] the proof is 
30           * a foterm like (Node [ Leaf T ; Var i ]), while for the Goal
31           * it is just (Var g), i.e. the identity proof *)
32   | Step of rule * int * int * direction * position * 'a substitution
33          (* rule, eq1, eq2, direction of eq2, position, substitution *)
34
35 type 'a literal = 
36  | Equation of    'a foterm  (* lhs *)
37                 * 'a foterm  (* rhs *)
38                 * 'a foterm  (* type *)
39                 * comparison (* orientation *)
40  | Predicate of   'a foterm 
41
42 type varlist = int list
43
44 type 'a unit_clause =
45    int        (* ID *)
46  * 'a literal
47  * varlist
48  * 'a proof      (* proof *)
49
50 type 'a passive_clause = int * 'a unit_clause (* weight * equation *)
51
52 module M : Map.S with type key = int 
53
54 type 'a bag = 'a unit_clause M.t
55
56 module type Blob =
57   sig
58     (* Blob is the type for opaque leaves: 
59      * - checking equlity should be efficient
60      * - atoms have to be equipped with a total order relation
61      *)
62     type t
63     val eq : t -> t -> bool
64     val compare : t -> t -> int
65     val is_eq_predicate : t -> bool
66     (* TODO: consider taking in input an imperative buffer for Format 
67      *  val pp : Format.formatter -> t -> unit
68      * *)
69     val pp : t -> string
70
71     val embed : t -> t foterm 
72     (* saturate [proof] [type] -> [proof] * [type] *)
73     val saturate : t -> t -> t foterm * t foterm
74   end
75