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.
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_______________________________________________________________ *)
12 (* $Id: nCic.ml 9058 2008-10-13 17:42:30Z tassi $ *)
18 type ('s,'g) tree = ([ `And of 's | `Or ], 'g) ZipTree.tree
19 type ('a,'s,'g) position = ('a,[ `And of 's | `Or ], 'g) ZipTree.position
21 type ('s,'g) subtreeA =
22 Solution of 's | Todo of (andT,'s,'g) position
24 type ('s,'g) subtreeO =
25 Unexplored | Alternatives of (orT,'s,'g) position
32 match down (start t) with
33 | None -> assert false
36 let setO x = set `Or x
37 let setA x y = set (`And x) y
39 let getO x = match get x with `And _,_ -> assert false | `Or, x -> x
40 let getA x = match get x with `And x,y -> x,y | `Or, _ -> assert false
47 | Some p -> if is_top p then None else Some p
49 let upO p = match up p with None -> assert false | Some x -> x
53 | Some x -> Alternatives x
54 | None -> assert(eject p = Nil); Unexplored
61 | Node(`And s,[]) -> Solution s
69 | Node(`And s,[]) -> Solution s
80 let is_solved_leaf p =
82 | Node(`And _,[]) -> true
84 let get_leaf_solution p =
86 | Node(`And x,[]) -> x
95 | `And _ -> fun _ _ -> ()
96 | `Or -> fun node fmt ->
97 GraphvizPp.Dot.node node ~attrs:["style","rounded"]