summaryrefslogtreecommitdiff
path: root/lib/coq/Sail2_prompt.v
diff options
context:
space:
mode:
authorBrian Campbell2018-12-12 18:23:00 +0000
committerBrian Campbell2018-12-12 18:23:00 +0000
commitf8d88d4cf2439f4920fa948b054c4f0b2899e368 (patch)
treeca227449fe5579ecfd3ac003d8dd31e33fa92d41 /lib/coq/Sail2_prompt.v
parent4f20163965e7c336f28740628fa9d64528006861 (diff)
Move much of recursive function termination to a rewrite
It now includes updating the effects so that morally pure recursive functions can be turned into this impure termination-by-assertion form.
Diffstat (limited to 'lib/coq/Sail2_prompt.v')
-rw-r--r--lib/coq/Sail2_prompt.v11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/coq/Sail2_prompt.v b/lib/coq/Sail2_prompt.v
index 8c0ca33c..85ca95f6 100644
--- a/lib/coq/Sail2_prompt.v
+++ b/lib/coq/Sail2_prompt.v
@@ -77,13 +77,14 @@ match b with
| BU => undefined_bool tt
end.
-(* For termination of recursive functions. *)
-Lemma _limit_is_limit {_limit : Z} : _limit >? 0 = true -> Zwf 0 (_limit - 1) _limit.
-intros.
-prepare_for_solver.
+(* For termination of recursive functions. We don't name assertions, so use
+ the type class mechanism to find it. *)
+Definition _limit_reduces {_limit} (_acc:Acc (Zwf 0) _limit) `{ArithFact (_limit >= 0)} : Acc (Zwf 0) (_limit - 1).
+refine (Acc_inv _acc _).
+destruct H.
red.
omega.
-Qed.
+Defined.
(*val whileM : forall 'rv 'vars 'e. 'vars -> ('vars -> monad 'rv bool 'e) ->
('vars -> monad 'rv 'vars 'e) -> monad 'rv 'vars 'e