type bform = B of bool V of string Neg of bform And of bform * bform Or of bform * bform (* returneaza o variabila (string) oarecare din formula * sau genereaza Not_found daca nu exista variabile *) let rec find_var = function B _ -> raise Not_found V s -> s Neg f -> find_var f And (f1, f2) Or (f1, f2) -> try find_var f1 with Not_found -> find_var f2 module S = Set.Make(String) (* returnează mulțimea tuturor variabilelor din formulă *) let rec allvars = function B _ -> S.empty V s -> S.singleton s Neg f -> allvars f And (f1, f2) Or (f1, f2) -> S.union (allvars f1) (allvars f2)
This document was generated using caml2html