Skip to content

Commit 584eac7

Browse files
committed
Represent external worlds by a coinductive type rather than an inductive type.
As noticed by R. Krebbers, an inductive type for external worlds implies that all sequences of program-world interactions are finite, which is not the case.
1 parent 9f30d49 commit 584eac7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

common/Determinism.v

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Require Import Behaviors.
3636
that this external call succeeds, has result [r], and changes
3737
the world to [w]. *)
3838

39-
Inductive world: Type :=
39+
CoInductive world: Type :=
4040
World (io: ident -> list eventval -> option (eventval * world))
4141
(vload: memory_chunk -> ident -> int -> option (eventval * world))
4242
(vstore: memory_chunk -> ident -> int -> eventval -> option world).

driver/Interp.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ let do_inline_assembly txt sg ge w args m = None
402402
(* Implementing external functions producing observable events *)
403403

404404
let rec world ge m =
405-
Determinism.World(world_io ge m, world_vload ge m, world_vstore ge m)
405+
lazy (Determinism.World(world_io ge m, world_vload ge m, world_vstore ge m))
406406

407407
and world_io ge m id args =
408408
None

0 commit comments

Comments
 (0)