]> matita.cs.unibo.it Git - helm.git/blob - helm/software/lambda-delta/src/common/level.ml
Matitaweb: layout change in the matitaweb inteface, in order to allow better
[helm.git] / helm / software / lambda-delta / src / common / level.ml
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 type level = int option
13
14 (* Interface functions ******************************************************)
15
16 let infinite = None
17
18 let finite i = Some i
19
20 let is_zero xi = 
21    xi = (Some 0)
22
23 let is_infinite xi =
24    xi = None
25
26 let succ = function
27    | None   -> None
28    | Some i -> Some (succ i)
29
30 let pred = function
31    | None              -> None
32    | Some i when i > 0 -> Some (pred i)
33    | _                 -> Some 0
34
35 let to_string = function
36    | None   -> ""
37    | Some i -> string_of_int i