File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,15 +23,24 @@ struct
2323 (* * Leiab funktsiooni vähima püsipunkti.
2424 Kasutada fp funktsiooni. *)
2525 let lfp (f : D.t -> D.t ): D.t =
26- failwith " TODO "
26+ fp f D. empty
2727
2828 (* * Leiab funktsiooni sulundi, mis sisaldab antud väärtusi.
2929 Kasutada lfp funktsiooni. *)
3030 let closure (f : D.t -> D.t ) (initial : D.t ): D.t =
31- failwith " TODO "
31+ lfp ( fun x -> D. union initial (f x))
3232
3333 (* * Leiab agara distributiivse funktsiooni sulundi, mis sisaldab antud väärtusi.
3434 Pole vaja kasutada fp/lfp funktsiooni. *)
3535 let closure_strict_distr (f : D.t -> D.t ) (initial : D.t ): D.t =
36- failwith " TODO"
36+ let rec helper closure frontier =
37+ (* if D.is_empty frontier then *)
38+ if D. subset frontier closure then
39+ closure
40+ else
41+ (* helper (D.union closure frontier) (f frontier) *)
42+ let closure' = D. union closure frontier in
43+ helper closure' (D. diff (f frontier) closure')
44+ in
45+ helper D. empty initial
3746end
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ let nfa_eps = function
1919
2020(* * Epsilonsammude funktsioon hulgal. *)
2121let nfa_eps_set states =
22+ (* IntSet.of_list (List.concat_map nfa_eps (IntSet.elements states)) *)
2223 IntSet. elements states
2324 |> List. concat_map nfa_eps
2425 |> IntSet. of_list
You can’t perform that action at this time.
0 commit comments