| 1 |
Require Import Rewriter.Language.Language. |
| 2 |
Require Import Crypto.Language.API. |
| 3 |
Require Import Rewriter.Language.Wf. |
| 4 |
Require Import Crypto.Language.WfExtra. |
| 5 |
Require Import Crypto.Rewriter.AllTacticsExtra. |
| 6 |
Require Import Crypto.Rewriter.RulesProofs. |
| 7 |
|
| 8 |
Module Compilers. |
| 9 |
Import Language.Compilers. |
| 10 |
Import Language.API.Compilers. |
| 11 |
Import Language.Wf.Compilers. |
| 12 |
Import Language.WfExtra.Compilers. |
| 13 |
Import Rewriter.AllTacticsExtra.Compilers.RewriteRules.GoalType. |
| 14 |
Import Rewriter.AllTactics.Compilers.RewriteRules.Tactic. |
| 15 |
Import Compilers.Classes. |
| 16 |
|
| 17 |
Module Import RewriteRules. |
| 18 |
Section __. |
| 19 |
Definition VerifiedRewriterNBE : VerifiedRewriter_with_args true false true nbe_rewrite_rules_proofs. |
| 20 |
Proof using All. make_rewriter. Defined. |
| 21 |
|
| 22 |
Definition default_opts := Eval hnf in @default_opts VerifiedRewriterNBE. |
| 23 |
Let optsT := Eval hnf in optsT VerifiedRewriterNBE. |
| 24 |
|
| 25 |
Definition RewriteNBE (opts : optsT) {t : API.type} := Eval hnf in @Rewrite VerifiedRewriterNBE opts t. |
| 26 |
|
| 27 |
Lemma Wf_RewriteNBE opts {t} e (Hwf : Wf e) : Wf (@RewriteNBE opts t e). |
| 28 |
Proof. now apply VerifiedRewriterNBE. Qed. |
| 29 |
|
| 30 |
Lemma Interp_RewriteNBE opts {t} e (Hwf : Wf e) : API.Interp (@RewriteNBE opts t e) == API.Interp e. |
| 31 |
Proof. now apply VerifiedRewriterNBE. Qed. |
| 32 |
End __. |
| 33 |
End RewriteRules. |
| 34 |
|
| 35 |
Definition PartialEvaluate opts {t : API.type} (e : Expr t) : Expr t := RewriteRules.RewriteNBE opts e. |
| 36 |
|
| 37 |
Lemma Wf_PartialEvaluate opts {t} e (Hwf : Wf e) : Wf (@PartialEvaluate opts t e). |
| 38 |
Proof. apply Wf_RewriteNBE, Hwf. Qed. |
| 39 |
|
| 40 |
Lemma Interp_PartialEvaluate opts {t} e (Hwf : Wf e) |
| 41 |
: API.Interp (@PartialEvaluate opts t e) == API.Interp e. |
| 42 |
Proof. apply Interp_RewriteNBE, Hwf. Qed. |
| 43 |
|
| 44 |
Module Export Hints. |
| 45 |
#[global] |
| 46 |
Hint Resolve Wf_PartialEvaluate Wf_RewriteNBE : wf wf_extra. |
| 47 |
#[global] |
| 48 |
Hint Opaque PartialEvaluate RewriteNBE : wf wf_extra interp interp_extra rewrite. |
| 49 |
#[global] |
| 50 |
Hint Rewrite @Interp_PartialEvaluate @Interp_RewriteNBE : interp interp_extra. |
| 51 |
End Hints. |
| 52 |
End Compilers. |