Skip to content
This repository was archived by the owner on Jun 19, 2026. It is now read-only.

Commit e15dda4

Browse files
committed
Lahenda modelcheck/program praktikumis
1 parent cb2e107 commit e15dda4

1 file changed

Lines changed: 28 additions & 4 deletions

File tree

src/modelcheck/program/modelcheck_program.ml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,22 @@ struct
3939
let initial: t = (P2, Env.singleton "x" 1)
4040

4141
let step ((point, env): t): t list =
42-
failwith "TODO"
42+
match point with
43+
| P2 -> nondet P3 "y" (-10, 10) env
44+
| P3 -> nondet P4 "z" (-10, 10) env
45+
| P4 ->
46+
if Env.find "z" env > 5 then
47+
[(P5, env)]
48+
else
49+
[(P7, env)]
50+
| P5 -> [(P8, Env.add "x" (Env.find "y" env) env)]
51+
| P7 -> [(P8, Env.add "x" (Env.find "x" env + 1) env)]
52+
| P8 -> []
4353

4454
let is_error ((point, env): t): bool =
45-
failwith "TODO"
55+
match point with
56+
| P8 -> Env.find "x" env = 0
57+
| _ -> false
4658
end
4759

4860
(** Mudel järgmise programmi jaoks:
@@ -64,10 +76,22 @@ struct
6476
let initial: t = (P1, Env.empty)
6577

6678
let step ((point, env): t): t list =
67-
failwith "TODO"
79+
match point with
80+
| P1 -> nondet P2 "x" (0, 1500) env
81+
| P2 -> [(P3, Env.add "y" (Env.find "x" env) env)]
82+
| P3 ->
83+
if Env.find "x" env < 1024 then
84+
[(P4, env)]
85+
else
86+
[(P7, env)]
87+
| P4 -> [(P5, Env.add "x" (Env.find "x" env + 1) env)]
88+
| P5 -> [(P3, Env.add "y" (Env.find "y" env + 1) env)]
89+
| P7 -> []
6890

6991
let is_error ((point, env): t): bool =
70-
failwith "TODO"
92+
match point with
93+
| P7 -> Env.find "x" env <> Env.find "y" env
94+
| _ -> false
7195
end
7296

7397
(** Mudel järgmise programmi jaoks:

0 commit comments

Comments
 (0)