]> matita.cs.unibo.it Git - helm.git/blob - helm/software/components/ng_paramodulation/terms.mli
First tests for paramodulation (pretty printer, unification)
[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
29   | Step of rule * int * int * direction * position * 'a substitution
30          (* rule, eq1, eq2, direction of eq2, position, substitution *)
31
32 type 'a literal = 
33  | Equation of    'a foterm  (* lhs *)
34                 * 'a foterm  (* rhs *)
35                 * 'a foterm  (* type *)
36                 * comparison (* orientation *)
37  | Predicate of   'a foterm 
38
39 type varlist = int list
40
41 type 'a unit_clause =
42    int        (* ID *)
43  * 'a literal
44  * varlist
45  * 'a proof      (* proof *)
46
47 type 'a passive_clause = int * 'a unit_clause (* weight * equation *)
48
49 module M : Map.S with type key = int 
50
51 type 'a bag = 'a unit_clause M.t
52
53 module type Blob =
54   sig
55     (* Blob is the type for opaque leaves: 
56      * - checking equlity should be efficient
57      * - atoms have to be equipped with a total order relation
58      *)
59     type t
60     val eq : t -> t -> bool
61     val compare : t -> t -> int
62     (* TODO: consider taking in input an imperative buffer for Format 
63      *  val pp : Format.formatter -> t -> unit
64      * *)
65     val pp : t -> string
66
67     val embed : t -> t foterm * int list
68   end
69
70 module Utils (B : Blob) :
71   sig
72     val eq_foterm : B.t foterm -> B.t foterm -> bool
73     val compare_foterm : B.t foterm -> B.t foterm -> int
74
75     val eq_literal : B.t literal -> B.t literal -> bool
76     val compare_literal : B.t literal -> B.t literal -> int
77
78     val eq_unit_clause : B.t unit_clause -> B.t unit_clause -> bool
79     val compare_unit_clause : B.t unit_clause -> B.t unit_clause -> int
80   end