diff options
author | Jason Gross <jgross@mit.edu> | 2016-12-03 14:52:18 -0500 |
---|---|---|
committer | Jason Gross <jgross@mit.edu> | 2016-12-03 14:52:18 -0500 |
commit | 3e89f6cf8818b09f655323349cec5733bba84f80 (patch) | |
tree | 6ef5822a1fd9ea2b70abbfae9e7ac9c02554a3d8 /src/Reflection | |
parent | c21d2bfe1065d7629c8006ea9e1814e6936a1266 (diff) |
Add invert_Op
Diffstat (limited to 'src/Reflection')
-rw-r--r-- | src/Reflection/Syntax.v | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/Reflection/Syntax.v b/src/Reflection/Syntax.v index 1c3915700..40b7cdbc5 100644 --- a/src/Reflection/Syntax.v +++ b/src/Reflection/Syntax.v @@ -377,8 +377,12 @@ Section language. Section misc. Definition invert_Const {var t} (e : @exprf var t) : option (interp_type t) - := match e with - | Const _ v => Some v + := match e with Const _ v => Some v | _ => None end. + Definition invert_Op {var t} (e : @exprf var t) : option { t1 : flat_type & op t1 t * exprf t1 }%type + := match e with Op _ _ opc args => Some (existT _ _ (opc, args)) | _ => None end. + Definition invert_LetIn {var A} (e : @exprf var A) : option { B : _ & exprf B * (interp_flat_type_gen var B -> exprf A) }%type + := match e in @exprf _ t return option { B : _ & _ * (_ -> exprf t) }%type with + | LetIn _ ex _ eC => Some (existT _ _ (ex, eC)) | _ => None end. Definition invert_Pair {var A B} (e : @exprf var (Prod A B)) : option (exprf A * exprf B) @@ -389,11 +393,6 @@ Section language. | Pair _ x _ y => Some (x, y)%core | _ => None end. - Definition invert_LetIn {var A} (e : @exprf var A) : option { B : _ & exprf B * (interp_flat_type_gen var B -> exprf A) }%type - := match e in @exprf _ t return option { B : _ & _ * (_ -> exprf t) }%type with - | LetIn _ ex _ eC => Some (existT _ _ (ex, eC)) - | _ => None - end. End misc. Section wf. |