summaryrefslogtreecommitdiff
path: root/src/interpreter.ml
diff options
context:
space:
mode:
authorBrian Campbell2019-04-15 12:08:28 +0100
committerBrian Campbell2019-04-15 12:08:28 +0100
commit1f421b865a87a161a82550443a0cf39aa2642d9c (patch)
tree61cd10e0203c7e613ba280c73360abfecad38277 /src/interpreter.ml
parent57443173923e87f33713c99dbab9eba7e3db0660 (diff)
Basic loop termination measures for Coq
Currently only supports pure termination measures for loops with effects. The user syntax uses separate termination measure declarations, as in the previous recursive termination measures, which are rewritten into the loop AST nodes before type checking (because it would be rather difficult to calculate the correct environment to type check the separate declaration in).
Diffstat (limited to 'src/interpreter.ml')
-rw-r--r--src/interpreter.ml4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/interpreter.ml b/src/interpreter.ml
index f01a3846..b198c59b 100644
--- a/src/interpreter.ml
+++ b/src/interpreter.ml
@@ -243,8 +243,8 @@ let rec step (E_aux (e_aux, annot) as orig_exp) =
| E_if (exp, then_exp, else_exp) ->
step exp >>= fun exp' -> wrap (E_if (exp', then_exp, else_exp))
- | E_loop (While, exp, body) -> wrap (E_if (exp, E_aux (E_block [body; orig_exp], annot), exp_of_value V_unit))
- | E_loop (Until, exp, body) -> wrap (E_block [body; E_aux (E_if (exp, exp_of_value V_unit, orig_exp), annot)])
+ | E_loop (While, _, exp, body) -> wrap (E_if (exp, E_aux (E_block [body; orig_exp], annot), exp_of_value V_unit))
+ | E_loop (Until, _, exp, body) -> wrap (E_block [body; E_aux (E_if (exp, exp_of_value V_unit, orig_exp), annot)])
| E_assert (exp, msg) when is_true exp -> wrap unit_exp
| E_assert (exp, msg) when is_false exp && is_value msg ->