source: src/Clight/test/badconditional.test.ma

Last change on this file was 2645, checked in by sacerdot, 7 years ago
  1. some broken back-end files repaires, several still to go
  2. the string datatype has been refined into three different data types: string (for backend comments); identifierTag; ErrorMessage?
  3. all axioms of type String have been turned into constructors of one of the three datatypes. In this way we do not have axioms to be implemented in the extracted files
File size: 2.0 KB
Line 
1include "Clight/test/badconditional.c.ma".
2
3example exec: finishes_with (repr I32 15) ? (exec_up_to clight_fullexec myprog 1000 [ ]).
4normalize  (* you can examine the result here *)
5%
6qed.
7
8include "Clight/SimplifyCasts.ma".
9include "Clight/switchRemoval.ma".
10
11example es: finishes_with (repr I32 15) ? (exec_up_to clight_fullexec (program_switch_removal (simplify_program myprog)) 1000 [ ]).
12normalize  (* you can examine the result here *)
13%
14qed.
15
16include "Clight/toCminor.ma".
17include "Cminor/Cminor_semantics.ma".
18
19example e1: finishes_with (repr I32 15) ?
20  (bind ? (snapshot state) (clight_to_cminor (program_switch_removal (simplify_program myprog)))
21   (λp. exec_up_to Cminor_fullexec p 1000 [ ])).
22normalize
23%
24qed.
25
26include "Cminor/toRTLabs.ma".
27include "RTLabs/RTLabs_semantics.ma".
28include "Clight/label.ma".
29
30example e2: finishes_with (repr I32 15) ? (
31let 〈p0,init〉 ≝ clight_label (program_switch_removal myprog) in
32bind ? (snapshot state) (clight_to_cminor (simplify_program p0))
33(λp1. let p2 ≝ cminor_to_rtlabs init p1 in
34  exec_up_to RTLabs_fullexec p2 1000 [ ])).
35normalize
36%
37qed.
38
39include "RTLabs/CostCheck.ma".
40
41definition readable_body ≝
42λfn. insert_sort ?
43       (λx,y. leb (succ (match \fst x with [an_identifier z ⇒ z])) (match \fst y with [an_identifier z ⇒ z]))
44       (elements ?? (f_graph fn)).
45(*
46example c2: result ? (
47  let 〈p0,init〉 ≝ clight_label myprog in
48  ! p1 ← clight_to_cminor (simplify_program p0);
49  let p2 ≝ cminor_to_rtlabs init p1 in
50  match prog_funct … p2 with
51  [ nil ⇒ Error ? (msg MISSING)
52  | cons h _ ⇒
53    match \snd h with
54    [ External _ ⇒ Error ? (msg EXTERNAL)
55    | Internal fn ⇒ return 〈pi1 … (f_entry fn), readable_body fn〉
56    ]
57  ]).
58normalize
59*)
60example c2: (
61  let 〈p0,init〉 ≝ clight_label (program_switch_removal myprog) in
62  ! p1 ← clight_to_cminor (simplify_program p0);
63  let p2 ≝ cminor_to_rtlabs init p1 in
64  return (check_cost_program p2)) = OK bool true.
65normalize
66%
67qed.
68
69
Note: See TracBrowser for help on using the repository browser.