File tree Expand file tree Collapse file tree 3 files changed +57
-0
lines changed
Expand file tree Collapse file tree 3 files changed +57
-0
lines changed Original file line number Diff line number Diff line change 1+ /* krml header omitted for test repeatability */
2+
3+
4+ #include "ExtractPulseFnIface.h"
5+
6+ extern krml_checked_int_t Prims_op_Addition(krml_checked_int_t x, krml_checked_int_t y);
7+
8+ krml_checked_int_t ExtractPulseFnIface_pure_add(krml_checked_int_t x, krml_checked_int_t y)
9+ {
10+ return Prims_op_Addition(x, y);
11+ }
12+
13+ krml_checked_int_t ExtractPulseFnIface_pulse_read_ref(krml_checked_int_t *r)
14+ {
15+ return *r;
16+ }
17+
Original file line number Diff line number Diff line change 1+ module ExtractPulseFnIface
2+ # lang - pulse
3+
4+ open Pulse.Lib.Pervasives
5+ open Pulse.Lib.Reference
6+ module R = Pulse.Lib.Reference
7+
8+ let pure_add ( x y : int) : int = x + y
9+
10+ fn pulse_read_ref
11+ ( r : ref int)
12+ (# v : Ghost . erased int)
13+ requires R. pts_to r v
14+ returns x : int
15+ ensures R. pts_to r v ** pure ( x == Ghost . reveal v )
16+ {
17+ let x = !r ;
18+ x
19+ }
Original file line number Diff line number Diff line change 1+ module ExtractPulseFnIface
2+ # lang - pulse
3+
4+ (* * Interface for ExtractPulseFnIface.
5+ Tests that a Pulse fn declared in .fsti extracts to C correctly.
6+ Regression test: previously, fn declarations in .fsti were not
7+ recognized by the interleaver, causing the implementation to be
8+ tagged KrmlPrivate and silently dropped by KaRaMeL. *)
9+
10+ open Pulse.Lib.Pervasives
11+ open Pulse.Lib.Reference
12+ module R = Pulse.Lib.Reference
13+
14+ val pure_add ( x y : int) : int
15+
16+ fn pulse_read_ref
17+ ( r : ref int)
18+ (# v : Ghost . erased int)
19+ requires R. pts_to r v
20+ returns x : int
21+ ensures R. pts_to r v ** pure ( x == Ghost . reveal v )
You can’t perform that action at this time.
0 commit comments