forked from team-checkr/fsharp-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgramVerification.fs
More file actions
34 lines (26 loc) · 1.11 KB
/
ProgramVerification.fs
File metadata and controls
34 lines (26 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module ProgramVerification
open System
open Predicate.AST
(*
This defines the input and output for the program verification analysis.
Please do not change the definitions below as they are needed for the
validation and evaluation tools!
*)
type Input = unit
type Output =
{ verification_conditions: List<SerializedPredicate> }
let analysis (src: string) (input: Input) : Output =
let (P, C, Q) =
match Predicate.Parse.parse src with
| Ok (AnnotatedCommand (P, C, Q)) -> P, C, Q
| Error e ->
failwith
$"Failed to parse.\n\nDid you remember to surround your program with predicate blocks, like so?\n\n {{ true }} skip {{ true }}\n\n{e}"
// TODO: Remove these print statements
Console.Error.WriteLine("P = {0}", P)
Console.Error.WriteLine("C = {0}", C)
Console.Error.WriteLine("Q = {0}", Q)
let verification_conditions: List<Predicate> =
failwith "Program verification not yet implemented" // TODO: start here
// Let this line stay as it is.
{ verification_conditions = List.map serialize_predicate verification_conditions }