「SF-LC」14 ImpCEvalFun

Step-Indexed Evaluator
…Copied from 12-imp.md:
Chapter
ImpCEvalFunprovide some workarounds to make functional evalution works:
- step-indexed evaluator, i.e. limit the recursion depth. (think about Depth-Limited Search).
- return
optionto tell if it’s a normal or abnormal termination.- use
LETOPT...IN...to reduce the “optional unwrapping” (basicaly Monadic binding>>=!)
this approach oflet-bindingbecame so popular in ML family.
1 | Notation "'LETOPT' x <== e1 'IN' e2" |
Relational vs. Step-Indexed Evaluation
Prove ceval_step is equiv to ceval
->
1 | Theorem ceval_step__ceval: forall c st st', |
The critical part of proof:
destructfor thei.induction i, generalize on allst st' c.i = 0case contradictioni = S i'case;destruct c.destruct (ceval_step ...)for theoptionNonecase contradictionSomecase, use induction hypothesis…
<-
1 | Theorem ceval__ceval_step: forall c st st', |
- 本文标题:「SF-LC」14 ImpCEvalFun
- 创建时间:2021-03-28 00:00:00
- 本文链接:posts/9cea.html
- 版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!