Skip to content

Commit d9980b6

Browse files
committed
Lahenda modelcheck praktikumis
1 parent c9fd5a1 commit d9980b6

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/modelcheck/checker.ml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,27 @@ struct
77
module StateSet = Set.Make (Model)
88
module StateSetFP = Fixpoint.MakeSet (StateSet)
99

10-
10+
let f states =
11+
StateSet.elements states
12+
|> List.concat_map Model.step
13+
|> StateSet.of_list
1114

1215
(** Tagastab kõik saavutatavad olekud. *)
1316
let all_states (): StateSet.t =
14-
failwith "TODO"
17+
StateSetFP.closure_strict_distr f (StateSet.singleton Model.initial)
1518

1619
(** Tagastab kõik saavutatavad veaolekud.
1720
Vihje: StateSet.filter. *)
1821
let error_states (): StateSet.t =
19-
failwith "TODO"
22+
StateSet.filter Model.is_error (all_states ())
2023

2124
(** Kas mõni veaolek on saavutatav? *)
2225
let has_error (): bool =
23-
failwith "TODO"
26+
not (StateSet.is_empty (error_states ()))
2427

2528
(** Kas veaolekud on mittesaavutatavad? *)
2629
let is_correct (): bool =
27-
failwith "TODO"
30+
not (has_error ())
2831
end
2932

3033

0 commit comments

Comments
 (0)