aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--_CoqProject1
-rw-r--r--src/Compilers/ZExtended/MapBaseType.v21
2 files changed, 22 insertions, 0 deletions
diff --git a/_CoqProject b/_CoqProject
index b77e1991c..3f5b2e287 100644
--- a/_CoqProject
+++ b/_CoqProject
@@ -208,6 +208,7 @@ src/Compilers/ZExtended/InlineConstAndOpByRewriteInterp.v
src/Compilers/ZExtended/InlineConstAndOpByRewriteWf.v
src/Compilers/ZExtended/InlineConstAndOpInterp.v
src/Compilers/ZExtended/InlineConstAndOpWf.v
+src/Compilers/ZExtended/MapBaseType.v
src/Compilers/ZExtended/Syntax.v
src/Compilers/ZExtended/Syntax/Util.v
src/Curves/Edwards/AffineProofs.v
diff --git a/src/Compilers/ZExtended/MapBaseType.v b/src/Compilers/ZExtended/MapBaseType.v
new file mode 100644
index 000000000..869017685
--- /dev/null
+++ b/src/Compilers/ZExtended/MapBaseType.v
@@ -0,0 +1,21 @@
+Require Import Crypto.Compilers.SmartMap.
+Require Import Crypto.Compilers.Syntax.
+Require Import Crypto.Compilers.Z.Syntax.
+Require Import Crypto.Compilers.Z.Syntax.Util.
+Require Import Crypto.Compilers.ZExtended.Syntax.
+Require Import Crypto.Compilers.ZExtended.Syntax.Util.
+Require Import Crypto.Compilers.MapBaseType.
+
+Definition MapBaseType' {t} (e : Expr t)
+ : Z.Syntax.Expr (Arrow (lift_flat_type unextend_base_type (domain t))
+ (lift_flat_type unextend_base_type (codomain t)))
+ := @MapBaseType' _ _ _ _ unextend_base_type (fun _ s d opc _ => unextend_op opc)
+ (fun _ t => Op (make_const t (ZToInterp 0)) TT)
+ t e.
+
+Definition MapBaseType {t} (e : Expr t)
+ : option (Z.Syntax.Expr (Arrow (lift_flat_type unextend_base_type (domain t))
+ (lift_flat_type unextend_base_type (codomain t))))
+ := @MapBaseType _ _ _ _ unextend_base_type (fun _ s d opc _ => unextend_op opc)
+ (fun _ t => Op (make_const t (ZToInterp 0)) TT)
+ t e.