aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Gross <jgross@mit.edu>2019-04-09 22:37:22 -0400
committerJason Gross <jasongross9@gmail.com>2019-04-11 11:01:29 -0400
commitbe2789ada63a1a5a6710da1abc73430f9b676399 (patch)
tree8ade84e8cf5f84bd2780ab0d87efcebb3fa744c9
parent606f334bbbf480f8e08c57945a7d4001dc267af6 (diff)
rm src/*.out, now that we no longer generate these
-rw-r--r--src/arith_rewrite_head.out2035
-rw-r--r--src/arith_with_casts_rewrite_head.out3060
-rw-r--r--src/fancy_rewrite_head.out290
-rw-r--r--src/fancy_with_casts_rewrite_head.out6485
-rw-r--r--src/nbe_rewrite_head.out3134
-rw-r--r--src/strip_literal_casts_rewrite_head.out316
6 files changed, 0 insertions, 15320 deletions
diff --git a/src/arith_rewrite_head.out b/src/arith_rewrite_head.out
deleted file mode 100644
index 1d3591c3b..000000000
--- a/src/arith_rewrite_head.out
+++ /dev/null
@@ -1,2035 +0,0 @@
-arith_rewrite_head =
-match idc in (Compilers.ident t) return (Compile.value' true t) with
-| @Literal t v => Base (##v)%expr
-| Nat_succ => fun x : expr ℕ => Base (#(Nat_succ)%expr @ x)%expr_pat
-| Nat_pred => fun x : expr ℕ => Base (#(Nat_pred)%expr @ x)%expr_pat
-| Nat_max => fun x x0 : expr ℕ => Base (#(Nat_max)%expr @ x @ x0)%expr_pat
-| Nat_mul => fun x x0 : expr ℕ => Base (#(Nat_mul)%expr @ x @ x0)%expr_pat
-| Nat_add => fun x x0 : expr ℕ => Base (#(Nat_add)%expr @ x @ x0)%expr_pat
-| Nat_sub => fun x x0 : expr ℕ => Base (#(Nat_sub)%expr @ x @ x0)%expr_pat
-| Nat_eqb => fun x x0 : expr ℕ => Base (#(Nat_eqb)%expr @ x @ x0)%expr_pat
-| @nil t => Base []%expr_pat
-| @cons t => fun (x : expr t) (x0 : expr (list t)) => Base (x :: x0)%expr_pat
-| @pair A B => fun (x : expr A) (x0 : expr B) => Base (x, x0)%expr_pat
-| @fst A B =>
- fun x : expr (A * B)%etype =>
- ((match x with
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) x1) _ =>
- args <- invert_bind_args idc Raw.ident.pair;
- match
- pattern.type.unify_extracted
- ((('1 * '2)%pbtype -> '1%pbtype) ->
- (('1%pbtype -> '2%pbtype -> ('1 * '2)%pbtype) -> '1%pbtype) ->
- '2%pbtype)%ptype
- (((A * B)%etype -> A) ->
- (((let (x2, _) := args in x2) ->
- (let (_, y) := args in y) ->
- ((let (x2, _) := args in x2) * (let (_, y) := args in y))%etype) ->
- s0) -> s)%ptype
- with
- | Datatypes.Some (_, _, _, (_, (_, (_, _)), b3, b2))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((b3 * b2)%etype -> b3) ->
- ((b3 -> b2 -> (b3 * b2)%etype) -> b3) -> b2)%ptype
- (((A * B)%etype -> A) ->
- (((let (x2, _) := args in x2) ->
- (let (_, y) := args in y) ->
- ((let (x2, _) := args in x2) * (let (_, y) := args in y))%etype) ->
- s0) -> s)%ptype
- then
- _ <- ident.unify pattern.ident.fst fst;
- _ <- ident.unify pattern.ident.pair pair;
- v <- type.try_make_transport_cps s0 b3;
- _ <- type.try_make_transport_cps s b2;
- v1 <- base.try_make_transport_cps b3 b3;
- _ <- base.try_make_transport_cps b2 b2;
- v3 <- base.try_make_transport_cps b3 A;
- v4 <- base.try_make_transport_cps A A;
- Datatypes.Some
- (fv1 <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($(v1 (v (Compile.reflect x1))));
- Base (v4 (v3 fv1)))%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ ($_)%expr _) _ | @expr.App
- _ _ _ s _ (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _) _ |
- @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ (_ @ _)%expr_pat _) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _) _ =>
- Datatypes.None
- | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr
- _ | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s
- _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base (#(fst)%expr @ x)%expr_pat)%option
-| @snd A B =>
- fun x : expr (A * B)%etype =>
- ((match x with
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) _) x0 =>
- args <- invert_bind_args idc Raw.ident.pair;
- match
- pattern.type.unify_extracted
- ((('1 * '2)%pbtype -> '2%pbtype) ->
- (('1%pbtype -> '2%pbtype -> ('1 * '2)%pbtype) -> '1%pbtype) ->
- '2%pbtype)%ptype
- (((A * B)%etype -> B) ->
- (((let (x2, _) := args in x2) ->
- (let (_, y) := args in y) ->
- ((let (x2, _) := args in x2) * (let (_, y) := args in y))%etype) ->
- s0) -> s)%ptype
- with
- | Datatypes.Some (_, _, _, (_, (_, (_, _)), b3, b2))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((b3 * b2)%etype -> b2) ->
- ((b3 -> b2 -> (b3 * b2)%etype) -> b3) -> b2)%ptype
- (((A * B)%etype -> B) ->
- (((let (x2, _) := args in x2) ->
- (let (_, y) := args in y) ->
- ((let (x2, _) := args in x2) * (let (_, y) := args in y))%etype) ->
- s0) -> s)%ptype
- then
- _ <- ident.unify pattern.ident.snd snd;
- _ <- ident.unify pattern.ident.pair pair;
- _ <- type.try_make_transport_cps s0 b3;
- v0 <- type.try_make_transport_cps s b2;
- _ <- base.try_make_transport_cps b3 b3;
- v2 <- base.try_make_transport_cps b2 b2;
- v3 <- base.try_make_transport_cps b2 B;
- v4 <- base.try_make_transport_cps B B;
- Datatypes.Some
- (fv1 <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($(v2 (v0 (Compile.reflect x0))));
- Base (v4 (v3 fv1)))%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ ($_)%expr _) _ | @expr.App
- _ _ _ s _ (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _) _ |
- @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ (_ @ _)%expr_pat _) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _) _ =>
- Datatypes.None
- | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr
- _ | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s
- _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base (#(snd)%expr @ x)%expr_pat)%option
-| @prod_rect A B T =>
- fun (x : expr A -> expr B -> UnderLets (expr T))
- (x0 : expr (A * B)%etype) =>
- Base
- (#(prod_rect)%expr @
- (λ (x1 : var A)(x2 : var B),
- to_expr (x ($x1) ($x2)))%expr @ x0)%expr_pat
-| @bool_rect T =>
- fun (x x0 : expr unit -> UnderLets (expr T)) (x1 : expr bool) =>
- Base
- (#(bool_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ x2 : var unit,
- to_expr (x0 ($x2)))%expr @ x1)%expr_pat
-| @nat_rect P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr ℕ -> expr P -> UnderLets (expr P)) (x1 : expr ℕ) =>
- Base
- (#(nat_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var ℕ)(x3 : var P),
- to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat
-| @nat_rect_arrow P Q =>
- fun (x : expr P -> UnderLets (expr Q))
- (x0 : expr ℕ ->
- (expr P -> UnderLets (expr Q)) -> expr P -> UnderLets (expr Q))
- (x1 : expr ℕ) (x2 : expr P) =>
- Base
- (#(nat_rect_arrow)%expr @ (λ x3 : var P,
- to_expr (x ($x3)))%expr @
- (λ (x3 : var ℕ)(x4 : var (P -> Q)%ptype)(x5 : var P),
- to_expr
- (x0 ($x3) (fun x6 : expr P => Base ($x4 @ x6)%expr_pat) ($x5)))%expr @
- x1 @ x2)%expr_pat
-| @eager_nat_rect P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr ℕ -> expr P -> UnderLets (expr P)) (x1 : expr ℕ) =>
- Base
- (#(eager_nat_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var ℕ)(x3 : var P),
- to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat
-| @eager_nat_rect_arrow P Q =>
- fun (x : expr P -> UnderLets (expr Q))
- (x0 : expr ℕ ->
- (expr P -> UnderLets (expr Q)) -> expr P -> UnderLets (expr Q))
- (x1 : expr ℕ) (x2 : expr P) =>
- Base
- (#(eager_nat_rect_arrow)%expr @ (λ x3 : var P,
- to_expr (x ($x3)))%expr @
- (λ (x3 : var ℕ)(x4 : var (P -> Q)%ptype)(x5 : var P),
- to_expr
- (x0 ($x3) (fun x6 : expr P => Base ($x4 @ x6)%expr_pat) ($x5)))%expr @
- x1 @ x2)%expr_pat
-| @list_rect A P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr A -> expr (list A) -> expr P -> UnderLets (expr P))
- (x1 : expr (list A)) =>
- Base
- (#(list_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var A)(x3 : var (list A))(x4 : var P),
- to_expr (x0 ($x2) ($x3) ($x4)))%expr @ x1)%expr_pat
-| @list_rect_arrow A P Q =>
- fun (x : expr P -> UnderLets (expr Q))
- (x0 : expr A ->
- expr (list A) ->
- (expr P -> UnderLets (expr Q)) -> expr P -> UnderLets (expr Q))
- (x1 : expr (list A)) (x2 : expr P) =>
- Base
- (#(list_rect_arrow)%expr @ (λ x3 : var P,
- to_expr (x ($x3)))%expr @
- (λ (x3 : var A)(x4 : var (list A))(x5 : var (P -> Q)%ptype)(x6 :
- var P),
- to_expr
- (x0 ($x3) ($x4) (fun x7 : expr P => Base ($x5 @ x7)%expr_pat) ($x6)))%expr @
- x1 @ x2)%expr_pat
-| @eager_list_rect A P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr A -> expr (list A) -> expr P -> UnderLets (expr P))
- (x1 : expr (list A)) =>
- Base
- (#(eager_list_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var A)(x3 : var (list A))(x4 : var P),
- to_expr (x0 ($x2) ($x3) ($x4)))%expr @ x1)%expr_pat
-| @eager_list_rect_arrow A P Q =>
- fun (x : expr P -> UnderLets (expr Q))
- (x0 : expr A ->
- expr (list A) ->
- (expr P -> UnderLets (expr Q)) -> expr P -> UnderLets (expr Q))
- (x1 : expr (list A)) (x2 : expr P) =>
- Base
- (#(eager_list_rect_arrow)%expr @ (λ x3 : var P,
- to_expr (x ($x3)))%expr @
- (λ (x3 : var A)(x4 : var (list A))(x5 : var (P -> Q)%ptype)(x6 :
- var P),
- to_expr
- (x0 ($x3) ($x4) (fun x7 : expr P => Base ($x5 @ x7)%expr_pat) ($x6)))%expr @
- x1 @ x2)%expr_pat
-| @list_case A P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr A -> expr (list A) -> UnderLets (expr P))
- (x1 : expr (list A)) =>
- Base
- (#(list_case)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var A)(x3 : var (list A)),
- to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat
-| @List_length T =>
- fun x : expr (list T) => Base (#(List_length)%expr @ x)%expr_pat
-| List_seq => fun x x0 : expr ℕ => Base (#(List_seq)%expr @ x @ x0)%expr_pat
-| @List_firstn A =>
- fun (x : expr ℕ) (x0 : expr (list A)) =>
- Base (#(List_firstn)%expr @ x @ x0)%expr_pat
-| @List_skipn A =>
- fun (x : expr ℕ) (x0 : expr (list A)) =>
- Base (#(List_skipn)%expr @ x @ x0)%expr_pat
-| @List_repeat A =>
- fun (x : expr A) (x0 : expr ℕ) =>
- Base (#(List_repeat)%expr @ x @ x0)%expr_pat
-| @List_combine A B =>
- fun (x : expr (list A)) (x0 : expr (list B)) =>
- Base (#(List_combine)%expr @ x @ x0)%expr_pat
-| @List_map A B =>
- fun (x : expr A -> UnderLets (expr B)) (x0 : expr (list A)) =>
- Base
- (#(List_map)%expr @ (λ x1 : var A,
- to_expr (x ($x1)))%expr @ x0)%expr_pat
-| @List_app A => fun x x0 : expr (list A) => Base (x ++ x0)%expr
-| @List_rev A =>
- fun x : expr (list A) => Base (#(List_rev)%expr @ x)%expr_pat
-| @List_flat_map A B =>
- fun (x : expr A -> UnderLets (expr (list B))) (x0 : expr (list A)) =>
- Base
- (#(List_flat_map)%expr @ (λ x1 : var A,
- to_expr (x ($x1)))%expr @ x0)%expr_pat
-| @List_partition A =>
- fun (x : expr A -> UnderLets (expr bool)) (x0 : expr (list A)) =>
- Base
- (#(List_partition)%expr @ (λ x1 : var A,
- to_expr (x ($x1)))%expr @ x0)%expr_pat
-| @List_fold_right A B =>
- fun (x : expr B -> expr A -> UnderLets (expr A)) (x0 : expr A)
- (x1 : expr (list B)) =>
- Base
- (#(List_fold_right)%expr @
- (λ (x2 : var B)(x3 : var A),
- to_expr (x ($x2) ($x3)))%expr @ x0 @ x1)%expr_pat
-| @List_update_nth T =>
- fun (x : expr ℕ) (x0 : expr T -> UnderLets (expr T)) (x1 : expr (list T))
- =>
- Base
- (#(List_update_nth)%expr @ x @ (λ x2 : var T,
- to_expr (x0 ($x2)))%expr @ x1)%expr_pat
-| @List_nth_default T =>
- fun (x : expr T) (x0 : expr (list T)) (x1 : expr ℕ) =>
- Base (#(List_nth_default)%expr @ x @ x0 @ x1)%expr_pat
-| @eager_List_nth_default T =>
- fun (x : expr T) (x0 : expr (list T)) (x1 : expr ℕ) =>
- Base (#(eager_List_nth_default)%expr @ x @ x0 @ x1)%expr_pat
-| Z_add =>
- fun x x0 : expr ℤ =>
- (((match x with
- | @expr.Ident _ _ _ t idc =>
- args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if (let (x1, _) := xv in x1) =? 0
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($x0))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x0 with
- | @expr.Ident _ _ _ t idc =>
- args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if (let (x1, _) := xv in x1) =? 0
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($x))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ (@expr.Ident _ _ _ t idc) x1 =>
- match x with
- | @expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t0 idc0) x2 =>
- _ <- invert_bind_args idc0 Raw.ident.Z_opp;
- _ <- invert_bind_args idc Raw.ident.Z_opp;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype (s0 -> s)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (s0 -> s)%ptype
- then
- v <- type.try_make_transport_cps s0 ℤ;
- v0 <- type.try_make_transport_cps s ℤ;
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (-
- ($(v (Compile.reflect x2)) +
- $(v0 (Compile.reflect x1))));
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s0 _ ($_)%expr _ | @expr.App _ _ _ s0 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s0 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s0 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat _ |
- @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;
- match x with
- | @expr.App _ _ _ s _ (@expr.Ident _ _ _ t idc) x1 =>
- _ <- invert_bind_args idc Raw.ident.Z_opp;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype (s -> ℤ)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (s -> ℤ)%ptype
- then
- v <- type.try_make_transport_cps s ℤ;
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($x0 - $(v (Compile.reflect x1)));
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat _ |
- @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;
- match x0 with
- | @expr.Ident _ _ _ t idc =>
- match x with
- | @expr.App _ _ _ s _ (@expr.Ident _ _ _ t0 idc0) x1 =>
- (_ <- invert_bind_args idc0 Raw.ident.Z_opp;
- args0 <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- (s -> (projT1 args0))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (ℤ -> ℤ)%ptype (s -> (projT1 args0))%ptype
- then
- v <- type.try_make_transport_cps s ℤ;
- xv <- ident.unify pattern.ident.Literal ##(projT2 args0);
- fv <- (if (let (x2, _) := xv in x2) >? 0
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (##(let (x2, _) := xv in x2) -
- $(v (Compile.reflect x1))))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;
- _ <- invert_bind_args idc0 Raw.ident.Z_opp;
- args0 <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- (s -> (projT1 args0))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (s -> (projT1 args0))%ptype
- then
- v <- type.try_make_transport_cps s ℤ;
- xv <- ident.unify pattern.ident.Literal ##(projT2 args0);
- fv <- (if (let (x2, _) := xv in x2) <? 0
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (-
- ($(v (Compile.reflect x1)) +
- ##(- (let (x2, _) := xv in x2))%Z)))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat
- _ | @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s _ (@expr.Ident _ _ _ t idc) x1 =>
- (_ <- invert_bind_args idc Raw.ident.Z_opp;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype (ℤ -> s)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (ℤ -> s)%ptype
- then
- v <- type.try_make_transport_cps s ℤ;
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($x - $(v (Compile.reflect x1)));
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;
- match x with
- | @expr.Ident _ _ _ t0 idc0 =>
- (args <- invert_bind_args idc0 Raw.ident.Literal;
- _ <- invert_bind_args idc Raw.ident.Z_opp;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- ((projT1 args) -> s)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (ℤ -> ℤ)%ptype ((projT1 args) -> s)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- v <- type.try_make_transport_cps s ℤ;
- fv <- (if (let (x2, _) := xv in x2) >? 0
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (##(let (x2, _) := xv in x2) -
- $(v (Compile.reflect x1))))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;
- args <- invert_bind_args idc0 Raw.ident.Literal;
- _ <- invert_bind_args idc Raw.ident.Z_opp;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- ((projT1 args) -> s)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- ((projT1 args) -> s)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- v <- type.try_make_transport_cps s ℤ;
- fv <- (if (let (x2, _) := xv in x2) <? 0
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (-
- (##(- (let (x2, _) := xv in x2))%Z +
- $(v (Compile.reflect x1)))))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat _ |
- @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end);;
- Datatypes.None);;;
- Base (x + x0)%expr)%option
-| Z_mul =>
- fun x x0 : expr ℤ =>
- (((match x with
- | @expr.Ident _ _ _ t idc =>
- args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if (let (x1, _) := xv in x1) =? 0
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false ##0)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x0 with
- | @expr.Ident _ _ _ t idc =>
- args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if (let (x1, _) := xv in x1) =? 0
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false ##0)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x with
- | @expr.Ident _ _ _ t idc =>
- args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if (let (x1, _) := xv in x1) =? 1
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($x0))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x0 with
- | @expr.Ident _ _ _ t idc =>
- (args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if (let (x1, _) := xv in x1) =? 1
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($x))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;
- match x with
- | @expr.App _ _ _ s _ (@expr.Ident _ _ _ t0 idc0) x1 =>
- _ <- invert_bind_args idc0 Raw.ident.Z_opp;
- args0 <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- (s -> (projT1 args0))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (s -> (projT1 args0))%ptype
- then
- v <- type.try_make_transport_cps s ℤ;
- xv <- ident.unify pattern.ident.Literal ##(projT2 args0);
- fv <- (if (let (x2, _) := xv in x2) =? -1
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($(v (Compile.reflect x1))))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat
- _ | @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s _ (@expr.Ident _ _ _ t idc) x1 =>
- match x with
- | @expr.Ident _ _ _ t0 idc0 =>
- args <- invert_bind_args idc0 Raw.ident.Literal;
- _ <- invert_bind_args idc Raw.ident.Z_opp;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- ((projT1 args) -> s)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- ((projT1 args) -> s)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- v <- type.try_make_transport_cps s ℤ;
- fv <- (if (let (x2, _) := xv in x2) =? -1
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($(v (Compile.reflect x1))))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat _ |
- @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;
- match x with
- | @expr.Ident _ _ _ t idc =>
- args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if (let (x1, _) := xv in x1) =? -1
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (- $x0))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x0 with
- | @expr.Ident _ _ _ t idc =>
- args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if (let (x1, _) := xv in x1) =? -1
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (- $x))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ (@expr.Ident _ _ _ t idc) x1 =>
- match x with
- | @expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t0 idc0) x2 =>
- _ <- invert_bind_args idc0 Raw.ident.Z_opp;
- _ <- invert_bind_args idc Raw.ident.Z_opp;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype (s0 -> s)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (s0 -> s)%ptype
- then
- v <- type.try_make_transport_cps s0 ℤ;
- v0 <- type.try_make_transport_cps s ℤ;
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($(v (Compile.reflect x2)) *
- $(v0 (Compile.reflect x1)));
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s0 _ ($_)%expr _ | @expr.App _ _ _ s0 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s0 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s0 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat _ |
- @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;
- match x with
- | @expr.App _ _ _ s _ (@expr.Ident _ _ _ t idc) x1 =>
- _ <- invert_bind_args idc Raw.ident.Z_opp;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype (s -> ℤ)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (s -> ℤ)%ptype
- then
- v <- type.try_make_transport_cps s ℤ;
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (- ($(v (Compile.reflect x1)) * $x0));
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat _ |
- @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;
- match x0 with
- | @expr.Ident _ _ _ t idc =>
- match x with
- | @expr.Ident _ _ _ t0 idc0 =>
- args <- invert_bind_args idc0 Raw.ident.Literal;
- args0 <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- ((projT1 args) -> (projT1 args0))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- ((projT1 args) -> (projT1 args0))%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- xv0 <- ident.unify pattern.ident.Literal ##(projT2 args0);
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ##((let (x1, _) := xv in x1) *
- (let (x1, _) := xv0 in x1));
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s _ (@expr.Ident _ _ _ t idc) x1 =>
- _ <- invert_bind_args idc Raw.ident.Z_opp;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype (ℤ -> s)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (ℤ -> s)%ptype
- then
- v <- type.try_make_transport_cps s ℤ;
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (- ($x * $(v (Compile.reflect x1))));
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat _ |
- @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;
- match x with
- | @expr.Ident _ _ _ t idc =>
- args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if (let (x1, _) := xv in x1) <? 0
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (- (##(- (let (x1, _) := xv in x1))%Z * $x0)))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x0 with
- | @expr.Ident _ _ _ t idc =>
- (args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if (let (x1, _) := xv in x1) <? 0
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (- ($x * ##(- (let (x1, _) := xv in x1))%Z)))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;
- args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if
- ((let (x1, _) := xv in x1) =?
- 2 ^ Z.log2 (let (x1, _) := xv in x1)) &&
- negb ((let (x1, _) := xv in x1) =? 2)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($x << ##(Z.log2 (let (x1, _) := xv in x1))))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x with
- | @expr.Ident _ _ _ t idc =>
- (args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if
- ((let (x1, _) := xv in x1) =?
- 2 ^ Z.log2 (let (x1, _) := xv in x1)) &&
- negb ((let (x1, _) := xv in x1) =? 2)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($x0 << ##(Z.log2 (let (x1, _) := xv in x1))))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;
- match x0 with
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t0 idc0) x2) x1 =>
- match x2 with
- | @expr.Ident _ _ _ t1 idc1 =>
- match x1 with
- | @expr.App _ _ _ s1 _
- (@expr.App _ _ _ s2 _ (@expr.Ident _ _ _ t2 idc2) x4)
- x3 =>
- _ <- invert_bind_args idc2 Raw.ident.Z_mul;
- args0 <- invert_bind_args idc1 Raw.ident.Literal;
- _ <- invert_bind_args idc0 Raw.ident.Z_mul;
- args2 <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted
- (ℤ -> ℤ -> ℤ -> ℤ)%ptype
- ((projT1 args2) -> (projT1 args0) -> s2 -> s1)%ptype
- with
- | Datatypes.Some (_, (_, (_, _)))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (ℤ -> ℤ -> ℤ -> ℤ)%ptype
- ((projT1 args2) -> (projT1 args0) -> s2 -> s1)%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args2);
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args0);
- v <- type.try_make_transport_cps s2 ℤ;
- v0 <- type.try_make_transport_cps s1 ℤ;
- fv <- (if
- (Z.abs (let (x5, _) := xv in x5) <=?
- Z.abs max_const_val) &&
- (Z.abs (let (x5, _) := xv0 in x5) <=?
- Z.abs max_const_val)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- ($(v (Compile.reflect x4)) *
- ($(v0 (Compile.reflect x3)) *
- (##(let (x5, _) := xv in x5) *
- ##(let (x5, _) := xv0 in x5)))))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s1 _ (@expr.App _ _ _ s2 _ ($_)%expr _)
- _ | @expr.App _ _ _ s1 _
- (@expr.App _ _ _ s2 _ (@expr.Abs _ _ _ _ _ _) _) _ |
- @expr.App _ _ _ s1 _
- (@expr.App _ _ _ s2 _ (_ @ _)%expr_pat _) _ | @expr.App
- _ _ _ s1 _
- (@expr.App _ _ _ s2 _ (@expr.LetIn _ _ _ _ _ _ _) _)
- _ => Datatypes.None
- | @expr.App _ _ _ s1 _ #(_)%expr_pat _ | @expr.App _ _ _
- s1 _ ($_)%expr _ | @expr.App _ _ _ s1 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s1 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x1 with
- | (@expr.App _ _ _ s2 _ (@expr.Ident _ _ _ t1 idc1) x4 @
- @expr.Ident _ _ _ t2 idc2)%expr_pat =>
- args <- invert_bind_args idc2 Raw.ident.Literal;
- _ <- invert_bind_args idc1 Raw.ident.Z_mul;
- _ <- invert_bind_args idc0 Raw.ident.Z_mul;
- args2 <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ -> ℤ -> ℤ)%ptype
- ((projT1 args2) -> s0 -> s2 -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, (_, (_, _)))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (ℤ -> ℤ -> ℤ -> ℤ)%ptype
- ((projT1 args2) -> s0 -> s2 -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args2);
- v <- type.try_make_transport_cps s0 ℤ;
- v0 <- type.try_make_transport_cps s2 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- (Z.abs (let (x5, _) := xv in x5) <=?
- Z.abs max_const_val) &&
- (Z.abs (let (x5, _) := xv0 in x5) <=?
- Z.abs max_const_val)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($(v (Compile.reflect x2)) *
- ($(v0 (Compile.reflect x4)) *
- (##(let (x5, _) := xv in x5) *
- ##(let (x5, _) := xv0 in x5)))))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.App _ _ _ s2 _ (@expr.Ident _ _ _ t1 idc1) x4 @
- ($_)%expr)%expr_pat |
- (@expr.App _ _ _ s2 _ (@expr.Ident _ _ _ t1 idc1) x4 @
- @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.App _ _ _ s2 _ (@expr.Ident _ _ _ t1 idc1) x4 @
- (_ @ _))%expr_pat |
- (@expr.App _ _ _ s2 _ (@expr.Ident _ _ _ t1 idc1) x4 @
- @expr.LetIn _ _ _ _ _ _ _)%expr_pat => Datatypes.None
- | (@expr.App _ _ _ s2 _ ($_)%expr _ @ _)%expr_pat |
- (@expr.App _ _ _ s2 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat |
- (@expr.App _ _ _ s2 _ (_ @ _) _ @ _)%expr_pat |
- (@expr.App _ _ _ s2 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- _ <- invert_bind_args idc0 Raw.ident.Z_mul;
- args0 <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ -> ℤ)%ptype
- ((projT1 args0) -> s0 -> s)%ptype
- with
- | Datatypes.Some (_, (_, _))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (ℤ -> ℤ -> ℤ)%ptype ((projT1 args0) -> s0 -> s)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args0);
- v <- type.try_make_transport_cps s0 ℤ;
- v0 <- type.try_make_transport_cps s ℤ;
- fv <- (if
- Z.abs (let (x3, _) := xv in x3) <=?
- Z.abs max_const_val
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($(v (Compile.reflect x2)) *
- ($(v0 (Compile.reflect x1)) *
- ##(let (x3, _) := xv in x3))))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ ($_)%expr _) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _) _ | @expr.App _
- _ _ s _ (@expr.App _ _ _ s0 _ (_ @ _)%expr_pat _) _ | @expr.App
- _ _ _ s _ (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _)
- _ => Datatypes.None
- | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _
- ($_)%expr _ | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ |
- @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if
- Z.abs (let (x1, _) := xv in x1) <=?
- Z.abs max_const_val
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($x0 * ##(let (x1, _) := xv in x1)))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end);;
- Datatypes.None);;;
- Base (x * x0)%expr)%option
-| Z_pow => fun x x0 : expr ℤ => Base (#(Z_pow)%expr @ x @ x0)%expr_pat
-| Z_sub =>
- fun x x0 : expr ℤ =>
- (((match x with
- | @expr.Ident _ _ _ t idc =>
- match x0 with
- | @expr.App _ _ _ s _ (@expr.Ident _ _ _ t0 idc0) x1 =>
- _ <- invert_bind_args idc0 Raw.ident.Z_opp;
- args0 <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- ((projT1 args0) -> s)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- ((projT1 args0) -> s)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args0);
- v <- type.try_make_transport_cps s ℤ;
- fv <- (if (let (x2, _) := xv in x2) =? 0
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($(v (Compile.reflect x1))))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat
- _ | @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if (let (x1, _) := xv in x1) =? 0
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (- $x0))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x0 with
- | @expr.Ident _ _ _ t idc =>
- args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if (let (x1, _) := xv in x1) =? 0
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($x))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ (@expr.Ident _ _ _ t idc) x1 =>
- match x with
- | @expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t0 idc0) x2 =>
- _ <- invert_bind_args idc0 Raw.ident.Z_opp;
- _ <- invert_bind_args idc Raw.ident.Z_opp;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype (s0 -> s)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (s0 -> s)%ptype
- then
- v <- type.try_make_transport_cps s0 ℤ;
- v0 <- type.try_make_transport_cps s ℤ;
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($(v0 (Compile.reflect x1)) -
- $(v (Compile.reflect x2)));
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s0 _ ($_)%expr _ | @expr.App _ _ _ s0 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s0 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s0 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat _ |
- @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;
- match x with
- | @expr.App _ _ _ s _ (@expr.Ident _ _ _ t idc) x1 =>
- _ <- invert_bind_args idc Raw.ident.Z_opp;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype (s -> ℤ)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (s -> ℤ)%ptype
- then
- v <- type.try_make_transport_cps s ℤ;
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (- ($(v (Compile.reflect x1)) + $x0));
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat _ |
- @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;
- match x0 with
- | @expr.App _ _ _ s _ (@expr.Ident _ _ _ t idc) x1 =>
- (_ <- invert_bind_args idc Raw.ident.Z_opp;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype (ℤ -> s)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (ℤ -> s)%ptype
- then
- v <- type.try_make_transport_cps s ℤ;
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($x + $(v (Compile.reflect x1)));
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;
- match x with
- | @expr.Ident _ _ _ t0 idc0 =>
- (args <- invert_bind_args idc0 Raw.ident.Literal;
- _ <- invert_bind_args idc Raw.ident.Z_opp;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- ((projT1 args) -> s)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (ℤ -> ℤ)%ptype ((projT1 args) -> s)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- v <- type.try_make_transport_cps s ℤ;
- fv <- (if (let (x2, _) := xv in x2) >? 0
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (##(let (x2, _) := xv in x2) +
- $(v (Compile.reflect x1))))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;
- args <- invert_bind_args idc0 Raw.ident.Literal;
- _ <- invert_bind_args idc Raw.ident.Z_opp;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- ((projT1 args) -> s)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- ((projT1 args) -> s)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- v <- type.try_make_transport_cps s ℤ;
- fv <- (if (let (x2, _) := xv in x2) <? 0
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($(v (Compile.reflect x1)) -
- ##(- (let (x2, _) := xv in x2))%Z))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat _ |
- @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;
- match x with
- | @expr.Ident _ _ _ t idc =>
- args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if (let (x1, _) := xv in x1) <? 0
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (- (##(- (let (x1, _) := xv in x1))%Z + $x0)))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ (@expr.Ident _ _ _ t idc) x1 =>
- match x0 with
- | @expr.Ident _ _ _ t0 idc0 =>
- (args <- invert_bind_args idc0 Raw.ident.Literal;
- _ <- invert_bind_args idc Raw.ident.Z_opp;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- (s -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (ℤ -> ℤ)%ptype (s -> (projT1 args))%ptype
- then
- v <- type.try_make_transport_cps s ℤ;
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if (let (x2, _) := xv in x2) >? 0
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (-
- ($(v (Compile.reflect x1)) +
- ##(let (x2, _) := xv in x2))))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;
- args <- invert_bind_args idc0 Raw.ident.Literal;
- _ <- invert_bind_args idc Raw.ident.Z_opp;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- (s -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (s -> (projT1 args))%ptype
- then
- v <- type.try_make_transport_cps s ℤ;
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if (let (x2, _) := xv in x2) <? 0
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (##(- (let (x2, _) := xv in x2))%Z -
- $(v (Compile.reflect x1))))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat _ |
- @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;
- match x0 with
- | @expr.Ident _ _ _ t idc =>
- args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if (let (x1, _) := xv in x1) <? 0
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($x + ##(- (let (x1, _) := xv in x1))%Z))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end);;
- Datatypes.None);;;
- Base (x - x0)%expr)%option
-| Z_opp =>
- fun x : expr ℤ =>
- ((match x with
- | @expr.App _ _ _ s _ (@expr.Ident _ _ _ t idc) x0 =>
- _ <- invert_bind_args idc Raw.ident.Z_opp;
- match pattern.type.unify_extracted ℤ s with
- | Datatypes.Some _ =>
- if type.type_beq base.type base.type.type_beq ℤ s
- then
- v <- type.try_make_transport_cps s ℤ;
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($(v (Compile.reflect x0)));
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat _ |
- @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;
- match pattern.type.unify_extracted ℤ ℤ with
- | Datatypes.Some _ =>
- if type.type_beq base.type base.type.type_beq ℤ ℤ
- then
- fv <- (if negb (SubstVarLike.is_var_fst_snd_pair_opp_cast x)
- then
- Datatypes.Some
- (UnderLet x (fun v : var ℤ => Base (- $v)%expr))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;;
- Base (- x)%expr)%option
-| Z_div =>
- fun x x0 : expr ℤ =>
- ((match x0 with
- | @expr.Ident _ _ _ t idc =>
- (args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if (let (x1, _) := xv in x1) =? 1
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($x))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;
- args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if
- (let (x1, _) := xv in x1) =?
- 2 ^ Z.log2 (let (x1, _) := xv in x1)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($x >> ##(Z.log2 (let (x1, _) := xv in x1))))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base (x / x0)%expr)%option
-| Z_modulo =>
- fun x x0 : expr ℤ =>
- (match x0 with
- | @expr.Ident _ _ _ t idc =>
- (args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if (let (x1, _) := xv in x1) =? 1
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false ##0)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;
- args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if
- (let (x1, _) := xv in x1) =?
- 2 ^ Z.log2 (let (x1, _) := xv in x1)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($x &' ##((let (x1, _) := xv in x1) - 1)%Z))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end;;;
- Base (x mod x0)%expr)%option
-| Z_log2 => fun x : expr ℤ => Base (#(Z_log2)%expr @ x)%expr_pat
-| Z_log2_up => fun x : expr ℤ => Base (#(Z_log2_up)%expr @ x)%expr_pat
-| Z_eqb => fun x x0 : expr ℤ => Base (#(Z_eqb)%expr @ x @ x0)%expr_pat
-| Z_leb => fun x x0 : expr ℤ => Base (#(Z_leb)%expr @ x @ x0)%expr_pat
-| Z_ltb => fun x x0 : expr ℤ => Base (#(Z_ltb)%expr @ x @ x0)%expr_pat
-| Z_geb => fun x x0 : expr ℤ => Base (#(Z_geb)%expr @ x @ x0)%expr_pat
-| Z_gtb => fun x x0 : expr ℤ => Base (#(Z_gtb)%expr @ x @ x0)%expr_pat
-| Z_of_nat => fun x : expr ℕ => Base (#(Z_of_nat)%expr @ x)%expr_pat
-| Z_to_nat => fun x : expr ℤ => Base (#(Z_to_nat)%expr @ x)%expr_pat
-| Z_shiftr => fun x x0 : expr ℤ => Base (x >> x0)%expr
-| Z_shiftl => fun x x0 : expr ℤ => Base (x << x0)%expr
-| Z_land =>
- fun x x0 : expr ℤ =>
- ((match x0 with
- | @expr.Ident _ _ _ t idc =>
- args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if (let (x1, _) := xv in x1) =? 0
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false ##0)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base (x &' x0)%expr)%option
-| Z_lor => fun x x0 : expr ℤ => Base (x || x0)%expr
-| Z_min => fun x x0 : expr ℤ => Base (#(Z_min)%expr @ x @ x0)%expr_pat
-| Z_max => fun x x0 : expr ℤ => Base (#(Z_max)%expr @ x @ x0)%expr_pat
-| Z_bneg => fun x : expr ℤ => Base (#(Z_bneg)%expr @ x)%expr_pat
-| Z_lnot_modulo =>
- fun x x0 : expr ℤ => Base (#(Z_lnot_modulo)%expr @ x @ x0)%expr_pat
-| Z_mul_split =>
- fun x x0 x1 : expr ℤ => Base (#(Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat
-| Z_add_get_carry =>
- fun x x0 x1 : expr ℤ =>
- ((match x1 with
- | @expr.App _ _ _ s _ (@expr.Ident _ _ _ t idc) x2 =>
- _ <- invert_bind_args idc Raw.ident.Z_opp;
- match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- ((ℤ -> ℤ) -> s)%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype ((ℤ -> ℤ) -> s)%ptype
- then
- v <- type.try_make_transport_cps s ℤ;
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (expr_let v0 := (#(Z_sub_get_borrow)%expr @
- ($x)%expr @ ($x0)%expr @
- ($(v (Compile.reflect x2)))%expr)%expr_pat in
- (#(fst)%expr @ $v0,
- - (#(snd)%expr @ $v0)%expr_pat)%expr_pat);
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat _ |
- @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;
- match x0 with
- | @expr.App _ _ _ s _ (@expr.Ident _ _ _ t idc) x2 =>
- _ <- invert_bind_args idc Raw.ident.Z_opp;
- match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- ((ℤ -> s) -> ℤ)%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype ((ℤ -> s) -> ℤ)%ptype
- then
- v <- type.try_make_transport_cps s ℤ;
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (expr_let v0 := (#(Z_sub_get_borrow)%expr @
- ($x)%expr @ ($x1)%expr @
- ($(v (Compile.reflect x2)))%expr)%expr_pat in
- (#(fst)%expr @ $v0,
- - (#(snd)%expr @ $v0)%expr_pat)%expr_pat);
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat _ |
- @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end);;;
- Base (#(Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat)%option
-| Z_add_with_carry =>
- fun x x0 x1 : expr ℤ =>
- Base (#(Z_add_with_carry)%expr @ x @ x0 @ x1)%expr_pat
-| Z_add_with_get_carry =>
- fun x x0 x1 x2 : expr ℤ =>
- (match x0 with
- | @expr.Ident _ _ _ t idc =>
- match x2 with
- | @expr.App _ _ _ s _ (@expr.Ident _ _ _ t0 idc0) x3 =>
- _ <- invert_bind_args idc0 Raw.ident.Z_opp;
- args0 <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((ℤ -> (projT1 args0)) -> ℤ) -> s)%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((ℤ -> (projT1 args0)) -> ℤ) -> s)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args0);
- v <- type.try_make_transport_cps s ℤ;
- fv <- (if (let (x4, _) := xv in x4) =? 0
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (expr_let v0 := (#(Z_sub_get_borrow)%expr @
- ($x)%expr @ ($x1)%expr @
- ($(v (Compile.reflect x3)))%expr)%expr_pat in
- (#(fst)%expr @ $v0,
- - (#(snd)%expr @ $v0)%expr_pat)%expr_pat))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat
- _ | @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- match x1 with
- | @expr.App _ _ _ s _ (@expr.Ident _ _ _ t0 idc0) x3 =>
- _ <- invert_bind_args idc0 Raw.ident.Z_opp;
- args0 <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((ℤ -> (projT1 args0)) -> s) -> ℤ)%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((ℤ -> (projT1 args0)) -> s) -> ℤ)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args0);
- v <- type.try_make_transport_cps s ℤ;
- fv <- (if (let (x4, _) := xv in x4) =? 0
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (expr_let v0 := (#(Z_sub_get_borrow)%expr @
- ($x)%expr @ ($x2)%expr @
- ($(v (Compile.reflect x3)))%expr)%expr_pat in
- (#(fst)%expr @ $v0,
- - (#(snd)%expr @ $v0)%expr_pat)%expr_pat))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat
- _ | @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s _ (@expr.Ident _ _ _ t idc) x3 =>
- match x1 with
- | @expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t0 idc0) x4 =>
- _ <- invert_bind_args idc0 Raw.ident.Z_opp;
- _ <- invert_bind_args idc Raw.ident.Z_opp;
- match
- pattern.type.unify_extracted (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((ℤ -> s) -> s0) -> ℤ)%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((ℤ -> s) -> s0) -> ℤ)%ptype
- then
- v <- type.try_make_transport_cps s ℤ;
- v0 <- type.try_make_transport_cps s0 ℤ;
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (expr_let v1 := (#(Z_sub_with_get_borrow)%expr @
- ($x)%expr @
- ($(v (Compile.reflect x3)))%expr @
- ($x2)%expr @
- ($(v0 (Compile.reflect x4)))%expr)%expr_pat in
- (#(fst)%expr @ $v1,
- - (#(snd)%expr @ $v1)%expr_pat)%expr_pat);
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s0 _ ($_)%expr _ | @expr.App _ _ _ s0 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s0 _ (_ @ _)%expr_pat
- _ | @expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- match x2 with
- | @expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t0 idc0) x4 =>
- _ <- invert_bind_args idc0 Raw.ident.Z_opp;
- _ <- invert_bind_args idc Raw.ident.Z_opp;
- match
- pattern.type.unify_extracted (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((ℤ -> s) -> ℤ) -> s0)%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((ℤ -> s) -> ℤ) -> s0)%ptype
- then
- v <- type.try_make_transport_cps s ℤ;
- v0 <- type.try_make_transport_cps s0 ℤ;
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (expr_let v1 := (#(Z_sub_with_get_borrow)%expr @
- ($x)%expr @
- ($(v (Compile.reflect x3)))%expr @
- ($x1)%expr @
- ($(v0 (Compile.reflect x4)))%expr)%expr_pat in
- (#(fst)%expr @ $v1,
- - (#(snd)%expr @ $v1)%expr_pat)%expr_pat);
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s0 _ ($_)%expr _ | @expr.App _ _ _ s0 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s0 _ (_ @ _)%expr_pat
- _ | @expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat _ |
- @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;;
- Base (#(Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat)%option
-| Z_sub_get_borrow =>
- fun x x0 x1 : expr ℤ =>
- Base (#(Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat
-| Z_sub_with_get_borrow =>
- fun x x0 x1 x2 : expr ℤ =>
- Base (#(Z_sub_with_get_borrow)%expr @ x @ x0 @ x1 @ x2)%expr_pat
-| Z_zselect =>
- fun x x0 x1 : expr ℤ => Base (#(Z_zselect)%expr @ x @ x0 @ x1)%expr_pat
-| Z_add_modulo =>
- fun x x0 x1 : expr ℤ =>
- Base (#(Z_add_modulo)%expr @ x @ x0 @ x1)%expr_pat
-| Z_rshi =>
- fun x x0 x1 x2 : expr ℤ =>
- Base (#(Z_rshi)%expr @ x @ x0 @ x1 @ x2)%expr_pat
-| Z_cc_m => fun x x0 : expr ℤ => Base (#(Z_cc_m)%expr @ x @ x0)%expr_pat
-| Z_combine_at_bitwidth =>
- fun x x0 x1 : expr ℤ =>
- Base (#(Z_combine_at_bitwidth)%expr @ x @ x0 @ x1)%expr_pat
-| Z_cast range => fun x : expr ℤ => Base (#(Z_cast range)%expr @ x)%expr_pat
-| Z_cast2 range =>
- fun x : expr (ℤ * ℤ)%etype => Base (#(Z_cast2 range)%expr @ x)%expr_pat
-| Some A => fun x : expr A => Base (#(Some)%expr @ x)%expr_pat
-| None A => Base #(None)%expr
-| @option_rect A P =>
- fun (x : expr A -> UnderLets (expr P))
- (x0 : expr unit -> UnderLets (expr P)) (x1 : expr (base.type.option A))
- =>
- Base
- (#(option_rect)%expr @ (λ x2 : var A,
- to_expr (x ($x2)))%expr @
- (λ x2 : var unit,
- to_expr (x0 ($x2)))%expr @ x1)%expr_pat
-| Build_zrange =>
- fun x x0 : expr ℤ => Base (#(Build_zrange)%expr @ x @ x0)%expr_pat
-| @zrange_rect P =>
- fun (x : expr ℤ -> expr ℤ -> UnderLets (expr P))
- (x0 : expr base.type.zrange) =>
- Base
- (#(zrange_rect)%expr @ (λ x1 x2 : var ℤ,
- to_expr (x ($x1) ($x2)))%expr @ x0)%expr_pat
-| fancy_add log2wordmax imm =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_add log2wordmax imm)%expr @ x)%expr_pat
-| fancy_addc log2wordmax imm =>
- fun x : expr (ℤ * ℤ * ℤ)%etype =>
- Base (#(fancy_addc log2wordmax imm)%expr @ x)%expr_pat
-| fancy_sub log2wordmax imm =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_sub log2wordmax imm)%expr @ x)%expr_pat
-| fancy_subb log2wordmax imm =>
- fun x : expr (ℤ * ℤ * ℤ)%etype =>
- Base (#(fancy_subb log2wordmax imm)%expr @ x)%expr_pat
-| fancy_mulll log2wordmax =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_mulll log2wordmax)%expr @ x)%expr_pat
-| fancy_mullh log2wordmax =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_mullh log2wordmax)%expr @ x)%expr_pat
-| fancy_mulhl log2wordmax =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_mulhl log2wordmax)%expr @ x)%expr_pat
-| fancy_mulhh log2wordmax =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_mulhh log2wordmax)%expr @ x)%expr_pat
-| fancy_rshi log2wordmax x =>
- fun x0 : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_rshi log2wordmax x)%expr @ x0)%expr_pat
-| fancy_selc =>
- fun x : expr (ℤ * ℤ * ℤ)%etype => Base (#(fancy_selc)%expr @ x)%expr_pat
-| fancy_selm log2wordmax =>
- fun x : expr (ℤ * ℤ * ℤ)%etype =>
- Base (#(fancy_selm log2wordmax)%expr @ x)%expr_pat
-| fancy_sell =>
- fun x : expr (ℤ * ℤ * ℤ)%etype => Base (#(fancy_sell)%expr @ x)%expr_pat
-| fancy_addm =>
- fun x : expr (ℤ * ℤ * ℤ)%etype => Base (#(fancy_addm)%expr @ x)%expr_pat
-end
- : Compile.value' true t
diff --git a/src/arith_with_casts_rewrite_head.out b/src/arith_with_casts_rewrite_head.out
deleted file mode 100644
index 6eb141dfc..000000000
--- a/src/arith_with_casts_rewrite_head.out
+++ /dev/null
@@ -1,3060 +0,0 @@
-arith_with_casts_rewrite_head =
-match idc in (Compilers.ident t) return (Compile.value' true t) with
-| @Literal t v => Base (##v)%expr
-| Nat_succ => fun x : expr ℕ => Base (#(Nat_succ)%expr @ x)%expr_pat
-| Nat_pred => fun x : expr ℕ => Base (#(Nat_pred)%expr @ x)%expr_pat
-| Nat_max => fun x x0 : expr ℕ => Base (#(Nat_max)%expr @ x @ x0)%expr_pat
-| Nat_mul => fun x x0 : expr ℕ => Base (#(Nat_mul)%expr @ x @ x0)%expr_pat
-| Nat_add => fun x x0 : expr ℕ => Base (#(Nat_add)%expr @ x @ x0)%expr_pat
-| Nat_sub => fun x x0 : expr ℕ => Base (#(Nat_sub)%expr @ x @ x0)%expr_pat
-| Nat_eqb => fun x x0 : expr ℕ => Base (#(Nat_eqb)%expr @ x @ x0)%expr_pat
-| @nil t => Base []%expr_pat
-| @cons t => fun (x : expr t) (x0 : expr (list t)) => Base (x :: x0)%expr_pat
-| @pair A B => fun (x : expr A) (x0 : expr B) => Base (x, x0)%expr_pat
-| @fst A B =>
- fun x : expr (A * B)%etype =>
- ((match x with
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) x1) _ =>
- args <- invert_bind_args idc Raw.ident.pair;
- match
- pattern.type.unify_extracted
- ((('1 * '2)%pbtype -> '1%pbtype) ->
- (('1%pbtype -> '2%pbtype -> ('1 * '2)%pbtype) -> '1%pbtype) ->
- '2%pbtype)%ptype
- (((A * B)%etype -> A) ->
- (((let (x2, _) := args in x2) ->
- (let (_, y) := args in y) ->
- ((let (x2, _) := args in x2) * (let (_, y) := args in y))%etype) ->
- s0) -> s)%ptype
- with
- | Datatypes.Some (_, _, _, (_, (_, (_, _)), b3, b2))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((b3 * b2)%etype -> b3) ->
- ((b3 -> b2 -> (b3 * b2)%etype) -> b3) -> b2)%ptype
- (((A * B)%etype -> A) ->
- (((let (x2, _) := args in x2) ->
- (let (_, y) := args in y) ->
- ((let (x2, _) := args in x2) * (let (_, y) := args in y))%etype) ->
- s0) -> s)%ptype
- then
- _ <- ident.unify pattern.ident.fst fst;
- _ <- ident.unify pattern.ident.pair pair;
- v <- type.try_make_transport_cps s0 b3;
- _ <- type.try_make_transport_cps s b2;
- v1 <- base.try_make_transport_cps b3 b3;
- _ <- base.try_make_transport_cps b2 b2;
- v3 <- base.try_make_transport_cps b3 A;
- v4 <- base.try_make_transport_cps A A;
- Datatypes.Some
- (fv1 <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($(v1 (v (Compile.reflect x1))));
- Base (v4 (v3 fv1)))%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ ($_)%expr _) _ | @expr.App
- _ _ _ s _ (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _) _ |
- @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ (_ @ _)%expr_pat _) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _) _ =>
- Datatypes.None
- | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr
- _ | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s
- _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base (#(fst)%expr @ x)%expr_pat)%option
-| @snd A B =>
- fun x : expr (A * B)%etype =>
- ((match x with
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) _) x0 =>
- args <- invert_bind_args idc Raw.ident.pair;
- match
- pattern.type.unify_extracted
- ((('1 * '2)%pbtype -> '2%pbtype) ->
- (('1%pbtype -> '2%pbtype -> ('1 * '2)%pbtype) -> '1%pbtype) ->
- '2%pbtype)%ptype
- (((A * B)%etype -> B) ->
- (((let (x2, _) := args in x2) ->
- (let (_, y) := args in y) ->
- ((let (x2, _) := args in x2) * (let (_, y) := args in y))%etype) ->
- s0) -> s)%ptype
- with
- | Datatypes.Some (_, _, _, (_, (_, (_, _)), b3, b2))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((b3 * b2)%etype -> b2) ->
- ((b3 -> b2 -> (b3 * b2)%etype) -> b3) -> b2)%ptype
- (((A * B)%etype -> B) ->
- (((let (x2, _) := args in x2) ->
- (let (_, y) := args in y) ->
- ((let (x2, _) := args in x2) * (let (_, y) := args in y))%etype) ->
- s0) -> s)%ptype
- then
- _ <- ident.unify pattern.ident.snd snd;
- _ <- ident.unify pattern.ident.pair pair;
- _ <- type.try_make_transport_cps s0 b3;
- v0 <- type.try_make_transport_cps s b2;
- _ <- base.try_make_transport_cps b3 b3;
- v2 <- base.try_make_transport_cps b2 b2;
- v3 <- base.try_make_transport_cps b2 B;
- v4 <- base.try_make_transport_cps B B;
- Datatypes.Some
- (fv1 <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($(v2 (v0 (Compile.reflect x0))));
- Base (v4 (v3 fv1)))%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ ($_)%expr _) _ | @expr.App
- _ _ _ s _ (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _) _ |
- @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ (_ @ _)%expr_pat _) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _) _ =>
- Datatypes.None
- | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr
- _ | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s
- _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base (#(snd)%expr @ x)%expr_pat)%option
-| @prod_rect A B T =>
- fun (x : expr A -> expr B -> UnderLets (expr T))
- (x0 : expr (A * B)%etype) =>
- Base
- (#(prod_rect)%expr @
- (λ (x1 : var A)(x2 : var B),
- to_expr (x ($x1) ($x2)))%expr @ x0)%expr_pat
-| @bool_rect T =>
- fun (x x0 : expr unit -> UnderLets (expr T)) (x1 : expr bool) =>
- Base
- (#(bool_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ x2 : var unit,
- to_expr (x0 ($x2)))%expr @ x1)%expr_pat
-| @nat_rect P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr ℕ -> expr P -> UnderLets (expr P)) (x1 : expr ℕ) =>
- Base
- (#(nat_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var ℕ)(x3 : var P),
- to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat
-| @nat_rect_arrow P Q =>
- fun (x : expr P -> UnderLets (expr Q))
- (x0 : expr ℕ ->
- (expr P -> UnderLets (expr Q)) -> expr P -> UnderLets (expr Q))
- (x1 : expr ℕ) (x2 : expr P) =>
- Base
- (#(nat_rect_arrow)%expr @ (λ x3 : var P,
- to_expr (x ($x3)))%expr @
- (λ (x3 : var ℕ)(x4 : var (P -> Q)%ptype)(x5 : var P),
- to_expr
- (x0 ($x3) (fun x6 : expr P => Base ($x4 @ x6)%expr_pat) ($x5)))%expr @
- x1 @ x2)%expr_pat
-| @eager_nat_rect P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr ℕ -> expr P -> UnderLets (expr P)) (x1 : expr ℕ) =>
- Base
- (#(eager_nat_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var ℕ)(x3 : var P),
- to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat
-| @eager_nat_rect_arrow P Q =>
- fun (x : expr P -> UnderLets (expr Q))
- (x0 : expr ℕ ->
- (expr P -> UnderLets (expr Q)) -> expr P -> UnderLets (expr Q))
- (x1 : expr ℕ) (x2 : expr P) =>
- Base
- (#(eager_nat_rect_arrow)%expr @ (λ x3 : var P,
- to_expr (x ($x3)))%expr @
- (λ (x3 : var ℕ)(x4 : var (P -> Q)%ptype)(x5 : var P),
- to_expr
- (x0 ($x3) (fun x6 : expr P => Base ($x4 @ x6)%expr_pat) ($x5)))%expr @
- x1 @ x2)%expr_pat
-| @list_rect A P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr A -> expr (list A) -> expr P -> UnderLets (expr P))
- (x1 : expr (list A)) =>
- Base
- (#(list_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var A)(x3 : var (list A))(x4 : var P),
- to_expr (x0 ($x2) ($x3) ($x4)))%expr @ x1)%expr_pat
-| @list_rect_arrow A P Q =>
- fun (x : expr P -> UnderLets (expr Q))
- (x0 : expr A ->
- expr (list A) ->
- (expr P -> UnderLets (expr Q)) -> expr P -> UnderLets (expr Q))
- (x1 : expr (list A)) (x2 : expr P) =>
- Base
- (#(list_rect_arrow)%expr @ (λ x3 : var P,
- to_expr (x ($x3)))%expr @
- (λ (x3 : var A)(x4 : var (list A))(x5 : var (P -> Q)%ptype)(x6 :
- var P),
- to_expr
- (x0 ($x3) ($x4) (fun x7 : expr P => Base ($x5 @ x7)%expr_pat) ($x6)))%expr @
- x1 @ x2)%expr_pat
-| @eager_list_rect A P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr A -> expr (list A) -> expr P -> UnderLets (expr P))
- (x1 : expr (list A)) =>
- Base
- (#(eager_list_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var A)(x3 : var (list A))(x4 : var P),
- to_expr (x0 ($x2) ($x3) ($x4)))%expr @ x1)%expr_pat
-| @eager_list_rect_arrow A P Q =>
- fun (x : expr P -> UnderLets (expr Q))
- (x0 : expr A ->
- expr (list A) ->
- (expr P -> UnderLets (expr Q)) -> expr P -> UnderLets (expr Q))
- (x1 : expr (list A)) (x2 : expr P) =>
- Base
- (#(eager_list_rect_arrow)%expr @ (λ x3 : var P,
- to_expr (x ($x3)))%expr @
- (λ (x3 : var A)(x4 : var (list A))(x5 : var (P -> Q)%ptype)(x6 :
- var P),
- to_expr
- (x0 ($x3) ($x4) (fun x7 : expr P => Base ($x5 @ x7)%expr_pat) ($x6)))%expr @
- x1 @ x2)%expr_pat
-| @list_case A P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr A -> expr (list A) -> UnderLets (expr P))
- (x1 : expr (list A)) =>
- Base
- (#(list_case)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var A)(x3 : var (list A)),
- to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat
-| @List_length T =>
- fun x : expr (list T) => Base (#(List_length)%expr @ x)%expr_pat
-| List_seq => fun x x0 : expr ℕ => Base (#(List_seq)%expr @ x @ x0)%expr_pat
-| @List_firstn A =>
- fun (x : expr ℕ) (x0 : expr (list A)) =>
- Base (#(List_firstn)%expr @ x @ x0)%expr_pat
-| @List_skipn A =>
- fun (x : expr ℕ) (x0 : expr (list A)) =>
- Base (#(List_skipn)%expr @ x @ x0)%expr_pat
-| @List_repeat A =>
- fun (x : expr A) (x0 : expr ℕ) =>
- Base (#(List_repeat)%expr @ x @ x0)%expr_pat
-| @List_combine A B =>
- fun (x : expr (list A)) (x0 : expr (list B)) =>
- Base (#(List_combine)%expr @ x @ x0)%expr_pat
-| @List_map A B =>
- fun (x : expr A -> UnderLets (expr B)) (x0 : expr (list A)) =>
- Base
- (#(List_map)%expr @ (λ x1 : var A,
- to_expr (x ($x1)))%expr @ x0)%expr_pat
-| @List_app A => fun x x0 : expr (list A) => Base (x ++ x0)%expr
-| @List_rev A =>
- fun x : expr (list A) => Base (#(List_rev)%expr @ x)%expr_pat
-| @List_flat_map A B =>
- fun (x : expr A -> UnderLets (expr (list B))) (x0 : expr (list A)) =>
- Base
- (#(List_flat_map)%expr @ (λ x1 : var A,
- to_expr (x ($x1)))%expr @ x0)%expr_pat
-| @List_partition A =>
- fun (x : expr A -> UnderLets (expr bool)) (x0 : expr (list A)) =>
- Base
- (#(List_partition)%expr @ (λ x1 : var A,
- to_expr (x ($x1)))%expr @ x0)%expr_pat
-| @List_fold_right A B =>
- fun (x : expr B -> expr A -> UnderLets (expr A)) (x0 : expr A)
- (x1 : expr (list B)) =>
- Base
- (#(List_fold_right)%expr @
- (λ (x2 : var B)(x3 : var A),
- to_expr (x ($x2) ($x3)))%expr @ x0 @ x1)%expr_pat
-| @List_update_nth T =>
- fun (x : expr ℕ) (x0 : expr T -> UnderLets (expr T)) (x1 : expr (list T))
- =>
- Base
- (#(List_update_nth)%expr @ x @ (λ x2 : var T,
- to_expr (x0 ($x2)))%expr @ x1)%expr_pat
-| @List_nth_default T =>
- fun (x : expr T) (x0 : expr (list T)) (x1 : expr ℕ) =>
- Base (#(List_nth_default)%expr @ x @ x0 @ x1)%expr_pat
-| @eager_List_nth_default T =>
- fun (x : expr T) (x0 : expr (list T)) (x1 : expr ℕ) =>
- Base (#(eager_List_nth_default)%expr @ x @ x0 @ x1)%expr_pat
-| Z_add =>
- fun x x0 : expr ℤ =>
- (((match x with
- | (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat =>
- args <- invert_bind_args idc0 Raw.ident.Literal;
- args0 <- invert_bind_args idc Raw.ident.Z_cast;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if
- is_bounded_by_bool 0 (ZRange.normalize args0) &&
- ((let (x2, _) := xv in x2) =? 0)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($x0))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t idc @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t idc @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t idc @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t idc @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- match x0 with
- | (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat =>
- args <- invert_bind_args idc0 Raw.ident.Literal;
- args0 <- invert_bind_args idc Raw.ident.Z_cast;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- (ℤ -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if
- is_bounded_by_bool 0 (ZRange.normalize args0) &&
- ((let (x2, _) := xv in x2) =? 0)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($x))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t idc @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t idc @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t idc @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t idc @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end);;
- Datatypes.None);;;
- Base (x + x0)%expr)%option
-| Z_mul => fun x x0 : expr ℤ => Base (x * x0)%expr
-| Z_pow => fun x x0 : expr ℤ => Base (#(Z_pow)%expr @ x @ x0)%expr_pat
-| Z_sub =>
- fun x x0 : expr ℤ =>
- ((match x with
- | (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat =>
- (args <- invert_bind_args idc0 Raw.ident.Literal;
- args0 <- invert_bind_args idc Raw.ident.Z_cast;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if
- is_bounded_by_bool 0 (ZRange.normalize args0) &&
- ((let (x2, _) := xv in x2) =? 0)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (- $x0))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;
- match x0 with
- | (@expr.Ident _ _ _ t1 idc1 @
- (@expr.Ident _ _ _ t2 idc2 @ @expr.App _ _ _ s2 _
- (@expr.Ident _ _ _ t3 idc3) x4))%expr_pat =>
- args <- invert_bind_args idc3 Raw.ident.Z_cast;
- _ <- invert_bind_args idc2 Raw.ident.Z_opp;
- args1 <- invert_bind_args idc1 Raw.ident.Z_cast;
- args2 <- invert_bind_args idc0 Raw.ident.Literal;
- args3 <- invert_bind_args idc Raw.ident.Z_cast;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- ((projT1 args2) -> s2)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- ((projT1 args2) -> s2)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args2);
- v <- type.try_make_transport_cps s2 ℤ;
- fv <- (if
- (ZRange.normalize args <=?
- - ZRange.normalize args1)%zrange &&
- is_bounded_by_bool 0 (ZRange.normalize args3) &&
- ((let (x5, _) := xv in x5) =? 0)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (#(Z_cast args)%expr @
- ($(v (Compile.reflect x4)))%expr)%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t1 idc1 @
- (@expr.Ident _ _ _ t2 idc2 @ @expr.App _ _ _ s2 _ ($_)%expr _))%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @
- (@expr.Ident _ _ _ t2 idc2 @ @expr.App _ _ _ s2 _
- (@expr.Abs _ _ _ _ _ _) _))%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @
- (@expr.Ident _ _ _ t2 idc2 @ @expr.App _ _ _ s2 _ (_ @ _) _))%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @
- (@expr.Ident _ _ _ t2 idc2 @ @expr.App _ _ _ s2 _
- (@expr.LetIn _ _ _ _ _ _ _) _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t1 idc1 @ (@expr.Ident _ _ _ t2 idc2 @ #(_)))%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @
- (@expr.Ident _ _ _ t2 idc2 @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @
- (@expr.Ident _ _ _ t2 idc2 @ @expr.Abs _ _ _ _ _ _))%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @
- (@expr.Ident _ _ _ t2 idc2 @ @expr.LetIn _ _ _ _ _ _ _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t1 idc1 @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @ (_ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @ (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | (@expr.Ident _ _ _ t idc @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t idc @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t idc @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t idc @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base (x - x0)%expr)%option
-| Z_opp =>
- fun x : expr ℤ =>
- ((match x with
- | (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t1 idc1) x2))%expr_pat =>
- args <- invert_bind_args idc1 Raw.ident.Z_cast;
- _ <- invert_bind_args idc0 Raw.ident.Z_opp;
- args1 <- invert_bind_args idc Raw.ident.Z_cast;
- match pattern.type.unify_extracted ℤ s1 with
- | Datatypes.Some _ =>
- if type.type_beq base.type base.type.type_beq ℤ s1
- then
- v <- type.try_make_transport_cps s1 ℤ;
- fv <- (if
- (ZRange.normalize args <=? - ZRange.normalize args1)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (#(Z_cast args)%expr @
- ($(v (Compile.reflect x2)))%expr)%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.App _ _ _ s1 _ ($_)%expr _))%expr_pat |
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.App _ _ _ s1 _
- (@expr.Abs _ _ _ _ _ _) _))%expr_pat |
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.App _ _ _ s1 _ (_ @ _) _))%expr_pat |
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.App _ _ _ s1 _
- (@expr.LetIn _ _ _ _ _ _ _) _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t idc @ (@expr.Ident _ _ _ t0 idc0 @ #(_)))%expr_pat |
- (@expr.Ident _ _ _ t idc @ (@expr.Ident _ _ _ t0 idc0 @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Abs _ _ _ _ _ _))%expr_pat |
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.LetIn _ _ _ _ _ _ _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t idc @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t idc @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t idc @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t idc @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t idc @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t idc @ (_ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t idc @ (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t idc @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base (- x)%expr)%option
-| Z_div => fun x x0 : expr ℤ => Base (x / x0)%expr
-| Z_modulo => fun x x0 : expr ℤ => Base (x mod x0)%expr
-| Z_log2 => fun x : expr ℤ => Base (#(Z_log2)%expr @ x)%expr_pat
-| Z_log2_up => fun x : expr ℤ => Base (#(Z_log2_up)%expr @ x)%expr_pat
-| Z_eqb => fun x x0 : expr ℤ => Base (#(Z_eqb)%expr @ x @ x0)%expr_pat
-| Z_leb => fun x x0 : expr ℤ => Base (#(Z_leb)%expr @ x @ x0)%expr_pat
-| Z_ltb => fun x x0 : expr ℤ => Base (#(Z_ltb)%expr @ x @ x0)%expr_pat
-| Z_geb => fun x x0 : expr ℤ => Base (#(Z_geb)%expr @ x @ x0)%expr_pat
-| Z_gtb => fun x x0 : expr ℤ => Base (#(Z_gtb)%expr @ x @ x0)%expr_pat
-| Z_of_nat => fun x : expr ℕ => Base (#(Z_of_nat)%expr @ x)%expr_pat
-| Z_to_nat => fun x : expr ℤ => Base (#(Z_to_nat)%expr @ x)%expr_pat
-| Z_shiftr => fun x x0 : expr ℤ => Base (x >> x0)%expr
-| Z_shiftl =>
- fun x x0 : expr ℤ =>
- (match x with
- | (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat =>
- args <- invert_bind_args idc0 Raw.ident.Literal;
- args0 <- invert_bind_args idc Raw.ident.Z_cast;
- match
- pattern.type.unify_extracted (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℤ -> ℤ)%ptype
- ((projT1 args) -> ℤ)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if
- is_bounded_by_bool 0 (ZRange.normalize args0) &&
- ((let (x2, _) := xv in x2) =? 0)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false ##0)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t idc @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t idc @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t idc @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t idc @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;;
- Base (x << x0)%expr)%option
-| Z_land => fun x x0 : expr ℤ => Base (x &' x0)%expr
-| Z_lor => fun x x0 : expr ℤ => Base (x || x0)%expr
-| Z_min => fun x x0 : expr ℤ => Base (#(Z_min)%expr @ x @ x0)%expr_pat
-| Z_max => fun x x0 : expr ℤ => Base (#(Z_max)%expr @ x @ x0)%expr_pat
-| Z_bneg => fun x : expr ℤ => Base (#(Z_bneg)%expr @ x)%expr_pat
-| Z_lnot_modulo =>
- fun x x0 : expr ℤ => Base (#(Z_lnot_modulo)%expr @ x @ x0)%expr_pat
-| Z_mul_split =>
- fun x x0 x1 : expr ℤ =>
- (((match x0 with
- | (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat =>
- args <- invert_bind_args idc0 Raw.ident.Literal;
- args0 <- invert_bind_args idc Raw.ident.Z_cast;
- match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- ((ℤ -> (projT1 args)) -> ℤ)%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype ((ℤ -> (projT1 args)) -> ℤ)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if
- is_bounded_by_bool 0 (ZRange.normalize args0) &&
- ((let (x3, _) := xv in x3) =? 0)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (#(Z_cast r[0 ~> 0])%expr @ (##0)%expr,
- #(Z_cast r[0 ~> 0])%expr @ (##0)%expr)%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t idc @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t idc @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t idc @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t idc @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- match x1 with
- | @expr.App _ _ _ s _ (@expr.Ident _ _ _ t idc) x2 =>
- match x2 with
- | @expr.Ident _ _ _ t0 idc0 =>
- args <- invert_bind_args idc0 Raw.ident.Literal;
- args0 <- invert_bind_args idc Raw.ident.Z_cast;
- match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- ((ℤ -> ℤ) -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype ((ℤ -> ℤ) -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if
- is_bounded_by_bool 0 (ZRange.normalize args0) &&
- ((let (x3, _) := xv in x3) =? 0)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (#(Z_cast r[0 ~> 0])%expr @ (##0)%expr,
- #(Z_cast r[0 ~> 0])%expr @ (##0)%expr)%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x with
- | (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat =>
- match x0 with
- | @expr.App _ _ _ s1 _ (@expr.Ident _ _ _ t2 idc2) x4 =>
- match x4 with
- | @expr.Ident _ _ _ t3 idc3 =>
- args <- invert_bind_args idc3 Raw.ident.Literal;
- args0 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc1 Raw.ident.Literal;
- args2 <- invert_bind_args idc0 Raw.ident.Z_cast;
- args3 <- invert_bind_args idc Raw.ident.Z_cast;
- match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args1) -> (projT1 args)) -> s)%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args1) -> (projT1 args)) -> s)%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args1);
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- v <- type.try_make_transport_cps s ℤ;
- fv <- (if
- is_bounded_by_bool 1
- (ZRange.normalize args0) &&
- is_bounded_by_bool
- (let (x5, _) := xv in x5)
- (ZRange.normalize args2) &&
- (ZRange.normalize args3 <=?
- r[0 ~> (let (x5, _) := xv in x5) - 1])%zrange &&
- ((let (x5, _) := xv0 in x5) =? 1)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast args3)%expr @
- ($(v (Compile.reflect x2)))%expr,
- #(Z_cast r[0 ~> 0])%expr @
- (##0)%expr)%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x2 with
- | @expr.Ident _ _ _ t3 idc3 =>
- args <- invert_bind_args idc3 Raw.ident.Literal;
- args0 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc1 Raw.ident.Literal;
- args2 <- invert_bind_args idc0 Raw.ident.Z_cast;
- args3 <- invert_bind_args idc Raw.ident.Z_cast;
- match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args1) -> s1) -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args1) -> s1) -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args1);
- v <- type.try_make_transport_cps s1 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- is_bounded_by_bool 1
- (ZRange.normalize args3) &&
- is_bounded_by_bool
- (let (x5, _) := xv in x5)
- (ZRange.normalize args2) &&
- (ZRange.normalize args0 <=?
- r[0 ~> (let (x5, _) := xv in x5) - 1])%zrange &&
- ((let (x5, _) := xv0 in x5) =? 1)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast args0)%expr @
- ($(v (Compile.reflect x4)))%expr,
- #(Z_cast r[0 ~> 0])%expr @
- (##0)%expr)%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s1 _ ($_)%expr _ | @expr.App _ _ _ s1 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s1 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s1 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | (@expr.Ident _ _ _ t0 idc0 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat _ |
- @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end);;
- Datatypes.None);;;
- Base (#(Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat)%option
-| Z_add_get_carry =>
- fun x x0 x1 : expr ℤ =>
- ((match x with
- | (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat =>
- match x0 with
- | @expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t1 idc1) x3 =>
- match x3 with
- | @expr.Ident _ _ _ t2 idc2 =>
- match x1 with
- | @expr.App _ _ _ s1 _ (@expr.Ident _ _ _ t3 idc3) x4 =>
- match x4 with
- | @expr.Ident _ _ _ t4 idc4 =>
- args <- invert_bind_args idc4 Raw.ident.Literal;
- args0 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc2 Raw.ident.Literal;
- args2 <- invert_bind_args idc1 Raw.ident.Z_cast;
- args3 <- invert_bind_args idc0 Raw.ident.Literal;
- args4 <- invert_bind_args idc Raw.ident.Z_cast;
- match
- pattern.type.unify_extracted
- ((ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args3) -> (projT1 args1)) ->
- (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args3) -> (projT1 args1)) ->
- (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args3);
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args1);
- xv1 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- is_bounded_by_bool
- (let (x5, _) := xv in x5)
- (ZRange.normalize args4) &&
- is_bounded_by_bool
- (let (x5, _) := xv0 in x5)
- (ZRange.normalize args2) &&
- is_bounded_by_bool
- (let (x5, _) := xv1 in x5)
- (ZRange.normalize args0)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- ((##(Datatypes.fst
- (Z.add_get_carry_full
- (let (x5, _) := xv in
- x5)
- (let (x5, _) := xv0 in
- x5)
- (let (x5, _) := xv1 in
- x5))))%expr,
- (##(Datatypes.snd
- (Z.add_get_carry_full
- (let (x5, _) := xv in x5)
- (let (x5, _) := xv0 in
- x5)
- (let (x5, _) := xv1 in
- x5))))%expr)%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- args <- invert_bind_args idc3 Raw.ident.Z_cast;
- args0 <- invert_bind_args idc2 Raw.ident.Literal;
- args1 <- invert_bind_args idc1 Raw.ident.Z_cast;
- args2 <- invert_bind_args idc0 Raw.ident.Literal;
- args3 <- invert_bind_args idc Raw.ident.Z_cast;
- match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args2) -> (projT1 args0)) -> s1)%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args2) -> (projT1 args0)) -> s1)%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args2);
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args0);
- v <- type.try_make_transport_cps s1 ℤ;
- fv <- (if
- is_bounded_by_bool
- (let (x5, _) := xv in x5)
- (ZRange.normalize args3) &&
- is_bounded_by_bool 0
- (ZRange.normalize args1) &&
- (ZRange.normalize args <=?
- r[0 ~> (let (x5, _) := xv in x5) - 1])%zrange &&
- ((let (x5, _) := xv0 in x5) =? 0)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast args)%expr @
- ($(v (Compile.reflect x4)))%expr,
- #(Z_cast r[0 ~> 0])%expr @ (##0)%expr)%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s1 _ ($_)%expr _ | @expr.App _ _ _ s1 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s1 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s1 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x1 with
- | (@expr.Ident _ _ _ t2 idc2 @ @expr.Ident _ _ _ t3 idc3)%expr_pat =>
- args <- invert_bind_args idc3 Raw.ident.Literal;
- args0 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc1 Raw.ident.Z_cast;
- args2 <- invert_bind_args idc0 Raw.ident.Literal;
- args3 <- invert_bind_args idc Raw.ident.Z_cast;
- match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args2) -> s0) -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args2) -> s0) -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args2);
- v <- type.try_make_transport_cps s0 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- is_bounded_by_bool (let (x5, _) := xv in x5)
- (ZRange.normalize args3) &&
- is_bounded_by_bool 0 (ZRange.normalize args0) &&
- (ZRange.normalize args1 <=?
- r[0 ~> (let (x5, _) := xv in x5) - 1])%zrange &&
- ((let (x5, _) := xv0 in x5) =? 0)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (#(Z_cast args1)%expr @
- ($(v (Compile.reflect x3)))%expr,
- #(Z_cast r[0 ~> 0])%expr @ (##0)%expr)%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t2 idc2 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s0 _ ($_)%expr _ | @expr.App _ _ _ s0 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s0 _ (_ @ _)%expr_pat
- _ | @expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | (@expr.Ident _ _ _ t idc @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t idc @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t idc @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t idc @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base (#(Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat)%option
-| Z_add_with_carry =>
- fun x x0 x1 : expr ℤ =>
- (match x with
- | (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat =>
- args <- invert_bind_args idc0 Raw.ident.Literal;
- args0 <- invert_bind_args idc Raw.ident.Z_cast;
- match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args) -> ℤ) -> ℤ)%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype (((projT1 args) -> ℤ) -> ℤ)%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if
- is_bounded_by_bool 0 (ZRange.normalize args0) &&
- ((let (x3, _) := xv in x3) =? 0)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($x0 + $x1))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t idc @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t idc @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t idc @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t idc @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;;
- Base (#(Z_add_with_carry)%expr @ x @ x0 @ x1)%expr_pat)%option
-| Z_add_with_get_carry =>
- fun x x0 x1 x2 : expr ℤ =>
- (match x with
- | (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat =>
- match x0 with
- | (@expr.Ident _ _ _ t1 idc1 @ @expr.Ident _ _ _ t2 idc2)%expr_pat =>
- match x1 with
- | @expr.App _ _ _ s1 _ (@expr.Ident _ _ _ t3 idc3) x5 =>
- match x5 with
- | @expr.Ident _ _ _ t4 idc4 =>
- match x2 with
- | @expr.App _ _ _ s2 _ (@expr.Ident _ _ _ t5 idc5) x6 =>
- match x6 with
- | @expr.Ident _ _ _ t6 idc6 =>
- args <- invert_bind_args idc6 Raw.ident.Literal;
- args0 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc4 Raw.ident.Literal;
- args2 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args3 <- invert_bind_args idc2 Raw.ident.Literal;
- args4 <- invert_bind_args idc1 Raw.ident.Z_cast;
- args5 <- invert_bind_args idc0 Raw.ident.Literal;
- args6 <- invert_bind_args idc Raw.ident.Z_cast;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- ((((projT1 args5) -> (projT1 args3)) ->
- (projT1 args1)) -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- ((((projT1 args5) -> (projT1 args3)) ->
- (projT1 args1)) -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args5);
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args3);
- xv1 <- ident.unify pattern.ident.Literal
- ##(projT2 args1);
- xv2 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- is_bounded_by_bool
- (let (x7, _) := xv in x7)
- (ZRange.normalize args6) &&
- is_bounded_by_bool
- (let (x7, _) := xv0 in x7)
- (ZRange.normalize args4) &&
- is_bounded_by_bool
- (let (x7, _) := xv1 in x7)
- (ZRange.normalize args2) &&
- is_bounded_by_bool
- (let (x7, _) := xv2 in x7)
- (ZRange.normalize args0)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota
- var) false
- ((##(Datatypes.fst
- (Z.add_with_get_carry_full
- (let (x7, _) :=
- xv in
- x7)
- (let (x7, _) :=
- xv0 in
- x7)
- (let (x7, _) :=
- xv1 in
- x7)
- (let (x7, _) :=
- xv2 in
- x7))))%expr,
- (##(Datatypes.snd
- (Z.add_with_get_carry_full
- (let (x7, _) := xv in
- x7)
- (let (x7, _) :=
- xv0 in
- x7)
- (let (x7, _) :=
- xv1 in
- x7)
- (let (x7, _) :=
- xv2 in
- x7))))%expr)%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- args <- invert_bind_args idc5 Raw.ident.Z_cast;
- args0 <- invert_bind_args idc4 Raw.ident.Literal;
- args1 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args2 <- invert_bind_args idc2 Raw.ident.Literal;
- args3 <- invert_bind_args idc1 Raw.ident.Z_cast;
- args4 <- invert_bind_args idc0 Raw.ident.Literal;
- args5 <- invert_bind_args idc Raw.ident.Z_cast;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- ((((projT1 args4) -> (projT1 args2)) ->
- (projT1 args0)) -> s2)%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- ((((projT1 args4) -> (projT1 args2)) ->
- (projT1 args0)) -> s2)%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args4);
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args2);
- xv1 <- ident.unify pattern.ident.Literal
- ##(projT2 args0);
- v <- type.try_make_transport_cps s2 ℤ;
- fv <- (if
- is_bounded_by_bool
- (let (x7, _) := xv in x7)
- (ZRange.normalize args5) &&
- is_bounded_by_bool 0
- (ZRange.normalize args3) &&
- is_bounded_by_bool 0
- (ZRange.normalize args1) &&
- (ZRange.normalize args <=?
- r[0 ~> (let (x7, _) := xv in x7) - 1])%zrange &&
- ((let (x7, _) := xv0 in x7) =? 0) &&
- ((let (x7, _) := xv1 in x7) =? 0)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast args)%expr @
- ($(v (Compile.reflect x6)))%expr,
- #(Z_cast r[0 ~> 0])%expr @
- (##0)%expr)%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s2 _ ($_)%expr _ | @expr.App _ _ _ s2
- _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s2 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s2 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x2 with
- | (@expr.Ident _ _ _ t4 idc4 @ @expr.Ident _ _ _ t5 idc5)%expr_pat =>
- args <- invert_bind_args idc5 Raw.ident.Literal;
- args0 <- invert_bind_args idc4 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args2 <- invert_bind_args idc2 Raw.ident.Literal;
- args3 <- invert_bind_args idc1 Raw.ident.Z_cast;
- args4 <- invert_bind_args idc0 Raw.ident.Literal;
- args5 <- invert_bind_args idc Raw.ident.Z_cast;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- ((((projT1 args4) -> (projT1 args2)) -> s1) ->
- (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- ((((projT1 args4) -> (projT1 args2)) -> s1) ->
- (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args4);
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args2);
- v <- type.try_make_transport_cps s1 ℤ;
- xv1 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- is_bounded_by_bool
- (let (x7, _) := xv in x7)
- (ZRange.normalize args5) &&
- is_bounded_by_bool 0
- (ZRange.normalize args3) &&
- is_bounded_by_bool 0
- (ZRange.normalize args0) &&
- (ZRange.normalize args1 <=?
- r[0 ~> (let (x7, _) := xv in x7) - 1])%zrange &&
- ((let (x7, _) := xv0 in x7) =? 0) &&
- ((let (x7, _) := xv1 in x7) =? 0)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast args1)%expr @
- ($(v (Compile.reflect x5)))%expr,
- #(Z_cast r[0 ~> 0])%expr @ (##0)%expr)%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s1 _ ($_)%expr _ | @expr.App _ _ _ s1 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s1 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s1 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | (@expr.Ident _ _ _ t1 idc1 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | (@expr.Ident _ _ _ t idc @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t idc @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t idc @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t idc @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;;
- Base (#(Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat)%option
-| Z_sub_get_borrow =>
- fun x x0 x1 : expr ℤ =>
- Base (#(Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat
-| Z_sub_with_get_borrow =>
- fun x x0 x1 x2 : expr ℤ =>
- Base (#(Z_sub_with_get_borrow)%expr @ x @ x0 @ x1 @ x2)%expr_pat
-| Z_zselect =>
- fun x x0 x1 : expr ℤ => Base (#(Z_zselect)%expr @ x @ x0 @ x1)%expr_pat
-| Z_add_modulo =>
- fun x x0 x1 : expr ℤ =>
- Base (#(Z_add_modulo)%expr @ x @ x0 @ x1)%expr_pat
-| Z_rshi =>
- fun x x0 x1 x2 : expr ℤ =>
- Base (#(Z_rshi)%expr @ x @ x0 @ x1 @ x2)%expr_pat
-| Z_cc_m => fun x x0 : expr ℤ => Base (#(Z_cc_m)%expr @ x @ x0)%expr_pat
-| Z_combine_at_bitwidth =>
- fun x x0 x1 : expr ℤ =>
- Base (#(Z_combine_at_bitwidth)%expr @ x @ x0 @ x1)%expr_pat
-| Z_cast range =>
- fun x : expr ℤ =>
- (((match pattern.type.unify_extracted ℤ ℤ with
- | Datatypes.Some _ =>
- if type.type_beq base.type base.type.type_beq ℤ ℤ
- then
- fv <- (if lower range =? upper range
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (#(Z_cast range)%expr @ (##(lower range))%expr)%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end;;
- match x with
- | @expr.App _ _ _ s _ (@expr.Ident _ _ _ t idc) x0 =>
- args <- invert_bind_args idc Raw.ident.Z_cast;
- match pattern.type.unify_extracted ℤ s with
- | Datatypes.Some _ =>
- if type.type_beq base.type base.type.type_beq ℤ s
- then
- v <- type.try_make_transport_cps s ℤ;
- fv <- (if
- (ZRange.normalize args <=? ZRange.normalize range)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (#(Z_cast args)%expr @
- ($(v (Compile.reflect x0)))%expr)%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _ (@expr.Ident _ _ _ t idc) x2) x1) x0 =>
- _ <- invert_bind_args idc Raw.ident.Z_add_with_carry;
- match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- ((s1 -> s0) -> s)%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype ((s1 -> s0) -> s)%ptype
- then
- v <- type.try_make_transport_cps s1 ℤ;
- v0 <- type.try_make_transport_cps s0 ℤ;
- v1 <- type.try_make_transport_cps s ℤ;
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (expr_let v2 := (#(Z_cast range)%expr @
- (#(Z_add_with_carry)%expr @
- ($(v (Compile.reflect x2)))%expr @
- ($(v0 (Compile.reflect x1)))%expr @
- ($(v1 (Compile.reflect x0)))%expr))%expr_pat in
- (#(Z_cast range)%expr @ $v2)%expr_pat);
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.App _ _ _ s1 _ ($_)%expr _) _) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _ (@expr.Abs _ _ _ _ _ _) _) _) _ | @expr.App _
- _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.App _ _ _ s1 _ (_ @ _)%expr_pat _) _)
- _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _ (@expr.LetIn _ _ _ _ _ _ _) _) _) _ =>
- Datatypes.None
- | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ #(_)%expr_pat _) _ |
- @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ ($_)%expr _) _ | @expr.App
- _ _ _ s _ (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _) _ =>
- Datatypes.None
- | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end);;
- Datatypes.None);;;
- Base (#(Z_cast range)%expr @ x)%expr_pat)%option
-| Z_cast2 range =>
- fun x : expr (ℤ * ℤ)%etype =>
- (match x with
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) x1) x0 =>
- args <- invert_bind_args idc Raw.ident.pair;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ -> (ℤ * ℤ)%pbtype) -> ℤ) -> ℤ)%ptype
- ((((let (x2, _) := args in x2) ->
- (let (_, y) := args in y) ->
- ((let (x2, _) := args in x2) * (let (_, y) := args in y))%etype) ->
- s0) -> s)%ptype
- with
- | Datatypes.Some (_, (_, (_, _)), _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ -> (ℤ * ℤ)%etype) -> ℤ) -> ℤ)%ptype
- ((((let (x2, _) := args in x2) ->
- (let (_, y) := args in y) ->
- ((let (x2, _) := args in x2) * (let (_, y) := args in y))%etype) ->
- s0) -> s)%ptype
- then
- _ <- ident.unify pattern.ident.pair pair;
- v <- type.try_make_transport_cps s0 ℤ;
- v0 <- type.try_make_transport_cps s ℤ;
- Datatypes.Some
- (fv0 <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) true
- (#(Z_cast (Datatypes.fst range))%expr @
- ($(v (Compile.reflect x1)))%expr,
- #(Z_cast (Datatypes.snd range))%expr @
- ($(v0 (Compile.reflect x0)))%expr)%expr_pat;
- fv1 <-- do_again (ℤ * ℤ) fv0;
- Base fv1)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _ (@expr.Ident _ _ _ t idc) x2) x1) x0 =>
- (match x1 with
- | (@expr.Ident _ _ _ t0 idc0 @
- (@expr.Ident _ _ _ t1 idc1 @ @expr.App _ _ _ s4 _
- (@expr.Ident _ _ _ t2 idc2) x5))%expr_pat =>
- args <- invert_bind_args idc2 Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_opp;
- args1 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_add_get_carry;
- match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- ((s1 -> s4) -> s)%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype ((s1 -> s4) -> s)%ptype
- then
- v <- type.try_make_transport_cps s1 ℤ;
- v0 <- type.try_make_transport_cps s4 ℤ;
- v1 <- type.try_make_transport_cps s ℤ;
- fv <- (if
- (ZRange.normalize args <=?
- - ZRange.normalize args1)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (expr_let v2 := (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- (#(Z_sub_get_borrow)%expr @
- ($(v (Compile.reflect x2)))%expr @
- ($(v1 (Compile.reflect x0)))%expr @
- (#(Z_cast args)%expr @
- ($(v0 (Compile.reflect x5)))%expr)))%expr_pat in
- (#(Z_cast (Datatypes.fst range))%expr @
- (#(fst)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @ $v2)),
- #(Z_cast (Datatypes.snd range))%expr @
- (-
- (#(Z_cast (- Datatypes.snd range))%expr @
- (#(snd)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @ $v2)))%expr_pat))%expr_pat))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t0 idc0 @
- (@expr.Ident _ _ _ t1 idc1 @ @expr.App _ _ _ s4 _ ($_)%expr _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @
- (@expr.Ident _ _ _ t1 idc1 @ @expr.App _ _ _ s4 _
- (@expr.Abs _ _ _ _ _ _) _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @
- (@expr.Ident _ _ _ t1 idc1 @ @expr.App _ _ _ s4 _ (_ @ _) _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @
- (@expr.Ident _ _ _ t1 idc1 @ @expr.App _ _ _ s4 _
- (@expr.LetIn _ _ _ _ _ _ _) _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t0 idc0 @ (@expr.Ident _ _ _ t1 idc1 @ #(_)))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @
- (@expr.Ident _ _ _ t1 idc1 @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @
- (@expr.Ident _ _ _ t1 idc1 @ @expr.Abs _ _ _ _ _ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @
- (@expr.Ident _ _ _ t1 idc1 @ @expr.LetIn _ _ _ _ _ _ _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t0 idc0 @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (_ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- match x0 with
- | (@expr.Ident _ _ _ t0 idc0 @
- (@expr.Ident _ _ _ t1 idc1 @ @expr.App _ _ _ s4 _
- (@expr.Ident _ _ _ t2 idc2) x5))%expr_pat =>
- args <- invert_bind_args idc2 Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_opp;
- args1 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_add_get_carry;
- match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- ((s1 -> s0) -> s4)%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype ((s1 -> s0) -> s4)%ptype
- then
- v <- type.try_make_transport_cps s1 ℤ;
- v0 <- type.try_make_transport_cps s0 ℤ;
- v1 <- type.try_make_transport_cps s4 ℤ;
- fv <- (if
- (ZRange.normalize args <=?
- - ZRange.normalize args1)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (expr_let v2 := (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- (#(Z_sub_get_borrow)%expr @
- ($(v (Compile.reflect x2)))%expr @
- ($(v0 (Compile.reflect x1)))%expr @
- (#(Z_cast args)%expr @
- ($(v1 (Compile.reflect x5)))%expr)))%expr_pat in
- (#(Z_cast (Datatypes.fst range))%expr @
- (#(fst)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @ $v2)),
- #(Z_cast (Datatypes.snd range))%expr @
- (-
- (#(Z_cast (- Datatypes.snd range))%expr @
- (#(snd)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @ $v2)))%expr_pat))%expr_pat))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t0 idc0 @
- (@expr.Ident _ _ _ t1 idc1 @ @expr.App _ _ _ s4 _ ($_)%expr _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @
- (@expr.Ident _ _ _ t1 idc1 @ @expr.App _ _ _ s4 _
- (@expr.Abs _ _ _ _ _ _) _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @
- (@expr.Ident _ _ _ t1 idc1 @ @expr.App _ _ _ s4 _ (_ @ _) _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @
- (@expr.Ident _ _ _ t1 idc1 @ @expr.App _ _ _ s4 _
- (@expr.LetIn _ _ _ _ _ _ _) _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t0 idc0 @ (@expr.Ident _ _ _ t1 idc1 @ #(_)))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @
- (@expr.Ident _ _ _ t1 idc1 @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @
- (@expr.Ident _ _ _ t1 idc1 @ @expr.Abs _ _ _ _ _ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @
- (@expr.Ident _ _ _ t1 idc1 @ @expr.LetIn _ _ _ _ _ _ _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t0 idc0 @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (_ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- match x1 with
- | (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat =>
- args <- invert_bind_args idc1 Raw.ident.Literal;
- args0 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_add_get_carry;
- match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- ((s1 -> (projT1 args)) -> s)%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype ((s1 -> (projT1 args)) -> s)%ptype
- then
- v <- type.try_make_transport_cps s1 ℤ;
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- v0 <- type.try_make_transport_cps s ℤ;
- fv <- (if
- is_bounded_by_bool (let (x4, _) := xv in x4)
- (ZRange.normalize args0) &&
- ((let (x4, _) := xv in x4) <? 0)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (expr_let v1 := (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- (#(Z_sub_get_borrow)%expr @
- ($(v (Compile.reflect x2)))%expr @
- ($(v0 (Compile.reflect x0)))%expr @
- (#(Z_cast (- args0))%expr @
- (##(-
- (let (x4, _) := xv in
- x4))%Z)%expr)))%expr_pat in
- (#(Z_cast (Datatypes.fst range))%expr @
- (#(fst)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @ $v1)),
- #(Z_cast (Datatypes.snd range))%expr @
- (-
- (#(Z_cast (- Datatypes.snd range))%expr @
- (#(snd)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @ $v1)))%expr_pat))%expr_pat))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t0 idc0 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- match x0 with
- | (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat =>
- args <- invert_bind_args idc1 Raw.ident.Literal;
- args0 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_add_get_carry;
- match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- ((s1 -> s0) -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype
- ((s1 -> s0) -> (projT1 args))%ptype
- then
- v <- type.try_make_transport_cps s1 ℤ;
- v0 <- type.try_make_transport_cps s0 ℤ;
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if
- is_bounded_by_bool (let (x4, _) := xv in x4)
- (ZRange.normalize args0) &&
- ((let (x4, _) := xv in x4) <? 0)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (expr_let v1 := (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- (#(Z_sub_get_borrow)%expr @
- ($(v (Compile.reflect x2)))%expr @
- ($(v0 (Compile.reflect x1)))%expr @
- (#(Z_cast (- args0))%expr @
- (##(-
- (let (x4, _) := xv in
- x4))%Z)%expr)))%expr_pat in
- (#(Z_cast (Datatypes.fst range))%expr @
- (#(fst)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @ $v1)),
- #(Z_cast (Datatypes.snd range))%expr @
- (-
- (#(Z_cast (- Datatypes.snd range))%expr @
- (#(snd)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @ $v1)))%expr_pat))%expr_pat))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t0 idc0 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- _ <- invert_bind_args idc Raw.ident.Z_add_get_carry;
- match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- ((s1 -> s0) -> s)%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype ((s1 -> s0) -> s)%ptype
- then
- v <- type.try_make_transport_cps s1 ℤ;
- v0 <- type.try_make_transport_cps s0 ℤ;
- v1 <- type.try_make_transport_cps s ℤ;
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (expr_let v2 := (#(Z_cast2 range)%expr @
- (#(Z_add_get_carry)%expr @
- ($(v (Compile.reflect x2)))%expr @
- ($(v0 (Compile.reflect x1)))%expr @
- ($(v1 (Compile.reflect x0)))%expr))%expr_pat in
- (#(Z_cast (Datatypes.fst range))%expr @
- (#(fst)%expr @ (#(Z_cast2 range)%expr @ $v2)),
- #(Z_cast (Datatypes.snd range))%expr @
- (#(snd)%expr @ (#(Z_cast2 range)%expr @ $v2)))%expr_pat);
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;
- (_ <- invert_bind_args idc Raw.ident.Z_sub_get_borrow;
- match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- ((s1 -> s0) -> s)%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype ((s1 -> s0) -> s)%ptype
- then
- v <- type.try_make_transport_cps s1 ℤ;
- v0 <- type.try_make_transport_cps s0 ℤ;
- v1 <- type.try_make_transport_cps s ℤ;
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (expr_let v2 := (#(Z_cast2 range)%expr @
- (#(Z_sub_get_borrow)%expr @
- ($(v (Compile.reflect x2)))%expr @
- ($(v0 (Compile.reflect x1)))%expr @
- ($(v1 (Compile.reflect x0)))%expr))%expr_pat in
- (#(Z_cast (Datatypes.fst range))%expr @
- (#(fst)%expr @ (#(Z_cast2 range)%expr @ $v2)),
- #(Z_cast (Datatypes.snd range))%expr @
- (#(snd)%expr @ (#(Z_cast2 range)%expr @ $v2)))%expr_pat);
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;
- _ <- invert_bind_args idc Raw.ident.Z_mul_split;
- match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- ((s1 -> s0) -> s)%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype ((s1 -> s0) -> s)%ptype
- then
- v <- type.try_make_transport_cps s1 ℤ;
- v0 <- type.try_make_transport_cps s0 ℤ;
- v1 <- type.try_make_transport_cps s ℤ;
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (expr_let v2 := (#(Z_cast2 range)%expr @
- (#(Z_mul_split)%expr @
- ($(v (Compile.reflect x2)))%expr @
- ($(v0 (Compile.reflect x1)))%expr @
- ($(v1 (Compile.reflect x0)))%expr))%expr_pat in
- (#(Z_cast (Datatypes.fst range))%expr @
- (#(fst)%expr @ (#(Z_cast2 range)%expr @ $v2)),
- #(Z_cast (Datatypes.snd range))%expr @
- (#(snd)%expr @ (#(Z_cast2 range)%expr @ $v2)))%expr_pat);
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.App _ _ _ s2 _ (@expr.Ident _ _ _ t idc) x3) x2) x1) x0 =>
- (match x2 with
- | @expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t0 idc0) x4 =>
- match x4 with
- | @expr.Ident _ _ _ t1 idc1 =>
- match x1 with
- | (@expr.Ident _ _ _ t2 idc2 @
- (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _
- (@expr.Ident _ _ _ t4 idc4) x7))%expr_pat =>
- (args <- invert_bind_args idc4 Raw.ident.Z_cast;
- _ <- invert_bind_args idc3 Raw.ident.Z_opp;
- args1 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args2 <- invert_bind_args idc1 Raw.ident.Literal;
- args3 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_add_with_get_carry;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> (projT1 args2)) -> s6) -> s)%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> (projT1 args2)) -> s6) -> s)%ptype
- then
- v <- type.try_make_transport_cps s2 ℤ;
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args2);
- v0 <- type.try_make_transport_cps s6 ℤ;
- v1 <- type.try_make_transport_cps s ℤ;
- fv <- (if
- is_bounded_by_bool 0
- (ZRange.normalize args3) &&
- (ZRange.normalize args <=?
- - ZRange.normalize args1)%zrange &&
- ((let (x8, _) := xv in x8) =? 0)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (expr_let v2 := (#(Z_cast2
- (Datatypes.fst
- range,
- -
- Datatypes.snd
- range))%expr @
- (#(Z_sub_get_borrow)%expr @
- ($(v
- (Compile.reflect
- x3)))%expr @
- ($(v1
- (Compile.reflect
- x0)))%expr @
- (#(Z_cast args)%expr @
- ($(v0
- (Compile.reflect
- x7)))%expr)))%expr_pat in
- (#(Z_cast (Datatypes.fst range))%expr @
- (#(fst)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- $v2)),
- #(Z_cast (Datatypes.snd range))%expr @
- (-
- (#(Z_cast (- Datatypes.snd range))%expr @
- (#(snd)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- $v2)))%expr_pat))%expr_pat))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;
- args <- invert_bind_args idc4 Raw.ident.Z_cast;
- _ <- invert_bind_args idc3 Raw.ident.Z_opp;
- args1 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args2 <- invert_bind_args idc1 Raw.ident.Literal;
- args3 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_add_with_get_carry;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> (projT1 args2)) -> s6) -> s)%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> (projT1 args2)) -> s6) -> s)%ptype
- then
- v <- type.try_make_transport_cps s2 ℤ;
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args2);
- v0 <- type.try_make_transport_cps s6 ℤ;
- v1 <- type.try_make_transport_cps s ℤ;
- fv <- (if
- ((let (x8, _) := xv in x8) <? 0) &&
- is_bounded_by_bool
- (let (x8, _) := xv in x8)
- (ZRange.normalize args3) &&
- (ZRange.normalize args <=?
- - ZRange.normalize args1)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (expr_let v2 := (#(Z_cast2
- (Datatypes.fst
- range,
- -
- Datatypes.snd
- range))%expr @
- (#(Z_sub_with_get_borrow)%expr @
- ($(v
- (Compile.reflect
- x3)))%expr @
- (#(Z_cast (- args3))%expr @
- (##(-
- (let
- (x8, _) :=
- xv in
- x8))%Z)%expr) @
- ($(v1
- (Compile.reflect
- x0)))%expr @
- (#(Z_cast args)%expr @
- ($(v0
- (Compile.reflect
- x7)))%expr)))%expr_pat in
- (#(Z_cast (Datatypes.fst range))%expr @
- (#(fst)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- $v2)),
- #(Z_cast (Datatypes.snd range))%expr @
- (-
- (#(Z_cast (- Datatypes.snd range))%expr @
- (#(snd)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- $v2)))%expr_pat))%expr_pat))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t2 idc2 @
- (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _
- ($_)%expr _))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @
- (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _
- (@expr.Abs _ _ _ _ _ _) _))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @
- (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _
- (_ @ _) _))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @
- (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _
- (@expr.LetIn _ _ _ _ _ _ _) _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t2 idc2 @
- (@expr.Ident _ _ _ t3 idc3 @ #(_)))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @
- (@expr.Ident _ _ _ t3 idc3 @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @
- (@expr.Ident _ _ _ t3 idc3 @ @expr.Abs _ _ _ _ _ _))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @
- (@expr.Ident _ _ _ t3 idc3 @ @expr.LetIn _ _ _ _ _ _ _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t2 idc2 @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ (_ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- match x0 with
- | (@expr.Ident _ _ _ t2 idc2 @
- (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _
- (@expr.Ident _ _ _ t4 idc4) x7))%expr_pat =>
- (args <- invert_bind_args idc4 Raw.ident.Z_cast;
- _ <- invert_bind_args idc3 Raw.ident.Z_opp;
- args1 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args2 <- invert_bind_args idc1 Raw.ident.Literal;
- args3 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_add_with_get_carry;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> (projT1 args2)) -> s0) -> s6)%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> (projT1 args2)) -> s0) -> s6)%ptype
- then
- v <- type.try_make_transport_cps s2 ℤ;
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args2);
- v0 <- type.try_make_transport_cps s0 ℤ;
- v1 <- type.try_make_transport_cps s6 ℤ;
- fv <- (if
- is_bounded_by_bool 0
- (ZRange.normalize args3) &&
- (ZRange.normalize args <=?
- - ZRange.normalize args1)%zrange &&
- ((let (x8, _) := xv in x8) =? 0)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (expr_let v2 := (#(Z_cast2
- (Datatypes.fst
- range,
- -
- Datatypes.snd
- range))%expr @
- (#(Z_sub_get_borrow)%expr @
- ($(v
- (Compile.reflect
- x3)))%expr @
- ($(v0
- (Compile.reflect
- x1)))%expr @
- (#(Z_cast args)%expr @
- ($(v1
- (Compile.reflect
- x7)))%expr)))%expr_pat in
- (#(Z_cast (Datatypes.fst range))%expr @
- (#(fst)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- $v2)),
- #(Z_cast (Datatypes.snd range))%expr @
- (-
- (#(Z_cast (- Datatypes.snd range))%expr @
- (#(snd)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- $v2)))%expr_pat))%expr_pat))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;
- args <- invert_bind_args idc4 Raw.ident.Z_cast;
- _ <- invert_bind_args idc3 Raw.ident.Z_opp;
- args1 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args2 <- invert_bind_args idc1 Raw.ident.Literal;
- args3 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_add_with_get_carry;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> (projT1 args2)) -> s0) -> s6)%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> (projT1 args2)) -> s0) -> s6)%ptype
- then
- v <- type.try_make_transport_cps s2 ℤ;
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args2);
- v0 <- type.try_make_transport_cps s0 ℤ;
- v1 <- type.try_make_transport_cps s6 ℤ;
- fv <- (if
- ((let (x8, _) := xv in x8) <? 0) &&
- is_bounded_by_bool
- (let (x8, _) := xv in x8)
- (ZRange.normalize args3) &&
- (ZRange.normalize args <=?
- - ZRange.normalize args1)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (expr_let v2 := (#(Z_cast2
- (Datatypes.fst
- range,
- -
- Datatypes.snd
- range))%expr @
- (#(Z_sub_with_get_borrow)%expr @
- ($(v
- (Compile.reflect
- x3)))%expr @
- (#(Z_cast (- args3))%expr @
- (##(-
- (let
- (x8, _) :=
- xv in
- x8))%Z)%expr) @
- ($(v0
- (Compile.reflect
- x1)))%expr @
- (#(Z_cast args)%expr @
- ($(v1
- (Compile.reflect
- x7)))%expr)))%expr_pat in
- (#(Z_cast (Datatypes.fst range))%expr @
- (#(fst)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- $v2)),
- #(Z_cast (Datatypes.snd range))%expr @
- (-
- (#(Z_cast (- Datatypes.snd range))%expr @
- (#(snd)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- $v2)))%expr_pat))%expr_pat))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t2 idc2 @
- (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _
- ($_)%expr _))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @
- (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _
- (@expr.Abs _ _ _ _ _ _) _))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @
- (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _
- (_ @ _) _))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @
- (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _
- (@expr.LetIn _ _ _ _ _ _ _) _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t2 idc2 @
- (@expr.Ident _ _ _ t3 idc3 @ #(_)))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @
- (@expr.Ident _ _ _ t3 idc3 @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @
- (@expr.Ident _ _ _ t3 idc3 @ @expr.Abs _ _ _ _ _ _))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @
- (@expr.Ident _ _ _ t3 idc3 @ @expr.LetIn _ _ _ _ _ _ _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t2 idc2 @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ (_ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- match x1 with
- | (@expr.Ident _ _ _ t2 idc2 @ @expr.Ident _ _ _ t3 idc3)%expr_pat =>
- args <- invert_bind_args idc3 Raw.ident.Literal;
- args0 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc1 Raw.ident.Literal;
- args2 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_add_with_get_carry;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> (projT1 args1)) -> (projT1 args)) -> s)%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> (projT1 args1)) -> (projT1 args)) -> s)%ptype
- then
- v <- type.try_make_transport_cps s2 ℤ;
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args1);
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- v0 <- type.try_make_transport_cps s ℤ;
- fv <- (if
- ((let (x6, _) := xv0 in x6) <=? 0) &&
- ((let (x6, _) := xv in x6) <=? 0) &&
- ((let (x6, _) := xv0 in x6) +
- (let (x6, _) := xv in x6) <? 0) &&
- is_bounded_by_bool
- (let (x6, _) := xv0 in x6)
- (ZRange.normalize args0) &&
- is_bounded_by_bool
- (let (x6, _) := xv in x6)
- (ZRange.normalize args2)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (expr_let v1 := (#(Z_cast2
- (Datatypes.fst
- range,
- -
- Datatypes.snd
- range))%expr @
- (#(Z_sub_with_get_borrow)%expr @
- ($(v
- (Compile.reflect
- x3)))%expr @
- (#(Z_cast (- args2))%expr @
- (##(-
- (let
- (x6, _) :=
- xv in
- x6))%Z)%expr) @
- ($(v0
- (Compile.reflect
- x0)))%expr @
- (#(Z_cast (- args0))%expr @
- (##(-
- (let
- (x6, _) :=
- xv0 in
- x6))%Z)%expr)))%expr_pat in
- (#(Z_cast (Datatypes.fst range))%expr @
- (#(fst)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- $v1)),
- #(Z_cast (Datatypes.snd range))%expr @
- (-
- (#(Z_cast (- Datatypes.snd range))%expr @
- (#(snd)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- $v1)))%expr_pat))%expr_pat))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t2 idc2 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- match x0 with
- | (@expr.Ident _ _ _ t2 idc2 @ @expr.Ident _ _ _ t3 idc3)%expr_pat =>
- args <- invert_bind_args idc3 Raw.ident.Literal;
- args0 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc1 Raw.ident.Literal;
- args2 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_add_with_get_carry;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> (projT1 args1)) -> s0) -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> (projT1 args1)) -> s0) -> (projT1 args))%ptype
- then
- v <- type.try_make_transport_cps s2 ℤ;
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args1);
- v0 <- type.try_make_transport_cps s0 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- ((let (x6, _) := xv0 in x6) <=? 0) &&
- ((let (x6, _) := xv in x6) <=? 0) &&
- ((let (x6, _) := xv0 in x6) +
- (let (x6, _) := xv in x6) <? 0) &&
- is_bounded_by_bool
- (let (x6, _) := xv0 in x6)
- (ZRange.normalize args0) &&
- is_bounded_by_bool
- (let (x6, _) := xv in x6)
- (ZRange.normalize args2)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (expr_let v1 := (#(Z_cast2
- (Datatypes.fst
- range,
- -
- Datatypes.snd
- range))%expr @
- (#(Z_sub_with_get_borrow)%expr @
- ($(v
- (Compile.reflect
- x3)))%expr @
- (#(Z_cast (- args2))%expr @
- (##(-
- (let
- (x6, _) :=
- xv in
- x6))%Z)%expr) @
- ($(v0
- (Compile.reflect
- x1)))%expr @
- (#(Z_cast (- args0))%expr @
- (##(-
- (let
- (x6, _) :=
- xv0 in
- x6))%Z)%expr)))%expr_pat in
- (#(Z_cast (Datatypes.fst range))%expr @
- (#(fst)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- $v1)),
- #(Z_cast (Datatypes.snd range))%expr @
- (-
- (#(Z_cast (- Datatypes.snd range))%expr @
- (#(snd)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- $v1)))%expr_pat))%expr_pat))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t2 idc2 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- args <- invert_bind_args idc1 Raw.ident.Literal;
- args0 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_add_with_get_carry;
- match
- pattern.type.unify_extracted (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> (projT1 args)) -> s0) -> s)%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> (projT1 args)) -> s0) -> s)%ptype
- then
- v <- type.try_make_transport_cps s2 ℤ;
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- v0 <- type.try_make_transport_cps s0 ℤ;
- v1 <- type.try_make_transport_cps s ℤ;
- fv <- (if
- is_bounded_by_bool 0 (ZRange.normalize args0) &&
- ((let (x5, _) := xv in x5) =? 0)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (expr_let v2 := (#(Z_cast2 range)%expr @
- (#(Z_add_get_carry)%expr @
- ($(v
- (Compile.reflect
- x3)))%expr @
- ($(v0
- (Compile.reflect
- x1)))%expr @
- ($(v1
- (Compile.reflect
- x0)))%expr))%expr_pat in
- (#(Z_cast (Datatypes.fst range))%expr @
- (#(fst)%expr @
- (#(Z_cast2 range)%expr @ $v2)),
- #(Z_cast (Datatypes.snd range))%expr @
- (#(snd)%expr @
- (#(Z_cast2 range)%expr @ $v2)))%expr_pat))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t1 idc1 @ @expr.App _ _ _ s5 _
- (@expr.Ident _ _ _ t2 idc2) x6)%expr_pat =>
- match x1 with
- | (@expr.Ident _ _ _ t3 idc3 @
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _
- (@expr.Ident _ _ _ t5 idc5) x9))%expr_pat =>
- args <- invert_bind_args idc5 Raw.ident.Z_cast;
- _ <- invert_bind_args idc4 Raw.ident.Z_opp;
- args1 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args2 <- invert_bind_args idc2 Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_opp;
- args4 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_add_with_get_carry;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> s5) -> s8) -> s)%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> s5) -> s8) -> s)%ptype
- then
- v <- type.try_make_transport_cps s2 ℤ;
- v0 <- type.try_make_transport_cps s5 ℤ;
- v1 <- type.try_make_transport_cps s8 ℤ;
- v2 <- type.try_make_transport_cps s ℤ;
- fv <- (if
- (ZRange.normalize args <=?
- - ZRange.normalize args1)%zrange &&
- (ZRange.normalize args2 <=?
- - ZRange.normalize args4)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (expr_let v3 := (#(Z_cast2
- (Datatypes.fst
- range,
- -
- Datatypes.snd
- range))%expr @
- (#(Z_sub_with_get_borrow)%expr @
- ($(v
- (Compile.reflect
- x3)))%expr @
- (#(Z_cast args2)%expr @
- ($(v0
- (Compile.reflect
- x6)))%expr) @
- ($(v2
- (Compile.reflect
- x0)))%expr @
- (#(Z_cast args)%expr @
- ($(v1
- (Compile.reflect
- x9)))%expr)))%expr_pat in
- (#(Z_cast (Datatypes.fst range))%expr @
- (#(fst)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- $v3)),
- #(Z_cast (Datatypes.snd range))%expr @
- (-
- (#(Z_cast (- Datatypes.snd range))%expr @
- (#(snd)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- $v3)))%expr_pat))%expr_pat))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t3 idc3 @
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _
- ($_)%expr _))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _
- (@expr.Abs _ _ _ _ _ _) _))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _
- (_ @ _) _))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _
- (@expr.LetIn _ _ _ _ _ _ _) _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t3 idc3 @
- (@expr.Ident _ _ _ t4 idc4 @ #(_)))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @
- (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @
- (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ _))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @
- (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ _ _ _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t3 idc3 @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ (_ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- match x0 with
- | (@expr.Ident _ _ _ t3 idc3 @
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _
- (@expr.Ident _ _ _ t5 idc5) x9))%expr_pat =>
- args <- invert_bind_args idc5 Raw.ident.Z_cast;
- _ <- invert_bind_args idc4 Raw.ident.Z_opp;
- args1 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args2 <- invert_bind_args idc2 Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_opp;
- args4 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_add_with_get_carry;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> s5) -> s0) -> s8)%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> s5) -> s0) -> s8)%ptype
- then
- v <- type.try_make_transport_cps s2 ℤ;
- v0 <- type.try_make_transport_cps s5 ℤ;
- v1 <- type.try_make_transport_cps s0 ℤ;
- v2 <- type.try_make_transport_cps s8 ℤ;
- fv <- (if
- (ZRange.normalize args <=?
- - ZRange.normalize args1)%zrange &&
- (ZRange.normalize args2 <=?
- - ZRange.normalize args4)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (expr_let v3 := (#(Z_cast2
- (Datatypes.fst
- range,
- -
- Datatypes.snd
- range))%expr @
- (#(Z_sub_with_get_borrow)%expr @
- ($(v
- (Compile.reflect
- x3)))%expr @
- (#(Z_cast args2)%expr @
- ($(v0
- (Compile.reflect
- x6)))%expr) @
- ($(v1
- (Compile.reflect
- x1)))%expr @
- (#(Z_cast args)%expr @
- ($(v2
- (Compile.reflect
- x9)))%expr)))%expr_pat in
- (#(Z_cast (Datatypes.fst range))%expr @
- (#(fst)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- $v3)),
- #(Z_cast (Datatypes.snd range))%expr @
- (-
- (#(Z_cast (- Datatypes.snd range))%expr @
- (#(snd)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- $v3)))%expr_pat))%expr_pat))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t3 idc3 @
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _
- ($_)%expr _))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _
- (@expr.Abs _ _ _ _ _ _) _))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _
- (_ @ _) _))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _
- (@expr.LetIn _ _ _ _ _ _ _) _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t3 idc3 @
- (@expr.Ident _ _ _ t4 idc4 @ #(_)))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @
- (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @
- (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ _))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @
- (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ _ _ _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t3 idc3 @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ (_ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- match x1 with
- | (@expr.Ident _ _ _ t3 idc3 @ @expr.Ident _ _ _ t4 idc4)%expr_pat =>
- args <- invert_bind_args idc4 Raw.ident.Literal;
- args0 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc2 Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_opp;
- args3 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_add_with_get_carry;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> s5) -> (projT1 args)) -> s)%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> s5) -> (projT1 args)) -> s)%ptype
- then
- v <- type.try_make_transport_cps s2 ℤ;
- v0 <- type.try_make_transport_cps s5 ℤ;
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- v1 <- type.try_make_transport_cps s ℤ;
- fv <- (if
- ((let (x8, _) := xv in x8) <=? 0) &&
- is_bounded_by_bool
- (let (x8, _) := xv in x8)
- (ZRange.normalize args0) &&
- (ZRange.normalize args1 <=?
- - ZRange.normalize args3)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (expr_let v2 := (#(Z_cast2
- (Datatypes.fst
- range,
- -
- Datatypes.snd
- range))%expr @
- (#(Z_sub_with_get_borrow)%expr @
- ($(v
- (Compile.reflect
- x3)))%expr @
- (#(Z_cast args1)%expr @
- ($(v0
- (Compile.reflect
- x6)))%expr) @
- ($(v1
- (Compile.reflect
- x0)))%expr @
- (#(Z_cast (- args0))%expr @
- (##(-
- (let
- (x8, _) :=
- xv in
- x8))%Z)%expr)))%expr_pat in
- (#(Z_cast (Datatypes.fst range))%expr @
- (#(fst)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- $v2)),
- #(Z_cast (Datatypes.snd range))%expr @
- (-
- (#(Z_cast (- Datatypes.snd range))%expr @
- (#(snd)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- $v2)))%expr_pat))%expr_pat))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t3 idc3 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- match x0 with
- | (@expr.Ident _ _ _ t3 idc3 @ @expr.Ident _ _ _ t4 idc4)%expr_pat =>
- args <- invert_bind_args idc4 Raw.ident.Literal;
- args0 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc2 Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_opp;
- args3 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_add_with_get_carry;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> s5) -> s0) -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> s5) -> s0) -> (projT1 args))%ptype
- then
- v <- type.try_make_transport_cps s2 ℤ;
- v0 <- type.try_make_transport_cps s5 ℤ;
- v1 <- type.try_make_transport_cps s0 ℤ;
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- ((let (x8, _) := xv in x8) <=? 0) &&
- is_bounded_by_bool
- (let (x8, _) := xv in x8)
- (ZRange.normalize args0) &&
- (ZRange.normalize args1 <=?
- - ZRange.normalize args3)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (expr_let v2 := (#(Z_cast2
- (Datatypes.fst
- range,
- -
- Datatypes.snd
- range))%expr @
- (#(Z_sub_with_get_borrow)%expr @
- ($(v
- (Compile.reflect
- x3)))%expr @
- (#(Z_cast args1)%expr @
- ($(v0
- (Compile.reflect
- x6)))%expr) @
- ($(v1
- (Compile.reflect
- x1)))%expr @
- (#(Z_cast (- args0))%expr @
- (##(-
- (let
- (x8, _) :=
- xv in
- x8))%Z)%expr)))%expr_pat in
- (#(Z_cast (Datatypes.fst range))%expr @
- (#(fst)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- $v2)),
- #(Z_cast (Datatypes.snd range))%expr @
- (-
- (#(Z_cast (- Datatypes.snd range))%expr @
- (#(snd)%expr @
- (#(Z_cast2
- (Datatypes.fst range,
- - Datatypes.snd range))%expr @
- $v2)))%expr_pat))%expr_pat))
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t3 idc3 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | (@expr.Ident _ _ _ t1 idc1 @ @expr.App _ _ _ s5 _ ($_)%expr _)%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @ @expr.App _ _ _ s5 _
- (@expr.Abs _ _ _ _ _ _) _)%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @ @expr.App _ _ _ s5 _ (_ @ _) _)%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @ @expr.App _ _ _ s5 _
- (@expr.LetIn _ _ _ _ _ _ _) _)%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t1 idc1 @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- match x3 with
- | (@expr.Ident _ _ _ t1 idc1 @ @expr.Ident _ _ _ t2 idc2)%expr_pat =>
- match x1 with
- | (@expr.Ident _ _ _ t3 idc3 @ @expr.Ident _ _ _ t4 idc4)%expr_pat =>
- match x0 with
- | (@expr.Ident _ _ _ t5 idc5 @ @expr.Ident _ _ _ t6
- idc6)%expr_pat =>
- args <- invert_bind_args idc6 Raw.ident.Literal;
- args0 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc4 Raw.ident.Literal;
- args2 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args3 <- invert_bind_args idc2 Raw.ident.Literal;
- args4 <- invert_bind_args idc1 Raw.ident.Z_cast;
- args5 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_add_with_get_carry;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- ((((projT1 args3) -> s3) -> (projT1 args1)) ->
- (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- ((((projT1 args3) -> s3) -> (projT1 args1)) ->
- (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args3);
- v <- type.try_make_transport_cps s3 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args1);
- xv1 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- is_bounded_by_bool 0
- (ZRange.normalize args2) &&
- is_bounded_by_bool 0
- (ZRange.normalize args0) &&
- (ZRange.normalize args5 <=?
- r[0 ~> (let (x8, _) := xv in x8) - 1])%zrange &&
- is_bounded_by_bool 0
- (ZRange.normalize
- (Datatypes.snd range)) &&
- is_bounded_by_bool
- (let (x8, _) := xv in x8)
- (ZRange.normalize args4) &&
- ((let (x8, _) := xv0 in x8) =? 0) &&
- ((let (x8, _) := xv1 in x8) =? 0)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (expr_let v0 := (#(Z_cast2 range)%expr @
- (#(Z_add_with_get_carry)%expr @
- (#(Z_cast args4)%expr @
- (##(let
- (x8,
- _) :=
- xv in
- x8))%expr) @
- (#(Z_cast args5)%expr @
- ($(v
- (Compile.reflect
- x4)))%expr) @
- (#(Z_cast args2)%expr @
- (##0)%expr) @
- (#(Z_cast args0)%expr @
- (##0)%expr)))%expr_pat in
- (#(Z_cast (Datatypes.fst range))%expr @
- (#(fst)%expr @
- (#(Z_cast2 range)%expr @ $v0)),
- #(Z_cast r[0 ~> 0])%expr @ ##0)%expr_pat))
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ _ _
- _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end
- | (@expr.Ident _ _ _ t3 idc3 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | (@expr.Ident _ _ _ t1 idc1 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t1 idc1 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s3 _ ($_)%expr _ | @expr.App _ _ _ s3 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s3 _ (_ @ _)%expr_pat
- _ | @expr.App _ _ _ s3 _ (@expr.LetIn _ _ _ _ _ _ _) _ =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- _ <- invert_bind_args idc Raw.ident.Z_add_with_get_carry;
- match
- pattern.type.unify_extracted (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> s1) -> s0) -> s)%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype (((s2 -> s1) -> s0) -> s)%ptype
- then
- v <- type.try_make_transport_cps s2 ℤ;
- v0 <- type.try_make_transport_cps s1 ℤ;
- v1 <- type.try_make_transport_cps s0 ℤ;
- v2 <- type.try_make_transport_cps s ℤ;
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (expr_let v3 := (#(Z_cast2 range)%expr @
- (#(Z_add_with_get_carry)%expr @
- ($(v (Compile.reflect x3)))%expr @
- ($(v0 (Compile.reflect x2)))%expr @
- ($(v1 (Compile.reflect x1)))%expr @
- ($(v2 (Compile.reflect x0)))%expr))%expr_pat in
- (#(Z_cast (Datatypes.fst range))%expr @
- (#(fst)%expr @ (#(Z_cast2 range)%expr @ $v3)),
- #(Z_cast (Datatypes.snd range))%expr @
- (#(snd)%expr @ (#(Z_cast2 range)%expr @ $v3)))%expr_pat);
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;
- _ <- invert_bind_args idc Raw.ident.Z_sub_with_get_borrow;
- match
- pattern.type.unify_extracted (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s2 -> s1) -> s0) -> s)%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype (((s2 -> s1) -> s0) -> s)%ptype
- then
- v <- type.try_make_transport_cps s2 ℤ;
- v0 <- type.try_make_transport_cps s1 ℤ;
- v1 <- type.try_make_transport_cps s0 ℤ;
- v2 <- type.try_make_transport_cps s ℤ;
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (expr_let v3 := (#(Z_cast2 range)%expr @
- (#(Z_sub_with_get_borrow)%expr @
- ($(v (Compile.reflect x3)))%expr @
- ($(v0 (Compile.reflect x2)))%expr @
- ($(v1 (Compile.reflect x1)))%expr @
- ($(v2 (Compile.reflect x0)))%expr))%expr_pat in
- (#(Z_cast (Datatypes.fst range))%expr @
- (#(fst)%expr @ (#(Z_cast2 range)%expr @ $v3)),
- #(Z_cast (Datatypes.snd range))%expr @
- (#(snd)%expr @ (#(Z_cast2 range)%expr @ $v3)))%expr_pat);
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _ (@expr.App _ _ _ s2 _ ($_)%expr _) _) _) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.App _ _ _ s2 _ (@expr.Abs _ _ _ _ _ _) _) _) _) _ | @expr.App
- _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _ (@expr.App _ _ _ s2 _ (_ @ _)%expr_pat _) _) _)
- _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.App _ _ _ s2 _ (@expr.LetIn _ _ _ _ _ _ _) _) _) _) _ =>
- Datatypes.None
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.App _ _ _ s1 _ ($_)%expr _) _) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.App _ _ _ s1 _ (@expr.Abs _ _ _ _ _ _) _)
- _) _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _ (@expr.LetIn _ _ _ _ _ _ _) _) _) _ =>
- Datatypes.None
- | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ ($_)%expr _) _ | @expr.App _
- _ _ s _ (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _) _ | @expr.App
- _ _ _ s _ (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _) _ =>
- Datatypes.None
- | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr
- _ | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s
- _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;;
- Base (#(Z_cast2 range)%expr @ x)%expr_pat)%option
-| Some A => fun x : expr A => Base (#(Some)%expr @ x)%expr_pat
-| None A => Base #(None)%expr
-| @option_rect A P =>
- fun (x : expr A -> UnderLets (expr P))
- (x0 : expr unit -> UnderLets (expr P)) (x1 : expr (base.type.option A))
- =>
- Base
- (#(option_rect)%expr @ (λ x2 : var A,
- to_expr (x ($x2)))%expr @
- (λ x2 : var unit,
- to_expr (x0 ($x2)))%expr @ x1)%expr_pat
-| Build_zrange =>
- fun x x0 : expr ℤ => Base (#(Build_zrange)%expr @ x @ x0)%expr_pat
-| @zrange_rect P =>
- fun (x : expr ℤ -> expr ℤ -> UnderLets (expr P))
- (x0 : expr base.type.zrange) =>
- Base
- (#(zrange_rect)%expr @ (λ x1 x2 : var ℤ,
- to_expr (x ($x1) ($x2)))%expr @ x0)%expr_pat
-| fancy_add log2wordmax imm =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_add log2wordmax imm)%expr @ x)%expr_pat
-| fancy_addc log2wordmax imm =>
- fun x : expr (ℤ * ℤ * ℤ)%etype =>
- Base (#(fancy_addc log2wordmax imm)%expr @ x)%expr_pat
-| fancy_sub log2wordmax imm =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_sub log2wordmax imm)%expr @ x)%expr_pat
-| fancy_subb log2wordmax imm =>
- fun x : expr (ℤ * ℤ * ℤ)%etype =>
- Base (#(fancy_subb log2wordmax imm)%expr @ x)%expr_pat
-| fancy_mulll log2wordmax =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_mulll log2wordmax)%expr @ x)%expr_pat
-| fancy_mullh log2wordmax =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_mullh log2wordmax)%expr @ x)%expr_pat
-| fancy_mulhl log2wordmax =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_mulhl log2wordmax)%expr @ x)%expr_pat
-| fancy_mulhh log2wordmax =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_mulhh log2wordmax)%expr @ x)%expr_pat
-| fancy_rshi log2wordmax x =>
- fun x0 : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_rshi log2wordmax x)%expr @ x0)%expr_pat
-| fancy_selc =>
- fun x : expr (ℤ * ℤ * ℤ)%etype => Base (#(fancy_selc)%expr @ x)%expr_pat
-| fancy_selm log2wordmax =>
- fun x : expr (ℤ * ℤ * ℤ)%etype =>
- Base (#(fancy_selm log2wordmax)%expr @ x)%expr_pat
-| fancy_sell =>
- fun x : expr (ℤ * ℤ * ℤ)%etype => Base (#(fancy_sell)%expr @ x)%expr_pat
-| fancy_addm =>
- fun x : expr (ℤ * ℤ * ℤ)%etype => Base (#(fancy_addm)%expr @ x)%expr_pat
-end
- : Compile.value' true t
diff --git a/src/fancy_rewrite_head.out b/src/fancy_rewrite_head.out
deleted file mode 100644
index 104ad09b3..000000000
--- a/src/fancy_rewrite_head.out
+++ /dev/null
@@ -1,290 +0,0 @@
-fancy_rewrite_head =
-match idc in (Compilers.ident t) return (Compile.value' true t) with
-| @Literal t v => Base (##v)%expr
-| Nat_succ => fun x : expr ℕ => Base (#(Nat_succ)%expr @ x)%expr_pat
-| Nat_pred => fun x : expr ℕ => Base (#(Nat_pred)%expr @ x)%expr_pat
-| Nat_max => fun x x0 : expr ℕ => Base (#(Nat_max)%expr @ x @ x0)%expr_pat
-| Nat_mul => fun x x0 : expr ℕ => Base (#(Nat_mul)%expr @ x @ x0)%expr_pat
-| Nat_add => fun x x0 : expr ℕ => Base (#(Nat_add)%expr @ x @ x0)%expr_pat
-| Nat_sub => fun x x0 : expr ℕ => Base (#(Nat_sub)%expr @ x @ x0)%expr_pat
-| Nat_eqb => fun x x0 : expr ℕ => Base (#(Nat_eqb)%expr @ x @ x0)%expr_pat
-| @nil t => Base []%expr_pat
-| @cons t => fun (x : expr t) (x0 : expr (list t)) => Base (x :: x0)%expr_pat
-| @pair A B => fun (x : expr A) (x0 : expr B) => Base (x, x0)%expr_pat
-| @fst A B => fun x : expr (A * B)%etype => Base (#(fst)%expr @ x)%expr_pat
-| @snd A B => fun x : expr (A * B)%etype => Base (#(snd)%expr @ x)%expr_pat
-| @prod_rect A B T =>
- fun (x : expr A -> expr B -> UnderLets (expr T))
- (x0 : expr (A * B)%etype) =>
- Base
- (#(prod_rect)%expr @
- (λ (x1 : var A)(x2 : var B),
- to_expr (x ($x1) ($x2)))%expr @ x0)%expr_pat
-| @bool_rect T =>
- fun (x x0 : expr unit -> UnderLets (expr T)) (x1 : expr bool) =>
- Base
- (#(bool_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ x2 : var unit,
- to_expr (x0 ($x2)))%expr @ x1)%expr_pat
-| @nat_rect P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr ℕ -> expr P -> UnderLets (expr P)) (x1 : expr ℕ) =>
- Base
- (#(nat_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var ℕ)(x3 : var P),
- to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat
-| @nat_rect_arrow P Q =>
- fun (x : expr P -> UnderLets (expr Q))
- (x0 : expr ℕ ->
- (expr P -> UnderLets (expr Q)) -> expr P -> UnderLets (expr Q))
- (x1 : expr ℕ) (x2 : expr P) =>
- Base
- (#(nat_rect_arrow)%expr @ (λ x3 : var P,
- to_expr (x ($x3)))%expr @
- (λ (x3 : var ℕ)(x4 : var (P -> Q)%ptype)(x5 : var P),
- to_expr
- (x0 ($x3) (fun x6 : expr P => Base ($x4 @ x6)%expr_pat) ($x5)))%expr @
- x1 @ x2)%expr_pat
-| @eager_nat_rect P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr ℕ -> expr P -> UnderLets (expr P)) (x1 : expr ℕ) =>
- Base
- (#(eager_nat_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var ℕ)(x3 : var P),
- to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat
-| @eager_nat_rect_arrow P Q =>
- fun (x : expr P -> UnderLets (expr Q))
- (x0 : expr ℕ ->
- (expr P -> UnderLets (expr Q)) -> expr P -> UnderLets (expr Q))
- (x1 : expr ℕ) (x2 : expr P) =>
- Base
- (#(eager_nat_rect_arrow)%expr @ (λ x3 : var P,
- to_expr (x ($x3)))%expr @
- (λ (x3 : var ℕ)(x4 : var (P -> Q)%ptype)(x5 : var P),
- to_expr
- (x0 ($x3) (fun x6 : expr P => Base ($x4 @ x6)%expr_pat) ($x5)))%expr @
- x1 @ x2)%expr_pat
-| @list_rect A P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr A -> expr (list A) -> expr P -> UnderLets (expr P))
- (x1 : expr (list A)) =>
- Base
- (#(list_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var A)(x3 : var (list A))(x4 : var P),
- to_expr (x0 ($x2) ($x3) ($x4)))%expr @ x1)%expr_pat
-| @list_rect_arrow A P Q =>
- fun (x : expr P -> UnderLets (expr Q))
- (x0 : expr A ->
- expr (list A) ->
- (expr P -> UnderLets (expr Q)) -> expr P -> UnderLets (expr Q))
- (x1 : expr (list A)) (x2 : expr P) =>
- Base
- (#(list_rect_arrow)%expr @ (λ x3 : var P,
- to_expr (x ($x3)))%expr @
- (λ (x3 : var A)(x4 : var (list A))(x5 : var (P -> Q)%ptype)(x6 :
- var P),
- to_expr
- (x0 ($x3) ($x4) (fun x7 : expr P => Base ($x5 @ x7)%expr_pat) ($x6)))%expr @
- x1 @ x2)%expr_pat
-| @eager_list_rect A P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr A -> expr (list A) -> expr P -> UnderLets (expr P))
- (x1 : expr (list A)) =>
- Base
- (#(eager_list_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var A)(x3 : var (list A))(x4 : var P),
- to_expr (x0 ($x2) ($x3) ($x4)))%expr @ x1)%expr_pat
-| @eager_list_rect_arrow A P Q =>
- fun (x : expr P -> UnderLets (expr Q))
- (x0 : expr A ->
- expr (list A) ->
- (expr P -> UnderLets (expr Q)) -> expr P -> UnderLets (expr Q))
- (x1 : expr (list A)) (x2 : expr P) =>
- Base
- (#(eager_list_rect_arrow)%expr @ (λ x3 : var P,
- to_expr (x ($x3)))%expr @
- (λ (x3 : var A)(x4 : var (list A))(x5 : var (P -> Q)%ptype)(x6 :
- var P),
- to_expr
- (x0 ($x3) ($x4) (fun x7 : expr P => Base ($x5 @ x7)%expr_pat) ($x6)))%expr @
- x1 @ x2)%expr_pat
-| @list_case A P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr A -> expr (list A) -> UnderLets (expr P))
- (x1 : expr (list A)) =>
- Base
- (#(list_case)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var A)(x3 : var (list A)),
- to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat
-| @List_length T =>
- fun x : expr (list T) => Base (#(List_length)%expr @ x)%expr_pat
-| List_seq => fun x x0 : expr ℕ => Base (#(List_seq)%expr @ x @ x0)%expr_pat
-| @List_firstn A =>
- fun (x : expr ℕ) (x0 : expr (list A)) =>
- Base (#(List_firstn)%expr @ x @ x0)%expr_pat
-| @List_skipn A =>
- fun (x : expr ℕ) (x0 : expr (list A)) =>
- Base (#(List_skipn)%expr @ x @ x0)%expr_pat
-| @List_repeat A =>
- fun (x : expr A) (x0 : expr ℕ) =>
- Base (#(List_repeat)%expr @ x @ x0)%expr_pat
-| @List_combine A B =>
- fun (x : expr (list A)) (x0 : expr (list B)) =>
- Base (#(List_combine)%expr @ x @ x0)%expr_pat
-| @List_map A B =>
- fun (x : expr A -> UnderLets (expr B)) (x0 : expr (list A)) =>
- Base
- (#(List_map)%expr @ (λ x1 : var A,
- to_expr (x ($x1)))%expr @ x0)%expr_pat
-| @List_app A => fun x x0 : expr (list A) => Base (x ++ x0)%expr
-| @List_rev A =>
- fun x : expr (list A) => Base (#(List_rev)%expr @ x)%expr_pat
-| @List_flat_map A B =>
- fun (x : expr A -> UnderLets (expr (list B))) (x0 : expr (list A)) =>
- Base
- (#(List_flat_map)%expr @ (λ x1 : var A,
- to_expr (x ($x1)))%expr @ x0)%expr_pat
-| @List_partition A =>
- fun (x : expr A -> UnderLets (expr bool)) (x0 : expr (list A)) =>
- Base
- (#(List_partition)%expr @ (λ x1 : var A,
- to_expr (x ($x1)))%expr @ x0)%expr_pat
-| @List_fold_right A B =>
- fun (x : expr B -> expr A -> UnderLets (expr A)) (x0 : expr A)
- (x1 : expr (list B)) =>
- Base
- (#(List_fold_right)%expr @
- (λ (x2 : var B)(x3 : var A),
- to_expr (x ($x2) ($x3)))%expr @ x0 @ x1)%expr_pat
-| @List_update_nth T =>
- fun (x : expr ℕ) (x0 : expr T -> UnderLets (expr T)) (x1 : expr (list T))
- =>
- Base
- (#(List_update_nth)%expr @ x @ (λ x2 : var T,
- to_expr (x0 ($x2)))%expr @ x1)%expr_pat
-| @List_nth_default T =>
- fun (x : expr T) (x0 : expr (list T)) (x1 : expr ℕ) =>
- Base (#(List_nth_default)%expr @ x @ x0 @ x1)%expr_pat
-| @eager_List_nth_default T =>
- fun (x : expr T) (x0 : expr (list T)) (x1 : expr ℕ) =>
- Base (#(eager_List_nth_default)%expr @ x @ x0 @ x1)%expr_pat
-| Z_add => fun x x0 : expr ℤ => Base (x + x0)%expr
-| Z_mul => fun x x0 : expr ℤ => Base (x * x0)%expr
-| Z_pow => fun x x0 : expr ℤ => Base (#(Z_pow)%expr @ x @ x0)%expr_pat
-| Z_sub => fun x x0 : expr ℤ => Base (x - x0)%expr
-| Z_opp => fun x : expr ℤ => Base (- x)%expr
-| Z_div => fun x x0 : expr ℤ => Base (x / x0)%expr
-| Z_modulo => fun x x0 : expr ℤ => Base (x mod x0)%expr
-| Z_log2 => fun x : expr ℤ => Base (#(Z_log2)%expr @ x)%expr_pat
-| Z_log2_up => fun x : expr ℤ => Base (#(Z_log2_up)%expr @ x)%expr_pat
-| Z_eqb => fun x x0 : expr ℤ => Base (#(Z_eqb)%expr @ x @ x0)%expr_pat
-| Z_leb => fun x x0 : expr ℤ => Base (#(Z_leb)%expr @ x @ x0)%expr_pat
-| Z_ltb => fun x x0 : expr ℤ => Base (#(Z_ltb)%expr @ x @ x0)%expr_pat
-| Z_geb => fun x x0 : expr ℤ => Base (#(Z_geb)%expr @ x @ x0)%expr_pat
-| Z_gtb => fun x x0 : expr ℤ => Base (#(Z_gtb)%expr @ x @ x0)%expr_pat
-| Z_of_nat => fun x : expr ℕ => Base (#(Z_of_nat)%expr @ x)%expr_pat
-| Z_to_nat => fun x : expr ℤ => Base (#(Z_to_nat)%expr @ x)%expr_pat
-| Z_shiftr => fun x x0 : expr ℤ => Base (x >> x0)%expr
-| Z_shiftl => fun x x0 : expr ℤ => Base (x << x0)%expr
-| Z_land => fun x x0 : expr ℤ => Base (x &' x0)%expr
-| Z_lor => fun x x0 : expr ℤ => Base (x || x0)%expr
-| Z_min => fun x x0 : expr ℤ => Base (#(Z_min)%expr @ x @ x0)%expr_pat
-| Z_max => fun x x0 : expr ℤ => Base (#(Z_max)%expr @ x @ x0)%expr_pat
-| Z_bneg => fun x : expr ℤ => Base (#(Z_bneg)%expr @ x)%expr_pat
-| Z_lnot_modulo =>
- fun x x0 : expr ℤ => Base (#(Z_lnot_modulo)%expr @ x @ x0)%expr_pat
-| Z_mul_split =>
- fun x x0 x1 : expr ℤ => Base (#(Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat
-| Z_add_get_carry =>
- fun x x0 x1 : expr ℤ =>
- Base (#(Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat
-| Z_add_with_carry =>
- fun x x0 x1 : expr ℤ =>
- Base (#(Z_add_with_carry)%expr @ x @ x0 @ x1)%expr_pat
-| Z_add_with_get_carry =>
- fun x x0 x1 x2 : expr ℤ =>
- Base (#(Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat
-| Z_sub_get_borrow =>
- fun x x0 x1 : expr ℤ =>
- Base (#(Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat
-| Z_sub_with_get_borrow =>
- fun x x0 x1 x2 : expr ℤ =>
- Base (#(Z_sub_with_get_borrow)%expr @ x @ x0 @ x1 @ x2)%expr_pat
-| Z_zselect =>
- fun x x0 x1 : expr ℤ => Base (#(Z_zselect)%expr @ x @ x0 @ x1)%expr_pat
-| Z_add_modulo =>
- fun x x0 x1 : expr ℤ =>
- Base (#(Z_add_modulo)%expr @ x @ x0 @ x1)%expr_pat
-| Z_rshi =>
- fun x x0 x1 x2 : expr ℤ =>
- Base (#(Z_rshi)%expr @ x @ x0 @ x1 @ x2)%expr_pat
-| Z_cc_m => fun x x0 : expr ℤ => Base (#(Z_cc_m)%expr @ x @ x0)%expr_pat
-| Z_combine_at_bitwidth =>
- fun x x0 x1 : expr ℤ =>
- Base (#(Z_combine_at_bitwidth)%expr @ x @ x0 @ x1)%expr_pat
-| Z_cast range => fun x : expr ℤ => Base (#(Z_cast range)%expr @ x)%expr_pat
-| Z_cast2 range =>
- fun x : expr (ℤ * ℤ)%etype => Base (#(Z_cast2 range)%expr @ x)%expr_pat
-| Some A => fun x : expr A => Base (#(Some)%expr @ x)%expr_pat
-| None A => Base #(None)%expr
-| @option_rect A P =>
- fun (x : expr A -> UnderLets (expr P))
- (x0 : expr unit -> UnderLets (expr P)) (x1 : expr (base.type.option A))
- =>
- Base
- (#(option_rect)%expr @ (λ x2 : var A,
- to_expr (x ($x2)))%expr @
- (λ x2 : var unit,
- to_expr (x0 ($x2)))%expr @ x1)%expr_pat
-| Build_zrange =>
- fun x x0 : expr ℤ => Base (#(Build_zrange)%expr @ x @ x0)%expr_pat
-| @zrange_rect P =>
- fun (x : expr ℤ -> expr ℤ -> UnderLets (expr P))
- (x0 : expr base.type.zrange) =>
- Base
- (#(zrange_rect)%expr @ (λ x1 x2 : var ℤ,
- to_expr (x ($x1) ($x2)))%expr @ x0)%expr_pat
-| fancy_add log2wordmax imm =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_add log2wordmax imm)%expr @ x)%expr_pat
-| fancy_addc log2wordmax imm =>
- fun x : expr (ℤ * ℤ * ℤ)%etype =>
- Base (#(fancy_addc log2wordmax imm)%expr @ x)%expr_pat
-| fancy_sub log2wordmax imm =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_sub log2wordmax imm)%expr @ x)%expr_pat
-| fancy_subb log2wordmax imm =>
- fun x : expr (ℤ * ℤ * ℤ)%etype =>
- Base (#(fancy_subb log2wordmax imm)%expr @ x)%expr_pat
-| fancy_mulll log2wordmax =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_mulll log2wordmax)%expr @ x)%expr_pat
-| fancy_mullh log2wordmax =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_mullh log2wordmax)%expr @ x)%expr_pat
-| fancy_mulhl log2wordmax =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_mulhl log2wordmax)%expr @ x)%expr_pat
-| fancy_mulhh log2wordmax =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_mulhh log2wordmax)%expr @ x)%expr_pat
-| fancy_rshi log2wordmax x =>
- fun x0 : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_rshi log2wordmax x)%expr @ x0)%expr_pat
-| fancy_selc =>
- fun x : expr (ℤ * ℤ * ℤ)%etype => Base (#(fancy_selc)%expr @ x)%expr_pat
-| fancy_selm log2wordmax =>
- fun x : expr (ℤ * ℤ * ℤ)%etype =>
- Base (#(fancy_selm log2wordmax)%expr @ x)%expr_pat
-| fancy_sell =>
- fun x : expr (ℤ * ℤ * ℤ)%etype => Base (#(fancy_sell)%expr @ x)%expr_pat
-| fancy_addm =>
- fun x : expr (ℤ * ℤ * ℤ)%etype => Base (#(fancy_addm)%expr @ x)%expr_pat
-end
- : Compile.value' true t
diff --git a/src/fancy_with_casts_rewrite_head.out b/src/fancy_with_casts_rewrite_head.out
deleted file mode 100644
index e493afa78..000000000
--- a/src/fancy_with_casts_rewrite_head.out
+++ /dev/null
@@ -1,6485 +0,0 @@
-fancy_with_casts_rewrite_head =
-match idc in (Compilers.ident t) return (Compile.value' true t) with
-| @Literal t v => Base (##v)%expr
-| Nat_succ => fun x : expr ℕ => Base (#(Nat_succ)%expr @ x)%expr_pat
-| Nat_pred => fun x : expr ℕ => Base (#(Nat_pred)%expr @ x)%expr_pat
-| Nat_max => fun x x0 : expr ℕ => Base (#(Nat_max)%expr @ x @ x0)%expr_pat
-| Nat_mul => fun x x0 : expr ℕ => Base (#(Nat_mul)%expr @ x @ x0)%expr_pat
-| Nat_add => fun x x0 : expr ℕ => Base (#(Nat_add)%expr @ x @ x0)%expr_pat
-| Nat_sub => fun x x0 : expr ℕ => Base (#(Nat_sub)%expr @ x @ x0)%expr_pat
-| Nat_eqb => fun x x0 : expr ℕ => Base (#(Nat_eqb)%expr @ x @ x0)%expr_pat
-| @nil t => Base []%expr_pat
-| @cons t => fun (x : expr t) (x0 : expr (list t)) => Base (x :: x0)%expr_pat
-| @pair A B => fun (x : expr A) (x0 : expr B) => Base (x, x0)%expr_pat
-| @fst A B => fun x : expr (A * B)%etype => Base (#(fst)%expr @ x)%expr_pat
-| @snd A B => fun x : expr (A * B)%etype => Base (#(snd)%expr @ x)%expr_pat
-| @prod_rect A B T =>
- fun (x : expr A -> expr B -> UnderLets (expr T))
- (x0 : expr (A * B)%etype) =>
- Base
- (#(prod_rect)%expr @
- (λ (x1 : var A)(x2 : var B),
- to_expr (x ($x1) ($x2)))%expr @ x0)%expr_pat
-| @bool_rect T =>
- fun (x x0 : expr unit -> UnderLets (expr T)) (x1 : expr bool) =>
- Base
- (#(bool_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ x2 : var unit,
- to_expr (x0 ($x2)))%expr @ x1)%expr_pat
-| @nat_rect P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr ℕ -> expr P -> UnderLets (expr P)) (x1 : expr ℕ) =>
- Base
- (#(nat_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var ℕ)(x3 : var P),
- to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat
-| @nat_rect_arrow P Q =>
- fun (x : expr P -> UnderLets (expr Q))
- (x0 : expr ℕ ->
- (expr P -> UnderLets (expr Q)) -> expr P -> UnderLets (expr Q))
- (x1 : expr ℕ) (x2 : expr P) =>
- Base
- (#(nat_rect_arrow)%expr @ (λ x3 : var P,
- to_expr (x ($x3)))%expr @
- (λ (x3 : var ℕ)(x4 : var (P -> Q)%ptype)(x5 : var P),
- to_expr
- (x0 ($x3) (fun x6 : expr P => Base ($x4 @ x6)%expr_pat) ($x5)))%expr @
- x1 @ x2)%expr_pat
-| @eager_nat_rect P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr ℕ -> expr P -> UnderLets (expr P)) (x1 : expr ℕ) =>
- Base
- (#(eager_nat_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var ℕ)(x3 : var P),
- to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat
-| @eager_nat_rect_arrow P Q =>
- fun (x : expr P -> UnderLets (expr Q))
- (x0 : expr ℕ ->
- (expr P -> UnderLets (expr Q)) -> expr P -> UnderLets (expr Q))
- (x1 : expr ℕ) (x2 : expr P) =>
- Base
- (#(eager_nat_rect_arrow)%expr @ (λ x3 : var P,
- to_expr (x ($x3)))%expr @
- (λ (x3 : var ℕ)(x4 : var (P -> Q)%ptype)(x5 : var P),
- to_expr
- (x0 ($x3) (fun x6 : expr P => Base ($x4 @ x6)%expr_pat) ($x5)))%expr @
- x1 @ x2)%expr_pat
-| @list_rect A P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr A -> expr (list A) -> expr P -> UnderLets (expr P))
- (x1 : expr (list A)) =>
- Base
- (#(list_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var A)(x3 : var (list A))(x4 : var P),
- to_expr (x0 ($x2) ($x3) ($x4)))%expr @ x1)%expr_pat
-| @list_rect_arrow A P Q =>
- fun (x : expr P -> UnderLets (expr Q))
- (x0 : expr A ->
- expr (list A) ->
- (expr P -> UnderLets (expr Q)) -> expr P -> UnderLets (expr Q))
- (x1 : expr (list A)) (x2 : expr P) =>
- Base
- (#(list_rect_arrow)%expr @ (λ x3 : var P,
- to_expr (x ($x3)))%expr @
- (λ (x3 : var A)(x4 : var (list A))(x5 : var (P -> Q)%ptype)(x6 :
- var P),
- to_expr
- (x0 ($x3) ($x4) (fun x7 : expr P => Base ($x5 @ x7)%expr_pat) ($x6)))%expr @
- x1 @ x2)%expr_pat
-| @eager_list_rect A P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr A -> expr (list A) -> expr P -> UnderLets (expr P))
- (x1 : expr (list A)) =>
- Base
- (#(eager_list_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var A)(x3 : var (list A))(x4 : var P),
- to_expr (x0 ($x2) ($x3) ($x4)))%expr @ x1)%expr_pat
-| @eager_list_rect_arrow A P Q =>
- fun (x : expr P -> UnderLets (expr Q))
- (x0 : expr A ->
- expr (list A) ->
- (expr P -> UnderLets (expr Q)) -> expr P -> UnderLets (expr Q))
- (x1 : expr (list A)) (x2 : expr P) =>
- Base
- (#(eager_list_rect_arrow)%expr @ (λ x3 : var P,
- to_expr (x ($x3)))%expr @
- (λ (x3 : var A)(x4 : var (list A))(x5 : var (P -> Q)%ptype)(x6 :
- var P),
- to_expr
- (x0 ($x3) ($x4) (fun x7 : expr P => Base ($x5 @ x7)%expr_pat) ($x6)))%expr @
- x1 @ x2)%expr_pat
-| @list_case A P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr A -> expr (list A) -> UnderLets (expr P))
- (x1 : expr (list A)) =>
- Base
- (#(list_case)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var A)(x3 : var (list A)),
- to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat
-| @List_length T =>
- fun x : expr (list T) => Base (#(List_length)%expr @ x)%expr_pat
-| List_seq => fun x x0 : expr ℕ => Base (#(List_seq)%expr @ x @ x0)%expr_pat
-| @List_firstn A =>
- fun (x : expr ℕ) (x0 : expr (list A)) =>
- Base (#(List_firstn)%expr @ x @ x0)%expr_pat
-| @List_skipn A =>
- fun (x : expr ℕ) (x0 : expr (list A)) =>
- Base (#(List_skipn)%expr @ x @ x0)%expr_pat
-| @List_repeat A =>
- fun (x : expr A) (x0 : expr ℕ) =>
- Base (#(List_repeat)%expr @ x @ x0)%expr_pat
-| @List_combine A B =>
- fun (x : expr (list A)) (x0 : expr (list B)) =>
- Base (#(List_combine)%expr @ x @ x0)%expr_pat
-| @List_map A B =>
- fun (x : expr A -> UnderLets (expr B)) (x0 : expr (list A)) =>
- Base
- (#(List_map)%expr @ (λ x1 : var A,
- to_expr (x ($x1)))%expr @ x0)%expr_pat
-| @List_app A => fun x x0 : expr (list A) => Base (x ++ x0)%expr
-| @List_rev A =>
- fun x : expr (list A) => Base (#(List_rev)%expr @ x)%expr_pat
-| @List_flat_map A B =>
- fun (x : expr A -> UnderLets (expr (list B))) (x0 : expr (list A)) =>
- Base
- (#(List_flat_map)%expr @ (λ x1 : var A,
- to_expr (x ($x1)))%expr @ x0)%expr_pat
-| @List_partition A =>
- fun (x : expr A -> UnderLets (expr bool)) (x0 : expr (list A)) =>
- Base
- (#(List_partition)%expr @ (λ x1 : var A,
- to_expr (x ($x1)))%expr @ x0)%expr_pat
-| @List_fold_right A B =>
- fun (x : expr B -> expr A -> UnderLets (expr A)) (x0 : expr A)
- (x1 : expr (list B)) =>
- Base
- (#(List_fold_right)%expr @
- (λ (x2 : var B)(x3 : var A),
- to_expr (x ($x2) ($x3)))%expr @ x0 @ x1)%expr_pat
-| @List_update_nth T =>
- fun (x : expr ℕ) (x0 : expr T -> UnderLets (expr T)) (x1 : expr (list T))
- =>
- Base
- (#(List_update_nth)%expr @ x @ (λ x2 : var T,
- to_expr (x0 ($x2)))%expr @ x1)%expr_pat
-| @List_nth_default T =>
- fun (x : expr T) (x0 : expr (list T)) (x1 : expr ℕ) =>
- Base (#(List_nth_default)%expr @ x @ x0 @ x1)%expr_pat
-| @eager_List_nth_default T =>
- fun (x : expr T) (x0 : expr (list T)) (x1 : expr ℕ) =>
- Base (#(eager_List_nth_default)%expr @ x @ x0 @ x1)%expr_pat
-| Z_add => fun x x0 : expr ℤ => Base (x + x0)%expr
-| Z_mul => fun x x0 : expr ℤ => Base (x * x0)%expr
-| Z_pow => fun x x0 : expr ℤ => Base (#(Z_pow)%expr @ x @ x0)%expr_pat
-| Z_sub => fun x x0 : expr ℤ => Base (x - x0)%expr
-| Z_opp => fun x : expr ℤ => Base (- x)%expr
-| Z_div => fun x x0 : expr ℤ => Base (x / x0)%expr
-| Z_modulo => fun x x0 : expr ℤ => Base (x mod x0)%expr
-| Z_log2 => fun x : expr ℤ => Base (#(Z_log2)%expr @ x)%expr_pat
-| Z_log2_up => fun x : expr ℤ => Base (#(Z_log2_up)%expr @ x)%expr_pat
-| Z_eqb => fun x x0 : expr ℤ => Base (#(Z_eqb)%expr @ x @ x0)%expr_pat
-| Z_leb => fun x x0 : expr ℤ => Base (#(Z_leb)%expr @ x @ x0)%expr_pat
-| Z_ltb => fun x x0 : expr ℤ => Base (#(Z_ltb)%expr @ x @ x0)%expr_pat
-| Z_geb => fun x x0 : expr ℤ => Base (#(Z_geb)%expr @ x @ x0)%expr_pat
-| Z_gtb => fun x x0 : expr ℤ => Base (#(Z_gtb)%expr @ x @ x0)%expr_pat
-| Z_of_nat => fun x : expr ℕ => Base (#(Z_of_nat)%expr @ x)%expr_pat
-| Z_to_nat => fun x : expr ℤ => Base (#(Z_to_nat)%expr @ x)%expr_pat
-| Z_shiftr => fun x x0 : expr ℤ => Base (x >> x0)%expr
-| Z_shiftl => fun x x0 : expr ℤ => Base (x << x0)%expr
-| Z_land => fun x x0 : expr ℤ => Base (x &' x0)%expr
-| Z_lor => fun x x0 : expr ℤ => Base (x || x0)%expr
-| Z_min => fun x x0 : expr ℤ => Base (#(Z_min)%expr @ x @ x0)%expr_pat
-| Z_max => fun x x0 : expr ℤ => Base (#(Z_max)%expr @ x @ x0)%expr_pat
-| Z_bneg => fun x : expr ℤ => Base (#(Z_bneg)%expr @ x)%expr_pat
-| Z_lnot_modulo =>
- fun x x0 : expr ℤ => Base (#(Z_lnot_modulo)%expr @ x @ x0)%expr_pat
-| Z_mul_split =>
- fun x x0 x1 : expr ℤ => Base (#(Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat
-| Z_add_get_carry =>
- fun x x0 x1 : expr ℤ =>
- Base (#(Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat
-| Z_add_with_carry =>
- fun x x0 x1 : expr ℤ =>
- Base (#(Z_add_with_carry)%expr @ x @ x0 @ x1)%expr_pat
-| Z_add_with_get_carry =>
- fun x x0 x1 x2 : expr ℤ =>
- Base (#(Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat
-| Z_sub_get_borrow =>
- fun x x0 x1 : expr ℤ =>
- Base (#(Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat
-| Z_sub_with_get_borrow =>
- fun x x0 x1 x2 : expr ℤ =>
- Base (#(Z_sub_with_get_borrow)%expr @ x @ x0 @ x1 @ x2)%expr_pat
-| Z_zselect =>
- fun x x0 x1 : expr ℤ => Base (#(Z_zselect)%expr @ x @ x0 @ x1)%expr_pat
-| Z_add_modulo =>
- fun x x0 x1 : expr ℤ =>
- (match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- ((ℤ -> ℤ) -> ℤ)%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq ((ℤ -> ℤ) -> ℤ)%ptype
- ((ℤ -> ℤ) -> ℤ)%ptype
- then
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (#(fancy_addm)%expr @
- (($x)%expr, ($x0)%expr, ($x1)%expr))%expr_pat;
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end;;;
- Base (#(Z_add_modulo)%expr @ x @ x0 @ x1)%expr_pat)%option
-| Z_rshi =>
- fun x x0 x1 x2 : expr ℤ =>
- Base (#(Z_rshi)%expr @ x @ x0 @ x1 @ x2)%expr_pat
-| Z_cc_m => fun x x0 : expr ℤ => Base (#(Z_cc_m)%expr @ x @ x0)%expr_pat
-| Z_combine_at_bitwidth =>
- fun x x0 x1 : expr ℤ =>
- Base (#(Z_combine_at_bitwidth)%expr @ x @ x0 @ x1)%expr_pat
-| Z_cast range =>
- fun x : expr ℤ =>
- ((match x with
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat)
- (@expr.Ident _ _ _ t2 idc2 @ (@expr.Ident _ _ _ t3 idc3 @ x5 @ x4))%expr_pat =>
- match x5 with
- | @expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t4 idc4) x6 =>
- match x4 with
- | @expr.App _ _ _ s6 _ (@expr.Ident _ _ _ t5 idc5) x7 =>
- match x7 with
- | @expr.Ident _ _ _ t6 idc6 =>
- args <- invert_bind_args idc6 Raw.ident.Literal;
- args0 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc4 Raw.ident.Z_cast;
- _ <- invert_bind_args idc3 Raw.ident.Z_land;
- args3 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args4 <- invert_bind_args idc1 Raw.ident.Literal;
- args5 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_mul;
- match
- pattern.type.unify_extracted (ℤ -> ℤ -> ℤ)%ptype
- ((projT1 args4) -> s5 -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, (_, _))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (ℤ -> ℤ -> ℤ)%ptype
- ((projT1 args4) -> s5 -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args4);
- v <- type.try_make_transport_cps s5 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- negb
- (option_beq Z.eqb
- (invert_low
- (2 *
- Z.log2_up
- (let (x8, _) := xv0 in x8))
- (let (x8, _) := xv in x8))
- Datatypes.None) &&
- is_bounded_by_bool
- (let (x8, _) := xv in x8)
- (ZRange.normalize args5) &&
- is_bounded_by_bool
- (let (x8, _) := xv0 in x8)
- (ZRange.normalize args0) &&
- ((let (x8, _) := xv0 in x8) =?
- 2
- ^ (2 *
- Z.log2_up (let (x8, _) := xv0 in x8) /
- 2) - 1) &&
- (ZRange.normalize args1 &'
- ZRange.normalize
- (ZRange.constant
- (let (x8, _) := xv0 in x8)) <=?
- ZRange.normalize args3)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast range)%expr @
- (#(fancy_mulll
- (2 *
- Z.log2_up
- (let (x8, _) := xv0 in x8)))%expr @
- ((##match
- invert_low
- (2 *
- Z.log2_up
- (let (x8, _) := xv0 in
- x8))
- (let (x8, _) := xv in x8)
- with
- | Datatypes.Some x8 => x8
- | Datatypes.None => 0
- end)%expr,
- #(Z_cast args1)%expr @
- ($(v (Compile.reflect x6)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x6 with
- | @expr.Ident _ _ _ t6 idc6 =>
- (args <- invert_bind_args idc6 Raw.ident.Literal;
- args0 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc4 Raw.ident.Z_cast;
- _ <- invert_bind_args idc3 Raw.ident.Z_land;
- args3 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args4 <- invert_bind_args idc1 Raw.ident.Literal;
- args5 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_mul;
- match
- pattern.type.unify_extracted (ℤ -> ℤ -> ℤ)%ptype
- ((projT1 args4) -> (projT1 args) -> s6)%ptype
- with
- | Datatypes.Some (_, (_, _))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (ℤ -> ℤ -> ℤ)%ptype
- ((projT1 args4) -> (projT1 args) -> s6)%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args4);
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- v <- type.try_make_transport_cps s6 ℤ;
- fv <- (if
- negb
- (option_beq Z.eqb
- (invert_low
- (2 *
- Z.log2_up
- (let (x8, _) := xv0 in x8))
- (let (x8, _) := xv in x8))
- Datatypes.None) &&
- is_bounded_by_bool
- (let (x8, _) := xv in x8)
- (ZRange.normalize args5) &&
- is_bounded_by_bool
- (let (x8, _) := xv0 in x8)
- (ZRange.normalize args1) &&
- ((let (x8, _) := xv0 in x8) =?
- 2
- ^ (2 *
- Z.log2_up (let (x8, _) := xv0 in x8) /
- 2) - 1) &&
- (ZRange.normalize
- (ZRange.constant
- (let (x8, _) := xv0 in x8)) &'
- ZRange.normalize args0 <=?
- ZRange.normalize args3)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast range)%expr @
- (#(fancy_mulll
- (2 *
- Z.log2_up
- (let (x8, _) := xv0 in x8)))%expr @
- ((##match
- invert_low
- (2 *
- Z.log2_up
- (let (x8, _) := xv0 in
- x8))
- (let (x8, _) := xv in x8)
- with
- | Datatypes.Some x8 => x8
- | Datatypes.None => 0
- end)%expr,
- #(Z_cast args0)%expr @
- ($(v (Compile.reflect x7)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;
- args <- invert_bind_args idc6 Raw.ident.Literal;
- args0 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc4 Raw.ident.Z_cast;
- _ <- invert_bind_args idc3 Raw.ident.Z_land;
- args3 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args4 <- invert_bind_args idc1 Raw.ident.Literal;
- args5 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_mul;
- match
- pattern.type.unify_extracted (ℤ -> ℤ -> ℤ)%ptype
- ((projT1 args4) -> (projT1 args) -> s6)%ptype
- with
- | Datatypes.Some (_, (_, _))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (ℤ -> ℤ -> ℤ)%ptype
- ((projT1 args4) -> (projT1 args) -> s6)%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args4);
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- v <- type.try_make_transport_cps s6 ℤ;
- fv <- (if
- negb
- (option_beq Z.eqb
- (invert_high
- (2 *
- Z.log2_up
- (let (x8, _) := xv0 in x8))
- (let (x8, _) := xv in x8))
- Datatypes.None) &&
- is_bounded_by_bool
- (let (x8, _) := xv in x8)
- (ZRange.normalize args5) &&
- is_bounded_by_bool
- (let (x8, _) := xv0 in x8)
- (ZRange.normalize args1) &&
- ((let (x8, _) := xv0 in x8) =?
- 2
- ^ (2 *
- Z.log2_up (let (x8, _) := xv0 in x8) /
- 2) - 1) &&
- (ZRange.normalize
- (ZRange.constant
- (let (x8, _) := xv0 in x8)) &'
- ZRange.normalize args0 <=?
- ZRange.normalize args3)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast range)%expr @
- (#(fancy_mulhl
- (2 *
- Z.log2_up
- (let (x8, _) := xv0 in x8)))%expr @
- ((##match
- invert_high
- (2 *
- Z.log2_up
- (let (x8, _) := xv0 in
- x8))
- (let (x8, _) := xv in x8)
- with
- | Datatypes.Some x8 => x8
- | Datatypes.None => 0
- end)%expr,
- #(Z_cast args0)%expr @
- ($(v (Compile.reflect x7)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x7 with
- | @expr.Ident _ _ _ t6 idc6 =>
- args <- invert_bind_args idc6 Raw.ident.Literal;
- args0 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc4 Raw.ident.Z_cast;
- _ <- invert_bind_args idc3 Raw.ident.Z_land;
- args3 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args4 <- invert_bind_args idc1 Raw.ident.Literal;
- args5 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_mul;
- match
- pattern.type.unify_extracted (ℤ -> ℤ -> ℤ)%ptype
- ((projT1 args4) -> s5 -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, (_, _))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (ℤ -> ℤ -> ℤ)%ptype
- ((projT1 args4) -> s5 -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args4);
- v <- type.try_make_transport_cps s5 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- negb
- (option_beq Z.eqb
- (invert_high
- (2 *
- Z.log2_up
- (let (x8, _) := xv0 in x8))
- (let (x8, _) := xv in x8))
- Datatypes.None) &&
- is_bounded_by_bool
- (let (x8, _) := xv in x8)
- (ZRange.normalize args5) &&
- is_bounded_by_bool
- (let (x8, _) := xv0 in x8)
- (ZRange.normalize args0) &&
- ((let (x8, _) := xv0 in x8) =?
- 2
- ^ (2 *
- Z.log2_up (let (x8, _) := xv0 in x8) /
- 2) - 1) &&
- (ZRange.normalize args1 &'
- ZRange.normalize
- (ZRange.constant
- (let (x8, _) := xv0 in x8)) <=?
- ZRange.normalize args3)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast range)%expr @
- (#(fancy_mulhl
- (2 *
- Z.log2_up
- (let (x8, _) := xv0 in x8)))%expr @
- ((##match
- invert_high
- (2 *
- Z.log2_up
- (let (x8, _) := xv0 in
- x8))
- (let (x8, _) := xv in x8)
- with
- | Datatypes.Some x8 => x8
- | Datatypes.None => 0
- end)%expr,
- #(Z_cast args1)%expr @
- ($(v (Compile.reflect x6)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s6 _ ($_)%expr _ | @expr.App _ _ _ s6 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s6 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s6 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s5 _ ($_)%expr _ | @expr.App _ _ _ s5 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s5 _ (_ @ _)%expr_pat
- _ | @expr.App _ _ _ s5 _ (@expr.LetIn _ _ _ _ _ _ _) _ =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- match x5 with
- | @expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t4 idc4) x6 =>
- match x4 with
- | (@expr.Ident _ _ _ t5 idc5 @ @expr.Ident _ _ _ t6 idc6)%expr_pat =>
- (args <- invert_bind_args idc6 Raw.ident.Literal;
- args0 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc4 Raw.ident.Z_cast;
- _ <- invert_bind_args idc3 Raw.ident.Z_shiftr;
- args3 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args4 <- invert_bind_args idc1 Raw.ident.Literal;
- args5 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_mul;
- match
- pattern.type.unify_extracted (ℤ -> ℤ -> ℤ)%ptype
- ((projT1 args4) -> s5 -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, (_, _))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (ℤ -> ℤ -> ℤ)%ptype
- ((projT1 args4) -> s5 -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args4);
- v <- type.try_make_transport_cps s5 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- negb
- (option_beq Z.eqb
- (invert_low
- (2 * (let (x8, _) := xv0 in x8))
- (let (x8, _) := xv in x8))
- Datatypes.None) &&
- is_bounded_by_bool (let (x8, _) := xv in x8)
- (ZRange.normalize args5) &&
- is_bounded_by_bool (let (x8, _) := xv0 in x8)
- (ZRange.normalize args0) &&
- (ZRange.normalize args1 >>
- ZRange.normalize
- (ZRange.constant
- (let (x8, _) := xv0 in x8)) <=?
- ZRange.normalize args3)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (#(Z_cast range)%expr @
- (#(fancy_mullh
- (2 * (let (x8, _) := xv0 in x8)))%expr @
- ((##match
- invert_low
- (2 *
- (let (x8, _) := xv0 in x8))
- (let (x8, _) := xv in x8)
- with
- | Datatypes.Some x8 => x8
- | Datatypes.None => 0
- end)%expr,
- #(Z_cast args1)%expr @
- ($(v (Compile.reflect x6)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;
- args <- invert_bind_args idc6 Raw.ident.Literal;
- args0 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc4 Raw.ident.Z_cast;
- _ <- invert_bind_args idc3 Raw.ident.Z_shiftr;
- args3 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args4 <- invert_bind_args idc1 Raw.ident.Literal;
- args5 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_mul;
- match
- pattern.type.unify_extracted (ℤ -> ℤ -> ℤ)%ptype
- ((projT1 args4) -> s5 -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, (_, _))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (ℤ -> ℤ -> ℤ)%ptype
- ((projT1 args4) -> s5 -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args4);
- v <- type.try_make_transport_cps s5 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- negb
- (option_beq Z.eqb
- (invert_high
- (2 * (let (x8, _) := xv0 in x8))
- (let (x8, _) := xv in x8))
- Datatypes.None) &&
- is_bounded_by_bool (let (x8, _) := xv in x8)
- (ZRange.normalize args5) &&
- is_bounded_by_bool (let (x8, _) := xv0 in x8)
- (ZRange.normalize args0) &&
- (ZRange.normalize args1 >>
- ZRange.normalize
- (ZRange.constant (let (x8, _) := xv0 in x8)) <=?
- ZRange.normalize args3)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (#(Z_cast range)%expr @
- (#(fancy_mulhh
- (2 * (let (x8, _) := xv0 in x8)))%expr @
- ((##match
- invert_high
- (2 * (let (x8, _) := xv0 in x8))
- (let (x8, _) := xv in x8)
- with
- | Datatypes.Some x8 => x8
- | Datatypes.None => 0
- end)%expr,
- #(Z_cast args1)%expr @
- ($(v (Compile.reflect x6)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s5 _ ($_)%expr _ | @expr.App _ _ _ s5 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s5 _ (_ @ _)%expr_pat
- _ | @expr.App _ _ _ s5 _ (@expr.LetIn _ _ _ _ _ _ _) _ =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat)
- (@expr.Ident _ _ _ t2 idc2 @ #(_))%expr_pat | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat)
- (@expr.Ident _ _ _ t2 idc2 @ ($_)%expr)%expr_pat | @expr.App _ _ _ s
- _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat)
- (@expr.Ident _ _ _ t2 idc2 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat)
- (@expr.Ident _ _ _ t2 idc2 @ (#(_) @ _))%expr_pat | @expr.App _ _ _ s
- _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat)
- (@expr.Ident _ _ _ t2 idc2 @ (($_)%expr @ _))%expr_pat | @expr.App _
- _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat)
- (@expr.Ident _ _ _ t2 idc2 @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat)
- (@expr.Ident _ _ _ t2 idc2 @ (($_)%expr @ _ @ _))%expr_pat |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat)
- (@expr.Ident _ _ _ t2 idc2 @ (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat)
- (@expr.Ident _ _ _ t2 idc2 @ (_ @ _ @ _ @ _))%expr_pat | @expr.App _
- _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat)
- (@expr.Ident _ _ _ t2 idc2 @ (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat)
- (@expr.Ident _ _ _ t2 idc2 @ (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat)
- (@expr.Ident _ _ _ t2 idc2 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat)
- #(_)%expr_pat | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat)
- ($_)%expr | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat)
- (@expr.Abs _ _ _ _ _ _) | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat)
- (($_)%expr @ _)%expr_pat | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat)
- (@expr.Abs _ _ _ _ _ _ @ _)%expr_pat | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat)
- (_ @ _ @ _)%expr_pat | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat)
- (@expr.LetIn _ _ _ _ _ _ _ @ _)%expr_pat | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat)
- (@expr.LetIn _ _ _ _ _ _ _) => Datatypes.None
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ (@expr.Ident _ _ _ t1 idc1 @ x4 @ x3))%expr_pat)
- x0 =>
- match x4 with
- | @expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5 =>
- match x5 with
- | @expr.Ident _ _ _ t3 idc3 =>
- match x3 with
- | @expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t4 idc4) x6 =>
- match x0 with
- | (@expr.Ident _ _ _ t5 idc5 @ @expr.Ident _ _ _ t6
- idc6)%expr_pat =>
- args <- invert_bind_args idc6 Raw.ident.Literal;
- args0 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc4 Raw.ident.Z_cast;
- args2 <- invert_bind_args idc3 Raw.ident.Literal;
- args3 <- invert_bind_args idc2 Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_land;
- args5 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_mul;
- match
- pattern.type.unify_extracted
- ((ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args2) -> s5) -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args2) -> s5) -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args2);
- v <- type.try_make_transport_cps s5 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- negb
- (option_beq Z.eqb
- (invert_low
- (2 *
- Z.log2_up
- (let (x8, _) := xv in x8))
- (let (x8, _) := xv0 in x8))
- Datatypes.None) &&
- is_bounded_by_bool
- (let (x8, _) := xv0 in x8)
- (ZRange.normalize args0) &&
- is_bounded_by_bool
- (let (x8, _) := xv in x8)
- (ZRange.normalize args3) &&
- ((let (x8, _) := xv in x8) =?
- 2
- ^ (2 *
- Z.log2_up
- (let (x8, _) := xv in x8) / 2) -
- 1) &&
- (ZRange.normalize
- (ZRange.constant
- (let (x8, _) := xv in x8)) &'
- ZRange.normalize args1 <=?
- ZRange.normalize args5)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast range)%expr @
- (#(fancy_mulll
- (2 *
- Z.log2_up
- (let (x8, _) := xv in x8)))%expr @
- (#(Z_cast args1)%expr @
- ($(v (Compile.reflect x6)))%expr,
- (##match
- invert_low
- (2 *
- Z.log2_up
- (let (x8, _) := xv in
- x8))
- (let (x8, _) := xv0 in
- x8)
- with
- | Datatypes.Some y => y
- | Datatypes.None => 0
- end)%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ _ _
- _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s5 _ ($_)%expr _ | @expr.App _ _ _ s5 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s5 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s5 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x3 with
- | @expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t3 idc3) x6 =>
- match x6 with
- | @expr.Ident _ _ _ t4 idc4 =>
- match x0 with
- | (@expr.Ident _ _ _ t5 idc5 @ @expr.Ident _ _ _ t6
- idc6)%expr_pat =>
- args <- invert_bind_args idc6 Raw.ident.Literal;
- args0 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc4 Raw.ident.Literal;
- args2 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args3 <- invert_bind_args idc2 Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_land;
- args5 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_mul;
- match
- pattern.type.unify_extracted
- ((ℤ -> ℤ) -> ℤ)%ptype
- ((s4 -> (projT1 args1)) -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype
- ((s4 -> (projT1 args1)) -> (projT1 args))%ptype
- then
- v <- type.try_make_transport_cps s4 ℤ;
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args1);
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- negb
- (option_beq Z.eqb
- (invert_low
- (2 *
- Z.log2_up
- (let (x8, _) := xv in x8))
- (let (x8, _) := xv0 in x8))
- Datatypes.None) &&
- is_bounded_by_bool
- (let (x8, _) := xv0 in x8)
- (ZRange.normalize args0) &&
- is_bounded_by_bool
- (let (x8, _) := xv in x8)
- (ZRange.normalize args2) &&
- ((let (x8, _) := xv in x8) =?
- 2
- ^ (2 *
- Z.log2_up
- (let (x8, _) := xv in x8) / 2) -
- 1) &&
- (ZRange.normalize args3 &'
- ZRange.normalize
- (ZRange.constant
- (let (x8, _) := xv in x8)) <=?
- ZRange.normalize args5)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast range)%expr @
- (#(fancy_mulll
- (2 *
- Z.log2_up
- (let (x8, _) := xv in x8)))%expr @
- (#(Z_cast args3)%expr @
- ($(v (Compile.reflect x5)))%expr,
- (##match
- invert_low
- (2 *
- Z.log2_up
- (let (x8, _) := xv in
- x8))
- (let (x8, _) := xv0 in
- x8)
- with
- | Datatypes.Some y => y
- | Datatypes.None => 0
- end)%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ _ _
- _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x5 with
- | @expr.Ident _ _ _ t4 idc4 =>
- match x0 with
- | (@expr.Ident _ _ _ t5 idc5 @ @expr.Ident _ _ _ t6
- idc6)%expr_pat =>
- args <- invert_bind_args idc6 Raw.ident.Literal;
- args0 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc4 Raw.ident.Literal;
- args2 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args3 <- invert_bind_args idc2 Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_land;
- args5 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_mul;
- match
- pattern.type.unify_extracted
- ((ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args1) -> s5) -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args1) -> s5) -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args1);
- v <- type.try_make_transport_cps s5 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- negb
- (option_beq Z.eqb
- (invert_high
- (2 *
- Z.log2_up
- (let (x8, _) := xv in x8))
- (let (x8, _) := xv0 in x8))
- Datatypes.None) &&
- is_bounded_by_bool
- (let (x8, _) := xv0 in x8)
- (ZRange.normalize args0) &&
- is_bounded_by_bool
- (let (x8, _) := xv in x8)
- (ZRange.normalize args3) &&
- ((let (x8, _) := xv in x8) =?
- 2
- ^ (2 *
- Z.log2_up
- (let (x8, _) := xv in x8) / 2) -
- 1) &&
- (ZRange.normalize
- (ZRange.constant
- (let (x8, _) := xv in x8)) &'
- ZRange.normalize args2 <=?
- ZRange.normalize args5)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast range)%expr @
- (#(fancy_mullh
- (2 *
- Z.log2_up
- (let (x8, _) := xv in x8)))%expr @
- (#(Z_cast args2)%expr @
- ($(v (Compile.reflect x6)))%expr,
- (##match
- invert_high
- (2 *
- Z.log2_up
- (let (x8, _) := xv in
- x8))
- (let (x8, _) := xv0 in
- x8)
- with
- | Datatypes.Some y => y
- | Datatypes.None => 0
- end)%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ _ _
- _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x6 with
- | @expr.Ident _ _ _ t4 idc4 =>
- match x0 with
- | (@expr.Ident _ _ _ t5 idc5 @ @expr.Ident _ _ _ t6
- idc6)%expr_pat =>
- args <- invert_bind_args idc6 Raw.ident.Literal;
- args0 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc4 Raw.ident.Literal;
- args2 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args3 <- invert_bind_args idc2 Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_land;
- args5 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_mul;
- match
- pattern.type.unify_extracted
- ((ℤ -> ℤ) -> ℤ)%ptype
- ((s4 -> (projT1 args1)) -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype
- ((s4 -> (projT1 args1)) -> (projT1 args))%ptype
- then
- v <- type.try_make_transport_cps s4 ℤ;
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args1);
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- negb
- (option_beq Z.eqb
- (invert_high
- (2 *
- Z.log2_up
- (let (x8, _) := xv in x8))
- (let (x8, _) := xv0 in x8))
- Datatypes.None) &&
- is_bounded_by_bool
- (let (x8, _) := xv0 in x8)
- (ZRange.normalize args0) &&
- is_bounded_by_bool
- (let (x8, _) := xv in x8)
- (ZRange.normalize args2) &&
- ((let (x8, _) := xv in x8) =?
- 2
- ^ (2 *
- Z.log2_up
- (let (x8, _) := xv in x8) / 2) -
- 1) &&
- (ZRange.normalize args3 &'
- ZRange.normalize
- (ZRange.constant
- (let (x8, _) := xv in x8)) <=?
- ZRange.normalize args5)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast range)%expr @
- (#(fancy_mullh
- (2 *
- Z.log2_up
- (let (x8, _) := xv in x8)))%expr @
- (#(Z_cast args3)%expr @
- ($(v (Compile.reflect x5)))%expr,
- (##match
- invert_high
- (2 *
- Z.log2_up
- (let (x8, _) := xv in
- x8))
- (let (x8, _) := xv0 in
- x8)
- with
- | Datatypes.Some y => y
- | Datatypes.None => 0
- end)%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ _ _
- _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x5 with
- | @expr.Ident _ _ _ t4 idc4 =>
- match x0 with
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Ident _ _ _ t8
- idc8) @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t9 idc9) x11))%expr_pat =>
- args <- invert_bind_args idc9 Raw.ident.Z_cast;
- args0 <- invert_bind_args idc8 Raw.ident.Literal;
- args1 <- invert_bind_args idc7 Raw.ident.Z_cast;
- _ <- invert_bind_args idc6 Raw.ident.Z_land;
- args3 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args4 <- invert_bind_args idc4 Raw.ident.Literal;
- args5 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args6 <- invert_bind_args idc2 Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_land;
- args8 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_mul;
- match
- pattern.type.unify_extracted
- ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype
- (((projT1 args4) -> s5) ->
- (projT1 args0) -> s10)%ptype
- with
- | Datatypes.Some (_, _, (_, _))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype
- (((projT1 args4) -> s5) ->
- (projT1 args0) -> s10)%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args4);
- v <- type.try_make_transport_cps s5 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args0);
- v0 <- type.try_make_transport_cps s10 ℤ;
- fv <- (if
- is_bounded_by_bool
- (let (x12, _) := xv in x12)
- (ZRange.normalize args6) &&
- is_bounded_by_bool
- (let (x12, _) := xv0 in x12)
- (ZRange.normalize args1) &&
- ((let (x12, _) := xv in x12) =?
- 2
- ^ (2 *
- Z.log2_up
- (let (x12, _) := xv in x12) / 2) -
- 1) &&
- ((let (x12, _) := xv0 in x12) =?
- 2
- ^ (2 *
- Z.log2_up
- (let (x12, _) := xv in x12) / 2) -
- 1) &&
- (ZRange.normalize
- (ZRange.constant
- (let (x12, _) := xv in x12)) &'
- ZRange.normalize args5 <=?
- ZRange.normalize args8)%zrange &&
- (ZRange.normalize
- (ZRange.constant
- (let (x12, _) := xv0 in x12)) &'
- ZRange.normalize args <=?
- ZRange.normalize args3)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast range)%expr @
- (#(fancy_mulll
- (2 *
- Z.log2_up
- (let (x12, _) := xv in
- x12)))%expr @
- (#(Z_cast args5)%expr @
- ($(v (Compile.reflect x6)))%expr,
- #(Z_cast args)%expr @
- ($(v0 (Compile.reflect x11)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Ident _ _ _ t8
- idc8) @ @expr.App _ _ _ s10 _ ($_)%expr _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Ident _ _ _ t8
- idc8) @ @expr.App _ _ _ s10 _
- (@expr.Abs _ _ _ _ _ _) _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Ident _ _ _ t8
- idc8) @ @expr.App _ _ _ s10 _ (_ @ _) _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Ident _ _ _ t8
- idc8) @ @expr.App _ _ _ s10 _
- (@expr.LetIn _ _ _ _ _ _ _) _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Ident _ _ _ t8
- idc8) @ #(_)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Ident _ _ _ t8
- idc8) @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Ident _ _ _ t8
- idc8) @ @expr.Abs _ _ _ _ _ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Ident _ _ _ t8
- idc8) @ @expr.LetIn _ _ _ _ _ _ _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ ($_)%expr) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Abs _ _ _ _ _ _) @
- _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ (_ @ _)) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.LetIn _ _ _ _ _
- _ _) @ _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ #(_) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ _ _ _ @
- _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ (($_)%expr @ _) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Abs _ _ _ _ _ _ @ _) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ (_ @ _ @ _) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ _ _ _ _
- _ @ _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (#(_) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ _ _
- _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x6 with
- | @expr.Ident _ _ _ t4 idc4 =>
- match x0 with
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Ident _ _ _ t8
- idc8) @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t9 idc9) x11))%expr_pat =>
- args <- invert_bind_args idc9 Raw.ident.Z_cast;
- args0 <- invert_bind_args idc8 Raw.ident.Literal;
- args1 <- invert_bind_args idc7 Raw.ident.Z_cast;
- _ <- invert_bind_args idc6 Raw.ident.Z_land;
- args3 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args4 <- invert_bind_args idc4 Raw.ident.Literal;
- args5 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args6 <- invert_bind_args idc2 Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_land;
- args8 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_mul;
- match
- pattern.type.unify_extracted
- ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype
- ((s4 -> (projT1 args4)) ->
- (projT1 args0) -> s10)%ptype
- with
- | Datatypes.Some (_, _, (_, _))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype
- ((s4 -> (projT1 args4)) ->
- (projT1 args0) -> s10)%ptype
- then
- v <- type.try_make_transport_cps s4 ℤ;
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args4);
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args0);
- v0 <- type.try_make_transport_cps s10 ℤ;
- fv <- (if
- is_bounded_by_bool
- (let (x12, _) := xv in x12)
- (ZRange.normalize args5) &&
- is_bounded_by_bool
- (let (x12, _) := xv0 in x12)
- (ZRange.normalize args1) &&
- ((let (x12, _) := xv in x12) =?
- 2
- ^ (2 *
- Z.log2_up
- (let (x12, _) := xv in x12) / 2) -
- 1) &&
- ((let (x12, _) := xv0 in x12) =?
- 2
- ^ (2 *
- Z.log2_up
- (let (x12, _) := xv in x12) / 2) -
- 1) &&
- (ZRange.normalize args6 &'
- ZRange.normalize
- (ZRange.constant
- (let (x12, _) := xv in x12)) <=?
- ZRange.normalize args8)%zrange &&
- (ZRange.normalize
- (ZRange.constant
- (let (x12, _) := xv0 in x12)) &'
- ZRange.normalize args <=?
- ZRange.normalize args3)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast range)%expr @
- (#(fancy_mulll
- (2 *
- Z.log2_up
- (let (x12, _) := xv in
- x12)))%expr @
- (#(Z_cast args6)%expr @
- ($(v (Compile.reflect x5)))%expr,
- #(Z_cast args)%expr @
- ($(v0 (Compile.reflect x11)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Ident _ _ _ t8
- idc8) @ @expr.App _ _ _ s10 _ ($_)%expr _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Ident _ _ _ t8
- idc8) @ @expr.App _ _ _ s10 _
- (@expr.Abs _ _ _ _ _ _) _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Ident _ _ _ t8
- idc8) @ @expr.App _ _ _ s10 _ (_ @ _) _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Ident _ _ _ t8
- idc8) @ @expr.App _ _ _ s10 _
- (@expr.LetIn _ _ _ _ _ _ _) _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Ident _ _ _ t8
- idc8) @ #(_)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Ident _ _ _ t8
- idc8) @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Ident _ _ _ t8
- idc8) @ @expr.Abs _ _ _ _ _ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Ident _ _ _ t8
- idc8) @ @expr.LetIn _ _ _ _ _ _ _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ ($_)%expr) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Abs _ _ _ _ _ _) @
- _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ (_ @ _)) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.LetIn _ _ _ _ _
- _ _) @ _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ #(_) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ _ _ _ @
- _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ (($_)%expr @ _) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Abs _ _ _ _ _ _ @ _) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ (_ @ _ @ _) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ _ _ _ _
- _ @ _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (#(_) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ _ _
- _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x5 with
- | @expr.Ident _ _ _ t4 idc4 =>
- match x0 with
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9)))%expr_pat =>
- args <- invert_bind_args idc9 Raw.ident.Literal;
- args0 <- invert_bind_args idc8 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc7 Raw.ident.Z_cast;
- _ <- invert_bind_args idc6 Raw.ident.Z_land;
- args3 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args4 <- invert_bind_args idc4 Raw.ident.Literal;
- args5 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args6 <- invert_bind_args idc2 Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_land;
- args8 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_mul;
- match
- pattern.type.unify_extracted
- ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype
- (((projT1 args4) -> s5) -> s9 -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, (_, _))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype
- (((projT1 args4) -> s5) ->
- s9 -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args4);
- v <- type.try_make_transport_cps s5 ℤ;
- v0 <- type.try_make_transport_cps s9 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- is_bounded_by_bool
- (let (x12, _) := xv in x12)
- (ZRange.normalize args6) &&
- is_bounded_by_bool
- (let (x12, _) := xv0 in x12)
- (ZRange.normalize args0) &&
- ((let (x12, _) := xv in x12) =?
- 2
- ^ (2 *
- Z.log2_up
- (let (x12, _) := xv in x12) / 2) -
- 1) &&
- ((let (x12, _) := xv0 in x12) =?
- 2
- ^ (2 *
- Z.log2_up
- (let (x12, _) := xv in x12) / 2) -
- 1) &&
- (ZRange.normalize
- (ZRange.constant
- (let (x12, _) := xv in x12)) &'
- ZRange.normalize args5 <=?
- ZRange.normalize args8)%zrange &&
- (ZRange.normalize args1 &'
- ZRange.normalize
- (ZRange.constant
- (let (x12, _) := xv0 in x12)) <=?
- ZRange.normalize args3)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast range)%expr @
- (#(fancy_mulll
- (2 *
- Z.log2_up
- (let (x12, _) := xv in
- x12)))%expr @
- (#(Z_cast args5)%expr @
- ($(v (Compile.reflect x6)))%expr,
- #(Z_cast args1)%expr @
- ($(v0 (Compile.reflect x10)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Ident _ _ _ t8 idc8 @ ($_)%expr)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Abs _ _ _ _ _ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Ident _ _ _ t8 idc8 @ (_ @ _))))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.LetIn _ _ _ _ _
- _ _)))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ #(_)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ @expr.Abs _ _ _ _
- _ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ (($_)%expr @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Abs _ _ _ _ _ _ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ (_ @ _ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ @expr.LetIn _ _ _
- _ _ _ _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- ($_)%expr _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Abs _ _ _ _ _ _) _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (_ @ _) _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.LetIn _ _ _ _ _ _ _) _ @ _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ #(_) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ _ _ _ @
- _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ _ _ _ _
- _ @ _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (#(_) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ _ _
- _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x6 with
- | @expr.Ident _ _ _ t4 idc4 =>
- match x0 with
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9)))%expr_pat =>
- args <- invert_bind_args idc9 Raw.ident.Literal;
- args0 <- invert_bind_args idc8 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc7 Raw.ident.Z_cast;
- _ <- invert_bind_args idc6 Raw.ident.Z_land;
- args3 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args4 <- invert_bind_args idc4 Raw.ident.Literal;
- args5 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args6 <- invert_bind_args idc2 Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_land;
- args8 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_mul;
- match
- pattern.type.unify_extracted
- ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype
- ((s4 -> (projT1 args4)) -> s9 -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, (_, _))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype
- ((s4 -> (projT1 args4)) ->
- s9 -> (projT1 args))%ptype
- then
- v <- type.try_make_transport_cps s4 ℤ;
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args4);
- v0 <- type.try_make_transport_cps s9 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- is_bounded_by_bool
- (let (x12, _) := xv in x12)
- (ZRange.normalize args5) &&
- is_bounded_by_bool
- (let (x12, _) := xv0 in x12)
- (ZRange.normalize args0) &&
- ((let (x12, _) := xv in x12) =?
- 2
- ^ (2 *
- Z.log2_up
- (let (x12, _) := xv in x12) / 2) -
- 1) &&
- ((let (x12, _) := xv0 in x12) =?
- 2
- ^ (2 *
- Z.log2_up
- (let (x12, _) := xv in x12) / 2) -
- 1) &&
- (ZRange.normalize args6 &'
- ZRange.normalize
- (ZRange.constant
- (let (x12, _) := xv in x12)) <=?
- ZRange.normalize args8)%zrange &&
- (ZRange.normalize args1 &'
- ZRange.normalize
- (ZRange.constant
- (let (x12, _) := xv0 in x12)) <=?
- ZRange.normalize args3)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast range)%expr @
- (#(fancy_mulll
- (2 *
- Z.log2_up
- (let (x12, _) := xv in
- x12)))%expr @
- (#(Z_cast args6)%expr @
- ($(v (Compile.reflect x5)))%expr,
- #(Z_cast args1)%expr @
- ($(v0 (Compile.reflect x10)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Ident _ _ _ t8 idc8 @ ($_)%expr)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Abs _ _ _ _ _ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Ident _ _ _ t8 idc8 @ (_ @ _))))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.LetIn _ _ _ _ _
- _ _)))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ #(_)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ @expr.Abs _ _ _ _
- _ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ (($_)%expr @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Abs _ _ _ _ _ _ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ (_ @ _ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ @expr.LetIn _ _ _
- _ _ _ _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- ($_)%expr _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Abs _ _ _ _ _ _) _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (_ @ _) _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.LetIn _ _ _ _ _ _ _) _ @ _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ #(_) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ _ _ _ @
- _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ _ _ _ _
- _ @ _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (#(_) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ _ _
- _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x5 with
- | @expr.Ident _ _ _ t4 idc4 =>
- match x0 with
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9)))%expr_pat =>
- args <- invert_bind_args idc9 Raw.ident.Literal;
- args0 <- invert_bind_args idc8 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc7 Raw.ident.Z_cast;
- _ <- invert_bind_args idc6 Raw.ident.Z_shiftr;
- args3 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args4 <- invert_bind_args idc4 Raw.ident.Literal;
- args5 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args6 <- invert_bind_args idc2 Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_land;
- args8 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_mul;
- match
- pattern.type.unify_extracted
- ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype
- (((projT1 args4) -> s5) -> s9 -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, (_, _))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype
- (((projT1 args4) -> s5) ->
- s9 -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args4);
- v <- type.try_make_transport_cps s5 ℤ;
- v0 <- type.try_make_transport_cps s9 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- is_bounded_by_bool
- (let (x12, _) := xv in x12)
- (ZRange.normalize args6) &&
- is_bounded_by_bool
- (let (x12, _) := xv0 in x12)
- (ZRange.normalize args0) &&
- ((let (x12, _) := xv in x12) =?
- 2
- ^ (2 * (let (x12, _) := xv0 in x12) /
- 2) - 1) &&
- (ZRange.normalize
- (ZRange.constant
- (let (x12, _) := xv in x12)) &'
- ZRange.normalize args5 <=?
- ZRange.normalize args8)%zrange &&
- (ZRange.normalize args1 >>
- ZRange.normalize
- (ZRange.constant
- (let (x12, _) := xv0 in x12)) <=?
- ZRange.normalize args3)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast range)%expr @
- (#(fancy_mullh
- (2 *
- (let (x12, _) := xv0 in
- x12)))%expr @
- (#(Z_cast args5)%expr @
- ($(v (Compile.reflect x6)))%expr,
- #(Z_cast args1)%expr @
- ($(v0 (Compile.reflect x10)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Ident _ _ _ t8 idc8 @ ($_)%expr)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Abs _ _ _ _ _ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Ident _ _ _ t8 idc8 @ (_ @ _))))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.LetIn _ _ _ _ _
- _ _)))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ #(_)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ @expr.Abs _ _ _ _
- _ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ (($_)%expr @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Abs _ _ _ _ _ _ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ (_ @ _ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ @expr.LetIn _ _ _
- _ _ _ _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- ($_)%expr _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Abs _ _ _ _ _ _) _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (_ @ _) _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.LetIn _ _ _ _ _ _ _) _ @ _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ #(_) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ _ _ _ @
- _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ _ _ _ _
- _ @ _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (#(_) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ _ _
- _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x6 with
- | @expr.Ident _ _ _ t4 idc4 =>
- match x0 with
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9)))%expr_pat =>
- args <- invert_bind_args idc9 Raw.ident.Literal;
- args0 <- invert_bind_args idc8 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc7 Raw.ident.Z_cast;
- _ <- invert_bind_args idc6 Raw.ident.Z_shiftr;
- args3 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args4 <- invert_bind_args idc4 Raw.ident.Literal;
- args5 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args6 <- invert_bind_args idc2 Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_land;
- args8 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_mul;
- match
- pattern.type.unify_extracted
- ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype
- ((s4 -> (projT1 args4)) -> s9 -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, (_, _))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype
- ((s4 -> (projT1 args4)) ->
- s9 -> (projT1 args))%ptype
- then
- v <- type.try_make_transport_cps s4 ℤ;
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args4);
- v0 <- type.try_make_transport_cps s9 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- is_bounded_by_bool
- (let (x12, _) := xv in x12)
- (ZRange.normalize args5) &&
- is_bounded_by_bool
- (let (x12, _) := xv0 in x12)
- (ZRange.normalize args0) &&
- ((let (x12, _) := xv in x12) =?
- 2
- ^ (2 * (let (x12, _) := xv0 in x12) /
- 2) - 1) &&
- (ZRange.normalize args6 &'
- ZRange.normalize
- (ZRange.constant
- (let (x12, _) := xv in x12)) <=?
- ZRange.normalize args8)%zrange &&
- (ZRange.normalize args1 >>
- ZRange.normalize
- (ZRange.constant
- (let (x12, _) := xv0 in x12)) <=?
- ZRange.normalize args3)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast range)%expr @
- (#(fancy_mullh
- (2 *
- (let (x12, _) := xv0 in
- x12)))%expr @
- (#(Z_cast args6)%expr @
- ($(v (Compile.reflect x5)))%expr,
- #(Z_cast args1)%expr @
- ($(v0 (Compile.reflect x10)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Ident _ _ _ t8 idc8 @ ($_)%expr)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Abs _ _ _ _ _ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Ident _ _ _ t8 idc8 @ (_ @ _))))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.LetIn _ _ _ _ _
- _ _)))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ #(_)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ @expr.Abs _ _ _ _
- _ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ (($_)%expr @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.Abs _ _ _ _ _ _ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ (_ @ _ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t7 idc7) x10 @ @expr.LetIn _ _ _
- _ _ _ _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- ($_)%expr _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.Abs _ _ _ _ _ _) _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (_ @ _) _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s9 _
- (@expr.LetIn _ _ _ _ _ _ _) _ @ _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ #(_) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ _ _ _ @
- _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ _ _ _ _
- _ @ _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (#(_) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ _ _
- _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s5 _ ($_)%expr _ | @expr.App _ _ _ s5 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s5 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s5 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s4 _ ($_)%expr _ | @expr.App _ _ _ s4 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s4 _ (_ @ _)%expr_pat
- _ | @expr.App _ _ _ s4 _ (@expr.LetIn _ _ _ _ _ _ _) _ =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- match x4 with
- | @expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5 =>
- match x3 with
- | (@expr.Ident _ _ _ t3 idc3 @ @expr.Ident _ _ _ t4 idc4)%expr_pat =>
- match x0 with
- | (@expr.Ident _ _ _ t5 idc5 @ @expr.Ident _ _ _ t6 idc6)%expr_pat =>
- (args <- invert_bind_args idc6 Raw.ident.Literal;
- args0 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc4 Raw.ident.Literal;
- args2 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args3 <- invert_bind_args idc2 Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_shiftr;
- args5 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_mul;
- match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- ((s4 -> (projT1 args1)) -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype
- ((s4 -> (projT1 args1)) -> (projT1 args))%ptype
- then
- v <- type.try_make_transport_cps s4 ℤ;
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args1);
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- negb
- (option_beq Z.eqb
- (invert_low
- (2 * (let (x8, _) := xv in x8))
- (let (x8, _) := xv0 in x8))
- Datatypes.None) &&
- is_bounded_by_bool
- (let (x8, _) := xv0 in x8)
- (ZRange.normalize args0) &&
- is_bounded_by_bool
- (let (x8, _) := xv in x8)
- (ZRange.normalize args2) &&
- (ZRange.normalize args3 >>
- ZRange.normalize
- (ZRange.constant
- (let (x8, _) := xv in x8)) <=?
- ZRange.normalize args5)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast range)%expr @
- (#(fancy_mulhl
- (2 * (let (x8, _) := xv in x8)))%expr @
- (#(Z_cast args3)%expr @
- ($(v (Compile.reflect x5)))%expr,
- (##match
- invert_low
- (2 *
- (let (x8, _) := xv in x8))
- (let (x8, _) := xv0 in x8)
- with
- | Datatypes.Some y => y
- | Datatypes.None => 0
- end)%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;
- args <- invert_bind_args idc6 Raw.ident.Literal;
- args0 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc4 Raw.ident.Literal;
- args2 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args3 <- invert_bind_args idc2 Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_shiftr;
- args5 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_mul;
- match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- ((s4 -> (projT1 args1)) -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype
- ((s4 -> (projT1 args1)) -> (projT1 args))%ptype
- then
- v <- type.try_make_transport_cps s4 ℤ;
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args1);
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- negb
- (option_beq Z.eqb
- (invert_high
- (2 * (let (x8, _) := xv in x8))
- (let (x8, _) := xv0 in x8))
- Datatypes.None) &&
- is_bounded_by_bool
- (let (x8, _) := xv0 in x8)
- (ZRange.normalize args0) &&
- is_bounded_by_bool
- (let (x8, _) := xv in x8)
- (ZRange.normalize args2) &&
- (ZRange.normalize args3 >>
- ZRange.normalize
- (ZRange.constant
- (let (x8, _) := xv in x8)) <=?
- ZRange.normalize args5)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast range)%expr @
- (#(fancy_mulhh
- (2 * (let (x8, _) := xv in x8)))%expr @
- (#(Z_cast args3)%expr @
- ($(v (Compile.reflect x5)))%expr,
- (##match
- invert_high
- (2 *
- (let (x8, _) := xv in x8))
- (let (x8, _) := xv0 in x8)
- with
- | Datatypes.Some y => y
- | Datatypes.None => 0
- end)%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ x9 @ x8))%expr_pat =>
- match x9 with
- | @expr.App _ _ _ s9 _ (@expr.Ident _ _ _ t7 idc7)
- x10 =>
- match x10 with
- | @expr.Ident _ _ _ t8 idc8 =>
- match x8 with
- | @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t9 idc9) x11 =>
- args <- invert_bind_args idc9
- Raw.ident.Z_cast;
- args0 <- invert_bind_args idc8
- Raw.ident.Literal;
- args1 <- invert_bind_args idc7
- Raw.ident.Z_cast;
- _ <- invert_bind_args idc6 Raw.ident.Z_land;
- args3 <- invert_bind_args idc5
- Raw.ident.Z_cast;
- args4 <- invert_bind_args idc4
- Raw.ident.Literal;
- args5 <- invert_bind_args idc3
- Raw.ident.Z_cast;
- args6 <- invert_bind_args idc2
- Raw.ident.Z_cast;
- _ <- invert_bind_args idc1
- Raw.ident.Z_shiftr;
- args8 <- invert_bind_args idc0
- Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_mul;
- match
- pattern.type.unify_extracted
- ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype
- ((s4 -> (projT1 args4)) ->
- (projT1 args0) -> s10)%ptype
- with
- | Datatypes.Some (_, _, (_, _))%zrange =>
- if
- type.type_beq base.type
- base.type.type_beq
- ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype
- ((s4 -> (projT1 args4)) ->
- (projT1 args0) -> s10)%ptype
- then
- v <- type.try_make_transport_cps s4 ℤ;
- xv <- ident.unify
- pattern.ident.Literal
- ##(projT2 args4);
- xv0 <- ident.unify
- pattern.ident.Literal
- ##(projT2 args0);
- v0 <- type.try_make_transport_cps s10 ℤ;
- fv <- (if
- is_bounded_by_bool
- (let (x12, _) := xv0 in x12)
- (ZRange.normalize args1) &&
- is_bounded_by_bool
- (let (x12, _) := xv in x12)
- (ZRange.normalize args5) &&
- ((let (x12, _) := xv0 in x12) =?
- 2
- ^ (2 *
- (let (x12, _) := xv in x12) /
- 2) - 1) &&
- (ZRange.normalize args6 >>
- ZRange.normalize
- (ZRange.constant
- (let (x12, _) := xv in
- x12)) <=?
- ZRange.normalize args8)%zrange &&
- (ZRange.normalize
- (ZRange.constant
- (let (x12, _) := xv0 in
- x12)) &'
- ZRange.normalize args <=?
- ZRange.normalize args3)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota
- var) false
- (#(Z_cast range)%expr @
- (#(fancy_mulhl
- (2 *
- (let (x12, _) :=
- xv in
- x12)))%expr @
- (#(Z_cast args6)%expr @
- ($(v
- (Compile.reflect
- x5)))%expr,
- #(Z_cast args)%expr @
- ($(v0
- (Compile.reflect
- x11)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s10 _ ($_)%expr _ | @expr.App
- _ _ _ s10 _ (@expr.Abs _ _ _ _ _ _) _ |
- @expr.App _ _ _ s10 _ (_ @ _)%expr_pat _ |
- @expr.App _ _ _ s10 _
- (@expr.LetIn _ _ _ _ _ _ _) _ =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x8 with
- | (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9)%expr_pat =>
- args <- invert_bind_args idc9 Raw.ident.Literal;
- args0 <- invert_bind_args idc8 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc7 Raw.ident.Z_cast;
- _ <- invert_bind_args idc6 Raw.ident.Z_land;
- args3 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args4 <- invert_bind_args idc4
- Raw.ident.Literal;
- args5 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args6 <- invert_bind_args idc2 Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_shiftr;
- args8 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_mul;
- match
- pattern.type.unify_extracted
- ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype
- ((s4 -> (projT1 args4)) ->
- s9 -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, (_, _))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype
- ((s4 -> (projT1 args4)) ->
- s9 -> (projT1 args))%ptype
- then
- v <- type.try_make_transport_cps s4 ℤ;
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args4);
- v0 <- type.try_make_transport_cps s9 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- is_bounded_by_bool
- (let (x12, _) := xv0 in x12)
- (ZRange.normalize args0) &&
- is_bounded_by_bool
- (let (x12, _) := xv in x12)
- (ZRange.normalize args5) &&
- ((let (x12, _) := xv0 in x12) =?
- 2
- ^ (2 *
- (let (x12, _) := xv in x12) /
- 2) - 1) &&
- (ZRange.normalize args6 >>
- ZRange.normalize
- (ZRange.constant
- (let (x12, _) := xv in x12)) <=?
- ZRange.normalize args8)%zrange &&
- (ZRange.normalize args1 &'
- ZRange.normalize
- (ZRange.constant
- (let (x12, _) := xv0 in x12)) <=?
- ZRange.normalize args3)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota
- var) false
- (#(Z_cast range)%expr @
- (#(fancy_mulhl
- (2 *
- (let (x12, _) := xv in
- x12)))%expr @
- (#(Z_cast args6)%expr @
- ($(v (Compile.reflect x5)))%expr,
- #(Z_cast args1)%expr @
- ($(v0 (Compile.reflect x10)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t8 idc8 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Abs _ _ _ _ _
- _)%expr_pat |
- (@expr.Ident _ _ _ t8 idc8 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t8 idc8 @ @expr.LetIn _ _ _ _
- _ _ _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s9 _ ($_)%expr _ | @expr.App _ _ _ s9
- _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s9 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s9 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;
- match x9 with
- | @expr.App _ _ _ s9 _ (@expr.Ident _ _ _ t7 idc7)
- x10 =>
- match x8 with
- | (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9)%expr_pat =>
- args <- invert_bind_args idc9 Raw.ident.Literal;
- args0 <- invert_bind_args idc8 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc7 Raw.ident.Z_cast;
- _ <- invert_bind_args idc6 Raw.ident.Z_shiftr;
- args3 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args4 <- invert_bind_args idc4
- Raw.ident.Literal;
- args5 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args6 <- invert_bind_args idc2 Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_shiftr;
- args8 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_mul;
- match
- pattern.type.unify_extracted
- ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype
- ((s4 -> (projT1 args4)) ->
- s9 -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, (_, _))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype
- ((s4 -> (projT1 args4)) ->
- s9 -> (projT1 args))%ptype
- then
- v <- type.try_make_transport_cps s4 ℤ;
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args4);
- v0 <- type.try_make_transport_cps s9 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- is_bounded_by_bool
- (let (x12, _) := xv in x12)
- (ZRange.normalize args5) &&
- is_bounded_by_bool
- (let (x12, _) := xv0 in x12)
- (ZRange.normalize args0) &&
- ((let (x12, _) := xv in x12) =?
- (let (x12, _) := xv0 in x12)) &&
- (ZRange.normalize args6 >>
- ZRange.normalize
- (ZRange.constant
- (let (x12, _) := xv in x12)) <=?
- ZRange.normalize args8)%zrange &&
- (ZRange.normalize args1 >>
- ZRange.normalize
- (ZRange.constant
- (let (x12, _) := xv0 in x12)) <=?
- ZRange.normalize args3)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota
- var) false
- (#(Z_cast range)%expr @
- (#(fancy_mulhh
- (2 *
- (let (x12, _) := xv in
- x12)))%expr @
- (#(Z_cast args6)%expr @
- ($(v (Compile.reflect x5)))%expr,
- #(Z_cast args1)%expr @
- ($(v0 (Compile.reflect x10)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t8 idc8 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Abs _ _ _ _ _
- _)%expr_pat |
- (@expr.Ident _ _ _ t8 idc8 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t8 idc8 @ @expr.LetIn _ _ _ _
- _ _ _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s9 _ ($_)%expr _ | @expr.App _ _ _ s9
- _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s9 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s9 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (#(_) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | (@expr.Ident _ _ _ t3 idc3 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s4 _ ($_)%expr _ | @expr.App _ _ _ s4 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s4 _ (_ @ _)%expr_pat
- _ | @expr.App _ _ _ s4 _ (@expr.LetIn _ _ _ _ _ _ _) _ =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ ($_)%expr)%expr_pat) _ | @expr.App _ _
- _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Abs _ _ _ _ _ _)%expr_pat) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ (#(_) @ _))%expr_pat) _ | @expr.App _ _
- _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ (($_)%expr @ _))%expr_pat) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat)
- _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ (($_)%expr @ _ @ _))%expr_pat) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat)
- _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ (_ @ _ @ _ @ _))%expr_pat) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat)
- _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat)
- _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Ident _ _ _ t0 idc0 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat)
- _ => Datatypes.None
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) #(_)%expr_pat) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) ($_)%expr) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Abs _ _ _ _ _ _)) _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (($_)%expr @ _)%expr_pat) _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.Abs _ _ _ _ _ _ @ _)%expr_pat) _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) (_ @ _ @ _)%expr_pat)
- _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.LetIn _ _ _ _ _ _ _ @ _)%expr_pat) _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc)
- (@expr.LetIn _ _ _ _ _ _ _)) _ => Datatypes.None
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _ (@expr.Ident _ _ _ t idc) x2) x1) x0 =>
- match x2 with
- | (@expr.Ident _ _ _ t0 idc0 @
- (@expr.Ident _ _ _ t1 idc1 @ x5 @ x4))%expr_pat =>
- match x5 with
- | (@expr.Ident _ _ _ t2 idc2 @ @expr.Ident _ _ _ t3 idc3)%expr_pat =>
- match x4 with
- | @expr.App _ _ _ s6 _ (@expr.Ident _ _ _ t4 idc4) x7 =>
- match x1 with
- | @expr.App _ _ _ s7 _ (@expr.Ident _ _ _ t5 idc5)
- x8 =>
- match x0 with
- | @expr.App _ _ _ s8 _ (@expr.Ident _ _ _ t6 idc6)
- x9 =>
- args <- invert_bind_args idc6 Raw.ident.Z_cast;
- args0 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc4 Raw.ident.Z_cast;
- args2 <- invert_bind_args idc3
- Raw.ident.Literal;
- args3 <- invert_bind_args idc2 Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_cc_m;
- args5 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_zselect;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- ((((projT1 args2) -> s6) -> s7) -> s8)%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- ((((projT1 args2) -> s6) -> s7) -> s8)%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args2);
- v <- type.try_make_transport_cps s6 ℤ;
- v0 <- type.try_make_transport_cps s7 ℤ;
- v1 <- type.try_make_transport_cps s8 ℤ;
- fv <- (if
- is_bounded_by_bool
- (let (x10, _) := xv in x10)
- (ZRange.normalize args3) &&
- ((let (x10, _) := xv in x10) =?
- 2
- ^ Z.log2
- (let (x10, _) := xv in x10)) &&
- ((ZRange.cc_m
- (let (x10, _) := xv in x10))
- (ZRange.normalize args1) <=?
- ZRange.normalize args5)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota
- var) false
- (#(Z_cast range)%expr @
- (#(fancy_selm
- (Z.log2
- (let (x10, _) :=
- xv in
- x10)))%expr @
- (#(Z_cast args1)%expr @
- ($(v (Compile.reflect x7)))%expr,
- #(Z_cast args0)%expr @
- ($(v0 (Compile.reflect x8)))%expr,
- #(Z_cast args)%expr @
- ($(v1 (Compile.reflect x9)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s8 _ ($_)%expr _ | @expr.App _ _
- _ s8 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _
- _ s8 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s8 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s7 _ ($_)%expr _ | @expr.App _ _ _ s7
- _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s7 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s7 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s6 _ ($_)%expr _ | @expr.App _ _ _ s6 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s6 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s6 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | (@expr.Ident _ _ _ t2 idc2 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t2 idc2 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- match x5 with
- | @expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t2 idc2) x6 =>
- match x6 with
- | @expr.Ident _ _ _ t3 idc3 =>
- match x4 with
- | @expr.App _ _ _ s6 _ (@expr.Ident _ _ _ t4 idc4)
- x7 =>
- match x1 with
- | @expr.App _ _ _ s7 _ (@expr.Ident _ _ _ t5 idc5)
- x8 =>
- match x0 with
- | @expr.App _ _ _ s8 _
- (@expr.Ident _ _ _ t6 idc6) x9 =>
- args <- invert_bind_args idc6
- Raw.ident.Z_cast;
- args0 <- invert_bind_args idc5
- Raw.ident.Z_cast;
- args1 <- invert_bind_args idc4
- Raw.ident.Z_cast;
- args2 <- invert_bind_args idc3
- Raw.ident.Literal;
- args3 <- invert_bind_args idc2
- Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_land;
- args5 <- invert_bind_args idc0
- Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_zselect;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- ((((projT1 args2) -> s6) -> s7) -> s8)%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type
- base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- ((((projT1 args2) -> s6) -> s7) ->
- s8)%ptype
- then
- xv <- ident.unify
- pattern.ident.Literal
- ##(projT2 args2);
- v <- type.try_make_transport_cps s6 ℤ;
- v0 <- type.try_make_transport_cps s7 ℤ;
- v1 <- type.try_make_transport_cps s8 ℤ;
- fv <- (if
- is_bounded_by_bool 1
- (ZRange.normalize args3) &&
- (ZRange.normalize
- (ZRange.constant 1) &'
- ZRange.normalize args1 <=?
- ZRange.normalize args5)%zrange &&
- ((let (x10, _) := xv in x10) =?
- 1)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota
- var) false
- (#(Z_cast range)%expr @
- (#(fancy_sell)%expr @
- (#(Z_cast args1)%expr @
- ($(v
- (Compile.reflect
- x7)))%expr,
- #(Z_cast args0)%expr @
- ($(v0
- (Compile.reflect
- x8)))%expr,
- #(Z_cast args)%expr @
- ($(v1
- (Compile.reflect
- x9)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s8 _ ($_)%expr _ | @expr.App
- _ _ _ s8 _ (@expr.Abs _ _ _ _ _ _) _ |
- @expr.App _ _ _ s8 _ (_ @ _)%expr_pat _ |
- @expr.App _ _ _ s8 _
- (@expr.LetIn _ _ _ _ _ _ _) _ =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s7 _ ($_)%expr _ | @expr.App _ _
- _ s7 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _
- _ s7 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s7 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s6 _ ($_)%expr _ | @expr.App _ _ _ s6
- _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s6 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s6 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- match x4 with
- | (@expr.Ident _ _ _ t3 idc3 @ @expr.Ident _ _ _ t4 idc4)%expr_pat =>
- match x1 with
- | @expr.App _ _ _ s7 _ (@expr.Ident _ _ _ t5 idc5)
- x8 =>
- match x0 with
- | @expr.App _ _ _ s8 _ (@expr.Ident _ _ _ t6 idc6)
- x9 =>
- args <- invert_bind_args idc6 Raw.ident.Z_cast;
- args0 <- invert_bind_args idc5 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc4
- Raw.ident.Literal;
- args2 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args3 <- invert_bind_args idc2 Raw.ident.Z_cast;
- _ <- invert_bind_args idc1 Raw.ident.Z_land;
- args5 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_zselect;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s5 -> (projT1 args1)) -> s7) -> s8)%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((s5 -> (projT1 args1)) -> s7) -> s8)%ptype
- then
- v <- type.try_make_transport_cps s5 ℤ;
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args1);
- v0 <- type.try_make_transport_cps s7 ℤ;
- v1 <- type.try_make_transport_cps s8 ℤ;
- fv <- (if
- is_bounded_by_bool 1
- (ZRange.normalize args2) &&
- (ZRange.normalize args3 &'
- ZRange.normalize
- (ZRange.constant 1) <=?
- ZRange.normalize args5)%zrange &&
- ((let (x10, _) := xv in x10) =? 1)
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota
- var) false
- (#(Z_cast range)%expr @
- (#(fancy_sell)%expr @
- (#(Z_cast args3)%expr @
- ($(v (Compile.reflect x6)))%expr,
- #(Z_cast args0)%expr @
- ($(v0 (Compile.reflect x8)))%expr,
- #(Z_cast args)%expr @
- ($(v1 (Compile.reflect x9)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s8 _ ($_)%expr _ | @expr.App _ _
- _ s8 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _
- _ s8 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s8 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s7 _ ($_)%expr _ | @expr.App _ _ _ s7
- _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s7 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s7 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | (@expr.Ident _ _ _ t3 idc3 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t3 idc3 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s5 _ ($_)%expr _ | @expr.App _ _ _ s5 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s5 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s5 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | (@expr.Ident _ _ _ t0 idc0 @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (#(_) @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (($_)%expr @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (_ @ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- _ <- invert_bind_args idc Raw.ident.Z_zselect;
- match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- ((s1 -> s0) -> s)%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype ((s1 -> s0) -> s)%ptype
- then
- v <- type.try_make_transport_cps s1 ℤ;
- v0 <- type.try_make_transport_cps s0 ℤ;
- v1 <- type.try_make_transport_cps s ℤ;
- Datatypes.Some
- (fv <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (#(Z_cast range)%expr @
- (#(fancy_selc)%expr @
- (($(v (Compile.reflect x2)))%expr,
- ($(v0 (Compile.reflect x1)))%expr,
- ($(v1 (Compile.reflect x0)))%expr)))%expr_pat;
- Base fv)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5))
- (@expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t3 idc3) x6))
- (@expr.Ident _ _ _ t4 idc4 @ @expr.Ident _ _ _ t5 idc5)%expr_pat =>
- args <- invert_bind_args idc5 Raw.ident.Literal;
- args0 <- invert_bind_args idc4 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args2 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args3 <- invert_bind_args idc1 Raw.ident.Literal;
- args4 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_rshi;
- match
- pattern.type.unify_extracted (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- ((((projT1 args3) -> s4) -> s5) -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- ((((projT1 args3) -> s4) -> s5) -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args3);
- v <- type.try_make_transport_cps s4 ℤ;
- v0 <- type.try_make_transport_cps s5 ℤ;
- xv0 <- ident.unify pattern.ident.Literal ##(projT2 args);
- fv <- (if
- is_bounded_by_bool (let (x8, _) := xv in x8)
- (ZRange.normalize args4) &&
- is_bounded_by_bool (let (x8, _) := xv0 in x8)
- (ZRange.normalize args0) &&
- ((let (x8, _) := xv in x8) =?
- 2 ^ Z.log2 (let (x8, _) := xv in x8))
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (#(Z_cast range)%expr @
- (#(fancy_rshi (Z.log2 (let (x8, _) := xv in x8))
- (let (x8, _) := xv0 in x8))%expr @
- (#(Z_cast args2)%expr @
- ($(v (Compile.reflect x5)))%expr,
- #(Z_cast args1)%expr @
- ($(v0 (Compile.reflect x6)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5))
- (@expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t3 idc3) x6))
- (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr)%expr_pat | @expr.App _ _ _ s
- _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5))
- (@expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t3 idc3) x6))
- (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5))
- (@expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t3 idc3) x6))
- (@expr.Ident _ _ _ t4 idc4 @ (_ @ _))%expr_pat | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5))
- (@expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t3 idc3) x6))
- (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5))
- (@expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t3 idc3) x6))
- #(_)%expr_pat | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5))
- (@expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t3 idc3) x6)) ($_)%expr |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5))
- (@expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t3 idc3) x6))
- (@expr.Abs _ _ _ _ _ _) | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5))
- (@expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t3 idc3) x6))
- (($_)%expr @ _)%expr_pat | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5))
- (@expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t3 idc3) x6))
- (@expr.Abs _ _ _ _ _ _ @ _)%expr_pat | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5))
- (@expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t3 idc3) x6))
- (_ @ _ @ _)%expr_pat | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5))
- (@expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t3 idc3) x6))
- (@expr.LetIn _ _ _ _ _ _ _ @ _)%expr_pat | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5))
- (@expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t3 idc3) x6))
- (@expr.LetIn _ _ _ _ _ _ _) => Datatypes.None
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5))
- (@expr.App _ _ _ s5 _ ($_)%expr _)) _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5))
- (@expr.App _ _ _ s5 _ (@expr.Abs _ _ _ _ _ _) _)) _ | @expr.App _ _
- _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5))
- (@expr.App _ _ _ s5 _ (_ @ _)%expr_pat _)) _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5))
- (@expr.App _ _ _ s5 _ (@expr.LetIn _ _ _ _ _ _ _) _)) _ =>
- Datatypes.None
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5))
- #(_)%expr_pat) _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5)) ($_)%expr)
- _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5))
- (@expr.Abs _ _ _ _ _ _)) _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5))
- (@expr.LetIn _ _ _ _ _ _ _)) _ => Datatypes.None
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ ($_)%expr _)) _) _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.Abs _ _ _ _ _ _) _)) _) _ | @expr.App
- _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (_ @ _)%expr_pat _)) _) _ | @expr.App _ _ _ s
- _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.App _ _ _ s4 _ (@expr.LetIn _ _ _ _ _ _ _) _)) _) _ =>
- Datatypes.None
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- #(_)%expr_pat) _) _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- ($_)%expr) _) _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.Abs _ _ _ _ _ _)) _) _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1))%expr_pat
- (@expr.LetIn _ _ _ _ _ _ _)) _) _ => Datatypes.None
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @ (@expr.Ident _ _ _ t0 idc0 @ ($_)%expr))%expr_pat
- _) _) _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Abs _ _ _ _ _ _))%expr_pat _)
- _) _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @ (@expr.Ident _ _ _ t0 idc0 @ (_ @ _)))%expr_pat
- _) _) _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @
- (@expr.Ident _ _ _ t0 idc0 @ @expr.LetIn _ _ _ _ _ _ _))%expr_pat
- _) _) _ => Datatypes.None
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _ (@expr.Ident _ _ _ t idc @ #(_))%expr_pat _)
- _) _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _ (@expr.Ident _ _ _ t idc @ ($_)%expr)%expr_pat
- _) _) _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @ @expr.Abs _ _ _ _ _ _)%expr_pat _) _)
- _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @ (($_)%expr @ _))%expr_pat _) _) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat _)
- _) _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @ (_ @ _ @ _))%expr_pat _) _) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @ (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat
- _) _) _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _
- (@expr.Ident _ _ _ t idc @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat _)
- _) _ => Datatypes.None
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.App _ _ _ s1 _ ($_)%expr _) _) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _ (@expr.Abs _ _ _ _ _ _) _) _) _ | @expr.App _
- _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _ (($_)%expr @ _)%expr_pat _) _) _ | @expr.App _
- _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _ (@expr.Abs _ _ _ _ _ _ @ _)%expr_pat _) _) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.App _ _ _ s1 _ (_ @ _ @ _)%expr_pat _)
- _) _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _ (@expr.LetIn _ _ _ _ _ _ _ @ _)%expr_pat _) _)
- _ | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _
- (@expr.App _ _ _ s1 _ (@expr.LetIn _ _ _ _ _ _ _) _) _) _ =>
- Datatypes.None
- | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ ($_)%expr _) _ | @expr.App
- _ _ _ s _ (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _) _ =>
- Datatypes.None
- | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr
- _ | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s
- _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;
- match pattern.type.unify_extracted ℤ ℤ with
- | Datatypes.Some _ =>
- if type.type_beq base.type base.type.type_beq ℤ ℤ
- then
- fv <- (if
- (range <=? value_range)%zrange
- || (range <=? flag_range)%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (#(Z_cast range)%expr @ ($x)%expr)%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;;
- Base (#(Z_cast range)%expr @ x)%expr_pat)%option
-| Z_cast2 range =>
- fun x : expr (ℤ * ℤ)%etype =>
- ((match x with
- | (@expr.Ident _ _ _ t idc @ x2 @ x1 @ x0)%expr_pat =>
- match x2 with
- | (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat =>
- match x1 with
- | @expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t2 idc2) x4 =>
- match x0 with
- | @expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t3 idc3) x5 =>
- match x5 with
- | (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @
- (@expr.Ident _ _ _ t10 idc10 @ @expr.Ident _ _ _ t11
- idc11))%expr_pat =>
- (args <- invert_bind_args idc11 Raw.ident.Literal;
- args0 <- invert_bind_args idc10 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc9 Raw.ident.Literal;
- args2 <- invert_bind_args idc8 Raw.ident.Z_cast;
- args3 <- invert_bind_args idc7 Raw.ident.Z_cast;
- _ <- invert_bind_args idc6 Raw.ident.Z_land;
- args5 <- invert_bind_args idc5 Raw.ident.Z_cast;
- _ <- invert_bind_args idc4 Raw.ident.Z_shiftl;
- args7 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args8 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args9 <- invert_bind_args idc1 Raw.ident.Literal;
- args10 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_add_get_carry;
- match
- pattern.type.unify_extracted
- ((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args9) -> s3) ->
- (s10 -> (projT1 args1)) -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, (_, _, _))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args9) -> s3) ->
- (s10 -> (projT1 args1)) -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args9);
- v <- type.try_make_transport_cps s3 ℤ;
- v0 <- type.try_make_transport_cps s10 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args1);
- xv1 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- ((let (x14, _) := xv in x14) =?
- 2
- ^ Z.log2 (let (x14, _) := xv in x14)) &&
- is_bounded_by_bool
- (let (x14, _) := xv in x14)
- (ZRange.normalize args10) &&
- is_bounded_by_bool
- (let (x14, _) := xv1 in x14)
- (ZRange.normalize args0) &&
- is_bounded_by_bool
- (let (x14, _) := xv0 in x14)
- (ZRange.normalize args2) &&
- (ZRange.normalize args5 <<
- ZRange.normalize
- (ZRange.constant
- (let (x14, _) := xv1 in x14)) <=?
- ZRange.normalize args7)%zrange &&
- (ZRange.normalize args3 &'
- ZRange.normalize
- (ZRange.constant
- (let (x14, _) := xv0 in x14)) <=?
- ZRange.normalize args5)%zrange &&
- (ZRange.normalize args7 <=?
- r[0 ~> (let (x14, _) := xv in x14) -
- 1])%zrange &&
- ((let (x14, _) := xv0 in x14) =?
- Z.ones
- (Z.log2
- (let (x14, _) := xv in x14) -
- (let (x14, _) := xv1 in x14))) &&
- ((0 <=? (let (x14, _) := xv1 in x14)) &&
- ((let (x14, _) := xv1 in x14) <=?
- Z.log2 (let (x14, _) := xv in x14)))
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast2 range)%expr @
- (#(fancy_add
- (Z.log2
- (let (x14, _) := xv in
- x14))
- (let (x14, _) := xv1 in
- x14))%expr @
- (#(Z_cast args8)%expr @
- ($(v (Compile.reflect x4)))%expr,
- #(Z_cast args3)%expr @
- ($(v0 (Compile.reflect x11)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;
- args <- invert_bind_args idc11 Raw.ident.Literal;
- args0 <- invert_bind_args idc10 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc9 Raw.ident.Literal;
- args2 <- invert_bind_args idc8 Raw.ident.Z_cast;
- args3 <- invert_bind_args idc7 Raw.ident.Z_cast;
- _ <- invert_bind_args idc6 Raw.ident.Z_land;
- args5 <- invert_bind_args idc5 Raw.ident.Z_cast;
- _ <- invert_bind_args idc4 Raw.ident.Z_shiftl;
- args7 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args8 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args9 <- invert_bind_args idc1 Raw.ident.Literal;
- args10 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_add_get_carry;
- match
- pattern.type.unify_extracted
- ((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args9) -> s3) ->
- (s10 -> (projT1 args1)) -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, (_, _, _))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args9) -> s3) ->
- (s10 -> (projT1 args1)) -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args9);
- v <- type.try_make_transport_cps s3 ℤ;
- v0 <- type.try_make_transport_cps s10 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args1);
- xv1 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- ((let (x14, _) := xv in x14) =?
- 2
- ^ Z.log2 (let (x14, _) := xv in x14)) &&
- ((let (x14, _) := xv0 in x14) =?
- Z.ones
- (Z.log2 (let (x14, _) := xv in x14) -
- (let (x14, _) := xv1 in x14))) &&
- ((0 <=? (let (x14, _) := xv1 in x14)) &&
- ((let (x14, _) := xv1 in x14) <=?
- Z.log2 (let (x14, _) := xv in x14))) &&
- is_bounded_by_bool
- (let (x14, _) := xv in x14)
- (ZRange.normalize args10) &&
- is_bounded_by_bool
- (let (x14, _) := xv0 in x14)
- (ZRange.normalize args2) &&
- is_bounded_by_bool
- (let (x14, _) := xv1 in x14)
- (ZRange.normalize args0) &&
- (ZRange.normalize args5 <<
- ZRange.normalize
- (ZRange.constant
- (let (x14, _) := xv1 in x14)) <=?
- ZRange.normalize args7)%zrange &&
- (ZRange.normalize args3 &'
- ZRange.normalize
- (ZRange.constant
- (let (x14, _) := xv0 in x14)) <=?
- ZRange.normalize args5)%zrange &&
- (ZRange.normalize args7 <=?
- r[0 ~> (let (x14, _) := xv in x14) -
- 1])%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast2 range)%expr @
- (#(fancy_add
- (Z.log2
- (let (x14, _) := xv in
- x14))
- (let (x14, _) := xv1 in x14))%expr @
- (#(Z_cast args8)%expr @
- ($(v (Compile.reflect x4)))%expr,
- #(Z_cast args3)%expr @
- ($(v0 (Compile.reflect x11)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @
- (@expr.Ident _ _ _ t10 idc10 @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @
- (@expr.Ident _ _ _ t10 idc10 @ @expr.Abs _ _ _ _ _ _))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @ (@expr.Ident _ _ _ t10 idc10 @ (_ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @
- (@expr.Ident _ _ _ t10 idc10 @ @expr.LetIn _ _ _ _ _
- _ _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @ (_ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @ (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ ($_)%expr))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Abs _ _ _ _ _ _))) @
- _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ (_ @ _)))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.LetIn _ _ _ _ _
- _ _))) @ _)%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @ #(_))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @ ($_)%expr)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @ @expr.Abs _ _ _
- _ _ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @ (($_)%expr @ _))) @
- _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Abs _ _ _ _ _ _ @ _))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @ (_ @ _ @ _))) @
- _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @ @expr.LetIn _ _
- _ _ _ _ _)) @ _)%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- ($_)%expr _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Abs _ _ _ _ _ _) _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (_ @ _) _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.LetIn _ _ _ _ _ _ _) _ @ _)) @ _)%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ #(_) @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ _ _ _ @
- _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ _ _ _
- _ _ @ _)) @ _)%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @ #(_)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ _) @
- _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @ (#(_) @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Abs _ _ _ _ _ _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _ @ _)) @
- _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Abs _ _ _ _ _ _ @ _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ _ _
- _) @ _)%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t4 idc4 @ #(_) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ _ @
- _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Abs _ _ _ _ _ _ @ _) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ (_ @ _ @ _) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ _ _
- _ @ _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end;;
- match x4 with
- | (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @
- (@expr.Ident _ _ _ t10 idc10 @ @expr.Ident _ _ _ t11
- idc11))%expr_pat =>
- args <- invert_bind_args idc11 Raw.ident.Literal;
- args0 <- invert_bind_args idc10 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc9 Raw.ident.Literal;
- args2 <- invert_bind_args idc8 Raw.ident.Z_cast;
- args3 <- invert_bind_args idc7 Raw.ident.Z_cast;
- _ <- invert_bind_args idc6 Raw.ident.Z_land;
- args5 <- invert_bind_args idc5 Raw.ident.Z_cast;
- _ <- invert_bind_args idc4 Raw.ident.Z_shiftl;
- args7 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args8 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args9 <- invert_bind_args idc1 Raw.ident.Literal;
- args10 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_add_get_carry;
- match
- pattern.type.unify_extracted
- ((ℤ -> (ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((projT1 args9) ->
- (s10 -> (projT1 args1)) -> (projT1 args)) ->
- s4)%ptype
- with
- | Datatypes.Some (_, (_, _, _), _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> (ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- (((projT1 args9) ->
- (s10 -> (projT1 args1)) -> (projT1 args)) ->
- s4)%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args9);
- v <- type.try_make_transport_cps s10 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args1);
- xv1 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- v0 <- type.try_make_transport_cps s4 ℤ;
- fv <- (if
- is_bounded_by_bool
- (let (x14, _) := xv in x14)
- (ZRange.normalize args10) &&
- is_bounded_by_bool
- (let (x14, _) := xv0 in x14)
- (ZRange.normalize args2) &&
- is_bounded_by_bool
- (let (x14, _) := xv1 in x14)
- (ZRange.normalize args0) &&
- ((let (x14, _) := xv in x14) =?
- 2
- ^ Z.log2 (let (x14, _) := xv in x14)) &&
- (ZRange.normalize args5 <<
- ZRange.normalize
- (ZRange.constant
- (let (x14, _) := xv1 in x14)) <=?
- ZRange.normalize args8)%zrange &&
- (ZRange.normalize args3 &'
- ZRange.normalize
- (ZRange.constant
- (let (x14, _) := xv0 in x14)) <=?
- ZRange.normalize args5)%zrange &&
- (ZRange.normalize args8 <=?
- r[0 ~> (let (x14, _) := xv in x14) -
- 1])%zrange &&
- ((let (x14, _) := xv0 in x14) =?
- Z.ones
- (Z.log2 (let (x14, _) := xv in x14) -
- (let (x14, _) := xv1 in x14))) &&
- ((0 <=? (let (x14, _) := xv1 in x14)) &&
- ((let (x14, _) := xv1 in x14) <=?
- Z.log2 (let (x14, _) := xv in x14)))
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast2 range)%expr @
- (#(fancy_add
- (Z.log2
- (let (x14, _) := xv in
- x14))
- (let (x14, _) := xv1 in x14))%expr @
- (#(Z_cast args7)%expr @
- ($(v0 (Compile.reflect x5)))%expr,
- #(Z_cast args3)%expr @
- ($(v (Compile.reflect x11)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @
- (@expr.Ident _ _ _ t10 idc10 @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @
- (@expr.Ident _ _ _ t10 idc10 @ @expr.Abs _ _ _ _ _ _))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @ (@expr.Ident _ _ _ t10 idc10 @ (_ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @
- (@expr.Ident _ _ _ t10 idc10 @ @expr.LetIn _ _ _ _ _
- _ _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @ (_ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @ (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _ t9
- idc9))) @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ ($_)%expr))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Abs _ _ _ _ _ _))) @
- _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ (_ @ _)))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.LetIn _ _ _ _ _
- _ _))) @ _)%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @ #(_))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @ ($_)%expr)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @ @expr.Abs _ _ _
- _ _ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @ (($_)%expr @ _))) @
- _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Abs _ _ _ _ _ _ @ _))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @ (_ @ _ @ _))) @
- _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Ident _ _ _ t7 idc7) x11 @ @expr.LetIn _ _
- _ _ _ _ _)) @ _)%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- ($_)%expr _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.Abs _ _ _ _ _ _) _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (_ @ _) _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10 _
- (@expr.LetIn _ _ _ _ _ _ _) _ @ _)) @ _)%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ #(_) @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ _ _ _ @
- _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ _ _ _
- _ _ @ _)) @ _)%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @ #(_)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ _) @
- _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @ (#(_) @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Abs _ _ _ _ _ _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _ @ _)) @
- _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Abs _ _ _ _ _ _ @ _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ _ _
- _) @ _)%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t4 idc4 @ #(_) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ _ @
- _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.Abs _ _ _ _ _ _ @ _) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ (_ @ _ @ _) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ _ _
- _ @ _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end;;
- match x5 with
- | (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.Ident _ _ _ t7
- idc7))%expr_pat =>
- args <- invert_bind_args idc7 Raw.ident.Literal;
- args0 <- invert_bind_args idc6 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc5 Raw.ident.Z_cast;
- _ <- invert_bind_args idc4 Raw.ident.Z_shiftr;
- args3 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args4 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args5 <- invert_bind_args idc1 Raw.ident.Literal;
- args6 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_add_get_carry;
- match
- pattern.type.unify_extracted
- ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype
- (((projT1 args5) -> s3) -> s7 -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, (_, _))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype
- (((projT1 args5) -> s3) ->
- s7 -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args5);
- v <- type.try_make_transport_cps s3 ℤ;
- v0 <- type.try_make_transport_cps s7 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- is_bounded_by_bool
- (let (x10, _) := xv in x10)
- (ZRange.normalize args6) &&
- is_bounded_by_bool
- (let (x10, _) := xv0 in x10)
- (ZRange.normalize args0) &&
- ((let (x10, _) := xv in x10) =?
- 2
- ^ Z.log2 (let (x10, _) := xv in x10)) &&
- (ZRange.normalize args1 >>
- ZRange.normalize
- (ZRange.constant
- (let (x10, _) := xv0 in x10)) <=?
- ZRange.normalize args3)%zrange &&
- (ZRange.normalize args3 <=?
- r[0 ~> (let (x10, _) := xv in x10) -
- 1])%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast2 range)%expr @
- (#(fancy_add
- (Z.log2
- (let (x10, _) := xv in
- x10))
- (-
- (let (x10, _) := xv0 in
- x10)))%expr @
- (#(Z_cast args4)%expr @
- ($(v (Compile.reflect x4)))%expr,
- #(Z_cast args1)%expr @
- ($(v0 (Compile.reflect x8)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @
- (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ _ _ _))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @
- (@expr.Ident _ _ _ t6 idc6 @ (_ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ _ _ _ _
- _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @ @expr.Abs _ _ _ _ _
- _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @
- (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @ (_ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @ @expr.LetIn _ _ _ _
- _ _ _)%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- ($_)%expr _ @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (_ @ _) _ @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t4 idc4 @ #(_) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ _ @
- _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ _ _
- _ @ _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end;;
- match x4 with
- | (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.Ident _ _ _ t7
- idc7))%expr_pat =>
- args <- invert_bind_args idc7 Raw.ident.Literal;
- args0 <- invert_bind_args idc6 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc5 Raw.ident.Z_cast;
- _ <- invert_bind_args idc4 Raw.ident.Z_shiftr;
- args3 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args4 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args5 <- invert_bind_args idc1 Raw.ident.Literal;
- args6 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_add_get_carry;
- match
- pattern.type.unify_extracted
- ((ℤ -> ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args5) -> s7 -> (projT1 args)) -> s4)%ptype
- with
- | Datatypes.Some (_, (_, _), _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args5) -> s7 -> (projT1 args)) ->
- s4)%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args5);
- v <- type.try_make_transport_cps s7 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- v0 <- type.try_make_transport_cps s4 ℤ;
- fv <- (if
- is_bounded_by_bool
- (let (x10, _) := xv in x10)
- (ZRange.normalize args6) &&
- is_bounded_by_bool
- (let (x10, _) := xv0 in x10)
- (ZRange.normalize args0) &&
- ((let (x10, _) := xv in x10) =?
- 2
- ^ Z.log2 (let (x10, _) := xv in x10)) &&
- (ZRange.normalize args1 >>
- ZRange.normalize
- (ZRange.constant
- (let (x10, _) := xv0 in x10)) <=?
- ZRange.normalize args4)%zrange &&
- (ZRange.normalize args4 <=?
- r[0 ~> (let (x10, _) := xv in x10) -
- 1])%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast2 range)%expr @
- (#(fancy_add
- (Z.log2
- (let (x10, _) := xv in
- x10))
- (-
- (let (x10, _) := xv0 in
- x10)))%expr @
- (#(Z_cast args3)%expr @
- ($(v0 (Compile.reflect x5)))%expr,
- #(Z_cast args1)%expr @
- ($(v (Compile.reflect x8)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @
- (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ _ _ _))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @
- (@expr.Ident _ _ _ t6 idc6 @ (_ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ _ _ _ _
- _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @ @expr.Abs _ _ _ _ _
- _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @
- (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @ (_ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Ident _ _ _ t5 idc5) x8 @ @expr.LetIn _ _ _ _
- _ _ _)%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- ($_)%expr _ @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (_ @ _) _ @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _
- (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t4 idc4 @ #(_) @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr @ _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ _ @
- _)%expr_pat |
- (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ _ _
- _ @ _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end;;
- args <- invert_bind_args idc3 Raw.ident.Z_cast;
- args0 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc1 Raw.ident.Literal;
- args2 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_add_get_carry;
- match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args1) -> s3) -> s4)%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args1) -> s3) -> s4)%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args1);
- v <- type.try_make_transport_cps s3 ℤ;
- v0 <- type.try_make_transport_cps s4 ℤ;
- fv <- (if
- is_bounded_by_bool
- (let (x6, _) := xv in x6)
- (ZRange.normalize args2) &&
- ((let (x6, _) := xv in x6) =?
- 2 ^ Z.log2 (let (x6, _) := xv in x6)) &&
- (ZRange.normalize args <=?
- r[0 ~> (let (x6, _) := xv in x6) - 1])%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast2 range)%expr @
- (#(fancy_add
- (Z.log2
- (let (x6, _) := xv in x6)) 0)%expr @
- (#(Z_cast args0)%expr @
- ($(v (Compile.reflect x4)))%expr,
- #(Z_cast args)%expr @
- ($(v0 (Compile.reflect x5)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s4 _ ($_)%expr _ | @expr.App _ _ _ s4 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s4 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s4 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s3 _ ($_)%expr _ | @expr.App _ _ _ s3 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s3 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s3 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | (@expr.Ident _ _ _ t0 idc0 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- match x2 with
- | (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat =>
- match x1 with
- | @expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t2 idc2) x4 =>
- match x0 with
- | @expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t3 idc3) x5 =>
- match x5 with
- | (@expr.Ident _ _ _ t4 idc4 @ x7 @ x6)%expr_pat =>
- match x7 with
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10
- _ (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Ident _ _ _
- t9 idc9)))%expr_pat =>
- match x6 with
- | (@expr.Ident _ _ _ t10 idc10 @ @expr.Ident _
- _ _ t11 idc11)%expr_pat =>
- args <- invert_bind_args idc11
- Raw.ident.Literal;
- args0 <- invert_bind_args idc10
- Raw.ident.Z_cast;
- args1 <- invert_bind_args idc9
- Raw.ident.Literal;
- args2 <- invert_bind_args idc8
- Raw.ident.Z_cast;
- args3 <- invert_bind_args idc7
- Raw.ident.Z_cast;
- _ <- invert_bind_args idc6 Raw.ident.Z_land;
- args5 <- invert_bind_args idc5
- Raw.ident.Z_cast;
- _ <- invert_bind_args idc4
- Raw.ident.Z_shiftl;
- args7 <- invert_bind_args idc3
- Raw.ident.Z_cast;
- args8 <- invert_bind_args idc2
- Raw.ident.Z_cast;
- args9 <- invert_bind_args idc1
- Raw.ident.Literal;
- args10 <- invert_bind_args idc0
- Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_sub_get_borrow;
- match
- pattern.type.unify_extracted
- ((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args9) -> s3) ->
- (s10 -> (projT1 args1)) ->
- (projT1 args))%ptype
- with
- | Datatypes.Some
- (_, _, (_, _, _))%zrange =>
- if
- type.type_beq base.type
- base.type.type_beq
- ((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args9) -> s3) ->
- (s10 -> (projT1 args1)) ->
- (projT1 args))%ptype
- then
- xv <- ident.unify
- pattern.ident.Literal
- ##(projT2 args9);
- v <- type.try_make_transport_cps s3 ℤ;
- v0 <- type.try_make_transport_cps s10 ℤ;
- xv0 <- ident.unify
- pattern.ident.Literal
- ##(projT2 args1);
- xv1 <- ident.unify
- pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- is_bounded_by_bool
- (let (x14, _) := xv in x14)
- (ZRange.normalize args10) &&
- is_bounded_by_bool
- (let (x14, _) := xv0 in x14)
- (ZRange.normalize args2) &&
- is_bounded_by_bool
- (let (x14, _) := xv1 in x14)
- (ZRange.normalize args0) &&
- ((let (x14, _) := xv in x14) =?
- 2
- ^ Z.log2
- (let (x14, _) := xv in
- x14)) &&
- (ZRange.normalize args5 <<
- ZRange.normalize
- (ZRange.constant
- (let (x14, _) := xv1 in
- x14)) <=?
- ZRange.normalize args7)%zrange &&
- (ZRange.normalize args7 <=?
- r[0 ~> (let (x14, _) := xv in
- x14) - 1])%zrange &&
- (ZRange.normalize args3 &'
- ZRange.normalize
- (ZRange.constant
- (let (x14, _) := xv0 in
- x14)) <=?
- ZRange.normalize args5)%zrange &&
- ((let (x14, _) := xv0 in x14) =?
- Z.ones
- (Z.log2
- (let (x14, _) := xv in
- x14) -
- (let (x14, _) := xv1 in
- x14))) &&
- ((0 <=?
- (let (x14, _) := xv1 in x14)) &&
- ((let (x14, _) := xv1 in x14) <=?
- Z.log2
- (let (x14, _) := xv in x14)))
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota
- var) false
- (#(Z_cast2 range)%expr @
- (#(fancy_sub
- (Z.log2
- (let (x14, _) :=
- xv in
- x14))
- (let (x14, _) :=
- xv1 in
- x14))%expr @
- (#(Z_cast args8)%expr @
- ($(v
- (Compile.reflect
- x4)))%expr,
- #(Z_cast args3)%expr @
- ($(v0
- (Compile.reflect
- x11)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t10 idc10 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t10 idc10 @ @expr.Abs _ _
- _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t10 idc10 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t10 idc10 @ @expr.LetIn _
- _ _ _ _ _ _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10
- _ (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ ($_)%expr)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10
- _ (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.Abs _ _ _ _
- _ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10
- _ (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ (_ @ _))))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10
- _ (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Ident _ _ _ t8 idc8 @ @expr.LetIn _ _ _
- _ _ _ _)))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10
- _ (@expr.Ident _ _ _ t7 idc7) x11 @ #(_)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10
- _ (@expr.Ident _ _ _ t7 idc7) x11 @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10
- _ (@expr.Ident _ _ _ t7 idc7) x11 @ @expr.Abs _
- _ _ _ _ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10
- _ (@expr.Ident _ _ _ t7 idc7) x11 @
- (($_)%expr @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10
- _ (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.Abs _ _ _ _ _ _ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10
- _ (@expr.Ident _ _ _ t7 idc7) x11 @ (_ @ _ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10
- _ (@expr.Ident _ _ _ t7 idc7) x11 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10
- _ (@expr.Ident _ _ _ t7 idc7) x11 @ @expr.LetIn
- _ _ _ _ _ _ _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10
- _ ($_)%expr _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10
- _ (@expr.Abs _ _ _ _ _ _) _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10
- _ (_ @ _) _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ s10
- _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ #(_) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ _ _
- _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ _ _
- _ _ _ @ _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _
- _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (#(_) @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _
- _ _ _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end;;
- match x7 with
- | @expr.App _ _ _ s7 _ (@expr.Ident _ _ _ t5 idc5)
- x8 =>
- match x6 with
- | (@expr.Ident _ _ _ t6 idc6 @ @expr.Ident _ _
- _ t7 idc7)%expr_pat =>
- args <- invert_bind_args idc7
- Raw.ident.Literal;
- args0 <- invert_bind_args idc6
- Raw.ident.Z_cast;
- args1 <- invert_bind_args idc5
- Raw.ident.Z_cast;
- _ <- invert_bind_args idc4
- Raw.ident.Z_shiftr;
- args3 <- invert_bind_args idc3
- Raw.ident.Z_cast;
- args4 <- invert_bind_args idc2
- Raw.ident.Z_cast;
- args5 <- invert_bind_args idc1
- Raw.ident.Literal;
- args6 <- invert_bind_args idc0
- Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_sub_get_borrow;
- match
- pattern.type.unify_extracted
- ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype
- (((projT1 args5) -> s3) ->
- s7 -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, (_, _))%zrange =>
- if
- type.type_beq base.type
- base.type.type_beq
- ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype
- (((projT1 args5) -> s3) ->
- s7 -> (projT1 args))%ptype
- then
- xv <- ident.unify
- pattern.ident.Literal
- ##(projT2 args5);
- v <- type.try_make_transport_cps s3 ℤ;
- v0 <- type.try_make_transport_cps s7 ℤ;
- xv0 <- ident.unify
- pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- is_bounded_by_bool
- (let (x10, _) := xv in x10)
- (ZRange.normalize args6) &&
- is_bounded_by_bool
- (let (x10, _) := xv0 in x10)
- (ZRange.normalize args0) &&
- ((let (x10, _) := xv in x10) =?
- 2
- ^ Z.log2
- (let (x10, _) := xv in
- x10)) &&
- (ZRange.normalize args1 >>
- ZRange.normalize
- (ZRange.constant
- (let (x10, _) := xv0 in
- x10)) <=?
- ZRange.normalize args3)%zrange &&
- (ZRange.normalize args3 <=?
- r[0 ~> (let (x10, _) := xv in
- x10) - 1])%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota
- var) false
- (#(Z_cast2 range)%expr @
- (#(fancy_sub
- (Z.log2
- (let (x10, _) :=
- xv in
- x10))
- (-
- (let (x10, _) :=
- xv0 in
- x10)))%expr @
- (#(Z_cast args4)%expr @
- ($(v
- (Compile.reflect
- x4)))%expr,
- #(Z_cast args1)%expr @
- ($(v0
- (Compile.reflect
- x8)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _
- _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _
- _ _ _ _ _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s7 _ ($_)%expr _ | @expr.App _ _
- _ s7 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _
- _ s7 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s7 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- args <- invert_bind_args idc3 Raw.ident.Z_cast;
- args0 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc1 Raw.ident.Literal;
- args2 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc Raw.ident.Z_sub_get_borrow;
- match
- pattern.type.unify_extracted ((ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args1) -> s3) -> s4)%ptype
- with
- | Datatypes.Some (_, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((ℤ -> ℤ) -> ℤ)%ptype
- (((projT1 args1) -> s3) -> s4)%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args1);
- v <- type.try_make_transport_cps s3 ℤ;
- v0 <- type.try_make_transport_cps s4 ℤ;
- fv <- (if
- is_bounded_by_bool
- (let (x6, _) := xv in x6)
- (ZRange.normalize args2) &&
- ((let (x6, _) := xv in x6) =?
- 2 ^ Z.log2 (let (x6, _) := xv in x6)) &&
- (ZRange.normalize args <=?
- r[0 ~> (let (x6, _) := xv in x6) - 1])%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast2 range)%expr @
- (#(fancy_sub
- (Z.log2
- (let (x6, _) := xv in x6)) 0)%expr @
- (#(Z_cast args0)%expr @
- ($(v (Compile.reflect x4)))%expr,
- #(Z_cast args)%expr @
- ($(v0 (Compile.reflect x5)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s4 _ ($_)%expr _ | @expr.App _ _ _ s4 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s4 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s4 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s3 _ ($_)%expr _ | @expr.App _ _ _ s3 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s3 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s3 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | (@expr.Ident _ _ _ t0 idc0 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | (@expr.Ident _ _ _ t idc @ x3 @ x2 @ x1 @ x0)%expr_pat =>
- match x3 with
- | (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat =>
- match x2 with
- | @expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5 =>
- match x1 with
- | @expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t3 idc3) x6 =>
- match x0 with
- | @expr.App _ _ _ s6 _ (@expr.Ident _ _ _ t4 idc4)
- x7 =>
- match x7 with
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @
- (@expr.Ident _ _ _ t11 idc11 @ @expr.Ident _ _ _
- t12 idc12))%expr_pat =>
- args <- invert_bind_args idc12
- Raw.ident.Literal;
- args0 <- invert_bind_args idc11
- Raw.ident.Z_cast;
- args1 <- invert_bind_args idc10
- Raw.ident.Literal;
- args2 <- invert_bind_args idc9 Raw.ident.Z_cast;
- args3 <- invert_bind_args idc8 Raw.ident.Z_cast;
- _ <- invert_bind_args idc7 Raw.ident.Z_land;
- args5 <- invert_bind_args idc6 Raw.ident.Z_cast;
- _ <- invert_bind_args idc5 Raw.ident.Z_shiftl;
- args7 <- invert_bind_args idc4 Raw.ident.Z_cast;
- args8 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args9 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args10 <- invert_bind_args idc1
- Raw.ident.Literal;
- args11 <- invert_bind_args idc0
- Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_add_with_get_carry;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype
- ((((projT1 args10) -> s4) -> s5) ->
- (s12 -> (projT1 args1)) -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, _, (_, _, _))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype
- ((((projT1 args10) -> s4) -> s5) ->
- (s12 -> (projT1 args1)) ->
- (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args10);
- v <- type.try_make_transport_cps s4 ℤ;
- v0 <- type.try_make_transport_cps s5 ℤ;
- v1 <- type.try_make_transport_cps s12 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args1);
- xv1 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- is_bounded_by_bool
- (let (x16, _) := xv in x16)
- (ZRange.normalize args11) &&
- is_bounded_by_bool
- (let (x16, _) := xv0 in x16)
- (ZRange.normalize args2) &&
- is_bounded_by_bool
- (let (x16, _) := xv1 in x16)
- (ZRange.normalize args0) &&
- ((let (x16, _) := xv in x16) =?
- 2
- ^ Z.log2
- (let (x16, _) := xv in x16)) &&
- (ZRange.normalize args5 <<
- ZRange.normalize
- (ZRange.constant
- (let (x16, _) := xv1 in x16)) <=?
- ZRange.normalize args7)%zrange &&
- (ZRange.normalize args3 &'
- ZRange.normalize
- (ZRange.constant
- (let (x16, _) := xv0 in x16)) <=?
- ZRange.normalize args5)%zrange &&
- (ZRange.normalize args7 <=?
- r[0 ~> (let (x16, _) := xv in x16) -
- 1])%zrange &&
- ((let (x16, _) := xv0 in x16) =?
- Z.ones
- (Z.log2
- (let (x16, _) := xv in x16) -
- (let (x16, _) := xv1 in x16))) &&
- ((0 <=?
- (let (x16, _) := xv1 in x16)) &&
- ((let (x16, _) := xv1 in x16) <=?
- Z.log2
- (let (x16, _) := xv in x16)))
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota
- var) false
- (#(Z_cast2 range)%expr @
- (#(fancy_addc
- (Z.log2
- (let (x16, _) :=
- xv in
- x16))
- (let (x16, _) := xv1 in
- x16))%expr @
- (#(Z_cast args9)%expr @
- ($(v (Compile.reflect x5)))%expr,
- #(Z_cast args8)%expr @
- ($(v0 (Compile.reflect x6)))%expr,
- #(Z_cast args3)%expr @
- ($(v1 (Compile.reflect x13)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @
- (@expr.Ident _ _ _ t11 idc11 @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @
- (@expr.Ident _ _ _ t11 idc11 @ @expr.Abs _ _ _ _
- _ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @
- (@expr.Ident _ _ _ t11 idc11 @ (_ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @
- (@expr.Ident _ _ _ t11 idc11 @ @expr.LetIn _ _ _
- _ _ _ _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @ (_ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ ($_)%expr))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Abs _ _ _ _
- _ _))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ (_ @ _)))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.LetIn _ _ _
- _ _ _ _))) @ _)%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @ #
- (_))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- ($_)%expr)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- @expr.Abs _ _ _ _ _ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (($_)%expr @ _))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Abs _ _ _ _ _ _ @ _))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (_ @ _ @ _))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- @expr.LetIn _ _ _ _ _ _ _)) @ _)%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ ($_)%expr _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Abs _ _ _ _ _ _) _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (_ @ _) _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)) @ _)%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ #(_) @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ ($_)%expr @ _)) @
- _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Abs _ _ _ _
- _ _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.LetIn _ _ _
- _ _ _ _ @ _)) @ _)%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ #(_)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ _ _
- _) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ (#(_) @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ (($_)%expr @ _)) @
- _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Abs _ _ _ _ _ _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ (($_)%expr @ _ @ _)) @
- _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Abs _ _ _ _ _ _ @ _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ (_ @ _ @ _ @ _)) @
- _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ _ _
- _ _ _) @ _)%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @ #(_) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _
- _ @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Abs _ _ _ _ _ _ @ _) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _
- _ _ _ @ _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end;;
- match x6 with
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @
- (@expr.Ident _ _ _ t11 idc11 @ @expr.Ident _ _ _
- t12 idc12))%expr_pat =>
- args <- invert_bind_args idc12
- Raw.ident.Literal;
- args0 <- invert_bind_args idc11
- Raw.ident.Z_cast;
- args1 <- invert_bind_args idc10
- Raw.ident.Literal;
- args2 <- invert_bind_args idc9 Raw.ident.Z_cast;
- args3 <- invert_bind_args idc8 Raw.ident.Z_cast;
- _ <- invert_bind_args idc7 Raw.ident.Z_land;
- args5 <- invert_bind_args idc6 Raw.ident.Z_cast;
- _ <- invert_bind_args idc5 Raw.ident.Z_shiftl;
- args7 <- invert_bind_args idc4 Raw.ident.Z_cast;
- args8 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args9 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args10 <- invert_bind_args idc1
- Raw.ident.Literal;
- args11 <- invert_bind_args idc0
- Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_add_with_get_carry;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- ((((projT1 args10) -> s4) ->
- (s12 -> (projT1 args1)) -> (projT1 args)) ->
- s6)%ptype
- with
- | Datatypes.Some (_, _, (_, _, _), _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- ((((projT1 args10) -> s4) ->
- (s12 -> (projT1 args1)) ->
- (projT1 args)) -> s6)%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args10);
- v <- type.try_make_transport_cps s4 ℤ;
- v0 <- type.try_make_transport_cps s12 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args1);
- xv1 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- v1 <- type.try_make_transport_cps s6 ℤ;
- fv <- (if
- is_bounded_by_bool
- (let (x16, _) := xv in x16)
- (ZRange.normalize args11) &&
- is_bounded_by_bool
- (let (x16, _) := xv0 in x16)
- (ZRange.normalize args2) &&
- is_bounded_by_bool
- (let (x16, _) := xv1 in x16)
- (ZRange.normalize args0) &&
- ((let (x16, _) := xv in x16) =?
- 2
- ^ Z.log2
- (let (x16, _) := xv in x16)) &&
- (ZRange.normalize args5 <<
- ZRange.normalize
- (ZRange.constant
- (let (x16, _) := xv1 in x16)) <=?
- ZRange.normalize args8)%zrange &&
- (ZRange.normalize args8 <=?
- r[0 ~> (let (x16, _) := xv in x16) -
- 1])%zrange &&
- (ZRange.normalize args3 &'
- ZRange.normalize
- (ZRange.constant
- (let (x16, _) := xv0 in x16)) <=?
- ZRange.normalize args5)%zrange &&
- ((let (x16, _) := xv0 in x16) =?
- Z.ones
- (Z.log2
- (let (x16, _) := xv in x16) -
- (let (x16, _) := xv1 in x16))) &&
- ((0 <=?
- (let (x16, _) := xv1 in x16)) &&
- ((let (x16, _) := xv1 in x16) <=?
- Z.log2
- (let (x16, _) := xv in x16)))
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota
- var) false
- (#(Z_cast2 range)%expr @
- (#(fancy_addc
- (Z.log2
- (let (x16, _) :=
- xv in
- x16))
- (let (x16, _) := xv1 in
- x16))%expr @
- (#(Z_cast args9)%expr @
- ($(v (Compile.reflect x5)))%expr,
- #(Z_cast args7)%expr @
- ($(v1 (Compile.reflect x7)))%expr,
- #(Z_cast args3)%expr @
- ($(v0 (Compile.reflect x13)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @
- (@expr.Ident _ _ _ t11 idc11 @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @
- (@expr.Ident _ _ _ t11 idc11 @ @expr.Abs _ _ _ _
- _ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @
- (@expr.Ident _ _ _ t11 idc11 @ (_ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @
- (@expr.Ident _ _ _ t11 idc11 @ @expr.LetIn _ _ _
- _ _ _ _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @ (_ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _ _ _
- t10 idc10))) @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ ($_)%expr))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Abs _ _ _ _
- _ _))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ (_ @ _)))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.LetIn _ _ _
- _ _ _ _))) @ _)%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @ #
- (_))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- ($_)%expr)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- @expr.Abs _ _ _ _ _ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (($_)%expr @ _))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Abs _ _ _ _ _ _ @ _))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (_ @ _ @ _))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- @expr.LetIn _ _ _ _ _ _ _)) @ _)%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ ($_)%expr _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Abs _ _ _ _ _ _) _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (_ @ _) _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)) @ _)%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ #(_) @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ ($_)%expr @ _)) @
- _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Abs _ _ _ _
- _ _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.LetIn _ _ _
- _ _ _ _ @ _)) @ _)%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ #(_)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ _ _
- _) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ (#(_) @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ (($_)%expr @ _)) @
- _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Abs _ _ _ _ _ _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ (($_)%expr @ _ @ _)) @
- _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Abs _ _ _ _ _ _ @ _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ (_ @ _ @ _ @ _)) @
- _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _)) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ _ _
- _ _ _) @ _)%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @ #(_) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _
- _ @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.Abs _ _ _ _ _ _ @ _) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _
- _ _ _ @ _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end;;
- match x7 with
- | (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Ident _ _ _
- t8 idc8))%expr_pat =>
- args <- invert_bind_args idc8 Raw.ident.Literal;
- args0 <- invert_bind_args idc7 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc6 Raw.ident.Z_cast;
- _ <- invert_bind_args idc5 Raw.ident.Z_shiftr;
- args3 <- invert_bind_args idc4 Raw.ident.Z_cast;
- args4 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args5 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args6 <- invert_bind_args idc1
- Raw.ident.Literal;
- args7 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_add_with_get_carry;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> ℤ -> ℤ)%ptype
- ((((projT1 args6) -> s4) -> s5) ->
- s9 -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _, _, (_, _))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ -> ℤ)%ptype
- ((((projT1 args6) -> s4) -> s5) ->
- s9 -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args6);
- v <- type.try_make_transport_cps s4 ℤ;
- v0 <- type.try_make_transport_cps s5 ℤ;
- v1 <- type.try_make_transport_cps s9 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- is_bounded_by_bool
- (let (x12, _) := xv in x12)
- (ZRange.normalize args7) &&
- is_bounded_by_bool
- (let (x12, _) := xv0 in x12)
- (ZRange.normalize args0) &&
- ((let (x12, _) := xv in x12) =?
- 2
- ^ Z.log2
- (let (x12, _) := xv in x12)) &&
- (ZRange.normalize args1 >>
- ZRange.normalize
- (ZRange.constant
- (let (x12, _) := xv0 in x12)) <=?
- ZRange.normalize args3)%zrange &&
- (ZRange.normalize args3 <=?
- r[0 ~> (let (x12, _) := xv in x12) -
- 1])%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota
- var) false
- (#(Z_cast2 range)%expr @
- (#(fancy_addc
- (Z.log2
- (let (x12, _) :=
- xv in
- x12))
- (-
- (let (x12, _) :=
- xv0 in
- x12)))%expr @
- (#(Z_cast args5)%expr @
- ($(v (Compile.reflect x5)))%expr,
- #(Z_cast args4)%expr @
- ($(v0 (Compile.reflect x6)))%expr,
- #(Z_cast args1)%expr @
- ($(v1 (Compile.reflect x10)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @
- (@expr.Ident _ _ _ t7 idc7 @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Abs _ _ _ _ _
- _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @
- (@expr.Ident _ _ _ t7 idc7 @ (_ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.LetIn _ _ _ _
- _ _ _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @ @expr.Abs _ _
- _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @
- (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @
- (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @ (_ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @ @expr.LetIn _
- _ _ _ _ _ _)%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- ($_)%expr _ @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (_ @ _) _ @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @ #(_) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _
- _ @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _
- _ _ _ @ _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end;;
- match x6 with
- | (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Ident _ _ _
- t8 idc8))%expr_pat =>
- args <- invert_bind_args idc8 Raw.ident.Literal;
- args0 <- invert_bind_args idc7 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc6 Raw.ident.Z_cast;
- _ <- invert_bind_args idc5 Raw.ident.Z_shiftr;
- args3 <- invert_bind_args idc4 Raw.ident.Z_cast;
- args4 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args5 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args6 <- invert_bind_args idc1
- Raw.ident.Literal;
- args7 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_add_with_get_carry;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ -> ℤ) -> ℤ)%ptype
- ((((projT1 args6) -> s4) ->
- s9 -> (projT1 args)) -> s6)%ptype
- with
- | Datatypes.Some (_, _, (_, _), _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ -> ℤ) -> ℤ)%ptype
- ((((projT1 args6) -> s4) ->
- s9 -> (projT1 args)) -> s6)%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args6);
- v <- type.try_make_transport_cps s4 ℤ;
- v0 <- type.try_make_transport_cps s9 ℤ;
- xv0 <- ident.unify pattern.ident.Literal
- ##(projT2 args);
- v1 <- type.try_make_transport_cps s6 ℤ;
- fv <- (if
- is_bounded_by_bool
- (let (x12, _) := xv in x12)
- (ZRange.normalize args7) &&
- is_bounded_by_bool
- (let (x12, _) := xv0 in x12)
- (ZRange.normalize args0) &&
- ((let (x12, _) := xv in x12) =?
- 2
- ^ Z.log2
- (let (x12, _) := xv in x12)) &&
- (ZRange.normalize args1 >>
- ZRange.normalize
- (ZRange.constant
- (let (x12, _) := xv0 in x12)) <=?
- ZRange.normalize args4)%zrange &&
- (ZRange.normalize args4 <=?
- r[0 ~> (let (x12, _) := xv in x12) -
- 1])%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota
- var) false
- (#(Z_cast2 range)%expr @
- (#(fancy_addc
- (Z.log2
- (let (x12, _) :=
- xv in
- x12))
- (-
- (let (x12, _) :=
- xv0 in
- x12)))%expr @
- (#(Z_cast args5)%expr @
- ($(v (Compile.reflect x5)))%expr,
- #(Z_cast args3)%expr @
- ($(v1 (Compile.reflect x7)))%expr,
- #(Z_cast args1)%expr @
- ($(v0 (Compile.reflect x10)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @
- (@expr.Ident _ _ _ t7 idc7 @ ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Abs _ _ _ _ _
- _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @
- (@expr.Ident _ _ _ t7 idc7 @ (_ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.LetIn _ _ _ _
- _ _ _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @ @expr.Abs _ _
- _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @
- (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @
- (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @ (_ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 @ @expr.LetIn _
- _ _ _ _ _ _)%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- ($_)%expr _ @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (_ @ _) _ @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _
- (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t5 idc5 @ #(_) @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _
- _ @ _)%expr_pat |
- (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _
- _ _ _ @ _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end;;
- args <- invert_bind_args idc4 Raw.ident.Z_cast;
- args0 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args2 <- invert_bind_args idc1 Raw.ident.Literal;
- args3 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_add_with_get_carry;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- ((((projT1 args2) -> s4) -> s5) -> s6)%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- ((((projT1 args2) -> s4) -> s5) -> s6)%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args2);
- v <- type.try_make_transport_cps s4 ℤ;
- v0 <- type.try_make_transport_cps s5 ℤ;
- v1 <- type.try_make_transport_cps s6 ℤ;
- fv <- (if
- is_bounded_by_bool
- (let (x8, _) := xv in x8)
- (ZRange.normalize args3) &&
- ((let (x8, _) := xv in x8) =?
- 2 ^ Z.log2 (let (x8, _) := xv in x8)) &&
- (ZRange.normalize args <=?
- r[0 ~> (let (x8, _) := xv in x8) - 1])%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast2 range)%expr @
- (#(fancy_addc
- (Z.log2
- (let (x8, _) := xv in x8))
- 0)%expr @
- (#(Z_cast args1)%expr @
- ($(v (Compile.reflect x5)))%expr,
- #(Z_cast args0)%expr @
- ($(v0 (Compile.reflect x6)))%expr,
- #(Z_cast args)%expr @
- ($(v1 (Compile.reflect x7)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s6 _ ($_)%expr _ | @expr.App _ _ _ s6
- _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s6 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s6 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s5 _ ($_)%expr _ | @expr.App _ _ _ s5 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s5 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s5 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s4 _ ($_)%expr _ | @expr.App _ _ _ s4 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s4 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s4 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | (@expr.Ident _ _ _ t0 idc0 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end;;
- match x3 with
- | (@expr.Ident _ _ _ t0 idc0 @ @expr.Ident _ _ _ t1 idc1)%expr_pat =>
- match x2 with
- | @expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5 =>
- match x1 with
- | @expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t3 idc3) x6 =>
- match x0 with
- | @expr.App _ _ _ s6 _ (@expr.Ident _ _ _ t4 idc4)
- x7 =>
- match x7 with
- | (@expr.Ident _ _ _ t5 idc5 @ x9 @ x8)%expr_pat =>
- match x9 with
- | (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Ident _
- _ _ t10 idc10)))%expr_pat =>
- match x8 with
- | (@expr.Ident _ _ _ t11 idc11 @
- @expr.Ident _ _ _ t12 idc12)%expr_pat =>
- args <- invert_bind_args idc12
- Raw.ident.Literal;
- args0 <- invert_bind_args idc11
- Raw.ident.Z_cast;
- args1 <- invert_bind_args idc10
- Raw.ident.Literal;
- args2 <- invert_bind_args idc9
- Raw.ident.Z_cast;
- args3 <- invert_bind_args idc8
- Raw.ident.Z_cast;
- _ <- invert_bind_args idc7
- Raw.ident.Z_land;
- args5 <- invert_bind_args idc6
- Raw.ident.Z_cast;
- _ <- invert_bind_args idc5
- Raw.ident.Z_shiftl;
- args7 <- invert_bind_args idc4
- Raw.ident.Z_cast;
- args8 <- invert_bind_args idc3
- Raw.ident.Z_cast;
- args9 <- invert_bind_args idc2
- Raw.ident.Z_cast;
- args10 <- invert_bind_args idc1
- Raw.ident.Literal;
- args11 <- invert_bind_args idc0
- Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_sub_with_get_borrow;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype
- ((((projT1 args10) -> s4) -> s5) ->
- (s12 -> (projT1 args1)) ->
- (projT1 args))%ptype
- with
- | Datatypes.Some
- (_, _, _, (_, _, _))%zrange =>
- if
- type.type_beq base.type
- base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) ->
- (ℤ -> ℤ) -> ℤ)%ptype
- ((((projT1 args10) -> s4) -> s5) ->
- (s12 -> (projT1 args1)) ->
- (projT1 args))%ptype
- then
- xv <- ident.unify
- pattern.ident.Literal
- ##(projT2 args10);
- v <- type.try_make_transport_cps s4 ℤ;
- v0 <- type.try_make_transport_cps s5 ℤ;
- v1 <- type.try_make_transport_cps s12 ℤ;
- xv0 <- ident.unify
- pattern.ident.Literal
- ##(projT2 args1);
- xv1 <- ident.unify
- pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- is_bounded_by_bool
- (let (x16, _) := xv in
- x16)
- (ZRange.normalize args11) &&
- is_bounded_by_bool
- (let (x16, _) := xv0 in
- x16)
- (ZRange.normalize args2) &&
- is_bounded_by_bool
- (let (x16, _) := xv1 in
- x16)
- (ZRange.normalize args0) &&
- ((let (x16, _) := xv in
- x16) =?
- 2
- ^ Z.log2
- (let (x16, _) :=
- xv in
- x16)) &&
- (ZRange.normalize args5 <<
- ZRange.normalize
- (ZRange.constant
- (let (x16, _) :=
- xv1 in
- x16)) <=?
- ZRange.normalize args7)%zrange &&
- (ZRange.normalize args7 <=?
- r[0 ~> (let (x16, _) :=
- xv in
- x16) - 1])%zrange &&
- (ZRange.normalize args3 &'
- ZRange.normalize
- (ZRange.constant
- (let (x16, _) :=
- xv0 in
- x16)) <=?
- ZRange.normalize args5)%zrange &&
- ((let (x16, _) := xv0 in
- x16) =?
- Z.ones
- (Z.log2
- (let (x16, _) :=
- xv in
- x16) -
- (let (x16, _) :=
- xv1 in
- x16))) &&
- ((0 <=?
- (let (x16, _) := xv1 in
- x16)) &&
- ((let (x16, _) := xv1 in
- x16) <=?
- Z.log2
- (let (x16, _) := xv in
- x16)))
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota
- var) false
- (#(Z_cast2 range)%expr @
- (#(fancy_subb
- (Z.log2
- (let
- (x16,
- _) :=
- xv in
- x16))
- (let
- (x16, _) :=
- xv1 in
- x16))%expr @
- (#(Z_cast args9)%expr @
- ($(v
- (Compile.reflect
- x5)))%expr,
- #(Z_cast args8)%expr @
- ($(v0
- (Compile.reflect
- x6)))%expr,
- #(Z_cast args3)%expr @
- ($(v1
- (Compile.reflect
- x13)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t11 idc11 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t11 idc11 @ @expr.Abs
- _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t11 idc11 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t11 idc11 @
- @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ ($_)%expr)))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.Abs _ _
- _ _ _ _)))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ (_ @ _))))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Ident _ _ _ t9 idc9 @ @expr.LetIn _
- _ _ _ _ _ _)))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- #(_)))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- ($_)%expr))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- @expr.Abs _ _ _ _ _ _))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (($_)%expr @ _)))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.Abs _ _ _ _ _ _ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (_ @ _ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _)))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Ident _ _ _ t8 idc8) x13 @
- @expr.LetIn _ _ _ _ _ _ _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ ($_)%expr _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.Abs _ _ _ _ _ _) _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (_ @ _) _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.App _ _ _
- s12 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _))%expr_pat =>
- Datatypes.None
- | (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ #(_) @ _))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ ($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Abs _ _ _
- _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Ident _ _ _ t7 idc7 @ @expr.LetIn _ _
- _ _ _ _ _ @ _))%expr_pat => Datatypes.None
- | (@expr.Ident _ _ _ t6 idc6 @ #(_))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _
- _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @ (#(_) @ _))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @ (($_)%expr @ _))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @
- (($_)%expr @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @ (_ @ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @
- (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat |
- (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _
- _ _ _ _ _)%expr_pat => Datatypes.None
- | _ => Datatypes.None
- end;;
- match x9 with
- | @expr.App _ _ _ s9 _
- (@expr.Ident _ _ _ t6 idc6) x10 =>
- match x8 with
- | (@expr.Ident _ _ _ t7 idc7 @ @expr.Ident
- _ _ _ t8 idc8)%expr_pat =>
- args <- invert_bind_args idc8
- Raw.ident.Literal;
- args0 <- invert_bind_args idc7
- Raw.ident.Z_cast;
- args1 <- invert_bind_args idc6
- Raw.ident.Z_cast;
- _ <- invert_bind_args idc5
- Raw.ident.Z_shiftr;
- args3 <- invert_bind_args idc4
- Raw.ident.Z_cast;
- args4 <- invert_bind_args idc3
- Raw.ident.Z_cast;
- args5 <- invert_bind_args idc2
- Raw.ident.Z_cast;
- args6 <- invert_bind_args idc1
- Raw.ident.Literal;
- args7 <- invert_bind_args idc0
- Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_sub_with_get_borrow;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> ℤ -> ℤ)%ptype
- ((((projT1 args6) -> s4) -> s5) ->
- s9 -> (projT1 args))%ptype
- with
- | Datatypes.Some
- (_, _, _, (_, _))%zrange =>
- if
- type.type_beq base.type
- base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ -> ℤ)%ptype
- ((((projT1 args6) -> s4) -> s5) ->
- s9 -> (projT1 args))%ptype
- then
- xv <- ident.unify
- pattern.ident.Literal
- ##(projT2 args6);
- v <- type.try_make_transport_cps s4 ℤ;
- v0 <- type.try_make_transport_cps s5 ℤ;
- v1 <- type.try_make_transport_cps s9 ℤ;
- xv0 <- ident.unify
- pattern.ident.Literal
- ##(projT2 args);
- fv <- (if
- is_bounded_by_bool
- (let (x12, _) := xv in
- x12)
- (ZRange.normalize args7) &&
- is_bounded_by_bool
- (let (x12, _) := xv0 in
- x12)
- (ZRange.normalize args0) &&
- ((let (x12, _) := xv in
- x12) =?
- 2
- ^ Z.log2
- (let (x12, _) :=
- xv in
- x12)) &&
- (ZRange.normalize args1 >>
- ZRange.normalize
- (ZRange.constant
- (let (x12, _) :=
- xv0 in
- x12)) <=?
- ZRange.normalize args3)%zrange &&
- (ZRange.normalize args3 <=?
- r[0 ~> (let (x12, _) :=
- xv in
- x12) - 1])%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota
- var) false
- (#(Z_cast2 range)%expr @
- (#(fancy_subb
- (Z.log2
- (let
- (x12,
- _) :=
- xv in
- x12))
- (-
- (let
- (x12, _) :=
- xv0 in
- x12)))%expr @
- (#(Z_cast args5)%expr @
- ($(v
- (Compile.reflect
- x5)))%expr,
- #(Z_cast args4)%expr @
- ($(v0
- (Compile.reflect
- x6)))%expr,
- #(Z_cast args1)%expr @
- ($(v1
- (Compile.reflect
- x10)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | (@expr.Ident _ _ _ t7 idc7 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t7 idc7 @ @expr.Abs _
- _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t7 idc7 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t7 idc7 @ @expr.LetIn
- _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s9 _ ($_)%expr _ | @expr.App
- _ _ _ s9 _ (@expr.Abs _ _ _ _ _ _) _ |
- @expr.App _ _ _ s9 _ (_ @ _)%expr_pat _ |
- @expr.App _ _ _ s9 _
- (@expr.LetIn _ _ _ _ _ _ _) _ =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- args <- invert_bind_args idc4 Raw.ident.Z_cast;
- args0 <- invert_bind_args idc3 Raw.ident.Z_cast;
- args1 <- invert_bind_args idc2 Raw.ident.Z_cast;
- args2 <- invert_bind_args idc1 Raw.ident.Literal;
- args3 <- invert_bind_args idc0 Raw.ident.Z_cast;
- _ <- invert_bind_args idc
- Raw.ident.Z_sub_with_get_borrow;
- match
- pattern.type.unify_extracted
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- ((((projT1 args2) -> s4) -> s5) -> s6)%ptype
- with
- | Datatypes.Some (_, _, _, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype
- ((((projT1 args2) -> s4) -> s5) -> s6)%ptype
- then
- xv <- ident.unify pattern.ident.Literal
- ##(projT2 args2);
- v <- type.try_make_transport_cps s4 ℤ;
- v0 <- type.try_make_transport_cps s5 ℤ;
- v1 <- type.try_make_transport_cps s6 ℤ;
- fv <- (if
- is_bounded_by_bool
- (let (x8, _) := xv in x8)
- (ZRange.normalize args3) &&
- ((let (x8, _) := xv in x8) =?
- 2 ^ Z.log2 (let (x8, _) := xv in x8)) &&
- (ZRange.normalize args <=?
- r[0 ~> (let (x8, _) := xv in x8) - 1])%zrange
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var)
- false
- (#(Z_cast2 range)%expr @
- (#(fancy_subb
- (Z.log2
- (let (x8, _) := xv in x8))
- 0)%expr @
- (#(Z_cast args1)%expr @
- ($(v (Compile.reflect x5)))%expr,
- #(Z_cast args0)%expr @
- ($(v0 (Compile.reflect x6)))%expr,
- #(Z_cast args)%expr @
- ($(v1 (Compile.reflect x7)))%expr)))%expr_pat)
- else Datatypes.None);
- Datatypes.Some
- (fv0 <-- fv;
- Base fv0)%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s6 _ ($_)%expr _ | @expr.App _ _ _ s6
- _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s6 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s6 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s5 _ ($_)%expr _ | @expr.App _ _ _ s5 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s5 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s5 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | @expr.App _ _ _ s4 _ ($_)%expr _ | @expr.App _ _ _ s4 _
- (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s4 _
- (_ @ _)%expr_pat _ | @expr.App _ _ _ s4 _
- (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end
- | (@expr.Ident _ _ _ t0 idc0 @ ($_)%expr)%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ @expr.Abs _ _ _ _ _ _)%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ (_ @ _))%expr_pat |
- (@expr.Ident _ _ _ t0 idc0 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat =>
- Datatypes.None
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base (#(Z_cast2 range)%expr @ x)%expr_pat)%option
-| Some A => fun x : expr A => Base (#(Some)%expr @ x)%expr_pat
-| None A => Base #(None)%expr
-| @option_rect A P =>
- fun (x : expr A -> UnderLets (expr P))
- (x0 : expr unit -> UnderLets (expr P)) (x1 : expr (base.type.option A))
- =>
- Base
- (#(option_rect)%expr @ (λ x2 : var A,
- to_expr (x ($x2)))%expr @
- (λ x2 : var unit,
- to_expr (x0 ($x2)))%expr @ x1)%expr_pat
-| Build_zrange =>
- fun x x0 : expr ℤ => Base (#(Build_zrange)%expr @ x @ x0)%expr_pat
-| @zrange_rect P =>
- fun (x : expr ℤ -> expr ℤ -> UnderLets (expr P))
- (x0 : expr base.type.zrange) =>
- Base
- (#(zrange_rect)%expr @ (λ x1 x2 : var ℤ,
- to_expr (x ($x1) ($x2)))%expr @ x0)%expr_pat
-| fancy_add log2wordmax imm =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_add log2wordmax imm)%expr @ x)%expr_pat
-| fancy_addc log2wordmax imm =>
- fun x : expr (ℤ * ℤ * ℤ)%etype =>
- Base (#(fancy_addc log2wordmax imm)%expr @ x)%expr_pat
-| fancy_sub log2wordmax imm =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_sub log2wordmax imm)%expr @ x)%expr_pat
-| fancy_subb log2wordmax imm =>
- fun x : expr (ℤ * ℤ * ℤ)%etype =>
- Base (#(fancy_subb log2wordmax imm)%expr @ x)%expr_pat
-| fancy_mulll log2wordmax =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_mulll log2wordmax)%expr @ x)%expr_pat
-| fancy_mullh log2wordmax =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_mullh log2wordmax)%expr @ x)%expr_pat
-| fancy_mulhl log2wordmax =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_mulhl log2wordmax)%expr @ x)%expr_pat
-| fancy_mulhh log2wordmax =>
- fun x : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_mulhh log2wordmax)%expr @ x)%expr_pat
-| fancy_rshi log2wordmax x =>
- fun x0 : expr (ℤ * ℤ)%etype =>
- Base (#(fancy_rshi log2wordmax x)%expr @ x0)%expr_pat
-| fancy_selc =>
- fun x : expr (ℤ * ℤ * ℤ)%etype => Base (#(fancy_selc)%expr @ x)%expr_pat
-| fancy_selm log2wordmax =>
- fun x : expr (ℤ * ℤ * ℤ)%etype =>
- Base (#(fancy_selm log2wordmax)%expr @ x)%expr_pat
-| fancy_sell =>
- fun x : expr (ℤ * ℤ * ℤ)%etype => Base (#(fancy_sell)%expr @ x)%expr_pat
-| fancy_addm =>
- fun x : expr (ℤ * ℤ * ℤ)%etype => Base (#(fancy_addm)%expr @ x)%expr_pat
-end
- : Compile.value' true t
diff --git a/src/nbe_rewrite_head.out b/src/nbe_rewrite_head.out
deleted file mode 100644
index ef9e829f3..000000000
--- a/src/nbe_rewrite_head.out
+++ /dev/null
@@ -1,3134 +0,0 @@
-nbe_rewrite_head =
-match idc in (Compilers.ident t) return (Compile.value' true t) with
-| @Literal t v => Base (##v)%expr
-| Nat_succ =>
- fun x : expr ℕ =>
- ((match x with
- | @expr.Ident _ _ _ t idc =>
- args <- invert_bind_args idc Raw.ident.Literal;
- match pattern.type.unify_extracted ℕ (projT1 args) with
- | Datatypes.Some _ =>
- if type.type_beq base.type base.type.type_beq ℕ (projT1 args)
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- Datatypes.Some
- (Base (##(Nat.succ (let (x0, _) := xv in x0)))%expr)
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base (#(Nat_succ)%expr @ x)%expr_pat)%option
-| Nat_pred =>
- fun x : expr ℕ =>
- ((match x with
- | @expr.Ident _ _ _ t idc =>
- args <- invert_bind_args idc Raw.ident.Literal;
- match pattern.type.unify_extracted ℕ (projT1 args) with
- | Datatypes.Some _ =>
- if type.type_beq base.type base.type.type_beq ℕ (projT1 args)
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- Datatypes.Some
- (Base (##(Nat.pred (let (x0, _) := xv in x0)))%expr)
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base (#(Nat_pred)%expr @ x)%expr_pat)%option
-| Nat_max =>
- fun x x0 : expr ℕ =>
- ((match x with
- | @expr.Ident _ _ _ t idc =>
- match x0 with
- | @expr.Ident _ _ _ t0 idc0 =>
- args <- invert_bind_args idc0 Raw.ident.Literal;
- args0 <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℕ -> ℕ)%ptype
- ((projT1 args0) -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℕ -> ℕ)%ptype
- ((projT1 args0) -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args0);
- xv0 <- ident.unify pattern.ident.Literal ##(projT2 args);
- Datatypes.Some
- (Base
- (##(Nat.max (let (x1, _) := xv in x1)
- (let (x1, _) := xv0 in x1)))%expr)
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base (#(Nat_max)%expr @ x @ x0)%expr_pat)%option
-| Nat_mul =>
- fun x x0 : expr ℕ =>
- ((match x with
- | @expr.Ident _ _ _ t idc =>
- match x0 with
- | @expr.Ident _ _ _ t0 idc0 =>
- args <- invert_bind_args idc0 Raw.ident.Literal;
- args0 <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℕ -> ℕ)%ptype
- ((projT1 args0) -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℕ -> ℕ)%ptype
- ((projT1 args0) -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args0);
- xv0 <- ident.unify pattern.ident.Literal ##(projT2 args);
- Datatypes.Some
- (Base
- (##((let (x1, _) := xv in x1) *
- (let (x1, _) := xv0 in x1))%nat)%expr)
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base (#(Nat_mul)%expr @ x @ x0)%expr_pat)%option
-| Nat_add =>
- fun x x0 : expr ℕ =>
- ((match x with
- | @expr.Ident _ _ _ t idc =>
- match x0 with
- | @expr.Ident _ _ _ t0 idc0 =>
- args <- invert_bind_args idc0 Raw.ident.Literal;
- args0 <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℕ -> ℕ)%ptype
- ((projT1 args0) -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℕ -> ℕ)%ptype
- ((projT1 args0) -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args0);
- xv0 <- ident.unify pattern.ident.Literal ##(projT2 args);
- Datatypes.Some
- (Base
- (##((let (x1, _) := xv in x1) +
- (let (x1, _) := xv0 in x1))%nat)%expr)
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base (#(Nat_add)%expr @ x @ x0)%expr_pat)%option
-| Nat_sub =>
- fun x x0 : expr ℕ =>
- ((match x with
- | @expr.Ident _ _ _ t idc =>
- match x0 with
- | @expr.Ident _ _ _ t0 idc0 =>
- args <- invert_bind_args idc0 Raw.ident.Literal;
- args0 <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℕ -> ℕ)%ptype
- ((projT1 args0) -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℕ -> ℕ)%ptype
- ((projT1 args0) -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args0);
- xv0 <- ident.unify pattern.ident.Literal ##(projT2 args);
- Datatypes.Some
- (Base
- (##((let (x1, _) := xv in x1) -
- (let (x1, _) := xv0 in x1))%nat)%expr)
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base (#(Nat_sub)%expr @ x @ x0)%expr_pat)%option
-| Nat_eqb =>
- fun x x0 : expr ℕ =>
- ((match x with
- | @expr.Ident _ _ _ t idc =>
- match x0 with
- | @expr.Ident _ _ _ t0 idc0 =>
- args <- invert_bind_args idc0 Raw.ident.Literal;
- args0 <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted (ℕ -> ℕ)%ptype
- ((projT1 args0) -> (projT1 args))%ptype
- with
- | Datatypes.Some (_, _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq (ℕ -> ℕ)%ptype
- ((projT1 args0) -> (projT1 args))%ptype
- then
- xv <- ident.unify pattern.ident.Literal ##(projT2 args0);
- xv0 <- ident.unify pattern.ident.Literal ##(projT2 args);
- Datatypes.Some
- (Base
- (##((let (x1, _) := xv in x1) =?
- (let (x1, _) := xv0 in x1))%nat)%expr)
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base (#(Nat_eqb)%expr @ x @ x0)%expr_pat)%option
-| @nil t => Base []%expr_pat
-| @cons t => fun (x : expr t) (x0 : expr (list t)) => Base (x :: x0)%expr_pat
-| @pair A B => fun (x : expr A) (x0 : expr B) => Base (x, x0)%expr_pat
-| @fst A B =>
- fun x : expr (A * B)%etype =>
- ((match x with
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) x1) _ =>
- args <- invert_bind_args idc Raw.ident.pair;
- match
- pattern.type.unify_extracted
- ((('1 * '2)%pbtype -> '1%pbtype) ->
- (('1%pbtype -> '2%pbtype -> ('1 * '2)%pbtype) -> '1%pbtype) ->
- '2%pbtype)%ptype
- (((A * B)%etype -> A) ->
- (((let (x2, _) := args in x2) ->
- (let (_, y) := args in y) ->
- ((let (x2, _) := args in x2) * (let (_, y) := args in y))%etype) ->
- s0) -> s)%ptype
- with
- | Datatypes.Some (_, _, _, (_, (_, (_, _)), b3, b2))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((b3 * b2)%etype -> b3) ->
- ((b3 -> b2 -> (b3 * b2)%etype) -> b3) -> b2)%ptype
- (((A * B)%etype -> A) ->
- (((let (x2, _) := args in x2) ->
- (let (_, y) := args in y) ->
- ((let (x2, _) := args in x2) * (let (_, y) := args in y))%etype) ->
- s0) -> s)%ptype
- then
- _ <- ident.unify pattern.ident.fst fst;
- _ <- ident.unify pattern.ident.pair pair;
- v <- type.try_make_transport_cps s0 b3;
- _ <- type.try_make_transport_cps s b2;
- v1 <- base.try_make_transport_cps b3 b3;
- _ <- base.try_make_transport_cps b2 b2;
- v3 <- base.try_make_transport_cps b3 A;
- v4 <- base.try_make_transport_cps A A;
- Datatypes.Some
- (fv1 <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($(v1 (v (Compile.reflect x1))));
- Base (v4 (v3 fv1)))%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ ($_)%expr _) _ | @expr.App
- _ _ _ s _ (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _) _ |
- @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ (_ @ _)%expr_pat _) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _) _ =>
- Datatypes.None
- | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr
- _ | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s
- _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base (#(fst)%expr @ x)%expr_pat)%option
-| @snd A B =>
- fun x : expr (A * B)%etype =>
- ((match x with
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) _) x0 =>
- args <- invert_bind_args idc Raw.ident.pair;
- match
- pattern.type.unify_extracted
- ((('1 * '2)%pbtype -> '2%pbtype) ->
- (('1%pbtype -> '2%pbtype -> ('1 * '2)%pbtype) -> '1%pbtype) ->
- '2%pbtype)%ptype
- (((A * B)%etype -> B) ->
- (((let (x2, _) := args in x2) ->
- (let (_, y) := args in y) ->
- ((let (x2, _) := args in x2) * (let (_, y) := args in y))%etype) ->
- s0) -> s)%ptype
- with
- | Datatypes.Some (_, _, _, (_, (_, (_, _)), b3, b2))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((b3 * b2)%etype -> b2) ->
- ((b3 -> b2 -> (b3 * b2)%etype) -> b3) -> b2)%ptype
- (((A * B)%etype -> B) ->
- (((let (x2, _) := args in x2) ->
- (let (_, y) := args in y) ->
- ((let (x2, _) := args in x2) * (let (_, y) := args in y))%etype) ->
- s0) -> s)%ptype
- then
- _ <- ident.unify pattern.ident.snd snd;
- _ <- ident.unify pattern.ident.pair pair;
- _ <- type.try_make_transport_cps s0 b3;
- v0 <- type.try_make_transport_cps s b2;
- _ <- base.try_make_transport_cps b3 b3;
- v2 <- base.try_make_transport_cps b2 b2;
- v3 <- base.try_make_transport_cps b2 B;
- v4 <- base.try_make_transport_cps B B;
- Datatypes.Some
- (fv1 <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- ($(v2 (v0 (Compile.reflect x0))));
- Base (v4 (v3 fv1)))%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ ($_)%expr _) _ | @expr.App
- _ _ _ s _ (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _) _ |
- @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ (_ @ _)%expr_pat _) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _) _ =>
- Datatypes.None
- | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr
- _ | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s
- _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base (#(snd)%expr @ x)%expr_pat)%option
-| @prod_rect A B T =>
- fun (x : expr A -> expr B -> UnderLets (expr T))
- (x0 : expr (A * B)%etype) =>
- ((match x0 with
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) x2) x1 =>
- args <- invert_bind_args idc Raw.ident.pair;
- match
- pattern.type.unify_extracted
- (((('1%pbtype -> '2%pbtype -> '3%pbtype) ->
- ('1 * '2)%pbtype -> '3%pbtype) ->
- '1%pbtype -> '2%pbtype -> '3%pbtype) ->
- (('1%pbtype -> '2%pbtype -> ('1 * '2)%pbtype) -> '1%pbtype) ->
- '2%pbtype)%ptype
- ((((A -> B -> T) -> (A * B)%etype -> T) -> A -> B -> T) ->
- (((let (x3, _) := args in x3) ->
- (let (_, y) := args in y) ->
- ((let (x3, _) := args in x3) * (let (_, y) := args in y))%etype) ->
- s0) -> s)%ptype
- with
- | Datatypes.Some
- (_, (_, _), (_, _, _), (_, (_, b7)), (_, (_, (_, _)), b9, b8))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((((b9 -> b8 -> b7) -> (b9 * b8)%etype -> b7) ->
- b9 -> b8 -> b7) ->
- ((b9 -> b8 -> (b9 * b8)%etype) -> b9) -> b8)%ptype
- ((((A -> B -> T) -> (A * B)%etype -> T) -> A -> B -> T) ->
- (((let (x3, _) := args in x3) ->
- (let (_, y) := args in y) ->
- ((let (x3, _) := args in x3) * (let (_, y) := args in y))%etype) ->
- s0) -> s)%ptype
- then
- _ <- ident.unify pattern.ident.prod_rect prod_rect;
- x' <- base.try_make_transport_cps A b9;
- x'0 <- base.try_make_transport_cps B b8;
- x'1 <- base.try_make_transport_cps T b7;
- _ <- ident.unify pattern.ident.pair pair;
- v <- type.try_make_transport_cps s0 b9;
- v0 <- type.try_make_transport_cps s b8;
- x'2 <- base.try_make_transport_cps b9 b9;
- x'3 <- base.try_make_transport_cps b8 b8;
- x'4 <- base.try_make_transport_cps b7 b7;
- v1 <- base.try_make_transport_cps b9 b9;
- v2 <- base.try_make_transport_cps b8 b8;
- v3 <- base.try_make_transport_cps b7 T;
- v4 <- base.try_make_transport_cps T T;
- Datatypes.Some
- (fv1 <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (($(x'4 (x'3 (x'2 (x'1 (x'0 (x' x)))))))%expr @
- ($(v1 (v (Compile.reflect x2))))%expr @
- ($(v2 (v0 (Compile.reflect x1))))%expr)%expr_pat;
- Base (v4 (v3 fv1)))%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ ($_)%expr _) _ | @expr.App
- _ _ _ s _ (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _) _ |
- @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ (_ @ _)%expr_pat _) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _) _ =>
- Datatypes.None
- | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr
- _ | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s
- _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base
- (#(prod_rect)%expr @
- (λ (x1 : var A)(x2 : var B),
- to_expr (x ($x1) ($x2)))%expr @ x0)%expr_pat)%option
-| @bool_rect T =>
- fun (x x0 : expr unit -> UnderLets (expr T)) (x1 : expr bool) =>
- ((match x1 with
- | @expr.Ident _ _ _ t idc =>
- (args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted
- (((((unit -> '1%pbtype) ->
- (unit -> '1%pbtype) -> bool -> '1%pbtype) ->
- unit -> '1%pbtype) -> unit -> '1%pbtype) -> bool)%ptype
- (((((unit -> T) -> (unit -> T) -> bool -> T) -> unit -> T) ->
- unit -> T) -> (projT1 args))%ptype
- with
- | Datatypes.Some
- (_, _, (_, _, (_, _)), (_, _), (_, b8), _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((((unit -> b8) -> (unit -> b8) -> bool -> b8) ->
- unit -> b8) -> unit -> b8) -> bool)%ptype
- (((((unit -> T) -> (unit -> T) -> bool -> T) -> unit -> T) ->
- unit -> T) -> (projT1 args))%ptype
- then
- _ <- ident.unify pattern.ident.bool_rect bool_rect;
- x' <- base.try_make_transport_cps T b8;
- _ <- base.try_make_transport_cps T b8;
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- x'1 <- base.try_make_transport_cps b8 b8;
- _ <- base.try_make_transport_cps b8 b8;
- v <- base.try_make_transport_cps b8 T;
- v0 <- base.try_make_transport_cps T T;
- fv0 <- (if let (x2, _) := xv in x2
- then
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (($(x'1 (x' x)))%expr @ (##tt)%expr)%expr_pat)
- else Datatypes.None);
- Datatypes.Some (fv1 <-- fv0;
- Base (v0 (v fv1)))%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end);;
- args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted
- (((((unit -> '1%pbtype) ->
- (unit -> '1%pbtype) -> bool -> '1%pbtype) ->
- unit -> '1%pbtype) -> unit -> '1%pbtype) -> bool)%ptype
- (((((unit -> T) -> (unit -> T) -> bool -> T) -> unit -> T) ->
- unit -> T) -> (projT1 args))%ptype
- with
- | Datatypes.Some
- (_, _, (_, _, (_, _)), (_, _), (_, b8), _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((((unit -> b8) -> (unit -> b8) -> bool -> b8) ->
- unit -> b8) -> unit -> b8) -> bool)%ptype
- (((((unit -> T) -> (unit -> T) -> bool -> T) -> unit -> T) ->
- unit -> T) -> (projT1 args))%ptype
- then
- _ <- ident.unify pattern.ident.bool_rect bool_rect;
- _ <- base.try_make_transport_cps T b8;
- x'0 <- base.try_make_transport_cps T b8;
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- _ <- base.try_make_transport_cps b8 b8;
- x'2 <- base.try_make_transport_cps b8 b8;
- v <- base.try_make_transport_cps b8 T;
- v0 <- base.try_make_transport_cps T T;
- fv0 <- (if let (x2, _) := xv in x2
- then Datatypes.None
- else
- Datatypes.Some
- (Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (($(x'2 (x'0 x0)))%expr @ (##tt)%expr)%expr_pat));
- Datatypes.Some (fv1 <-- fv0;
- Base (v0 (v fv1)))%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base
- (#(bool_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ x2 : var unit,
- to_expr (x0 ($x2)))%expr @ x1)%expr_pat)%option
-| @nat_rect P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr ℕ -> expr P -> UnderLets (expr P)) (x1 : expr ℕ) =>
- ((match x1 with
- | @expr.Ident _ _ _ t idc =>
- args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted
- (((((unit -> '1%pbtype) ->
- (ℕ -> '1%pbtype -> '1%pbtype) -> ℕ -> '1%pbtype) ->
- unit -> '1%pbtype) -> ℕ -> '1%pbtype -> '1%pbtype) -> ℕ)%ptype
- (((((unit -> P) -> (ℕ -> P -> P) -> ℕ -> P) -> unit -> P) ->
- ℕ -> P -> P) -> (projT1 args))%ptype
- with
- | Datatypes.Some
- (_, _, (_, (_, _), (_, _)), (_, _), (_, (_, b10)), _)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((((unit -> b10) -> (ℕ -> b10 -> b10) -> ℕ -> b10) ->
- unit -> b10) -> ℕ -> b10 -> b10) -> ℕ)%ptype
- (((((unit -> P) -> (ℕ -> P -> P) -> ℕ -> P) -> unit -> P) ->
- ℕ -> P -> P) -> (projT1 args))%ptype
- then
- _ <- ident.unify pattern.ident.nat_rect nat_rect;
- x' <- base.try_make_transport_cps P b10;
- x'0 <- base.try_make_transport_cps P b10;
- x'1 <- base.try_make_transport_cps P b10;
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- x'2 <- base.try_make_transport_cps b10 b10;
- x'3 <- base.try_make_transport_cps b10 b10;
- x'4 <- base.try_make_transport_cps b10 b10;
- v <- base.try_make_transport_cps b10 P;
- v0 <- base.try_make_transport_cps P P;
- Datatypes.Some
- (fv0 <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (#(eager_nat_rect)%expr @ ($(x'2 (x' x)))%expr @
- ($(x'4 (x'3 (x'1 (x'0 x0)))))%expr @
- (##(let (x2, _) := xv in x2))%expr)%expr_pat;
- Base (v0 (v fv0)))%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base
- (#(nat_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var ℕ)(x3 : var P),
- to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat)%option
-| @nat_rect_arrow P Q =>
- fun (x : expr P -> UnderLets (expr Q))
- (x0 : expr ℕ ->
- (expr P -> UnderLets (expr Q)) -> expr P -> UnderLets (expr Q))
- (x1 : expr ℕ) (x2 : expr P) =>
- (match x1 with
- | @expr.Ident _ _ _ t idc =>
- args <- invert_bind_args idc Raw.ident.Literal;
- match
- pattern.type.unify_extracted
- (((((('1%pbtype -> '2%pbtype) ->
- (ℕ -> ('1%pbtype -> '2%pbtype) -> '1%pbtype -> '2%pbtype) ->
- ℕ -> '1%pbtype -> '2%pbtype) -> '1%pbtype -> '2%pbtype) ->
- ℕ -> ('1%pbtype -> '2%pbtype) -> '1%pbtype -> '2%pbtype) -> ℕ) ->
- '1%pbtype)%ptype
- ((((((P -> Q) -> (ℕ -> (P -> Q) -> P -> Q) -> ℕ -> P -> Q) ->
- P -> Q) -> ℕ -> (P -> Q) -> P -> Q) -> (projT1 args)) -> P)%ptype
- with
- | Datatypes.Some
- (_, _, (_, (_, _, (_, _)), (_, (_, _))), (_, _),
- (_, (_, _, (_, b16))), _, b)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((((((b -> b16) ->
- (ℕ -> (b -> b16) -> b -> b16) -> ℕ -> b -> b16) ->
- b -> b16) -> ℕ -> (b -> b16) -> b -> b16) -> ℕ) -> b)%ptype
- ((((((P -> Q) -> (ℕ -> (P -> Q) -> P -> Q) -> ℕ -> P -> Q) ->
- P -> Q) -> ℕ -> (P -> Q) -> P -> Q) -> (projT1 args)) ->
- P)%ptype
- then
- _ <- ident.unify pattern.ident.nat_rect_arrow nat_rect_arrow;
- x' <- base.try_make_transport_cps P b;
- x'0 <- base.try_make_transport_cps Q b16;
- x'1 <- base.try_make_transport_cps P b;
- x'2 <- base.try_make_transport_cps Q b16;
- x'3 <- base.try_make_transport_cps P b;
- x'4 <- base.try_make_transport_cps Q b16;
- xv <- ident.unify pattern.ident.Literal ##(projT2 args);
- v <- base.try_make_transport_cps P b;
- x'5 <- base.try_make_transport_cps b b;
- x'6 <- base.try_make_transport_cps b16 b16;
- x'7 <- base.try_make_transport_cps b b;
- x'8 <- base.try_make_transport_cps b16 b16;
- x'9 <- base.try_make_transport_cps b b;
- x'10 <- base.try_make_transport_cps b16 b16;
- v0 <- base.try_make_transport_cps b b;
- v1 <- base.try_make_transport_cps b16 Q;
- v2 <- base.try_make_transport_cps Q Q;
- Datatypes.Some
- (fv0 <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (#(eager_nat_rect_arrow)%expr @
- ($(x'6 (x'5 (x'0 (x' x)))))%expr @
- ($(x'10
- (x'9 (x'8 (x'7 (x'4 (x'3 (x'2 (x'1 x0)))))))))%expr @
- (##(let (x3, _) := xv in x3))%expr @
- ($(v0 (v x2)))%expr)%expr_pat;
- Base (v2 (v1 fv0)))%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | _ => Datatypes.None
- end;;;
- Base
- (#(nat_rect_arrow)%expr @ (λ x3 : var P,
- to_expr (x ($x3)))%expr @
- (λ (x3 : var ℕ)(x4 : var (P -> Q)%ptype)(x5 : var P),
- to_expr
- (x0 ($x3) (fun x6 : expr P => Base ($x4 @ x6)%expr_pat) ($x5)))%expr @
- x1 @ x2)%expr_pat)%option
-| @eager_nat_rect P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr ℕ -> expr P -> UnderLets (expr P)) (x1 : expr ℕ) =>
- Base
- (#(eager_nat_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var ℕ)(x3 : var P),
- to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat
-| @eager_nat_rect_arrow P Q =>
- fun (x : expr P -> UnderLets (expr Q))
- (x0 : expr ℕ ->
- (expr P -> UnderLets (expr Q)) -> expr P -> UnderLets (expr Q))
- (x1 : expr ℕ) (x2 : expr P) =>
- Base
- (#(eager_nat_rect_arrow)%expr @ (λ x3 : var P,
- to_expr (x ($x3)))%expr @
- (λ (x3 : var ℕ)(x4 : var (P -> Q)%ptype)(x5 : var P),
- to_expr
- (x0 ($x3) (fun x6 : expr P => Base ($x4 @ x6)%expr_pat) ($x5)))%expr @
- x1 @ x2)%expr_pat
-| @list_rect A P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr A -> expr (list A) -> expr P -> UnderLets (expr P))
- (x1 : expr (list A)) =>
- ((match
- pattern.type.unify_extracted
- (((((unit -> '2%pbtype) ->
- ('1%pbtype ->
- (pattern.base.type.list '1) -> '2%pbtype -> '2%pbtype) ->
- (pattern.base.type.list '1) -> '2%pbtype) -> unit -> '2%pbtype) ->
- '1%pbtype ->
- (pattern.base.type.list '1) -> '2%pbtype -> '2%pbtype) ->
- (pattern.base.type.list '1))%ptype
- (((((unit -> P) -> (A -> (list A) -> P -> P) -> (list A) -> P) ->
- unit -> P) -> A -> (list A) -> P -> P) -> (list A))%ptype
- with
- | Datatypes.Some
- (_, _, (_, (_, (_, _)), (_, _)), (_, _), (_, (_, (_, b12))), b)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((((unit -> b12) ->
- (b -> (list b) -> b12 -> b12) -> (list b) -> b12) ->
- unit -> b12) -> b -> (list b) -> b12 -> b12) -> (list b))%ptype
- (((((unit -> P) -> (A -> (list A) -> P -> P) -> (list A) -> P) ->
- unit -> P) -> A -> (list A) -> P -> P) -> (list A))%ptype
- then
- _ <- ident.unify pattern.ident.list_rect list_rect;
- x' <- base.try_make_transport_cps P b12;
- x'0 <- base.try_make_transport_cps A b;
- x'1 <- base.try_make_transport_cps A b;
- x'2 <- base.try_make_transport_cps P b12;
- x'3 <- base.try_make_transport_cps P b12;
- v <- base.try_make_transport_cps A b;
- x'4 <- base.try_make_transport_cps b12 b12;
- x'5 <- base.try_make_transport_cps b b;
- x'6 <- base.try_make_transport_cps b b;
- x'7 <- base.try_make_transport_cps b12 b12;
- x'8 <- base.try_make_transport_cps b12 b12;
- v0 <- base.try_make_transport_cps b b;
- v1 <- base.try_make_transport_cps b12 P;
- v2 <- base.try_make_transport_cps P P;
- Datatypes.Some
- (fv0 <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (#(eager_list_rect)%expr @ ($(x'4 (x' x)))%expr @
- ($(x'8 (x'7 (x'6 (x'5 (x'3 (x'2 (x'1 (x'0 x0)))))))))%expr @
- ($(v0 (v x1)))%expr)%expr_pat;
- Base (v2 (v1 fv0)))%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end;;
- Datatypes.None);;;
- Base
- (#(list_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var A)(x3 : var (list A))(x4 : var P),
- to_expr (x0 ($x2) ($x3) ($x4)))%expr @ x1)%expr_pat)%option
-| @list_rect_arrow A P Q =>
- fun (x : expr P -> UnderLets (expr Q))
- (x0 : expr A ->
- expr (list A) ->
- (expr P -> UnderLets (expr Q)) -> expr P -> UnderLets (expr Q))
- (x1 : expr (list A)) (x2 : expr P) =>
- ((match
- pattern.type.unify_extracted
- (((((('2%pbtype -> '3%pbtype) ->
- ('1%pbtype ->
- (pattern.base.type.list '1) ->
- ('2%pbtype -> '3%pbtype) -> '2%pbtype -> '3%pbtype) ->
- (pattern.base.type.list '1) -> '2%pbtype -> '3%pbtype) ->
- '2%pbtype -> '3%pbtype) ->
- '1%pbtype ->
- (pattern.base.type.list '1) ->
- ('2%pbtype -> '3%pbtype) -> '2%pbtype -> '3%pbtype) ->
- (pattern.base.type.list '1)) -> '2%pbtype)%ptype
- ((((((P -> Q) ->
- (A -> (list A) -> (P -> Q) -> P -> Q) -> (list A) -> P -> Q) ->
- P -> Q) -> A -> (list A) -> (P -> Q) -> P -> Q) -> (list A)) ->
- P)%ptype
- with
- | Datatypes.Some
- (_, _, (_, (_, (_, _, (_, _))), (_, (_, _))), (_, _),
- (_, (_, (_, _, (_, b18)))), b0, b)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- ((((((b -> b18) ->
- (b0 -> (list b0) -> (b -> b18) -> b -> b18) ->
- (list b0) -> b -> b18) -> b -> b18) ->
- b0 -> (list b0) -> (b -> b18) -> b -> b18) -> (list b0)) -> b)%ptype
- ((((((P -> Q) ->
- (A -> (list A) -> (P -> Q) -> P -> Q) -> (list A) -> P -> Q) ->
- P -> Q) -> A -> (list A) -> (P -> Q) -> P -> Q) -> (list A)) ->
- P)%ptype
- then
- _ <- ident.unify pattern.ident.list_rect_arrow list_rect_arrow;
- x' <- base.try_make_transport_cps P b;
- x'0 <- base.try_make_transport_cps Q b18;
- x'1 <- base.try_make_transport_cps A b0;
- x'2 <- base.try_make_transport_cps A b0;
- x'3 <- base.try_make_transport_cps P b;
- x'4 <- base.try_make_transport_cps Q b18;
- x'5 <- base.try_make_transport_cps P b;
- x'6 <- base.try_make_transport_cps Q b18;
- v <- base.try_make_transport_cps A b0;
- v0 <- base.try_make_transport_cps P b;
- x'7 <- base.try_make_transport_cps b b;
- x'8 <- base.try_make_transport_cps b18 b18;
- x'9 <- base.try_make_transport_cps b0 b0;
- x'10 <- base.try_make_transport_cps b0 b0;
- x'11 <- base.try_make_transport_cps b b;
- x'12 <- base.try_make_transport_cps b18 b18;
- x'13 <- base.try_make_transport_cps b b;
- x'14 <- base.try_make_transport_cps b18 b18;
- v1 <- base.try_make_transport_cps b0 b0;
- v2 <- base.try_make_transport_cps b b;
- v3 <- base.try_make_transport_cps b18 Q;
- v4 <- base.try_make_transport_cps Q Q;
- Datatypes.Some
- (fv0 <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (#(eager_list_rect_arrow)%expr @
- ($(x'8 (x'7 (x'0 (x' x)))))%expr @
- ($(x'14
- (x'13
- (x'12
- (x'11
- (x'10
- (x'9
- (x'6
- (x'5
- (x'4 (x'3 (x'2 (x'1 x0)))))))))))))%expr @
- ($(v1 (v x1)))%expr @ ($(v2 (v0 x2)))%expr)%expr_pat;
- Base (v4 (v3 fv0)))%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end;;
- Datatypes.None);;;
- Base
- (#(list_rect_arrow)%expr @ (λ x3 : var P,
- to_expr (x ($x3)))%expr @
- (λ (x3 : var A)(x4 : var (list A))(x5 : var (P -> Q)%ptype)(x6 :
- var P),
- to_expr
- (x0 ($x3) ($x4) (fun x7 : expr P => Base ($x5 @ x7)%expr_pat)
- ($x6)))%expr @ x1 @ x2)%expr_pat)%option
-| @eager_list_rect A P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr A -> expr (list A) -> expr P -> UnderLets (expr P))
- (x1 : expr (list A)) =>
- Base
- (#(eager_list_rect)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var A)(x3 : var (list A))(x4 : var P),
- to_expr (x0 ($x2) ($x3) ($x4)))%expr @ x1)%expr_pat
-| @eager_list_rect_arrow A P Q =>
- fun (x : expr P -> UnderLets (expr Q))
- (x0 : expr A ->
- expr (list A) ->
- (expr P -> UnderLets (expr Q)) -> expr P -> UnderLets (expr Q))
- (x1 : expr (list A)) (x2 : expr P) =>
- Base
- (#(eager_list_rect_arrow)%expr @ (λ x3 : var P,
- to_expr (x ($x3)))%expr @
- (λ (x3 : var A)(x4 : var (list A))(x5 : var (P -> Q)%ptype)(x6 :
- var P),
- to_expr
- (x0 ($x3) ($x4) (fun x7 : expr P => Base ($x5 @ x7)%expr_pat) ($x6)))%expr @
- x1 @ x2)%expr_pat
-| @list_case A P =>
- fun (x : expr unit -> UnderLets (expr P))
- (x0 : expr A -> expr (list A) -> UnderLets (expr P))
- (x1 : expr (list A)) =>
- ((match x1 with
- | @expr.Ident _ _ _ t idc =>
- args <- invert_bind_args idc Raw.ident.nil;
- match
- pattern.type.unify_extracted
- (((((unit -> '2%pbtype) ->
- ('1%pbtype -> (pattern.base.type.list '1) -> '2%pbtype) ->
- (pattern.base.type.list '1) -> '2%pbtype) ->
- unit -> '2%pbtype) ->
- '1%pbtype -> (pattern.base.type.list '1) -> '2%pbtype) ->
- (pattern.base.type.list '1))%ptype
- (((((unit -> P) -> (A -> (list A) -> P) -> (list A) -> P) ->
- unit -> P) -> A -> (list A) -> P) -> (list args))%ptype
- with
- | Datatypes.Some
- (_, _, (_, (_, _), (_, _)), (_, _), (_, (_, b10)), b)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((((unit -> b10) ->
- (b -> (list b) -> b10) -> (list b) -> b10) ->
- unit -> b10) -> b -> (list b) -> b10) -> (list b))%ptype
- (((((unit -> P) -> (A -> (list A) -> P) -> (list A) -> P) ->
- unit -> P) -> A -> (list A) -> P) -> (list args))%ptype
- then
- _ <- ident.unify pattern.ident.list_case list_case;
- x' <- base.try_make_transport_cps P b10;
- _ <- base.try_make_transport_cps A b;
- _ <- base.try_make_transport_cps A b;
- _ <- base.try_make_transport_cps P b10;
- _ <- ident.unify pattern.ident.nil nil;
- x'3 <- base.try_make_transport_cps b10 b10;
- _ <- base.try_make_transport_cps b b;
- _ <- base.try_make_transport_cps b b;
- _ <- base.try_make_transport_cps b10 b10;
- v <- base.try_make_transport_cps b10 P;
- v0 <- base.try_make_transport_cps P P;
- Datatypes.Some
- (fv0 <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (($(x'3 (x' x)))%expr @ (##tt)%expr)%expr_pat;
- Base (v0 (v fv0)))%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) x3) x2 =>
- args <- invert_bind_args idc Raw.ident.cons;
- match
- pattern.type.unify_extracted
- (((((unit -> '2%pbtype) ->
- ('1%pbtype -> (pattern.base.type.list '1) -> '2%pbtype) ->
- (pattern.base.type.list '1) -> '2%pbtype) ->
- unit -> '2%pbtype) ->
- '1%pbtype -> (pattern.base.type.list '1) -> '2%pbtype) ->
- (('1%pbtype ->
- (pattern.base.type.list '1) -> (pattern.base.type.list '1)) ->
- '1%pbtype) -> (pattern.base.type.list '1))%ptype
- (((((unit -> P) -> (A -> (list A) -> P) -> (list A) -> P) ->
- unit -> P) -> A -> (list A) -> P) ->
- ((args -> (list args) -> (list args)) -> s0) -> s)%ptype
- with
- | Datatypes.Some
- (_, _, (_, (_, _), (_, _)), (_, _), (_, (_, b10)),
- (_, (_, _), _, b11))%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((((unit -> b10) ->
- (b11 -> (list b11) -> b10) -> (list b11) -> b10) ->
- unit -> b10) -> b11 -> (list b11) -> b10) ->
- ((b11 -> (list b11) -> (list b11)) -> b11) -> (list b11))%ptype
- (((((unit -> P) -> (A -> (list A) -> P) -> (list A) -> P) ->
- unit -> P) -> A -> (list A) -> P) ->
- ((args -> (list args) -> (list args)) -> s0) -> s)%ptype
- then
- _ <- ident.unify pattern.ident.list_case list_case;
- _ <- base.try_make_transport_cps P b10;
- x'0 <- base.try_make_transport_cps A b11;
- x'1 <- base.try_make_transport_cps A b11;
- x'2 <- base.try_make_transport_cps P b10;
- _ <- ident.unify pattern.ident.cons cons;
- v <- type.try_make_transport_cps s0 b11;
- v0 <- type.try_make_transport_cps s (list b11);
- _ <- base.try_make_transport_cps b10 b10;
- x'4 <- base.try_make_transport_cps b11 b11;
- x'5 <- base.try_make_transport_cps b11 b11;
- x'6 <- base.try_make_transport_cps b10 b10;
- v1 <- base.try_make_transport_cps b11 b11;
- v2 <- base.try_make_transport_cps b11 b11;
- v3 <- base.try_make_transport_cps b10 P;
- v4 <- base.try_make_transport_cps P P;
- Datatypes.Some
- (fv1 <-- Reify.expr_value_to_rewrite_rule_replacement
- (@Compile.reflect_ident_iota var) false
- (($(x'6 (x'5 (x'4 (x'2 (x'1 (x'0 x0)))))))%expr @
- ($(v1 (v (Compile.reflect x3))))%expr @
- ($(v2 (v0 (Compile.reflect x2))))%expr)%expr_pat;
- Base (v4 (v3 fv1)))%under_lets
- else Datatypes.None
- | Datatypes.None => Datatypes.None
- end
- | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ ($_)%expr _) _ | @expr.App
- _ _ _ s _ (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _) _ |
- @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ (_ @ _)%expr_pat _) _ |
- @expr.App _ _ _ s _
- (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _) _ =>
- Datatypes.None
- | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr
- _ | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s
- _ (@expr.LetIn _ _ _ _ _ _ _) _ => Datatypes.None
- | _ => Datatypes.None
- end;;
- Datatypes.None);;;
- Base
- (#(list_case)%expr @ (λ x2 : var unit,
- to_expr (x ($x2)))%expr @
- (λ (x2 : var A)(x3 : var (list A)),
- to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat)%option
-| @List_length T =>
- fun x : expr (list T) =>
- ((match
- pattern.type.unify_extracted
- (((pattern.base.type.list '1) -> ℕ) -> (pattern.base.type.list '1))%ptype
- (((list T) -> ℕ) -> (list T))%ptype
- with
- | Datatypes.Some (_, _, b)%zrange =>
- if
- type.type_beq base.type base.type.type_beq
- (((list b) -> ℕ) -> (list b))%ptype
- (((list T) -> ℕ) -> (list T))%ptype
- then
- _ <- ident.unify pattern.ident.List_length List_length;
- v <- base.try_make_transport_cps T b;
- v0 <- base.try_make_transport_cps b b;
- Datatypes.Some
- (fv0 <-- Reify.expr_value_to_rewrite_rule_replacement<