@@ -27,39 +27,33 @@ containing the generated proof object, a.k.a. the _certificate_. The certificate
27
27
it into Agda and checking that it is correctly typed.
28
28
29
29
```
30
- {-# OPTIONS --allow-unsolved-metas #-}
31
30
module VerifiedCompilation where
32
31
```
33
32
34
33
## Imports
35
34
36
35
```
37
- import Data.Bool.Base using (Bool; true; false; T; _∧_; _∨_; not)
38
- open import Data.Nat using (ℕ; zero; suc)
39
36
open import Relation.Nullary using (Dec; yes; no; ¬_)
40
37
41
- import Relation.Nullary using (_×-dec_)
42
- import Relation.Binary using (Decidable)
43
38
open import Untyped
44
39
open import Utils as U using (Maybe;nothing;just;Either;inj₁;inj₂;List;[];_∷_;_×_;_,_)
45
40
open import RawU using (Untyped)
46
- open import Data.String using (String;_++_ )
41
+ open import Data.String using (String)
47
42
open import Agda.Builtin.IO using (IO)
48
- open import Agda.Builtin.Unit using (⊤;tt)
49
- import IO.Primitive.Core as IO using (return;_>>=_)
43
+ open import Agda.Builtin.Unit using (⊤)
50
44
import VerifiedCompilation.UCaseOfCase as UCC
51
45
import VerifiedCompilation.UForceDelay as UFD
52
46
import VerifiedCompilation.UFloatDelay as UFlD
53
47
import VerifiedCompilation.UCSE as UCSE
48
+ import VerifiedCompilation.UInline as UInline
49
+ import VerifiedCompilation.UCaseReduce as UCR
54
50
open import Data.Empty using (⊥)
55
- open import Scoped using (ScopeError;deBError)
56
51
open import VerifiedCompilation.Equality using (DecEq)
57
- import Relation.Binary as Binary using (Decidable)
58
- open import VerifiedCompilation.UntypedTranslation using (Translation; Relation; translation?)
59
- import Relation.Binary as Binary using (Decidable)
52
+ open import VerifiedCompilation.UntypedTranslation using (Relation)
60
53
import Relation.Unary as Unary using (Decidable)
61
54
import Agda.Builtin.Int
62
55
import Relation.Nary as Nary using (Decidable)
56
+ import IO.Primitive.Core as IO
63
57
```
64
58
65
59
## Compiler optimisation traces
@@ -96,8 +90,10 @@ data Transformation : SimplifierTag → Relation where
96
90
isFD : {X : Set}{{_ : DecEq X}} → {ast ast' : X ⊢} → UFD.ForceDelay ast ast' → Transformation forceDelayT ast ast'
97
91
isFlD : {X : Set}{{_ : DecEq X}} → {ast ast' : X ⊢} → UFlD.FloatDelay ast ast' → Transformation floatDelayT ast ast'
98
92
isCSE : {X : Set}{{_ : DecEq X}} → {ast ast' : X ⊢} → UCSE.UntypedCSE ast ast' → Transformation cseT ast ast'
93
+ -- TODO: the decision procedure for Inline is broken, so we leave it as "not implemented"
94
+ -- isUInline : {X : Set}{{_ : DecEq X}} → {ast ast' : X ⊢} → UInline.UInline ast ast' → Transformation inlineT ast ast'
99
95
inlineNotImplemented : {X : Set}{{_ : DecEq X}} → {ast ast' : X ⊢} → Transformation inlineT ast ast'
100
- caseReduceNotImplemented : {X : Set}{{_ : DecEq X}} → {ast ast' : X ⊢} → Transformation caseReduceT ast ast'
96
+ isCaseReduce : {X : Set}{{_ : DecEq X}} → {ast ast' : X ⊢} → UCR.UCaseReduce ast ast' → Transformation caseReduceT ast ast'
101
97
102
98
data Trace : { X : Set } {{_ : DecEq X}} → List (SimplifierTag × (X ⊢) × (X ⊢)) → Set₁ where
103
99
empty : {X : Set}{{_ : DecEq X}} → Trace {X} []
@@ -120,8 +116,14 @@ isTransformation? tag ast ast' | forceDelayT with UFD.isForceDelay? ast ast'
120
116
isTransformation? tag ast ast' | caseOfCaseT with UCC.isCaseOfCase? ast ast'
121
117
... | no ¬p = no λ { (isCoC x) → ¬p x }
122
118
... | yes p = yes (isCoC p)
123
- isTransformation? tag ast ast' | caseReduceT = yes caseReduceNotImplemented
119
+ -- isTransformation? tag ast ast' | caseReduceT = yes caseReduceNotImplemented
120
+ isTransformation? tag ast ast' | caseReduceT with UCR.isCaseReduce? ast ast'
121
+ ... | no ¬p = no λ { (isCaseReduce x) → ¬p x }
122
+ ... | yes p = yes (isCaseReduce p)
124
123
isTransformation? tag ast ast' | inlineT = yes inlineNotImplemented
124
+ -- isTransformation? tag ast ast' | inlineT with UInline.isInline? ast ast'
125
+ -- ... | no ¬p = no λ { (isUInline x) → ¬p x }
126
+ -- ... | yes p = yes (isUInline p)
125
127
isTransformation? tag ast ast' | cseT with UCSE.isUntypedCSE? ast ast'
126
128
... | no ¬p = no λ { (isCSE x) → ¬p x }
127
129
... | yes p = yes (isCSE p)
0 commit comments