From 152094f4d9d83e4a5689536e0cd68d4f006517e1 Mon Sep 17 00:00:00 2001 From: Jason Gross Date: Tue, 24 Jul 2018 17:19:27 -0400 Subject: Improve rewriter speed Andres and I met today, and discovered that there's a source of non-linear complexity in the rewriter which is not type casts. In adding side-conditions to the rewrite rules (which are not discussed in the pattern-matching compilation paper), I represented them by allowing rewrite rules to fail. So, for example, # + x ~~> x (when # == 0) is represented as # + x ~~> if (# =? 0) then Some x else None In the case that a rewrite rule fails, we need to try all other rewrite rules that might still apply. However, doing this in the naive-CPS way leads to non-linear blowup, because wildcard rewrite rules get duplicated in the failure branches. (This is similar to the issue that `match x with "some string" => true | _ => false end%string` will generate a large number of "false" branches, and duplicate "false" across all of them, rather than having a single default case.) For example, if we had the rewrite rules # + # ~~> literal sum x + (-y) ~~> x - y (-x) + y ~~> y - x then the compiled code would look like fun x y => if x is a literal then if y is a literal then literal sum else if y is an opp then x - y else x + y else if y is an opp then x - y else if x is an opp then y - x else x + y where we actually want the code fun x y => if x is a literal then if y is a literal then return (literal sum); if y is an opp then return (x - y); if x is an opp then return (y - x); return (x + y) in the sequence+return monad. i.e., we want to not duplicate the "if y is an opp" code multiple times. I think the solution to this is to have the discrimination tree evaluator return an option, and to have the function that computes the discrimination tree not duplicate rewrite rules among different cases. Note that this leads to slightly inefficient matching sometimes: when two rules with the same structure are separated by a rule with a wildcard instead of structure, we will now try to match on the structure twice. It might be useful to be able to denote that some rewrite rules can be commuted. After | File Name | Before || Change | % Change ---------------------------------------------------------------------------------------------------------------------- 40m35.83s | Total | 30m00.99s || +10m34.84s | +35.24% ---------------------------------------------------------------------------------------------------------------------- 21m46.37s | Experiments/NewPipeline/SlowPrimeSynthesisExamples | 6m01.39s || +15m44.97s | +261.48% 6m37.40s | p384_32.c | 0m22.47s || +6m14.92s | +1668.58% 0m18.00s | Experiments/NewPipeline/Rewriter | 5m16.50s || -4m58.50s | -94.31% 0m30.49s | Experiments/NewPipeline/ExtractionHaskell/unsaturated_solinas | 1m54.20s || -1m23.71s | -73.30% 0m27.41s | Experiments/NewPipeline/ExtractionHaskell/saturated_solinas | 1m39.40s || -1m11.99s | -72.42% 0m47.78s | Experiments/NewPipeline/ExtractionHaskell/word_by_word_montgomery | 1m54.50s || -1m06.71s | -58.27% 0m40.28s | Experiments/NewPipeline/ExtractionOCaml/word_by_word_montgomery | 1m23.77s || -0m43.48s | -51.91% 0m15.21s | Experiments/NewPipeline/ExtractionOCaml/saturated_solinas | 0m55.86s || -0m40.64s | -72.77% 0m23.39s | Experiments/NewPipeline/ExtractionOCaml/unsaturated_solinas | 1m00.22s || -0m36.82s | -61.15% 0m21.85s | p256_32.c | 0m04.01s || +0m17.84s | +444.88% 0m20.97s | secp256k1_32.c | 0m03.26s || +0m17.71s | +543.25% 0m04.60s | Experiments/NewPipeline/ExtractionOCaml/saturated_solinas.ml | 0m20.33s || -0m15.72s | -77.37% 0m09.48s | Experiments/NewPipeline/ExtractionOCaml/word_by_word_montgomery.ml | 0m23.28s || -0m13.80s | -59.27% 1m33.63s | Experiments/NewPipeline/Toplevel2 | 1m45.56s || -0m11.93s | -11.30% 0m08.29s | Experiments/NewPipeline/ExtractionOCaml/unsaturated_solinas.ml | 0m18.64s || -0m10.35s | -55.52% 0m05.93s | Experiments/NewPipeline/ExtractionHaskell/word_by_word_montgomery.hs | 0m16.74s || -0m10.80s | -64.57% 0m32.41s | p521_64.c | 0m41.42s || -0m09.01s | -21.75% 0m04.93s | Experiments/NewPipeline/ExtractionHaskell/unsaturated_solinas.hs | 0m14.92s || -0m09.99s | -66.95% 0m04.40s | Experiments/NewPipeline/ExtractionHaskell/saturated_solinas.hs | 0m12.57s || -0m08.16s | -64.99% 0m08.52s | p224_32.c | 0m01.95s || +0m06.56s | +336.92% 0m13.99s | p384_64.c | 0m10.64s || +0m03.34s | +31.48% 4m07.13s | Experiments/NewPipeline/Toplevel1 | 4m05.83s || +0m01.29s | +0.52% 0m38.96s | p521_32.c | 0m40.09s || -0m01.13s | -2.81% 0m02.28s | p224_64.c | 0m01.66s || +0m00.61s | +37.34% 0m02.27s | curve25519_32.c | 0m01.98s || +0m00.29s | +14.64% 0m01.78s | p256_64.c | 0m01.65s || +0m00.13s | +7.87% 0m01.70s | secp256k1_64.c | 0m01.96s || -0m00.26s | -13.26% 0m01.65s | curve25519_64.c | 0m01.51s || +0m00.13s | +9.27% 0m01.37s | Experiments/NewPipeline/CLI | 0m01.26s || +0m00.11s | +8.73% 0m01.15s | Experiments/NewPipeline/StandaloneHaskellMain | 0m01.21s || -0m00.06s | -4.95% 0m01.14s | Experiments/NewPipeline/StandaloneOCamlMain | 0m01.16s || -0m00.02s | -1.72% 0m01.07s | Experiments/NewPipeline/CompilersTestCases | 0m01.05s || +0m00.02s | +1.90% --- src/Experiments/NewPipeline/Rewriter.v | 134 +- src/Experiments/NewPipeline/arith_rewrite_head.out | 20935 +++------- src/Experiments/NewPipeline/fancy_rewrite_head.out | 37776 +++---------------- src/Experiments/NewPipeline/nbe_rewrite_head.out | 1705 +- 4 files changed, 9657 insertions(+), 50893 deletions(-) (limited to 'src/Experiments') diff --git a/src/Experiments/NewPipeline/Rewriter.v b/src/Experiments/NewPipeline/Rewriter.v index f9f6e22ac..dd898bc3e 100644 --- a/src/Experiments/NewPipeline/Rewriter.v +++ b/src/Experiments/NewPipeline/Rewriter.v @@ -8,6 +8,7 @@ Require Crypto.Util.PrimitiveHList. Require Import Crypto.Experiments.NewPipeline.Language. Require Import Crypto.Experiments.NewPipeline.UnderLets. Require Import Crypto.Experiments.NewPipeline.GENERATEDIdentifiersWithoutTypes. +Require Import Crypto.Util.LetIn. Require Import Crypto.Util.Notations. Import ListNotations. Local Open Scope bool_scope. Local Open Scope Z_scope. @@ -425,42 +426,49 @@ Module Compilers. => match ctx with | nil => cont None ctx None | ctx0 :: ctx' - => let default _ := @eval_decision_tree T ctx default_case cont in - reveal_rawexpr_cps - ctx0 _ - (fun ctx0' - => match ctx0' with - | rIdent t idc t' alt - => fold_right - (fun '(pidc, icase) default 'tt - => match invert_bind_args _ idc pidc with - | Some args + => let default := fun 'tt => @eval_decision_tree T ctx default_case cont in + let bind_default_in f + := match default_case with + | Failure => f default + | _ => (dlet default := default in f default) + end in + bind_default_in + (fun default + => reveal_rawexpr_cps + ctx0 _ + (fun ctx0' + => match ctx0' with + | rIdent t idc t' alt + => fold_right + (fun '(pidc, icase) default 'tt + => match invert_bind_args _ idc pidc with + | Some args + => @eval_decision_tree + T ctx' icase + (fun k ctx'' + => cont k (rIdent (pident_to_typed pidc args) alt :: ctx'')) + | None => default tt + end) + default + icases + tt + | rApp f x t alt + => match app_case with + | Some app_case => @eval_decision_tree - T ctx' icase + T (f :: x :: ctx') app_case (fun k ctx'' - => cont k (rIdent (pident_to_typed pidc args) alt :: ctx'')) + => match ctx'' with + | f' :: x' :: ctx''' + => cont k (rApp f' x' alt :: ctx''') + | _ => cont None ctx + end) | None => default tt - end) - default - icases - tt - | rApp f x t alt - => match app_case with - | Some app_case - => @eval_decision_tree - T (f :: x :: ctx') app_case - (fun k ctx'' - => match ctx'' with - | f' :: x' :: ctx''' - => cont k (rApp f' x' alt :: ctx''') - | _ => cont None ctx - end) - | None => default tt - end - | rExpr t e - | rValue t e - => default tt - end) + end + | rExpr t e + | rValue t e + => default tt + end)) end | Swap i d' => match swap_list 0 i ctx with @@ -499,7 +507,8 @@ Module Compilers. (rew : rewrite_rulesT) (e : rawexpr) : UnderLets (expr (type_of_rawexpr e)) - := eval_decision_tree + := dlet default := UnderLets.Base (expr_of_rawexpr e) in + eval_decision_tree (e::nil) d (fun k ctx default_on_rewrite_failure => match k, ctx return UnderLets (expr (type_of_rawexpr e)) with @@ -523,18 +532,18 @@ Module Compilers. => match fv', default_on_rewrite_failure with | Some fv'', _ => UnderLets.Base fv'' | None, Some default => default tt - | None, None => UnderLets.Base (expr_of_rawexpr e) + | None, None => default end))%under_lets | None => match default_on_rewrite_failure with | Some default => default tt - | None => UnderLets.Base (expr_of_rawexpr e) + | None => default end end) - | None => UnderLets.Base (expr_of_rawexpr e) + | None => default end) - | None => UnderLets.Base (expr_of_rawexpr e) + | None => default end - | _, _ => UnderLets.Base (expr_of_rawexpr e) + | _, _ => default end). Local Notation enumerate ls @@ -558,12 +567,20 @@ Module Compilers. end) (enumerate p). + Definition starts_with_wildcard : nat * list pattern -> bool + := fun '(_, p) => match p with + | pattern.Wildcard _::_ => true + | _ => false + end. + + Definition not_starts_with_wildcard : nat * list pattern -> bool + := fun p => negb (starts_with_wildcard p). + Definition filter_pattern_wildcard (p : list (nat * list pattern)) : list (nat * list pattern) - := filter (fun '(_, p) => match p with - | pattern.Wildcard _::_ => true - | _ => false - end) - p. + := filter starts_with_wildcard p. + + Definition split_at_first_pattern_wildcard (p : list (nat * list pattern)) : list (nat * list pattern) * list (nat * list pattern) + := (take_while not_starts_with_wildcard p, drop_while not_starts_with_wildcard p). Fixpoint get_unique_pattern_ident' (p : list (nat * list pattern)) (so_far : list pident) : list pident := match p with @@ -592,25 +609,23 @@ Module Compilers. end) p. - Definition refine_pattern_app (p : nat * list pattern) : option (nat * list pattern) + Definition filter_pattern_app (p : nat * list pattern) : option (nat * list pattern) := match p with - | (n, pattern.Wildcard d::ps) - => Some (n, (??{?? -> d} :: ?? :: ps)%list%pattern) | (n, pattern.App f x :: ps) => Some (n, f :: x :: ps) | (_, pattern.Ident _::_) + | (_, pattern.Wildcard _::_) | (_, nil) => None end. - Definition refine_pattern_pident (pidc : pident) (p : nat * list pattern) : option (nat * list pattern) + Definition filter_pattern_pident (pidc : pident) (p : nat * list pattern) : option (nat * list pattern) := match p with - | (n, pattern.Wildcard _::ps) - => Some (n, ps) | (n, pattern.Ident pidc'::ps) => if pident_beq pidc pidc' then Some (n, ps) else None + | (_, pattern.Wildcard _::_) | (_, pattern.App _ _::_) | (_, nil) => None @@ -628,13 +643,14 @@ Module Compilers. => (onfailure <- compile_rewrites ps; Some (TryLeaf n1 onfailure)) | Some Datatypes.O - => default_case <- compile_rewrites (filter_pattern_wildcard pattern_matrix); + => let '(pattern_matrix, default_pattern_matrix) := split_at_first_pattern_wildcard pattern_matrix in + default_case <- compile_rewrites default_pattern_matrix; app_case <- (if contains_pattern_app pattern_matrix - then option_map Some (compile_rewrites (Option.List.map refine_pattern_app pattern_matrix)) + then option_map Some (compile_rewrites (Option.List.map filter_pattern_app pattern_matrix)) else Some None); let pidcs := get_unique_pattern_ident pattern_matrix in let icases := Option.List.map - (fun pidc => option_map (pair pidc) (compile_rewrites (Option.List.map (refine_pattern_pident pidc) pattern_matrix))) + (fun pidc => option_map (pair pidc) (compile_rewrites (Option.List.map (filter_pattern_pident pidc) pattern_matrix))) pidcs in Some (Switch icases app_case default_case) | Some i @@ -1724,6 +1740,7 @@ Z.mul @@ (?x >> 128, ?y >> 128) --> mulhh @@ (x, y) := Eval cbv -[fancy_pr2_rewrite_rules base.interp base.try_make_transport_cps type.try_make_transport_cps type.try_transport_cps + Let_In UnderLets.splice UnderLets.to_expr Compile.reflect Compile.reify Compile.reify_and_let_binds_cps UnderLets.reify_and_let_binds_base_cps Compile.value' SubstVarLike.is_var_fst_snd_pair_opp @@ -1787,6 +1804,9 @@ Z.mul @@ (?x >> 128, ?y >> 128) --> mulhh @@ (x, y) ] in fancy_rewrite_head2. (* Finished transaction in 13.298 secs (13.283u,0.s) (successful) *) + Local Set Printing Depth 1000000. + Local Set Printing Width 200. + Local Notation "'llet' x := v 'in' f" := (Let_In v (fun x => f)). Redirect "/tmp/fancy_rewrite_head" Print fancy_rewrite_head. End red_fancy. @@ -1800,6 +1820,7 @@ Z.mul @@ (?x >> 128, ?y >> 128) --> mulhh @@ (x, y) := Eval cbv -[nbe_pr2_rewrite_rules base.interp base.try_make_transport_cps type.try_make_transport_cps type.try_transport_cps + Let_In UnderLets.splice UnderLets.to_expr Compile.reflect UnderLets.reify_and_let_binds_base_cps Compile.reify Compile.reify_and_let_binds_cps Compile.value' @@ -1864,6 +1885,9 @@ Z.mul @@ (?x >> 128, ?y >> 128) --> mulhh @@ (x, y) ] in nbe_rewrite_head2. (* Finished transaction in 16.561 secs (16.54u,0.s) (successful) *) + Local Set Printing Depth 1000000. + Local Set Printing Width 200. + Local Notation "'llet' x := v 'in' f" := (Let_In v (fun x => f)). Redirect "/tmp/nbe_rewrite_head" Print nbe_rewrite_head. End red_nbe. @@ -1877,6 +1901,7 @@ Z.mul @@ (?x >> 128, ?y >> 128) --> mulhh @@ (x, y) := Eval cbv -[arith_pr2_rewrite_rules base.interp base.try_make_transport_cps type.try_make_transport_cps type.try_transport_cps + Let_In UnderLets.splice UnderLets.to_expr Compile.reflect UnderLets.reify_and_let_binds_base_cps Compile.reify Compile.reify_and_let_binds_cps Compile.value' @@ -1941,6 +1966,9 @@ Z.mul @@ (?x >> 128, ?y >> 128) --> mulhh @@ (x, y) ] in arith_rewrite_head2. (* Finished transaction in 16.561 secs (16.54u,0.s) (successful) *) + Local Set Printing Depth 1000000. + Local Set Printing Width 200. + Local Notation "'llet' x := v 'in' f" := (Let_In v (fun x => f)). Redirect "/tmp/arith_rewrite_head" Print arith_rewrite_head. End red_arith. diff --git a/src/Experiments/NewPipeline/arith_rewrite_head.out b/src/Experiments/NewPipeline/arith_rewrite_head.out index 23b5205d2..994eaa810 100644 --- a/src/Experiments/NewPipeline/arith_rewrite_head.out +++ b/src/Experiments/NewPipeline/arith_rewrite_head.out @@ -8,39 +8,57 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.UnderLets base.type ident var (defaults.expr (type.base t0))) with - | base.type.unit => fun v0 : unit => UnderLets.Base ##(v0)%expr - | base.type.Z => fun v0 : Z => UnderLets.Base ##(v0)%expr - | base.type.bool => fun v0 : bool => UnderLets.Base ##(v0)%expr - | base.type.nat => fun v0 : nat => UnderLets.Base ##(v0)%expr + | base.type.unit => + fun v0 : unit => llet default := UnderLets.Base ##(v0)%expr in + default + | base.type.Z => + fun v0 : Z => llet default := UnderLets.Base ##(v0)%expr in + default + | base.type.bool => + fun v0 : bool => llet default := UnderLets.Base ##(v0)%expr in + default + | base.type.nat => + fun v0 : nat => llet default := UnderLets.Base ##(v0)%expr in + default end v | ident.Nat_succ => fun x : defaults.expr (type.base base.type.nat) => - UnderLets.Base (#(ident.Nat_succ)%expr @ x)%expr_pat + llet default := UnderLets.Base (#(ident.Nat_succ)%expr @ x)%expr_pat in + default | ident.Nat_pred => fun x : defaults.expr (type.base base.type.nat) => - UnderLets.Base (#(ident.Nat_pred)%expr @ x)%expr_pat + llet default := UnderLets.Base (#(ident.Nat_pred)%expr @ x)%expr_pat in + default | ident.Nat_max => fun x x0 : defaults.expr (type.base base.type.nat) => - UnderLets.Base (#(ident.Nat_max)%expr @ x @ x0)%expr_pat + llet default := UnderLets.Base (#(ident.Nat_max)%expr @ x @ x0)%expr_pat in + default | ident.Nat_mul => fun x x0 : defaults.expr (type.base base.type.nat) => - UnderLets.Base (#(ident.Nat_mul)%expr @ x @ x0)%expr_pat + llet default := UnderLets.Base (#(ident.Nat_mul)%expr @ x @ x0)%expr_pat in + default | ident.Nat_add => fun x x0 : defaults.expr (type.base base.type.nat) => - UnderLets.Base (#(ident.Nat_add)%expr @ x @ x0)%expr_pat + llet default := UnderLets.Base (#(ident.Nat_add)%expr @ x @ x0)%expr_pat in + default | ident.Nat_sub => fun x x0 : defaults.expr (type.base base.type.nat) => - UnderLets.Base (#(ident.Nat_sub)%expr @ x @ x0)%expr_pat -| @ident.nil t => UnderLets.Base []%expr_pat + llet default := UnderLets.Base (#(ident.Nat_sub)%expr @ x @ x0)%expr_pat in + default +| @ident.nil t => llet default := UnderLets.Base []%expr_pat in + default | @ident.cons t => fun (x : defaults.expr (type.base t)) (x0 : defaults.expr (type.base (base.type.list t))) => - UnderLets.Base (x :: x0)%expr_pat + llet default := UnderLets.Base (x :: x0)%expr_pat in + default | @ident.pair A B => fun (x : defaults.expr (type.base A)) (x0 : defaults.expr (type.base B)) - => UnderLets.Base (x, x0)%expr_pat + => llet default := UnderLets.Base (x, x0)%expr_pat in + default | @ident.fst A B => fun x : defaults.expr (type.base (A * B)%etype) => + llet default := UnderLets.Base (#(ident.fst)%expr @ x)%expr_pat in match x with | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ #(idc)%expr_pat x1) x0 => match @@ -79,32 +97,30 @@ match idc in (ident t) return (Compile.value' true t) with defaults.expr (type.base A)) => match a with | Some x' => UnderLets.Base (x' v) - | None => - UnderLets.Base (#(ident.fst)%expr @ x)%expr_pat + | None => default end) | (s1 -> d1)%ptype => fun _ : Compile.value' false s1 -> Compile.value' true d1 - => UnderLets.Base (#(ident.fst)%expr @ x)%expr_pat + => default end (Compile.reflect x0) | (s1 -> d1)%ptype => fun _ : Compile.value' false s1 -> Compile.value' true d1 => - UnderLets.Base (#(ident.fst)%expr @ x)%expr_pat + default end (Compile.reflect x1) - | None => UnderLets.Base (#(ident.fst)%expr @ x)%expr_pat + | None => default 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 _ _ _ _ _ _ _) _) _ => - UnderLets.Base (#(ident.fst)%expr @ x)%expr_pat + s _ (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _) _ => default | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (#(ident.fst)%expr @ x)%expr_pat - | _ => UnderLets.Base (#(ident.fst)%expr @ x)%expr_pat + (@expr.LetIn _ _ _ _ _ _ _) _ => default + | _ => default end | @ident.snd A B => fun x : defaults.expr (type.base (A * B)%etype) => + llet default := UnderLets.Base (#(ident.snd)%expr @ x)%expr_pat in match x with | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ #(idc)%expr_pat x1) x0 => match @@ -143,29 +159,26 @@ match idc in (ident t) return (Compile.value' true t) with defaults.expr (type.base B)) => match a with | Some x' => UnderLets.Base (x' v0) - | None => - UnderLets.Base (#(ident.snd)%expr @ x)%expr_pat + | None => default end) | (s1 -> d1)%ptype => fun _ : Compile.value' false s1 -> Compile.value' true d1 - => UnderLets.Base (#(ident.snd)%expr @ x)%expr_pat + => default end (Compile.reflect x0) | (s1 -> d1)%ptype => fun _ : Compile.value' false s1 -> Compile.value' true d1 => - UnderLets.Base (#(ident.snd)%expr @ x)%expr_pat + default end (Compile.reflect x1) - | None => UnderLets.Base (#(ident.snd)%expr @ x)%expr_pat + | None => default 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 _ _ _ _ _ _ _) _) _ => - UnderLets.Base (#(ident.snd)%expr @ x)%expr_pat + s _ (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _) _ => default | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (#(ident.snd)%expr @ x)%expr_pat - | _ => UnderLets.Base (#(ident.snd)%expr @ x)%expr_pat + (@expr.LetIn _ _ _ _ _ _ _) _ => default + | _ => default end | @ident.prod_rect A B T => fun @@ -174,10 +187,11 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.UnderLets base.type ident var (defaults.expr (type.base T))) (x0 : defaults.expr (type.base (A * B)%etype)) => - UnderLets.Base - (#(ident.prod_rect)%expr @ - (λ (x1 : var (type.base A))(x2 : var (type.base B)), - UnderLets.to_expr (x ($x1) ($x2)))%expr @ x0)%expr_pat + llet default := UnderLets.Base + (#(ident.prod_rect)%expr @ + (λ (x1 : var (type.base A))(x2 : var (type.base B)), + UnderLets.to_expr (x ($x1) ($x2)))%expr @ x0)%expr_pat in + default | @ident.bool_rect T => fun (x @@ -185,12 +199,13 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.UnderLets base.type ident var (defaults.expr (type.base T))) (x1 : defaults.expr (type.base base.type.bool)) => - UnderLets.Base - (#(ident.bool_rect)%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x2)))%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x0 ($x2)))%expr @ x1)%expr_pat + llet default := UnderLets.Base + (#(ident.bool_rect)%expr @ + (λ x2 : var (type.base base.type.unit), + UnderLets.to_expr (x ($x2)))%expr @ + (λ x2 : var (type.base base.type.unit), + UnderLets.to_expr (x0 ($x2)))%expr @ x1)%expr_pat in + default | @ident.nat_rect P => fun (x : defaults.expr (type.base base.type.unit) -> @@ -201,12 +216,15 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.UnderLets base.type ident var (defaults.expr (type.base P))) (x1 : defaults.expr (type.base base.type.nat)) => - UnderLets.Base - (#(ident.nat_rect)%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x2)))%expr @ - (λ (x2 : var (type.base base.type.nat))(x3 : var (type.base P)), - UnderLets.to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat + llet default := UnderLets.Base + (#(ident.nat_rect)%expr @ + (λ x2 : var (type.base base.type.unit), + UnderLets.to_expr (x ($x2)))%expr @ + (λ (x2 : var (type.base base.type.nat))(x3 : var + (type.base + P)), + UnderLets.to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat in + default | @ident.nat_rect_arrow P Q => fun (x : defaults.expr (type.base P) -> @@ -221,18 +239,22 @@ match idc in (ident t) return (Compile.value' true t) with (defaults.expr (type.base Q))) (x1 : defaults.expr (type.base base.type.nat)) (x2 : defaults.expr (type.base P)) => - UnderLets.Base - (#(ident.nat_rect_arrow)%expr @ - (λ x3 : var (type.base P), - UnderLets.to_expr (x ($x3)))%expr @ - (λ (x3 : var (type.base base.type.nat))(x4 : var - (type.base P -> - type.base Q)%ptype) - (x5 : var (type.base P)), - UnderLets.to_expr - (x0 ($x3) - (fun x6 : defaults.expr (type.base P) => - UnderLets.Base ($x4 @ x6)%expr_pat) ($x5)))%expr @ x1 @ x2)%expr_pat + llet default := UnderLets.Base + (#(ident.nat_rect_arrow)%expr @ + (λ x3 : var (type.base P), + UnderLets.to_expr (x ($x3)))%expr @ + (λ (x3 : var (type.base base.type.nat))(x4 : var + (type.base + P -> + type.base + Q)%ptype) + (x5 : var (type.base P)), + UnderLets.to_expr + (x0 ($x3) + (fun x6 : defaults.expr (type.base P) => + UnderLets.Base ($x4 @ x6)%expr_pat) ($x5)))%expr @ + x1 @ x2)%expr_pat in + default | @ident.list_rect A P => fun (x : defaults.expr (type.base base.type.unit) -> @@ -244,13 +266,19 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.UnderLets base.type ident var (defaults.expr (type.base P))) (x1 : defaults.expr (type.base (base.type.list A))) => - UnderLets.Base - (#(ident.list_rect)%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x2)))%expr @ - (λ (x2 : var (type.base A))(x3 : var (type.base (base.type.list A))) - (x4 : var (type.base P)), - UnderLets.to_expr (x0 ($x2) ($x3) ($x4)))%expr @ x1)%expr_pat + llet default := UnderLets.Base + (#(ident.list_rect)%expr @ + (λ x2 : var (type.base base.type.unit), + UnderLets.to_expr (x ($x2)))%expr @ + (λ (x2 : var (type.base A))(x3 : var + (type.base + (base.type.list + A)))(x4 : + var + (type.base + P)), + UnderLets.to_expr (x0 ($x2) ($x3) ($x4)))%expr @ x1)%expr_pat in + default | @ident.list_case A P => fun (x : defaults.expr (type.base base.type.unit) -> @@ -261,70 +289,89 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.UnderLets base.type ident var (defaults.expr (type.base P))) (x1 : defaults.expr (type.base (base.type.list A))) => - UnderLets.Base - (#(ident.list_case)%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x2)))%expr @ - (λ (x2 : var (type.base A))(x3 : var (type.base (base.type.list A))), - UnderLets.to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat + llet default := UnderLets.Base + (#(ident.list_case)%expr @ + (λ x2 : var (type.base base.type.unit), + UnderLets.to_expr (x ($x2)))%expr @ + (λ (x2 : var (type.base A))(x3 : var + (type.base + (base.type.list + A))), + UnderLets.to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat in + default | @ident.List_length T => fun x : defaults.expr (type.base (base.type.list T)) => - UnderLets.Base (#(ident.List_length)%expr @ x)%expr_pat + llet default := UnderLets.Base (#(ident.List_length)%expr @ x)%expr_pat in + default | ident.List_seq => fun x x0 : defaults.expr (type.base base.type.nat) => - UnderLets.Base (#(ident.List_seq)%expr @ x @ x0)%expr_pat + llet default := UnderLets.Base (#(ident.List_seq)%expr @ x @ x0)%expr_pat in + default | @ident.List_firstn A => fun (x : defaults.expr (type.base base.type.nat)) (x0 : defaults.expr (type.base (base.type.list A))) => - UnderLets.Base (#(ident.List_firstn)%expr @ x @ x0)%expr_pat + llet default := UnderLets.Base + (#(ident.List_firstn)%expr @ x @ x0)%expr_pat in + default | @ident.List_skipn A => fun (x : defaults.expr (type.base base.type.nat)) (x0 : defaults.expr (type.base (base.type.list A))) => - UnderLets.Base (#(ident.List_skipn)%expr @ x @ x0)%expr_pat + llet default := UnderLets.Base + (#(ident.List_skipn)%expr @ x @ x0)%expr_pat in + default | @ident.List_repeat A => fun (x : defaults.expr (type.base A)) (x0 : defaults.expr (type.base base.type.nat)) => - UnderLets.Base (#(ident.List_repeat)%expr @ x @ x0)%expr_pat + llet default := UnderLets.Base + (#(ident.List_repeat)%expr @ x @ x0)%expr_pat in + default | @ident.List_combine A B => fun (x : defaults.expr (type.base (base.type.list A))) (x0 : defaults.expr (type.base (base.type.list B))) => - UnderLets.Base (#(ident.List_combine)%expr @ x @ x0)%expr_pat + llet default := UnderLets.Base + (#(ident.List_combine)%expr @ x @ x0)%expr_pat in + default | @ident.List_map A B => fun (x : defaults.expr (type.base A) -> UnderLets.UnderLets base.type ident var (defaults.expr (type.base B))) (x0 : defaults.expr (type.base (base.type.list A))) => - UnderLets.Base - (#(ident.List_map)%expr @ - (λ x1 : var (type.base A), - UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat + llet default := UnderLets.Base + (#(ident.List_map)%expr @ + (λ x1 : var (type.base A), + UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat in + default | @ident.List_app A => fun x x0 : defaults.expr (type.base (base.type.list A)) => - UnderLets.Base (x ++ x0)%expr + llet default := UnderLets.Base (x ++ x0)%expr in + default | @ident.List_rev A => fun x : defaults.expr (type.base (base.type.list A)) => - UnderLets.Base (#(ident.List_rev)%expr @ x)%expr_pat + llet default := UnderLets.Base (#(ident.List_rev)%expr @ x)%expr_pat in + default | @ident.List_flat_map A B => fun (x : defaults.expr (type.base A) -> UnderLets.UnderLets base.type ident var (defaults.expr (type.base (base.type.list B)))) (x0 : defaults.expr (type.base (base.type.list A))) => - UnderLets.Base - (#(ident.List_flat_map)%expr @ - (λ x1 : var (type.base A), - UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat + llet default := UnderLets.Base + (#(ident.List_flat_map)%expr @ + (λ x1 : var (type.base A), + UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat in + default | @ident.List_partition A => fun (x : defaults.expr (type.base A) -> UnderLets.UnderLets base.type ident var (defaults.expr (type.base base.type.bool))) (x0 : defaults.expr (type.base (base.type.list A))) => - UnderLets.Base - (#(ident.List_partition)%expr @ - (λ x1 : var (type.base A), - UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat + llet default := UnderLets.Base + (#(ident.List_partition)%expr @ + (λ x1 : var (type.base A), + UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat in + default | @ident.List_fold_right A B => fun (x : defaults.expr (type.base B) -> @@ -333,533 +380,438 @@ match idc in (ident t) return (Compile.value' true t) with (defaults.expr (type.base A))) (x0 : defaults.expr (type.base A)) (x1 : defaults.expr (type.base (base.type.list B))) => - UnderLets.Base - (#(ident.List_fold_right)%expr @ - (λ (x2 : var (type.base B))(x3 : var (type.base A)), - UnderLets.to_expr (x ($x2) ($x3)))%expr @ x0 @ x1)%expr_pat + llet default := UnderLets.Base + (#(ident.List_fold_right)%expr @ + (λ (x2 : var (type.base B))(x3 : var (type.base A)), + UnderLets.to_expr (x ($x2) ($x3)))%expr @ x0 @ x1)%expr_pat in + default | @ident.List_update_nth T => fun (x : defaults.expr (type.base base.type.nat)) (x0 : defaults.expr (type.base T) -> UnderLets.UnderLets base.type ident var (defaults.expr (type.base T))) (x1 : defaults.expr (type.base (base.type.list T))) => - UnderLets.Base - (#(ident.List_update_nth)%expr @ x @ - (λ x2 : var (type.base T), - UnderLets.to_expr (x0 ($x2)))%expr @ x1)%expr_pat + llet default := UnderLets.Base + (#(ident.List_update_nth)%expr @ x @ + (λ x2 : var (type.base T), + UnderLets.to_expr (x0 ($x2)))%expr @ x1)%expr_pat in + default | @ident.List_nth_default T => fun (x : defaults.expr (type.base T)) (x0 : defaults.expr (type.base (base.type.list T))) (x1 : defaults.expr (type.base base.type.nat)) => - UnderLets.Base (#(ident.List_nth_default)%expr @ x @ x0 @ x1)%expr_pat + llet default := UnderLets.Base + (#(ident.List_nth_default)%expr @ x @ x0 @ x1)%expr_pat in + default | ident.Z_add => fun x x0 : defaults.expr (type.base base.type.Z) => - match x with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match t0 as t1 return (base.base_interp t1 -> option Z) with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args =? 0 - then UnderLets.Base x0 - else - match x0 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - if args0 =? 0 - then UnderLets.Base x - else UnderLets.Base (x + x0)%expr - | None => UnderLets.Base (x + x0)%expr - end - | @expr.App _ _ _ s _ #(idc0)%expr_pat x1 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - if args >? 0 - then UnderLets.Base (##(args) - x' v)%expr - else - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - if args - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t4 => - fun - v1 : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr - (type.base t1)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : option + llet default := UnderLets.Base (x + x0)%expr in + llet default0 := fun 'tt => + llet default0 := fun 'tt => + llet default0 := fun 'tt => + match x0 with + | @expr.App _ _ _ s _ + #(idc)%expr_pat + x1 => + match + match idc with + | ident.Z_opp => + Some tt + | _ => None + end + with + | Some _ => + match + s as t2 + return + (Compile.value' + false t2 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base + t2 => + fun + v : + defaults.expr + (type.base + t2) => + base.try_make_transport_cps + (fun + t0 : base.type + => + defaults.expr + (type.base + t0)) t2 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a : + option + (defaults.expr + (type.base + t2) -> + defaults.expr + (type.base + base.type.Z)) + => + match + a + with + | Some + x' => + UnderLets.Base + (x - x' v)%expr + | None => + default + end) + | (s0 -> d0)%ptype => + fun + _ : + Compile.value' + false s0 -> + Compile.value' + true d0 + => default + end + (Compile.reflect + x1) + | None => default + end + | @expr.App _ _ _ s _ + ($_)%expr _ | + @expr.App _ _ _ s _ + (@expr.Abs _ _ _ _ _ + _) _ | @expr.App _ + _ _ s _ + (_ @ _)%expr_pat _ | + @expr.App _ _ _ s _ + (@expr.LetIn _ _ _ _ + _ _ _) _ => default + | _ => default + end in + match x with + | @expr.App _ _ _ s _ #(idc)%expr_pat + x1 => + match + match idc with + | ident.Z_opp => Some tt + | _ => None + end + with + | Some _ => + match + s as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base t2 => + fun + v : defaults.expr + (type.base t2) => + base.try_make_transport_cps + (fun t0 : base.type => + defaults.expr + (type.base t0)) t2 + base.type.Z + (UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a : option (defaults.expr - (type.base t4) -> + (type.base t2) -> defaults.expr (type.base base.type.Z)) - => - match a1 with - | Some x'1 => - UnderLets.Base - (x - x'1 v1)%expr - | None => - UnderLets.Base - (x + x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false - s0 -> - Compile.value' true d0 - => - UnderLets.Base (x + x0)%expr - end (Compile.reflect x1) - | None => - UnderLets.Base (x + x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x + x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x + x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x + x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x + x0)%expr - end - | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ - (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ - (_ @ _)%expr_pat _ | @expr.App _ _ _ s _ - (@expr.LetIn _ _ _ _ _ _ _) _ => UnderLets.Base (x + x0)%expr - | _ => UnderLets.Base (x + x0)%expr - end - | None => - match x0 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args =? 0 - then UnderLets.Base x - else UnderLets.Base (x + x0)%expr - | None => UnderLets.Base (x + x0)%expr - end - | @expr.App _ _ _ s _ #(idc0)%expr_pat x1 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (x - x' v)%expr - | None => UnderLets.Base (x + x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x + x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x + x0)%expr - end - | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ - (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ - (_ @ _)%expr_pat _ | @expr.App _ _ _ s _ - (@expr.LetIn _ _ _ _ _ _ _) _ => UnderLets.Base (x + x0)%expr - | _ => UnderLets.Base (x + x0)%expr - end - end - | ($_)%expr => - match x0 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t1 v0 => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args => - if args =? 0 - then UnderLets.Base x - else UnderLets.Base (x + x0)%expr - | None => UnderLets.Base (x + x0)%expr - end - | @expr.App _ _ _ s _ #(idc)%expr_pat x1 => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (x - x' v0)%expr - | None => UnderLets.Base (x + x0)%expr - end) - | (s0 -> d0)%ptype => - fun _ : Compile.value' false s0 -> Compile.value' true d0 - => UnderLets.Base (x + x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x + x0)%expr - end - | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ - (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat - _ | @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (x + x0)%expr - | _ => UnderLets.Base (x + x0)%expr - end - | @expr.Abs _ _ _ _ _ _ => - match x0 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match - t0 as t1 return (base.base_interp t1 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args =? 0 - then UnderLets.Base x - else UnderLets.Base (x + x0)%expr - | None => UnderLets.Base (x + x0)%expr - end - | @expr.App _ _ _ s0 _ #(idc)%expr_pat x1 => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (x - x' v)%expr - | None => UnderLets.Base (x + x0)%expr - end) - | (s1 -> d1)%ptype => - fun _ : Compile.value' false s1 -> Compile.value' true d1 - => UnderLets.Base (x + x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x + x0)%expr - end - | @expr.App _ _ _ s0 _ ($_)%expr _ | @expr.App _ _ _ s0 _ - (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s0 _ (_ @ _)%expr_pat - _ | @expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (x + x0)%expr - | _ => UnderLets.Base (x + x0)%expr - end - | @expr.App _ _ _ s _ f x1 => - match x0 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match - t0 as t1 return (base.base_interp t1 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args =? 0 - then UnderLets.Base x - else - match f with - | #(idc0)%expr_pat => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => + => + match a with + | Some x' => + UnderLets.Base + (x0 - x' v)%expr + | None => default + end) + | (s0 -> d0)%ptype => + fun + _ : Compile.value' false + s0 -> + Compile.value' true + d0 => default + end (Compile.reflect x1) + | None => default + end + | @expr.App _ _ _ s _ ($_)%expr _ | + @expr.App _ _ _ s _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App + _ _ _ s _ (_ @ _)%expr_pat _ | + @expr.App _ _ _ s _ + (@expr.LetIn _ _ _ _ _ _ _) _ => + default + | _ => default0 tt + end in + match x0 with + | #(idc)%expr_pat => match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) + match idc with + | @ident.Literal t0 v => + match + t0 as t1 + return (base.base_interp t1 -> option Z) + with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args >? 0 - then - UnderLets.Base (##(args) - x' v)%expr - else - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - (fun - a0 : option + | Some args => + if args =? 0 + then UnderLets.Base x + else + match x with + | @expr.App _ _ _ s _ #(idc0)%expr_pat x1 => + match + match idc0 with + | ident.Z_opp => Some tt + | _ => None + end + with + | Some _ => + match + s as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets base.type + ident var + (defaults.expr + (type.base base.type.Z))) + with + | type.base t2 => + fun + v : defaults.expr (type.base t2) + => + base.try_make_transport_cps + (fun t1 : base.type => + defaults.expr (type.base t1)) t2 + base.type.Z + (UnderLets.UnderLets base.type + ident var + (defaults.expr + (type.base base.type.Z))) + (fun + a : option (defaults.expr - (type.base t3) -> + (type.base t2) -> defaults.expr (type.base base.type.Z)) => - match a0 with - | Some x'0 => - if args - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v1 : defaults.expr - (type.base t4) - => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr - (type.base t1)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) + match a with + | Some x' => + if args >? 0 + then + UnderLets.Base + (##(args) - x' v)%expr + else + match + s as t3 + return + (Compile.value' false + t3 -> + UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base t3 => + fun + v0 : defaults.expr + (type.base t3) + => + base.try_make_transport_cps + (fun t1 : base.type + => + defaults.expr + (type.base t1)) t3 + base.type.Z + (UnderLets.UnderLets + base.type ident + var + (defaults.expr + (type.base + base.type.Z))) + (fun + a0 : option + (defaults.expr + (type.base + t3) -> + defaults.expr + (type.base + base.type.Z)) + => + match a0 with + | Some x'0 => + if args default + end) + | (s0 -> d0)%ptype => + fun + _ : Compile.value' + false s0 -> + Compile.value' + true d0 => + default + end (Compile.reflect x1) + | None => default + end) + | (s0 -> d0)%ptype => + fun + _ : Compile.value' false s0 -> + Compile.value' true d0 => + default + end (Compile.reflect x1) + | None => default + end + | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ + _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App + _ _ _ s _ (_ @ _)%expr_pat _ | @expr.App _ _ + _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => + default + | _ => default + end + | None => default0 tt + end + | @expr.App _ _ _ s _ #(idc)%expr_pat x1 => + match + match idc with + | ident.Z_opp => Some tt + | _ => None + end + with + | Some _ => + match x with + | #(idc0)%expr_pat => + match + match idc0 with + | @ident.Literal t1 v => + match + t1 as t2 + return + (base.base_interp t2 -> option Z) + with + | base.type.unit => + fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => + fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args0 => + match + s as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets base.type ident + var + (defaults.expr + (type.base base.type.Z))) + with + | type.base t2 => + fun v : defaults.expr (type.base t2) + => + base.try_make_transport_cps + (fun t1 : base.type => + defaults.expr (type.base t1)) t2 + base.type.Z + (UnderLets.UnderLets base.type + ident var + (defaults.expr + (type.base base.type.Z))) + (fun + a : option + (defaults.expr + (type.base t2) -> + defaults.expr + (type.base base.type.Z)) + => + match a with + | Some x' => + if args0 >? 0 + then + UnderLets.Base + (##(args0) - x' v)%expr + else + match + s as t3 + return + (Compile.value' false t3 -> + UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base t3 => + fun + v0 : defaults.expr + (type.base t3) + => + base.try_make_transport_cps + (fun t1 : base.type => + defaults.expr + (type.base t1)) t3 + base.type.Z + (UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a0 : option + (defaults.expr + (type.base + t3) -> + defaults.expr + (type.base + base.type.Z)) => - match a1 with - | Some x'1 => - UnderLets.Base - (x0 - x'1 v1)%expr - | None => - UnderLets.Base - (x + x0)%expr + match a0 with + | Some x'0 => + if args0 default end) | (s0 -> d0)%ptype => fun @@ -867,645 +819,128 @@ match idc in (ident t) return (Compile.value' true t) with false s0 -> Compile.value' true d0 => - UnderLets.Base - (x + x0)%expr + default end (Compile.reflect x1) - | None => - UnderLets.Base (x + x0)%expr + | None => default end) | (s0 -> d0)%ptype => fun _ : Compile.value' false s0 -> Compile.value' true d0 => - UnderLets.Base (x + x0)%expr + default end (Compile.reflect x1) - | None => UnderLets.Base (x + x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x + x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x + x0)%expr - end - | _ => UnderLets.Base (x + x0)%expr - end - | None => - match f with - | #(idc0)%expr_pat => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => UnderLets.Base (x0 - x' v)%expr - | None => UnderLets.Base (x + x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x + x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x + x0)%expr - end - | _ => UnderLets.Base (x + x0)%expr - end - end - | ($_)%expr => - match f with - | #(idc)%expr_pat => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (x0 - x' v0)%expr - | None => UnderLets.Base (x + x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x + x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x + x0)%expr - end - | _ => UnderLets.Base (x + x0)%expr - end - | @expr.Abs _ _ _ _ _ _ => - match f with - | #(idc)%expr_pat => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (x0 - x' v)%expr - | None => UnderLets.Base (x + x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x + x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x + x0)%expr - end - | _ => UnderLets.Base (x + x0)%expr - end - | @expr.App _ _ _ s0 _ #(idc)%expr_pat x2 => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match f with - | #(idc0)%expr_pat => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident + | None => default + end + | @expr.App _ _ _ s0 _ #(idc0)%expr_pat x2 => + match + match idc0 with + | ident.Z_opp => Some tt + | _ => None + end + with + | Some _ => + match + s0 as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets base.type ident var (defaults.expr (type.base base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - UnderLets.Base - (- (x' v + x'0 v0))%expr - | None => - UnderLets.Base (x + x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x + x0)%expr - end (Compile.reflect x2) - | None => UnderLets.Base (x + x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x + x0)%expr - end (Compile.reflect x1) - | None => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => UnderLets.Base (x - x' v)%expr - | None => UnderLets.Base (x + x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x + x0)%expr - end (Compile.reflect x2) - end - | ($_)%expr => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (x - x' v0)%expr - | None => UnderLets.Base (x + x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x + x0)%expr - end (Compile.reflect x2) - | @expr.LetIn _ _ _ _ _ _ _ => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (x - x' v)%expr - | None => UnderLets.Base (x + x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x + x0)%expr - end (Compile.reflect x2) - | _ => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (x - x' v)%expr - | None => UnderLets.Base (x + x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base (x + x0)%expr - end (Compile.reflect x2) - end - | None => - match f with - | #(idc0)%expr_pat => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => UnderLets.Base (x0 - x' v)%expr - | None => UnderLets.Base (x + x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x + x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x + x0)%expr - end - | _ => UnderLets.Base (x + x0)%expr - end - end - | @expr.App _ _ _ s0 _ ($_)%expr _ => - match f with - | #(idc)%expr_pat => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (x0 - x' v0)%expr - | None => UnderLets.Base (x + x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x + x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x + x0)%expr - end - | _ => UnderLets.Base (x + x0)%expr - end - | @expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s0 - _ (_ @ _)%expr_pat _ => - match f with - | #(idc)%expr_pat => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (x0 - x' v)%expr - | None => UnderLets.Base (x + x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base (x + x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x + x0)%expr - end - | _ => UnderLets.Base (x + x0)%expr - end - | @expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ => - match f with - | #(idc)%expr_pat => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (x0 - x' v)%expr - | None => UnderLets.Base (x + x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x + x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x + x0)%expr - end - | _ => UnderLets.Base (x + x0)%expr - end - | @expr.LetIn _ _ _ _ _ _ _ => - match f with - | #(idc)%expr_pat => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (x0 - x' v)%expr - | None => UnderLets.Base (x + x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x + x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x + x0)%expr - end - | _ => UnderLets.Base (x + x0)%expr - end - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x0 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match - t0 as t1 return (base.base_interp t1 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args =? 0 - then UnderLets.Base x - else UnderLets.Base (x + x0)%expr - | None => UnderLets.Base (x + x0)%expr - end - | @expr.App _ _ _ s _ #(idc)%expr_pat x2 => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (x - x' v)%expr - | None => UnderLets.Base (x + x0)%expr - end) - | (s0 -> d0)%ptype => - fun _ : Compile.value' false s0 -> Compile.value' true d0 - => UnderLets.Base (x + x0)%expr - end (Compile.reflect x2) - | None => UnderLets.Base (x + x0)%expr - end - | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ - (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat - _ | @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (x + x0)%expr - | _ => UnderLets.Base (x + x0)%expr - end - end -| ident.Z_mul => - fun x x0 : defaults.expr (type.base base.type.Z) => + with + | type.base t2 => + fun v : defaults.expr (type.base t2) + => + base.try_make_transport_cps + (fun t1 : base.type => + defaults.expr (type.base t1)) t2 + base.type.Z + (UnderLets.UnderLets base.type + ident var + (defaults.expr + (type.base base.type.Z))) + (fun + a : option + (defaults.expr + (type.base t2) -> + defaults.expr + (type.base base.type.Z)) + => + match a with + | Some x' => + match + s as t3 + return + (Compile.value' false t3 -> + UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base t3 => + fun + v0 : defaults.expr + (type.base t3) + => + base.try_make_transport_cps + (fun t1 : base.type => + defaults.expr + (type.base t1)) t3 + base.type.Z + (UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a0 : option + (defaults.expr + (type.base + t3) -> + defaults.expr + (type.base + base.type.Z)) + => + match a0 with + | Some x'0 => + UnderLets.Base + (- + (x' v + x'0 v0))%expr + | None => default + end) + | (s1 -> d1)%ptype => + fun + _ : Compile.value' + false s1 -> + Compile.value' true + d1 => default + end (Compile.reflect x1) + | None => default + end) + | (s1 -> d1)%ptype => + fun + _ : Compile.value' false s1 -> + Compile.value' true d1 => + default + end (Compile.reflect x2) + | None => default + end + | @expr.App _ _ _ s0 _ ($_)%expr _ | @expr.App _ + _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App + _ _ _ s0 _ (_ @ _)%expr_pat _ | @expr.App _ _ + _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ => + default + | _ => default + end + | None => default + end + | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s _ + (@expr.LetIn _ _ _ _ _ _ _) _ => default + | _ => default0 tt + end in match x with | #(idc)%expr_pat => match @@ -1520,13192 +955,2714 @@ match idc in (ident t) return (Compile.value' true t) with | _ => None end with - | Some args => - if args =? 0 - then UnderLets.Base ##(0)%expr - else - match x0 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - if args0 =? 0 - then UnderLets.Base ##(0)%expr - else - if args =? 1 - then UnderLets.Base x0 - else - if args0 =? 1 - then UnderLets.Base x - else - if args =? -1 - then UnderLets.Base (- x0)%expr - else - if args0 =? -1 - then UnderLets.Base (- x)%expr - else - if args - if args =? 1 - then UnderLets.Base x0 - else - if args =? -1 - then UnderLets.Base (- x0)%expr - else - if args - if args =? 1 - then UnderLets.Base x0 - else - match f with - | #(idc0)%expr_pat => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? -1 - then UnderLets.Base (x' v) - else - if args =? -1 - then UnderLets.Base (- x0)%expr - else - if args - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - UnderLets.Base - (- (x * x'0 v0))%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => - if args =? -1 - then UnderLets.Base (- x0)%expr - else - if args - if args =? -1 - then UnderLets.Base (- x0)%expr - else - if args - if args =? 1 - then UnderLets.Base x0 - else - if args =? -1 - then UnderLets.Base (- x0)%expr - else - if args - match x0 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args =? 0 - then UnderLets.Base ##(0)%expr - else - if args =? 1 - then UnderLets.Base x - else - if args =? -1 - then UnderLets.Base (- x)%expr - else - if args UnderLets.Base (x * x0)%expr - end - | @expr.App _ _ _ s _ #(idc0)%expr_pat x1 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (- (x * x' v))%expr - | None => UnderLets.Base (x * x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end - | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ - (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ - (_ @ _)%expr_pat _ | @expr.App _ _ _ s _ - (@expr.LetIn _ _ _ _ _ _ _) _ => UnderLets.Base (x * x0)%expr - | _ => UnderLets.Base (x * x0)%expr - end - end - | ($_)%expr => - match x0 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t1 v0 => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args => - if args =? 0 - then UnderLets.Base ##(0)%expr - else - if args =? 1 - then UnderLets.Base x - else - if args =? -1 - then UnderLets.Base (- x)%expr - else - if args UnderLets.Base (x * x0)%expr - end - | @expr.App _ _ _ s _ #(idc)%expr_pat x1 => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (- (x * x' v0))%expr - | None => UnderLets.Base (x * x0)%expr - end) - | (s0 -> d0)%ptype => - fun _ : Compile.value' false s0 -> Compile.value' true d0 - => UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end - | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ - (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat - _ | @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (x * x0)%expr - | _ => UnderLets.Base (x * x0)%expr - end - | @expr.Abs _ _ _ _ _ _ => - match x0 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match - t0 as t1 return (base.base_interp t1 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args =? 0 - then UnderLets.Base ##(0)%expr - else - if args =? 1 - then UnderLets.Base x - else - if args =? -1 - then UnderLets.Base (- x)%expr - else - if args UnderLets.Base (x * x0)%expr - end - | @expr.App _ _ _ s0 _ #(idc)%expr_pat x1 => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (- (x * x' v))%expr - | None => UnderLets.Base (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun _ : Compile.value' false s1 -> Compile.value' true d1 - => UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end - | @expr.App _ _ _ s0 _ ($_)%expr _ | @expr.App _ _ _ s0 _ - (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s0 _ (_ @ _)%expr_pat - _ | @expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (x * x0)%expr - | _ => UnderLets.Base (x * x0)%expr - end - | @expr.App _ _ _ s _ f x1 => - match x0 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match - t0 as t1 return (base.base_interp t1 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args =? 0 - then UnderLets.Base ##(0)%expr - else - if args =? 1 - then UnderLets.Base x - else - match f with - | #(idc0)%expr_pat => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? -1 - then UnderLets.Base (x' v) - else - if args =? -1 - then UnderLets.Base (- x)%expr - else - if args - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - UnderLets.Base - (- (x'0 v0 * x0))%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => - if args =? -1 - then UnderLets.Base (- x)%expr - else - if args - if args =? -1 - then UnderLets.Base (- x)%expr - else - if args - match f with - | #(idc0)%expr_pat => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - UnderLets.Base (- (x' v * x0))%expr - | None => UnderLets.Base (x * x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - end - | ($_)%expr => - match f with - | #(idc)%expr_pat => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (- (x' v0 * x0))%expr - | None => UnderLets.Base (x * x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | @expr.Abs _ _ _ _ _ _ => - match f with - | #(idc)%expr_pat => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (- (x' v * x0))%expr - | None => UnderLets.Base (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | @expr.App _ _ _ s0 _ #(idc)%expr_pat x2 => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match f with - | #(idc0)%expr_pat => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - UnderLets.Base - (x' v * x'0 v0)%expr - | None => - UnderLets.Base (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => UnderLets.Base (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - UnderLets.Base (- (x * x' v))%expr - | None => UnderLets.Base (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - end - | ($_)%expr => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (- (x * x' v0))%expr - | None => UnderLets.Base (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | @expr.LetIn _ _ _ _ _ _ _ => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (- (x * x' v))%expr - | None => UnderLets.Base (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | _ => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (- (x * x' v))%expr - | None => UnderLets.Base (x * x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - end - | None => - match f with - | #(idc0)%expr_pat => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - UnderLets.Base (- (x' v * x0))%expr - | None => UnderLets.Base (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - end - | @expr.App _ _ _ s0 _ ($_)%expr _ => - match f with - | #(idc)%expr_pat => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (- (x' v0 * x0))%expr - | None => UnderLets.Base (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | @expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s0 - _ (_ @ _)%expr_pat _ => - match f with - | #(idc)%expr_pat => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (- (x' v * x0))%expr - | None => UnderLets.Base (x * x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | @expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ => - match f with - | #(idc)%expr_pat => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (- (x' v * x0))%expr - | None => UnderLets.Base (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | @expr.LetIn _ _ _ _ _ _ _ => - match f with - | #(idc)%expr_pat => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (- (x' v * x0))%expr - | None => UnderLets.Base (x * x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x0 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match - t0 as t1 return (base.base_interp t1 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args =? 0 - then UnderLets.Base ##(0)%expr - else - if args =? 1 - then UnderLets.Base x - else - if args =? -1 - then UnderLets.Base (- x)%expr - else - if args UnderLets.Base (x * x0)%expr - end - | @expr.App _ _ _ s _ #(idc)%expr_pat x2 => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (- (x * x' v))%expr - | None => UnderLets.Base (x * x0)%expr - end) - | (s0 -> d0)%ptype => - fun _ : Compile.value' false s0 -> Compile.value' true d0 - => UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => UnderLets.Base (x * x0)%expr - end - | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ - (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat - _ | @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (x * x0)%expr - | _ => UnderLets.Base (x * x0)%expr + | Some args => if args =? 0 then UnderLets.Base x0 else default + | None => default0 tt end + | _ => default0 tt end -| ident.Z_pow => - fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_pow)%expr @ x @ x0)%expr_pat -| ident.Z_sub => +| ident.Z_mul => fun x x0 : defaults.expr (type.base base.type.Z) => - match x with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match t0 as t1 return (base.base_interp t1 -> option Z) with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - match x0 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - if args =? 0 - then UnderLets.Base (- x0)%expr - else - if args0 =? 0 - then UnderLets.Base x - else - if args - if args =? 0 - then UnderLets.Base (- x0)%expr - else - if args - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 0 - then UnderLets.Base (x' v) - else - if args =? 0 - then UnderLets.Base (- x0)%expr - else - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - if args >? 0 - then - UnderLets.Base - (##(args) + x'0 v0)%expr - else - match - s as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t4 => - fun - v1 : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr - (type.base t1)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a1 with - | Some x'1 => - if args - UnderLets.UnderLets - base.type - ident var - (defaults.expr + llet default := UnderLets.Base (x * x0)%expr in + llet default0 := fun 'tt => + llet default0 := fun 'tt => + llet default0 := fun 'tt => + llet default0 := + fun 'tt => + llet default0 := + fun 'tt => + llet default0 := + fun 'tt => + llet default0 := + fun 'tt => + llet default0 := + fun 'tt => + llet default0 := + fun 'tt => + llet default0 := + fun 'tt => + match x with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal + t0 v => + match + t0 as t1 + return + (base.base_interp + t1 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => None + end + with + | Some args => + if + (args =? + 2 + ^ Z.log2 + args) && + negb + (args =? 2) + then + UnderLets.Base + (x0 << + ## + (Z.log2 + args))%expr + else default + | None => default + end + | _ => default + end in + match x0 with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal + t0 v => + match + t0 as t1 + return + (base.base_interp + t1 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => None + end + with + | Some args => + if + (args =? + 2 + ^ Z.log2 + args) && + negb + (args =? 2) + then + UnderLets.Base + (x << + ## + (Z.log2 + args))%expr + else default + | None => + default0 tt + end + | @expr.App _ _ _ s _ + #(idc)%expr_pat + x1 => + match + match idc with + | ident.Z_opp => + Some tt + | _ => None + end + with + | Some _ => + match + s as t2 + return + (Compile.value' + false t2 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr (type.base base.type.Z))) - with - | type.base t5 => - fun - v2 : - defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t1 : base.type - => - defaults.expr - (type.base - t1)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr + with + | type.base + t2 => + fun + v : + defaults.expr + (type.base + t2) => + base.try_make_transport_cps + (fun + t0 : base.type + => + defaults.expr + (type.base + t0)) t2 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr (type.base base.type.Z))) - (fun - a2 : + (fun + a : option (defaults.expr (type.base - t5) -> + t2) -> defaults.expr (type.base base.type.Z)) - => - match - a2 - with - | Some - x'2 => - UnderLets.Base - (x + - x'2 v2)%expr - | None => + => + match + a + with + | Some + x' => UnderLets.Base - (x - x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' + (- + (x * x' v))%expr + | None => + default + end) + | (s0 -> d0)%ptype => + fun + _ : + Compile.value' false s0 -> Compile.value' true d0 - => - UnderLets.Base - (x - x0)%expr - end - (Compile.reflect - x1) - | None => - UnderLets.Base - (x - x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false - s0 -> - Compile.value' true d0 - => - UnderLets.Base (x - x0)%expr - end (Compile.reflect x1) - | None => - UnderLets.Base (x - x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x - x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x - x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x - x0)%expr - end (Compile.reflect x1) - | None => - if args =? 0 - then UnderLets.Base (- x0)%expr - else - if args - if args =? 0 - then UnderLets.Base (- x0)%expr - else - if args - if args =? 0 - then UnderLets.Base (- x0)%expr - else - if args - match x0 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args =? 0 - then UnderLets.Base x - else - if args UnderLets.Base (x - x0)%expr - end - | @expr.App _ _ _ s _ #(idc0)%expr_pat x1 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (x + x' v)%expr - | None => UnderLets.Base (x - x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x - x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x - x0)%expr - end - | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ - (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ - (_ @ _)%expr_pat _ | @expr.App _ _ _ s _ - (@expr.LetIn _ _ _ _ _ _ _) _ => UnderLets.Base (x - x0)%expr - | _ => UnderLets.Base (x - x0)%expr - end - end - | ($_)%expr => - match x0 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t1 v0 => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args => - if args =? 0 - then UnderLets.Base x - else - if args UnderLets.Base (x - x0)%expr - end - | @expr.App _ _ _ s _ #(idc)%expr_pat x1 => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (x + x' v0)%expr - | None => UnderLets.Base (x - x0)%expr - end) - | (s0 -> d0)%ptype => - fun _ : Compile.value' false s0 -> Compile.value' true d0 - => UnderLets.Base (x - x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x - x0)%expr - end - | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ - (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat - _ | @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (x - x0)%expr - | _ => UnderLets.Base (x - x0)%expr - end - | @expr.Abs _ _ _ _ _ _ => - match x0 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match - t0 as t1 return (base.base_interp t1 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args =? 0 - then UnderLets.Base x - else - if args UnderLets.Base (x - x0)%expr - end - | @expr.App _ _ _ s0 _ #(idc)%expr_pat x1 => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (x + x' v)%expr - | None => UnderLets.Base (x - x0)%expr - end) - | (s1 -> d1)%ptype => - fun _ : Compile.value' false s1 -> Compile.value' true d1 - => UnderLets.Base (x - x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x - x0)%expr - end - | @expr.App _ _ _ s0 _ ($_)%expr _ | @expr.App _ _ _ s0 _ - (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s0 _ (_ @ _)%expr_pat - _ | @expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (x - x0)%expr - | _ => UnderLets.Base (x - x0)%expr - end - | @expr.App _ _ _ s _ f x1 => - match x0 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match - t0 as t1 return (base.base_interp t1 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args =? 0 - then UnderLets.Base x - else - match f with - | #(idc0)%expr_pat => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args >? 0 - then - UnderLets.Base - (- (x' v + ##((- args)%Z)))%expr - else - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) => - match a0 with - | Some x'0 => - if args - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v1 : defaults.expr - (type.base t4) - => - base.try_make_transport_cps - (fun t1 : base.type - => - defaults.expr - (type.base t1)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : option - (defaults.expr + => default + end + (Compile.reflect + x1) + | None => default + end + | @expr.App _ _ _ s _ + ($_)%expr _ | + @expr.App _ _ _ s _ + (@expr.Abs _ _ _ _ _ + _) _ | @expr.App _ + _ _ s _ + (_ @ _)%expr_pat _ | + @expr.App _ _ _ s _ + (@expr.LetIn _ _ _ _ + _ _ _) _ => default + | _ => default0 tt + end in + match x with + | @expr.App _ _ _ s _ + #(idc)%expr_pat + x1 => + match + match idc with + | ident.Z_opp => + Some tt + | _ => None + end + with + | Some _ => + match + s as t2 + return + (Compile.value' + false t2 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr (type.base - t4) -> - defaults.expr + base.type.Z))) + with + | type.base + t2 => + fun + v : + defaults.expr + (type.base + t2) => + base.try_make_transport_cps + (fun + t0 : base.type + => + defaults.expr + (type.base + t0)) t2 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a : + option + (defaults.expr + (type.base + t2) -> + defaults.expr (type.base base.type.Z)) - => - match a1 with - | Some x'1 => - UnderLets.Base - (- - (x'1 v1 + x0))%expr - | None => - UnderLets.Base - (x - x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' - false s0 -> - Compile.value' - true d0 => - UnderLets.Base - (x - x0)%expr - end (Compile.reflect x1) - | None => - UnderLets.Base (x - x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x - x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x - x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x - x0)%expr - end (Compile.reflect x1) - | None => - if args - if args - match f with - | #(idc0)%expr_pat => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - UnderLets.Base (- (x' v + x0))%expr - | None => UnderLets.Base (x - x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x - x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x - x0)%expr - end - | _ => UnderLets.Base (x - x0)%expr - end - end - | ($_)%expr => - match f with - | #(idc)%expr_pat => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (- (x' v0 + x0))%expr - | None => UnderLets.Base (x - x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x - x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x - x0)%expr - end - | _ => UnderLets.Base (x - x0)%expr - end - | @expr.Abs _ _ _ _ _ _ => - match f with - | #(idc)%expr_pat => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (- (x' v + x0))%expr - | None => UnderLets.Base (x - x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x - x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x - x0)%expr - end - | _ => UnderLets.Base (x - x0)%expr - end - | @expr.App _ _ _ s0 _ #(idc)%expr_pat x2 => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match f with - | #(idc0)%expr_pat => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - UnderLets.Base - (x'0 v0 - x' v)%expr - | None => - UnderLets.Base (x - x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x - x0)%expr - end (Compile.reflect x2) - | None => UnderLets.Base (x - x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x - x0)%expr - end (Compile.reflect x1) - | None => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => UnderLets.Base (x + x' v)%expr - | None => UnderLets.Base (x - x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x - x0)%expr - end (Compile.reflect x2) - end - | ($_)%expr => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (x + x' v0)%expr - | None => UnderLets.Base (x - x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x - x0)%expr - end (Compile.reflect x2) - | @expr.LetIn _ _ _ _ _ _ _ => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (x + x' v)%expr - | None => UnderLets.Base (x - x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x - x0)%expr - end (Compile.reflect x2) - | _ => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (x + x' v)%expr - | None => UnderLets.Base (x - x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base (x - x0)%expr - end (Compile.reflect x2) - end - | None => - match f with - | #(idc0)%expr_pat => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - UnderLets.Base (- (x' v + x0))%expr - | None => UnderLets.Base (x - x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x - x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x - x0)%expr - end - | _ => UnderLets.Base (x - x0)%expr - end - end - | @expr.App _ _ _ s0 _ ($_)%expr _ => - match f with - | #(idc)%expr_pat => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (- (x' v0 + x0))%expr - | None => UnderLets.Base (x - x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x - x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x - x0)%expr - end - | _ => UnderLets.Base (x - x0)%expr - end - | @expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s0 - _ (_ @ _)%expr_pat _ => - match f with - | #(idc)%expr_pat => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (- (x' v + x0))%expr - | None => UnderLets.Base (x - x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base (x - x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x - x0)%expr - end - | _ => UnderLets.Base (x - x0)%expr - end - | @expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ => - match f with - | #(idc)%expr_pat => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (- (x' v + x0))%expr - | None => UnderLets.Base (x - x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x - x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x - x0)%expr - end - | _ => UnderLets.Base (x - x0)%expr - end - | @expr.LetIn _ _ _ _ _ _ _ => - match f with - | #(idc)%expr_pat => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (- (x' v + x0))%expr - | None => UnderLets.Base (x - x0)%expr - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base (x - x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x - x0)%expr - end - | _ => UnderLets.Base (x - x0)%expr - end - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x0 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match - t0 as t1 return (base.base_interp t1 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args =? 0 - then UnderLets.Base x - else - if args UnderLets.Base (x - x0)%expr - end - | @expr.App _ _ _ s _ #(idc)%expr_pat x2 => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (x + x' v)%expr - | None => UnderLets.Base (x - x0)%expr - end) - | (s0 -> d0)%ptype => - fun _ : Compile.value' false s0 -> Compile.value' true d0 - => UnderLets.Base (x - x0)%expr - end (Compile.reflect x2) - | None => UnderLets.Base (x - x0)%expr - end - | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ - (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat - _ | @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (x - x0)%expr - | _ => UnderLets.Base (x - x0)%expr - end - end -| ident.Z_opp => - fun x : defaults.expr (type.base base.type.Z) => - match x with - | ($_)%expr => - if negb (SubstVarLike.is_var_fst_snd_pair_opp x) - then - UnderLets.UnderLet x - (fun v0 : var (type.base base.type.Z) => - UnderLets.Base (- $v0)%expr) - else UnderLets.Base (- x)%expr - | @expr.App _ _ _ s _ #(idc)%expr_pat x0 => - match match idc with - | ident.Z_opp => Some tt - | _ => None - end with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => UnderLets.Base (x' v) - | None => UnderLets.Base (- x)%expr - end) - | (s0 -> d0)%ptype => - fun _ : Compile.value' false s0 -> Compile.value' true d0 => - UnderLets.Base (- x)%expr - end (Compile.reflect x0) - | None => - if negb (SubstVarLike.is_var_fst_snd_pair_opp x) - then - UnderLets.UnderLet x - (fun v : var (type.base base.type.Z) => - UnderLets.Base (- $v)%expr) - else UnderLets.Base (- x)%expr - end - | @expr.App _ _ _ s _ ($_)%expr _ => - if negb (SubstVarLike.is_var_fst_snd_pair_opp x) - then - UnderLets.UnderLet x - (fun v0 : var (type.base base.type.Z) => - UnderLets.Base (- $v0)%expr) - else UnderLets.Base (- x)%expr - | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ - (_ @ _)%expr_pat _ | @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) - _ => - if negb (SubstVarLike.is_var_fst_snd_pair_opp x) - then - UnderLets.UnderLet x - (fun v : var (type.base base.type.Z) => UnderLets.Base (- $v)%expr) - else UnderLets.Base (- x)%expr - | _ => - if negb (SubstVarLike.is_var_fst_snd_pair_opp x) - then - UnderLets.UnderLet x - (fun v : var (type.base base.type.Z) => UnderLets.Base (- $v)%expr) - else UnderLets.Base (- x)%expr - end -| ident.Z_div => - fun x x0 : defaults.expr (type.base base.type.Z) => - match x0 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match t0 as t1 return (base.base_interp t1 -> option Z) with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args =? 1 - then UnderLets.Base x - else - if args =? 2 ^ Z.log2 args - then UnderLets.Base (x >> ##(Z.log2 args))%expr - else UnderLets.Base (x / x0)%expr - | None => UnderLets.Base (x / x0)%expr - end - | _ => UnderLets.Base (x / x0)%expr - end -| ident.Z_modulo => - fun x x0 : defaults.expr (type.base base.type.Z) => - match x0 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match t0 as t1 return (base.base_interp t1 -> option Z) with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args =? 1 - then UnderLets.Base ##(0)%expr - else - if args =? 2 ^ Z.log2 args - then UnderLets.Base (x &' ##((args - 1)%Z))%expr - else UnderLets.Base (x mod x0)%expr - | None => UnderLets.Base (x mod x0)%expr - end - | _ => UnderLets.Base (x mod x0)%expr - end -| ident.Z_log2 => - fun x : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_log2)%expr @ x)%expr_pat -| ident.Z_log2_up => - fun x : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_log2_up)%expr @ x)%expr_pat -| ident.Z_eqb => - fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_eqb)%expr @ x @ x0)%expr_pat -| ident.Z_leb => - fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_leb)%expr @ x @ x0)%expr_pat -| ident.Z_geb => - fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_geb)%expr @ x @ x0)%expr_pat -| ident.Z_of_nat => - fun x : defaults.expr (type.base base.type.nat) => - UnderLets.Base (#(ident.Z_of_nat)%expr @ x)%expr_pat -| ident.Z_to_nat => - fun x : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_to_nat)%expr @ x)%expr_pat -| ident.Z_shiftr => - fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (x >> x0)%expr -| ident.Z_shiftl => - fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (x << x0)%expr -| ident.Z_land => - fun x x0 : defaults.expr (type.base base.type.Z) => - match x0 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match t0 as t1 return (base.base_interp t1 -> option Z) with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args =? 0 - then UnderLets.Base ##(0)%expr - else - match x with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - if args0 =? 0 - then UnderLets.Base ##(0)%expr - else UnderLets.Base (x &' x0)%expr - | None => UnderLets.Base (x &' x0)%expr - end - | _ => UnderLets.Base (x &' x0)%expr - end - | None => - match x with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args =? 0 - then UnderLets.Base ##(0)%expr - else UnderLets.Base (x &' x0)%expr - | None => UnderLets.Base (x &' x0)%expr - end - | _ => UnderLets.Base (x &' x0)%expr - end - end - | ($_)%expr => - match x with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t1 v0 => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args => - if args =? 0 - then UnderLets.Base ##(0)%expr - else UnderLets.Base (x &' x0)%expr - | None => UnderLets.Base (x &' x0)%expr - end - | _ => UnderLets.Base (x &' x0)%expr - end - | _ => - match x with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match - t0 as t1 return (base.base_interp t1 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args =? 0 - then UnderLets.Base ##(0)%expr - else UnderLets.Base (x &' x0)%expr - | None => UnderLets.Base (x &' x0)%expr - end - | _ => UnderLets.Base (x &' x0)%expr - end - end -| ident.Z_lor => - fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (x || x0)%expr -| ident.Z_bneg => - fun x : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_bneg)%expr @ x)%expr_pat -| ident.Z_lnot_modulo => - fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_lnot_modulo)%expr @ x @ x0)%expr_pat -| ident.Z_mul_split => - fun x x0 x1 : defaults.expr (type.base base.type.Z) => - match x with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match t0 as t1 return (base.base_interp t1 -> option Z) with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some _ => - match x0 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - if args0 =? 0 - then UnderLets.Base (##(0)%expr, ##(0)%expr)%expr_pat - else - match x1 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - if args1 =? 0 - then - UnderLets.Base - (##(0)%expr, ##(0)%expr)%expr_pat - else - if args0 =? 1 - then UnderLets.Base (x1, ##(0)%expr)%expr_pat - else - if args1 =? 1 - then UnderLets.Base (x0, ##(0)%expr)%expr_pat - else - if args0 =? -1 - then - UnderLets.Base - ((- x1)%expr, ##(0)%expr)%expr_pat - else - if args1 =? -1 - then - UnderLets.Base - ((- x0)%expr, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - if args0 =? 1 - then UnderLets.Base (x1, ##(0)%expr)%expr_pat - else - if args0 =? -1 - then - UnderLets.Base - ((- x1)%expr, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - if args0 =? 1 - then UnderLets.Base (x1, ##(0)%expr)%expr_pat - else - if args0 =? -1 - then - UnderLets.Base ((- x1)%expr, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - if args0 =? 1 - then UnderLets.Base (x1, ##(0)%expr)%expr_pat - else - if args0 =? -1 - then - UnderLets.Base ((- x1)%expr, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | None => - match x1 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - if args0 =? 0 - then - UnderLets.Base (##(0)%expr, ##(0)%expr)%expr_pat - else - if args0 =? 1 - then UnderLets.Base (x0, ##(0)%expr)%expr_pat - else - if args0 =? -1 - then - UnderLets.Base - ((- x0)%expr, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - UnderLets.UnderLet - (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - end - | ($_)%expr => - match x1 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t2 v0 => - match - t2 as t3 return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args0 => - if args0 =? 0 - then UnderLets.Base (##(0)%expr, ##(0)%expr)%expr_pat - else - if args0 =? 1 - then UnderLets.Base (x0, ##(0)%expr)%expr_pat - else - if args0 =? -1 - then - UnderLets.Base ((- x0)%expr, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | None => - UnderLets.UnderLet - (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat - (fun - v1 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | _ => - match x1 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - if args0 =? 0 - then UnderLets.Base (##(0)%expr, ##(0)%expr)%expr_pat - else - if args0 =? 1 - then UnderLets.Base (x0, ##(0)%expr)%expr_pat - else - if args0 =? -1 - then - UnderLets.Base ((- x0)%expr, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - UnderLets.UnderLet - (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - end - | None => - UnderLets.UnderLet - (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - UnderLets.UnderLet (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end -| ident.Z_add_get_carry => - fun x x0 x1 : defaults.expr (type.base base.type.Z) => - match x0 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match t0 as t1 return (base.base_interp t1 -> option Z) with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - match x1 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - if args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - if args0 - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then UnderLets.Base (x1, ##(0)%expr)%expr_pat - else - if args0 =? 0 - then UnderLets.Base (x0, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - if args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then UnderLets.Base (x1, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - if args - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then UnderLets.Base (x1, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun - v0 : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s _ #(idc0)%expr_pat x2 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ - x' v)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end (Compile.reflect x2) - | None => - if args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then UnderLets.Base (x1, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s _ ($_)%expr _ => - if args - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then UnderLets.Base (x1, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun - v0 : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ - s _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - if args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then UnderLets.Base (x1, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | _ => - if args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then UnderLets.Base (x1, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | None => - match x1 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then UnderLets.Base (x0, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s _ #(idc0)%expr_pat x2 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ - x' v)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end (Compile.reflect x2) - | None => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s _ ($_)%expr _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ - s _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - end - | ($_)%expr => - match x1 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t1 v0 => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args => - if args - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then UnderLets.Base (x0, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun - v0 : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | None => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v1 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | @expr.App _ _ _ s _ #(idc)%expr_pat x2 => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x' v0)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - (- (#(ident.snd)%expr @ $v1)%expr_pat)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end) - | (s0 -> d0)%ptype => - fun _ : Compile.value' false s0 -> Compile.value' true d0 - => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end (Compile.reflect x2) - | None => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | @expr.App _ _ _ s _ ($_)%expr _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v1 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ - (_ @ _)%expr_pat _ | @expr.App _ _ _ s _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | @expr.Abs _ _ _ _ _ _ => - match x1 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match - t0 as t1 return (base.base_interp t1 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then UnderLets.Base (x0, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ #(idc)%expr_pat x2 => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x' v)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end) - | (s1 -> d1)%ptype => - fun _ : Compile.value' false s1 -> Compile.value' true d1 - => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end (Compile.reflect x2) - | None => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s0 _ ($_)%expr _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s0 - _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s0 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s _ #(idc)%expr_pat x2 => - match match idc with - | ident.Z_opp => Some tt - | _ => None - end with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ x @ x1 @ x' v)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end) - | (s0 -> d0)%ptype => - fun _ : Compile.value' false s0 -> Compile.value' true d0 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end (Compile.reflect x2) - | None => - match x1 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then UnderLets.Base (x0, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ #(idc0)%expr_pat x3 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ - x' v)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s0 _ ($_)%expr _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ - _ s0 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s0 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - end - | @expr.App _ _ _ s _ ($_)%expr _ => - match x1 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t1 v0 => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args => - if args - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then UnderLets.Base (x0, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun - v0 : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | None => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v1 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ #(idc)%expr_pat x3 => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x' v0)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - (- (#(ident.snd)%expr @ $v1)%expr_pat)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end) - | (s1 -> d1)%ptype => - fun _ : Compile.value' false s1 -> Compile.value' true d1 - => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | @expr.App _ _ _ s0 _ ($_)%expr _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v1 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s0 - _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s0 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ => - match x1 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match - t0 as t1 return (base.base_interp t1 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then UnderLets.Base (x0, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s1 _ #(idc)%expr_pat x3 => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s1 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x' v)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end) - | (s2 -> d2)%ptype => - fun _ : Compile.value' false s2 -> Compile.value' true d2 - => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s1 _ ($_)%expr _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s1 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s1 - _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s1 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s _ (_ @ _)%expr_pat _ => - match x1 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match - t0 as t1 return (base.base_interp t1 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then UnderLets.Base (x0, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s1 _ #(idc)%expr_pat x4 => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s1 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x' v)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end) - | (s2 -> d2)%ptype => - fun _ : Compile.value' false s2 -> Compile.value' true d2 - => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end (Compile.reflect x4) - | None => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s1 _ ($_)%expr _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s1 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s1 - _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s1 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => - match x1 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match - t0 as t1 return (base.base_interp t1 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then UnderLets.Base (x0, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ #(idc)%expr_pat x4 => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x' v)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end) - | (s1 -> d1)%ptype => - fun _ : Compile.value' false s1 -> Compile.value' true d1 - => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end (Compile.reflect x4) - | None => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s0 _ ($_)%expr _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s0 - _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s0 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x1 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match - t0 as t1 return (base.base_interp t1 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then UnderLets.Base (x0, ##(0)%expr)%expr_pat - else - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun - v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s _ #(idc)%expr_pat x3 => - match - match idc with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t0 : base.type => defaults.expr (type.base t0)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x' v)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end) - | (s0 -> d0)%ptype => - fun _ : Compile.value' false s0 -> Compile.value' true d0 - => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s _ ($_)%expr _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ - (_ @ _)%expr_pat _ | @expr.App _ _ _ s _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - end -| ident.Z_add_with_carry => - fun x x0 x1 : defaults.expr (type.base base.type.Z) => - match x with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match t0 as t1 return (base.base_interp t1 -> option Z) with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - if args =? 0 - then UnderLets.Base (x0 + x1)%expr - else - UnderLets.UnderLet - (#(ident.Z_add_with_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base base.type.Z) => - UnderLets.Base ($v)%expr) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base base.type.Z) => - UnderLets.Base ($v)%expr) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_with_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v0 : var (type.base base.type.Z) => UnderLets.Base ($v0)%expr) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_with_carry)%expr @ x @ x0 @ x1)%expr_pat - (fun v : var (type.base base.type.Z) => UnderLets.Base ($v)%expr) - end -| ident.Z_add_with_get_carry => - fun x x0 x1 x2 : defaults.expr (type.base base.type.Z) => - match x0 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match t0 as t1 return (base.base_interp t1 -> option Z) with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - match x1 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - if - (args0 <=? 0) && (args <=? 0) && - (args0 + args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - if - (args1 <=? 0) && (args <=? 0) && - (args1 + args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - match x with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some _ => - if (args =? 0) && (args0 =? 0) - then - UnderLets.Base - (x2, ##(0)%expr)%expr_pat - else - if (args =? 0) && (args1 =? 0) - then - UnderLets.Base - (x1, ##(0)%expr)%expr_pat - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - if (args0 =? 0) && (args1 =? 0) - then - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ ##(args0)%expr @ - ##(args1)%expr)%expr_pat - (fun - v : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - ##(0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * - base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - if (args0 =? 0) && (args1 =? 0) - then - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ ##(args0)%expr @ - ##(args1)%expr)%expr_pat - (fun - v : var - (type.base - (base.type.Z * - base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - ##(0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * - base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - if (args0 =? 0) && (args1 =? 0) - then - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ ##(args0)%expr @ ##(args1)%expr)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - ##(0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - if (args0 =? 0) && (args1 =? 0) - then - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ ##(args0)%expr @ ##(args1)%expr)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - ##(0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | None => - if - (args0 <=? 0) && (args <=? 0) && - (args0 + args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - match x with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some _ => - if (args =? 0) && (args0 =? 0) - then - UnderLets.Base - (x2, ##(0)%expr)%expr_pat - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * - base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * - base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * - base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * - base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - end - | ($_)%expr => - if - (args0 <=? 0) && (args <=? 0) && (args0 + args - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - match x with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return (base.base_interp t4 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some _ => - if (args =? 0) && (args0 =? 0) - then - UnderLets.Base (x2, ##(0)%expr)%expr_pat - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | @expr.App _ _ _ s _ #(idc1)%expr_pat x3 => - match - match idc1 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ x @ - x1 @ x' v)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- - (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if args - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - (- - (#(ident.snd)%expr @ - $v1)%expr_pat)%expr)%expr_pat) - else - if - (args0 <=? 0) && - (args <=? 0) && - (args0 + args - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - (- - (#(ident.snd)%expr @ - $v1)%expr_pat)%expr)%expr_pat) - else - match x with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal - t5 v1 => - match - t5 as t6 - return - (base.base_interp - t6 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun v2 : Z - => - Some v2 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun - _ : nat - => None - end v1 - | _ => None - end - with - | Some _ => - if - (args =? 0) && - (args0 =? 0) - then - UnderLets.Base - (x2, - ##(0)%expr)%expr_pat - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v1 : - var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - ( - # - (ident.fst)%expr @ - ($v1)%expr, - # - (ident.snd)%expr @ - ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ - x2)%expr_pat - (fun - v1 : - var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - ( - # - (ident.fst)%expr @ - ($v1)%expr, - # - (ident.snd)%expr @ - ($v1)%expr)%expr_pat) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v1 : - var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (# - (ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ - x2)%expr_pat - (fun - v1 : - var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (# - (ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v2 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v2)%expr, - #(ident.snd)%expr @ - ($v2)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v2 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v2)%expr, - #(ident.snd)%expr @ - ($v2)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - end - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - if - (args0 <=? 0) && (args <=? 0) && - (args0 + args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - match x with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some _ => - if (args =? 0) && (args0 =? 0) - then - UnderLets.Base - (x2, ##(0)%expr)%expr_pat - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * - base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * - base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * - base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * - base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - end - | @expr.App _ _ _ s _ ($_)%expr _ => - if - (args0 <=? 0) && (args <=? 0) && (args0 + args - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - match x with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return (base.base_interp t4 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some _ => - if (args =? 0) && (args0 =? 0) - then - UnderLets.Base (x2, ##(0)%expr)%expr_pat - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | - @expr.App _ _ _ s _ (_ @ _)%expr_pat _ | @expr.App _ _ - _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => - if - (args0 <=? 0) && (args <=? 0) && (args0 + args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - match x with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some _ => - if (args =? 0) && (args0 =? 0) - then - UnderLets.Base (x2, ##(0)%expr)%expr_pat - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | _ => - if - (args0 <=? 0) && (args <=? 0) && (args0 + args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - match x with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some _ => - if (args =? 0) && (args0 =? 0) - then - UnderLets.Base (x2, ##(0)%expr)%expr_pat - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - end - | None => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - if - (args0 <=? 0) && (args <=? 0) && - (args0 + args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - match x with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some _ => - if (args =? 0) && (args0 =? 0) - then - UnderLets.Base - (x1, ##(0)%expr)%expr_pat - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * - base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * - base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * - base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * - base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s _ #(idc1)%expr_pat x3 => - match - match idc1 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ x @ - x1 @ x' v)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- - (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if args - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - (- - (#(ident.snd)%expr @ - $v1)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s _ ($_)%expr _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | - @expr.App _ _ _ s _ (_ @ _)%expr_pat _ | @expr.App _ _ - _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - end - | ($_)%expr => - match x2 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t2 v0 => - match - t2 as t3 return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args0 => - if - (args0 <=? 0) && (args <=? 0) && (args0 + args - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - match x with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return (base.base_interp t4 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some _ => - if (args =? 0) && (args0 =? 0) - then - UnderLets.Base (x1, ##(0)%expr)%expr_pat - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | @expr.App _ _ _ s _ #(idc0)%expr_pat x3 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ x @ - x1 @ x' v0)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - (- - (#(ident.snd)%expr @ $v1)%expr_pat)%expr)%expr_pat) - else - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v1 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - if args - UnderLets.Base - (#(ident.fst)%expr @ - ($v2)%expr, - (- - (#(ident.snd)%expr @ - $v2)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v2 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v2)%expr, - #(ident.snd)%expr @ - ($v2)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v2 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v2)%expr, - #(ident.snd)%expr @ - ($v2)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | @expr.App _ _ _ s _ ($_)%expr _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ - _ _ s _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | @expr.Abs _ _ _ _ _ _ => - match x2 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - if - (args0 <=? 0) && (args <=? 0) && (args0 + args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - match x with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some _ => - if (args =? 0) && (args0 =? 0) - then - UnderLets.Base (x1, ##(0)%expr)%expr_pat - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ #(idc0)%expr_pat x3 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ x @ - x1 @ x' v)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- - (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - if args - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - (- - (#(ident.snd)%expr @ - $v1)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s0 _ ($_)%expr _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App - _ _ _ s0 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s0 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s _ #(idc0)%expr_pat x3 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ x @ x2 @ - x' v)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a0 : option - (defaults.expr (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - if args - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - (- - (#(ident.snd)%expr @ $v1)%expr_pat)%expr)%expr_pat) - else - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t4 v1 => - match - t4 as t5 - return - (base.base_interp - t5 -> option Z) - with - | base.type.unit => - fun _ : unit => - None - | base.type.Z => - fun v2 : Z => - Some v2 - | base.type.bool => - fun _ : bool => - None - | base.type.nat => - fun _ : nat => None - end v1 - | _ => None - end - with - | Some args1 => - if - (args1 <=? 0) && - (args <=? 0) && - (args1 + args - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - (- - (#(ident.snd)%expr @ - $v1)%expr_pat)%expr)%expr_pat) - else - match x with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal - t5 v1 => - match - t5 as t6 - return - (base.base_interp - t6 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun v2 : Z - => - Some v2 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun - _ : nat - => None - end v1 - | _ => None - end - with - | Some _ => - if - (args =? 0) && - (args1 =? 0) - then - UnderLets.Base - (x1, - ##(0)%expr)%expr_pat - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v1 : - var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - ( - # - (ident.fst)%expr @ - ($v1)%expr, - # - (ident.snd)%expr @ - ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ - x2)%expr_pat - (fun - v1 : - var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - ( - # - (ident.fst)%expr @ - ($v1)%expr, - # - (ident.snd)%expr @ - ($v1)%expr)%expr_pat) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v1 : - var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (# - (ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ - x2)%expr_pat - (fun - v1 : - var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (# - (ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v2 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v2)%expr, - #(ident.snd)%expr @ - ($v2)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v2 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v2)%expr, - #(ident.snd)%expr @ - ($v2)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - end - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v2 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v2)%expr, - #(ident.snd)%expr @ - ($v2)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v2 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v2)%expr, - #(ident.snd)%expr @ - ($v2)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ - #(idc1)%expr_pat x4 => - match - match idc1 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s0 as t4 - return - (Compile.value' false - t4 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t4 => - fun - v1 : defaults.expr - (type.base - t4) => - base.try_make_transport_cps - (fun t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a1 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a1 with - | Some x'1 => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ - x @ x1 @ - x'1 v1)%expr_pat - (fun - v2 : - var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - ( - # - (ident.fst)%expr @ - ($v2)%expr, - (- - (# - (ident.snd)%expr @ - $v2)%expr_pat)%expr)%expr_pat) - else - match - s0 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base - t5 => - fun - v2 : - defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a2 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a2 - with - | Some - x'2 => - if - args - UnderLets.Base - ( - # - (ident.fst)%expr @ - ($v3)%expr, - (- - (# - (ident.snd)%expr @ - $v3)%expr_pat)%expr)%expr_pat) - else - if - args =? 0 - then - UnderLets.UnderLet - (# - (ident.Z_add_get_carry)%expr @ - x @ x1 @ - x2)%expr_pat - (fun - v3 : - var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - ( - # - (ident.fst)%expr @ - ($v3)%expr, - # - (ident.snd)%expr @ - ($v3)%expr)%expr_pat) - else - UnderLets.UnderLet - (# - (ident.Z_add_with_get_carry)%expr @ - x @ x0 @ - x1 @ x2)%expr_pat - (fun - v3 : - var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - ( - # - (ident.fst)%expr @ - ($v3)%expr, - # - (ident.snd)%expr @ - ($v3)%expr)%expr_pat) - | None => - UnderLets.Base - (# - (ident.Z_add_with_get_carry)%expr @ - x @ x0 @ - x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : - Compile.value' - false s1 -> - Compile.value' - true d1 - => - UnderLets.Base - (# - (ident.Z_add_with_get_carry)%expr @ - x @ x0 @ - x1 @ x2)%expr_pat - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ - x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' - false s1 -> - Compile.value' - true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - end - | @expr.App _ _ _ s0 _ ($_)%expr - _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v2 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v2)%expr, - #(ident.snd)%expr @ - ($v2)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v2 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v2)%expr, - #(ident.snd)%expr @ - ($v2)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ - (@expr.Abs _ _ _ _ _ _) _ | - @expr.App _ _ _ s0 _ - (_ @ _)%expr_pat _ | @expr.App - _ _ _ s0 _ - (@expr.LetIn _ _ _ _ _ _ _) - _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - end - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - end (Compile.reflect x3) - | None => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - if - (args0 <=? 0) && (args <=? 0) && - (args0 + args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - match x with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some _ => - if (args =? 0) && (args0 =? 0) - then - UnderLets.Base - (x1, ##(0)%expr)%expr_pat - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * - base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * - base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * - base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * - base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ #(idc1)%expr_pat x4 => - match - match idc1 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ x @ - x1 @ x' v)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- - (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if args - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - (- - (#(ident.snd)%expr @ - $v1)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s0 _ ($_)%expr _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ | - @expr.App _ _ _ s0 _ (_ @ _)%expr_pat _ | @expr.App _ _ - _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - end - | @expr.App _ _ _ s _ ($_)%expr _ => - match x2 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t2 v0 => - match - t2 as t3 return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args0 => - if - (args0 <=? 0) && (args <=? 0) && (args0 + args - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - match x with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return (base.base_interp t4 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some _ => - if (args =? 0) && (args0 =? 0) - then - UnderLets.Base (x1, ##(0)%expr)%expr_pat - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ #(idc0)%expr_pat x4 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ x @ - x1 @ x' v0)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - (- - (#(ident.snd)%expr @ $v1)%expr_pat)%expr)%expr_pat) - else - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v1 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - if args - UnderLets.Base - (#(ident.fst)%expr @ - ($v2)%expr, - (- - (#(ident.snd)%expr @ - $v2)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v2 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v2)%expr, - #(ident.snd)%expr @ - ($v2)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v2 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v2)%expr, - #(ident.snd)%expr @ - ($v2)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | @expr.App _ _ _ s0 _ ($_)%expr _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App - _ _ _ s0 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s0 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ => - match x2 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - if - (args0 <=? 0) && (args <=? 0) && (args0 + args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - match x with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some _ => - if (args =? 0) && (args0 =? 0) - then - UnderLets.Base (x1, ##(0)%expr)%expr_pat - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s1 _ #(idc0)%expr_pat x4 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s1 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ x @ - x1 @ x' v)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- - (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - match - s1 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - if args - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - (- - (#(ident.snd)%expr @ - $v1)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s1 _ ($_)%expr _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s1 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App - _ _ _ s1 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s1 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s _ (_ @ _)%expr_pat _ => - match x2 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - if - (args0 <=? 0) && (args <=? 0) && (args0 + args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - match x with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some _ => - if (args =? 0) && (args0 =? 0) - then - UnderLets.Base (x1, ##(0)%expr)%expr_pat - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s1 _ #(idc0)%expr_pat x5 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s1 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ x @ - x1 @ x' v)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- - (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - match - s1 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - if args - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - (- - (#(ident.snd)%expr @ - $v1)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x5) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s1 _ ($_)%expr _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s1 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App - _ _ _ s1 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s1 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => - match x2 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - if - (args0 <=? 0) && (args <=? 0) && (args0 + args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - match x with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some _ => - if (args =? 0) && (args0 =? 0) - then - UnderLets.Base (x1, ##(0)%expr)%expr_pat - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => + => + match + a + with + | Some + x' => + UnderLets.Base + (- + (x' v * + x0))%expr + | None => + default + end) + | (s0 -> d0)%ptype => + fun + _ : + Compile.value' + false s0 -> + Compile.value' + true d0 + => default + end + (Compile.reflect + x1) + | None => default + end + | @expr.App _ _ _ s _ + ($_)%expr _ | + @expr.App _ _ _ s _ + (@expr.Abs _ _ _ _ _ + _) _ | @expr.App _ + _ _ s _ + (_ @ _)%expr_pat _ | + @expr.App _ _ _ s _ + (@expr.LetIn _ _ _ _ + _ _ _) _ => default + | _ => default0 tt + end in + match x0 with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal + t0 v => + match + t0 as t1 + return + (base.base_interp + t1 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => None + end + with + | Some args => + if args + default0 tt + end + | @expr.App _ _ _ s _ + #(idc)%expr_pat + x1 => + match + match idc with + | ident.Z_opp => + Some tt + | _ => None + end + with + | Some _ => + match x with + | @expr.App _ + _ _ s0 _ + #(idc0)%expr_pat + x2 => + match + match + idc0 + with + | ident.Z_opp => + Some tt + | _ => + None + end + with + | Some + _ => + match + s0 as t2 + return + (Compile.value' + false t2 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base + t2 => + fun + v : + defaults.expr + (type.base + t2) => + base.try_make_transport_cps + (fun + t1 : base.type + => + defaults.expr + (type.base + t1)) t2 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a : + option + (defaults.expr + (type.base + t2) -> + defaults.expr + (type.base + base.type.Z)) + => + match + a + with + | Some + x' => + match + s as t3 + return + (Compile.value' + false t3 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base + t3 => + fun + v0 : + defaults.expr + (type.base + t3) => + base.try_make_transport_cps + (fun + t1 : base.type + => + defaults.expr + (type.base + t1)) t3 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a0 : + option + (defaults.expr + (type.base + t3) -> + defaults.expr + (type.base + base.type.Z)) + => + match + a0 + with + | Some + x'0 => + UnderLets.Base + (x' v * + x'0 v0)%expr + | None => + default + end) + | (s1 -> + d1)%ptype => + fun + _ : + Compile.value' + false s1 -> + Compile.value' + true d1 + => + default + end + (Compile.reflect + x1) + | None => + default + end) + | (s1 -> + d1)%ptype => + fun + _ : + Compile.value' + false s1 -> + Compile.value' + true d1 + => + default + end + (Compile.reflect + x2) + | None => + default + end + | @expr.App _ + _ _ s0 _ + ($_)%expr + _ | + @expr.App _ + _ _ s0 _ + (@expr.Abs _ + _ _ _ _ _) + _ | + @expr.App _ + _ _ s0 _ + (_ @ _)%expr_pat + _ | + @expr.App _ + _ _ s0 _ + (@expr.LetIn + _ _ _ _ _ _ + _) _ => + default + | _ => default + end + | None => default + end + | @expr.App _ _ _ s _ + ($_)%expr _ | + @expr.App _ _ _ s _ + (@expr.Abs _ _ _ _ _ + _) _ | @expr.App _ + _ _ s _ + (_ @ _)%expr_pat _ | + @expr.App _ _ _ s _ + (@expr.LetIn _ _ _ _ + _ _ _) _ => default + | _ => default0 tt + end in + match x with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal + t0 v => + match + t0 as t1 + return + (base.base_interp + t1 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => None + end + with + | Some args => + if args + default0 tt + end + | _ => default0 tt + end in + match x0 with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal + t0 v => + match + t0 as t1 + return + (base.base_interp + t1 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => None + end + with + | Some args => + if args =? -1 + then + UnderLets.Base + (- x)%expr + else default + | None => + default0 tt + end + | _ => default0 tt + end in + match x with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal + t0 v => + match + t0 as t1 + return + (base.base_interp + t1 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => None + end + with + | Some args => + if args =? -1 + then + UnderLets.Base + (- x0)%expr + else default + | None => + default0 tt + end + | _ => default0 tt + end in + match x0 with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal + t0 v => + match + t0 as t1 + return + (base.base_interp + t1 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => None + end + with + | Some args => + if args =? 1 + then + UnderLets.Base + x + else + match x with + | @expr.App _ + _ _ s _ + #(idc0)%expr_pat + x1 => + match + match + idc0 + with + | ident.Z_opp => + Some tt + | _ => + None + end + with + | Some + _ => + match + s as t2 + return + (Compile.value' + false t2 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base + t2 => + fun + v : + defaults.expr + (type.base + t2) => + base.try_make_transport_cps + (fun + t1 : base.type + => + defaults.expr + (type.base + t1)) t2 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a : + option + (defaults.expr + (type.base + t2) -> + defaults.expr + (type.base + base.type.Z)) + => + match + a + with + | Some + x' => + if + args =? + -1 + then + UnderLets.Base + (x' v) + else + default + | None => + default + end) + | (s0 -> + d0)%ptype => + fun + _ : + Compile.value' + false s0 -> + Compile.value' + true d0 + => + default + end + (Compile.reflect + x1) + | None => + default + end + | @expr.App _ + _ _ s _ + ($_)%expr + _ | + @expr.App _ + _ _ s _ + (@expr.Abs + _ _ _ _ _ + _) _ | + @expr.App _ + _ _ s _ + (_ @ _)%expr_pat + _ | + @expr.App _ + _ _ s _ + (@expr.LetIn + _ _ _ _ _ + _ _) _ => + default + | _ => + default + end + | None => + default0 tt + end + | @expr.App _ _ _ s _ + #(idc)%expr_pat + x1 => + match + match idc with + | ident.Z_opp => + Some tt + | _ => None + end + with + | Some _ => + match x with + | #(idc0)%expr_pat => + match + match + idc0 + with + | @ident.Literal + t1 v => + match + t1 as t2 + return + (base.base_interp + t2 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end + with + | Some + args0 => + match + s as t2 + return + (Compile.value' + false t2 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base + t2 => + fun + v : + defaults.expr + (type.base + t2) => + base.try_make_transport_cps + (fun + t1 : base.type + => + defaults.expr + (type.base + t1)) t2 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a : + option + (defaults.expr + (type.base + t2) -> + defaults.expr + (type.base + base.type.Z)) + => + match + a + with + | Some + x' => + if + args0 =? + -1 + then + UnderLets.Base + (x' v) + else + default + | None => + default + end) + | (s0 -> + d0)%ptype => + fun + _ : + Compile.value' + false s0 -> + Compile.value' + true d0 + => + default + end + (Compile.reflect + x1) + | None => + default + end + | _ => default + end + | None => default + end + | @expr.App _ _ _ s _ + ($_)%expr _ | + @expr.App _ _ _ s _ + (@expr.Abs _ _ _ _ _ + _) _ | @expr.App _ + _ _ s _ + (_ @ _)%expr_pat _ | + @expr.App _ _ _ s _ + (@expr.LetIn _ _ _ _ + _ _ _) _ => default + | _ => default0 tt + end in + match x with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal t0 v => + match + t0 as t1 + return + (base.base_interp t1 -> + option Z) + with + | base.type.unit => + fun _ : unit => None + | base.type.Z => + fun v0 : Z => Some v0 + | base.type.bool => + fun _ : bool => None + | base.type.nat => + fun _ : nat => None + end v + | _ => None + end + with + | Some args => + if args =? 1 + then UnderLets.Base x0 + else default + | None => default0 tt + end + | _ => default0 tt + end in + match x0 with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal t0 v => + match + t0 as t1 + return (base.base_interp t1 -> option Z) + with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args => if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) + then UnderLets.Base ##(0)%expr + else default + | None => default0 tt end - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ #(idc0)%expr_pat x5 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ x @ - x1 @ x' v)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- - (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - if args - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - (- - (#(ident.snd)%expr @ - $v1)%expr_pat)%expr)%expr_pat) - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - | None => + | _ => default0 tt + end in + match x with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal t0 v => + match t0 as t1 return (base.base_interp t1 -> option Z) with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args => + if args =? 0 then UnderLets.Base ##(0)%expr else default + | None => default0 tt + end + | _ => default0 tt + end +| ident.Z_pow => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_pow)%expr @ x @ x0)%expr_pat in + default +| ident.Z_sub => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x - x0)%expr in + llet default0 := fun 'tt => + llet default0 := fun 'tt => + llet default0 := fun 'tt => + llet default0 := + fun 'tt => + llet default0 := + fun 'tt => + match x0 with + | @expr.App _ _ _ s _ + #(idc)%expr_pat + x1 => + match + match idc with + | ident.Z_opp => + Some tt + | _ => None + end + with + | Some _ => + match + s as t2 + return + (Compile.value' + false t2 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base + t2 => + fun + v : + defaults.expr + (type.base + t2) => + base.try_make_transport_cps + (fun + t0 : base.type + => + defaults.expr + (type.base + t0)) t2 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a : + option + (defaults.expr + (type.base + t2) -> + defaults.expr + (type.base + base.type.Z)) + => + match + a + with + | Some + x' => + UnderLets.Base + (x + x' v)%expr + | None => + default + end) + | (s0 -> d0)%ptype => + fun + _ : + Compile.value' + false s0 -> + Compile.value' + true d0 + => default + end + (Compile.reflect + x1) + | None => default + end + | @expr.App _ _ _ s _ + ($_)%expr _ | + @expr.App _ _ _ s _ + (@expr.Abs _ _ _ _ _ + _) _ | @expr.App _ + _ _ s _ + (_ @ _)%expr_pat _ | + @expr.App _ _ _ s _ + (@expr.LetIn _ _ _ _ + _ _ _) _ => default + | _ => default + end in + match x with + | @expr.App _ _ _ s _ + #(idc)%expr_pat + x1 => + match + match idc with + | ident.Z_opp => + Some tt + | _ => None + end + with + | Some _ => + match + s as t2 + return + (Compile.value' + false t2 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base + t2 => + fun + v : + defaults.expr + (type.base + t2) => + base.try_make_transport_cps + (fun + t0 : base.type + => + defaults.expr + (type.base + t0)) t2 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a : + option + (defaults.expr + (type.base + t2) -> + defaults.expr + (type.base + base.type.Z)) + => + match + a + with + | Some + x' => + UnderLets.Base + (- + (x' v + + x0))%expr + | None => + default + end) + | (s0 -> d0)%ptype => + fun + _ : + Compile.value' + false s0 -> + Compile.value' + true d0 + => default + end + (Compile.reflect + x1) + | None => default + end + | @expr.App _ _ _ s _ + ($_)%expr _ | + @expr.App _ _ _ s _ + (@expr.Abs _ _ _ _ _ + _) _ | @expr.App _ + _ _ s _ + (_ @ _)%expr_pat _ | + @expr.App _ _ _ s _ + (@expr.LetIn _ _ _ _ + _ _ _) _ => default + | _ => default0 tt + end in + match x0 with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal + t0 v => + match + t0 as t1 + return + (base.base_interp + t1 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => None + end + with + | Some args => + if args + default0 tt + end + | @expr.App _ _ _ s _ + #(idc)%expr_pat + x1 => + match + match idc with + | ident.Z_opp => + Some tt + | _ => None + end + with + | Some _ => + match x with + | @expr.App _ + _ _ s0 _ + #(idc0)%expr_pat + x2 => + match + match + idc0 + with + | ident.Z_opp => + Some tt + | _ => + None + end + with + | Some + _ => + match + s0 as t2 + return + (Compile.value' + false t2 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base + t2 => + fun + v : + defaults.expr + (type.base + t2) => + base.try_make_transport_cps + (fun + t1 : base.type + => + defaults.expr + (type.base + t1)) t2 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a : + option + (defaults.expr + (type.base + t2) -> + defaults.expr + (type.base + base.type.Z)) + => + match + a + with + | Some + x' => + match + s as t3 + return + (Compile.value' + false t3 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base + t3 => + fun + v0 : + defaults.expr + (type.base + t3) => + base.try_make_transport_cps + (fun + t1 : base.type + => + defaults.expr + (type.base + t1)) t3 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a0 : + option + (defaults.expr + (type.base + t3) -> + defaults.expr + (type.base + base.type.Z)) + => + match + a0 + with + | Some + x'0 => + UnderLets.Base + (x'0 v0 - + x' v)%expr + | None => + default + end) + | (s1 -> + d1)%ptype => + fun + _ : + Compile.value' + false s1 -> + Compile.value' + true d1 + => + default + end + (Compile.reflect + x1) + | None => + default + end) + | (s1 -> + d1)%ptype => + fun + _ : + Compile.value' + false s1 -> + Compile.value' + true d1 + => + default + end + (Compile.reflect + x2) + | None => + default + end + | @expr.App _ + _ _ s0 _ + ($_)%expr + _ | + @expr.App _ + _ _ s0 _ + (@expr.Abs _ + _ _ _ _ _) + _ | + @expr.App _ + _ _ s0 _ + (_ @ _)%expr_pat + _ | + @expr.App _ + _ _ s0 _ + (@expr.LetIn + _ _ _ _ _ _ + _) _ => + default + | _ => default + end + | None => default + end + | @expr.App _ _ _ s _ + ($_)%expr _ | + @expr.App _ _ _ s _ + (@expr.Abs _ _ _ _ _ + _) _ | @expr.App _ + _ _ s _ + (_ @ _)%expr_pat _ | + @expr.App _ _ _ s _ + (@expr.LetIn _ _ _ _ + _ _ _) _ => default + | _ => default0 tt + end in + match x with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal t0 v => + match + t0 as t1 + return + (base.base_interp t1 -> + option Z) + with + | base.type.unit => + fun _ : unit => None + | base.type.Z => + fun v0 : Z => Some v0 + | base.type.bool => + fun _ : bool => None + | base.type.nat => + fun _ : nat => None + end v + | _ => None + end + with + | Some args => + if args d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x5) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s0 _ ($_)%expr _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App - _ _ _ s0 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s0 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x2 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - if - (args0 <=? 0) && (args <=? 0) && (args0 + args - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - (- (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) - else - match x with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some _ => - if (args =? 0) && (args0 =? 0) - then - UnderLets.Base (x1, ##(0)%expr)%expr_pat - else - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) + (- (##((- args)%Z) + x0))%expr + else default + | None => default0 tt + end + | @expr.App _ _ _ s _ #(idc)%expr_pat + x1 => + match + match idc with + | ident.Z_opp => Some tt + | _ => None + end + with + | Some _ => + match x0 with + | #(idc0)%expr_pat => + match + match idc0 with + | @ident.Literal t1 v => + match + t1 as t2 + return + (base.base_interp + t2 -> + option Z) + with + | base.type.unit => + fun _ : unit => + None + | base.type.Z => + fun v0 : Z => + Some v0 + | base.type.bool => + fun _ : bool => + None + | base.type.nat => + fun _ : nat => + None + end v + | _ => None + end + with + | Some args0 => + match + s as t2 + return + (Compile.value' + false t2 -> + UnderLets.UnderLets + base.type ident + var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base t2 => + fun + v : defaults.expr + (type.base + t2) => + base.try_make_transport_cps + (fun + t1 : base.type + => + defaults.expr + (type.base t1)) + t2 base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a : option + (defaults.expr + (type.base + t2) -> + defaults.expr + (type.base + base.type.Z)) + => + match a with + | Some x' => + if + args0 >? 0 + then + UnderLets.Base + (- + (x' v + + ## + ((- args0)%Z)))%expr + else + match + s as t3 + return + (Compile.value' + false t3 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base + t3 => + fun + v0 : + defaults.expr + (type.base + t3) => + base.try_make_transport_cps + (fun + t1 : base.type + => + defaults.expr + (type.base + t1)) t3 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a0 : + option + (defaults.expr + (type.base + t3) -> + defaults.expr + (type.base + base.type.Z)) + => + match + a0 + with + | Some + x'0 => + if + args0 + default + end) + | (s0 -> d0)%ptype => + fun + _ : + Compile.value' + false s0 -> + Compile.value' + true d0 + => + default + end + (Compile.reflect + x1) + | None => + default + end) + | (s0 -> d0)%ptype => + fun + _ : Compile.value' + false s0 -> + Compile.value' + true d0 => + default + end + (Compile.reflect x1) + | None => default + end + | _ => default + end + | None => default + end + | @expr.App _ _ _ s _ ($_)%expr _ | + @expr.App _ _ _ s _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App + _ _ _ s _ (_ @ _)%expr_pat _ | + @expr.App _ _ _ s _ + (@expr.LetIn _ _ _ _ _ _ _) _ => + default + | _ => default0 tt + end in + match x0 with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal t0 v => + match + t0 as t1 + return (base.base_interp t1 -> option Z) + with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args => + if args =? 0 then UnderLets.Base x else default + | None => default0 tt end - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s _ #(idc0)%expr_pat x4 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_get_borrow)%expr @ x @ - x1 @ x' v)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- - (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a0 : option + | @expr.App _ _ _ s _ #(idc)%expr_pat x1 => + match + match idc with + | ident.Z_opp => Some tt + | _ => None + end + with + | Some _ => + match x with + | #(idc0)%expr_pat => + match + match idc0 with + | @ident.Literal t1 v => + match + t1 as t2 + return + (base.base_interp t2 -> option Z) + with + | base.type.unit => + fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => + fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args0 => + match + s as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets base.type ident + var + (defaults.expr + (type.base base.type.Z))) + with + | type.base t2 => + fun v : defaults.expr (type.base t2) + => + base.try_make_transport_cps + (fun t1 : base.type => + defaults.expr (type.base t1)) t2 + base.type.Z + (UnderLets.UnderLets base.type + ident var + (defaults.expr + (type.base base.type.Z))) + (fun + a : option (defaults.expr - (type.base t3) -> + (type.base t2) -> defaults.expr (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - if args - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - (- - (#(ident.snd)%expr @ - $v1)%expr_pat)%expr)%expr_pat) - else - if args =? 0 + => + match a with + | Some x' => + if args0 >? 0 then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ - x @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) + UnderLets.Base + (##(args0) + x' v)%expr else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var + match + s as t3 + return + (Compile.value' false t3 -> + UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base t3 => + fun + v0 : defaults.expr + (type.base t3) + => + base.try_make_transport_cps + (fun t1 : base.type => + defaults.expr + (type.base t1)) t3 + base.type.Z + (UnderLets.UnderLets + base.type ident var + (defaults.expr (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s _ ($_)%expr _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ - _ _ s _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | _ => - if args =? 0 - then - UnderLets.UnderLet - (#(ident.Z_add_get_carry)%expr @ x @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - end - | None => - match x1 with - | #(idc0)%expr_pat => + base.type.Z))) + (fun + a0 : option + (defaults.expr + (type.base + t3) -> + defaults.expr + (type.base + base.type.Z)) + => + match a0 with + | Some x'0 => + if args0 default + end) + | (s0 -> d0)%ptype => + fun + _ : Compile.value' + false s0 -> + Compile.value' + true d0 => + default + end (Compile.reflect x1) + | None => default + end) + | (s0 -> d0)%ptype => + fun + _ : Compile.value' false s0 -> + Compile.value' true d0 => + default + end (Compile.reflect x1) + | None => default + end + | _ => default + end + | None => default + end + | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s _ + (@expr.LetIn _ _ _ _ _ _ _) _ => default + | _ => default0 tt + end in + match x with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal t0 v => + match t0 as t1 return (base.base_interp t1 -> option Z) with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args => + llet default1 := fun 'tt => + if args =? 0 + then UnderLets.Base (- x0)%expr + else default in + match x0 with + | @expr.App _ _ _ s _ #(idc0)%expr_pat x1 => match match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v + | ident.Z_opp => Some tt | _ => None end with - | Some args => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - if (args =? 0) && (args0 =? 0) - then - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - ##(args)%expr @ ##(args0)%expr)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, ##(0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat + | Some _ => + match + s as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets base.type ident var + (defaults.expr (type.base base.type.Z))) + with + | type.base t2 => + fun v : defaults.expr (type.base t2) => + base.try_make_transport_cps + (fun t1 : base.type => defaults.expr (type.base t1)) + t2 base.type.Z + (UnderLets.UnderLets base.type ident var + (defaults.expr (type.base base.type.Z))) (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) + a : option + (defaults.expr (type.base t2) -> + defaults.expr (type.base base.type.Z)) => + match a with + | Some x' => + if args =? 0 + then UnderLets.Base (x' v) + else default + | None => default + end) + | (s0 -> d0)%ptype => + fun + _ : Compile.value' false s0 -> + Compile.value' true d0 => default + end (Compile.reflect x1) + | None => default end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) + | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s _ + (@expr.LetIn _ _ _ _ _ _ _) _ => default + | _ => default1 tt end + | None => default0 tt + end + | _ => default0 tt + end +| ident.Z_opp => + fun x : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (- x)%expr in + llet default0 := fun 'tt => + if negb (SubstVarLike.is_var_fst_snd_pair_opp x) + then + UnderLets.UnderLet x + (fun v : var (type.base base.type.Z) => + UnderLets.Base (- $v)%expr) + else default in + match x with + | @expr.App _ _ _ s _ #(idc)%expr_pat x0 => + match match idc with + | ident.Z_opp => Some tt + | _ => None + end with + | Some _ => + match + s as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets base.type ident var + (defaults.expr (type.base base.type.Z))) + with + | type.base t2 => + fun v : defaults.expr (type.base t2) => + base.try_make_transport_cps + (fun t0 : base.type => defaults.expr (type.base t0)) t2 + base.type.Z + (UnderLets.UnderLets base.type ident var + (defaults.expr (type.base base.type.Z))) + (fun + a : option + (defaults.expr (type.base t2) -> + defaults.expr (type.base base.type.Z)) => + match a with + | Some x' => UnderLets.Base (x' v) + | None => default + end) + | (s0 -> d0)%ptype => + fun _ : Compile.value' false s0 -> Compile.value' true d0 => + default + end (Compile.reflect x0) + | None => default + end + | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat _ | + @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => default + | _ => default0 tt + end +| ident.Z_div => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x / x0)%expr in + match x0 with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal t0 v => + match t0 as t1 return (base.base_interp t1 -> option Z) with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args => + if args =? 1 + then UnderLets.Base x + else + if args =? 2 ^ Z.log2 args + then UnderLets.Base (x >> ##(Z.log2 args))%expr + else default + | None => default + end + | _ => default + end +| ident.Z_modulo => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x mod x0)%expr in + match x0 with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal t0 v => + match t0 as t1 return (base.base_interp t1 -> option Z) with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args => + if args =? 1 + then UnderLets.Base ##(0)%expr + else + if args =? 2 ^ Z.log2 args + then UnderLets.Base (x &' ##((args - 1)%Z))%expr + else default + | None => default end - | ($_)%expr => - match x1 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t1 v0 => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args => - match x2 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t2 v0 => - match - t2 as t3 return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args0 => - if (args =? 0) && (args0 =? 0) - then - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - ##(args)%expr @ ##(args0)%expr)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, ##(0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun v1 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) + | _ => default + end +| ident.Z_log2 => + fun x : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_log2)%expr @ x)%expr_pat in + default +| ident.Z_log2_up => + fun x : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_log2_up)%expr @ x)%expr_pat in + default +| ident.Z_eqb => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_eqb)%expr @ x @ x0)%expr_pat in + default +| ident.Z_leb => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_leb)%expr @ x @ x0)%expr_pat in + default +| ident.Z_geb => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_geb)%expr @ x @ x0)%expr_pat in + default +| ident.Z_of_nat => + fun x : defaults.expr (type.base base.type.nat) => + llet default := UnderLets.Base (#(ident.Z_of_nat)%expr @ x)%expr_pat in + default +| ident.Z_to_nat => + fun x : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_to_nat)%expr @ x)%expr_pat in + default +| ident.Z_shiftr => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x >> x0)%expr in + default +| ident.Z_shiftl => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x << x0)%expr in + default +| ident.Z_land => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x &' x0)%expr in + llet default0 := fun 'tt => + match x with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal t0 v => + match + t0 as t1 + return (base.base_interp t1 -> option Z) + with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args => + if args =? 0 + then UnderLets.Base ##(0)%expr + else default + | None => default + end + | _ => default + end in + match x0 with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal t0 v => + match t0 as t1 return (base.base_interp t1 -> option Z) with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args => + if args =? 0 then UnderLets.Base ##(0)%expr else default + | None => default0 tt end - | @expr.App _ _ _ s _ #(idc)%expr_pat x3 => - match match idc with - | ident.Z_opp => Some tt - | _ => None - end with - | Some _ => - match x1 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args0 <=? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x2 @ - ##((- args0)%Z)%expr)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- - (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if args1 <=? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x'0 v0 @ x1 @ - ##((- args1)%Z)%expr)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - (- - (#(ident.snd)%expr @ - $v1)%expr_pat)%expr)%expr_pat) - else - if - (args0 =? 0) && - (args1 =? 0) - then - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ - ##(args0)%expr @ - ##(args1)%expr)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - ##(0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - #(ident.snd)%expr @ - ($v1)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args0 <=? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x2 @ - ##((- args0)%Z)%expr)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- - (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x3) - end - | ($_)%expr => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - if args0 <=? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v0 @ x2 @ ##((- args0)%Z)%expr)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - (- - (#(ident.snd)%expr @ $v1)%expr_pat)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x3) - | @expr.Abs _ _ _ _ _ _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - if args0 <=? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x2 @ ##((- args0)%Z)%expr)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- - (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x3) - | @expr.App _ _ _ s0 _ #(idc1)%expr_pat x4 => - match - match idc1 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) => - match a0 with - | Some x'0 => - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x1 @ - x'0 v0)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - (- - (#(ident.snd)%expr @ - $v1)%expr_pat)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args0 <=? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x2 @ - ##((- args0)%Z)%expr)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- - (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x3) - end - | @expr.App _ _ _ s0 _ ($_)%expr _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - if args0 <=? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v0 @ x2 @ ##((- args0)%Z)%expr)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - (- - (#(ident.snd)%expr @ $v1)%expr_pat)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x3) - | @expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ | - @expr.App _ _ _ s0 _ (_ @ _)%expr_pat _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - if args0 <=? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x2 @ ##((- args0)%Z)%expr)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- - (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x3) - | @expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - if args0 <=? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x2 @ ##((- args0)%Z)%expr)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- - (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x3) - | @expr.LetIn _ _ _ _ _ _ _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - if args0 <=? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x2 @ ##((- args0)%Z)%expr)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- - (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x3) - end - | None => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args0 <=? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x1 @ - ##((- args0)%Z)%expr)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- - (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ #(idc1)%expr_pat x4 => - match - match idc1 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => + | _ => default0 tt + end +| ident.Z_lor => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x || x0)%expr in + default +| ident.Z_bneg => + fun x : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_bneg)%expr @ x)%expr_pat in + default +| ident.Z_lnot_modulo => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_lnot_modulo)%expr @ x @ x0)%expr_pat in + default +| ident.Z_mul_split => + fun x x0 x1 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat in + llet default0 := fun 'tt => + UnderLets.UnderLet + (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat + (fun + v : var + (type.base (base.type.Z * base.type.Z)%etype) + => + UnderLets.Base + (#(ident.fst)%expr @ ($v)%expr, + #(ident.snd)%expr @ ($v)%expr)%expr_pat) in + match x with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal t0 v => + match t0 as t1 return (base.base_interp t1 -> option Z) with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some _ => + llet default1 := fun 'tt => + llet default1 := fun 'tt => + llet default1 := fun 'tt => + llet default1 := + fun 'tt => + llet default1 := + fun 'tt => + match x1 with + | #(idc0)%expr_pat => + match + match + idc0 + with + | @ident.Literal + t1 v => + match + t1 as t2 + return + (base.base_interp + t2 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end + with + | Some + args0 => + if + args0 =? + -1 + then + UnderLets.Base + ( + (- x0)%expr, + ## + (0)%expr)%expr_pat + else + default + | None => + default + end + | _ => default + end in + match x0 with + | #(idc0)%expr_pat => + match + match + idc0 + with + | @ident.Literal + t1 v => + match + t1 as t2 + return + (base.base_interp + t2 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end + with + | Some + args0 => + if + args0 =? + -1 + then + UnderLets.Base + ( + (- x1)%expr, + ## + (0)%expr)%expr_pat + else + default + | None => + default1 + tt + end + | _ => + default1 + tt + end in + match x1 with + | #(idc0)%expr_pat => + match + match + idc0 + with + | @ident.Literal + t1 v => + match + t1 as t2 + return + (base.base_interp + t2 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end + with + | Some + args0 => + if + args0 =? + 1 + then + UnderLets.Base + (x0, + ## + (0)%expr)%expr_pat + else + default + | None => + default1 + tt + end + | _ => + default1 + tt + end in + match x0 with + | #(idc0)%expr_pat => + match + match idc0 with + | @ident.Literal t1 v => + match + t1 as t2 + return + (base.base_interp + t2 -> + option Z) + with + | base.type.unit => + fun _ : unit => + None + | base.type.Z => + fun v0 : Z => + Some v0 + | base.type.bool => + fun _ : bool => + None + | base.type.nat => + fun _ : nat => + None + end v + | _ => None + end + with + | Some args0 => + if args0 =? 1 + then + UnderLets.Base + (x1, ##(0)%expr)%expr_pat + else default + | None => default1 tt + end + | _ => default1 tt + end in + match x1 with + | #(idc0)%expr_pat => + match + match idc0 with + | @ident.Literal t1 v => match - s0 as t3 + t1 as t2 return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) + (base.base_interp t2 -> option Z) with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) => - match a0 with - | Some x'0 => - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x1 @ - x'0 v0)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - (- - (#(ident.snd)%expr @ - $v1)%expr_pat)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s0 _ ($_)%expr _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ | - @expr.App _ _ _ s0 _ (_ @ _)%expr_pat _ | @expr.App _ _ - _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - end - | ($_)%expr => - match x2 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t2 v0 => - match - t2 as t3 return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args0 => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - if args0 <=? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v0 @ x1 @ ##((- args0)%Z)%expr)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - (- - (#(ident.snd)%expr @ $v1)%expr_pat)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ #(idc0)%expr_pat x4 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v1 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v0 @ x1 @ x'0 v1)%expr_pat - (fun - v2 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v2)%expr, - (- - (#(ident.snd)%expr @ $v2)%expr_pat)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | @expr.App _ _ _ s0 _ ($_)%expr _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App - _ _ _ s0 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s0 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) + | base.type.unit => + fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => + fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args0 => + if args0 =? 0 + then + UnderLets.Base + (##(0)%expr, ##(0)%expr)%expr_pat + else default + | None => default1 tt + end + | _ => default1 tt + end in + match x0 with + | #(idc0)%expr_pat => + match + match idc0 with + | @ident.Literal t1 v => + match + t1 as t2 return (base.base_interp t2 -> option Z) + with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args0 => + if args0 =? 0 + then UnderLets.Base (##(0)%expr, ##(0)%expr)%expr_pat + else default + | None => default1 tt end - | @expr.Abs _ _ _ _ _ _ => - match x2 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - if args0 <=? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x1 @ ##((- args0)%Z)%expr)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- - (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s1 _ #(idc0)%expr_pat x4 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - match - s1 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x1 @ x'0 v0)%expr_pat - (fun - v1 : var + | _ => default1 tt + end + | None => default0 tt + end + | _ => default0 tt + end +| ident.Z_add_get_carry => + fun x x0 x1 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat in + llet default0 := fun 'tt => + llet default0 := fun 'tt => + llet default0 := fun 'tt => + llet default0 := + fun 'tt => + llet default0 := + fun 'tt => + llet default0 := + fun 'tt => + UnderLets.UnderLet + (#(ident.Z_add_get_carry)%expr @ + x @ x0 @ x1)%expr_pat + (fun + v : var + (type.base + (base.type.Z * + base.type.Z)%etype) + => + UnderLets.Base + (#(ident.fst)%expr @ + ($v)%expr, + #(ident.snd)%expr @ + ($v)%expr)%expr_pat) in + match x1 with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal + t0 v => + match + t0 as t1 + return + (base.base_interp + t1 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => None + end + with + | Some args => + if args =? 0 + then + UnderLets.Base + (x0, + ##(0)%expr)%expr_pat + else default + | None => + default0 tt + end + | _ => default0 tt + end in + match x0 with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal + t0 v => + match + t0 as t1 + return + (base.base_interp + t1 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => None + end + with + | Some args => + if args =? 0 + then + UnderLets.Base + (x1, + ##(0)%expr)%expr_pat + else default + | None => + default0 tt + end + | _ => default0 tt + end in + match x1 with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal + t0 v => + match + t0 as t1 + return + (base.base_interp + t1 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => None + end + with + | Some args => + if args + UnderLets.Base + ( + # + (ident.fst)%expr @ + ($v)%expr, + (- + (# + (ident.snd)%expr @ + $v)%expr_pat)%expr)%expr_pat) + else default + | None => + default0 tt + end + | _ => default0 tt + end in + match x0 with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal t0 v => + match + t0 as t1 + return + (base.base_interp t1 -> + option Z) + with + | base.type.unit => + fun _ : unit => None + | base.type.Z => + fun v0 : Z => Some v0 + | base.type.bool => + fun _ : bool => None + | base.type.nat => + fun _ : nat => None + end v + | _ => None + end + with + | Some args => + if args - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - (- - (#(ident.snd)%expr @ $v1)%expr_pat)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s1 _ ($_)%expr _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s1 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App - _ _ _ s1 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s1 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s0 _ #(idc0)%expr_pat x4 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => defaults.expr (type.base t1)) - t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) => - match a with - | Some x' => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident var + => + UnderLets.Base + (#(ident.fst)%expr @ + ($v)%expr, + (- + (#(ident.snd)%expr @ $v)%expr_pat)%expr)%expr_pat) + else default + | None => default0 tt + end + | _ => default0 tt + end in + match x1 with + | @expr.App _ _ _ s _ #(idc)%expr_pat x2 => + match + match idc with + | ident.Z_opp => Some tt + | _ => None + end + with + | Some _ => + match + s as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets base.type ident var + (defaults.expr + (type.base + (base.type.Z * base.type.Z)%etype))) + with + | type.base t2 => + fun v : defaults.expr (type.base t2) => + base.try_make_transport_cps + (fun t0 : base.type => + defaults.expr (type.base t0)) t2 + base.type.Z + (UnderLets.UnderLets base.type ident var (defaults.expr (type.base (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a0 : option - (defaults.expr (type.base t3) -> - defaults.expr - (type.base base.type.Z)) => - match a0 with - | Some x'0 => - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x2 @ x'0 v0)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - (- - (#(ident.snd)%expr @ $v1)%expr_pat)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - end (Compile.reflect x3) - | None => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args0 <=? 0 - then + (fun + a : option + (defaults.expr (type.base t2) -> + defaults.expr + (type.base base.type.Z)) => + match a with + | Some x' => UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x1 @ - ##((- args0)%Z)%expr)%expr_pat + (#(ident.Z_sub_get_borrow)%expr @ x @ + x0 @ x' v)%expr_pat (fun v0 : var (type.base @@ -14716,1954 +3673,1280 @@ match idc in (ident t) return (Compile.value' true t) with (#(ident.fst)%expr @ ($v0)%expr, (- (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s1 _ #(idc1)%expr_pat x5 => - match - match idc1 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - match - s1 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) => - match a0 with - | Some x'0 => - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x1 @ - x'0 v0)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - (- - (#(ident.snd)%expr @ - $v1)%expr_pat)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x5) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s1 _ ($_)%expr _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s1 _ (@expr.Abs _ _ _ _ _ _) _ | - @expr.App _ _ _ s1 _ (_ @ _)%expr_pat _ | @expr.App _ _ - _ s1 _ (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - end - | @expr.App _ _ _ s0 _ ($_)%expr _ => - match x2 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t2 v0 => - match - t2 as t3 return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args0 => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - if args0 <=? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v0 @ x1 @ ##((- args0)%Z)%expr)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - (- - (#(ident.snd)%expr @ $v1)%expr_pat)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | @expr.App _ _ _ s1 _ #(idc0)%expr_pat x5 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - match - s1 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v1 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v0 @ x1 @ x'0 v1)%expr_pat - (fun - v2 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v2)%expr, - (- - (#(ident.snd)%expr @ $v2)%expr_pat)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x5) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | @expr.App _ _ _ s1 _ ($_)%expr _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | @expr.App _ _ _ s1 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App - _ _ _ s1 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s1 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | @expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ => - match x2 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - if args0 <=? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x1 @ ##((- args0)%Z)%expr)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- - (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s2 _ #(idc0)%expr_pat x5 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - match - s2 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x1 @ x'0 v0)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - (- - (#(ident.snd)%expr @ $v1)%expr_pat)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x5) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s2 _ ($_)%expr _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s2 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App - _ _ _ s2 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s2 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s0 _ (_ @ _)%expr_pat _ => - match x2 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - if args0 <=? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x1 @ ##((- args0)%Z)%expr)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- - (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s2 _ #(idc0)%expr_pat x6 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - match - s2 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x1 @ x'0 v0)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - (- - (#(ident.snd)%expr @ $v1)%expr_pat)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x6) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s2 _ ($_)%expr _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s2 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App - _ _ _ s2 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s2 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ => - match x2 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - if args0 <=? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x1 @ ##((- args0)%Z)%expr)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- - (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var + | None => default + end) + | (s0 -> d0)%ptype => + fun + _ : Compile.value' false s0 -> + Compile.value' true d0 => default + end (Compile.reflect x2) + | None => default + end + | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s _ + (@expr.LetIn _ _ _ _ _ _ _) _ => default + | _ => default0 tt + end in + match x0 with + | @expr.App _ _ _ s _ #(idc)%expr_pat x2 => + match match idc with + | ident.Z_opp => Some tt + | _ => None + end with + | Some _ => + match + s as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets base.type ident var + (defaults.expr + (type.base (base.type.Z * base.type.Z)%etype))) + with + | type.base t2 => + fun v : defaults.expr (type.base t2) => + base.try_make_transport_cps + (fun t0 : base.type => defaults.expr (type.base t0)) t2 + base.type.Z + (UnderLets.UnderLets base.type ident var + (defaults.expr + (type.base (base.type.Z * base.type.Z)%etype))) + (fun + a : option + (defaults.expr (type.base t2) -> + defaults.expr (type.base base.type.Z)) => + match a with + | Some x' => + UnderLets.UnderLet + (#(ident.Z_sub_get_borrow)%expr @ x @ x1 @ x' v)%expr_pat + (fun + v0 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s1 _ #(idc0)%expr_pat x6 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - match - s1 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident + UnderLets.Base + (#(ident.fst)%expr @ ($v0)%expr, + (- (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) + | None => default + end) + | (s0 -> d0)%ptype => + fun _ : Compile.value' false s0 -> Compile.value' true d0 => + default + end (Compile.reflect x2) + | None => default + end + | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat _ | + @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => default + | _ => default0 tt + end +| ident.Z_add_with_carry => + fun x x0 x1 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_add_with_carry)%expr @ x @ x0 @ x1)%expr_pat in + llet default0 := fun 'tt => + UnderLets.UnderLet + (#(ident.Z_add_with_carry)%expr @ x @ x0 @ x1)%expr_pat + (fun v : var (type.base base.type.Z) => + UnderLets.Base ($v)%expr) in + match x with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal t0 v => + match t0 as t1 return (base.base_interp t1 -> option Z) with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args => + if args =? 0 then UnderLets.Base (x0 + x1)%expr else default + | None => default0 tt + end + | _ => default0 tt + end +| ident.Z_add_with_get_carry => + fun x x0 x1 x2 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat in + llet default0 := fun 'tt => + llet default0 := fun 'tt => + UnderLets.UnderLet + (#(ident.Z_add_with_get_carry)%expr @ + x @ x0 @ x1 @ x2)%expr_pat + (fun + v : var + (type.base + (base.type.Z * + base.type.Z)%etype) => + UnderLets.Base + (#(ident.fst)%expr @ ($v)%expr, + #(ident.snd)%expr @ ($v)%expr)%expr_pat) in + match x1 with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal t0 v => + match + t0 as t1 + return (base.base_interp t1 -> option Z) + with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args => + match x2 with + | #(idc0)%expr_pat => + match + match idc0 with + | @ident.Literal t1 v => + match + t1 as t2 + return + (base.base_interp t2 -> option Z) + with + | base.type.unit => + fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => + fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args0 => + if (args =? 0) && (args0 =? 0) + then + UnderLets.UnderLet + (#(ident.Z_add_with_get_carry)%expr @ + x @ x0 @ ##(args)%expr @ + ##(args0)%expr)%expr_pat + (fun + v : var + (type.base + (base.type.Z * + base.type.Z)%etype) => + UnderLets.Base + (#(ident.fst)%expr @ ($v)%expr, + ##(0)%expr)%expr_pat) + else default + | None => default + end + | _ => default + end + | None => default0 tt + end + | _ => default0 tt + end in + match x0 with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal t0 v => + match t0 as t1 return (base.base_interp t1 -> option Z) with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args => + llet default1 := fun 'tt => + llet default1 := fun 'tt => + llet default1 := fun 'tt => + llet default1 := + fun 'tt => + llet default1 := + fun 'tt => + if args =? 0 + then + UnderLets.UnderLet + (#(ident.Z_add_get_carry)%expr @ + x @ x1 @ + x2)%expr_pat + (fun + v : + var + (type.base + (base.type.Z * + base.type.Z)%etype) + => + UnderLets.Base + ( + # + (ident.fst)%expr @ + ($v)%expr, + # + (ident.snd)%expr @ + ($v)%expr)%expr_pat) + else default in + match x with + | #(idc0)%expr_pat => + match + match + idc0 + with + | @ident.Literal + t1 v => + match + t1 as t2 + return + (base.base_interp + t2 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end + with + | Some + _ => + llet default2 := + fun 'tt + => + match + x2 + with + | # + (idc1)%expr_pat => + match + match + idc1 + with + | @ident.Literal + t2 v => + match + t2 as t3 + return + (base.base_interp + t3 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end + with + | Some + args1 => + if + (args =? + 0) && + (args1 =? + 0) + then + UnderLets.Base + (x1, + ## + (0)%expr)%expr_pat + else + default + | None => + default + end + | _ => + default + end in + match + x1 + with + | # + (idc1)%expr_pat => + match + match + idc1 + with + | @ident.Literal + t2 v => + match + t2 as t3 + return + (base.base_interp + t3 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end + with + | Some + args1 => + if + (args =? + 0) && + (args1 =? + 0) + then + UnderLets.Base + (x2, + ## + (0)%expr)%expr_pat + else + default + | None => + default2 + tt + end + | _ => + default2 + tt + end + | None => + default1 + tt + end + | _ => + default1 + tt + end in + match x2 with + | #(idc0)%expr_pat => + match + match + idc0 + with + | @ident.Literal + t1 v => + match + t1 as t2 + return + (base.base_interp + t2 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end + with + | Some + args0 => + if + (args0 <=? + 0) && + (args <=? + 0) && + (args0 + + args + UnderLets.Base + ( + # + (ident.fst)%expr @ + ($v)%expr, + (- + (# + (ident.snd)%expr @ + $v)%expr_pat)%expr)%expr_pat) + else + default + | None => + default1 + tt + end + | _ => + default1 + tt + end in + match x1 with + | #(idc0)%expr_pat => + match + match idc0 with + | @ident.Literal t1 v => + match + t1 as t2 + return + (base.base_interp + t2 -> + option Z) + with + | base.type.unit => + fun _ : unit => + None + | base.type.Z => + fun v0 : Z => + Some v0 + | base.type.bool => + fun _ : bool => + None + | base.type.nat => + fun _ : nat => + None + end v + | _ => None + end + with + | Some args0 => + if + (args0 <=? 0) && + (args <=? 0) && + (args0 + args + UnderLets.Base + (#(ident.fst)%expr @ + ($v)%expr, + (- + (#(ident.snd)%expr @ + $v)%expr_pat)%expr)%expr_pat) + else default + | None => default1 tt + end + | _ => default1 tt + end in + match x2 with + | @expr.App _ _ _ s _ #(idc0)%expr_pat x3 => + match + match idc0 with + | ident.Z_opp => Some tt + | _ => None + end + with + | Some _ => + match + s as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets base.type ident var (defaults.expr (type.base (base.type.Z * base.type.Z)%etype))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x1 @ x'0 v0)%expr_pat - (fun - v1 : var - (type.base - (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - (- - (#(ident.snd)%expr @ $v1)%expr_pat)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x6) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s1 _ ($_)%expr _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s1 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App - _ _ _ s1 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s1 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x2 with - | #(idc0)%expr_pat => + with + | type.base t2 => + fun v : defaults.expr (type.base t2) + => + base.try_make_transport_cps + (fun t1 : base.type => + defaults.expr (type.base t1)) t2 + base.type.Z + (UnderLets.UnderLets base.type + ident var + (defaults.expr + (type.base + (base.type.Z * + base.type.Z)%etype))) + (fun + a : option + (defaults.expr + (type.base t2) -> + defaults.expr + (type.base base.type.Z)) + => + match a with + | Some x' => + if args =? 0 + then + UnderLets.UnderLet + (#(ident.Z_sub_get_borrow)%expr @ + x @ x1 @ x' v)%expr_pat + (fun + v0 : var + (type.base + (base.type.Z * + base.type.Z)%etype) + => + UnderLets.Base + (#(ident.fst)%expr @ + ($v0)%expr, + (- + (#(ident.snd)%expr @ + $v0)%expr_pat)%expr)%expr_pat) + else + match + s as t3 + return + (Compile.value' false t3 -> + UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + (base.type.Z * + base.type.Z)%etype))) + with + | type.base t3 => + fun + v0 : defaults.expr + (type.base t3) + => + base.try_make_transport_cps + (fun t1 : base.type => + defaults.expr + (type.base t1)) t3 + base.type.Z + (UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + (base.type.Z * + base.type.Z)%etype))) + (fun + a0 : option + (defaults.expr + (type.base + t3) -> + defaults.expr + (type.base + base.type.Z)) + => + match a0 with + | Some x'0 => + if args + UnderLets.Base + (#(ident.fst)%expr @ + ($v1)%expr, + (- + (# + (ident.snd)%expr @ + $v1)%expr_pat)%expr)%expr_pat) + else default + | None => default + end) + | (s0 -> d0)%ptype => + fun + _ : Compile.value' + false s0 -> + Compile.value' + true d0 => + default + end (Compile.reflect x3) + | None => default + end) + | (s0 -> d0)%ptype => + fun + _ : Compile.value' false s0 -> + Compile.value' true d0 => + default + end (Compile.reflect x3) + | None => default + end + | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ + _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App + _ _ _ s _ (_ @ _)%expr_pat _ | @expr.App _ _ _ + s _ (@expr.LetIn _ _ _ _ _ _ _) _ => default + | _ => default1 tt + end in + match x1 with + | @expr.App _ _ _ s _ #(idc0)%expr_pat x3 => + match + match idc0 with + | ident.Z_opp => Some tt + | _ => None + end + with + | Some _ => match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end + s as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets base.type ident var + (defaults.expr + (type.base (base.type.Z * base.type.Z)%etype))) with - | Some args0 => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - if args0 <=? 0 - then - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x1 @ ##((- args0)%Z)%expr)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - (- - (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s0 -> d0)%ptype => - fun - _ : Compile.value' false s0 -> - Compile.value' true d0 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat + | type.base t2 => + fun v : defaults.expr (type.base t2) => + base.try_make_transport_cps + (fun t1 : base.type => defaults.expr (type.base t1)) + t2 base.type.Z + (UnderLets.UnderLets base.type ident var + (defaults.expr + (type.base (base.type.Z * base.type.Z)%etype))) (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ #(idc0)%expr_pat x5 => - match - match idc0 with - | ident.Z_opp => Some tt - | _ => None - end - with - | Some _ => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr (type.base base.type.Z)) - => - match a with - | Some x' => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) + a : option + (defaults.expr (type.base t2) -> + defaults.expr (type.base base.type.Z)) => + match a with + | Some x' => + if args =? 0 + then + UnderLets.UnderLet + (#(ident.Z_sub_get_borrow)%expr @ x @ x2 @ + x' v)%expr_pat + (fun + v0 : var + (type.base + (base.type.Z * base.type.Z)%etype) + => + UnderLets.Base + (#(ident.fst)%expr @ ($v0)%expr, + (- (#(ident.snd)%expr @ $v0)%expr_pat)%expr)%expr_pat) + else + match + s as t3 + return + (Compile.value' false t3 -> + UnderLets.UnderLets base.type ident var + (defaults.expr + (type.base + (base.type.Z * base.type.Z)%etype))) + with + | type.base t3 => + fun v0 : defaults.expr (type.base t3) => + base.try_make_transport_cps + (fun t1 : base.type => + defaults.expr (type.base t1)) t3 + base.type.Z + (UnderLets.UnderLets base.type ident + var + (defaults.expr + (type.base + (base.type.Z * base.type.Z)%etype))) + (fun + a0 : option + (defaults.expr (type.base t3) -> + defaults.expr + (type.base base.type.Z)) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident + match a0 with + | Some x'0 => + if args + UnderLets.Base + (#(ident.fst)%expr @ + ($v1)%expr, + (- + (#(ident.snd)%expr @ $v1)%expr_pat)%expr)%expr_pat) + else default + | None => default + end) + | (s0 -> d0)%ptype => + fun + _ : Compile.value' false s0 -> + Compile.value' true d0 => default + end (Compile.reflect x3) + | None => default + end) + | (s0 -> d0)%ptype => + fun + _ : Compile.value' false s0 -> + Compile.value' true d0 => default + end (Compile.reflect x3) + | None => default + end + | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s _ + (@expr.LetIn _ _ _ _ _ _ _) _ => default + | _ => default1 tt + end + | None => default0 tt + end + | @expr.App _ _ _ s _ #(idc)%expr_pat x3 => + match match idc with + | ident.Z_opp => Some tt + | _ => None + end with + | Some _ => + llet default1 := fun 'tt => + llet default1 := fun 'tt => + llet default1 := fun 'tt => + match x2 with + | #(idc0)%expr_pat => + match + match + idc0 + with + | @ident.Literal + t1 v => + match + t1 as t2 + return + (base.base_interp + t2 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end + with + | Some + args0 => + match + s as t2 + return + (Compile.value' + false t2 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + (base.type.Z * + base.type.Z)%etype))) + with + | type.base + t2 => + fun + v : + defaults.expr + (type.base + t2) => + base.try_make_transport_cps + (fun + t1 : base.type + => + defaults.expr + (type.base + t1)) t2 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + (base.type.Z * + base.type.Z)%etype))) + (fun + a : + option + (defaults.expr + (type.base + t2) -> + defaults.expr + (type.base + base.type.Z)) + => + match + a + with + | Some + x' => + if + args0 <=? + 0 + then + UnderLets.UnderLet + (# + (ident.Z_sub_with_get_borrow)%expr @ + x @ + x' v @ x1 @ + ## + ((- args0)%Z)%expr)%expr_pat + (fun + v0 : + var + (type.base + (base.type.Z * + base.type.Z)%etype) + => + UnderLets.Base + ( + # + (ident.fst)%expr @ + ($v0)%expr, + (- + (# + (ident.snd)%expr @ + $v0)%expr_pat)%expr)%expr_pat) + else + default + | None => + default + end) + | (s0 -> + d0)%ptype => + fun + _ : + Compile.value' + false s0 -> + Compile.value' + true d0 + => + default + end + (Compile.reflect + x3) + | None => + default + end + | _ => default + end in + match x1 with + | #(idc0)%expr_pat => + match + match idc0 with + | @ident.Literal t1 v => + match + t1 as t2 + return + (base.base_interp + t2 -> + option Z) + with + | base.type.unit => + fun _ : unit => + None + | base.type.Z => + fun v0 : Z => + Some v0 + | base.type.bool => + fun _ : bool => + None + | base.type.nat => + fun _ : nat => + None + end v + | _ => None + end + with + | Some args0 => + match + s as t2 + return + (Compile.value' + false t2 -> + UnderLets.UnderLets + base.type ident + var + (defaults.expr + (type.base + (base.type.Z * + base.type.Z)%etype))) + with + | type.base t2 => + fun + v : defaults.expr + (type.base + t2) => + base.try_make_transport_cps + (fun + t1 : base.type + => + defaults.expr + (type.base t1)) + t2 base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + (base.type.Z * + base.type.Z)%etype))) + (fun + a : option + (defaults.expr + (type.base + t2) -> + defaults.expr + (type.base + base.type.Z)) + => + match a with + | Some x' => + if + args0 <=? 0 + then + UnderLets.UnderLet + (# + (ident.Z_sub_with_get_borrow)%expr @ + x @ + x' v @ x2 @ + ## + ((- args0)%Z)%expr)%expr_pat + (fun + v0 : + var + (type.base + (base.type.Z * + base.type.Z)%etype) + => + UnderLets.Base + ( + # + (ident.fst)%expr @ + ($v0)%expr, + (- + (# + (ident.snd)%expr @ + $v0)%expr_pat)%expr)%expr_pat) + else default + | None => + default + end) + | (s0 -> d0)%ptype => + fun + _ : Compile.value' + false s0 -> + Compile.value' + true d0 => + default + end + (Compile.reflect x3) + | None => default1 tt + end + | _ => default1 tt + end in + match x2 with + | @expr.App _ _ _ s0 _ #(idc0)%expr_pat x4 => + match + match idc0 with + | ident.Z_opp => Some tt + | _ => None + end + with + | Some _ => + match + s as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets base.type ident var (defaults.expr (type.base (base.type.Z * base.type.Z)%etype))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - UnderLets.UnderLet - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x' v @ x1 @ x'0 v0)%expr_pat - (fun - v1 : var + with + | type.base t2 => + fun v : defaults.expr (type.base t2) + => + base.try_make_transport_cps + (fun t1 : base.type => + defaults.expr (type.base t1)) t2 + base.type.Z + (UnderLets.UnderLets base.type + ident var + (defaults.expr + (type.base + (base.type.Z * + base.type.Z)%etype))) + (fun + a : option + (defaults.expr + (type.base t2) -> + defaults.expr + (type.base base.type.Z)) + => + match a with + | Some x' => + match + s0 as t3 + return + (Compile.value' false t3 -> + UnderLets.UnderLets + base.type ident var + (defaults.expr (type.base (base.type.Z * - base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ - ($v1)%expr, - (- - (#(ident.snd)%expr @ $v1)%expr_pat)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x5) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | @expr.App _ _ _ s0 _ ($_)%expr _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | @expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App - _ _ _ s0 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s0 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - end - | None => + base.type.Z)%etype))) + with + | type.base t3 => + fun + v0 : defaults.expr + (type.base t3) + => + base.try_make_transport_cps + (fun t1 : base.type => + defaults.expr + (type.base t1)) t3 + base.type.Z + (UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + (base.type.Z * + base.type.Z)%etype))) + (fun + a0 : option + (defaults.expr + (type.base + t3) -> + defaults.expr + (type.base + base.type.Z)) + => + match a0 with + | Some x'0 => + UnderLets.UnderLet + (#(ident.Z_sub_with_get_borrow)%expr @ + x @ x' v @ x1 @ + x'0 v0)%expr_pat + (fun + v1 : + var + (type.base + (base.type.Z * + base.type.Z)%etype) + => + UnderLets.Base + (#(ident.fst)%expr @ + ($v1)%expr, + (- + (#(ident.snd)%expr @ + $v1)%expr_pat)%expr)%expr_pat) + | None => default + end) + | (s1 -> d1)%ptype => + fun + _ : Compile.value' + false s1 -> + Compile.value' true + d1 => default + end (Compile.reflect x4) + | None => default + end) + | (s1 -> d1)%ptype => + fun + _ : Compile.value' false s1 -> + Compile.value' true d1 => + default + end (Compile.reflect x3) + | None => default + end + | @expr.App _ _ _ s0 _ ($_)%expr _ | @expr.App _ + _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App + _ _ _ s0 _ (_ @ _)%expr_pat _ | @expr.App _ _ + _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ => + default + | _ => default1 tt + end in match x1 with - | #(idc0)%expr_pat => + | @expr.App _ _ _ s0 _ #(idc0)%expr_pat x4 => match match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v + | ident.Z_opp => Some tt | _ => None end with - | Some args => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - if (args =? 0) && (args0 =? 0) - then - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - ##(args)%expr @ ##(args0)%expr)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, ##(0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - end - | @expr.App _ _ _ s _ ($_)%expr _ => - match x1 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t1 v0 => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args => - match x2 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t2 v0 => - match - t2 as t3 return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args0 => - if (args =? 0) && (args0 =? 0) - then - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - ##(args)%expr @ ##(args0)%expr)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, ##(0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v0 : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v1 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun v1 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v1)%expr, - #(ident.snd)%expr @ ($v1)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - end - | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ - (_ @ _)%expr_pat _ | @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) - _ => - match x1 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match - t0 as t1 return (base.base_interp t1 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - match x2 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - if (args =? 0) && (args0 =? 0) - then - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - ##(args)%expr @ ##(args0)%expr)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, ##(0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | _ => - match x1 with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match - t0 as t1 return (base.base_interp t1 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - match x2 with - | #(idc0)%expr_pat => + | Some _ => match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end + s as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets base.type ident var + (defaults.expr + (type.base (base.type.Z * base.type.Z)%etype))) with - | Some args0 => - if (args =? 0) && (args0 =? 0) - then - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - ##(args)%expr @ ##(args0)%expr)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, ##(0)%expr)%expr_pat) - else - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat - (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat + | type.base t2 => + fun v : defaults.expr (type.base t2) => + base.try_make_transport_cps + (fun t1 : base.type => defaults.expr (type.base t1)) + t2 base.type.Z + (UnderLets.UnderLets base.type ident var + (defaults.expr + (type.base (base.type.Z * base.type.Z)%etype))) (fun - v : var - (type.base - (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) - end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v0 : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun - v : var - (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) + a : option + (defaults.expr (type.base t2) -> + defaults.expr (type.base base.type.Z)) => + match a with + | Some x' => + match + s0 as t3 + return + (Compile.value' false t3 -> + UnderLets.UnderLets base.type ident var + (defaults.expr + (type.base + (base.type.Z * base.type.Z)%etype))) + with + | type.base t3 => + fun v0 : defaults.expr (type.base t3) => + base.try_make_transport_cps + (fun t1 : base.type => + defaults.expr (type.base t1)) t3 + base.type.Z + (UnderLets.UnderLets base.type ident var + (defaults.expr + (type.base + (base.type.Z * base.type.Z)%etype))) + (fun + a0 : option + (defaults.expr (type.base t3) -> + defaults.expr + (type.base base.type.Z)) => + match a0 with + | Some x'0 => + UnderLets.UnderLet + (#(ident.Z_sub_with_get_borrow)%expr @ + x @ x' v @ x2 @ x'0 v0)%expr_pat + (fun + v1 : var + (type.base + (base.type.Z * + base.type.Z)%etype) + => + UnderLets.Base + (#(ident.fst)%expr @ + ($v1)%expr, + (- + (#(ident.snd)%expr @ $v1)%expr_pat)%expr)%expr_pat) + | None => default + end) + | (s1 -> d1)%ptype => + fun + _ : Compile.value' false s1 -> + Compile.value' true d1 => default + end (Compile.reflect x4) + | None => default + end) + | (s1 -> d1)%ptype => + fun + _ : Compile.value' false s1 -> + Compile.value' true d1 => default + end (Compile.reflect x3) + | None => default end - | None => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) - => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) + | @expr.App _ _ _ s0 _ ($_)%expr _ | @expr.App _ _ _ s0 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s0 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s0 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => default + | _ => default1 tt end - | ($_)%expr => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun v0 : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v0)%expr, - #(ident.snd)%expr @ ($v0)%expr)%expr_pat) - | _ => - UnderLets.UnderLet - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - (fun v : var (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base - (#(ident.fst)%expr @ ($v)%expr, - #(ident.snd)%expr @ ($v)%expr)%expr_pat) + | None => default end + | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ (_ @ _)%expr_pat _ | + @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => default + | _ => default0 tt end | ident.Z_sub_get_borrow => fun x x0 x1 : defaults.expr (type.base base.type.Z) => + llet _ := UnderLets.Base + (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat in UnderLets.UnderLet (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat (fun v : var (type.base (base.type.Z * base.type.Z)%etype) => @@ -16671,6 +4954,8 @@ match idc in (ident t) return (Compile.value' true t) with (#(ident.fst)%expr @ ($v)%expr, #(ident.snd)%expr @ ($v)%expr)%expr_pat) | ident.Z_sub_with_get_borrow => fun x x0 x1 x2 : defaults.expr (type.base base.type.Z) => + llet _ := UnderLets.Base + (#(ident.Z_sub_with_get_borrow)%expr @ x @ x0 @ x1 @ x2)%expr_pat in UnderLets.UnderLet (#(ident.Z_sub_with_get_borrow)%expr @ x @ x0 @ x1 @ x2)%expr_pat (fun v : var (type.base (base.type.Z * base.type.Z)%etype) => @@ -16678,21 +4963,30 @@ match idc in (ident t) return (Compile.value' true t) with (#(ident.fst)%expr @ ($v)%expr, #(ident.snd)%expr @ ($v)%expr)%expr_pat) | ident.Z_zselect => fun x x0 x1 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_zselect)%expr @ x @ x0 @ x1)%expr_pat + llet default := UnderLets.Base + (#(ident.Z_zselect)%expr @ x @ x0 @ x1)%expr_pat in + default | ident.Z_add_modulo => fun x x0 x1 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_add_modulo)%expr @ x @ x0 @ x1)%expr_pat + llet default := UnderLets.Base + (#(ident.Z_add_modulo)%expr @ x @ x0 @ x1)%expr_pat in + default | ident.Z_rshi => fun x x0 x1 x2 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_rshi)%expr @ x @ x0 @ x1 @ x2)%expr_pat + llet default := UnderLets.Base + (#(ident.Z_rshi)%expr @ x @ x0 @ x1 @ x2)%expr_pat in + default | ident.Z_cc_m => fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_cc_m)%expr @ x @ x0)%expr_pat + llet default := UnderLets.Base (#(ident.Z_cc_m)%expr @ x @ x0)%expr_pat in + default | ident.Z_cast range => fun x : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_cast range)%expr @ x)%expr_pat + llet default := UnderLets.Base (#(ident.Z_cast range)%expr @ x)%expr_pat in + default | ident.Z_cast2 range => fun x : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => + llet default := UnderLets.Base (#(ident.Z_cast2 range)%expr @ x)%expr_pat in match x with | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ #(idc)%expr_pat x1) x0 => match @@ -16755,88 +5049,103 @@ match idc in (ident t) return (Compile.value' true t) with #(ident.Z_cast (snd range))%expr @ ($(x'0 v0))%expr)%expr_pat; UnderLets.Base (id (id fv)))%under_lets - | None => - UnderLets.Base - (#(ident.Z_cast2 range)%expr @ x)%expr_pat + | None => default end) | (s1 -> d1)%ptype => fun _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_cast2 range)%expr @ x)%expr_pat + Compile.value' true d1 => default end (Compile.reflect x0) - | None => - UnderLets.Base - (#(ident.Z_cast2 range)%expr @ x)%expr_pat + | None => default end) | (s1 -> d1)%ptype => fun _ : Compile.value' false s1 -> Compile.value' true d1 => - UnderLets.Base (#(ident.Z_cast2 range)%expr @ x)%expr_pat + default end (Compile.reflect x1) - | None => UnderLets.Base (#(ident.Z_cast2 range)%expr @ x)%expr_pat + | None => default 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 _ _ _ _ _ _ _) _) _ => - UnderLets.Base (#(ident.Z_cast2 range)%expr @ x)%expr_pat + s _ (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _) _ => default | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (#(ident.Z_cast2 range)%expr @ x)%expr_pat - | _ => UnderLets.Base (#(ident.Z_cast2 range)%expr @ x)%expr_pat + (@expr.LetIn _ _ _ _ _ _ _) _ => default + | _ => default end | ident.fancy_add log2wordmax imm => fun x : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_add log2wordmax imm)%expr @ x)%expr_pat + llet default := UnderLets.Base + (#(ident.fancy_add log2wordmax imm)%expr @ x)%expr_pat in + default | ident.fancy_addc log2wordmax imm => fun x : defaults.expr (type.base (base.type.Z * base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_addc log2wordmax imm)%expr @ x)%expr_pat + llet default := UnderLets.Base + (#(ident.fancy_addc log2wordmax imm)%expr @ x)%expr_pat in + default | ident.fancy_sub log2wordmax imm => fun x : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_sub log2wordmax imm)%expr @ x)%expr_pat + llet default := UnderLets.Base + (#(ident.fancy_sub log2wordmax imm)%expr @ x)%expr_pat in + default | ident.fancy_subb log2wordmax imm => fun x : defaults.expr (type.base (base.type.Z * base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_subb log2wordmax imm)%expr @ x)%expr_pat + llet default := UnderLets.Base + (#(ident.fancy_subb log2wordmax imm)%expr @ x)%expr_pat in + default | ident.fancy_mulll log2wordmax => fun x : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_mulll log2wordmax)%expr @ x)%expr_pat + llet default := UnderLets.Base + (#(ident.fancy_mulll log2wordmax)%expr @ x)%expr_pat in + default | ident.fancy_mullh log2wordmax => fun x : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_mullh log2wordmax)%expr @ x)%expr_pat + llet default := UnderLets.Base + (#(ident.fancy_mullh log2wordmax)%expr @ x)%expr_pat in + default | ident.fancy_mulhl log2wordmax => fun x : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_mulhl log2wordmax)%expr @ x)%expr_pat + llet default := UnderLets.Base + (#(ident.fancy_mulhl log2wordmax)%expr @ x)%expr_pat in + default | ident.fancy_mulhh log2wordmax => fun x : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_mulhh log2wordmax)%expr @ x)%expr_pat + llet default := UnderLets.Base + (#(ident.fancy_mulhh log2wordmax)%expr @ x)%expr_pat in + default | ident.fancy_rshi log2wordmax x => fun x0 : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_rshi log2wordmax x)%expr @ x0)%expr_pat + llet default := UnderLets.Base + (#(ident.fancy_rshi log2wordmax x)%expr @ x0)%expr_pat in + default | ident.fancy_selc => fun x : defaults.expr (type.base (base.type.Z * base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_selc)%expr @ x)%expr_pat + llet default := UnderLets.Base (#(ident.fancy_selc)%expr @ x)%expr_pat in + default | ident.fancy_selm log2wordmax => fun x : defaults.expr (type.base (base.type.Z * base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_selm log2wordmax)%expr @ x)%expr_pat + llet default := UnderLets.Base + (#(ident.fancy_selm log2wordmax)%expr @ x)%expr_pat in + default | ident.fancy_sell => fun x : defaults.expr (type.base (base.type.Z * base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_sell)%expr @ x)%expr_pat + llet default := UnderLets.Base (#(ident.fancy_sell)%expr @ x)%expr_pat in + default | ident.fancy_addm => fun x : defaults.expr (type.base (base.type.Z * base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_addm)%expr @ x)%expr_pat + llet default := UnderLets.Base (#(ident.fancy_addm)%expr @ x)%expr_pat in + default end : Compile.value' true t diff --git a/src/Experiments/NewPipeline/fancy_rewrite_head.out b/src/Experiments/NewPipeline/fancy_rewrite_head.out index b93038b7c..5d5edd8e9 100644 --- a/src/Experiments/NewPipeline/fancy_rewrite_head.out +++ b/src/Experiments/NewPipeline/fancy_rewrite_head.out @@ -8,43 +8,62 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.UnderLets base.type ident var (defaults.expr (type.base t0))) with - | base.type.unit => fun v0 : unit => UnderLets.Base ##(v0)%expr - | base.type.Z => fun v0 : Z => UnderLets.Base ##(v0)%expr - | base.type.bool => fun v0 : bool => UnderLets.Base ##(v0)%expr - | base.type.nat => fun v0 : nat => UnderLets.Base ##(v0)%expr + | base.type.unit => + fun v0 : unit => llet default := UnderLets.Base ##(v0)%expr in + default + | base.type.Z => + fun v0 : Z => llet default := UnderLets.Base ##(v0)%expr in + default + | base.type.bool => + fun v0 : bool => llet default := UnderLets.Base ##(v0)%expr in + default + | base.type.nat => + fun v0 : nat => llet default := UnderLets.Base ##(v0)%expr in + default end v | ident.Nat_succ => fun x : defaults.expr (type.base base.type.nat) => - UnderLets.Base (#(ident.Nat_succ)%expr @ x)%expr_pat + llet default := UnderLets.Base (#(ident.Nat_succ)%expr @ x)%expr_pat in + default | ident.Nat_pred => fun x : defaults.expr (type.base base.type.nat) => - UnderLets.Base (#(ident.Nat_pred)%expr @ x)%expr_pat + llet default := UnderLets.Base (#(ident.Nat_pred)%expr @ x)%expr_pat in + default | ident.Nat_max => fun x x0 : defaults.expr (type.base base.type.nat) => - UnderLets.Base (#(ident.Nat_max)%expr @ x @ x0)%expr_pat + llet default := UnderLets.Base (#(ident.Nat_max)%expr @ x @ x0)%expr_pat in + default | ident.Nat_mul => fun x x0 : defaults.expr (type.base base.type.nat) => - UnderLets.Base (#(ident.Nat_mul)%expr @ x @ x0)%expr_pat + llet default := UnderLets.Base (#(ident.Nat_mul)%expr @ x @ x0)%expr_pat in + default | ident.Nat_add => fun x x0 : defaults.expr (type.base base.type.nat) => - UnderLets.Base (#(ident.Nat_add)%expr @ x @ x0)%expr_pat + llet default := UnderLets.Base (#(ident.Nat_add)%expr @ x @ x0)%expr_pat in + default | ident.Nat_sub => fun x x0 : defaults.expr (type.base base.type.nat) => - UnderLets.Base (#(ident.Nat_sub)%expr @ x @ x0)%expr_pat -| @ident.nil t => UnderLets.Base []%expr_pat + llet default := UnderLets.Base (#(ident.Nat_sub)%expr @ x @ x0)%expr_pat in + default +| @ident.nil t => llet default := UnderLets.Base []%expr_pat in + default | @ident.cons t => fun (x : defaults.expr (type.base t)) (x0 : defaults.expr (type.base (base.type.list t))) => - UnderLets.Base (x :: x0)%expr_pat + llet default := UnderLets.Base (x :: x0)%expr_pat in + default | @ident.pair A B => fun (x : defaults.expr (type.base A)) (x0 : defaults.expr (type.base B)) - => UnderLets.Base (x, x0)%expr_pat + => llet default := UnderLets.Base (x, x0)%expr_pat in + default | @ident.fst A B => fun x : defaults.expr (type.base (A * B)%etype) => - UnderLets.Base (#(ident.fst)%expr @ x)%expr_pat + llet default := UnderLets.Base (#(ident.fst)%expr @ x)%expr_pat in + default | @ident.snd A B => fun x : defaults.expr (type.base (A * B)%etype) => - UnderLets.Base (#(ident.snd)%expr @ x)%expr_pat + llet default := UnderLets.Base (#(ident.snd)%expr @ x)%expr_pat in + default | @ident.prod_rect A B T => fun (x : defaults.expr (type.base A) -> @@ -52,10 +71,11 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.UnderLets base.type ident var (defaults.expr (type.base T))) (x0 : defaults.expr (type.base (A * B)%etype)) => - UnderLets.Base - (#(ident.prod_rect)%expr @ - (λ (x1 : var (type.base A))(x2 : var (type.base B)), - UnderLets.to_expr (x ($x1) ($x2)))%expr @ x0)%expr_pat + llet default := UnderLets.Base + (#(ident.prod_rect)%expr @ + (λ (x1 : var (type.base A))(x2 : var (type.base B)), + UnderLets.to_expr (x ($x1) ($x2)))%expr @ x0)%expr_pat in + default | @ident.bool_rect T => fun (x @@ -63,12 +83,13 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.UnderLets base.type ident var (defaults.expr (type.base T))) (x1 : defaults.expr (type.base base.type.bool)) => - UnderLets.Base - (#(ident.bool_rect)%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x2)))%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x0 ($x2)))%expr @ x1)%expr_pat + llet default := UnderLets.Base + (#(ident.bool_rect)%expr @ + (λ x2 : var (type.base base.type.unit), + UnderLets.to_expr (x ($x2)))%expr @ + (λ x2 : var (type.base base.type.unit), + UnderLets.to_expr (x0 ($x2)))%expr @ x1)%expr_pat in + default | @ident.nat_rect P => fun (x : defaults.expr (type.base base.type.unit) -> @@ -79,12 +100,15 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.UnderLets base.type ident var (defaults.expr (type.base P))) (x1 : defaults.expr (type.base base.type.nat)) => - UnderLets.Base - (#(ident.nat_rect)%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x2)))%expr @ - (λ (x2 : var (type.base base.type.nat))(x3 : var (type.base P)), - UnderLets.to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat + llet default := UnderLets.Base + (#(ident.nat_rect)%expr @ + (λ x2 : var (type.base base.type.unit), + UnderLets.to_expr (x ($x2)))%expr @ + (λ (x2 : var (type.base base.type.nat))(x3 : var + (type.base + P)), + UnderLets.to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat in + default | @ident.nat_rect_arrow P Q => fun (x : defaults.expr (type.base P) -> @@ -99,18 +123,22 @@ match idc in (ident t) return (Compile.value' true t) with (defaults.expr (type.base Q))) (x1 : defaults.expr (type.base base.type.nat)) (x2 : defaults.expr (type.base P)) => - UnderLets.Base - (#(ident.nat_rect_arrow)%expr @ - (λ x3 : var (type.base P), - UnderLets.to_expr (x ($x3)))%expr @ - (λ (x3 : var (type.base base.type.nat))(x4 : var - (type.base P -> - type.base Q)%ptype) - (x5 : var (type.base P)), - UnderLets.to_expr - (x0 ($x3) - (fun x6 : defaults.expr (type.base P) => - UnderLets.Base ($x4 @ x6)%expr_pat) ($x5)))%expr @ x1 @ x2)%expr_pat + llet default := UnderLets.Base + (#(ident.nat_rect_arrow)%expr @ + (λ x3 : var (type.base P), + UnderLets.to_expr (x ($x3)))%expr @ + (λ (x3 : var (type.base base.type.nat))(x4 : var + (type.base + P -> + type.base + Q)%ptype) + (x5 : var (type.base P)), + UnderLets.to_expr + (x0 ($x3) + (fun x6 : defaults.expr (type.base P) => + UnderLets.Base ($x4 @ x6)%expr_pat) ($x5)))%expr @ + x1 @ x2)%expr_pat in + default | @ident.list_rect A P => fun (x : defaults.expr (type.base base.type.unit) -> @@ -122,13 +150,19 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.UnderLets base.type ident var (defaults.expr (type.base P))) (x1 : defaults.expr (type.base (base.type.list A))) => - UnderLets.Base - (#(ident.list_rect)%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x2)))%expr @ - (λ (x2 : var (type.base A))(x3 : var (type.base (base.type.list A))) - (x4 : var (type.base P)), - UnderLets.to_expr (x0 ($x2) ($x3) ($x4)))%expr @ x1)%expr_pat + llet default := UnderLets.Base + (#(ident.list_rect)%expr @ + (λ x2 : var (type.base base.type.unit), + UnderLets.to_expr (x ($x2)))%expr @ + (λ (x2 : var (type.base A))(x3 : var + (type.base + (base.type.list + A)))(x4 : + var + (type.base + P)), + UnderLets.to_expr (x0 ($x2) ($x3) ($x4)))%expr @ x1)%expr_pat in + default | @ident.list_case A P => fun (x : defaults.expr (type.base base.type.unit) -> @@ -139,70 +173,89 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.UnderLets base.type ident var (defaults.expr (type.base P))) (x1 : defaults.expr (type.base (base.type.list A))) => - UnderLets.Base - (#(ident.list_case)%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x2)))%expr @ - (λ (x2 : var (type.base A))(x3 : var (type.base (base.type.list A))), - UnderLets.to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat + llet default := UnderLets.Base + (#(ident.list_case)%expr @ + (λ x2 : var (type.base base.type.unit), + UnderLets.to_expr (x ($x2)))%expr @ + (λ (x2 : var (type.base A))(x3 : var + (type.base + (base.type.list + A))), + UnderLets.to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat in + default | @ident.List_length T => fun x : defaults.expr (type.base (base.type.list T)) => - UnderLets.Base (#(ident.List_length)%expr @ x)%expr_pat + llet default := UnderLets.Base (#(ident.List_length)%expr @ x)%expr_pat in + default | ident.List_seq => fun x x0 : defaults.expr (type.base base.type.nat) => - UnderLets.Base (#(ident.List_seq)%expr @ x @ x0)%expr_pat + llet default := UnderLets.Base (#(ident.List_seq)%expr @ x @ x0)%expr_pat in + default | @ident.List_firstn A => fun (x : defaults.expr (type.base base.type.nat)) (x0 : defaults.expr (type.base (base.type.list A))) => - UnderLets.Base (#(ident.List_firstn)%expr @ x @ x0)%expr_pat + llet default := UnderLets.Base + (#(ident.List_firstn)%expr @ x @ x0)%expr_pat in + default | @ident.List_skipn A => fun (x : defaults.expr (type.base base.type.nat)) (x0 : defaults.expr (type.base (base.type.list A))) => - UnderLets.Base (#(ident.List_skipn)%expr @ x @ x0)%expr_pat + llet default := UnderLets.Base + (#(ident.List_skipn)%expr @ x @ x0)%expr_pat in + default | @ident.List_repeat A => fun (x : defaults.expr (type.base A)) (x0 : defaults.expr (type.base base.type.nat)) => - UnderLets.Base (#(ident.List_repeat)%expr @ x @ x0)%expr_pat + llet default := UnderLets.Base + (#(ident.List_repeat)%expr @ x @ x0)%expr_pat in + default | @ident.List_combine A B => fun (x : defaults.expr (type.base (base.type.list A))) (x0 : defaults.expr (type.base (base.type.list B))) => - UnderLets.Base (#(ident.List_combine)%expr @ x @ x0)%expr_pat + llet default := UnderLets.Base + (#(ident.List_combine)%expr @ x @ x0)%expr_pat in + default | @ident.List_map A B => fun (x : defaults.expr (type.base A) -> UnderLets.UnderLets base.type ident var (defaults.expr (type.base B))) (x0 : defaults.expr (type.base (base.type.list A))) => - UnderLets.Base - (#(ident.List_map)%expr @ - (λ x1 : var (type.base A), - UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat + llet default := UnderLets.Base + (#(ident.List_map)%expr @ + (λ x1 : var (type.base A), + UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat in + default | @ident.List_app A => fun x x0 : defaults.expr (type.base (base.type.list A)) => - UnderLets.Base (x ++ x0)%expr + llet default := UnderLets.Base (x ++ x0)%expr in + default | @ident.List_rev A => fun x : defaults.expr (type.base (base.type.list A)) => - UnderLets.Base (#(ident.List_rev)%expr @ x)%expr_pat + llet default := UnderLets.Base (#(ident.List_rev)%expr @ x)%expr_pat in + default | @ident.List_flat_map A B => fun (x : defaults.expr (type.base A) -> UnderLets.UnderLets base.type ident var (defaults.expr (type.base (base.type.list B)))) (x0 : defaults.expr (type.base (base.type.list A))) => - UnderLets.Base - (#(ident.List_flat_map)%expr @ - (λ x1 : var (type.base A), - UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat + llet default := UnderLets.Base + (#(ident.List_flat_map)%expr @ + (λ x1 : var (type.base A), + UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat in + default | @ident.List_partition A => fun (x : defaults.expr (type.base A) -> UnderLets.UnderLets base.type ident var (defaults.expr (type.base base.type.bool))) (x0 : defaults.expr (type.base (base.type.list A))) => - UnderLets.Base - (#(ident.List_partition)%expr @ - (λ x1 : var (type.base A), - UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat + llet default := UnderLets.Base + (#(ident.List_partition)%expr @ + (λ x1 : var (type.base A), + UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat in + default | @ident.List_fold_right A B => fun (x : defaults.expr (type.base B) -> @@ -211,30 +264,36 @@ match idc in (ident t) return (Compile.value' true t) with (defaults.expr (type.base A))) (x0 : defaults.expr (type.base A)) (x1 : defaults.expr (type.base (base.type.list B))) => - UnderLets.Base - (#(ident.List_fold_right)%expr @ - (λ (x2 : var (type.base B))(x3 : var (type.base A)), - UnderLets.to_expr (x ($x2) ($x3)))%expr @ x0 @ x1)%expr_pat + llet default := UnderLets.Base + (#(ident.List_fold_right)%expr @ + (λ (x2 : var (type.base B))(x3 : var (type.base A)), + UnderLets.to_expr (x ($x2) ($x3)))%expr @ x0 @ x1)%expr_pat in + default | @ident.List_update_nth T => fun (x : defaults.expr (type.base base.type.nat)) (x0 : defaults.expr (type.base T) -> UnderLets.UnderLets base.type ident var (defaults.expr (type.base T))) (x1 : defaults.expr (type.base (base.type.list T))) => - UnderLets.Base - (#(ident.List_update_nth)%expr @ x @ - (λ x2 : var (type.base T), - UnderLets.to_expr (x0 ($x2)))%expr @ x1)%expr_pat + llet default := UnderLets.Base + (#(ident.List_update_nth)%expr @ x @ + (λ x2 : var (type.base T), + UnderLets.to_expr (x0 ($x2)))%expr @ x1)%expr_pat in + default | @ident.List_nth_default T => fun (x : defaults.expr (type.base T)) (x0 : defaults.expr (type.base (base.type.list T))) (x1 : defaults.expr (type.base base.type.nat)) => - UnderLets.Base (#(ident.List_nth_default)%expr @ x @ x0 @ x1)%expr_pat + llet default := UnderLets.Base + (#(ident.List_nth_default)%expr @ x @ x0 @ x1)%expr_pat in + default | ident.Z_add => fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (x + x0)%expr + llet default := UnderLets.Base (x + x0)%expr in + default | ident.Z_mul => fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x * x0)%expr in match x with | #(idc)%expr_pat => match @@ -260,179 +319,68 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some _ => - match x1 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if - args1 =? - 2 ^ (2 * Z.log2_up args1 / 2) - 1 - then - match - invert_low (2 * Z.log2_up args1) - args - with - | Some x3 => - UnderLets.Base - (#(ident.fancy_mulll - (2 * Z.log2_up args1))%expr @ - (##(x3)%expr, x' v))%expr_pat - | None => - match x2 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t4 v0 => - match - t4 as t5 - return - (base.base_interp - t5 -> option Z) - with - | base.type.unit => - fun _ : unit => - None - | base.type.Z => - fun v1 : Z => - Some v1 - | base.type.bool => - fun _ : bool => - None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s as t4 - return - (Compile.value' false - t4 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base - t4) => - base.try_make_transport_cps - (fun t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args2 =? - 2 - ^ (2 * - Z.log2_up - args2 / 2) - - 1 - then + llet default0 := fun 'tt => + llet default0 := fun 'tt => + match x1 with + | #(idc1)%expr_pat => + match + match idc1 with + | @ident.Literal + t2 v => match - invert_low - (2 * - Z.log2_up - args2) - args + t2 as t3 + return + (base.base_interp + t3 -> + option Z) with - | Some x3 => - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args2))%expr @ - (## - (x3)%expr, - x'0 v0))%expr_pat - | None => - match - s as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => None + end + with + | Some args1 => + match + s0 as t2 + return + (Compile.value' + false t2 -> + UnderLets.UnderLets base.type ident var (defaults.expr (type.base base.type.Z))) - with - | type.base - t5 => - fun - v1 : + with + | type.base + t2 => + fun + v : defaults.expr (type.base - t5) => - base.try_make_transport_cps + t2) => + base.try_make_transport_cps (fun - t6 : base.type + t3 : base.type => defaults.expr (type.base - t6)) t5 + t3)) t2 base.type.Z (UnderLets.UnderLets base.type @@ -441,34 +389,34 @@ match idc in (ident t) return (Compile.value' true t) with (type.base base.type.Z))) (fun - a1 : + a : option (defaults.expr (type.base - t5) -> + t2) -> defaults.expr (type.base base.type.Z)) => match - a1 + a with | Some - x'1 => + x' => if - args2 =? + args1 =? 2 ^ (2 * Z.log2_up - args2 / 2) - + args1 / 2) - 1 then match invert_high (2 * Z.log2_up - args2) + args1) args with | Some @@ -478,59 +426,160 @@ match idc in (ident t) return (Compile.value' true t) with (ident.fancy_mulhl (2 * Z.log2_up - args2))%expr @ + args1))%expr @ (## (x3)%expr, - x'1 v1))%expr_pat + x' v))%expr_pat | None => - match - s0 as t6 - return - (Compile.value' - false t6 -> - UnderLets.UnderLets + default + end + else + default + | None => + default + end) + | (s1 -> d1)%ptype => + fun + _ : + Compile.value' + false s1 -> + Compile.value' + true d1 + => default + end + (Compile.reflect + x2) + | None => default + end + | _ => default + end in + match x2 with + | #(idc1)%expr_pat => + match + match idc1 with + | @ident.Literal t2 v => + match + t2 as t3 + return + (base.base_interp t3 -> + option Z) + with + | base.type.unit => + fun _ : unit => None + | base.type.Z => + fun v0 : Z => Some v0 + | base.type.bool => + fun _ : bool => None + | base.type.nat => + fun _ : nat => None + end v + | _ => None + end + with + | Some args1 => + match + s as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base base.type.Z))) + with + | type.base t2 => + fun + v : defaults.expr + (type.base t2) => + base.try_make_transport_cps + (fun t3 : base.type => + defaults.expr + (type.base t3)) t2 + base.type.Z + (UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a : option + (defaults.expr + (type.base t2) -> + defaults.expr + (type.base + base.type.Z)) + => + match a with + | Some x' => + if + args1 =? + 2 + ^ (2 * + Z.log2_up args1 / + 2) - 1 + then + match + invert_low + (2 * + Z.log2_up args1) + args + with + | Some x3 => + UnderLets.Base + (#(ident.fancy_mulll + (2 * + Z.log2_up + args1))%expr @ + (##(x3)%expr, + x' v))%expr_pat + | None => + match + s as t3 + return + (Compile.value' + false t3 -> + UnderLets.UnderLets base.type ident var (defaults.expr (type.base base.type.Z))) - with - | type.base - t6 => - fun - v2 : + with + | type.base + t3 => + fun + v0 : defaults.expr (type.base - t6) => - base.try_make_transport_cps - (fun - t7 : base.type + t3) => + base.try_make_transport_cps + (fun + t4 : base.type => defaults.expr (type.base - t7)) t6 - base.type.Z - (UnderLets.UnderLets + t4)) t3 + base.type.Z + (UnderLets.UnderLets base.type ident var (defaults.expr (type.base base.type.Z))) - (fun - a2 : + (fun + a0 : option (defaults.expr (type.base - t6) -> + t3) -> defaults.expr (type.base base.type.Z)) => match - a2 + a0 with | Some - x'2 => + x'0 => if args1 =? 2 @@ -557,82 +606,71 @@ match idc in (ident t) return (Compile.value' true t) with args1))%expr @ (## (x3)%expr, - x'2 v2))%expr_pat + x'0 v0))%expr_pat | None => - UnderLets.Base - (x * x0)%expr + default end else - UnderLets.Base - (x * x0)%expr + default | None => - UnderLets.Base - (x * x0)%expr + default end) - | (s1 -> - d1)%ptype => - fun - _ : + | (s1 -> d1)%ptype => + fun + _ : Compile.value' false s1 -> Compile.value' true d1 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) - end - else - match - s0 as t6 - return - (Compile.value' - false t6 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base + => default + end + (Compile.reflect + x1) + end + else + match + s as t3 + return + (Compile.value' + false t3 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base base.type.Z))) - with - | type.base - t6 => - fun - v2 : - defaults.expr - (type.base - t6) => - base.try_make_transport_cps - (fun - t7 : base.type - => - defaults.expr + with + | type.base t3 => + fun + v0 : defaults.expr (type.base - t7)) t6 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr + t3) => + base.try_make_transport_cps + (fun + t4 : base.type + => + defaults.expr + (type.base + t4)) t3 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr (type.base base.type.Z))) - (fun - a2 : - option + (fun + a0 : + option (defaults.expr (type.base - t6) -> + t3) -> defaults.expr (type.base base.type.Z)) - => - match - a2 - with - | Some - x'2 => + => + match a0 with + | Some x'0 => if args1 =? 2 @@ -659,133 +697,375 @@ match idc in (ident t) return (Compile.value' true t) with args1))%expr @ (## (x3)%expr, - x'2 v2))%expr_pat + x'0 v0))%expr_pat | None => - UnderLets.Base - (x * x0)%expr + default end else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> - d1)%ptype => - fun - _ : - Compile.value' - false s1 -> - Compile.value' - true d1 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> - d1)%ptype => - fun - _ : - Compile.value' + default + | None => + default + end) + | (s1 -> d1)%ptype => + fun + _ : Compile.value' false s1 -> - Compile.value' + Compile.value' true d1 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x1) - end - else - match - s as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t5 => - fun - v1 : - defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base + => default + end + (Compile.reflect + x1) + | None => default + end) + | (s1 -> d1)%ptype => + fun + _ : Compile.value' false + s1 -> + Compile.value' true d1 + => default + end (Compile.reflect x1) + | None => default0 tt + end + | _ => default0 tt + end in + match x1 with + | #(idc1)%expr_pat => + match + match idc1 with + | @ident.Literal t2 v => + match + t2 as t3 + return (base.base_interp t3 -> option Z) + with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args1 => + match + s0 as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets base.type ident var + (defaults.expr (type.base base.type.Z))) + with + | type.base t2 => + fun v : defaults.expr (type.base t2) => + base.try_make_transport_cps + (fun t3 : base.type => + defaults.expr (type.base t3)) t2 + base.type.Z + (UnderLets.UnderLets base.type ident var + (defaults.expr (type.base base.type.Z))) + (fun + a : option + (defaults.expr (type.base t2) -> + defaults.expr + (type.base base.type.Z)) => + match a with + | Some x' => + if + args1 =? + 2 ^ (2 * Z.log2_up args1 / 2) - 1 + then + match + invert_low (2 * Z.log2_up args1) + args + with + | Some x3 => + UnderLets.Base + (#(ident.fancy_mulll + (2 * Z.log2_up args1))%expr @ + (##(x3)%expr, x' v))%expr_pat + | None => default + end + else default + | None => default + end) + | (s1 -> d1)%ptype => + fun + _ : Compile.value' false s1 -> + Compile.value' true d1 => default + end (Compile.reflect x2) + | None => default0 tt + end + | _ => default0 tt + end + | None => + match + match idc0 with + | ident.Z_shiftr => Some tt + | _ => None + end + with + | Some _ => + match x1 with + | #(idc1)%expr_pat => + match + match idc1 with + | @ident.Literal t2 v => + match + t2 as t3 + return (base.base_interp t3 -> option Z) + with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args1 => + match + s0 as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets base.type ident var + (defaults.expr (type.base base.type.Z))) + with + | type.base t2 => + fun v : defaults.expr (type.base t2) => + base.try_make_transport_cps + (fun t3 : base.type => + defaults.expr (type.base t3)) t2 + base.type.Z + (UnderLets.UnderLets base.type ident + var + (defaults.expr + (type.base base.type.Z))) + (fun + a : option + (defaults.expr (type.base t2) -> + defaults.expr + (type.base base.type.Z)) => + match a with + | Some x' => + match + invert_low (2 * args1) args + with + | Some x3 => + UnderLets.Base + (#(ident.fancy_mullh + (2 * args1))%expr @ + (##(x3)%expr, x' v))%expr_pat + | None => + match + s0 as t3 + return + (Compile.value' false t3 -> + UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base t3 => + fun + v0 : defaults.expr + (type.base t3) => + base.try_make_transport_cps + (fun t4 : base.type => + defaults.expr + (type.base t4)) t3 + base.type.Z + (UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a0 : option + (defaults.expr + (type.base + t3) -> + defaults.expr + (type.base base.type.Z)) - => + => + match a0 with + | Some x'0 => + match + invert_high + (2 * args1) + args + with + | Some x3 => + UnderLets.Base + (#(ident.fancy_mulhh + (2 * + args1))%expr @ + (##(x3)%expr, + x'0 v0))%expr_pat + | None => default + end + | None => default + end) + | (s1 -> d1)%ptype => + fun + _ : Compile.value' false + s1 -> + Compile.value' true + d1 => default + end (Compile.reflect x2) + end + | None => default + end) + | (s1 -> d1)%ptype => + fun + _ : Compile.value' false s1 -> + Compile.value' true d1 => default + end (Compile.reflect x2) + | None => default + end + | _ => default + end + | None => default + end + 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 _ _ _ _ _ _ _) _) _ => + default + | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ + ($_)%expr _ | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | + @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => default + | _ => default + end + | None => default + end + | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ #(idc)%expr_pat x2) x1 => + match match idc with + | ident.Z_land => Some tt + | _ => None + end with + | Some _ => + llet default0 := fun 'tt => + llet default0 := fun 'tt => + llet default0 := fun 'tt => + llet default0 := + fun 'tt => + llet default0 := + fun 'tt => + llet default0 := + fun 'tt => + llet default0 := + fun 'tt => + llet default0 := + fun 'tt => + llet default0 := + fun 'tt => + match x1 with + | #(idc0)%expr_pat => + match match - a1 + idc0 with - | Some - x'1 => - if - args2 =? - 2 - ^ - (2 * - Z.log2_up - args2 / 2) - - 1 - then + | @ident.Literal + t1 v => match - invert_high - (2 * - Z.log2_up - args2) - args + t1 as t2 + return + (base.base_interp + t2 -> + option Z) with - | Some - x3 => - UnderLets.Base - (# - (ident.fancy_mulhl - (2 * - Z.log2_up - args2))%expr @ - (## - (x3)%expr, - x'1 v1))%expr_pat - | None => + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end + with + | Some + args0 => + match + x0 + with + | (@expr.App + _ _ _ s2 + _ #(idc1) + x4 @ x3)%expr_pat => + match + match + idc1 + with + | ident.Z_shiftr => + Some tt + | _ => + None + end + with + | Some + _ => + match + x3 + with + | # + (idc2)%expr_pat => + match + match + idc2 + with + | @ident.Literal + t3 v => + match + t3 as t4 + return + (base.base_interp + t4 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end + with + | Some + args2 => match - s0 as t6 + s0 as t3 return (Compile.value' - false t6 -> + false t3 -> UnderLets.UnderLets base.type ident var @@ -794,19 +1074,19 @@ match idc in (ident t) return (Compile.value' true t) with base.type.Z))) with | type.base - t6 => + t3 => fun - v2 : + v : defaults.expr (type.base - t6) => + t3) => base.try_make_transport_cps (fun - t7 : base.type + t4 : base.type => defaults.expr (type.base - t7)) t6 + t4)) t3 base.type.Z (UnderLets.UnderLets base.type @@ -815,79 +1095,25 @@ match idc in (ident t) return (Compile.value' true t) with (type.base base.type.Z))) (fun - a2 : + a : option (defaults.expr (type.base - t6) -> + t3) -> defaults.expr (type.base base.type.Z)) => match - a2 - with - | Some - x'2 => - if - args1 =? - 2 - ^ - (2 * - Z.log2_up - args1 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args1) - args + a with | Some - x3 => - UnderLets.Base - (# - (ident.fancy_mulhl - (2 * - Z.log2_up - args1))%expr @ - (## - (x3)%expr, - x'2 v2))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> - d1)%ptype => - fun - _ : - Compile.value' - false s1 -> - Compile.value' - true d1 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) - end - else + x' => match - s0 as t6 + s2 as t4 return (Compile.value' - false t6 -> + false t4 -> UnderLets.UnderLets base.type ident var @@ -896,19 +1122,19 @@ match idc in (ident t) return (Compile.value' true t) with base.type.Z))) with | type.base - t6 => + t4 => fun - v2 : + v0 : defaults.expr (type.base - t6) => + t4) => base.try_make_transport_cps (fun - t7 : base.type + t5 : base.type => defaults.expr (type.base - t7)) t6 + t5)) t4 base.type.Z (UnderLets.UnderLets base.type @@ -917,682 +1143,214 @@ match idc in (ident t) return (Compile.value' true t) with (type.base base.type.Z))) (fun - a2 : + a0 : option (defaults.expr (type.base - t6) -> + t4) -> defaults.expr (type.base base.type.Z)) => match - a2 + a0 with | Some - x'2 => + x'0 => if - args1 =? + args0 =? 2 ^ (2 * - Z.log2_up - args1 / 2) - + args2 / 2) - 1 then - match - invert_high - (2 * - Z.log2_up - args1) - args - with - | Some - x3 => UnderLets.Base (# - (ident.fancy_mulhl + (ident.fancy_mullh (2 * - Z.log2_up - args1))%expr @ - (## - (x3)%expr, - x'2 v2))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end + args2))%expr @ + ( + x' v, + x'0 v0))%expr_pat else - UnderLets.Base - (x * x0)%expr + default | None => - UnderLets.Base - (x * x0)%expr + default end) - | (s1 -> - d1)%ptype => + | (s3 -> + d3)%ptype => fun _ : Compile.value' - false s1 -> + false s3 -> Compile.value' - true d1 + true d3 => - UnderLets.Base - (x * x0)%expr + default end (Compile.reflect - x2) + x4) | None => - UnderLets.Base - (x * x0)%expr + default end) - | (s1 -> d1)%ptype => + | (s3 -> + d3)%ptype => fun _ : Compile.value' - false s1 -> + false s3 -> Compile.value' - true d1 + true d3 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x1) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' - false s1 -> - Compile.value' - true d1 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x1) - | None => - match - s0 as t4 - return - (Compile.value' false - t4 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base - t4) => - base.try_make_transport_cps - (fun t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args1 =? - 2 - ^ (2 * - Z.log2_up - args1 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args1) - args - with - | Some x3 => - UnderLets.Base - (# - (ident.fancy_mulhl - (2 * - Z.log2_up - args1))%expr @ - (## - (x3)%expr, - x'0 v0))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' - false s1 -> - Compile.value' - true d1 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - end - | ($_)%expr => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v1 : defaults.expr - (type.base t4) - => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args1 =? - 2 - ^ (2 * - Z.log2_up - args1 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args1) - args - with - | Some x3 => - UnderLets.Base - (#(ident.fancy_mulhl - (2 * - Z.log2_up - args1))%expr @ - (## - (x3)%expr, - x'0 v1))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' - false s1 -> - Compile.value' true - d1 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - | @expr.Abs _ _ _ _ _ _ => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args1 =? - 2 - ^ (2 * - Z.log2_up - args1 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args1) - args - with - | Some x3 => - UnderLets.Base - (#(ident.fancy_mulhl - (2 * - Z.log2_up - args1))%expr @ - (## - (x3)%expr, - x'0 v0))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' - false s2 -> - Compile.value' true - d2 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - | (_ @ _)%expr_pat => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args1 =? - 2 - ^ (2 * - Z.log2_up - args1 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args1) - args - with - | Some x4 => - UnderLets.Base - (#(ident.fancy_mulhl - (2 * - Z.log2_up - args1))%expr @ - (## - (x4)%expr, - x'0 v0))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' - false s2 -> - Compile.value' true - d2 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - | @expr.LetIn _ _ _ _ _ _ _ => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args1 =? - 2 - ^ (2 * - Z.log2_up - args1 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args1) - args - with - | Some x4 => - UnderLets.Base - (#(ident.fancy_mulhl - (2 * - Z.log2_up - args1))%expr @ - (## - (x4)%expr, - x'0 v0))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' - false s1 -> - Compile.value' true - d1 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - end - end - else - match x2 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t4 v0 => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) - => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args2 =? - 2 - ^ (2 * - Z.log2_up - args2 / 2) - - 1 - then - match - invert_low - (2 * - Z.log2_up - args2) - args - with - | Some x3 => - UnderLets.Base - (#(ident.fancy_mulll - (2 * - Z.log2_up - args2))%expr @ - (## - (x3)%expr, - x'0 v0))%expr_pat - | None => - match - s as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t5 => + default + end + (Compile.reflect + x2) + | None => + default + end + | _ => + default + end + | None => + default + end + | (@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 => + default + | _ => + default + end + | None => + default + end + | _ => default + end in + match x2 with + | #(idc0)%expr_pat => + match + match + idc0 + with + | @ident.Literal + t1 v => + match + t1 as t2 + return + (base.base_interp + t2 -> + option Z) + with + | base.type.unit => fun - v1 : - defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end + with + | Some + args0 => + match + x0 + with + | (@expr.App + _ _ _ s2 + _ #(idc1) + x4 @ x3)%expr_pat => + match match - a1 + idc1 + with + | ident.Z_shiftr => + Some tt + | _ => + None + end with | Some - x'1 => - if - args2 =? - 2 - ^ - (2 * - Z.log2_up - args2 / 2) - - 1 - then + _ => match - invert_high - (2 * - Z.log2_up - args2) - args + x3 + with + | # + (idc2)%expr_pat => + match + match + idc2 + with + | @ident.Literal + t3 v => + match + t3 as t4 + return + (base.base_interp + t4 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end with | Some - x3 => - UnderLets.Base - (# - (ident.fancy_mulhl - (2 * - Z.log2_up - args2))%expr @ - (## - (x3)%expr, - x'1 v1))%expr_pat - | None => + args2 => match - s0 as t6 + s as t3 return (Compile.value' - false t6 -> + false t3 -> UnderLets.UnderLets base.type ident var @@ -1601,19 +1359,19 @@ match idc in (ident t) return (Compile.value' true t) with base.type.Z))) with | type.base - t6 => + t3 => fun - v2 : + v : defaults.expr (type.base - t6) => + t3) => base.try_make_transport_cps (fun - t7 : base.type + t4 : base.type => defaults.expr (type.base - t7)) t6 + t4)) t3 base.type.Z (UnderLets.UnderLets base.type @@ -1622,79 +1380,25 @@ match idc in (ident t) return (Compile.value' true t) with (type.base base.type.Z))) (fun - a2 : + a : option (defaults.expr (type.base - t6) -> + t3) -> defaults.expr (type.base base.type.Z)) => match - a2 - with - | Some - x'2 => - if - args1 =? - 2 - ^ - (2 * - Z.log2_up - args1 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args1) - args + a with | Some - x3 => - UnderLets.Base - (# - (ident.fancy_mulhl - (2 * - Z.log2_up - args1))%expr @ - (## - (x3)%expr, - x'2 v2))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> - d1)%ptype => - fun - _ : - Compile.value' - false s1 -> - Compile.value' - true d1 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) - end - else + x' => match - s0 as t6 + s2 as t4 return (Compile.value' - false t6 -> + false t4 -> UnderLets.UnderLets base.type ident var @@ -1703,19 +1407,19 @@ match idc in (ident t) return (Compile.value' true t) with base.type.Z))) with | type.base - t6 => + t4 => fun - v2 : + v0 : defaults.expr (type.base - t6) => + t4) => base.try_make_transport_cps (fun - t7 : base.type + t5 : base.type => defaults.expr (type.base - t7)) t6 + t5)) t4 base.type.Z (UnderLets.UnderLets base.type @@ -1724,171 +1428,217 @@ match idc in (ident t) return (Compile.value' true t) with (type.base base.type.Z))) (fun - a2 : + a0 : option (defaults.expr (type.base - t6) -> + t4) -> defaults.expr (type.base base.type.Z)) => match - a2 + a0 with | Some - x'2 => + x'0 => if - args1 =? + args0 =? 2 ^ (2 * - Z.log2_up - args1 / 2) - + args2 / 2) - 1 then - match - invert_high - (2 * - Z.log2_up - args1) - args - with - | Some - x3 => UnderLets.Base (# - (ident.fancy_mulhl + (ident.fancy_mullh (2 * - Z.log2_up - args1))%expr @ - (## - (x3)%expr, - x'2 v2))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end + args2))%expr @ + ( + x' v, + x'0 v0))%expr_pat else - UnderLets.Base - (x * x0)%expr + default | None => - UnderLets.Base - (x * x0)%expr + default end) - | (s1 -> - d1)%ptype => + | (s3 -> + d3)%ptype => fun _ : Compile.value' - false s1 -> + false s3 -> Compile.value' - true d1 + true d3 => - UnderLets.Base - (x * x0)%expr + default end (Compile.reflect - x2) + x4) | None => - UnderLets.Base - (x * x0)%expr + default end) - | (s1 -> d1)%ptype => + | (s3 -> + d3)%ptype => fun _ : Compile.value' - false s1 -> + false s3 -> Compile.value' - true d1 + true d3 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect + default + end + (Compile.reflect x1) - end - else - match - s as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t5 => - fun - v1 : - defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => + | None => + default + end + | _ => + default + end + | None => + default + end + | (@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 => + default + | _ => + default + end + | None => + default0 + tt + end + | _ => + default0 + tt + end in + match x1 with + | #(idc0)%expr_pat => match - a1 + match + idc0 + with + | @ident.Literal + t1 v => + match + t1 as t2 + return + (base.base_interp + t2 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end with | Some - x'1 => - if - args2 =? - 2 - ^ - (2 * - Z.log2_up - args2 / 2) - - 1 - then + args0 => match - invert_high - (2 * - Z.log2_up - args2) - args + x0 + with + | (@expr.App + _ _ _ s2 + _ #(idc1) + x4 @ x3)%expr_pat => + match + match + idc1 + with + | ident.Z_land => + Some tt + | _ => + None + end with | Some - x3 => - UnderLets.Base - (# - (ident.fancy_mulhl - (2 * - Z.log2_up - args2))%expr @ - (## - (x3)%expr, - x'1 v1))%expr_pat - | None => + _ => + match + x3 + with + | # + (idc2)%expr_pat => + match + match + idc2 + with + | @ident.Literal + t3 v => + match + t3 as t4 + return + (base.base_interp + t4 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end + with + | Some + args2 => match - s0 as t6 + s0 as t3 return (Compile.value' - false t6 -> + false t3 -> UnderLets.UnderLets base.type ident var @@ -1897,19 +1647,19 @@ match idc in (ident t) return (Compile.value' true t) with base.type.Z))) with | type.base - t6 => + t3 => fun - v2 : + v : defaults.expr (type.base - t6) => + t3) => base.try_make_transport_cps (fun - t7 : base.type + t4 : base.type => defaults.expr (type.base - t7)) t6 + t4)) t3 base.type.Z (UnderLets.UnderLets base.type @@ -1918,79 +1668,25 @@ match idc in (ident t) return (Compile.value' true t) with (type.base base.type.Z))) (fun - a2 : + a : option (defaults.expr (type.base - t6) -> + t3) -> defaults.expr (type.base base.type.Z)) => match - a2 - with - | Some - x'2 => - if - args1 =? - 2 - ^ - (2 * - Z.log2_up - args1 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args1) - args + a with | Some - x3 => - UnderLets.Base - (# - (ident.fancy_mulhl - (2 * - Z.log2_up - args1))%expr @ - (## - (x3)%expr, - x'2 v2))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> - d1)%ptype => - fun - _ : - Compile.value' - false s1 -> - Compile.value' - true d1 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) - end - else + x' => match - s0 as t6 + s2 as t4 return (Compile.value' - false t6 -> + false t4 -> UnderLets.UnderLets base.type ident var @@ -1999,19 +1695,19 @@ match idc in (ident t) return (Compile.value' true t) with base.type.Z))) with | type.base - t6 => + t4 => fun - v2 : + v0 : defaults.expr (type.base - t6) => + t4) => base.try_make_transport_cps (fun - t7 : base.type + t5 : base.type => defaults.expr (type.base - t7)) t6 + t5)) t4 base.type.Z (UnderLets.UnderLets base.type @@ -2020,2115 +1716,1232 @@ match idc in (ident t) return (Compile.value' true t) with (type.base base.type.Z))) (fun - a2 : + a0 : option (defaults.expr (type.base - t6) -> + t4) -> defaults.expr (type.base base.type.Z)) => match - a2 + a0 with | Some - x'2 => + x'0 => if - args1 =? + (args0 =? 2 ^ (2 * Z.log2_up - args1 / 2) - - 1 - then - match - invert_high + args0 / 2) - + 1) && + (args2 =? + 2 + ^ (2 * Z.log2_up - args1) - args - with - | Some - x3 => + args0 / 2) - + 1) + then UnderLets.Base (# - (ident.fancy_mulhl + (ident.fancy_mulll (2 * Z.log2_up - args1))%expr @ - (## - (x3)%expr, - x'2 v2))%expr_pat + args0))%expr @ + ( + x' v, + x'0 v0))%expr_pat + else + default | None => - UnderLets.Base - (x * x0)%expr + default + end) + | (s3 -> + d3)%ptype => + fun + _ : + Compile.value' + false s3 -> + Compile.value' + true d3 + => + default end - else - UnderLets.Base - (x * x0)%expr + (Compile.reflect + x4) | None => - UnderLets.Base - (x * x0)%expr + default end) - | (s1 -> - d1)%ptype => + | (s3 -> + d3)%ptype => fun _ : Compile.value' - false s1 -> + false s3 -> Compile.value' - true d1 + true d3 => - UnderLets.Base - (x * x0)%expr + default end (Compile.reflect x2) + | None => + default + end + | _ => + default + end + | None => + default + end + | (@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 => + default + | _ => + default + end | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : - Compile.value' - false s1 -> - Compile.value' - true d1 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x1) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' - false s1 -> - Compile.value' true - d1 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x1) - | None => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) - => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base + default0 + tt + end + | _ => + default0 + tt + end in + match x2 with + | #(idc0)%expr_pat => + match + match + idc0 + with + | @ident.Literal + t1 v => + match + t1 as t2 + return + (base.base_interp + t2 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end + with + | Some + args0 => + match + x0 + with + | (@expr.App + _ _ _ s2 + _ #(idc1) + x4 @ x3)%expr_pat => + match + match + idc1 + with + | ident.Z_land => + Some tt + | _ => + None + end + with + | Some + _ => + match + x3 + with + | # + (idc2)%expr_pat => + match + match + idc2 + with + | @ident.Literal + t3 v => + match + t3 as t4 + return + (base.base_interp + t4 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end + with + | Some + args2 => + match + s as t3 + return + (Compile.value' + false t3 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base + t3 => + fun + v : + defaults.expr + (type.base + t3) => + base.try_make_transport_cps + (fun + t4 : base.type + => + defaults.expr + (type.base + t4)) t3 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a : + option + (defaults.expr + (type.base + t3) -> + defaults.expr + (type.base + base.type.Z)) + => + match + a + with + | Some + x' => + match + s2 as t4 + return + (Compile.value' + false t4 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base + t4 => + fun + v0 : + defaults.expr + (type.base + t4) => + base.try_make_transport_cps + (fun + t5 : base.type + => + defaults.expr + (type.base + t5)) t4 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a0 : + option + (defaults.expr + (type.base t4) -> - defaults.expr - (type.base + defaults.expr + (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - if - args1 =? - 2 - ^ (2 * - Z.log2_up - args1 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args1) - args - with - | Some x3 => - UnderLets.Base - (#(ident.fancy_mulhl + => + match + a0 + with + | Some + x'0 => + if + (args0 =? + 2 + ^ (2 * Z.log2_up - args1))%expr @ - (## - (x3)%expr, - x'0 v0))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' - false s1 -> - Compile.value' true - d1 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - end - | ($_)%expr => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t4 => - fun - v1 : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args1 =? - 2 - ^ (2 * - Z.log2_up args1 / - 2) - 1 - then - match - invert_high - (2 * - Z.log2_up args1) - args - with - | Some x3 => - UnderLets.Base - (#(ident.fancy_mulhl - (2 * + args0 / 2) - + 1) && + (args2 =? + 2 + ^ + (2 * Z.log2_up - args1))%expr @ - (##(x3)%expr, - x'0 v1))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | @expr.Abs _ _ _ _ _ _ => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args1 =? - 2 - ^ (2 * - Z.log2_up args1 / - 2) - 1 - then - match - invert_high - (2 * - Z.log2_up args1) - args - with - | Some x3 => - UnderLets.Base - (#(ident.fancy_mulhl - (2 * + args0 / 2) - + 1) + then + UnderLets.Base + (# + (ident.fancy_mulll + (2 * Z.log2_up - args1))%expr @ - (##(x3)%expr, - x'0 v0))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | (_ @ _)%expr_pat => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args1 =? - 2 - ^ (2 * - Z.log2_up args1 / - 2) - 1 - then - match - invert_high - (2 * - Z.log2_up args1) - args - with - | Some x4 => - UnderLets.Base - (#(ident.fancy_mulhl - (2 * - Z.log2_up - args1))%expr @ - (##(x4)%expr, - x'0 v0))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | @expr.LetIn _ _ _ _ _ _ _ => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args1 =? - 2 - ^ (2 * - Z.log2_up args1 / - 2) - 1 - then - match - invert_high - (2 * - Z.log2_up args1) - args - with - | Some x4 => - UnderLets.Base - (#(ident.fancy_mulhl - (2 * - Z.log2_up - args1))%expr @ - (##(x4)%expr, - x'0 v0))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - end - | None => UnderLets.Base (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - match x2 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun v : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if - args1 =? - 2 ^ (2 * Z.log2_up args1 / 2) - - 1 - then - match - invert_low - (2 * Z.log2_up args1) - args - with - | Some x3 => - UnderLets.Base - (#(ident.fancy_mulll - (2 * - Z.log2_up args1))%expr @ - (##(x3)%expr, x' v))%expr_pat - | None => - match - s as t4 - return - (Compile.value' false - t4 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base + args0))%expr @ + ( + x' v, + x'0 v0))%expr_pat + else + default + | None => + default + end) + | (s3 -> + d3)%ptype => + fun + _ : + Compile.value' + false s3 -> + Compile.value' + true d3 + => + default + end + (Compile.reflect + x4) + | None => + default + end) + | (s3 -> + d3)%ptype => + fun + _ : + Compile.value' + false s3 -> + Compile.value' + true d3 + => + default + end + (Compile.reflect + x1) + | None => + default + end + | _ => + default + end + | None => + default + end + | (@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 => + default + | _ => + default + end + | None => + default0 + tt + end + | _ => + default0 + tt + end in + match x1 with + | #(idc0)%expr_pat => + match + match + idc0 + with + | @ident.Literal + t1 v => + match + t1 as t2 + return + (base.base_interp + t2 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end + with + | Some + args0 => + match + x0 + with + | @expr.App + _ _ _ s1 + _ + (# + (idc1) @ + x4)%expr_pat + x3 => + match + match + idc1 + with + | ident.Z_land => + Some tt + | _ => + None + end + with + | Some + _ => + match + x4 + with + | # + (idc2)%expr_pat => + match + match + idc2 + with + | @ident.Literal + t3 v => + match + t3 as t4 + return + (base.base_interp + t4 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end + with + | Some + args2 => + match + s0 as t3 + return + (Compile.value' + false t3 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base + t3 => + fun + v : + defaults.expr + (type.base + t3) => + base.try_make_transport_cps + (fun + t4 : base.type + => + defaults.expr + (type.base + t4)) t3 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a : + option + (defaults.expr + (type.base + t3) -> + defaults.expr + (type.base + base.type.Z)) + => + match + a + with + | Some + x' => + match + s1 as t4 + return + (Compile.value' + false t4 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base + t4 => + fun + v0 : + defaults.expr + (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option + base.try_make_transport_cps + (fun + t5 : base.type + => + defaults.expr + (type.base + t5)) t4 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a0 : + option (defaults.expr (type.base t4) -> defaults.expr (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - if - args1 =? - 2 - ^ (2 * - Z.log2_up - args1 / 2) - - 1 - then - match - invert_high + => + match + a0 + with + | Some + x'0 => + if + (args0 =? + 2 + ^ (2 * Z.log2_up - args1) - args - with - | Some x3 => + args0 / 2) - + 1) && + (args2 =? + 2 + ^ + (2 * + Z.log2_up + args0 / 2) - + 1) + then UnderLets.Base (# - (ident.fancy_mulhl + (ident.fancy_mulll (2 * Z.log2_up - args1))%expr @ - (## - (x3)%expr, + args0))%expr @ + ( + x' v, x'0 v0))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' - false s1 -> - Compile.value' - true d1 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x1) - end - else - match - s as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) - => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base + else + default + | None => + default + end) + | (s3 -> + d3)%ptype => + fun + _ : + Compile.value' + false s3 -> + Compile.value' + true d3 + => + default + end + (Compile.reflect + x3) + | None => + default + end) + | (s3 -> + d3)%ptype => + fun + _ : + Compile.value' + false s3 -> + Compile.value' + true d3 + => + default + end + (Compile.reflect + x2) + | None => + default + end + | _ => + default + end + | None => + default + end + | @expr.App + _ _ _ s1 + _ + #(_)%expr_pat + _ | + @expr.App + _ _ _ s1 + _ + ($_)%expr + _ | + @expr.App + _ _ _ s1 + _ + (@expr.Abs + _ _ _ _ _ + _) _ | + @expr.App + _ _ _ s1 + _ + (($_)%expr @ + _)%expr_pat + _ | + @expr.App + _ _ _ s1 + _ + (@expr.Abs + _ _ _ _ _ + _ @ _)%expr_pat + _ | + @expr.App + _ _ _ s1 + _ + (_ @ _ @ + _)%expr_pat + _ | + @expr.App + _ _ _ s1 + _ + (@expr.LetIn + _ _ _ _ _ + _ _ @ _)%expr_pat + _ | + @expr.App + _ _ _ s1 + _ + (@expr.LetIn + _ _ _ _ _ + _ _) _ => + default + | _ => + default + end + | None => + default0 + tt + end + | _ => + default0 + tt + end in + match x2 with + | #(idc0)%expr_pat => + match + match + idc0 + with + | @ident.Literal + t1 v => + match + t1 as t2 + return + (base.base_interp + t2 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end + with + | Some + args0 => + match + x0 + with + | @expr.App + _ _ _ s1 + _ + (# + (idc1) @ + x4)%expr_pat + x3 => + match + match + idc1 + with + | ident.Z_land => + Some tt + | _ => + None + end + with + | Some + _ => + match + x4 + with + | # + (idc2)%expr_pat => + match + match + idc2 + with + | @ident.Literal + t3 v => + match + t3 as t4 + return + (base.base_interp + t4 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end + with + | Some + args2 => + match + s as t3 + return + (Compile.value' + false t3 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base + t3 => + fun + v : + defaults.expr + (type.base + t3) => + base.try_make_transport_cps + (fun + t4 : base.type + => + defaults.expr + (type.base + t4)) t3 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a : + option + (defaults.expr + (type.base + t3) -> + defaults.expr + (type.base + base.type.Z)) + => + match + a + with + | Some + x' => + match + s1 as t4 + return + (Compile.value' + false t4 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base + t4 => + fun + v0 : + defaults.expr + (type.base + t4) => + base.try_make_transport_cps + (fun + t5 : base.type + => + defaults.expr + (type.base + t5)) t4 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a0 : + option + (defaults.expr + (type.base t4) -> - defaults.expr - (type.base + defaults.expr + (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - if - args1 =? - 2 - ^ (2 * - Z.log2_up - args1 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args1) - args - with - | Some x3 => - UnderLets.Base - (#(ident.fancy_mulhl + => + match + a0 + with + | Some + x'0 => + if + (args0 =? + 2 + ^ (2 * Z.log2_up - args1))%expr @ - (## - (x3)%expr, - x'0 v0))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' - false s1 -> - Compile.value' true - d1 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x1) - | None => - UnderLets.Base (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - end - | ($_)%expr => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return (base.base_interp t4 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args1 => - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t3) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if - args1 =? - 2 ^ (2 * Z.log2_up args1 / 2) - 1 - then - match - invert_low - (2 * Z.log2_up args1) args - with - | Some x3 => - UnderLets.Base - (#(ident.fancy_mulll - (2 * Z.log2_up args1))%expr @ - (##(x3)%expr, x' v0))%expr_pat - | None => - match - s as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v1 : defaults.expr - (type.base t4) - => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args1 =? - 2 - ^ (2 * - Z.log2_up - args1 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args1) - args - with - | Some x3 => - UnderLets.Base - (#(ident.fancy_mulhl - (2 * - Z.log2_up - args1))%expr @ - (## - (x3)%expr, - x'0 v1))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' - false s1 -> - Compile.value' true - d1 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x1) - end - else - match - s as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t4 => - fun - v1 : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args1 =? - 2 - ^ (2 * - Z.log2_up args1 / - 2) - 1 - then - match - invert_high - (2 * - Z.log2_up args1) - args - with - | Some x3 => - UnderLets.Base - (#(ident.fancy_mulhl - (2 * - Z.log2_up - args1))%expr @ - (##(x3)%expr, - x'0 v1))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | @expr.Abs _ _ _ _ _ _ => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if - args1 =? - 2 ^ (2 * Z.log2_up args1 / 2) - 1 - then - match - invert_low - (2 * Z.log2_up args1) args - with - | Some x3 => - UnderLets.Base - (#(ident.fancy_mulll - (2 * Z.log2_up args1))%expr @ - (##(x3)%expr, x' v))%expr_pat - | None => - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args1 =? - 2 - ^ (2 * - Z.log2_up - args1 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args1) - args - with - | Some x3 => - UnderLets.Base - (#(ident.fancy_mulhl + args0 / 2) - + 1) && + (args2 =? + 2 + ^ (2 * Z.log2_up - args1))%expr @ - (## - (x3)%expr, - x'0 v0))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' - false s2 -> - Compile.value' true - d2 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x1) - end - else - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args1 =? - 2 - ^ (2 * - Z.log2_up args1 / - 2) - 1 - then - match - invert_high - (2 * - Z.log2_up args1) - args - with - | Some x3 => - UnderLets.Base - (#(ident.fancy_mulhl - (2 * - Z.log2_up - args1))%expr @ - (##(x3)%expr, - x'0 v0))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | (_ @ _)%expr_pat => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if - args1 =? - 2 ^ (2 * Z.log2_up args1 / 2) - 1 - then - match - invert_low - (2 * Z.log2_up args1) args - with - | Some x4 => - UnderLets.Base - (#(ident.fancy_mulll - (2 * Z.log2_up args1))%expr @ - (##(x4)%expr, x' v))%expr_pat - | None => - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args1 =? - 2 - ^ (2 * - Z.log2_up - args1 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args1) - args - with - | Some x4 => - UnderLets.Base - (#(ident.fancy_mulhl + args0 / 2) - + 1) + then + UnderLets.Base + (# + (ident.fancy_mulll (2 * Z.log2_up - args1))%expr @ - (## - (x4)%expr, - x'0 v0))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' - false s2 -> - Compile.value' true - d2 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x1) - end - else - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args1 =? - 2 - ^ (2 * - Z.log2_up args1 / - 2) - 1 - then - match - invert_high - (2 * - Z.log2_up args1) - args - with - | Some x4 => - UnderLets.Base - (#(ident.fancy_mulhl - (2 * - Z.log2_up - args1))%expr @ - (##(x4)%expr, - x'0 v0))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if - args1 =? - 2 ^ (2 * Z.log2_up args1 / 2) - 1 - then - match - invert_low - (2 * Z.log2_up args1) args - with - | Some x4 => - UnderLets.Base - (#(ident.fancy_mulll - (2 * Z.log2_up args1))%expr @ - (##(x4)%expr, x' v))%expr_pat - | None => - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t3) -> - defaults.expr - (type.base + args0))%expr @ + ( + x' v, + x'0 v0))%expr_pat + else + default + | None => + default + end) + | (s3 -> + d3)%ptype => + fun + _ : + Compile.value' + false s3 -> + Compile.value' + true d3 + => + default + end + (Compile.reflect + x3) + | None => + default + end) + | (s3 -> + d3)%ptype => + fun + _ : + Compile.value' + false s3 -> + Compile.value' + true d3 + => + default + end + (Compile.reflect + x1) + | None => + default + end + | _ => + default + end + | None => + default + end + | @expr.App + _ _ _ s1 + _ + #(_)%expr_pat + _ | + @expr.App + _ _ _ s1 + _ + ($_)%expr + _ | + @expr.App + _ _ _ s1 + _ + (@expr.Abs + _ _ _ _ _ + _) _ | + @expr.App + _ _ _ s1 + _ + (($_)%expr @ + _)%expr_pat + _ | + @expr.App + _ _ _ s1 + _ + (@expr.Abs + _ _ _ _ _ + _ @ _)%expr_pat + _ | + @expr.App + _ _ _ s1 + _ + (_ @ _ @ + _)%expr_pat + _ | + @expr.App + _ _ _ s1 + _ + (@expr.LetIn + _ _ _ _ _ + _ _ @ _)%expr_pat + _ | + @expr.App + _ _ _ s1 + _ + (@expr.LetIn + _ _ _ _ _ + _ _) _ => + default + | _ => + default + end + | None => + default0 + tt + end + | _ => + default0 + tt + end in + match x1 with + | #(idc0)%expr_pat => + match + match + idc0 + with + | @ident.Literal + t1 v => + match + t1 as t2 + return + (base.base_interp + t2 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end + with + | Some + args0 => + match + x0 + with + | # + (idc1)%expr_pat => + match + match + idc1 + with + | @ident.Literal + t2 v => + match + t2 as t3 + return + (base.base_interp + t3 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end + with + | Some + args1 => + match + s0 as t2 + return + (Compile.value' + false t2 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base + t2 => + fun + v : + defaults.expr + (type.base + t2) => + base.try_make_transport_cps + (fun + t3 : base.type + => + defaults.expr + (type.base + t3)) t2 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a : + option + (defaults.expr + (type.base + t2) -> + defaults.expr + (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - if - args1 =? - 2 - ^ (2 * - Z.log2_up - args1 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args1) - args - with - | Some x4 => - UnderLets.Base - (#(ident.fancy_mulhl + => + match + a + with + | Some + x' => + if + args0 =? + 2 + ^ (2 * Z.log2_up - args1))%expr @ - (## - (x4)%expr, - x'0 v0))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' - false s1 -> - Compile.value' true - d1 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x1) - end - else - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args1 =? - 2 - ^ (2 * - Z.log2_up args1 / - 2) - 1 - then - match - invert_high - (2 * - Z.log2_up args1) - args - with - | Some x4 => - UnderLets.Base - (#(ident.fancy_mulhl - (2 * + args0 / 2) - + 1 + then + match + invert_high + (2 * Z.log2_up - args1))%expr @ - (##(x4)%expr, - x'0 v0))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - end - | None => - match - match idc0 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x1 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - match - invert_low (2 * args1) args - with - | Some x3 => - UnderLets.Base - (#(ident.fancy_mullh - (2 * args1))%expr @ - (##(x3)%expr, x' v))%expr_pat - | None => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - match - invert_high - (2 * args1) - args - with - | Some x3 => - UnderLets.Base - (#(ident.fancy_mulhh - (2 * - args1))%expr @ - (##(x3)%expr, - x'0 v0))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false - s1 -> - Compile.value' true - d1 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - end - | None => UnderLets.Base (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | None => UnderLets.Base (x * x0)%expr - end - 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 _ _ _ _ _ _ _) _) _ => - UnderLets.Base (x * x0)%expr - | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ - ($_)%expr _ | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | - @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (x * x0)%expr - | _ => UnderLets.Base (x * x0)%expr - end - | None => UnderLets.Base (x * x0)%expr - end - | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ #(idc)%expr_pat x2) x1 => - match match idc with - | ident.Z_land => Some tt - | _ => None - end with - | Some _ => - match x2 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - match x0 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if - args0 =? - 2 ^ (2 * Z.log2_up args0 / 2) - 1 - then - match - invert_low (2 * Z.log2_up args0) - args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mulll - (2 * Z.log2_up args0))%expr @ - (x' v, ##(y)%expr))%expr_pat - | None => - match x1 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t4 v0 => - match - t4 as t5 - return - (base.base_interp - t5 -> option Z) - with - | base.type.unit => - fun _ : unit => - None - | base.type.Z => - fun v1 : Z => - Some v1 - | base.type.bool => - fun _ : bool => - None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s0 as t4 - return - (Compile.value' false - t4 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base - t4) => - base.try_make_transport_cps - (fun t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args2 =? - 2 - ^ (2 * - Z.log2_up - args2 / 2) - - 1 - then - match - invert_low - (2 * - Z.log2_up - args2) + args0) args1 - with - | Some y => + with + | Some + y => UnderLets.Base (# - (ident.fancy_mulll + (ident.fancy_mullh (2 * Z.log2_up - args2))%expr @ + args0))%expr @ ( - x'0 v0, - ## - (y)%expr))%expr_pat - | None => - match - s as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t5 => - fun - v1 : - defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a1 - with - | Some - x'1 => - if - args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args0) - args1 - with - | Some - y => - UnderLets.Base - (# - (ident.fancy_mullh - (2 * - Z.log2_up - args0))%expr @ - ( - x'1 v1, - ## - (y)%expr))%expr_pat - | None => - match - s0 as t6 - return - (Compile.value' - false t6 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t6 => - fun - v2 : - defaults.expr - (type.base - t6) => - base.try_make_transport_cps - (fun - t7 : base.type - => - defaults.expr - (type.base - t7)) t6 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a2 : - option - (defaults.expr - (type.base - t6) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a2 - with - | Some - x'2 => - if - args2 =? - 2 - ^ - (2 * - Z.log2_up - args2 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args2) - args1 - with - | Some - y => - UnderLets.Base - (# - (ident.fancy_mullh - (2 * - Z.log2_up - args2))%expr @ - ( - x'2 v2, + x' v, ## (y)%expr))%expr_pat | None => - UnderLets.Base - (x * x0)%expr + default end else - UnderLets.Base - (x * x0)%expr + default | None => - UnderLets.Base - (x * x0)%expr + default end) | (s1 -> d1)%ptype => @@ -4139,39 +2952,113 @@ match idc in (ident t) return (Compile.value' true t) with Compile.value' true d1 => - UnderLets.Base - (x * x0)%expr + default end (Compile.reflect x2) + | None => + default end - else - match - s0 as t6 - return - (Compile.value' - false t6 -> - UnderLets.UnderLets + | _ => + default + end + | None => + default0 + tt + end + | _ => + default0 + tt + end in + match x2 with + | #(idc0)%expr_pat => + match + match idc0 with + | @ident.Literal t1 v => + match + t1 as t2 + return + (base.base_interp + t2 -> + option Z) + with + | base.type.unit => + fun _ : unit => + None + | base.type.Z => + fun v0 : Z => + Some v0 + | base.type.bool => + fun _ : bool => + None + | base.type.nat => + fun _ : nat => + None + end v + | _ => None + end + with + | Some args0 => + match x0 with + | #(idc1)%expr_pat => + match + match idc1 with + | @ident.Literal + t2 v => + match + t2 as t3 + return + (base.base_interp + t3 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => None + end + with + | Some args1 => + match + s as t2 + return + (Compile.value' + false t2 -> + UnderLets.UnderLets base.type ident var (defaults.expr (type.base base.type.Z))) - with - | type.base - t6 => - fun - v2 : + with + | type.base + t2 => + fun + v : defaults.expr (type.base - t6) => - base.try_make_transport_cps + t2) => + base.try_make_transport_cps (fun - t7 : base.type + t3 : base.type => defaults.expr (type.base - t7)) t6 + t3)) t2 base.type.Z (UnderLets.UnderLets base.type @@ -4180,34 +3067,34 @@ match idc in (ident t) return (Compile.value' true t) with (type.base base.type.Z))) (fun - a2 : + a : option (defaults.expr (type.base - t6) -> + t2) -> defaults.expr (type.base base.type.Z)) => match - a2 + a with | Some - x'2 => + x' => if - args2 =? + args0 =? 2 ^ (2 * Z.log2_up - args2 / 2) - + args0 / 2) - 1 then match invert_high (2 * Z.log2_up - args2) + args0) args1 with | Some @@ -4217,868 +3104,477 @@ match idc in (ident t) return (Compile.value' true t) with (ident.fancy_mullh (2 * Z.log2_up - args2))%expr @ + args0))%expr @ ( - x'2 v2, + x' v, ## (y)%expr))%expr_pat | None => - UnderLets.Base - (x * x0)%expr + default end else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> - d1)%ptype => - fun - _ : - Compile.value' - false s1 -> - Compile.value' - true d1 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) + default | None => - UnderLets.Base - (x * x0)%expr + default end) - | (s1 -> - d1)%ptype => - fun + | (s1 -> d1)%ptype => + fun _ : Compile.value' false s1 -> Compile.value' true d1 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x1) - end - else - match - s as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t5 => - fun - v1 : - defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a1 - with - | Some - x'1 => - if - args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args0) - args1 - with - | Some - y => - UnderLets.Base - (# - (ident.fancy_mullh - (2 * - Z.log2_up - args0))%expr @ - ( - x'1 v1, - ## - (y)%expr))%expr_pat - | None => - match - s0 as t6 - return - (Compile.value' - false t6 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t6 => - fun - v2 : - defaults.expr - (type.base - t6) => - base.try_make_transport_cps - (fun - t7 : base.type - => - defaults.expr - (type.base - t7)) t6 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a2 : - option - (defaults.expr - (type.base - t6) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a2 - with - | Some - x'2 => - if - args2 =? - 2 - ^ - (2 * - Z.log2_up - args2 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args2) - args1 - with - | Some - y => - UnderLets.Base - (# - (ident.fancy_mullh - (2 * - Z.log2_up - args2))%expr @ - ( - x'2 v2, - ## - (y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> - d1)%ptype => - fun - _ : - Compile.value' - false s1 -> - Compile.value' - true d1 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) - end - else - match - s0 as t6 - return - (Compile.value' - false t6 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t6 => - fun - v2 : - defaults.expr - (type.base - t6) => - base.try_make_transport_cps - (fun - t7 : base.type - => - defaults.expr - (type.base - t7)) t6 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a2 : - option - (defaults.expr - (type.base - t6) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a2 - with - | Some - x'2 => - if - args2 =? - 2 - ^ - (2 * - Z.log2_up - args2 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args2) - args1 - with - | Some - y => - UnderLets.Base - (# - (ident.fancy_mullh - (2 * - Z.log2_up - args2))%expr @ - ( - x'2 v2, - ## - (y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> - d1)%ptype => - fun - _ : - Compile.value' - false s1 -> - Compile.value' - true d1 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : - Compile.value' - false s1 -> - Compile.value' - true d1 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x1) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' - false s1 -> - Compile.value' - true d1 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - | None => - match - s as t4 - return - (Compile.value' false - t4 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base - t4) => - base.try_make_transport_cps - (fun t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args0) - args1 - with - | Some y => - UnderLets.Base - (# - (ident.fancy_mullh - (2 * - Z.log2_up - args0))%expr @ - ( - x'0 v0, - ## - (y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' - false s1 -> - Compile.value' - true d1 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x1) - end - | ($_)%expr => - match - s as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v1 : defaults.expr - (type.base t4) + => default + end + (Compile.reflect + x1) + | None => default + end + | _ => default + end + | None => default0 tt + end + | _ => default0 tt + end in + match x1 with + | #(idc0)%expr_pat => + match + match idc0 with + | @ident.Literal t1 v => + match + t1 as t2 + return + (base.base_interp t2 -> option Z) + with + | base.type.unit => + fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => + fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args0 => + match x0 with + | #(idc1)%expr_pat => + match + match idc1 with + | @ident.Literal t2 v => + match + t2 as t3 + return + (base.base_interp t3 -> + option Z) + with + | base.type.unit => + fun _ : unit => None + | base.type.Z => + fun v0 : Z => Some v0 + | base.type.bool => + fun _ : bool => None + | base.type.nat => + fun _ : nat => None + end v + | _ => None + end + with + | Some args1 => + match + s0 as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base base.type.Z))) + with + | type.base t2 => + fun + v : defaults.expr + (type.base t2) => + base.try_make_transport_cps + (fun t3 : base.type => + defaults.expr + (type.base t3)) t2 + base.type.Z + (UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a : option + (defaults.expr + (type.base t2) -> + defaults.expr + (type.base + base.type.Z)) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args0) - args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mullh + match a with + | Some x' => + if + args0 =? + 2 + ^ (2 * + Z.log2_up args0 / + 2) - 1 + then + match + invert_low + (2 * + Z.log2_up args0) + args1 + with + | Some y => + UnderLets.Base + (#(ident.fancy_mulll (2 * Z.log2_up args0))%expr @ - (x'0 v1, - ## - (y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' - false s1 -> - Compile.value' true - d1 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x1) - | @expr.LetIn _ _ _ _ _ _ _ => - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base + (x' v, + ##(y)%expr))%expr_pat + | None => default + end + else default + | None => default + end) + | (s1 -> d1)%ptype => + fun + _ : Compile.value' false + s1 -> + Compile.value' true d1 + => default + end (Compile.reflect x2) + | None => default + end + | _ => default + end + | None => default0 tt + end + | _ => default0 tt + end in + match x2 with + | #(idc0)%expr_pat => + match + match idc0 with + | @ident.Literal t1 v => + match + t1 as t2 return (base.base_interp t2 -> option Z) + with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args0 => + match x0 with + | #(idc1)%expr_pat => + match + match idc1 with + | @ident.Literal t2 v => + match + t2 as t3 + return (base.base_interp t3 -> option Z) + with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args1 => + match + s as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets base.type ident var + (defaults.expr (type.base base.type.Z))) + with + | type.base t2 => + fun v : defaults.expr (type.base t2) => + base.try_make_transport_cps + (fun t3 : base.type => + defaults.expr (type.base t3)) t2 + base.type.Z + (UnderLets.UnderLets base.type ident var + (defaults.expr (type.base base.type.Z))) + (fun + a : option + (defaults.expr (type.base t2) -> + defaults.expr + (type.base base.type.Z)) => + match a with + | Some x' => + if + args0 =? + 2 ^ (2 * Z.log2_up args0 / 2) - 1 + then + match + invert_low (2 * Z.log2_up args0) + args1 + with + | Some y => + UnderLets.Base + (#(ident.fancy_mulll + (2 * Z.log2_up args0))%expr @ + (x' v, ##(y)%expr))%expr_pat + | None => default + end + else default + | None => default + end) + | (s1 -> d1)%ptype => + fun + _ : Compile.value' false s1 -> + Compile.value' true d1 => default + end (Compile.reflect x1) + | None => default + end + | _ => default + end + | None => default0 tt + end + | _ => default0 tt + end + | None => + match + match idc with + | ident.Z_shiftr => Some tt + | _ => None + end + with + | Some _ => + match x1 with + | #(idc0)%expr_pat => + match + match idc0 with + | @ident.Literal t1 v => + match + t1 as t2 return (base.base_interp t2 -> option Z) + with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args0 => + match x0 with + | #(idc1)%expr_pat => + match + match idc1 with + | @ident.Literal t2 v => + match + t2 as t3 + return (base.base_interp t3 -> option Z) + with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args1 => + match + s0 as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets base.type ident var + (defaults.expr (type.base base.type.Z))) + with + | type.base t2 => + fun v : defaults.expr (type.base t2) => + base.try_make_transport_cps + (fun t3 : base.type => + defaults.expr (type.base t3)) t2 + base.type.Z + (UnderLets.UnderLets base.type ident + var + (defaults.expr + (type.base base.type.Z))) + (fun + a : option + (defaults.expr (type.base t2) -> + defaults.expr + (type.base base.type.Z)) => + match a with + | Some x' => + match + invert_low (2 * args0) args1 + with + | Some y => + UnderLets.Base + (#(ident.fancy_mulhl + (2 * args0))%expr @ + (x' v, ##(y)%expr))%expr_pat + | None => + match + s0 as t3 + return + (Compile.value' false t3 -> + UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base t3 => + fun + v0 : defaults.expr + (type.base t3) => + base.try_make_transport_cps + (fun t4 : base.type => + defaults.expr + (type.base t4)) t3 + base.type.Z + (UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a0 : option + (defaults.expr + (type.base t3) -> - defaults.expr - (type.base + defaults.expr + (type.base base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args0) - args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mullh + => + match a0 with + | Some x'0 => + match + invert_high + (2 * args0) + args1 + with + | Some y => + UnderLets.Base + (#(ident.fancy_mulhh (2 * - Z.log2_up args0))%expr @ - (x'0 v0, - ## - (y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' - false s1 -> - Compile.value' true - d1 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x1) - | _ => - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option + (x'0 v0, + ##(y)%expr))%expr_pat + | None => default + end + | None => default + end) + | (s1 -> d1)%ptype => + fun + _ : Compile.value' false + s1 -> + Compile.value' true + d1 => default + end (Compile.reflect x2) + end + | None => default + end) + | (s1 -> d1)%ptype => + fun + _ : Compile.value' false s1 -> + Compile.value' true d1 => default + end (Compile.reflect x2) + | None => default + end + | @expr.App _ _ _ s1 _ + (@expr.App _ _ _ s2 _ #(idc1)%expr_pat x4) x3 => + match + match idc1 with + | ident.Z_land => Some tt + | _ => None + end + with + | Some _ => + llet default0 := fun 'tt => + match x3 with + | #(idc2)%expr_pat => + match + match idc2 with + | @ident.Literal t3 + v => + match + t3 as t4 + return + (base.base_interp + t4 -> + option Z) + with + | base.type.unit => + fun _ : unit + => None + | base.type.Z => + fun v0 : Z => + Some v0 + | base.type.bool => + fun _ : bool + => None + | base.type.nat => + fun _ : nat => + None + end v + | _ => None + end + with + | Some args2 => + match + s0 as t3 + return + (Compile.value' + false t3 -> + UnderLets.UnderLets + base.type + ident var (defaults.expr (type.base - t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args0) - args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mullh - (2 * - Z.log2_up - args0))%expr @ - (x'0 v0, - ## - (y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' - false s2 -> - Compile.value' true - d2 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x1) - end - end - else - match x1 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t4 v0 => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) - => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args2 =? - 2 - ^ (2 * - Z.log2_up - args2 / 2) - - 1 - then - match - invert_low - (2 * - Z.log2_up - args2) - args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mulll - (2 * - Z.log2_up - args2))%expr @ - (x'0 v0, - ## - (y)%expr))%expr_pat - | None => - match - s as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base - t5 => - fun - v1 : - defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr + with + | type.base t3 => + fun + v : defaults.expr (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr + t3) => + base.try_make_transport_cps + (fun + t4 : base.type + => + defaults.expr + (type.base + t4)) t3 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr (type.base base.type.Z))) - (fun - a1 : - option + (fun + a : + option (defaults.expr (type.base - t5) -> + t3) -> defaults.expr (type.base base.type.Z)) - => - match - a1 - with - | Some - x'1 => - if - args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args0) - args1 - with - | Some - y => - UnderLets.Base - (# - (ident.fancy_mullh - (2 * - Z.log2_up - args0))%expr @ - ( - x'1 v1, - ## - (y)%expr))%expr_pat - | None => + => + match a with + | Some x' => match - s0 as t6 + s2 as t4 return (Compile.value' - false t6 -> + false t4 -> UnderLets.UnderLets base.type ident var @@ -5087,19 +3583,19 @@ match idc in (ident t) return (Compile.value' true t) with base.type.Z))) with | type.base - t6 => + t4 => fun - v2 : + v0 : defaults.expr (type.base - t6) => + t4) => base.try_make_transport_cps (fun - t7 : base.type + t5 : base.type => defaults.expr (type.base - t7)) t6 + t5)) t4 base.type.Z (UnderLets.UnderLets base.type @@ -5108,460 +3604,618 @@ match idc in (ident t) return (Compile.value' true t) with (type.base base.type.Z))) (fun - a2 : + a0 : option (defaults.expr (type.base - t6) -> + t4) -> defaults.expr (type.base base.type.Z)) => match - a2 + a0 with | Some - x'2 => + x'0 => if args2 =? 2 ^ (2 * - Z.log2_up - args2 / 2) - + args0 / 2) - 1 then - match - invert_high - (2 * - Z.log2_up - args2) - args1 - with - | Some - y => UnderLets.Base (# - (ident.fancy_mullh + (ident.fancy_mulhl (2 * - Z.log2_up - args2))%expr @ + args0))%expr @ ( - x'2 v2, - ## - (y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end + x' v, + x'0 v0))%expr_pat else - UnderLets.Base - (x * x0)%expr + default | None => - UnderLets.Base - (x * x0)%expr + default end) - | (s1 -> - d1)%ptype => + | (s3 -> + d3)%ptype => fun _ : Compile.value' - false s1 -> + false s3 -> Compile.value' - true d1 + true d3 => - UnderLets.Base - (x * x0)%expr + default end (Compile.reflect - x2) - end - else - match - s0 as t6 - return - (Compile.value' - false t6 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t6 => - fun - v2 : - defaults.expr - (type.base - t6) => - base.try_make_transport_cps - (fun - t7 : base.type - => - defaults.expr - (type.base - t7)) t6 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a2 : - option - (defaults.expr + x4) + | None => + default + end) + | (s3 -> d3)%ptype => + fun + _ : Compile.value' + false s3 -> + Compile.value' + true d3 + => default + end + (Compile.reflect + x2) + | None => default + end + | _ => default + end in + match x4 with + | #(idc2)%expr_pat => + match + match idc2 with + | @ident.Literal t3 v => + match + t3 as t4 + return + (base.base_interp t4 -> + option Z) + with + | base.type.unit => + fun _ : unit => None + | base.type.Z => + fun v0 : Z => Some v0 + | base.type.bool => + fun _ : bool => None + | base.type.nat => + fun _ : nat => None + end v + | _ => None + end + with + | Some args2 => + match + s0 as t3 + return + (Compile.value' false t3 -> + UnderLets.UnderLets base.type + ident var + (defaults.expr + (type.base base.type.Z))) + with + | type.base t3 => + fun + v : defaults.expr + (type.base t3) => + base.try_make_transport_cps + (fun t4 : base.type => + defaults.expr (type.base t4)) + t3 base.type.Z + (UnderLets.UnderLets base.type + ident var + (defaults.expr + (type.base base.type.Z))) + (fun + a : option + (defaults.expr + (type.base t3) -> + defaults.expr + (type.base + base.type.Z)) => + match a with + | Some x' => + match + s1 as t4 + return + (Compile.value' false + t4 -> + UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + base.type.Z))) + with + | type.base t4 => + fun + v0 : defaults.expr + (type.base t4) + => + base.try_make_transport_cps + (fun t5 : base.type + => + defaults.expr + (type.base t5)) + t4 base.type.Z + (UnderLets.UnderLets + base.type ident + var + (defaults.expr + (type.base + base.type.Z))) + (fun + a0 : option + (defaults.expr (type.base - t6) -> + t4) -> defaults.expr (type.base base.type.Z)) - => - match - a2 - with - | Some - x'2 => - if - args2 =? - 2 - ^ - (2 * - Z.log2_up - args2 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args2) - args1 - with - | Some - y => - UnderLets.Base - (# - (ident.fancy_mullh + => + match a0 with + | Some x'0 => + if + args2 =? + 2 + ^ (2 * args0 / + 2) - 1 + then + UnderLets.Base + (#(ident.fancy_mulhl (2 * - Z.log2_up - args2))%expr @ - ( - x'2 v2, - ## - (y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> - d1)%ptype => - fun - _ : - Compile.value' - false s1 -> - Compile.value' - true d1 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : - Compile.value' - false s1 -> - Compile.value' - true d1 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x1) - end - else - match - s as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base + args0))%expr @ + (x' v, + x'0 v0))%expr_pat + else default + | None => default + end) + | (s3 -> d3)%ptype => + fun + _ : Compile.value' + false s3 -> + Compile.value' + true d3 => + default + end (Compile.reflect x3) + | None => default + end) + | (s3 -> d3)%ptype => + fun + _ : Compile.value' false s3 -> + Compile.value' true d3 => + default + end (Compile.reflect x2) + | None => default0 tt + end + | _ => default0 tt + end + | None => + match + match idc1 with + | ident.Z_shiftr => Some tt + | _ => None + end + with + | Some _ => + match x3 with + | #(idc2)%expr_pat => + match + match idc2 with + | @ident.Literal t3 v => + match + t3 as t4 + return + (base.base_interp t4 -> + option Z) + with + | base.type.unit => + fun _ : unit => None + | base.type.Z => + fun v0 : Z => Some v0 + | base.type.bool => + fun _ : bool => None + | base.type.nat => + fun _ : nat => None + end v + | _ => None + end + with + | Some args2 => + match + s0 as t3 + return + (Compile.value' false t3 -> + UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base base.type.Z))) + with + | type.base t3 => + fun + v : defaults.expr + (type.base t3) => + base.try_make_transport_cps + (fun t4 : base.type => + defaults.expr + (type.base t4)) t3 + base.type.Z + (UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + base.type.Z))) + (fun + a : option + (defaults.expr + (type.base t3) -> + defaults.expr + (type.base + base.type.Z)) + => + match a with + | Some x' => + match + s2 as t4 + return + (Compile.value' + false t4 -> + UnderLets.UnderLets + base.type ident + var + (defaults.expr + (type.base base.type.Z))) - with - | type.base t5 => - fun - v1 : - defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr + with + | type.base t4 => + fun + v0 : defaults.expr (type.base + t4) => + base.try_make_transport_cps + (fun + t5 : base.type + => + defaults.expr + (type.base t5)) + t4 base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base base.type.Z))) - (fun - a1 : - option - (defaults.expr + (fun + a0 : + option + (defaults.expr (type.base - t5) -> + t4) -> defaults.expr (type.base base.type.Z)) - => - match - a1 - with - | Some - x'1 => - if - args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args0) - args1 - with - | Some - y => - UnderLets.Base + => + match a0 with + | Some x'0 => + if + args0 =? + args2 + then + UnderLets.Base (# - (ident.fancy_mullh + (ident.fancy_mulhh (2 * - Z.log2_up args0))%expr @ ( - x'1 v1, - ## - (y)%expr))%expr_pat - | None => - match - s0 as t6 - return - (Compile.value' - false t6 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t6 => - fun - v2 : - defaults.expr - (type.base - t6) => - base.try_make_transport_cps - (fun - t7 : base.type - => - defaults.expr - (type.base - t7)) t6 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a2 : - option - (defaults.expr - (type.base - t6) -> - defaults.expr - (type.base - base.type.Z)) - => + x' v, + x'0 v0))%expr_pat + else + default + | None => + default + end) + | (s3 -> d3)%ptype => + fun + _ : Compile.value' + false s3 -> + Compile.value' + true d3 => + default + end + (Compile.reflect x4) + | None => default + end) + | (s3 -> d3)%ptype => + fun + _ : Compile.value' false s3 -> + Compile.value' true d3 + => default + end (Compile.reflect x2) + | None => default + end + | _ => default + end + | None => default + end + 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 _ _ _ _ _ _ _) + _) _ => default + | @expr.App _ _ _ s1 _ #(_)%expr_pat _ | @expr.App _ + _ _ s1 _ ($_)%expr _ | @expr.App _ _ _ s1 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s1 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => default + | _ => default + end + | None => default + end + | _ => default + end + | None => default + end + 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 _ _ _ _ _ _ _) _) _ => default + | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr _ | + @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ + (@expr.LetIn _ _ _ _ _ _ _) _ => default + | _ => default + end +| ident.Z_pow => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_pow)%expr @ x @ x0)%expr_pat in + default +| ident.Z_sub => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x - x0)%expr in + default +| ident.Z_opp => + fun x : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (- x)%expr in + default +| ident.Z_div => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x / x0)%expr in + default +| ident.Z_modulo => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x mod x0)%expr in + default +| ident.Z_log2 => + fun x : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_log2)%expr @ x)%expr_pat in + default +| ident.Z_log2_up => + fun x : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_log2_up)%expr @ x)%expr_pat in + default +| ident.Z_eqb => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_eqb)%expr @ x @ x0)%expr_pat in + default +| ident.Z_leb => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_leb)%expr @ x @ x0)%expr_pat in + default +| ident.Z_geb => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_geb)%expr @ x @ x0)%expr_pat in + default +| ident.Z_of_nat => + fun x : defaults.expr (type.base base.type.nat) => + llet default := UnderLets.Base (#(ident.Z_of_nat)%expr @ x)%expr_pat in + default +| ident.Z_to_nat => + fun x : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_to_nat)%expr @ x)%expr_pat in + default +| ident.Z_shiftr => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x >> x0)%expr in + default +| ident.Z_shiftl => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x << x0)%expr in + default +| ident.Z_land => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x &' x0)%expr in + default +| ident.Z_lor => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x || x0)%expr in + default +| ident.Z_bneg => + fun x : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_bneg)%expr @ x)%expr_pat in + default +| ident.Z_lnot_modulo => + fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_lnot_modulo)%expr @ x @ x0)%expr_pat in + default +| ident.Z_mul_split => + fun x x0 x1 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat in + default +| ident.Z_add_get_carry => + fun x x0 x1 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat in + match x with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal t0 v => + match t0 as t1 return (base.base_interp t1 -> option Z) with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args => + llet default0 := fun 'tt => + llet default0 := fun 'tt => + llet default0 := fun 'tt => + llet default0 := + fun 'tt => + if + args =? + 2 + ^ Z.log2 args + then + UnderLets.Base + (#(ident.fancy_add + (Z.log2 + args) 0)%expr @ + (x0, x1))%expr_pat + else default in + match x0 with + | (@expr.App _ + _ _ s0 _ + #(idc0) + x3 @ x2)%expr_pat => + match match - a2 + idc0 with - | Some - x'2 => - if - args2 =? - 2 - ^ - (2 * - Z.log2_up - args2 / 2) - - 1 - then + | ident.Z_shiftr => + Some tt + | _ => + None + end + with + | Some + _ => match - invert_high - (2 * - Z.log2_up - args2) - args1 + x2 with - | Some - y => - UnderLets.Base - (# - (ident.fancy_mullh - (2 * - Z.log2_up - args2))%expr @ - ( - x'2 v2, - ## - (y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> - d1)%ptype => + | # + (idc1)%expr_pat => + match + match + idc1 + with + | @ident.Literal + t2 v => + match + t2 as t3 + return + (base.base_interp + t3 -> + option Z) + with + | base.type.unit => fun - _ : - Compile.value' - false s1 -> - Compile.value' - true d1 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None end - else + with + | Some + args1 => match - s0 as t6 + s0 as t2 return (Compile.value' - false t6 -> + false t2 -> UnderLets.UnderLets base.type ident var (defaults.expr (type.base - base.type.Z))) + (base.type.Z * + base.type.Z)%etype))) with | type.base - t6 => + t2 => fun - v2 : + v : defaults.expr (type.base - t6) => + t2) => base.try_make_transport_cps (fun - t7 : base.type + t3 : base.type => defaults.expr (type.base - t7)) t6 + t3)) t2 base.type.Z (UnderLets.UnderLets base.type ident var (defaults.expr (type.base - base.type.Z))) + (base.type.Z * + base.type.Z)%etype))) (fun - a2 : + a : option (defaults.expr (type.base - t6) -> + t2) -> defaults.expr (type.base base.type.Z)) => match - a2 + a with | Some - x'2 => + x' => if - args2 =? + args =? 2 ^ - (2 * - Z.log2_up - args2 / 2) - - 1 + Z.log2 + args then - match - invert_high - (2 * - Z.log2_up - args2) - args1 - with - | Some - y => UnderLets.Base (# - (ident.fancy_mullh - (2 * - Z.log2_up - args2))%expr @ - ( - x'2 v2, - ## - (y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end + (ident.fancy_add + (Z.log2 + args) + (- args1))%expr @ + (x1, + x' v))%expr_pat else - UnderLets.Base - (x * x0)%expr + default | None => - UnderLets.Base - (x * x0)%expr + default end) | (s1 -> d1)%ptype => @@ -5572,28146 +4226,966 @@ match idc in (ident t) return (Compile.value' true t) with Compile.value' true d1 => - UnderLets.Base - (x * x0)%expr + default end (Compile.reflect - x2) + x3) + | None => + default + end + | _ => + default + end | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : - Compile.value' - false s1 -> - Compile.value' - true d1 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x1) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' - false s1 -> - Compile.value' true - d1 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - | None => - match - s as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) - => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args0) - args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mullh - (2 * - Z.log2_up - args0))%expr @ - (x'0 v0, - ## - (y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' - false s1 -> - Compile.value' true - d1 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x1) - end - | ($_)%expr => - match - s as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t4 => - fun - v1 : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ (2 * - Z.log2_up args0 / - 2) - 1 - then - match - invert_high - (2 * - Z.log2_up args0) - args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mullh - (2 * - Z.log2_up - args0))%expr @ - (x'0 v1, - ##(y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | @expr.LetIn _ _ _ _ _ _ _ => - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ (2 * - Z.log2_up args0 / - 2) - 1 - then - match - invert_high - (2 * - Z.log2_up args0) - args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mullh - (2 * - Z.log2_up - args0))%expr @ - (x'0 v0, - ##(y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | _ => - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ (2 * - Z.log2_up args0 / - 2) - 1 - then - match - invert_high - (2 * - Z.log2_up args0) - args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mullh - (2 * - Z.log2_up - args0))%expr @ - (x'0 v0, - ##(y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - end - | None => UnderLets.Base (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end - | @expr.App _ _ _ s1 _ - (@expr.App _ _ _ s2 _ #(idc1)%expr_pat x4) x3 => - match - match idc1 with - | ident.Z_land => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun v : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - match - s1 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - (args0 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (#(ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - (x' v, x'0 v0))%expr_pat - else - match x1 with - | #(idc3)%expr_pat => - match - match - idc3 - with - | @ident.Literal - t6 v1 => - match - t6 as t7 - return + default + end + | (@expr.App _ + _ _ s0 _ + ($_)%expr + _ @ _)%expr_pat | + (@expr.App _ + _ _ s0 _ + (@expr.Abs + _ _ _ _ _ + _) _ @ _)%expr_pat | + (@expr.App _ + _ _ s0 _ + (_ @ _) _ @ + _)%expr_pat | + (@expr.App _ + _ _ s0 _ + (@expr.LetIn + _ _ _ _ _ + _ _) _ @ _)%expr_pat => + default + | (#(_) @ _)%expr_pat | + (($_)%expr @ + _)%expr_pat | + (@expr.Abs _ + _ _ _ _ _ @ + _)%expr_pat | + (@expr.LetIn + _ _ _ _ _ _ + _ @ _)%expr_pat => + default + | _ => + default0 + tt + end in + match x1 with + | (@expr.App _ _ _ s0 _ # + (idc0) x3 @ x2)%expr_pat => + match + match idc0 with + | ident.Z_shiftr => + Some tt + | _ => None + end + with + | Some _ => + match x2 with + | #(idc1)%expr_pat => + match + match idc1 with + | @ident.Literal + t2 v => + match + t2 as t3 + return (base.base_interp - t7 -> + t3 -> option Z) - with - | base.type.unit => + with + | base.type.unit => fun _ : unit => None - | base.type.Z => + | base.type.Z => fun - v2 : Z => - Some v2 - | base.type.bool => + v0 : Z => + Some v0 + | base.type.bool => fun _ : bool => None - | base.type.nat => + | base.type.nat => fun _ : nat => None - end v1 - | _ => None - end - with - | Some - args3 => - match - s0 as t6 - return - (Compile.value' - false t6 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t6 => - fun - v1 : - defaults.expr - (type.base - t6) => - base.try_make_transport_cps - (fun - t7 : base.type - => - defaults.expr - (type.base - t7)) t6 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : - option - (defaults.expr - (type.base - t6) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a1 - with - | Some - x'1 => - match - s1 as t7 - return - (Compile.value' - false t7 -> - UnderLets.UnderLets + end v + | _ => None + end + with + | Some args1 => + match + s0 as t2 + return + (Compile.value' + false t2 -> + UnderLets.UnderLets base.type ident var (defaults.expr (type.base - base.type.Z))) - with - | type.base - t7 => - fun - v2 : + (base.type.Z * + base.type.Z)%etype))) + with + | type.base + t2 => + fun + v : defaults.expr (type.base - t7) => - base.try_make_transport_cps + t2) => + base.try_make_transport_cps (fun - t8 : base.type + t3 : base.type => defaults.expr (type.base - t8)) t7 + t3)) t2 base.type.Z (UnderLets.UnderLets base.type ident var (defaults.expr (type.base - base.type.Z))) + (base.type.Z * + base.type.Z)%etype))) (fun - a2 : + a : option (defaults.expr (type.base - t7) -> + t2) -> defaults.expr (type.base - base.type.Z)) - => - match - a2 - with - | Some - x'2 => - if - (args3 =? - 2 - ^ - (2 * - Z.log2_up - args3 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args3 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args3))%expr @ - ( - x'1 v1, - x'2 v2))%expr_pat - else - match - x3 - with - | # - (idc4)%expr_pat => - match - match - idc4 - with - | @ident.Literal - t9 v3 => - match - t9 as t10 - return - (base.base_interp - t10 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun - v4 : Z => - Some v4 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun - _ : nat - => None - end v3 - | _ => - None - end - with - | Some - args4 => - match - s as t9 - return - (Compile.value' - false t9 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t9 => - fun - v3 : - defaults.expr - (type.base - t9) => - base.try_make_transport_cps - (fun - t10 : base.type - => - defaults.expr - (type.base - t10)) t9 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a3 : - option - (defaults.expr - (type.base - t9) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a3 - with - | Some - x'3 => - match - s2 as t10 - return - (Compile.value' - false t10 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t10 => - fun - v4 : - defaults.expr - (type.base - t10) => - base.try_make_transport_cps - (fun - t11 : base.type - => - defaults.expr - (type.base - t11)) t10 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a4 : - option - (defaults.expr - (type.base - t10) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a4 - with - | Some - x'4 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args4 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x'3 v3, - x'4 v4))%expr_pat - else - match - s0 as t11 - return - (Compile.value' - false t11 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t11 => - fun - v5 : - defaults.expr - (type.base - t11) => - base.try_make_transport_cps - (fun - t12 : base.type - => - defaults.expr - (type.base - t12)) t11 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a5 : - option - (defaults.expr - (type.base - t11) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a5 - with - | Some - x'5 => - match - s2 as t12 - return - (Compile.value' - false t12 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t12 => - fun - v6 : - defaults.expr - (type.base - t12) => - base.try_make_transport_cps - (fun - t13 : base.type - => - defaults.expr - (type.base - t13)) t12 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a6 : - option - (defaults.expr - (type.base - t12) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a6 - with - | Some - x'6 => - if - (args3 =? - 2 - ^ - (2 * - Z.log2_up - args3 / 2) - - 1) && - (args4 =? - 2 - ^ - (2 * - Z.log2_up - args3 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args3))%expr @ - ( - x'5 v5, - x'6 v6))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x1) - | None => - UnderLets.Base - (x * x0)%expr - end - | _ => - UnderLets.Base - (x * x0)%expr - end - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x3) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) - | None => - match - x3 - with - | # - (idc4)%expr_pat => - match - match - idc4 - with - | @ident.Literal - t7 v1 => - match - t7 as t8 - return - (base.base_interp - t8 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun - v2 : Z => - Some v2 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun - _ : nat - => None - end v1 - | _ => - None - end - with - | Some - args3 => - match - s as t7 - return - (Compile.value' - false t7 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t7 => - fun - v1 : - defaults.expr - (type.base - t7) => - base.try_make_transport_cps - (fun - t8 : base.type - => - defaults.expr - (type.base - t8)) t7 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : - option - (defaults.expr - (type.base - t7) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a1 - with - | Some - x'1 => - match - s2 as t8 - return - (Compile.value' - false t8 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t8 => - fun - v2 : - defaults.expr - (type.base - t8) => - base.try_make_transport_cps - (fun - t9 : base.type - => - defaults.expr - (type.base - t9)) t8 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a2 : - option - (defaults.expr - (type.base - t8) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a2 - with - | Some - x'2 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args3 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x'1 v1, - x'2 v2))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x1) - | None => - UnderLets.Base - (x * x0)%expr - end - | _ => - UnderLets.Base - (x * x0)%expr - end - end - | ($_)%expr => - match x3 with - | #(idc3)%expr_pat => - match - match - idc3 - with - | @ident.Literal - t7 v2 => - match - t7 as t8 - return - (base.base_interp - t8 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun - v3 : Z => - Some v3 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun - _ : nat - => None - end v2 - | _ => - None - end - with - | Some - args3 => - match - s as t7 - return - (Compile.value' - false t7 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t7 => - fun - v2 : - defaults.expr - (type.base - t7) => - base.try_make_transport_cps - (fun - t8 : base.type - => - defaults.expr - (type.base - t8)) t7 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : - option - (defaults.expr - (type.base - t7) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a1 - with - | Some - x'1 => - match - s2 as t8 - return - (Compile.value' - false t8 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t8 => - fun - v3 : - defaults.expr - (type.base - t8) => - base.try_make_transport_cps - (fun - t9 : base.type - => - defaults.expr - (type.base - t9)) t8 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a2 : - option - (defaults.expr - (type.base - t8) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a2 - with - | Some - x'2 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args3 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x'1 v2, - x'2 v3))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x1) - | None => - UnderLets.Base - (x * x0)%expr - end - | _ => - UnderLets.Base - (x * x0)%expr - end - | @expr.LetIn _ _ - _ _ _ _ _ => - match x3 with - | #(idc3)%expr_pat => - match - match - idc3 - with - | @ident.Literal - t6 v1 => - match - t6 as t7 - return - (base.base_interp - t7 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun - v2 : Z => - Some v2 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun - _ : nat - => None - end v1 - | _ => - None - end - with - | Some - args3 => - match - s as t6 - return - (Compile.value' - false t6 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t6 => - fun - v1 : - defaults.expr - (type.base - t6) => - base.try_make_transport_cps - (fun - t7 : base.type - => - defaults.expr - (type.base - t7)) t6 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : - option - (defaults.expr - (type.base - t6) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a1 - with - | Some - x'1 => - match - s2 as t7 - return - (Compile.value' - false t7 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t7 => - fun - v2 : - defaults.expr - (type.base - t7) => - base.try_make_transport_cps - (fun - t8 : base.type - => - defaults.expr - (type.base - t8)) t7 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a2 : - option - (defaults.expr - (type.base - t7) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a2 - with - | Some - x'2 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args3 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x'1 v1, - x'2 v2))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x1) - | None => - UnderLets.Base - (x * x0)%expr - end - | _ => - UnderLets.Base - (x * x0)%expr - end - | _ => - match x3 with - | #(idc3)%expr_pat => - match - match - idc3 - with - | @ident.Literal - t6 v1 => - match - t6 as t7 - return - (base.base_interp - t7 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun - v2 : Z => - Some v2 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun - _ : nat - => None - end v1 - | _ => - None - end - with - | Some - args3 => - match - s as t6 - return - (Compile.value' - false t6 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t6 => - fun - v1 : - defaults.expr - (type.base - t6) => - base.try_make_transport_cps - (fun - t7 : base.type - => - defaults.expr - (type.base - t7)) t6 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : - option - (defaults.expr - (type.base - t6) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a1 - with - | Some - x'1 => - match - s2 as t7 - return - (Compile.value' - false t7 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t7 => - fun - v2 : - defaults.expr - (type.base - t7) => - base.try_make_transport_cps - (fun - t8 : base.type - => - defaults.expr - (type.base - t8)) t7 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a2 : - option - (defaults.expr - (type.base - t7) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a2 - with - | Some - x'2 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args3 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x'1 v1, - x'2 v2))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> - d4)%ptype => - fun - _ : - Compile.value' - false s4 -> - Compile.value' - true d4 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> - d4)%ptype => - fun - _ : - Compile.value' - false s4 -> - Compile.value' - true d4 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x1) - | None => - UnderLets.Base - (x * x0)%expr - end - | _ => - UnderLets.Base - (x * x0)%expr - end - end - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false - s3 -> - Compile.value' true - d3 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x3) - | None => - UnderLets.Base (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => - match x3 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t4 v => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t4 => - fun - v : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s2 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t5 => - fun - v0 : defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base t6)) - t5 base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x' v, - x'0 v0))%expr_pat - else - match - x1 - with - | # - (idc4)%expr_pat => - match - match - idc4 - with - | @ident.Literal - t7 v1 => - match - t7 as t8 - return - (base.base_interp - t8 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun - v2 : Z => - Some v2 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun - _ : nat - => None - end v1 - | _ => - None - end - with - | Some - args3 => - match - s0 as t7 - return - (Compile.value' - false t7 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t7 => - fun - v1 : - defaults.expr - (type.base - t7) => - base.try_make_transport_cps - (fun - t8 : base.type - => - defaults.expr - (type.base - t8)) t7 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : - option - (defaults.expr - (type.base - t7) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a1 - with - | Some - x'1 => - match - s2 as t8 - return - (Compile.value' - false t8 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t8 => - fun - v2 : - defaults.expr - (type.base - t8) => - base.try_make_transport_cps - (fun - t9 : base.type - => - defaults.expr - (type.base - t9)) t8 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a2 : - option - (defaults.expr - (type.base - t8) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a2 - with - | Some - x'2 => - if - (args3 =? - 2 - ^ - (2 * - Z.log2_up - args3 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args3 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args3))%expr @ - ( - x'1 v1, - x'2 v2))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) - | None => - UnderLets.Base - (x * x0)%expr - end - | _ => - UnderLets.Base - (x * x0)%expr - end - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' - true d3 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - end - | ($_)%expr => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t4 v0 => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) => - match a with - | Some x' => - match - s2 as t5 - return - (Compile.value' false - t5 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t5 => - fun - v1 : defaults.expr - (type.base t5) - => - base.try_make_transport_cps - (fun t6 : base.type - => - defaults.expr - (type.base t6)) - t5 base.type.Z - (UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - (args0 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (#(ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - (x' v0, - x'0 v1))%expr_pat - else - match x1 with - | #(idc3)%expr_pat => - match - match - idc3 - with - | @ident.Literal - t7 v2 => - match - t7 as t8 - return - (base.base_interp - t8 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun - v3 : Z => - Some v3 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun - _ : nat - => None - end v2 - | _ => - None - end - with - | Some - args3 => - match - s0 as t7 - return - (Compile.value' - false t7 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t7 => - fun - v2 : - defaults.expr - (type.base - t7) => - base.try_make_transport_cps - (fun - t8 : base.type - => - defaults.expr - (type.base - t8)) t7 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : - option - (defaults.expr - (type.base - t7) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a1 - with - | Some - x'1 => - match - s2 as t8 - return - (Compile.value' - false t8 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t8 => - fun - v3 : - defaults.expr - (type.base - t8) => - base.try_make_transport_cps - (fun - t9 : base.type - => - defaults.expr - (type.base - t9)) t8 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a2 : - option - (defaults.expr - (type.base - t8) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a2 - with - | Some - x'2 => - if - (args3 =? - 2 - ^ - (2 * - Z.log2_up - args3 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args3 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args3))%expr @ - ( - x'1 v2, - x'2 v3))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) - | None => - UnderLets.Base - (x * x0)%expr - end - | _ => - UnderLets.Base - (x * x0)%expr - end - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' - true d3 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) => - match a with - | Some x' => - match - s2 as t4 - return - (Compile.value' false - t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) - => - base.try_make_transport_cps - (fun t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - (args0 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (#(ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - (x' v, - x'0 v0))%expr_pat - else - match x1 with - | #(idc3)%expr_pat => - match - match - idc3 - with - | @ident.Literal - t6 v1 => - match - t6 as t7 - return - (base.base_interp - t7 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun - v2 : Z => - Some v2 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun - _ : nat - => None - end v1 - | _ => - None - end - with - | Some - args3 => - match - s0 as t6 - return - (Compile.value' - false t6 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t6 => - fun - v1 : - defaults.expr - (type.base - t6) => - base.try_make_transport_cps - (fun - t7 : base.type - => - defaults.expr - (type.base - t7)) t6 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : - option - (defaults.expr - (type.base - t6) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a1 - with - | Some - x'1 => - match - s2 as t7 - return - (Compile.value' - false t7 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t7 => - fun - v2 : - defaults.expr - (type.base - t7) => - base.try_make_transport_cps - (fun - t8 : base.type - => - defaults.expr - (type.base - t8)) t7 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a2 : - option - (defaults.expr - (type.base - t7) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a2 - with - | Some - x'2 => - if - (args3 =? - 2 - ^ - (2 * - Z.log2_up - args3 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args3 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args3))%expr @ - ( - x'1 v1, - x'2 v2))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) - | None => - UnderLets.Base - (x * x0)%expr - end - | _ => - UnderLets.Base - (x * x0)%expr - end - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' - true d3 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | _ => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) => - match a with - | Some x' => - match - s2 as t4 - return - (Compile.value' false - t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) - => - base.try_make_transport_cps - (fun t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - (args0 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (#(ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - (x' v, - x'0 v0))%expr_pat - else - match x1 with - | #(idc3)%expr_pat => - match - match - idc3 - with - | @ident.Literal - t6 v1 => - match - t6 as t7 - return - (base.base_interp - t7 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun - v2 : Z => - Some v2 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun - _ : nat - => None - end v1 - | _ => - None - end - with - | Some - args3 => - match - s0 as t6 - return - (Compile.value' - false t6 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t6 => - fun - v1 : - defaults.expr - (type.base - t6) => - base.try_make_transport_cps - (fun - t7 : base.type - => - defaults.expr - (type.base - t7)) t6 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : - option - (defaults.expr - (type.base - t6) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a1 - with - | Some - x'1 => - match - s2 as t7 - return - (Compile.value' - false t7 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t7 => - fun - v2 : - defaults.expr - (type.base - t7) => - base.try_make_transport_cps - (fun - t8 : base.type - => - defaults.expr - (type.base - t8)) t7 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a2 : - option - (defaults.expr - (type.base - t7) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a2 - with - | Some - x'2 => - if - (args3 =? - 2 - ^ - (2 * - Z.log2_up - args3 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args3 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args3))%expr @ - ( - x'1 v1, - x'2 v2))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> - d4)%ptype => - fun - _ : - Compile.value' - false s4 -> - Compile.value' - true d4 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> - d4)%ptype => - fun - _ : - Compile.value' - false s4 -> - Compile.value' - true d4 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) - | None => - UnderLets.Base - (x * x0)%expr - end - | _ => - UnderLets.Base - (x * x0)%expr - end - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' - false s4 -> - Compile.value' - true d4 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - end - | None => - match - match idc1 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) => - match a with - | Some x' => - match - s2 as t4 - return - (Compile.value' false - t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) - => - base.try_make_transport_cps - (fun t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ (2 * args2 / - 2) - 1 - then - UnderLets.Base - (#(ident.fancy_mullh - (2 * - args2))%expr @ - (x' v, - x'0 v0))%expr_pat - else - match x1 with - | #(idc3)%expr_pat => - match - match - idc3 - with - | @ident.Literal - t6 v1 => - match - t6 as t7 - return - (base.base_interp - t7 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun - v2 : Z => - Some v2 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun - _ : nat - => None - end v1 - | _ => - None - end - with - | Some - args3 => - match - s0 as t6 - return - (Compile.value' - false t6 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t6 => - fun - v1 : - defaults.expr - (type.base - t6) => - base.try_make_transport_cps - (fun - t7 : base.type - => - defaults.expr - (type.base - t7)) t6 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : - option - (defaults.expr - (type.base - t6) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a1 - with - | Some - x'1 => - match - s2 as t7 - return - (Compile.value' - false t7 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t7 => - fun - v2 : - defaults.expr - (type.base - t7) => - base.try_make_transport_cps - (fun - t8 : base.type - => - defaults.expr - (type.base - t8)) t7 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a2 : - option - (defaults.expr - (type.base - t7) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a2 - with - | Some - x'2 => - if - args3 =? - 2 - ^ - (2 * - args2 / 2) - - 1 - then - UnderLets.Base - (# - (ident.fancy_mullh - (2 * - args2))%expr @ - ( - x'1 v1, - x'2 v2))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) - | None => - UnderLets.Base - (x * x0)%expr - end - | _ => - UnderLets.Base - (x * x0)%expr - end - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' - true d3 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x1) - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | None => UnderLets.Base (x * x0)%expr - end - 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 _ _ _ _ _ _ _) _) - _ => UnderLets.Base (x * x0)%expr - | @expr.App _ _ _ s1 _ #(_)%expr_pat _ | @expr.App _ _ _ - s1 _ ($_)%expr _ | @expr.App _ _ _ s1 _ - (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s1 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (x * x0)%expr - | _ => UnderLets.Base (x * x0)%expr - end - | None => - match x1 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - match x0 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun v : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if - args0 =? - 2 ^ (2 * Z.log2_up args0 / 2) - - 1 - then - match - invert_low - (2 * Z.log2_up args0) - args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mulll - (2 * - Z.log2_up args0))%expr @ - (x' v, ##(y)%expr))%expr_pat - | None => - match - s0 as t4 - return - (Compile.value' false - t4 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base - t4) => - base.try_make_transport_cps - (fun t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args0) - args1 - with - | Some y => - UnderLets.Base - (# - (ident.fancy_mullh - (2 * - Z.log2_up - args0))%expr @ - ( - x'0 v0, - ## - (y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' - false s1 -> - Compile.value' - true d1 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - end - else - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) - => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args0) - args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mullh - (2 * - Z.log2_up - args0))%expr @ - (x'0 v0, - ## - (y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' - false s1 -> - Compile.value' true - d1 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => UnderLets.Base (x * x0)%expr - end - | @expr.App _ _ _ s1 _ - (@expr.App _ _ _ s2 _ #(idc2)%expr_pat x4) - x3 => - match - match idc2 with - | ident.Z_land => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t4 v => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t4 => - fun - v : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s1 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t5 => - fun - v0 : defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base t6)) - t5 base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x' v, - x'0 v0))%expr_pat - else - match - x3 - with - | # - (idc4)%expr_pat => - match - match - idc4 - with - | @ident.Literal - t7 v1 => - match - t7 as t8 - return - (base.base_interp - t8 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun - v2 : Z => - Some v2 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun - _ : nat - => None - end v1 - | _ => - None - end - with - | Some - args3 => - match - s0 as t7 - return - (Compile.value' - false t7 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t7 => - fun - v1 : - defaults.expr - (type.base - t7) => - base.try_make_transport_cps - (fun - t8 : base.type - => - defaults.expr - (type.base - t8)) t7 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : - option - (defaults.expr - (type.base - t7) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a1 - with - | Some - x'1 => - match - s2 as t8 - return - (Compile.value' - false t8 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t8 => - fun - v2 : - defaults.expr - (type.base - t8) => - base.try_make_transport_cps - (fun - t9 : base.type - => - defaults.expr - (type.base - t9)) t8 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a2 : - option - (defaults.expr - (type.base - t8) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a2 - with - | Some - x'2 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args3 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x'1 v1, - x'2 v2))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) - | None => - UnderLets.Base - (x * x0)%expr - end - | _ => - UnderLets.Base - (x * x0)%expr - end - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' - true d3 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect x3) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - match x3 with - | #(idc4)%expr_pat => - match - match idc4 with - | @ident.Literal t5 v => - match - t5 as t6 - return - (base.base_interp - t6 -> option Z) - with - | base.type.unit => - fun _ : unit => - None - | base.type.Z => - fun v0 : Z => - Some v0 - | base.type.bool => - fun _ : bool => - None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t5 - return - (Compile.value' false - t5 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t5 => - fun - v : defaults.expr - (type.base t5) - => - base.try_make_transport_cps - (fun t6 : base.type - => - defaults.expr - (type.base t6)) - t5 base.type.Z - (UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s2 as t6 - return - (Compile.value' - false t6 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t6 => - fun - v0 : - defaults.expr - (type.base - t6) => - base.try_make_transport_cps - (fun - t7 : base.type - => - defaults.expr - (type.base - t7)) t6 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t6) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a0 - with - | Some - x'0 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x' v, - x'0 v0))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' - true d3 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base - (x * x0)%expr - end - | _ => - UnderLets.Base (x * x0)%expr - end - end - | ($_)%expr => - match x3 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t5 v0 => - match - t5 as t6 - return - (base.base_interp t6 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s0 as t5 - return - (Compile.value' false t5 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t5 => - fun - v0 : defaults.expr - (type.base t5) - => - base.try_make_transport_cps - (fun t6 : base.type => - defaults.expr - (type.base t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s2 as t6 - return - (Compile.value' - false t6 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t6 => - fun - v1 : - defaults.expr - (type.base - t6) => - base.try_make_transport_cps - (fun - t7 : base.type - => - defaults.expr - (type.base - t7)) t6 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t6) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a0 - with - | Some - x'0 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x' v0, - x'0 v1))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' true - d3 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x3 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t4 v => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s2 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t5 => - fun - v0 : - defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a0 - with - | Some - x'0 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x' v, - x'0 v0))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' true - d3 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | _ => - match x3 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t4 v => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s2 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t5 => - fun - v0 : - defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a0 - with - | Some - x'0 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x' v, - x'0 v0))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : - Compile.value' - false s4 -> - Compile.value' - true d4 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' - false s4 -> - Compile.value' true - d4 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - end - | None => - match - match idc2 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x3 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t4 v => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s2 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t5 => - fun - v0 : - defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a0 - with - | Some - x'0 => - if - args0 =? - 2 - ^ - (2 * - args2 / 2) - - 1 - then - UnderLets.Base - (# - (ident.fancy_mullh - (2 * - args2))%expr @ - ( - x' v, - x'0 v0))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' true - d3 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | None => UnderLets.Base (x * x0)%expr - end - 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 _ _ _ _ _ _ _) _) _ => - UnderLets.Base (x * x0)%expr - | @expr.App _ _ _ s1 _ #(_)%expr_pat _ | - @expr.App _ _ _ s1 _ ($_)%expr _ | @expr.App _ - _ _ s1 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App - _ _ _ s1 _ (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (x * x0)%expr - | _ => UnderLets.Base (x * x0)%expr - end - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - end - | ($_)%expr => - match x1 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t2 v0 => - match - t2 as t3 return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args0 => - match x0 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return (base.base_interp t4 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t3) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if - args0 =? - 2 ^ (2 * Z.log2_up args0 / 2) - 1 - then - match - invert_low - (2 * Z.log2_up args0) args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mulll - (2 * Z.log2_up args0))%expr @ - (x' v0, ##(y)%expr))%expr_pat - | None => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v1 : defaults.expr - (type.base t4) - => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args0) - args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mullh - (2 * - Z.log2_up - args0))%expr @ - (x'0 v1, - ## - (y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' - false s1 -> - Compile.value' true - d1 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - end - else - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t4 => - fun - v1 : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ (2 * - Z.log2_up args0 / - 2) - 1 - then - match - invert_high - (2 * - Z.log2_up args0) - args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mullh - (2 * - Z.log2_up - args0))%expr @ - (x'0 v1, - ##(y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => UnderLets.Base (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => UnderLets.Base (x * x0)%expr - end - | @expr.App _ _ _ s1 _ - (@expr.App _ _ _ s2 _ #(idc1)%expr_pat x4) x3 => - match - match idc1 with - | ident.Z_land => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t4 v0 => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) => - match a with - | Some x' => - match - s1 as t5 - return - (Compile.value' false - t5 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t5 => - fun - v1 : defaults.expr - (type.base t5) - => - base.try_make_transport_cps - (fun t6 : base.type - => - defaults.expr - (type.base t6)) - t5 base.type.Z - (UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - (args0 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (#(ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - (x' v0, - x'0 v1))%expr_pat - else - match x3 with - | #(idc3)%expr_pat => - match - match - idc3 - with - | @ident.Literal - t7 v2 => - match - t7 as t8 - return - (base.base_interp - t8 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun - v3 : Z => - Some v3 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun - _ : nat - => None - end v2 - | _ => - None - end - with - | Some - args3 => - match - s0 as t7 - return - (Compile.value' - false t7 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t7 => - fun - v2 : - defaults.expr - (type.base - t7) => - base.try_make_transport_cps - (fun - t8 : base.type - => - defaults.expr - (type.base - t8)) t7 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : - option - (defaults.expr - (type.base - t7) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a1 - with - | Some - x'1 => - match - s2 as t8 - return - (Compile.value' - false t8 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t8 => - fun - v3 : - defaults.expr - (type.base - t8) => - base.try_make_transport_cps - (fun - t9 : base.type - => - defaults.expr - (type.base - t9)) t8 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a2 : - option - (defaults.expr - (type.base - t8) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a2 - with - | Some - x'2 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args3 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x'1 v2, - x'2 v3))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) - | None => - UnderLets.Base - (x * x0)%expr - end - | _ => - UnderLets.Base - (x * x0)%expr - end - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' - true d3 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x3) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - match x3 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t5 v0 => - match - t5 as t6 - return - (base.base_interp t6 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s0 as t5 - return - (Compile.value' false t5 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t5 => - fun - v0 : defaults.expr - (type.base t5) - => - base.try_make_transport_cps - (fun t6 : base.type => - defaults.expr - (type.base t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s2 as t6 - return - (Compile.value' - false t6 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t6 => - fun - v1 : - defaults.expr - (type.base - t6) => - base.try_make_transport_cps - (fun - t7 : base.type - => - defaults.expr - (type.base - t7)) t6 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t6) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a0 - with - | Some - x'0 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x' v0, - x'0 v1))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' true - d3 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - end - | ($_)%expr => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t5 v1 => - match - t5 as t6 - return - (base.base_interp t6 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v2 : Z => Some v2 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v1 - | _ => None - end - with - | Some args2 => - match - s0 as t5 - return - (Compile.value' false t5 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t5 => - fun - v1 : defaults.expr - (type.base t5) => - base.try_make_transport_cps - (fun t6 : base.type => - defaults.expr - (type.base t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s2 as t6 - return - (Compile.value' - false t6 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t6 => - fun - v2 : defaults.expr - (type.base - t6) => - base.try_make_transport_cps - (fun - t7 : base.type - => - defaults.expr - (type.base t7)) - t6 base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t6) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x' v1, - x'0 v2))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' - true d3 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t4 v0 => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s2 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t5 => - fun - v1 : defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base t6)) - t5 base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x' v0, - x'0 v1))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' - true d3 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | _ => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t4 v0 => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s2 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t5 => - fun - v1 : defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base t6)) - t5 base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x' v0, - x'0 v1))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' - false s4 -> - Compile.value' - true d4 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - end - | None => - match - match idc1 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t4 v0 => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s2 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t5 => - fun - v1 : defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base t6)) - t5 base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ - (2 * args2 / - 2) - 1 - then - UnderLets.Base - (# - (ident.fancy_mullh - (2 * - args2))%expr @ - ( - x' v0, - x'0 v1))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' - true d3 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | None => UnderLets.Base (x * x0)%expr - end - 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 _ _ _ _ _ _ _) - _) _ => UnderLets.Base (x * x0)%expr - | @expr.App _ _ _ s1 _ #(_)%expr_pat _ | @expr.App _ - _ _ s1 _ ($_)%expr _ | @expr.App _ _ _ s1 _ - (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s1 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (x * x0)%expr - | _ => UnderLets.Base (x * x0)%expr - end - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | @expr.Abs _ _ _ _ _ _ => - match x1 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - match x0 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if - args0 =? - 2 ^ (2 * Z.log2_up args0 / 2) - 1 - then - match - invert_low - (2 * Z.log2_up args0) args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mulll - (2 * Z.log2_up args0))%expr @ - (x' v, ##(y)%expr))%expr_pat - | None => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args0) - args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mullh - (2 * - Z.log2_up - args0))%expr @ - (x'0 v0, - ## - (y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' - false s2 -> - Compile.value' true - d2 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - end - else - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ (2 * - Z.log2_up args0 / - 2) - 1 - then - match - invert_high - (2 * - Z.log2_up args0) - args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mullh - (2 * - Z.log2_up - args0))%expr @ - (x'0 v0, - ##(y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => UnderLets.Base (x * x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => UnderLets.Base (x * x0)%expr - end - | @expr.App _ _ _ s2 _ - (@expr.App _ _ _ s3 _ #(idc1)%expr_pat x4) x3 => - match - match idc1 with - | ident.Z_land => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) => - match a with - | Some x' => - match - s2 as t4 - return - (Compile.value' false - t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) - => - base.try_make_transport_cps - (fun t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - (args0 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (#(ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - (x' v, - x'0 v0))%expr_pat - else - match x3 with - | #(idc3)%expr_pat => - match - match - idc3 - with - | @ident.Literal - t6 v1 => - match - t6 as t7 - return - (base.base_interp - t7 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun - v2 : Z => - Some v2 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun - _ : nat - => None - end v1 - | _ => - None - end - with - | Some - args3 => - match - s0 as t6 - return - (Compile.value' - false t6 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t6 => - fun - v1 : - defaults.expr - (type.base - t6) => - base.try_make_transport_cps - (fun - t7 : base.type - => - defaults.expr - (type.base - t7)) t6 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : - option - (defaults.expr - (type.base - t6) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a1 - with - | Some - x'1 => - match - s3 as t7 - return - (Compile.value' - false t7 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t7 => - fun - v2 : - defaults.expr - (type.base - t7) => - base.try_make_transport_cps - (fun - t8 : base.type - => - defaults.expr - (type.base - t8)) t7 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a2 : - option - (defaults.expr - (type.base - t7) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a2 - with - | Some - x'2 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args3 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x'1 v1, - x'2 v2))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> - d4)%ptype => - fun - _ : - Compile.value' - false s4 -> - Compile.value' - true d4 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> - d4)%ptype => - fun - _ : - Compile.value' - false s4 -> - Compile.value' - true d4 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) - | None => - UnderLets.Base - (x * x0)%expr - end - | _ => - UnderLets.Base - (x * x0)%expr - end - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' - false s4 -> - Compile.value' - true d4 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x3) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - match x3 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t4 v => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s3 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t5 => - fun - v0 : - defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a0 - with - | Some - x'0 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x' v, - x'0 v0))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : - Compile.value' - false s4 -> - Compile.value' - true d4 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' - false s4 -> - Compile.value' true - d4 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - end - | ($_)%expr => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t4 v0 => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s3 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t5 => - fun - v1 : defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base t6)) - t5 base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x' v0, - x'0 v1))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' - false s4 -> - Compile.value' - true d4 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s3 as t4 - return - (Compile.value' - false t4 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base - t4) => - base.try_make_transport_cps - (fun - t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x' v, - x'0 v0))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' - false s4 -> - Compile.value' - true d4 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | _ => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s3 as t4 - return - (Compile.value' - false t4 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base - t4) => - base.try_make_transport_cps - (fun - t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x' v, - x'0 v0))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s5 -> d5)%ptype => - fun - _ : Compile.value' - false s5 -> - Compile.value' - true d5 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s5 -> d5)%ptype => - fun - _ : Compile.value' false s5 -> - Compile.value' true d5 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - end - | None => - match - match idc1 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s3 as t4 - return - (Compile.value' - false t4 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base - t4) => - base.try_make_transport_cps - (fun - t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ - (2 * args2 / - 2) - 1 - then - UnderLets.Base - (# - (ident.fancy_mullh - (2 * - args2))%expr @ - ( - x' v, - x'0 v0))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' - false s4 -> - Compile.value' - true d4 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | None => UnderLets.Base (x * x0)%expr - end - end - | @expr.App _ _ _ s2 _ - (@expr.App _ _ _ s3 _ ($_)%expr _) _ | @expr.App _ - _ _ s2 _ - (@expr.App _ _ _ s3 _ (@expr.Abs _ _ _ _ _ _) _) - _ | @expr.App _ _ _ s2 _ - (@expr.App _ _ _ s3 _ (_ @ _)%expr_pat _) _ | - @expr.App _ _ _ s2 _ - (@expr.App _ _ _ s3 _ (@expr.LetIn _ _ _ _ _ _ _) - _) _ => UnderLets.Base (x * x0)%expr - | @expr.App _ _ _ s2 _ #(_)%expr_pat _ | @expr.App _ - _ _ s2 _ ($_)%expr _ | @expr.App _ _ _ s2 _ - (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s2 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (x * x0)%expr - | _ => UnderLets.Base (x * x0)%expr - end - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | (_ @ _)%expr_pat => - match x1 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - match x0 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if - args0 =? - 2 ^ (2 * Z.log2_up args0 / 2) - 1 - then - match - invert_low - (2 * Z.log2_up args0) args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mulll - (2 * Z.log2_up args0))%expr @ - (x' v, ##(y)%expr))%expr_pat - | None => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args0) - args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mullh - (2 * - Z.log2_up - args0))%expr @ - (x'0 v0, - ## - (y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' - false s2 -> - Compile.value' true - d2 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - end - else - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ (2 * - Z.log2_up args0 / - 2) - 1 - then - match - invert_high - (2 * - Z.log2_up args0) - args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mullh - (2 * - Z.log2_up - args0))%expr @ - (x'0 v0, - ##(y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => UnderLets.Base (x * x0)%expr - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => UnderLets.Base (x * x0)%expr - end - | @expr.App _ _ _ s2 _ - (@expr.App _ _ _ s3 _ #(idc1)%expr_pat x5) x4 => - match - match idc1 with - | ident.Z_land => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) => - match a with - | Some x' => - match - s2 as t4 - return - (Compile.value' false - t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) - => - base.try_make_transport_cps - (fun t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - (args0 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (#(ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - (x' v, - x'0 v0))%expr_pat - else - match x4 with - | #(idc3)%expr_pat => - match - match - idc3 - with - | @ident.Literal - t6 v1 => - match - t6 as t7 - return - (base.base_interp - t7 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun - v2 : Z => - Some v2 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun - _ : nat - => None - end v1 - | _ => - None - end - with - | Some - args3 => - match - s0 as t6 - return - (Compile.value' - false t6 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t6 => - fun - v1 : - defaults.expr - (type.base - t6) => - base.try_make_transport_cps - (fun - t7 : base.type - => - defaults.expr - (type.base - t7)) t6 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : - option - (defaults.expr - (type.base - t6) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a1 - with - | Some - x'1 => - match - s3 as t7 - return - (Compile.value' - false t7 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t7 => - fun - v2 : - defaults.expr - (type.base - t7) => - base.try_make_transport_cps - (fun - t8 : base.type - => - defaults.expr - (type.base - t8)) t7 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a2 : - option - (defaults.expr - (type.base - t7) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a2 - with - | Some - x'2 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args3 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x'1 v1, - x'2 v2))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> - d4)%ptype => - fun - _ : - Compile.value' - false s4 -> - Compile.value' - true d4 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x5) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> - d4)%ptype => - fun - _ : - Compile.value' - false s4 -> - Compile.value' - true d4 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) - | None => - UnderLets.Base - (x * x0)%expr - end - | _ => - UnderLets.Base - (x * x0)%expr - end - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' - false s4 -> - Compile.value' - true d4 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - match x4 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t4 v => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s3 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t5 => - fun - v0 : - defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a0 - with - | Some - x'0 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x' v, - x'0 v0))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : - Compile.value' - false s4 -> - Compile.value' - true d4 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x5) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' - false s4 -> - Compile.value' true - d4 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - end - | ($_)%expr => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t4 v0 => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s3 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t5 => - fun - v1 : defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base t6)) - t5 base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x' v0, - x'0 v1))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' - false s4 -> - Compile.value' - true d4 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect x5) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s3 as t4 - return - (Compile.value' - false t4 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base - t4) => - base.try_make_transport_cps - (fun - t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x' v, - x'0 v0))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' - false s4 -> - Compile.value' - true d4 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect x5) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | _ => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s3 as t4 - return - (Compile.value' - false t4 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base - t4) => - base.try_make_transport_cps - (fun - t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x' v, - x'0 v0))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s5 -> d5)%ptype => - fun - _ : Compile.value' - false s5 -> - Compile.value' - true d5 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect x5) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s5 -> d5)%ptype => - fun - _ : Compile.value' false s5 -> - Compile.value' true d5 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - end - | None => - match - match idc1 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s3 as t4 - return - (Compile.value' - false t4 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base - t4) => - base.try_make_transport_cps - (fun - t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ - (2 * args2 / - 2) - 1 - then - UnderLets.Base - (# - (ident.fancy_mullh - (2 * - args2))%expr @ - ( - x' v, - x'0 v0))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' - false s4 -> - Compile.value' - true d4 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect x5) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | None => UnderLets.Base (x * x0)%expr - end - end - | @expr.App _ _ _ s2 _ - (@expr.App _ _ _ s3 _ ($_)%expr _) _ | @expr.App _ - _ _ s2 _ - (@expr.App _ _ _ s3 _ (@expr.Abs _ _ _ _ _ _) _) - _ | @expr.App _ _ _ s2 _ - (@expr.App _ _ _ s3 _ (_ @ _)%expr_pat _) _ | - @expr.App _ _ _ s2 _ - (@expr.App _ _ _ s3 _ (@expr.LetIn _ _ _ _ _ _ _) - _) _ => UnderLets.Base (x * x0)%expr - | @expr.App _ _ _ s2 _ #(_)%expr_pat _ | @expr.App _ - _ _ s2 _ ($_)%expr _ | @expr.App _ _ _ s2 _ - (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s2 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (x * x0)%expr - | _ => UnderLets.Base (x * x0)%expr - end - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x1 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - match x0 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if - args0 =? - 2 ^ (2 * Z.log2_up args0 / 2) - 1 - then - match - invert_low - (2 * Z.log2_up args0) args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mulll - (2 * Z.log2_up args0))%expr @ - (x' v, ##(y)%expr))%expr_pat - | None => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1 - then - match - invert_high - (2 * - Z.log2_up - args0) - args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mullh - (2 * - Z.log2_up - args0))%expr @ - (x'0 v0, - ## - (y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' - false s1 -> - Compile.value' true - d1 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - end - else - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ (2 * - Z.log2_up args0 / - 2) - 1 - then - match - invert_high - (2 * - Z.log2_up args0) - args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mullh - (2 * - Z.log2_up - args0))%expr @ - (x'0 v0, - ##(y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => UnderLets.Base (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => UnderLets.Base (x * x0)%expr - end - | @expr.App _ _ _ s1 _ - (@expr.App _ _ _ s2 _ #(idc1)%expr_pat x5) x4 => - match - match idc1 with - | ident.Z_land => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) => - match a with - | Some x' => - match - s1 as t4 - return - (Compile.value' false - t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) - => - base.try_make_transport_cps - (fun t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - (args0 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (#(ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - (x' v, - x'0 v0))%expr_pat - else - match x4 with - | #(idc3)%expr_pat => - match - match - idc3 - with - | @ident.Literal - t6 v1 => - match - t6 as t7 - return - (base.base_interp - t7 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun - v2 : Z => - Some v2 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun - _ : nat - => None - end v1 - | _ => - None - end - with - | Some - args3 => - match - s0 as t6 - return - (Compile.value' - false t6 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t6 => - fun - v1 : - defaults.expr - (type.base - t6) => - base.try_make_transport_cps - (fun - t7 : base.type - => - defaults.expr - (type.base - t7)) t6 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : - option - (defaults.expr - (type.base - t6) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a1 - with - | Some - x'1 => - match - s2 as t7 - return - (Compile.value' - false t7 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t7 => - fun - v2 : - defaults.expr - (type.base - t7) => - base.try_make_transport_cps - (fun - t8 : base.type - => - defaults.expr - (type.base - t8)) t7 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a2 : - option - (defaults.expr - (type.base - t7) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a2 - with - | Some - x'2 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args3 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x'1 v1, - x'2 v2))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x5) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) - | None => - UnderLets.Base - (x * x0)%expr - end - | _ => - UnderLets.Base - (x * x0)%expr - end - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' - true d3 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - match x4 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t4 v => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s2 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t5 => - fun - v0 : - defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a0 - with - | Some - x'0 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x' v, - x'0 v0))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x5) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' true - d3 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - end - | ($_)%expr => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t4 v0 => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s2 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t5 => - fun - v1 : defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base t6)) - t5 base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x' v0, - x'0 v1))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' - true d3 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect x5) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s2 as t4 - return - (Compile.value' - false t4 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base - t4) => - base.try_make_transport_cps - (fun - t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x' v, - x'0 v0))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' - true d3 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect x5) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | _ => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s2 as t4 - return - (Compile.value' - false t4 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base - t4) => - base.try_make_transport_cps - (fun - t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - (args0 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) && - (args2 =? - 2 - ^ - (2 * - Z.log2_up - args0 / 2) - - 1) - then - UnderLets.Base - (# - (ident.fancy_mulll - (2 * - Z.log2_up - args0))%expr @ - ( - x' v, - x'0 v0))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' - false s4 -> - Compile.value' - true d4 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect x5) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - end - | None => - match - match idc1 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s2 as t4 - return - (Compile.value' - false t4 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base - t4) => - base.try_make_transport_cps - (fun - t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - 2 - ^ - (2 * args2 / - 2) - 1 - then - UnderLets.Base - (# - (ident.fancy_mullh - (2 * - args2))%expr @ - ( - x' v, - x'0 v0))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' - true d3 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect x5) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | None => UnderLets.Base (x * x0)%expr - end - 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 _ _ _ _ _ _ _) - _) _ => UnderLets.Base (x * x0)%expr - | @expr.App _ _ _ s1 _ #(_)%expr_pat _ | @expr.App _ - _ _ s1 _ ($_)%expr _ | @expr.App _ _ _ s1 _ - (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s1 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (x * x0)%expr - | _ => UnderLets.Base (x * x0)%expr - end - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - end - | None => - match - match idc with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x1 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - match x0 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - match - invert_low (2 * args0) args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mulhl - (2 * args0))%expr @ - (x' v, ##(y)%expr))%expr_pat - | None => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - match - invert_high - (2 * args0) - args1 - with - | Some y => - UnderLets.Base - (#(ident.fancy_mulhh - (2 * - args0))%expr @ - (x'0 v0, - ##(y)%expr))%expr_pat - | None => - UnderLets.Base - (x * x0)%expr - end - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false - s1 -> - Compile.value' true - d1 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - end - | None => UnderLets.Base (x * x0)%expr - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => UnderLets.Base (x * x0)%expr - end - | @expr.App _ _ _ s1 _ - (@expr.App _ _ _ s2 _ #(idc1)%expr_pat x4) x3 => - match - match idc1 with - | ident.Z_land => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) => - match a with - | Some x' => - match - s1 as t4 - return - (Compile.value' false - t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) - => - base.try_make_transport_cps - (fun t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args2 =? - 2 - ^ (2 * args0 / - 2) - 1 - then - UnderLets.Base - (#(ident.fancy_mulhl - (2 * - args0))%expr @ - (x' v, - x'0 v0))%expr_pat - else - match x3 with - | #(idc3)%expr_pat => - match - match - idc3 - with - | @ident.Literal - t6 v1 => - match - t6 as t7 - return - (base.base_interp - t7 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun - v2 : Z => - Some v2 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun - _ : nat - => None - end v1 - | _ => - None - end - with - | Some - args3 => - match - s0 as t6 - return - (Compile.value' - false t6 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t6 => - fun - v1 : - defaults.expr - (type.base - t6) => - base.try_make_transport_cps - (fun - t7 : base.type - => - defaults.expr - (type.base - t7)) t6 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a1 : - option - (defaults.expr - (type.base - t6) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a1 - with - | Some - x'1 => - match - s2 as t7 - return - (Compile.value' - false t7 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base - t7 => - fun - v2 : - defaults.expr - (type.base - t7) => - base.try_make_transport_cps - (fun - t8 : base.type - => - defaults.expr - (type.base - t8)) t7 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a2 : - option - (defaults.expr - (type.base - t7) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a2 - with - | Some - x'2 => - if - args3 =? - 2 - ^ - (2 * - args0 / 2) - - 1 - then - UnderLets.Base - (# - (ident.fancy_mulhl - (2 * - args0))%expr @ - ( - x'1 v1, - x'2 v2))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> - d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x2) - | None => - UnderLets.Base - (x * x0)%expr - end - | _ => - UnderLets.Base - (x * x0)%expr - end - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' - true d3 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x3) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - match x3 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t4 v => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s2 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t5 => - fun - v0 : - defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a0 - with - | Some - x'0 => - if - args2 =? - 2 - ^ - (2 * - args0 / 2) - - 1 - then - UnderLets.Base - (# - (ident.fancy_mulhl - (2 * - args0))%expr @ - ( - x' v, - x'0 v0))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect - x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' true - d3 => - UnderLets.Base - (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - end - | ($_)%expr => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t4 v0 => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s2 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t5 => - fun - v1 : defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base t6)) - t5 base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args2 =? - 2 - ^ - (2 * args0 / - 2) - 1 - then - UnderLets.Base - (# - (ident.fancy_mulhl - (2 * - args0))%expr @ - ( - x' v0, - x'0 v1))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' - true d3 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s2 as t4 - return - (Compile.value' - false t4 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base - t4) => - base.try_make_transport_cps - (fun - t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args2 =? - 2 - ^ - (2 * args0 / - 2) - 1 - then - UnderLets.Base - (# - (ident.fancy_mulhl - (2 * - args0))%expr @ - ( - x' v, - x'0 v0))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' - true d3 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | _ => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s2 as t4 - return - (Compile.value' - false t4 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base - t4) => - base.try_make_transport_cps - (fun - t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args2 =? - 2 - ^ - (2 * args0 / - 2) - 1 - then - UnderLets.Base - (# - (ident.fancy_mulhl - (2 * - args0))%expr @ - ( - x' v, - x'0 v0))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' - false s4 -> - Compile.value' - true d4 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - end - | None => - match - match idc1 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - match - s2 as t4 - return - (Compile.value' - false t4 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - base.type.Z))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base - t4) => - base.try_make_transport_cps - (fun - t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : - option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args0 =? - args2 - then - UnderLets.Base - (# - (ident.fancy_mulhh - (2 * - args0))%expr @ - ( - x' v, - x'0 v0))%expr_pat - else - UnderLets.Base - (x * x0)%expr - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' - true d3 => - UnderLets.Base - (x * x0)%expr - end - (Compile.reflect x4) - | None => - UnderLets.Base - (x * x0)%expr - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base (x * x0)%expr - end (Compile.reflect x2) - | None => - UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | None => UnderLets.Base (x * x0)%expr - end - 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 _ _ _ _ _ _ _) - _) _ => UnderLets.Base (x * x0)%expr - | @expr.App _ _ _ s1 _ #(_)%expr_pat _ | @expr.App _ - _ _ s1 _ ($_)%expr _ | @expr.App _ _ _ s1 _ - (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s1 _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (x * x0)%expr - | _ => UnderLets.Base (x * x0)%expr - end - | None => UnderLets.Base (x * x0)%expr - end - | _ => UnderLets.Base (x * x0)%expr - end - | None => UnderLets.Base (x * x0)%expr - end - 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 _ _ _ _ _ _ _) _) _ => - UnderLets.Base (x * x0)%expr - | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr _ | - @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ - (@expr.LetIn _ _ _ _ _ _ _) _ => UnderLets.Base (x * x0)%expr - | _ => UnderLets.Base (x * x0)%expr - end -| ident.Z_pow => - fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_pow)%expr @ x @ x0)%expr_pat -| ident.Z_sub => - fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (x - x0)%expr -| ident.Z_opp => - fun x : defaults.expr (type.base base.type.Z) => - UnderLets.Base (- x)%expr -| ident.Z_div => - fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (x / x0)%expr -| ident.Z_modulo => - fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (x mod x0)%expr -| ident.Z_log2 => - fun x : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_log2)%expr @ x)%expr_pat -| ident.Z_log2_up => - fun x : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_log2_up)%expr @ x)%expr_pat -| ident.Z_eqb => - fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_eqb)%expr @ x @ x0)%expr_pat -| ident.Z_leb => - fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_leb)%expr @ x @ x0)%expr_pat -| ident.Z_geb => - fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_geb)%expr @ x @ x0)%expr_pat -| ident.Z_of_nat => - fun x : defaults.expr (type.base base.type.nat) => - UnderLets.Base (#(ident.Z_of_nat)%expr @ x)%expr_pat -| ident.Z_to_nat => - fun x : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_to_nat)%expr @ x)%expr_pat -| ident.Z_shiftr => - fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (x >> x0)%expr -| ident.Z_shiftl => - fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (x << x0)%expr -| ident.Z_land => - fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (x &' x0)%expr -| ident.Z_lor => - fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (x || x0)%expr -| ident.Z_bneg => - fun x : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_bneg)%expr @ x)%expr_pat -| ident.Z_lnot_modulo => - fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_lnot_modulo)%expr @ x @ x0)%expr_pat -| ident.Z_mul_split => - fun x x0 x1 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat -| ident.Z_add_get_carry => - fun x x0 x1 : defaults.expr (type.base base.type.Z) => - match x with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match t0 as t1 return (base.base_interp t1 -> option Z) with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - match x1 with - | #(_)%expr_pat => - match x0 with - | (@expr.App _ _ _ s0 _ #(idc1) x3 @ x2)%expr_pat => - match - match idc1 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x2 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return (base.base_interp t4 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v : defaults.expr (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t3) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) args1)%expr @ - (x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | None => - match - match idc1 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x2 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - end - | (@expr.App _ _ _ s0 _ ($_)%expr _ @ _)%expr_pat | - (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s0 _ (_ @ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | ($_)%expr => - match x0 with - | (@expr.App _ _ _ s0 _ #(idc0) x3 @ x2)%expr_pat => - match - match idc0 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return (base.base_interp t4 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t3) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) args1)%expr @ - (x1, x' v0))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | None => - match - match idc0 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x1, x' v0))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - end - | (@expr.App _ _ _ s0 _ ($_)%expr _ @ _)%expr_pat | - (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s0 _ (_ @ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | @expr.Abs _ _ _ _ _ _ => - match x0 with - | (@expr.App _ _ _ s1 _ #(idc0) x3 @ x2)%expr_pat => - match - match idc0 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s1 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) args1)%expr @ - (x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | None => - match - match idc0 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s1 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - end - | (@expr.App _ _ _ s1 _ ($_)%expr _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (_ @ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | (#(_) @ _)%expr_pat => - match x0 with - | (@expr.App _ _ _ s1 _ #(idc1) x4 @ x3)%expr_pat => - match - match idc1 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return (base.base_interp t4 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s1 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v : defaults.expr (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t3) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) args1)%expr @ - (x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | None => - match - match idc1 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s1 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - end - | (@expr.App _ _ _ s1 _ ($_)%expr _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (_ @ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | (($_)%expr @ _)%expr_pat => - match x0 with - | (@expr.App _ _ _ s1 _ #(idc0) x4 @ x3)%expr_pat => - match - match idc0 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x3 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return (base.base_interp t4 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args1 => - match - s1 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t3) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) args1)%expr @ - (x1, x' v0))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | None => - match - match idc0 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x3 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args1 => - match - s1 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x1, x' v0))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - end - | (@expr.App _ _ _ s1 _ ($_)%expr _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (_ @ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | (@expr.Abs _ _ _ _ _ _ @ _)%expr_pat => - match x0 with - | (@expr.App _ _ _ s2 _ #(idc0) x4 @ x3)%expr_pat => - match - match idc0 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x3 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s2 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) args1)%expr @ - (x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | None => - match - match idc0 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x3 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s2 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - end - | (@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 => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | (@expr.App _ _ _ s0 _ #(idc0) x3 @ x2)%expr_pat => - match - match idc0 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) - args1)%expr @ (x0, x' v))%expr_pat - else - match x0 with - | (@expr.App _ _ _ s2 _ #(idc2) x5 @ - x4)%expr_pat => - match - match idc2 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t5 - v0 => - match - t5 as t6 - return - (base.base_interp - t6 -> - option Z) - with - | base.type.unit => - fun _ : unit => - None - | base.type.Z => - fun v1 : Z => - Some v1 - | base.type.bool => - fun _ : bool => - None - | base.type.nat => - fun _ : nat => - None - end v0 - | _ => None - end - with - | Some args3 => - match - s2 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t5 => - fun - v0 : defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args =? - 2 - ^ - Z.log2 - args - then - UnderLets.Base - (# - (ident.fancy_add - (Z.log2 - args) - args3)%expr @ - (x1, - x'0 v0))%expr_pat - else - if - args =? - 2 - ^ - Z.log2 - args - then - UnderLets.Base - (# - (ident.fancy_add - (Z.log2 - args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (# - (ident.Z_add_get_carry)%expr @ - x @ x0 @ - x1)%expr_pat - | None => - UnderLets.Base - (# - (ident.Z_add_get_carry)%expr @ - x @ x0 @ - x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - (Compile.reflect x5) - | None => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | _ => - if - args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | None => - match - match idc2 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t5 - v0 => - match - t5 as t6 - return - (base.base_interp - t6 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun v1 : Z - => - Some v1 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun _ : nat - => None - end v0 - | _ => None - end - with - | Some args3 => - match - s2 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t5 => - fun - v0 : - defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a0 - with - | Some - x'0 => - if - args =? - 2 - ^ - Z.log2 - args - then - UnderLets.Base - (# - (ident.fancy_add - (Z.log2 - args) - (- args3))%expr @ - (x1, - x'0 v0))%expr_pat - else - if - args =? - 2 - ^ - Z.log2 - args - then - UnderLets.Base - (# - (ident.fancy_add - (Z.log2 - args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (# - (ident.Z_add_get_carry)%expr @ - x @ x0 @ - x1)%expr_pat - | None => - UnderLets.Base - (# - (ident.Z_add_get_carry)%expr @ - x @ x0 @ - x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ - x1)%expr_pat - end - (Compile.reflect - x5) - | None => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 - args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | _ => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | None => - if - args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - end - | (@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 => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end (Compile.reflect x3) - | None => - match x0 with - | (@expr.App _ _ _ s2 _ #(idc2) x5 @ x4)%expr_pat => - match - match idc2 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t4 v => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s2 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t4 => - fun - v : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - args2)%expr @ - (x1, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | None => - match - match idc2 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t4 v => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s2 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t4 => - fun - v : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 - args) - (- args2))%expr @ - (x1, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 - args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' true - d3 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - end - | (@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 => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - end - | ($_)%expr => - match x0 with - | (@expr.App _ _ _ s2 _ #(idc1) x5 @ x4)%expr_pat => - match - match idc1 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t4 v0 => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s2 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - args2)%expr @ - (x1, x' v0))%expr_pat - else - if - args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | None => - match - match idc1 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t4 v0 => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s2 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args2))%expr @ - (x1, x' v0))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - end - | (@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 => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | @expr.Abs _ _ _ _ _ _ => - match x0 with - | (@expr.App _ _ _ s3 _ #(idc1) x5 @ x4)%expr_pat => - match - match idc1 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s3 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - args2)%expr @ - (x1, x' v))%expr_pat - else - if - args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | None => - match - match idc1 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s3 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args2))%expr @ - (x1, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 - => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - end - | (@expr.App _ _ _ s3 _ ($_)%expr _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (_ @ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (@expr.LetIn _ _ _ _ _ _ _) - _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | (_ @ _)%expr_pat => - match x0 with - | (@expr.App _ _ _ s3 _ #(idc1) x6 @ x5)%expr_pat => - match - match idc1 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s3 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - args2)%expr @ - (x1, x' v))%expr_pat - else - if - args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | None => - match - match idc1 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s3 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args2))%expr @ - (x1, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 - => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - end - | (@expr.App _ _ _ s3 _ ($_)%expr _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (_ @ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (@expr.LetIn _ _ _ _ _ _ _) - _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x0 with - | (@expr.App _ _ _ s2 _ #(idc1) x6 @ x5)%expr_pat => - match - match idc1 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s2 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - args2)%expr @ - (x1, x' v))%expr_pat - else - if - args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | None => - match - match idc1 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s2 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args2))%expr @ - (x1, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - end - | (@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 => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - end - | None => - match - match idc0 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x0 with - | #(_)%expr_pat => - match x2 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x0, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | ($_)%expr => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x0, x' v0))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | (#(_) @ _)%expr_pat => - match x2 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x0, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | (($_)%expr @ _)%expr_pat => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x0, x' v0))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | (@expr.Abs _ _ _ _ _ _ @ _)%expr_pat => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x0, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | (@expr.App _ _ _ s2 _ #(idc1) x5 @ x4)%expr_pat => - match - match idc1 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s2 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - args2)%expr @ - (x1, x' v))%expr_pat - else - match x2 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t5 - v0 => - match - t5 as t6 - return - (base.base_interp - t6 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun v1 : Z - => - Some v1 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun _ : nat - => None - end v0 - | _ => None - end - with - | Some args3 => - match - s0 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t5 => - fun - v0 : - defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a0 - with - | Some - x'0 => - if - args =? - 2 - ^ - Z.log2 - args - then - UnderLets.Base - (# - (ident.fancy_add - (Z.log2 - args) - (- args3))%expr @ - (x0, - x'0 v0))%expr_pat - else - if - args =? - 2 - ^ - Z.log2 - args - then - UnderLets.Base - (# - (ident.fancy_add - (Z.log2 - args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (# - (ident.Z_add_get_carry)%expr @ - x @ x0 @ - x1)%expr_pat - | None => - UnderLets.Base - (# - (ident.Z_add_get_carry)%expr @ - x @ x0 @ - x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ - x1)%expr_pat - end - (Compile.reflect - x3) - | None => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 - args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | _ => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x5) - | None => - match x2 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t4 v => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t4 => - fun - v : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 - args) - (- args2))%expr @ - (x0, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 - args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' true - d3 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - end - | ($_)%expr => - match x2 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t4 v0 => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args2))%expr @ - (x0, x' v0))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x2 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args2))%expr @ - (x0, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - match x2 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args2))%expr @ - (x0, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 - => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - end - | None => - match - match idc1 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x2 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args2))%expr @ - (x0, x' v))%expr_pat - else - match x4 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal - t5 v0 => - match - t5 as t6 - return - (base.base_interp - t6 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun - v1 : Z => - Some v1 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun - _ : nat - => None - end v0 - | _ => None - end - with - | Some args3 => - match - s2 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base - t5 => - fun - v0 : - defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a0 - with - | Some - x'0 => - if - args =? - 2 - ^ - Z.log2 - args - then - UnderLets.Base - (# - (ident.fancy_add - (Z.log2 - args) - (- args3))%expr @ - (x1, - x'0 v0))%expr_pat - else - if - args =? - 2 - ^ - Z.log2 - args - then - UnderLets.Base - (# - (ident.fancy_add - (Z.log2 - args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (# - (ident.Z_add_get_carry)%expr @ - x @ x0 @ - x1)%expr_pat - | None => - UnderLets.Base - (# - (ident.Z_add_get_carry)%expr @ - x @ x0 @ - x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (# - (ident.Z_add_get_carry)%expr @ - x @ x0 @ - x1)%expr_pat - end - (Compile.reflect - x5) - | None => - if - args =? - 2 - ^ Z.log2 - args - then - UnderLets.Base - (# - (ident.fancy_add - (Z.log2 - args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (# - (ident.Z_add_get_carry)%expr @ - x @ x0 @ - x1)%expr_pat - end - | _ => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 - args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - match x4 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t4 v => - match - t4 as t5 - return - (base.base_interp - t5 -> option Z) - with - | base.type.unit => - fun _ : unit => - None - | base.type.Z => - fun v0 : Z => - Some v0 - | base.type.bool => - fun _ : bool => - None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s2 as t4 - return - (Compile.value' false - t4 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t4 => - fun - v : defaults.expr - (type.base t4) - => - base.try_make_transport_cps - (fun t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 - ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 - args) - (- args2))%expr @ - (x1, x' v))%expr_pat - else - if - args =? - 2 - ^ Z.log2 - args - then - UnderLets.Base - (# - (ident.fancy_add - (Z.log2 - args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (# - (ident.Z_add_get_carry)%expr @ - x @ x0 @ - x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' - true d3 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x5) - | None => - if - args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - end - | ($_)%expr => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t4 v0 => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s2 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) - => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 - args) - (- args2))%expr @ - (x1, x' v0))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 - args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' true - d3 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s2 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base - t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 - args) - (- args2))%expr @ - (x1, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 - args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' true - d3 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | _ => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s2 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base - t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 - args) - (- args2))%expr @ - (x1, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 - args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' - false s4 -> - Compile.value' true - d4 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - end - | None => - match x2 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x0, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - end - end - | (@expr.App _ _ _ s2 _ ($_)%expr _ @ _)%expr_pat => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x0, x' v0))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | (@expr.App _ _ _ s2 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s2 _ (_ @ _) _ @ _)%expr_pat => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x0, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | (@expr.App _ _ _ s2 _ (@expr.LetIn _ _ _ _ _ _ _) - _ @ _)%expr_pat => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x0, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x0, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | _ => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x0, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - end - | None => - match x0 with - | (@expr.App _ _ _ s2 _ #(idc1) x5 @ x4)%expr_pat => - match - match idc1 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s2 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - args1)%expr @ - (x1, x' v))%expr_pat - else - if - args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | None => - match - match idc1 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s2 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x1, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - end - | (@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 => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - end - end - | (@expr.App _ _ _ s0 _ ($_)%expr _ @ _)%expr_pat => - match x0 with - | (@expr.App _ _ _ s2 _ #(idc0) x5 @ x4)%expr_pat => - match - match idc0 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return (base.base_interp t4 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args1 => - match - s2 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t3) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) args1)%expr @ - (x1, x' v0))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | None => - match - match idc0 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args1 => - match - s2 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x1, x' v0))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - end - | (@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 => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat => - match x0 with - | (@expr.App _ _ _ s3 _ #(idc0) x5 @ x4)%expr_pat => - match - match idc0 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s3 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) args1)%expr @ - (x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | None => - match - match idc0 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s3 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - end - | (@expr.App _ _ _ s3 _ ($_)%expr _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (_ @ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | (@expr.App _ _ _ s0 _ (_ @ _) _ @ _)%expr_pat => - match x0 with - | (@expr.App _ _ _ s3 _ #(idc0) x6 @ x5)%expr_pat => - match - match idc0 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s3 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) args1)%expr @ - (x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | None => - match - match idc0 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s3 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - end - | (@expr.App _ _ _ s3 _ ($_)%expr _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (_ @ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => - match x0 with - | (@expr.App _ _ _ s2 _ #(idc0) x6 @ x5)%expr_pat => - match - match idc0 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s2 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) args1)%expr @ - (x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | None => - match - match idc0 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s2 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - end - | (@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 => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | (@expr.LetIn _ _ _ _ _ _ _ @ _)%expr_pat => - match x0 with - | (@expr.App _ _ _ s1 _ #(idc0) x5 @ x4)%expr_pat => - match - match idc0 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s1 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) args1)%expr @ - (x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | None => - match - match idc0 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s1 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - end - | (@expr.App _ _ _ s1 _ ($_)%expr _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (_ @ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x0 with - | (@expr.App _ _ _ s0 _ #(idc0) x4 @ x3)%expr_pat => - match - match idc0 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x3 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) args1)%expr @ - (x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | None => - match - match idc0 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x3 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) - (- args1))%expr @ - (x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ - x0 @ x1)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ - x1)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - end - | (@expr.App _ _ _ s0 _ ($_)%expr _ @ _)%expr_pat | - (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s0 _ (_ @ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_add (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - end - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end - | _ => - UnderLets.Base (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat - end -| ident.Z_add_with_carry => - fun x x0 x1 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_add_with_carry)%expr @ x @ x0 @ x1)%expr_pat -| ident.Z_add_with_get_carry => - fun x x0 x1 x2 : defaults.expr (type.base base.type.Z) => - match x with - | #(idc)%expr_pat => - match - match idc with - | @ident.Literal t0 v => - match t0 as t1 return (base.base_interp t1 -> option Z) with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args => - match x2 with - | #(_)%expr_pat => - match x1 with - | (@expr.App _ _ _ s0 _ #(idc1) x4 @ x3)%expr_pat => - match - match idc1 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return (base.base_interp t4 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v : defaults.expr (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t3) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) args1)%expr @ - (x0, x2, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - | None => - match - match idc1 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x2, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - end - | (@expr.App _ _ _ s0 _ ($_)%expr _ @ _)%expr_pat | - (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s0 _ (_ @ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - end - | ($_)%expr => - match x1 with - | (@expr.App _ _ _ s0 _ #(idc0) x4 @ x3)%expr_pat => - match - match idc0 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x3 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return (base.base_interp t4 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t3) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) args1)%expr @ - (x0, x2, x' v0))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - | None => - match - match idc0 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x3 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x2, x' v0))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - end - | (@expr.App _ _ _ s0 _ ($_)%expr _ @ _)%expr_pat | - (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s0 _ (_ @ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - end - | @expr.Abs _ _ _ _ _ _ => - match x1 with - | (@expr.App _ _ _ s1 _ #(idc0) x4 @ x3)%expr_pat => - match - match idc0 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x3 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s1 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) args1)%expr @ - (x0, x2, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - | None => - match - match idc0 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x3 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s1 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x2, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - end - | (@expr.App _ _ _ s1 _ ($_)%expr _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (_ @ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - end - | (#(_) @ _)%expr_pat => - match x1 with - | (@expr.App _ _ _ s1 _ #(idc1) x5 @ x4)%expr_pat => - match - match idc1 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return (base.base_interp t4 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s1 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v : defaults.expr (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t3) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) args1)%expr @ - (x0, x2, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - | None => - match - match idc1 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s1 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x2, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - end - | (@expr.App _ _ _ s1 _ ($_)%expr _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (_ @ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - end - | (($_)%expr @ _)%expr_pat => - match x1 with - | (@expr.App _ _ _ s1 _ #(idc0) x5 @ x4)%expr_pat => - match - match idc0 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return (base.base_interp t4 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args1 => - match - s1 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t3) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) args1)%expr @ - (x0, x2, x' v0))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - | None => - match - match idc0 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args1 => - match - s1 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x2, x' v0))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - end - | (@expr.App _ _ _ s1 _ ($_)%expr _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (_ @ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - end - | (@expr.Abs _ _ _ _ _ _ @ _)%expr_pat => - match x1 with - | (@expr.App _ _ _ s2 _ #(idc0) x5 @ x4)%expr_pat => - match - match idc0 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s2 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) args1)%expr @ - (x0, x2, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - | None => - match - match idc0 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s2 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x2, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - end - | (@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 => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - end - | (@expr.App _ _ _ s0 _ #(idc0) x4 @ x3)%expr_pat => - match - match idc0 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x3 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) - args1)%expr @ (x0, x1, x' v))%expr_pat - else - match x1 with - | (@expr.App _ _ _ s2 _ #(idc2) x6 @ - x5)%expr_pat => - match - match idc2 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t5 - v0 => - match - t5 as t6 - return - (base.base_interp - t6 -> - option Z) - with - | base.type.unit => - fun _ : unit => - None - | base.type.Z => - fun v1 : Z => - Some v1 - | base.type.bool => - fun _ : bool => - None - | base.type.nat => - fun _ : nat => - None - end v0 - | _ => None - end - with - | Some args3 => - match - s2 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t5 => - fun - v0 : defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if - args =? - 2 - ^ - Z.log2 - args - then - UnderLets.Base - (# - (ident.fancy_addc - (Z.log2 - args) - args3)%expr @ - (x0, x2, - x'0 v0))%expr_pat - else - if - args =? - 2 - ^ - Z.log2 - args - then - UnderLets.Base - (# - (ident.fancy_addc - (Z.log2 - args) 0)%expr @ - (x0, x1, - x2))%expr_pat - else - UnderLets.Base - (# - (ident.Z_add_with_get_carry)%expr @ - x @ x0 @ - x1 @ x2)%expr_pat - | None => - UnderLets.Base - (# - (ident.Z_add_with_get_carry)%expr @ - x @ x0 @ - x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ - x2)%expr_pat - end - (Compile.reflect x6) - | None => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if - args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | None => - match - match idc2 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t5 - v0 => - match - t5 as t6 - return - (base.base_interp - t6 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun v1 : Z - => - Some v1 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun _ : nat - => None - end v0 - | _ => None - end - with - | Some args3 => - match - s2 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t5 => - fun - v0 : - defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a0 - with - | Some - x'0 => - if - args =? - 2 - ^ - Z.log2 - args - then - UnderLets.Base - (# - (ident.fancy_addc - (Z.log2 - args) - (- args3))%expr @ - (x0, x2, - x'0 v0))%expr_pat - else - if - args =? - 2 - ^ - Z.log2 - args - then - UnderLets.Base - (# - (ident.fancy_addc - (Z.log2 - args) 0)%expr @ - (x0, x1, - x2))%expr_pat - else - UnderLets.Base - (# - (ident.Z_add_with_get_carry)%expr @ - x @ x0 @ - x1 @ x2)%expr_pat - | None => - UnderLets.Base - (# - (ident.Z_add_with_get_carry)%expr @ - x @ x0 @ - x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ - x1 @ x2)%expr_pat - end - (Compile.reflect - x6) - | None => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 - args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ - x2)%expr_pat - end - | _ => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | None => - if - args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - end - | (@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 => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - match x1 with - | (@expr.App _ _ _ s2 _ #(idc2) x6 @ x5)%expr_pat => - match - match idc2 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t4 v => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s2 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t4 => - fun - v : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - args2)%expr @ - (x0, x2, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) - 0)%expr @ (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | None => - match - match idc2 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t4 v => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s2 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t4 => - fun - v : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 - args) - (- args2))%expr @ - (x0, x2, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 - args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ - x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ - x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' true - d3 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) - 0)%expr @ (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - end - | (@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 => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - end - | ($_)%expr => - match x1 with - | (@expr.App _ _ _ s2 _ #(idc1) x6 @ x5)%expr_pat => - match - match idc1 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t4 v0 => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s2 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - args2)%expr @ - (x0, x2, x' v0))%expr_pat - else - if - args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) - 0)%expr @ (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | None => - match - match idc1 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t4 v0 => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s2 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args2))%expr @ - (x0, x2, x' v0))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) - 0)%expr @ (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - end - | (@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 => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - | @expr.Abs _ _ _ _ _ _ => - match x1 with - | (@expr.App _ _ _ s3 _ #(idc1) x6 @ x5)%expr_pat => - match - match idc1 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s3 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - args2)%expr @ - (x0, x2, x' v))%expr_pat - else - if - args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) - 0)%expr @ (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | None => - match - match idc1 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s3 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args2))%expr @ - (x0, x2, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 - => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) - 0)%expr @ (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - end - | (@expr.App _ _ _ s3 _ ($_)%expr _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (_ @ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (@expr.LetIn _ _ _ _ _ _ _) - _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - | (_ @ _)%expr_pat => - match x1 with - | (@expr.App _ _ _ s3 _ #(idc1) x7 @ x6)%expr_pat => - match - match idc1 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x6 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s3 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - args2)%expr @ - (x0, x2, x' v))%expr_pat - else - if - args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x7) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) - 0)%expr @ (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | None => - match - match idc1 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x6 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s3 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args2))%expr @ - (x0, x2, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 - => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x7) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) - 0)%expr @ (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - end - | (@expr.App _ _ _ s3 _ ($_)%expr _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (_ @ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (@expr.LetIn _ _ _ _ _ _ _) - _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x1 with - | (@expr.App _ _ _ s2 _ #(idc1) x7 @ x6)%expr_pat => - match - match idc1 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x6 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s2 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - args2)%expr @ - (x0, x2, x' v))%expr_pat - else - if - args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x7) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) - 0)%expr @ (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | None => - match - match idc1 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x6 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s2 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args2))%expr @ - (x0, x2, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x7) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) - 0)%expr @ (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - end - | (@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 => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - end - | None => - match - match idc0 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x1 with - | #(_)%expr_pat => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | ($_)%expr => - match x3 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x1, x' v0))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | (#(_) @ _)%expr_pat => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | (($_)%expr @ _)%expr_pat => - match x3 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x1, x' v0))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | (@expr.Abs _ _ _ _ _ _ @ _)%expr_pat => - match x3 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | (@expr.App _ _ _ s2 _ #(idc1) x6 @ x5)%expr_pat => - match - match idc1 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s2 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - args2)%expr @ - (x0, x2, x' v))%expr_pat - else - match x3 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t5 - v0 => - match - t5 as t6 - return - (base.base_interp - t6 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun v1 : Z - => - Some v1 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun _ : nat - => None - end v0 - | _ => None - end - with - | Some args3 => - match - s0 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t5 => - fun - v0 : - defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a0 - with - | Some - x'0 => - if - args =? - 2 - ^ - Z.log2 - args - then - UnderLets.Base - (# - (ident.fancy_addc - (Z.log2 - args) - (- args3))%expr @ - (x0, x1, - x'0 v0))%expr_pat - else - if - args =? - 2 - ^ - Z.log2 - args - then - UnderLets.Base - (# - (ident.fancy_addc - (Z.log2 - args) 0)%expr @ - (x0, x1, - x2))%expr_pat - else - UnderLets.Base - (# - (ident.Z_add_with_get_carry)%expr @ - x @ x0 @ - x1 @ x2)%expr_pat - | None => - UnderLets.Base - (# - (ident.Z_add_with_get_carry)%expr @ - x @ x0 @ - x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ - x1 @ x2)%expr_pat - end - (Compile.reflect - x4) - | None => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 - args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ - x2)%expr_pat - end - | _ => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x6) - | None => - match x3 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t4 v => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t4 => - fun - v : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 - args) - (- args2))%expr @ - (x0, x1, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 - args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ - x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ - x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' true - d3 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - end - | ($_)%expr => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t4 v0 => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s0 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args2))%expr @ - (x0, x1, x' v0))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) - 0)%expr @ (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args2))%expr @ - (x0, x1, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) - 0)%expr @ (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args2))%expr @ - (x0, x1, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 - => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) - 0)%expr @ (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - end - | None => - match - match idc1 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args2))%expr @ - (x0, x1, x' v))%expr_pat - else - match x5 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal - t5 v0 => - match - t5 as t6 - return - (base.base_interp - t6 -> - option Z) - with - | base.type.unit => - fun - _ : unit - => None - | base.type.Z => - fun - v1 : Z => - Some v1 - | base.type.bool => - fun - _ : bool - => None - | base.type.nat => - fun - _ : nat - => None - end v0 - | _ => None - end - with - | Some args3 => - match - s2 as t5 - return - (Compile.value' - false t5 -> - UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base - t5 => - fun - v0 : - defaults.expr - (type.base - t5) => - base.try_make_transport_cps - (fun - t6 : base.type - => - defaults.expr - (type.base - t6)) t5 - base.type.Z - (UnderLets.UnderLets - base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a0 : - option - (defaults.expr - (type.base - t5) -> - defaults.expr - (type.base - base.type.Z)) - => - match - a0 - with - | Some - x'0 => - if - args =? - 2 - ^ - Z.log2 - args - then - UnderLets.Base - (# - (ident.fancy_addc - (Z.log2 - args) - (- args3))%expr @ - (x0, x2, - x'0 v0))%expr_pat - else - if - args =? - 2 - ^ - Z.log2 - args - then - UnderLets.Base - (# - (ident.fancy_addc - (Z.log2 - args) 0)%expr @ - (x0, x1, - x2))%expr_pat - else - UnderLets.Base - (# - (ident.Z_add_with_get_carry)%expr @ - x @ x0 @ - x1 @ x2)%expr_pat - | None => - UnderLets.Base - (# - (ident.Z_add_with_get_carry)%expr @ - x @ x0 @ - x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : - Compile.value' - false s3 -> - Compile.value' - true d3 - => - UnderLets.Base - (# - (ident.Z_add_with_get_carry)%expr @ - x @ x0 @ - x1 @ x2)%expr_pat - end - (Compile.reflect - x6) - | None => - if - args =? - 2 - ^ Z.log2 - args - then - UnderLets.Base - (# - (ident.fancy_addc - (Z.log2 - args) 0)%expr @ - (x0, x1, - x2))%expr_pat - else - UnderLets.Base - (# - (ident.Z_add_with_get_carry)%expr @ - x @ x0 @ - x1 @ x2)%expr_pat - end - | _ => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 - args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ - x2)%expr_pat - end - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - match x5 with - | #(idc3)%expr_pat => - match - match idc3 with - | @ident.Literal t4 v => - match - t4 as t5 - return - (base.base_interp - t5 -> option Z) - with - | base.type.unit => - fun _ : unit => - None - | base.type.Z => - fun v0 : Z => - Some v0 - | base.type.bool => - fun _ : bool => - None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s2 as t4 - return - (Compile.value' false - t4 -> - UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t4 => - fun - v : defaults.expr - (type.base t4) - => - base.try_make_transport_cps - (fun t5 : base.type - => - defaults.expr - (type.base t5)) - t4 base.type.Z - (UnderLets.UnderLets - base.type ident - var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 - ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 - args) - (- args2))%expr @ - (x0, x2, - x' v))%expr_pat - else - if - args =? - 2 - ^ Z.log2 - args - then - UnderLets.Base - (# - (ident.fancy_addc - (Z.log2 - args) 0)%expr @ - (x0, x1, - x2))%expr_pat - else - UnderLets.Base - (# - (ident.Z_add_with_get_carry)%expr @ - x @ x0 @ - x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ - x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' - true d3 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x6) - | None => - if - args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - end - | ($_)%expr => - match x5 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t4 v0 => - match - t4 as t5 - return - (base.base_interp t5 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args2 => - match - s2 as t4 - return - (Compile.value' false t4 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t4 => - fun - v0 : defaults.expr - (type.base t4) - => - base.try_make_transport_cps - (fun t5 : base.type => - defaults.expr - (type.base t5)) t4 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base - t4) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 - args) - (- args2))%expr @ - (x0, x2, - x' v0))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 - args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ - x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ - x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' true - d3 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x5 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s2 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base - t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 - args) - (- args2))%expr @ - (x0, x2, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 - args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ - x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ - x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' - false s3 -> - Compile.value' true - d3 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - match x5 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args2 => - match - s2 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base - t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 - args) - (- args2))%expr @ - (x0, x2, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 - args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ - x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ - x2)%expr_pat - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' - false s4 -> - Compile.value' true - d4 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - end - | None => - match x3 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x1, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) - 0)%expr @ (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - end - end - | (@expr.App _ _ _ s2 _ ($_)%expr _ @ _)%expr_pat => - match x3 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x1, x' v0))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | (@expr.App _ _ _ s2 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s2 _ (_ @ _) _ @ _)%expr_pat => - match x3 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | (@expr.App _ _ _ s2 _ (@expr.LetIn _ _ _ _ _ _ _) - _ @ _)%expr_pat => - match x3 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x3 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | _ => - match x3 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - end - | None => - match x1 with - | (@expr.App _ _ _ s2 _ #(idc1) x6 @ x5)%expr_pat => - match - match idc1 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s2 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) - t3 base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - args1)%expr @ - (x0, x2, x' v))%expr_pat - else - if - args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) - 0)%expr @ (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | None => - match - match idc1 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc2)%expr_pat => - match - match idc2 with - | @ident.Literal t3 v => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s2 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - with - | type.base t3 => - fun - v : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - (base.type.Z * - base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a with - | Some x' => - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x2, x' v))%expr_pat - else - if - args =? - 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 - => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) - 0)%expr @ (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - end - | (@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 => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - end - end - | (@expr.App _ _ _ s0 _ ($_)%expr _ @ _)%expr_pat => - match x1 with - | (@expr.App _ _ _ s2 _ #(idc0) x6 @ x5)%expr_pat => - match - match idc0 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return (base.base_interp t4 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args1 => - match - s2 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t3) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) args1)%expr @ - (x0, x2, x' v0))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - | None => - match - match idc0 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return - (base.base_interp t4 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args1 => - match - s2 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t3 => - fun v0 : defaults.expr (type.base t3) - => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x2, x' v0))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - end - | (@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 => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - end - | (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat => - match x1 with - | (@expr.App _ _ _ s3 _ #(idc0) x6 @ x5)%expr_pat => - match - match idc0 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s3 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) args1)%expr @ - (x0, x2, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - | None => - match - match idc0 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s3 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> + base.type.Z)) + => + match + a + with + | Some + x' => + if + args =? + 2 + ^ + Z.log2 + args + then + UnderLets.Base + (# + (ident.fancy_add + (Z.log2 + args) + (- args1))%expr @ + (x0, + x' v))%expr_pat + else + default + | None => + default + end) + | (s1 -> d1)%ptype => + fun + _ : + Compile.value' + false s1 -> + Compile.value' + true d1 + => default + end + (Compile.reflect + x3) + | None => default + end + | _ => default + end + | None => default + end + | (@expr.App _ _ _ s0 _ + ($_)%expr _ @ _)%expr_pat | + (@expr.App _ _ _ s0 _ + (@expr.Abs _ _ _ _ _ _) _ @ + _)%expr_pat | + (@expr.App _ _ _ s0 _ + (_ @ _) _ @ _)%expr_pat | + (@expr.App _ _ _ s0 _ + (@expr.LetIn _ _ _ _ _ _ _) + _ @ _)%expr_pat => default + | (#(_) @ _)%expr_pat | + (($_)%expr @ _)%expr_pat | + (@expr.Abs _ _ _ _ _ _ @ _)%expr_pat | + (@expr.LetIn _ _ _ _ _ _ _ @ + _)%expr_pat => default + | _ => default0 tt + end in + match x0 with + | (@expr.App _ _ _ s0 _ #(idc0) x3 @ x2)%expr_pat => + match + match idc0 with + | ident.Z_shiftl => Some tt + | _ => None + end + with + | Some _ => + match x2 with + | #(idc1)%expr_pat => + match + match idc1 with + | @ident.Literal t2 v => + match + t2 as t3 + return + (base.base_interp t3 -> + option Z) + with + | base.type.unit => + fun _ : unit => None + | base.type.Z => + fun v0 : Z => Some v0 + | base.type.bool => + fun _ : bool => None + | base.type.nat => + fun _ : nat => None + end v + | _ => None + end + with + | Some args1 => + match + s0 as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + (base.type.Z * + base.type.Z)%etype))) + with + | type.base t2 => + fun + v : defaults.expr + (type.base t2) => + base.try_make_transport_cps + (fun t3 : base.type => defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x2, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - end - | (@expr.App _ _ _ s3 _ ($_)%expr _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (_ @ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - end - | (@expr.App _ _ _ s0 _ (_ @ _) _ @ _)%expr_pat => - match x1 with - | (@expr.App _ _ _ s3 _ #(idc0) x7 @ x6)%expr_pat => - match - match idc0 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x6 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s3 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) args1)%expr @ - (x0, x2, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x7) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - | None => + (type.base t3)) t2 + base.type.Z + (UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + (base.type.Z * + base.type.Z)%etype))) + (fun + a : option + (defaults.expr + (type.base t2) -> + defaults.expr + (type.base + base.type.Z)) + => + match a with + | Some x' => + if + args =? + 2 ^ Z.log2 args + then + UnderLets.Base + (#(ident.fancy_add + (Z.log2 args) + args1)%expr @ + (x1, x' v))%expr_pat + else default + | None => default + end) + | (s1 -> d1)%ptype => + fun + _ : Compile.value' false + s1 -> + Compile.value' true d1 + => default + end (Compile.reflect x3) + | None => default + end + | _ => default + end + | None => default + end + | (@expr.App _ _ _ s0 _ ($_)%expr _ @ _)%expr_pat | + (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) + _ @ _)%expr_pat | + (@expr.App _ _ _ s0 _ (_ @ _) _ @ _)%expr_pat | + (@expr.App _ _ _ s0 _ + (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => + default + | (#(_) @ _)%expr_pat | + (($_)%expr @ _)%expr_pat | + (@expr.Abs _ _ _ _ _ _ @ _)%expr_pat | + (@expr.LetIn _ _ _ _ _ _ _ @ _)%expr_pat => + default + | _ => default0 tt + end in + match x1 with + | (@expr.App _ _ _ s0 _ #(idc0) x3 @ x2)%expr_pat => + match + match idc0 with + | ident.Z_shiftl => Some tt + | _ => None + end + with + | Some _ => + match x2 with + | #(idc1)%expr_pat => match - match idc0 with - | ident.Z_shiftr => Some tt + match idc1 with + | @ident.Literal t2 v => + match + t2 as t3 + return (base.base_interp t3 -> option Z) + with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v | _ => None end with - | Some _ => - match x6 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s3 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x2, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s4 -> d4)%ptype => - fun - _ : Compile.value' false s4 -> - Compile.value' true d4 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x7) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - end - | (@expr.App _ _ _ s3 _ ($_)%expr _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (_ @ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s3 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - end - | (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => - match x1 with - | (@expr.App _ _ _ s2 _ #(idc0) x7 @ x6)%expr_pat => - match - match idc0 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x6 with - | #(idc1)%expr_pat => + | Some args1 => match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end + s0 as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets base.type ident var + (defaults.expr + (type.base + (base.type.Z * base.type.Z)%etype))) with - | Some args1 => - match - s2 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) args1)%expr @ - (x0, x2, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x7) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - | None => - match - match idc0 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x6 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s2 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x2, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s3 -> d3)%ptype => - fun - _ : Compile.value' false s3 -> - Compile.value' true d3 => + | type.base t2 => + fun v : defaults.expr (type.base t2) => + base.try_make_transport_cps + (fun t3 : base.type => + defaults.expr (type.base t3)) t2 + base.type.Z + (UnderLets.UnderLets base.type ident var + (defaults.expr + (type.base + (base.type.Z * base.type.Z)%etype))) + (fun + a : option + (defaults.expr (type.base t2) -> + defaults.expr + (type.base base.type.Z)) => + match a with + | Some x' => + if args =? 2 ^ Z.log2 args + then UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x7) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat + (#(ident.fancy_add (Z.log2 args) + args1)%expr @ (x0, x' v))%expr_pat + else default + | None => default + end) + | (s1 -> d1)%ptype => + fun + _ : Compile.value' false s1 -> + Compile.value' true d1 => default + end (Compile.reflect x3) + | None => default end + | _ => default end - | (@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 => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | None => default end - | (@expr.LetIn _ _ _ _ _ _ _ @ _)%expr_pat => - match x1 with - | (@expr.App _ _ _ s1 _ #(idc0) x6 @ x5)%expr_pat => - match - match idc0 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x5 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s1 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) args1)%expr @ - (x0, x2, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - | None => + | (@expr.App _ _ _ s0 _ ($_)%expr _ @ _)%expr_pat | + (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | + (@expr.App _ _ _ s0 _ (_ @ _) _ @ _)%expr_pat | + (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => + default + | (#(_) @ _)%expr_pat | (($_)%expr @ _)%expr_pat | + (@expr.Abs _ _ _ _ _ _ @ _)%expr_pat | + (@expr.LetIn _ _ _ _ _ _ _ @ _)%expr_pat => default + | _ => default0 tt + end + | None => default + end + | _ => default + end +| ident.Z_add_with_carry => + fun x x0 x1 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_add_with_carry)%expr @ x @ x0 @ x1)%expr_pat in + default +| ident.Z_add_with_get_carry => + fun x x0 x1 x2 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat in + match x with + | #(idc)%expr_pat => + match + match idc with + | @ident.Literal t0 v => + match t0 as t1 return (base.base_interp t1 -> option Z) with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v + | _ => None + end + with + | Some args => + llet default0 := fun 'tt => + llet default0 := fun 'tt => + llet default0 := fun 'tt => + llet default0 := + fun 'tt => + if + args =? + 2 + ^ Z.log2 args + then + UnderLets.Base + (#(ident.fancy_addc + (Z.log2 + args) 0)%expr @ + (x0, x1, + x2))%expr_pat + else default in + match x1 with + | (@expr.App _ + _ _ s0 _ + #(idc0) + x4 @ x3)%expr_pat => + match + match + idc0 + with + | ident.Z_shiftr => + Some tt + | _ => + None + end + with + | Some + _ => + match + x3 + with + | # + (idc1)%expr_pat => + match + match + idc1 + with + | @ident.Literal + t2 v => + match + t2 as t3 + return + (base.base_interp + t3 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => + None + end + with + | Some + args1 => + match + s0 as t2 + return + (Compile.value' + false t2 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + (base.type.Z * + base.type.Z)%etype))) + with + | type.base + t2 => + fun + v : + defaults.expr + (type.base + t2) => + base.try_make_transport_cps + (fun + t3 : base.type + => + defaults.expr + (type.base + t3)) t2 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + (base.type.Z * + base.type.Z)%etype))) + (fun + a : + option + (defaults.expr + (type.base + t2) -> + defaults.expr + (type.base + base.type.Z)) + => + match + a + with + | Some + x' => + if + args =? + 2 + ^ + Z.log2 + args + then + UnderLets.Base + (# + (ident.fancy_addc + (Z.log2 + args) + (- args1))%expr @ + (x0, x2, + x' v))%expr_pat + else + default + | None => + default + end) + | (s1 -> + d1)%ptype => + fun + _ : + Compile.value' + false s1 -> + Compile.value' + true d1 + => + default + end + (Compile.reflect + x4) + | None => + default + end + | _ => + default + end + | None => + default + end + | (@expr.App _ + _ _ s0 _ + ($_)%expr + _ @ _)%expr_pat | + (@expr.App _ + _ _ s0 _ + (@expr.Abs + _ _ _ _ _ + _) _ @ _)%expr_pat | + (@expr.App _ + _ _ s0 _ + (_ @ _) _ @ + _)%expr_pat | + (@expr.App _ + _ _ s0 _ + (@expr.LetIn + _ _ _ _ _ + _ _) _ @ _)%expr_pat => + default + | (#(_) @ _)%expr_pat | + (($_)%expr @ + _)%expr_pat | + (@expr.Abs _ + _ _ _ _ _ @ + _)%expr_pat | + (@expr.LetIn + _ _ _ _ _ _ + _ @ _)%expr_pat => + default + | _ => + default0 + tt + end in + match x2 with + | (@expr.App _ _ _ s0 _ # + (idc0) x4 @ x3)%expr_pat => + match + match idc0 with + | ident.Z_shiftr => + Some tt + | _ => None + end + with + | Some _ => + match x3 with + | #(idc1)%expr_pat => + match + match idc1 with + | @ident.Literal + t2 v => + match + t2 as t3 + return + (base.base_interp + t3 -> + option Z) + with + | base.type.unit => + fun + _ : unit + => None + | base.type.Z => + fun + v0 : Z => + Some v0 + | base.type.bool => + fun + _ : bool + => None + | base.type.nat => + fun + _ : nat + => None + end v + | _ => None + end + with + | Some args1 => + match + s0 as t2 + return + (Compile.value' + false t2 -> + UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + (base.type.Z * + base.type.Z)%etype))) + with + | type.base + t2 => + fun + v : + defaults.expr + (type.base + t2) => + base.try_make_transport_cps + (fun + t3 : base.type + => + defaults.expr + (type.base + t3)) t2 + base.type.Z + (UnderLets.UnderLets + base.type + ident var + (defaults.expr + (type.base + (base.type.Z * + base.type.Z)%etype))) + (fun + a : + option + (defaults.expr + (type.base + t2) -> + defaults.expr + (type.base + base.type.Z)) + => + match + a + with + | Some + x' => + if + args =? + 2 + ^ + Z.log2 + args + then + UnderLets.Base + (# + (ident.fancy_addc + (Z.log2 + args) + (- args1))%expr @ + (x0, x1, + x' v))%expr_pat + else + default + | None => + default + end) + | (s1 -> d1)%ptype => + fun + _ : + Compile.value' + false s1 -> + Compile.value' + true d1 + => default + end + (Compile.reflect + x4) + | None => default + end + | _ => default + end + | None => default + end + | (@expr.App _ _ _ s0 _ + ($_)%expr _ @ _)%expr_pat | + (@expr.App _ _ _ s0 _ + (@expr.Abs _ _ _ _ _ _) _ @ + _)%expr_pat | + (@expr.App _ _ _ s0 _ + (_ @ _) _ @ _)%expr_pat | + (@expr.App _ _ _ s0 _ + (@expr.LetIn _ _ _ _ _ _ _) + _ @ _)%expr_pat => default + | (#(_) @ _)%expr_pat | + (($_)%expr @ _)%expr_pat | + (@expr.Abs _ _ _ _ _ _ @ _)%expr_pat | + (@expr.LetIn _ _ _ _ _ _ _ @ + _)%expr_pat => default + | _ => default0 tt + end in + match x1 with + | (@expr.App _ _ _ s0 _ #(idc0) x4 @ x3)%expr_pat => + match + match idc0 with + | ident.Z_shiftl => Some tt + | _ => None + end + with + | Some _ => + match x3 with + | #(idc1)%expr_pat => + match + match idc1 with + | @ident.Literal t2 v => + match + t2 as t3 + return + (base.base_interp t3 -> + option Z) + with + | base.type.unit => + fun _ : unit => None + | base.type.Z => + fun v0 : Z => Some v0 + | base.type.bool => + fun _ : bool => None + | base.type.nat => + fun _ : nat => None + end v + | _ => None + end + with + | Some args1 => + match + s0 as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + (base.type.Z * + base.type.Z)%etype))) + with + | type.base t2 => + fun + v : defaults.expr + (type.base t2) => + base.try_make_transport_cps + (fun t3 : base.type => + defaults.expr + (type.base t3)) t2 + base.type.Z + (UnderLets.UnderLets + base.type ident var + (defaults.expr + (type.base + (base.type.Z * + base.type.Z)%etype))) + (fun + a : option + (defaults.expr + (type.base t2) -> + defaults.expr + (type.base + base.type.Z)) + => + match a with + | Some x' => + if + args =? + 2 ^ Z.log2 args + then + UnderLets.Base + (#(ident.fancy_addc + (Z.log2 args) + args1)%expr @ + (x0, x2, x' v))%expr_pat + else default + | None => default + end) + | (s1 -> d1)%ptype => + fun + _ : Compile.value' false + s1 -> + Compile.value' true d1 + => default + end (Compile.reflect x4) + | None => default + end + | _ => default + end + | None => default + end + | (@expr.App _ _ _ s0 _ ($_)%expr _ @ _)%expr_pat | + (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) + _ @ _)%expr_pat | + (@expr.App _ _ _ s0 _ (_ @ _) _ @ _)%expr_pat | + (@expr.App _ _ _ s0 _ + (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => + default + | (#(_) @ _)%expr_pat | + (($_)%expr @ _)%expr_pat | + (@expr.Abs _ _ _ _ _ _ @ _)%expr_pat | + (@expr.LetIn _ _ _ _ _ _ _ @ _)%expr_pat => + default + | _ => default0 tt + end in + match x2 with + | (@expr.App _ _ _ s0 _ #(idc0) x4 @ x3)%expr_pat => + match + match idc0 with + | ident.Z_shiftl => Some tt + | _ => None + end + with + | Some _ => + match x3 with + | #(idc1)%expr_pat => match - match idc0 with - | ident.Z_shiftr => Some tt + match idc1 with + | @ident.Literal t2 v => + match + t2 as t3 + return (base.base_interp t3 -> option Z) + with + | base.type.unit => fun _ : unit => None + | base.type.Z => fun v0 : Z => Some v0 + | base.type.bool => fun _ : bool => None + | base.type.nat => fun _ : nat => None + end v | _ => None end with - | Some _ => - match x5 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s1 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x2, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x6) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - end - | (@expr.App _ _ _ s1 _ ($_)%expr _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (_ @ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s1 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x1 with - | (@expr.App _ _ _ s0 _ #(idc0) x5 @ x4)%expr_pat => - match - match idc0 with - | ident.Z_shiftl => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc1)%expr_pat => + | Some args1 => match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end + s0 as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets base.type ident var + (defaults.expr + (type.base + (base.type.Z * base.type.Z)%etype))) with - | Some args1 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) args1)%expr @ - (x0, x2, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat - end - | None => - match - match idc0 with - | ident.Z_shiftr => Some tt - | _ => None - end - with - | Some _ => - match x4 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return - (base.base_interp t3 -> option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => - fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args1 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) - => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type - ident var - (defaults.expr - (type.base - (base.type.Z * base.type.Z)%etype))) - (fun - a : option - (defaults.expr - (type.base t2) -> - defaults.expr - (type.base base.type.Z)) - => - match a with - | Some x' => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) - (- args1))%expr @ - (x0, x2, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => + | type.base t2 => + fun v : defaults.expr (type.base t2) => + base.try_make_transport_cps + (fun t3 : base.type => + defaults.expr (type.base t3)) t2 + base.type.Z + (UnderLets.UnderLets base.type ident var + (defaults.expr + (type.base + (base.type.Z * base.type.Z)%etype))) + (fun + a : option + (defaults.expr (type.base t2) -> + defaults.expr + (type.base base.type.Z)) => + match a with + | Some x' => + if args =? 2 ^ Z.log2 args + then UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end (Compile.reflect x5) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat - end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat + (#(ident.fancy_addc (Z.log2 args) + args1)%expr @ (x0, x1, x' v))%expr_pat + else default + | None => default + end) + | (s1 -> d1)%ptype => + fun + _ : Compile.value' false s1 -> + Compile.value' true d1 => default + end (Compile.reflect x4) + | None => default end + | _ => default end - | (@expr.App _ _ _ s0 _ ($_)%expr _ @ _)%expr_pat | - (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s0 _ (_ @ _) _ @ _)%expr_pat | - (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_addc (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | None => default end + | (@expr.App _ _ _ s0 _ ($_)%expr _ @ _)%expr_pat | + (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | + (@expr.App _ _ _ s0 _ (_ @ _) _ @ _)%expr_pat | + (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => + default + | (#(_) @ _)%expr_pat | (($_)%expr @ _)%expr_pat | + (@expr.Abs _ _ _ _ _ _ @ _)%expr_pat | + (@expr.LetIn _ _ _ _ _ _ _ @ _)%expr_pat => default + | _ => default0 tt end - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | _ => default end | ident.Z_sub_get_borrow => fun x x0 x1 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat in match x with | #(idc)%expr_pat => match @@ -33727,6 +5201,13 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args => + llet default0 := fun 'tt => + if args =? 2 ^ Z.log2 args + then + UnderLets.Base + (#(ident.fancy_sub (Z.log2 args) 0)%expr @ + (x0, x1))%expr_pat + else default in match x1 with | (@expr.App _ _ _ s0 _ #(idc0) x3 @ x2)%expr_pat => match @@ -33785,48 +5266,17 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.Base (#(ident.fancy_sub (Z.log2 args) args1)%expr @ (x0, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_sub (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_sub_get_borrow)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_sub_get_borrow)%expr @ x @ - x0 @ x1)%expr_pat + else default + | None => default end) | (s1 -> d1)%ptype => fun _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ - x1)%expr_pat + Compile.value' true d1 => default end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_sub (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat + | None => default end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_sub (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat + | _ => default end | None => match @@ -33887,92 +5337,39 @@ match idc in (ident t) return (Compile.value' true t) with (#(ident.fancy_sub (Z.log2 args) (- args1))%expr @ (x0, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_sub - (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_sub_get_borrow)%expr @ - x @ x0 @ x1)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_sub_get_borrow)%expr @ - x @ x0 @ x1)%expr_pat + else default + | None => default end) | (s1 -> d1)%ptype => fun _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_sub_get_borrow)%expr @ x @ - x0 @ x1)%expr_pat + Compile.value' true d1 => default end (Compile.reflect x3) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_sub (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ - x1)%expr_pat + | None => default end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_sub (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat + | _ => default end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_sub (Z.log2 args) 0)%expr @ - (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat + | None => default end end | (@expr.App _ _ _ s0 _ ($_)%expr _ @ _)%expr_pat | (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | (@expr.App _ _ _ s0 _ (_ @ _) _ @ _)%expr_pat | (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_sub (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_sub (Z.log2 args) 0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat + default + | (#(_) @ _)%expr_pat | (($_)%expr @ _)%expr_pat | + (@expr.Abs _ _ _ _ _ _ @ _)%expr_pat | + (@expr.LetIn _ _ _ _ _ _ _ @ _)%expr_pat => default + | _ => default0 tt end - | None => - UnderLets.Base - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat + | _ => default end | ident.Z_sub_with_get_borrow => fun x x0 x1 x2 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_sub_with_get_borrow)%expr @ x @ x0 @ x1 @ x2)%expr_pat in match x with | #(idc)%expr_pat => match @@ -33988,6 +5385,13 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args => + llet default0 := fun 'tt => + if args =? 2 ^ Z.log2 args + then + UnderLets.Base + (#(ident.fancy_subb (Z.log2 args) 0)%expr @ + (x0, x1, x2))%expr_pat + else default in match x2 with | (@expr.App _ _ _ s0 _ #(idc0) x4 @ x3)%expr_pat => match @@ -34046,50 +5450,17 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.Base (#(ident.fancy_subb (Z.log2 args) args1)%expr @ (x0, x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_subb (Z.log2 args) - 0)%expr @ (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x0 @ x1 @ x2)%expr_pat + else default + | None => default end) | (s1 -> d1)%ptype => fun _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ x @ - x0 @ x1 @ x2)%expr_pat + Compile.value' true d1 => default end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_subb (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ x @ x0 @ - x1 @ x2)%expr_pat + | None => default end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_subb (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ x @ x0 @ x1 @ - x2)%expr_pat + | _ => default end | None => match @@ -34150,94 +5521,42 @@ match idc in (ident t) return (Compile.value' true t) with (#(ident.fancy_subb (Z.log2 args) (- args1))%expr @ (x0, x1, x' v))%expr_pat - else - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_subb - (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x0 @ x1 @ x2)%expr_pat + else default + | None => default end) | (s1 -> d1)%ptype => fun _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x0 @ x1 @ x2)%expr_pat + Compile.value' true d1 => default end (Compile.reflect x4) - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_subb (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ x @ - x0 @ x1 @ x2)%expr_pat + | None => default end - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_subb (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ x @ x0 @ - x1 @ x2)%expr_pat + | _ => default end - | None => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_subb (Z.log2 args) 0)%expr @ - (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ x @ x0 @ x1 @ - x2)%expr_pat + | None => default end end | (@expr.App _ _ _ s0 _ ($_)%expr _ @ _)%expr_pat | (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | (@expr.App _ _ _ s0 _ (_ @ _) _ @ _)%expr_pat | (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_subb (Z.log2 args) 0)%expr @ (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ x @ x0 @ x1 @ x2)%expr_pat - | _ => - if args =? 2 ^ Z.log2 args - then - UnderLets.Base - (#(ident.fancy_subb (Z.log2 args) 0)%expr @ (x0, x1, x2))%expr_pat - else - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ x @ x0 @ x1 @ x2)%expr_pat + default + | (#(_) @ _)%expr_pat | (($_)%expr @ _)%expr_pat | + (@expr.Abs _ _ _ _ _ _ @ _)%expr_pat | + (@expr.LetIn _ _ _ _ _ _ _ @ _)%expr_pat => default + | _ => default0 tt end - | None => - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | _ => default end | ident.Z_zselect => fun x x0 x1 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_zselect)%expr @ x @ x0 @ x1)%expr_pat in + llet default0 := fun 'tt => + UnderLets.Base + (#(ident.fancy_selc)%expr @ (x, x0, x1))%expr_pat in match x with | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ #(idc)%expr_pat x3) x2 => match match idc with @@ -34287,27 +5606,17 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.Base (#(ident.fancy_selm (Z.log2 args0))%expr @ (x' v, x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.fancy_selc)%expr @ (x, x0, x1))%expr_pat - | None => - UnderLets.Base - (#(ident.Z_zselect)%expr @ x @ x0 @ x1)%expr_pat + else default + | None => default end) | (s1 -> d1)%ptype => fun _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_zselect)%expr @ x @ x0 @ x1)%expr_pat + Compile.value' true d1 => default end (Compile.reflect x2) - | None => - UnderLets.Base - (#(ident.fancy_selc)%expr @ (x, x0, x1))%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_selc)%expr @ (x, x0, x1))%expr_pat + | _ => default end | None => match @@ -34317,6 +5626,80 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some _ => + llet default1 := fun 'tt => + match x2 with + | #(idc0)%expr_pat => + match + match idc0 with + | @ident.Literal t1 v => + match + t1 as t2 + return + (base.base_interp t2 -> + option Z) + with + | base.type.unit => + fun _ : unit => None + | base.type.Z => + fun v0 : Z => Some v0 + | base.type.bool => + fun _ : bool => None + | base.type.nat => + fun _ : nat => None + end v + | _ => None + end + with + | Some args0 => + match + s0 as t2 + return + (Compile.value' false t2 -> + UnderLets.UnderLets base.type + ident var + (defaults.expr + (type.base base.type.Z))) + with + | type.base t2 => + fun + v : defaults.expr + (type.base t2) => + base.try_make_transport_cps + (fun t1 : base.type => + defaults.expr (type.base t1)) + t2 base.type.Z + (UnderLets.UnderLets base.type + ident var + (defaults.expr + (type.base base.type.Z))) + (fun + a : option + (defaults.expr + (type.base t2) -> + defaults.expr + (type.base + base.type.Z)) + => + match a with + | Some x' => + if args0 =? 1 + then + UnderLets.Base + (#(ident.fancy_sell)%expr @ + (x' v, x0, x1))%expr_pat + else default + | None => default + end) + | (s1 -> d1)%ptype => + fun + _ : Compile.value' false s1 -> + Compile.value' true d1 => + default + end (Compile.reflect x3) + | None => default + end + | _ => default + end in match x3 with | #(idc0)%expr_pat => match @@ -34360,413 +5743,39 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.Base (#(ident.fancy_sell)%expr @ (x' v, x0, x1))%expr_pat - else - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t3 v0 => - match - t3 as t4 - return - (base.base_interp t4 -> - option Z) - with - | base.type.unit => - fun _ : unit => None - | base.type.Z => - fun v1 : Z => Some v1 - | base.type.bool => - fun _ : bool => None - | base.type.nat => - fun _ : nat => None - end v0 - | _ => None - end - with - | Some args1 => - match - s0 as t3 - return - (Compile.value' false t3 -> - UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base base.type.Z))) - with - | type.base t3 => - fun - v0 : defaults.expr - (type.base t3) => - base.try_make_transport_cps - (fun t4 : base.type => - defaults.expr - (type.base t4)) t3 - base.type.Z - (UnderLets.UnderLets - base.type ident var - (defaults.expr - (type.base - base.type.Z))) - (fun - a0 : option - (defaults.expr - (type.base t3) -> - defaults.expr - (type.base - base.type.Z)) - => - match a0 with - | Some x'0 => - if args1 =? 1 - then - UnderLets.Base - (#(ident.fancy_sell)%expr @ - (x'0 v0, x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.fancy_selc)%expr @ - (x, x0, x1))%expr_pat - | None => - UnderLets.Base - (#(ident.Z_zselect)%expr @ - x @ x0 @ x1)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 - => - UnderLets.Base - (#(ident.Z_zselect)%expr @ - x @ x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.Base - (#(ident.fancy_selc)%expr @ - (x, x0, x1))%expr_pat - end - | _ => - UnderLets.Base - (#(ident.fancy_selc)%expr @ - (x, x0, x1))%expr_pat - end - | None => - UnderLets.Base - (#(ident.Z_zselect)%expr @ x @ x0 @ x1)%expr_pat + else default + | None => default end) | (s1 -> d1)%ptype => fun _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_zselect)%expr @ x @ x0 @ x1)%expr_pat + Compile.value' true d1 => default end (Compile.reflect x2) - | None => - match x2 with - | #(idc1)%expr_pat => - match - match idc1 with - | @ident.Literal t2 v => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident - var - (defaults.expr - (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args0 =? 1 - then - UnderLets.Base - (#(ident.fancy_sell)%expr @ - (x' v, x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.fancy_selc)%expr @ - (x, x0, x1))%expr_pat - | None => - UnderLets.Base - (#(ident.Z_zselect)%expr @ x @ - x0 @ x1)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_zselect)%expr @ x @ x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.Base - (#(ident.fancy_selc)%expr @ (x, x0, x1))%expr_pat - end - | _ => - UnderLets.Base - (#(ident.fancy_selc)%expr @ (x, x0, x1))%expr_pat - end - end - | ($_)%expr => - match x2 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t2 v0 => - match - t2 as t3 - return (base.base_interp t3 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v1 : Z => Some v1 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v0 - | _ => None - end - with - | Some args0 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v0 : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t3 : base.type => - defaults.expr (type.base t3)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args0 =? 1 - then - UnderLets.Base - (#(ident.fancy_sell)%expr @ - (x' v0, x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.fancy_selc)%expr @ - (x, x0, x1))%expr_pat - | None => - UnderLets.Base - (#(ident.Z_zselect)%expr @ x @ x0 @ - x1)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_zselect)%expr @ x @ x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.Base - (#(ident.fancy_selc)%expr @ (x, x0, x1))%expr_pat - end - | _ => - UnderLets.Base - (#(ident.fancy_selc)%expr @ (x, x0, x1))%expr_pat - end - | @expr.LetIn _ _ _ _ _ _ _ => - match x2 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 - return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args0 =? 1 - then - UnderLets.Base - (#(ident.fancy_sell)%expr @ - (x' v, x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.fancy_selc)%expr @ - (x, x0, x1))%expr_pat - | None => - UnderLets.Base - (#(ident.Z_zselect)%expr @ x @ x0 @ - x1)%expr_pat - end) - | (s1 -> d1)%ptype => - fun - _ : Compile.value' false s1 -> - Compile.value' true d1 => - UnderLets.Base - (#(ident.Z_zselect)%expr @ x @ x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.Base - (#(ident.fancy_selc)%expr @ (x, x0, x1))%expr_pat - end - | _ => - UnderLets.Base - (#(ident.fancy_selc)%expr @ (x, x0, x1))%expr_pat - end - | _ => - match x2 with - | #(idc0)%expr_pat => - match - match idc0 with - | @ident.Literal t1 v => - match - t1 as t2 - return (base.base_interp t2 -> option Z) - with - | base.type.unit => fun _ : unit => None - | base.type.Z => fun v0 : Z => Some v0 - | base.type.bool => fun _ : bool => None - | base.type.nat => fun _ : nat => None - end v - | _ => None - end - with - | Some args0 => - match - s0 as t2 - return - (Compile.value' false t2 -> - UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - with - | type.base t2 => - fun v : defaults.expr (type.base t2) => - base.try_make_transport_cps - (fun t1 : base.type => - defaults.expr (type.base t1)) t2 - base.type.Z - (UnderLets.UnderLets base.type ident var - (defaults.expr (type.base base.type.Z))) - (fun - a : option - (defaults.expr (type.base t2) -> - defaults.expr - (type.base base.type.Z)) => - match a with - | Some x' => - if args0 =? 1 - then - UnderLets.Base - (#(ident.fancy_sell)%expr @ - (x' v, x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.fancy_selc)%expr @ - (x, x0, x1))%expr_pat - | None => - UnderLets.Base - (#(ident.Z_zselect)%expr @ x @ x0 @ - x1)%expr_pat - end) - | (s2 -> d2)%ptype => - fun - _ : Compile.value' false s2 -> - Compile.value' true d2 => - UnderLets.Base - (#(ident.Z_zselect)%expr @ x @ x0 @ x1)%expr_pat - end (Compile.reflect x3) - | None => - UnderLets.Base - (#(ident.fancy_selc)%expr @ (x, x0, x1))%expr_pat - end - | _ => - UnderLets.Base - (#(ident.fancy_selc)%expr @ (x, x0, x1))%expr_pat + | None => default1 tt end + | _ => default1 tt end - | None => - UnderLets.Base - (#(ident.fancy_selc)%expr @ (x, x0, x1))%expr_pat + | None => default end 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 _ _ _ _ _ _ _) _) _ => - UnderLets.Base (#(ident.fancy_selc)%expr @ (x, x0, x1))%expr_pat + s _ (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _) _ => default | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (#(ident.fancy_selc)%expr @ (x, x0, x1))%expr_pat - | _ => UnderLets.Base (#(ident.fancy_selc)%expr @ (x, x0, x1))%expr_pat + (@expr.LetIn _ _ _ _ _ _ _) _ => default + | _ => default0 tt end | ident.Z_add_modulo => fun x x0 x1 : defaults.expr (type.base base.type.Z) => + llet _ := UnderLets.Base + (#(ident.Z_add_modulo)%expr @ x @ x0 @ x1)%expr_pat in UnderLets.Base (#(ident.fancy_addm)%expr @ (x, x0, x1))%expr_pat | ident.Z_rshi => fun x x0 x1 x2 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_rshi)%expr @ x @ x0 @ x1 @ x2)%expr_pat in match x with | #(idc)%expr_pat => match @@ -34804,81 +5813,100 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.Base (#(ident.fancy_rshi (Z.log2 args) args0)%expr @ (x0, x1))%expr_pat - else - UnderLets.Base - (#(ident.Z_rshi)%expr @ x @ x0 @ x1 @ x2)%expr_pat - | None => - UnderLets.Base - (#(ident.Z_rshi)%expr @ x @ x0 @ x1 @ x2)%expr_pat + else default + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_rshi)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | _ => default end - | None => - UnderLets.Base (#(ident.Z_rshi)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_rshi)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | _ => default end | ident.Z_cc_m => fun x x0 : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_cc_m)%expr @ x @ x0)%expr_pat + llet default := UnderLets.Base (#(ident.Z_cc_m)%expr @ x @ x0)%expr_pat in + default | ident.Z_cast range => fun x : defaults.expr (type.base base.type.Z) => - UnderLets.Base (#(ident.Z_cast range)%expr @ x)%expr_pat + llet default := UnderLets.Base (#(ident.Z_cast range)%expr @ x)%expr_pat in + default | ident.Z_cast2 range => fun x : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.Z_cast2 range)%expr @ x)%expr_pat + llet default := UnderLets.Base (#(ident.Z_cast2 range)%expr @ x)%expr_pat in + default | ident.fancy_add log2wordmax imm => fun x : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_add log2wordmax imm)%expr @ x)%expr_pat + llet default := UnderLets.Base + (#(ident.fancy_add log2wordmax imm)%expr @ x)%expr_pat in + default | ident.fancy_addc log2wordmax imm => fun x : defaults.expr (type.base (base.type.Z * base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_addc log2wordmax imm)%expr @ x)%expr_pat + llet default := UnderLets.Base + (#(ident.fancy_addc log2wordmax imm)%expr @ x)%expr_pat in + default | ident.fancy_sub log2wordmax imm => fun x : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_sub log2wordmax imm)%expr @ x)%expr_pat + llet default := UnderLets.Base + (#(ident.fancy_sub log2wordmax imm)%expr @ x)%expr_pat in + default | ident.fancy_subb log2wordmax imm => fun x : defaults.expr (type.base (base.type.Z * base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_subb log2wordmax imm)%expr @ x)%expr_pat + llet default := UnderLets.Base + (#(ident.fancy_subb log2wordmax imm)%expr @ x)%expr_pat in + default | ident.fancy_mulll log2wordmax => fun x : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_mulll log2wordmax)%expr @ x)%expr_pat + llet default := UnderLets.Base + (#(ident.fancy_mulll log2wordmax)%expr @ x)%expr_pat in + default | ident.fancy_mullh log2wordmax => fun x : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_mullh log2wordmax)%expr @ x)%expr_pat + llet default := UnderLets.Base + (#(ident.fancy_mullh log2wordmax)%expr @ x)%expr_pat in + default | ident.fancy_mulhl log2wordmax => fun x : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_mulhl log2wordmax)%expr @ x)%expr_pat + llet default := UnderLets.Base + (#(ident.fancy_mulhl log2wordmax)%expr @ x)%expr_pat in + default | ident.fancy_mulhh log2wordmax => fun x : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_mulhh log2wordmax)%expr @ x)%expr_pat + llet default := UnderLets.Base + (#(ident.fancy_mulhh log2wordmax)%expr @ x)%expr_pat in + default | ident.fancy_rshi log2wordmax x => fun x0 : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_rshi log2wordmax x)%expr @ x0)%expr_pat + llet default := UnderLets.Base + (#(ident.fancy_rshi log2wordmax x)%expr @ x0)%expr_pat in + default | ident.fancy_selc => fun x : defaults.expr (type.base (base.type.Z * base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_selc)%expr @ x)%expr_pat + llet default := UnderLets.Base (#(ident.fancy_selc)%expr @ x)%expr_pat in + default | ident.fancy_selm log2wordmax => fun x : defaults.expr (type.base (base.type.Z * base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_selm log2wordmax)%expr @ x)%expr_pat + llet default := UnderLets.Base + (#(ident.fancy_selm log2wordmax)%expr @ x)%expr_pat in + default | ident.fancy_sell => fun x : defaults.expr (type.base (base.type.Z * base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_sell)%expr @ x)%expr_pat + llet default := UnderLets.Base (#(ident.fancy_sell)%expr @ x)%expr_pat in + default | ident.fancy_addm => fun x : defaults.expr (type.base (base.type.Z * base.type.Z * base.type.Z)%etype) => - UnderLets.Base (#(ident.fancy_addm)%expr @ x)%expr_pat + llet default := UnderLets.Base (#(ident.fancy_addm)%expr @ x)%expr_pat in + default end : Compile.value' true t diff --git a/src/Experiments/NewPipeline/nbe_rewrite_head.out b/src/Experiments/NewPipeline/nbe_rewrite_head.out index 82d4983bd..f64ef126e 100644 --- a/src/Experiments/NewPipeline/nbe_rewrite_head.out +++ b/src/Experiments/NewPipeline/nbe_rewrite_head.out @@ -8,13 +8,26 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.UnderLets base.type ident var (defaults.expr (type.base t0))) with - | base.type.unit => fun v0 : unit => UnderLets.Base ##(v0)%expr - | base.type.Z => fun v0 : Z => UnderLets.Base ##(v0)%expr - | base.type.bool => fun v0 : bool => UnderLets.Base ##(v0)%expr - | base.type.nat => fun v0 : nat => UnderLets.Base ##(v0)%expr + | base.type.unit => + fun v0 : unit => + llet _ := UnderLets.Base ##(v0)%expr in + UnderLets.Base ##(v0)%expr + | base.type.Z => + fun v0 : Z => + llet _ := UnderLets.Base ##(v0)%expr in + UnderLets.Base ##(v0)%expr + | base.type.bool => + fun v0 : bool => + llet _ := UnderLets.Base ##(v0)%expr in + UnderLets.Base ##(v0)%expr + | base.type.nat => + fun v0 : nat => + llet _ := UnderLets.Base ##(v0)%expr in + UnderLets.Base ##(v0)%expr end v | ident.Nat_succ => fun x : defaults.expr (type.base base.type.nat) => + llet default := UnderLets.Base (#(ident.Nat_succ)%expr @ x)%expr_pat in match x with | #(idc)%expr_pat => match @@ -30,12 +43,13 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args => UnderLets.Base ##(Nat.succ args)%expr - | None => UnderLets.Base (#(ident.Nat_succ)%expr @ x)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Nat_succ)%expr @ x)%expr_pat + | _ => default end | ident.Nat_pred => fun x : defaults.expr (type.base base.type.nat) => + llet default := UnderLets.Base (#(ident.Nat_pred)%expr @ x)%expr_pat in match x with | #(idc)%expr_pat => match @@ -51,12 +65,13 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args => UnderLets.Base ##(Nat.pred args)%expr - | None => UnderLets.Base (#(ident.Nat_pred)%expr @ x)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Nat_pred)%expr @ x)%expr_pat + | _ => default end | ident.Nat_max => fun x x0 : defaults.expr (type.base base.type.nat) => + llet default := UnderLets.Base (#(ident.Nat_max)%expr @ x @ x0)%expr_pat in match x with | #(idc)%expr_pat => match @@ -89,17 +104,17 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args0 => UnderLets.Base ##(Nat.max args args0)%expr - | None => - UnderLets.Base (#(ident.Nat_max)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Nat_max)%expr @ x @ x0)%expr_pat + | _ => default end - | None => UnderLets.Base (#(ident.Nat_max)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Nat_max)%expr @ x @ x0)%expr_pat + | _ => default end | ident.Nat_mul => fun x x0 : defaults.expr (type.base base.type.nat) => + llet default := UnderLets.Base (#(ident.Nat_mul)%expr @ x @ x0)%expr_pat in match x with | #(idc)%expr_pat => match @@ -132,17 +147,17 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args0 => UnderLets.Base ##((args * args0)%nat)%expr - | None => - UnderLets.Base (#(ident.Nat_mul)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Nat_mul)%expr @ x @ x0)%expr_pat + | _ => default end - | None => UnderLets.Base (#(ident.Nat_mul)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Nat_mul)%expr @ x @ x0)%expr_pat + | _ => default end | ident.Nat_add => fun x x0 : defaults.expr (type.base base.type.nat) => + llet default := UnderLets.Base (#(ident.Nat_add)%expr @ x @ x0)%expr_pat in match x with | #(idc)%expr_pat => match @@ -175,17 +190,17 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args0 => UnderLets.Base ##((args + args0)%nat)%expr - | None => - UnderLets.Base (#(ident.Nat_add)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Nat_add)%expr @ x @ x0)%expr_pat + | _ => default end - | None => UnderLets.Base (#(ident.Nat_add)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Nat_add)%expr @ x @ x0)%expr_pat + | _ => default end | ident.Nat_sub => fun x x0 : defaults.expr (type.base base.type.nat) => + llet default := UnderLets.Base (#(ident.Nat_sub)%expr @ x @ x0)%expr_pat in match x with | #(idc)%expr_pat => match @@ -218,25 +233,28 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args0 => UnderLets.Base ##((args - args0)%nat)%expr - | None => - UnderLets.Base (#(ident.Nat_sub)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Nat_sub)%expr @ x @ x0)%expr_pat + | _ => default end - | None => UnderLets.Base (#(ident.Nat_sub)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Nat_sub)%expr @ x @ x0)%expr_pat + | _ => default end -| @ident.nil t => UnderLets.Base []%expr_pat +| @ident.nil t => llet default := UnderLets.Base []%expr_pat in + default | @ident.cons t => fun (x : defaults.expr (type.base t)) (x0 : defaults.expr (type.base (base.type.list t))) => - UnderLets.Base (x :: x0)%expr_pat + llet default := UnderLets.Base (x :: x0)%expr_pat in + default | @ident.pair A B => fun (x : defaults.expr (type.base A)) (x0 : defaults.expr (type.base B)) - => UnderLets.Base (x, x0)%expr_pat + => llet default := UnderLets.Base (x, x0)%expr_pat in + default | @ident.fst A B => fun x : defaults.expr (type.base (A * B)%etype) => + llet default := UnderLets.Base (#(ident.fst)%expr @ x)%expr_pat in match x with | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ #(idc)%expr_pat x1) x0 => match @@ -275,32 +293,30 @@ match idc in (ident t) return (Compile.value' true t) with defaults.expr (type.base A)) => match a with | Some x' => UnderLets.Base (x' v) - | None => - UnderLets.Base (#(ident.fst)%expr @ x)%expr_pat + | None => default end) | (s1 -> d1)%ptype => fun _ : Compile.value' false s1 -> Compile.value' true d1 - => UnderLets.Base (#(ident.fst)%expr @ x)%expr_pat + => default end (Compile.reflect x0) | (s1 -> d1)%ptype => fun _ : Compile.value' false s1 -> Compile.value' true d1 => - UnderLets.Base (#(ident.fst)%expr @ x)%expr_pat + default end (Compile.reflect x1) - | None => UnderLets.Base (#(ident.fst)%expr @ x)%expr_pat + | None => default 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 _ _ _ _ _ _ _) _) _ => - UnderLets.Base (#(ident.fst)%expr @ x)%expr_pat + s _ (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _) _ => default | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (#(ident.fst)%expr @ x)%expr_pat - | _ => UnderLets.Base (#(ident.fst)%expr @ x)%expr_pat + (@expr.LetIn _ _ _ _ _ _ _) _ => default + | _ => default end | @ident.snd A B => fun x : defaults.expr (type.base (A * B)%etype) => + llet default := UnderLets.Base (#(ident.snd)%expr @ x)%expr_pat in match x with | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ #(idc)%expr_pat x1) x0 => match @@ -339,29 +355,26 @@ match idc in (ident t) return (Compile.value' true t) with defaults.expr (type.base B)) => match a with | Some x' => UnderLets.Base (x' v0) - | None => - UnderLets.Base (#(ident.snd)%expr @ x)%expr_pat + | None => default end) | (s1 -> d1)%ptype => fun _ : Compile.value' false s1 -> Compile.value' true d1 - => UnderLets.Base (#(ident.snd)%expr @ x)%expr_pat + => default end (Compile.reflect x0) | (s1 -> d1)%ptype => fun _ : Compile.value' false s1 -> Compile.value' true d1 => - UnderLets.Base (#(ident.snd)%expr @ x)%expr_pat + default end (Compile.reflect x1) - | None => UnderLets.Base (#(ident.snd)%expr @ x)%expr_pat + | None => default 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 _ _ _ _ _ _ _) _) _ => - UnderLets.Base (#(ident.snd)%expr @ x)%expr_pat + s _ (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _) _ => default | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr _ | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ - (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base (#(ident.snd)%expr @ x)%expr_pat - | _ => UnderLets.Base (#(ident.snd)%expr @ x)%expr_pat + (@expr.LetIn _ _ _ _ _ _ _) _ => default + | _ => default end | @ident.prod_rect A B T => fun @@ -370,13 +383,11 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.UnderLets base.type ident var (defaults.expr (type.base T))) (x0 : defaults.expr (type.base (A * B)%etype)) => + llet default := UnderLets.Base + (#(ident.prod_rect)%expr @ + (λ (x1 : var (type.base A))(x2 : var (type.base B)), + UnderLets.to_expr (x ($x1) ($x2)))%expr @ x0)%expr_pat in match x0 with - | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr _ | - @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ => - UnderLets.Base - (#(ident.prod_rect)%expr @ - (λ (x2 : var (type.base A))(x3 : var (type.base B)), - UnderLets.to_expr (x ($x2) ($x3)))%expr @ x0)%expr_pat | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ #(idc)%expr_pat x2) x1 => match match idc with @@ -451,80 +462,30 @@ match idc in (ident t) return (Compile.value' true t) with anyexpr_ty))) := fv in unwrap)) - | None => - UnderLets.Base - (#(ident.prod_rect)%expr @ - (λ (x5 : var (type.base A)) - (x6 : var (type.base B)), - UnderLets.to_expr - (x ($x5) ($x6)))%expr @ x0)%expr_pat + | None => default end))%under_lets - | None => - UnderLets.Base - (#(ident.prod_rect)%expr @ - (λ (x5 : var (type.base A))(x6 : - var - (type.base - B)), - UnderLets.to_expr (x ($x5) ($x6)))%expr @ - x0)%expr_pat + | None => default end) - | None => - UnderLets.Base - (#(ident.prod_rect)%expr @ - (λ (x4 : var (type.base A))(x5 : var - (type.base B)), - UnderLets.to_expr (x ($x4) ($x5)))%expr @ x0)%expr_pat + | None => default end) | (s1 -> d1)%ptype => fun _ : Compile.value' false s1 -> Compile.value' true d1 - => - UnderLets.Base - (#(ident.prod_rect)%expr @ - (λ (x3 : var (type.base A))(x4 : var (type.base B)), - UnderLets.to_expr (x ($x3) ($x4)))%expr @ x0)%expr_pat + => default end (Compile.reflect x1) | (s1 -> d1)%ptype => fun _ : Compile.value' false s1 -> Compile.value' true d1 => - UnderLets.Base - (#(ident.prod_rect)%expr @ - (λ (x3 : var (type.base A))(x4 : var (type.base B)), - UnderLets.to_expr (x ($x3) ($x4)))%expr @ x0)%expr_pat + default end (Compile.reflect x2) - | None => - UnderLets.Base - (#(ident.prod_rect)%expr @ - (λ (x3 : var (type.base A))(x4 : var (type.base B)), - UnderLets.to_expr (x ($x3) ($x4)))%expr @ x0)%expr_pat + | None => default end | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ ($_)%expr _) _ | @expr.App _ - _ _ s _ (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _) _ => - UnderLets.Base - (#(ident.prod_rect)%expr @ - (λ (x3 : var (type.base A))(x4 : var (type.base B)), - UnderLets.to_expr (x ($x3) ($x4)))%expr @ x0)%expr_pat - | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ (_ @ _)%expr_pat _) _ | - @expr.App _ _ _ s _ - (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _) _ => - UnderLets.Base - (#(ident.prod_rect)%expr @ - (λ (x4 : var (type.base A))(x5 : var (type.base B)), - UnderLets.to_expr (x ($x4) ($x5)))%expr @ x0)%expr_pat - | @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base - (#(ident.prod_rect)%expr @ - (λ (x3 : var (type.base A))(x4 : var (type.base B)), - UnderLets.to_expr (x ($x3) ($x4)))%expr @ x0)%expr_pat - | @expr.LetIn _ _ _ _ _ _ _ => - UnderLets.Base - (#(ident.prod_rect)%expr @ - (λ (x2 : var (type.base A))(x3 : var (type.base B)), - UnderLets.to_expr (x ($x2) ($x3)))%expr @ x0)%expr_pat - | _ => - UnderLets.Base - (#(ident.prod_rect)%expr @ - (λ (x1 : var (type.base A))(x2 : var (type.base B)), - UnderLets.to_expr (x ($x1) ($x2)))%expr @ x0)%expr_pat + _ _ s _ (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _) _ | @expr.App + _ _ _ s _ (@expr.App _ _ _ s0 _ (_ @ _)%expr_pat _) _ | @expr.App _ _ _ + s _ (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _) _ => default + | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr _ | + @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ + (@expr.LetIn _ _ _ _ _ _ _) _ => default + | _ => default end | @ident.bool_rect T => fun @@ -533,6 +494,12 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.UnderLets base.type ident var (defaults.expr (type.base T))) (x1 : defaults.expr (type.base base.type.bool)) => + llet default := UnderLets.Base + (#(ident.bool_rect)%expr @ + (λ x2 : var (type.base base.type.unit), + UnderLets.to_expr (x ($x2)))%expr @ + (λ x2 : var (type.base base.type.unit), + UnderLets.to_expr (x0 ($x2)))%expr @ x1)%expr_pat in match x1 with | #(idc)%expr_pat => match @@ -580,36 +547,11 @@ match idc in (ident t) return (Compile.value' true t) with (let (anyexpr_ty, _) := a0 in anyexpr_ty))) := fv in unwrap)) - | None => - UnderLets.Base - (#(ident.bool_rect)%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x2)))%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x0 ($x2)))%expr @ x1)%expr_pat + | None => default end))%under_lets - | None => - UnderLets.Base - (#(ident.bool_rect)%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x2)))%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x0 ($x2)))%expr @ x1)%expr_pat + | None => default end - | ($_)%expr | @expr.Abs _ _ _ _ _ _ => - UnderLets.Base - (#(ident.bool_rect)%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x2)))%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x0 ($x2)))%expr @ x1)%expr_pat - | _ => - UnderLets.Base - (#(ident.bool_rect)%expr @ - (λ x3 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x3)))%expr @ - (λ x3 : var (type.base base.type.unit), - UnderLets.to_expr (x0 ($x3)))%expr @ x1)%expr_pat + | _ => default end | @ident.nat_rect P => fun @@ -621,6 +563,14 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.UnderLets base.type ident var (defaults.expr (type.base P))) (x1 : defaults.expr (type.base base.type.nat)) => + llet default := UnderLets.Base + (#(ident.nat_rect)%expr @ + (λ x2 : var (type.base base.type.unit), + UnderLets.to_expr (x ($x2)))%expr @ + (λ (x2 : var (type.base base.type.nat))(x3 : var + (type.base + P)), + UnderLets.to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat in match x1 with | #(idc)%expr_pat => match @@ -682,47 +632,13 @@ match idc in (ident t) return (Compile.value' true t) with (let (anyexpr_ty, _) := a0 in anyexpr_ty))) := fv in unwrap)) - | None => - UnderLets.Base - (#(ident.nat_rect)%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x2)))%expr @ - (λ (x2 : var (type.base base.type.nat)) - (x3 : var (type.base P)), - UnderLets.to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat + | None => default end))%under_lets - | None => - UnderLets.Base - (#(ident.nat_rect)%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x2)))%expr @ - (λ (x2 : var (type.base base.type.nat))(x3 : var - (type.base - P)), - UnderLets.to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat + | None => default end) - | None => - UnderLets.Base - (#(ident.nat_rect)%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x2)))%expr @ - (λ (x2 : var (type.base base.type.nat))(x3 : var (type.base P)), - UnderLets.to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat + | None => default end - | ($_)%expr | @expr.Abs _ _ _ _ _ _ => - UnderLets.Base - (#(ident.nat_rect)%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x2)))%expr @ - (λ (x2 : var (type.base base.type.nat))(x3 : var (type.base P)), - UnderLets.to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat - | _ => - UnderLets.Base - (#(ident.nat_rect)%expr @ - (λ x3 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x3)))%expr @ - (λ (x3 : var (type.base base.type.nat))(x4 : var (type.base P)), - UnderLets.to_expr (x0 ($x3) ($x4)))%expr @ x1)%expr_pat + | _ => default end | @ident.nat_rect_arrow P Q => fun @@ -738,6 +654,21 @@ match idc in (ident t) return (Compile.value' true t) with (defaults.expr (type.base Q))) (x1 : defaults.expr (type.base base.type.nat)) (x2 : defaults.expr (type.base P)) => + llet default := UnderLets.Base + (#(ident.nat_rect_arrow)%expr @ + (λ x3 : var (type.base P), + UnderLets.to_expr (x ($x3)))%expr @ + (λ (x3 : var (type.base base.type.nat))(x4 : var + (type.base + P -> + type.base + Q)%ptype) + (x5 : var (type.base P)), + UnderLets.to_expr + (x0 ($x3) + (fun x6 : defaults.expr (type.base P) => + UnderLets.Base ($x4 @ x6)%expr_pat) ($x5)))%expr @ + x1 @ x2)%expr_pat in match x1 with | #(idc)%expr_pat => match @@ -819,100 +750,15 @@ match idc in (ident t) return (Compile.value' true t) with a0 in anyexpr_ty))) := fv in unwrap)) - | None => - UnderLets.Base - (#(ident.nat_rect_arrow)%expr @ - (λ x3 : var (type.base P), - UnderLets.to_expr (x ($x3)))%expr @ - (λ (x3 : var (type.base base.type.nat)) - (x4 : var - (type.base P -> type.base Q)%ptype) - (x5 : var (type.base P)), - UnderLets.to_expr - (x0 ($x3) - (fun - x6 : defaults.expr - (type.base P) => - UnderLets.Base - ($x4 @ x6)%expr_pat) ($x5)))%expr @ - x1 @ x2)%expr_pat + | None => default end))%under_lets - | None => - UnderLets.Base - (#(ident.nat_rect_arrow)%expr @ - (λ x3 : var (type.base P), - UnderLets.to_expr (x ($x3)))%expr @ - (λ (x3 : var (type.base base.type.nat))(x4 : - var - (type.base - P -> - type.base - Q)%ptype) - (x5 : var (type.base P)), - UnderLets.to_expr - (x0 ($x3) - (fun x6 : defaults.expr (type.base P) => - UnderLets.Base ($x4 @ x6)%expr_pat) - ($x5)))%expr @ x1 @ x2)%expr_pat + | None => default end) - | None => - UnderLets.Base - (#(ident.nat_rect_arrow)%expr @ - (λ x3 : var (type.base P), - UnderLets.to_expr (x ($x3)))%expr @ - (λ (x3 : var (type.base base.type.nat))(x4 : var - (type.base - P -> - type.base - Q)%ptype) - (x5 : var (type.base P)), - UnderLets.to_expr - (x0 ($x3) - (fun x6 : defaults.expr (type.base P) => - UnderLets.Base ($x4 @ x6)%expr_pat) ($x5)))%expr @ - x1 @ x2)%expr_pat + | None => default end) - | None => - UnderLets.Base - (#(ident.nat_rect_arrow)%expr @ - (λ x3 : var (type.base P), - UnderLets.to_expr (x ($x3)))%expr @ - (λ (x3 : var (type.base base.type.nat))(x4 : var - (type.base P -> - type.base Q)%ptype) - (x5 : var (type.base P)), - UnderLets.to_expr - (x0 ($x3) - (fun x6 : defaults.expr (type.base P) => - UnderLets.Base ($x4 @ x6)%expr_pat) ($x5)))%expr @ x1 @ - x2)%expr_pat + | None => default end - | ($_)%expr | @expr.Abs _ _ _ _ _ _ => - UnderLets.Base - (#(ident.nat_rect_arrow)%expr @ - (λ x3 : var (type.base P), - UnderLets.to_expr (x ($x3)))%expr @ - (λ (x3 : var (type.base base.type.nat))(x4 : var - (type.base P -> - type.base Q)%ptype) - (x5 : var (type.base P)), - UnderLets.to_expr - (x0 ($x3) - (fun x6 : defaults.expr (type.base P) => - UnderLets.Base ($x4 @ x6)%expr_pat) ($x5)))%expr @ x1 @ x2)%expr_pat - | _ => - UnderLets.Base - (#(ident.nat_rect_arrow)%expr @ - (λ x4 : var (type.base P), - UnderLets.to_expr (x ($x4)))%expr @ - (λ (x4 : var (type.base base.type.nat))(x5 : var - (type.base P -> - type.base Q)%ptype) - (x6 : var (type.base P)), - UnderLets.to_expr - (x0 ($x4) - (fun x7 : defaults.expr (type.base P) => - UnderLets.Base ($x5 @ x7)%expr_pat) ($x6)))%expr @ x1 @ x2)%expr_pat + | _ => default end | @ident.list_rect A P => fun @@ -925,6 +771,18 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.UnderLets base.type ident var (defaults.expr (type.base P))) (x1 : defaults.expr (type.base (base.type.list A))) => + llet default := UnderLets.Base + (#(ident.list_rect)%expr @ + (λ x2 : var (type.base base.type.unit), + UnderLets.to_expr (x ($x2)))%expr @ + (λ (x2 : var (type.base A))(x3 : var + (type.base + (base.type.list + A)))(x4 : + var + (type.base + P)), + UnderLets.to_expr (x0 ($x2) ($x3) ($x4)))%expr @ x1)%expr_pat in Compile.castv x0 (UnderLets.UnderLets base.type ident var (defaults.expr (type.base P))) (fun @@ -980,40 +838,11 @@ match idc in (ident t) return (Compile.value' true t) with (let (anyexpr_ty, _) := a0 in anyexpr_ty))) := fv in unwrap)) - | None => - UnderLets.Base - (#(ident.list_rect)%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x2)))%expr @ - (λ (x2 : var (type.base A))(x3 : var - (type.base - (base.type.list - A))) - (x4 : var (type.base P)), - UnderLets.to_expr (x0 ($x2) ($x3) ($x4)))%expr @ - x1)%expr_pat + | None => default end))%under_lets - | None => - UnderLets.Base - (#(ident.list_rect)%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x2)))%expr @ - (λ (x2 : var (type.base A))(x3 : var - (type.base - (base.type.list A))) - (x4 : var (type.base P)), - UnderLets.to_expr (x0 ($x2) ($x3) ($x4)))%expr @ x1)%expr_pat + | None => default end) - | None => - UnderLets.Base - (#(ident.list_rect)%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x2)))%expr @ - (λ (x2 : var (type.base A))(x3 : var - (type.base - (base.type.list A))) - (x4 : var (type.base P)), - UnderLets.to_expr (x0 ($x2) ($x3) ($x4)))%expr @ x1)%expr_pat + | None => default end) | @ident.list_case A P => fun @@ -1025,6 +854,15 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.UnderLets base.type ident var (defaults.expr (type.base P))) (x1 : defaults.expr (type.base (base.type.list A))) => + llet default := UnderLets.Base + (#(ident.list_case)%expr @ + (λ x2 : var (type.base base.type.unit), + UnderLets.to_expr (x ($x2)))%expr @ + (λ (x2 : var (type.base A))(x3 : var + (type.base + (base.type.list + A))), + UnderLets.to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat in match x1 with | #(idc)%expr_pat => match match idc with @@ -1057,36 +895,10 @@ match idc in (ident t) return (Compile.value' true t) with (let (anyexpr_ty, _) := a0 in anyexpr_ty))) := fv in unwrap)) - | None => - UnderLets.Base - (#(ident.list_case)%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x2)))%expr @ - (λ (x2 : var (type.base A))(x3 : var - (type.base - (base.type.list - A))), - UnderLets.to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat + | None => default end))%under_lets - | None => - UnderLets.Base - (#(ident.list_case)%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x2)))%expr @ - (λ (x2 : var (type.base A))(x3 : var - (type.base - (base.type.list A))), - UnderLets.to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat + | None => default end - | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr _ | - @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ => - UnderLets.Base - (#(ident.list_case)%expr @ - (λ x3 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x3)))%expr @ - (λ (x3 : var (type.base A))(x4 : var - (type.base (base.type.list A))), - UnderLets.to_expr (x0 ($x3) ($x4)))%expr @ x1)%expr_pat | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ #(idc)%expr_pat x3) x2 => match match idc with | @ident.cons t0 => Some t0 @@ -1162,132 +974,43 @@ match idc in (ident t) return (Compile.value' true t) with anyexpr_ty))) := fv in unwrap)) - | None => - UnderLets.Base - (#(ident.list_case)%expr @ - (λ x6 : var - (type.base - base.type.unit), - UnderLets.to_expr (x ($x6)))%expr @ - (λ (x6 : var (type.base A)) - (x7 : var - (type.base - (base.type.list A))), - UnderLets.to_expr - (x0 ($x6) ($x7)))%expr @ x1)%expr_pat + | None => default end))%under_lets - | None => - UnderLets.Base - (#(ident.list_case)%expr @ - (λ x6 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x6)))%expr @ - (λ (x6 : var (type.base A))(x7 : - var - (type.base - (base.type.list - A))), - UnderLets.to_expr (x0 ($x6) ($x7)))%expr @ - x1)%expr_pat + | None => default end) - | None => - UnderLets.Base - (#(ident.list_case)%expr @ - (λ x5 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x5)))%expr @ - (λ (x5 : var (type.base A))(x6 : var - (type.base - (base.type.list - A))), - UnderLets.to_expr (x0 ($x5) ($x6)))%expr @ x1)%expr_pat + | None => default end) | (s1 -> d1)%ptype => fun _ : Compile.value' false s1 -> Compile.value' true d1 - => - UnderLets.Base - (#(ident.list_case)%expr @ - (λ x4 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x4)))%expr @ - (λ (x4 : var (type.base A))(x5 : var - (type.base - (base.type.list - A))), - UnderLets.to_expr (x0 ($x4) ($x5)))%expr @ x1)%expr_pat + => default end (Compile.reflect x2) | (s1 -> d1)%ptype => fun _ : Compile.value' false s1 -> Compile.value' true d1 => - UnderLets.Base - (#(ident.list_case)%expr @ - (λ x4 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x4)))%expr @ - (λ (x4 : var (type.base A))(x5 : var - (type.base - (base.type.list A))), - UnderLets.to_expr (x0 ($x4) ($x5)))%expr @ x1)%expr_pat + default end (Compile.reflect x3) - | None => - UnderLets.Base - (#(ident.list_case)%expr @ - (λ x4 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x4)))%expr @ - (λ (x4 : var (type.base A))(x5 : var - (type.base - (base.type.list A))), - UnderLets.to_expr (x0 ($x4) ($x5)))%expr @ x1)%expr_pat + | None => default end | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ ($_)%expr _) _ | @expr.App _ - _ _ s _ (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _) _ => - UnderLets.Base - (#(ident.list_case)%expr @ - (λ x4 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x4)))%expr @ - (λ (x4 : var (type.base A))(x5 : var - (type.base (base.type.list A))), - UnderLets.to_expr (x0 ($x4) ($x5)))%expr @ x1)%expr_pat - | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ (_ @ _)%expr_pat _) _ | - @expr.App _ _ _ s _ - (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _) _ => - UnderLets.Base - (#(ident.list_case)%expr @ - (λ x5 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x5)))%expr @ - (λ (x5 : var (type.base A))(x6 : var - (type.base (base.type.list A))), - UnderLets.to_expr (x0 ($x5) ($x6)))%expr @ x1)%expr_pat - | @expr.App _ _ _ s _ (@expr.LetIn _ _ _ _ _ _ _) _ => - UnderLets.Base - (#(ident.list_case)%expr @ - (λ x4 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x4)))%expr @ - (λ (x4 : var (type.base A))(x5 : var - (type.base (base.type.list A))), - UnderLets.to_expr (x0 ($x4) ($x5)))%expr @ x1)%expr_pat - | @expr.LetIn _ _ _ _ _ _ _ => - UnderLets.Base - (#(ident.list_case)%expr @ - (λ x3 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x3)))%expr @ - (λ (x3 : var (type.base A))(x4 : var - (type.base (base.type.list A))), - UnderLets.to_expr (x0 ($x3) ($x4)))%expr @ x1)%expr_pat - | _ => - UnderLets.Base - (#(ident.list_case)%expr @ - (λ x2 : var (type.base base.type.unit), - UnderLets.to_expr (x ($x2)))%expr @ - (λ (x2 : var (type.base A))(x3 : var - (type.base (base.type.list A))), - UnderLets.to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat + _ _ s _ (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _) _ | @expr.App + _ _ _ s _ (@expr.App _ _ _ s0 _ (_ @ _)%expr_pat _) _ | @expr.App _ _ _ + s _ (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _) _ => default + | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr _ | + @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s _ + (@expr.LetIn _ _ _ _ _ _ _) _ => default + | _ => default end | @ident.List_length T => fun x : defaults.expr (type.base (base.type.list T)) => + llet default := UnderLets.Base (#(ident.List_length)%expr @ x)%expr_pat in reflect_list_cps x (fun xs : option (list (defaults.expr (type.base T))) => match xs with | Some xs0 => UnderLets.Base ##(length xs0)%expr - | None => UnderLets.Base (#(ident.List_length)%expr @ x)%expr_pat + | None => default end) | ident.List_seq => fun x x0 : defaults.expr (type.base base.type.nat) => + llet default := UnderLets.Base (#(ident.List_seq)%expr @ x @ x0)%expr_pat in match x with | #(idc)%expr_pat => match @@ -1327,18 +1050,19 @@ match idc in (ident t) return (Compile.value' true t) with (type.base (base.type.list base.type.nat))) => (x1 :: xs)%expr_pat) []%expr_pat (map (fun v : nat => ##(v)%expr) (seq args args0))) - | None => - UnderLets.Base (#(ident.List_seq)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.List_seq)%expr @ x @ x0)%expr_pat + | _ => default end - | None => UnderLets.Base (#(ident.List_seq)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.List_seq)%expr @ x @ x0)%expr_pat + | _ => default end | @ident.List_firstn A => fun (x : defaults.expr (type.base base.type.nat)) (x0 : defaults.expr (type.base (base.type.list A))) => + llet default := UnderLets.Base + (#(ident.List_firstn)%expr @ x @ x0)%expr_pat in match x with | #(idc)%expr_pat => match @@ -1371,22 +1095,19 @@ match idc in (ident t) return (Compile.value' true t) with match a with | Some x' => UnderLets.Base (x' (reify_list (firstn args xs0))) - | None => - UnderLets.Base - (#(ident.List_firstn)%expr @ x @ x0)%expr_pat + | None => default end) - | None => - UnderLets.Base - (#(ident.List_firstn)%expr @ x @ x0)%expr_pat + | None => default end) - | None => - UnderLets.Base (#(ident.List_firstn)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.List_firstn)%expr @ x @ x0)%expr_pat + | _ => default end | @ident.List_skipn A => fun (x : defaults.expr (type.base base.type.nat)) (x0 : defaults.expr (type.base (base.type.list A))) => + llet default := UnderLets.Base + (#(ident.List_skipn)%expr @ x @ x0)%expr_pat in match x with | #(idc)%expr_pat => match @@ -1419,21 +1140,19 @@ match idc in (ident t) return (Compile.value' true t) with match a with | Some x' => UnderLets.Base (x' (reify_list (skipn args xs0))) - | None => - UnderLets.Base - (#(ident.List_skipn)%expr @ x @ x0)%expr_pat + | None => default end) - | None => - UnderLets.Base - (#(ident.List_skipn)%expr @ x @ x0)%expr_pat + | None => default end) - | None => UnderLets.Base (#(ident.List_skipn)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.List_skipn)%expr @ x @ x0)%expr_pat + | _ => default end | @ident.List_repeat A => fun (x : defaults.expr (type.base A)) (x0 : defaults.expr (type.base base.type.nat)) => + llet default := UnderLets.Base + (#(ident.List_repeat)%expr @ x @ x0)%expr_pat in match x0 with | #(idc)%expr_pat => match @@ -1460,18 +1179,17 @@ match idc in (ident t) return (Compile.value' true t) with defaults.expr (type.base (base.type.list A))) => match a with | Some x' => UnderLets.Base (x' (reify_list (repeat x args))) - | None => - UnderLets.Base - (#(ident.List_repeat)%expr @ x @ x0)%expr_pat + | None => default end) - | None => - UnderLets.Base (#(ident.List_repeat)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.List_repeat)%expr @ x @ x0)%expr_pat + | _ => default end | @ident.List_combine A B => fun (x : defaults.expr (type.base (base.type.list A))) (x0 : defaults.expr (type.base (base.type.list B))) => + llet default := UnderLets.Base + (#(ident.List_combine)%expr @ x @ x0)%expr_pat in reflect_list_cps x (fun xs : option (list (defaults.expr (type.base A))) => match xs with @@ -1508,16 +1226,11 @@ match idc in (ident t) return (Compile.value' true t) with (reify_list (map (fun '(x1, y) => (x1, y)%expr_pat) (combine xs0 ys0)))) - | None => - UnderLets.Base - (#(ident.List_combine)%expr @ x @ x0)%expr_pat + | None => default end) - | None => - UnderLets.Base - (#(ident.List_combine)%expr @ x @ x0)%expr_pat + | None => default end) - | None => - UnderLets.Base (#(ident.List_combine)%expr @ x @ x0)%expr_pat + | None => default end) | @ident.List_map A B => fun @@ -1525,6 +1238,10 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.UnderLets base.type ident var (defaults.expr (type.base B))) (x0 : defaults.expr (type.base (base.type.list A))) => + llet default := UnderLets.Base + (#(ident.List_map)%expr @ + (λ x1 : var (type.base A), + UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat in Compile.castbe x0 (UnderLets.UnderLets base.type ident var (defaults.expr (type.base (base.type.list B)))) @@ -1585,26 +1302,15 @@ match idc in (ident t) return (Compile.value' true t) with (let (anyexpr_ty, _) := a0 in anyexpr_ty))) := fv in unwrap)) - | None => - UnderLets.Base - (#(ident.List_map)%expr @ - (λ x1 : var (type.base A), - UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat + | None => default end))%under_lets - | None => - UnderLets.Base - (#(ident.List_map)%expr @ - (λ x1 : var (type.base A), - UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat + | None => default end) - | None => - UnderLets.Base - (#(ident.List_map)%expr @ - (λ x1 : var (type.base A), - UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat + | None => default end) | @ident.List_app A => fun x x0 : defaults.expr (type.base (base.type.list A)) => + llet default := UnderLets.Base (x ++ x0)%expr in Compile.castbe x (UnderLets.UnderLets base.type ident var (defaults.expr (type.base (base.type.list A)))) @@ -1664,14 +1370,15 @@ match idc in (ident t) return (Compile.value' true t) with (let (anyexpr_ty, _) := a0 in anyexpr_ty))) := fv in unwrap)) - | None => UnderLets.Base (x ++ x0)%expr + | None => default end))%under_lets - | None => UnderLets.Base (x ++ x0)%expr + | None => default end) - | None => UnderLets.Base (x ++ x0)%expr + | None => default end) | @ident.List_rev A => fun x : defaults.expr (type.base (base.type.list A)) => + llet default := UnderLets.Base (#(ident.List_rev)%expr @ x)%expr_pat in reflect_list_cps x (fun xs : option (list (defaults.expr (type.base A))) => match xs with @@ -1687,9 +1394,9 @@ match idc in (ident t) return (Compile.value' true t) with defaults.expr (type.base (base.type.list A))) => match a with | Some x' => UnderLets.Base (x' (reify_list (rev xs0))) - | None => UnderLets.Base (#(ident.List_rev)%expr @ x)%expr_pat + | None => default end) - | None => UnderLets.Base (#(ident.List_rev)%expr @ x)%expr_pat + | None => default end) | @ident.List_flat_map A B => fun @@ -1697,6 +1404,10 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.UnderLets base.type ident var (defaults.expr (type.base (base.type.list B)))) (x0 : defaults.expr (type.base (base.type.list A))) => + llet default := UnderLets.Base + (#(ident.List_flat_map)%expr @ + (λ x1 : var (type.base A), + UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat in Compile.castbe x0 (UnderLets.UnderLets base.type ident var (defaults.expr (type.base (base.type.list B)))) @@ -1755,23 +1466,11 @@ match idc in (ident t) return (Compile.value' true t) with => match a with | Some x' => UnderLets.Base (x' fv0) - | None => - UnderLets.Base - (#(ident.List_flat_map)%expr @ - (λ x1 : var (type.base A), - UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat + | None => default end))%under_lets - | None => - UnderLets.Base - (#(ident.List_flat_map)%expr @ - (λ x1 : var (type.base A), - UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat + | None => default end) - | None => - UnderLets.Base - (#(ident.List_flat_map)%expr @ - (λ x1 : var (type.base A), - UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat + | None => default end) | @ident.List_partition A => fun @@ -1779,6 +1478,10 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.UnderLets base.type ident var (defaults.expr (type.base base.type.bool))) (x0 : defaults.expr (type.base (base.type.list A))) => + llet default := UnderLets.Base + (#(ident.List_partition)%expr @ + (λ x1 : var (type.base A), + UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat in Compile.castbe x0 (UnderLets.UnderLets base.type ident var (defaults.expr @@ -1859,23 +1562,11 @@ match idc in (ident t) return (Compile.value' true t) with => match a with | Some x' => UnderLets.Base (x' fv0) - | None => - UnderLets.Base - (#(ident.List_partition)%expr @ - (λ x1 : var (type.base A), - UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat + | None => default end))%under_lets - | None => - UnderLets.Base - (#(ident.List_partition)%expr @ - (λ x1 : var (type.base A), - UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat + | None => default end) - | None => - UnderLets.Base - (#(ident.List_partition)%expr @ - (λ x1 : var (type.base A), - UnderLets.to_expr (x ($x1)))%expr @ x0)%expr_pat + | None => default end) | @ident.List_fold_right A B => fun @@ -1885,6 +1576,10 @@ match idc in (ident t) return (Compile.value' true t) with (defaults.expr (type.base A))) (x0 : defaults.expr (type.base A)) (x1 : defaults.expr (type.base (base.type.list B))) => + llet default := UnderLets.Base + (#(ident.List_fold_right)%expr @ + (λ (x2 : var (type.base B))(x3 : var (type.base A)), + UnderLets.to_expr (x ($x2) ($x3)))%expr @ x0 @ x1)%expr_pat in Compile.castv x (UnderLets.UnderLets base.type ident var (defaults.expr (type.base A))) (fun @@ -1937,25 +1632,11 @@ match idc in (ident t) return (Compile.value' true t) with (let (anyexpr_ty, _) := a0 in anyexpr_ty))) := fv in unwrap)) - | None => - UnderLets.Base - (#(ident.List_fold_right)%expr @ - (λ (x2 : var (type.base B))(x3 : var - (type.base A)), - UnderLets.to_expr (x ($x2) ($x3)))%expr @ x0 @ - x1)%expr_pat + | None => default end))%under_lets - | None => - UnderLets.Base - (#(ident.List_fold_right)%expr @ - (λ (x2 : var (type.base B))(x3 : var (type.base A)), - UnderLets.to_expr (x ($x2) ($x3)))%expr @ x0 @ x1)%expr_pat + | None => default end) - | None => - UnderLets.Base - (#(ident.List_fold_right)%expr @ - (λ (x2 : var (type.base B))(x3 : var (type.base A)), - UnderLets.to_expr (x ($x2) ($x3)))%expr @ x0 @ x1)%expr_pat + | None => default end) | @ident.List_update_nth T => fun (x : defaults.expr (type.base base.type.nat)) @@ -1963,6 +1644,10 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.UnderLets base.type ident var (defaults.expr (type.base T))) (x1 : defaults.expr (type.base (base.type.list T))) => + llet default := UnderLets.Base + (#(ident.List_update_nth)%expr @ x @ + (λ x2 : var (type.base T), + UnderLets.to_expr (x0 ($x2)))%expr @ x1)%expr_pat in match x with | #(idc)%expr_pat => match @@ -2037,45 +1722,22 @@ match idc in (ident t) return (Compile.value' true t) with a0 in anyexpr_ty))) := fv in unwrap)) - | None => - UnderLets.Base - (#(ident.List_update_nth)%expr @ x @ - (λ x2 : var (type.base T), - UnderLets.to_expr (x0 ($x2)))%expr @ x1)%expr_pat + | None => default end))%under_lets - | None => - UnderLets.Base - (#(ident.List_update_nth)%expr @ x @ - (λ x2 : var (type.base T), - UnderLets.to_expr (x0 ($x2)))%expr @ x1)%expr_pat + | None => default end) - | None => - UnderLets.Base - (#(ident.List_update_nth)%expr @ x @ - (λ x2 : var (type.base T), - UnderLets.to_expr (x0 ($x2)))%expr @ x1)%expr_pat + | None => default end) - | None => - UnderLets.Base - (#(ident.List_update_nth)%expr @ x @ - (λ x2 : var (type.base T), - UnderLets.to_expr (x0 ($x2)))%expr @ x1)%expr_pat + | None => default end - | ($_)%expr | @expr.Abs _ _ _ _ _ _ => - UnderLets.Base - (#(ident.List_update_nth)%expr @ x @ - (λ x2 : var (type.base T), - UnderLets.to_expr (x0 ($x2)))%expr @ x1)%expr_pat - | _ => - UnderLets.Base - (#(ident.List_update_nth)%expr @ x @ - (λ x3 : var (type.base T), - UnderLets.to_expr (x0 ($x3)))%expr @ x1)%expr_pat + | _ => default end | @ident.List_nth_default T => fun (x : defaults.expr (type.base T)) (x0 : defaults.expr (type.base (base.type.list T))) (x1 : defaults.expr (type.base base.type.nat)) => + llet default := UnderLets.Base + (#(ident.List_nth_default)%expr @ x @ x0 @ x1)%expr_pat in match x1 with | #(idc)%expr_pat => match @@ -2094,9 +1756,9 @@ match idc in (ident t) return (Compile.value' true t) with Compile.castbe x (UnderLets.UnderLets base.type ident var (defaults.expr (type.base T))) - (fun default : option (defaults.expr (type.base T)) => - match default with - | Some default0 => + (fun default0 : option (defaults.expr (type.base T)) => + match default0 with + | Some default1 => reflect_list_cps x0 (fun ls : option (list (defaults.expr (type.base T))) => match ls with @@ -2113,30 +1775,20 @@ match idc in (ident t) return (Compile.value' true t) with match a with | Some x' => UnderLets.Base - (x' (nth_default default0 ls0 args)) - | None => - UnderLets.Base - (#(ident.List_nth_default)%expr @ x @ x0 @ - x1)%expr_pat + (x' (nth_default default1 ls0 args)) + | None => default end) - | None => - UnderLets.Base - (#(ident.List_nth_default)%expr @ x @ x0 @ x1)%expr_pat + | None => default end) - | None => - UnderLets.Base - (#(ident.List_nth_default)%expr @ x @ x0 @ x1)%expr_pat + | None => default end) - | None => - UnderLets.Base - (#(ident.List_nth_default)%expr @ x @ x0 @ x1)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.List_nth_default)%expr @ x @ x0 @ x1)%expr_pat + | _ => default end | ident.Z_add => fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x + x0)%expr in match x with | #(idc)%expr_pat => match @@ -2169,16 +1821,17 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args0 => UnderLets.Base ##((args + args0)%Z)%expr - | None => UnderLets.Base (x + x0)%expr + | None => default end - | _ => UnderLets.Base (x + x0)%expr + | _ => default end - | None => UnderLets.Base (x + x0)%expr + | None => default end - | _ => UnderLets.Base (x + x0)%expr + | _ => default end | ident.Z_mul => fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x * x0)%expr in match x with | #(idc)%expr_pat => match @@ -2211,16 +1864,17 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args0 => UnderLets.Base ##((args * args0)%Z)%expr - | None => UnderLets.Base (x * x0)%expr + | None => default end - | _ => UnderLets.Base (x * x0)%expr + | _ => default end - | None => UnderLets.Base (x * x0)%expr + | None => default end - | _ => UnderLets.Base (x * x0)%expr + | _ => default end | ident.Z_pow => fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_pow)%expr @ x @ x0)%expr_pat in match x with | #(idc)%expr_pat => match @@ -2253,17 +1907,17 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args0 => UnderLets.Base ##(args ^ args0)%expr - | None => - UnderLets.Base (#(ident.Z_pow)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_pow)%expr @ x @ x0)%expr_pat + | _ => default end - | None => UnderLets.Base (#(ident.Z_pow)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_pow)%expr @ x @ x0)%expr_pat + | _ => default end | ident.Z_sub => fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x - x0)%expr in match x with | #(idc)%expr_pat => match @@ -2296,16 +1950,17 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args0 => UnderLets.Base ##((args - args0)%Z)%expr - | None => UnderLets.Base (x - x0)%expr + | None => default end - | _ => UnderLets.Base (x - x0)%expr + | _ => default end - | None => UnderLets.Base (x - x0)%expr + | None => default end - | _ => UnderLets.Base (x - x0)%expr + | _ => default end | ident.Z_opp => fun x : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (- x)%expr in match x with | #(idc)%expr_pat => match @@ -2321,12 +1976,13 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args => UnderLets.Base ##((- args)%Z)%expr - | None => UnderLets.Base (- x)%expr + | None => default end - | _ => UnderLets.Base (- x)%expr + | _ => default end | ident.Z_div => fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x / x0)%expr in match x with | #(idc)%expr_pat => match @@ -2359,16 +2015,17 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args0 => UnderLets.Base ##((args / args0)%Z)%expr - | None => UnderLets.Base (x / x0)%expr + | None => default end - | _ => UnderLets.Base (x / x0)%expr + | _ => default end - | None => UnderLets.Base (x / x0)%expr + | None => default end - | _ => UnderLets.Base (x / x0)%expr + | _ => default end | ident.Z_modulo => fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x mod x0)%expr in match x with | #(idc)%expr_pat => match @@ -2401,16 +2058,17 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args0 => UnderLets.Base ##((args mod args0)%Z)%expr - | None => UnderLets.Base (x mod x0)%expr + | None => default end - | _ => UnderLets.Base (x mod x0)%expr + | _ => default end - | None => UnderLets.Base (x mod x0)%expr + | None => default end - | _ => UnderLets.Base (x mod x0)%expr + | _ => default end | ident.Z_log2 => fun x : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_log2)%expr @ x)%expr_pat in match x with | #(idc)%expr_pat => match @@ -2426,12 +2084,13 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args => UnderLets.Base ##(Z.log2 args)%expr - | None => UnderLets.Base (#(ident.Z_log2)%expr @ x)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_log2)%expr @ x)%expr_pat + | _ => default end | ident.Z_log2_up => fun x : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_log2_up)%expr @ x)%expr_pat in match x with | #(idc)%expr_pat => match @@ -2447,12 +2106,13 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args => UnderLets.Base ##(Z.log2_up args)%expr - | None => UnderLets.Base (#(ident.Z_log2_up)%expr @ x)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_log2_up)%expr @ x)%expr_pat + | _ => default end | ident.Z_eqb => fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_eqb)%expr @ x @ x0)%expr_pat in match x with | #(idc)%expr_pat => match @@ -2485,17 +2145,17 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args0 => UnderLets.Base ##(args =? args0)%expr - | None => - UnderLets.Base (#(ident.Z_eqb)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_eqb)%expr @ x @ x0)%expr_pat + | _ => default end - | None => UnderLets.Base (#(ident.Z_eqb)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_eqb)%expr @ x @ x0)%expr_pat + | _ => default end | ident.Z_leb => fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_leb)%expr @ x @ x0)%expr_pat in match x with | #(idc)%expr_pat => match @@ -2528,17 +2188,17 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args0 => UnderLets.Base ##(args <=? args0)%expr - | None => - UnderLets.Base (#(ident.Z_leb)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_leb)%expr @ x @ x0)%expr_pat + | _ => default end - | None => UnderLets.Base (#(ident.Z_leb)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_leb)%expr @ x @ x0)%expr_pat + | _ => default end | ident.Z_geb => fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_geb)%expr @ x @ x0)%expr_pat in match x with | #(idc)%expr_pat => match @@ -2571,17 +2231,17 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args0 => UnderLets.Base ##(args >=? args0)%expr - | None => - UnderLets.Base (#(ident.Z_geb)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_geb)%expr @ x @ x0)%expr_pat + | _ => default end - | None => UnderLets.Base (#(ident.Z_geb)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_geb)%expr @ x @ x0)%expr_pat + | _ => default end | ident.Z_of_nat => fun x : defaults.expr (type.base base.type.nat) => + llet default := UnderLets.Base (#(ident.Z_of_nat)%expr @ x)%expr_pat in match x with | #(idc)%expr_pat => match @@ -2597,12 +2257,13 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args => UnderLets.Base ##(Z.of_nat args)%expr - | None => UnderLets.Base (#(ident.Z_of_nat)%expr @ x)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_of_nat)%expr @ x)%expr_pat + | _ => default end | ident.Z_to_nat => fun x : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_to_nat)%expr @ x)%expr_pat in match x with | #(idc)%expr_pat => match @@ -2618,12 +2279,13 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args => UnderLets.Base ##(Z.to_nat args)%expr - | None => UnderLets.Base (#(ident.Z_to_nat)%expr @ x)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_to_nat)%expr @ x)%expr_pat + | _ => default end | ident.Z_shiftr => fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x >> x0)%expr in match x with | #(idc)%expr_pat => match @@ -2656,16 +2318,17 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args0 => UnderLets.Base ##(Z.shiftr args args0)%expr - | None => UnderLets.Base (x >> x0)%expr + | None => default end - | _ => UnderLets.Base (x >> x0)%expr + | _ => default end - | None => UnderLets.Base (x >> x0)%expr + | None => default end - | _ => UnderLets.Base (x >> x0)%expr + | _ => default end | ident.Z_shiftl => fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x << x0)%expr in match x with | #(idc)%expr_pat => match @@ -2698,16 +2361,17 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args0 => UnderLets.Base ##(Z.shiftl args args0)%expr - | None => UnderLets.Base (x << x0)%expr + | None => default end - | _ => UnderLets.Base (x << x0)%expr + | _ => default end - | None => UnderLets.Base (x << x0)%expr + | None => default end - | _ => UnderLets.Base (x << x0)%expr + | _ => default end | ident.Z_land => fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x &' x0)%expr in match x with | #(idc)%expr_pat => match @@ -2740,16 +2404,17 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args0 => UnderLets.Base ##(Z.land args args0)%expr - | None => UnderLets.Base (x &' x0)%expr + | None => default end - | _ => UnderLets.Base (x &' x0)%expr + | _ => default end - | None => UnderLets.Base (x &' x0)%expr + | None => default end - | _ => UnderLets.Base (x &' x0)%expr + | _ => default end | ident.Z_lor => fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (x || x0)%expr in match x with | #(idc)%expr_pat => match @@ -2782,16 +2447,17 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args0 => UnderLets.Base ##(Z.lor args args0)%expr - | None => UnderLets.Base (x || x0)%expr + | None => default end - | _ => UnderLets.Base (x || x0)%expr + | _ => default end - | None => UnderLets.Base (x || x0)%expr + | None => default end - | _ => UnderLets.Base (x || x0)%expr + | _ => default end | ident.Z_bneg => fun x : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_bneg)%expr @ x)%expr_pat in match x with | #(idc)%expr_pat => match @@ -2807,12 +2473,14 @@ match idc in (ident t) return (Compile.value' true t) with end with | Some args => UnderLets.Base ##(Definitions.Z.bneg args)%expr - | None => UnderLets.Base (#(ident.Z_bneg)%expr @ x)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_bneg)%expr @ x)%expr_pat + | _ => default end | ident.Z_lnot_modulo => fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_lnot_modulo)%expr @ x @ x0)%expr_pat in match x with | #(idc)%expr_pat => match @@ -2847,21 +2515,18 @@ match idc in (ident t) return (Compile.value' true t) with | Some args0 => UnderLets.Base ##(Definitions.Z.lnot_modulo args args0)%expr - | None => - UnderLets.Base - (#(ident.Z_lnot_modulo)%expr @ x @ x0)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_lnot_modulo)%expr @ x @ x0)%expr_pat + | _ => default end - | None => - UnderLets.Base (#(ident.Z_lnot_modulo)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_lnot_modulo)%expr @ x @ x0)%expr_pat + | _ => default end | ident.Z_mul_split => fun x x0 x1 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat in match x with | #(idc)%expr_pat => match @@ -2917,29 +2582,22 @@ match idc in (ident t) return (Compile.value' true t) with '(a, b) := Definitions.Z.mul_split args args0 args1 in (##(a)%expr, ##(b)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat + | _ => default end - | None => - UnderLets.Base (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat + | _ => default end | ident.Z_add_get_carry => fun x x0 x1 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat in match x with | #(idc)%expr_pat => match @@ -2995,31 +2653,22 @@ match idc in (ident t) return (Compile.value' true t) with '(a, b) := Definitions.Z.add_get_carry_full args args0 args1 in (##(a)%expr, ##(b)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat + | None => default end - | _ => - UnderLets.Base (#(ident.Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat + | _ => default end | ident.Z_add_with_carry => fun x x0 x1 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_add_with_carry)%expr @ x @ x0 @ x1)%expr_pat in match x with | #(idc)%expr_pat => match @@ -3073,32 +2722,22 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.Base ##(Definitions.Z.add_with_carry args args0 args1)%expr - | None => - UnderLets.Base - (#(ident.Z_add_with_carry)%expr @ x @ x0 @ x1)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_add_with_carry)%expr @ x @ x0 @ x1)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.Z_add_with_carry)%expr @ x @ x0 @ x1)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_add_with_carry)%expr @ x @ x0 @ x1)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.Z_add_with_carry)%expr @ x @ x0 @ x1)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_add_with_carry)%expr @ x @ x0 @ x1)%expr_pat + | _ => default end | ident.Z_add_with_get_carry => fun x x0 x1 x2 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat in match x with | #(idc)%expr_pat => match @@ -3176,44 +2815,26 @@ match idc in (ident t) return (Compile.value' true t) with Definitions.Z.add_with_get_carry_full args args0 args1 args2 in (##(a)%expr, ##(b)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ - x0 @ x1 @ x2)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ - x1 @ x2)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ - x2)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | _ => default end | ident.Z_sub_get_borrow => fun x x0 x1 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat in match x with | #(idc)%expr_pat => match @@ -3269,32 +2890,22 @@ match idc in (ident t) return (Compile.value' true t) with '(a, b) := Definitions.Z.sub_get_borrow_full args args0 args1 in (##(a)%expr, ##(b)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat + | _ => default end | ident.Z_sub_with_get_borrow => fun x x0 x1 x2 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_sub_with_get_borrow)%expr @ x @ x0 @ x1 @ x2)%expr_pat in match x with | #(idc)%expr_pat => match @@ -3372,44 +2983,26 @@ match idc in (ident t) return (Compile.value' true t) with Definitions.Z.sub_with_get_borrow_full args args0 args1 args2 in (##(a)%expr, ##(b)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ - x @ x0 @ x1 @ x2)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ x @ - x0 @ x1 @ x2)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ x @ x0 @ - x1 @ x2)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ x @ x0 @ x1 @ - x2)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_sub_with_get_borrow)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | _ => default end | ident.Z_zselect => fun x x0 x1 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_zselect)%expr @ x @ x0 @ x1)%expr_pat in match x with | #(idc)%expr_pat => match @@ -3462,29 +3055,22 @@ match idc in (ident t) return (Compile.value' true t) with | Some args1 => UnderLets.Base ##(Definitions.Z.zselect args args0 args1)%expr - | None => - UnderLets.Base - (#(ident.Z_zselect)%expr @ x @ x0 @ x1)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_zselect)%expr @ x @ x0 @ x1)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.Z_zselect)%expr @ x @ x0 @ x1)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_zselect)%expr @ x @ x0 @ x1)%expr_pat + | _ => default end - | None => - UnderLets.Base (#(ident.Z_zselect)%expr @ x @ x0 @ x1)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_zselect)%expr @ x @ x0 @ x1)%expr_pat + | _ => default end | ident.Z_add_modulo => fun x x0 x1 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_add_modulo)%expr @ x @ x0 @ x1)%expr_pat in match x with | #(idc)%expr_pat => match @@ -3537,30 +3123,22 @@ match idc in (ident t) return (Compile.value' true t) with | Some args1 => UnderLets.Base ##(Definitions.Z.add_modulo args args0 args1)%expr - | None => - UnderLets.Base - (#(ident.Z_add_modulo)%expr @ x @ x0 @ x1)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_add_modulo)%expr @ x @ x0 @ x1)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.Z_add_modulo)%expr @ x @ x0 @ x1)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_add_modulo)%expr @ x @ x0 @ x1)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.Z_add_modulo)%expr @ x @ x0 @ x1)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_add_modulo)%expr @ x @ x0 @ x1)%expr_pat + | _ => default end | ident.Z_rshi => fun x x0 x1 x2 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base + (#(ident.Z_rshi)%expr @ x @ x0 @ x1 @ x2)%expr_pat in match x with | #(idc)%expr_pat => match @@ -3635,38 +3213,25 @@ match idc in (ident t) return (Compile.value' true t) with UnderLets.Base ##(Definitions.Z.rshi args args0 args1 args2)%expr - | None => - UnderLets.Base - (#(ident.Z_rshi)%expr @ x @ x0 @ x1 @ - x2)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_rshi)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.Z_rshi)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_rshi)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.Z_rshi)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_rshi)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | _ => default end - | None => - UnderLets.Base (#(ident.Z_rshi)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_rshi)%expr @ x @ x0 @ x1 @ x2)%expr_pat + | _ => default end | ident.Z_cc_m => fun x x0 : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_cc_m)%expr @ x @ x0)%expr_pat in match x with | #(idc)%expr_pat => match @@ -3700,17 +3265,17 @@ match idc in (ident t) return (Compile.value' true t) with with | Some args0 => UnderLets.Base ##(Definitions.Z.cc_m args args0)%expr - | None => - UnderLets.Base (#(ident.Z_cc_m)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_cc_m)%expr @ x @ x0)%expr_pat + | _ => default end - | None => UnderLets.Base (#(ident.Z_cc_m)%expr @ x @ x0)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_cc_m)%expr @ x @ x0)%expr_pat + | _ => default end | ident.Z_cast range => fun x : defaults.expr (type.base base.type.Z) => + llet default := UnderLets.Base (#(ident.Z_cast range)%expr @ x)%expr_pat in match x with | #(idc)%expr_pat => match @@ -3728,12 +3293,13 @@ match idc in (ident t) return (Compile.value' true t) with | Some args => UnderLets.Base ##(ident.cast ident.cast_outside_of_range range args)%expr - | None => UnderLets.Base (#(ident.Z_cast range)%expr @ x)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_cast range)%expr @ x)%expr_pat + | _ => default end | ident.Z_cast2 range => fun x : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => + llet default := UnderLets.Base (#(ident.Z_cast2 range)%expr @ x)%expr_pat in match x with | (#(idc) @ x1 @ x0)%expr_pat => match @@ -3788,25 +3354,22 @@ match idc in (ident t) return (Compile.value' true t) with ident.cast ident.cast_outside_of_range r2 x3)) (args0, args1) in (##(a)%expr, ##(b)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.Z_cast2 range)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.Z_cast2 range)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base (#(ident.Z_cast2 range)%expr @ x)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_cast2 range)%expr @ x)%expr_pat + | _ => default end - | None => UnderLets.Base (#(ident.Z_cast2 range)%expr @ x)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.Z_cast2 range)%expr @ x)%expr_pat + | _ => default end | ident.fancy_add log2wordmax imm => fun x : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => + llet default := UnderLets.Base + (#(ident.fancy_add log2wordmax imm)%expr @ x)%expr_pat in match x with | (#(idc) @ x1 @ x0)%expr_pat => match @@ -3860,33 +3423,24 @@ match idc in (ident t) return (Compile.value' true t) with (ident.fancy_add log2wordmax imm))) (args0, args1) in (##(a)%expr, ##(b)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.fancy_add log2wordmax imm)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_add log2wordmax imm)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_add log2wordmax imm)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_add log2wordmax imm)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_add log2wordmax imm)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base (#(ident.fancy_add log2wordmax imm)%expr @ x)%expr_pat + | _ => default end | ident.fancy_addc log2wordmax imm => fun x : defaults.expr (type.base (base.type.Z * base.type.Z * base.type.Z)%etype) => + llet default := UnderLets.Base + (#(ident.fancy_addc log2wordmax imm)%expr @ x)%expr_pat in match x with | (#(idc) @ x1 @ x0)%expr_pat => match @@ -3978,52 +3532,30 @@ match idc in (ident t) return (Compile.value' true t) with log2wordmax imm))) (args1, args2, args3) in (##(a)%expr, ##(b)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.fancy_addc log2wordmax - imm)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_addc log2wordmax imm)%expr @ - x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_addc log2wordmax imm)%expr @ - x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_addc log2wordmax imm)%expr @ - x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_addc log2wordmax imm)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_addc log2wordmax imm)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_addc log2wordmax imm)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_addc log2wordmax imm)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_addc log2wordmax imm)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_addc log2wordmax imm)%expr @ x)%expr_pat + | _ => default end | ident.fancy_sub log2wordmax imm => fun x : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => + llet default := UnderLets.Base + (#(ident.fancy_sub log2wordmax imm)%expr @ x)%expr_pat in match x with | (#(idc) @ x1 @ x0)%expr_pat => match @@ -4077,33 +3609,24 @@ match idc in (ident t) return (Compile.value' true t) with (ident.fancy_sub log2wordmax imm))) (args0, args1) in (##(a)%expr, ##(b)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.fancy_sub log2wordmax imm)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_sub log2wordmax imm)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_sub log2wordmax imm)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_sub log2wordmax imm)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_sub log2wordmax imm)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base (#(ident.fancy_sub log2wordmax imm)%expr @ x)%expr_pat + | _ => default end | ident.fancy_subb log2wordmax imm => fun x : defaults.expr (type.base (base.type.Z * base.type.Z * base.type.Z)%etype) => + llet default := UnderLets.Base + (#(ident.fancy_subb log2wordmax imm)%expr @ x)%expr_pat in match x with | (#(idc) @ x1 @ x0)%expr_pat => match @@ -4195,52 +3718,30 @@ match idc in (ident t) return (Compile.value' true t) with log2wordmax imm))) (args1, args2, args3) in (##(a)%expr, ##(b)%expr)%expr_pat) - | None => - UnderLets.Base - (#(ident.fancy_subb log2wordmax - imm)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_subb log2wordmax imm)%expr @ - x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_subb log2wordmax imm)%expr @ - x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_subb log2wordmax imm)%expr @ - x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_subb log2wordmax imm)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_subb log2wordmax imm)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_subb log2wordmax imm)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_subb log2wordmax imm)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_subb log2wordmax imm)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_subb log2wordmax imm)%expr @ x)%expr_pat + | _ => default end | ident.fancy_mulll log2wordmax => fun x : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => + llet default := UnderLets.Base + (#(ident.fancy_mulll log2wordmax)%expr @ x)%expr_pat in match x with | (#(idc) @ x1 @ x0)%expr_pat => match @@ -4291,31 +3792,22 @@ match idc in (ident t) return (Compile.value' true t) with (ident.to_fancy (ident.fancy_mulll log2wordmax))) (args0, args1)%core)%expr - | None => - UnderLets.Base - (#(ident.fancy_mulll log2wordmax)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_mulll log2wordmax)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_mulll log2wordmax)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_mulll log2wordmax)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_mulll log2wordmax)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base (#(ident.fancy_mulll log2wordmax)%expr @ x)%expr_pat + | _ => default end | ident.fancy_mullh log2wordmax => fun x : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => + llet default := UnderLets.Base + (#(ident.fancy_mullh log2wordmax)%expr @ x)%expr_pat in match x with | (#(idc) @ x1 @ x0)%expr_pat => match @@ -4366,31 +3858,22 @@ match idc in (ident t) return (Compile.value' true t) with (ident.to_fancy (ident.fancy_mullh log2wordmax))) (args0, args1)%core)%expr - | None => - UnderLets.Base - (#(ident.fancy_mullh log2wordmax)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_mullh log2wordmax)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_mullh log2wordmax)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_mullh log2wordmax)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_mullh log2wordmax)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base (#(ident.fancy_mullh log2wordmax)%expr @ x)%expr_pat + | _ => default end | ident.fancy_mulhl log2wordmax => fun x : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => + llet default := UnderLets.Base + (#(ident.fancy_mulhl log2wordmax)%expr @ x)%expr_pat in match x with | (#(idc) @ x1 @ x0)%expr_pat => match @@ -4441,31 +3924,22 @@ match idc in (ident t) return (Compile.value' true t) with (ident.to_fancy (ident.fancy_mulhl log2wordmax))) (args0, args1)%core)%expr - | None => - UnderLets.Base - (#(ident.fancy_mulhl log2wordmax)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_mulhl log2wordmax)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_mulhl log2wordmax)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_mulhl log2wordmax)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_mulhl log2wordmax)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base (#(ident.fancy_mulhl log2wordmax)%expr @ x)%expr_pat + | _ => default end | ident.fancy_mulhh log2wordmax => fun x : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => + llet default := UnderLets.Base + (#(ident.fancy_mulhh log2wordmax)%expr @ x)%expr_pat in match x with | (#(idc) @ x1 @ x0)%expr_pat => match @@ -4516,31 +3990,22 @@ match idc in (ident t) return (Compile.value' true t) with (ident.to_fancy (ident.fancy_mulhh log2wordmax))) (args0, args1)%core)%expr - | None => - UnderLets.Base - (#(ident.fancy_mulhh log2wordmax)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_mulhh log2wordmax)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_mulhh log2wordmax)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_mulhh log2wordmax)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_mulhh log2wordmax)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base (#(ident.fancy_mulhh log2wordmax)%expr @ x)%expr_pat + | _ => default end | ident.fancy_rshi log2wordmax x => fun x0 : defaults.expr (type.base (base.type.Z * base.type.Z)%etype) => + llet default := UnderLets.Base + (#(ident.fancy_rshi log2wordmax x)%expr @ x0)%expr_pat in match x0 with | (#(idc) @ x2 @ x1)%expr_pat => match @@ -4591,33 +4056,23 @@ match idc in (ident t) return (Compile.value' true t) with (ident.to_fancy (ident.fancy_rshi log2wordmax x))) (args0, args1)%core)%expr - | None => - UnderLets.Base - (#(ident.fancy_rshi log2wordmax x)%expr @ x0)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_rshi log2wordmax x)%expr @ x0)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_rshi log2wordmax x)%expr @ x0)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_rshi log2wordmax x)%expr @ x0)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_rshi log2wordmax x)%expr @ x0)%expr_pat + | None => default end - | _ => - UnderLets.Base (#(ident.fancy_rshi log2wordmax x)%expr @ x0)%expr_pat + | _ => default end | ident.fancy_selc => fun x : defaults.expr (type.base (base.type.Z * base.type.Z * base.type.Z)%etype) => + llet default := UnderLets.Base (#(ident.fancy_selc)%expr @ x)%expr_pat in match x with | (#(idc) @ x1 @ x0)%expr_pat => match @@ -4705,43 +4160,32 @@ match idc in (ident t) return (Compile.value' true t) with (ident.to_fancy ident.fancy_selc)) (args1, args2, args3)%core)%expr - | None => - UnderLets.Base - (#(ident.fancy_selc)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_selc)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_selc)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_selc)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_selc)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_selc)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base (#(ident.fancy_selc)%expr @ x)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.fancy_selc)%expr @ x)%expr_pat + | _ => default end - | None => UnderLets.Base (#(ident.fancy_selc)%expr @ x)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.fancy_selc)%expr @ x)%expr_pat + | _ => default end | ident.fancy_selm log2wordmax => fun x : defaults.expr (type.base (base.type.Z * base.type.Z * base.type.Z)%etype) => + llet default := UnderLets.Base + (#(ident.fancy_selm log2wordmax)%expr @ x)%expr_pat in match x with | (#(idc) @ x1 @ x0)%expr_pat => match @@ -4830,51 +4274,31 @@ match idc in (ident t) return (Compile.value' true t) with (ident.fancy_selm log2wordmax))) (args1, args2, args3)%core)%expr - | None => - UnderLets.Base - (#(ident.fancy_selm log2wordmax)%expr @ - x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_selm log2wordmax)%expr @ - x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_selm log2wordmax)%expr @ - x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_selm log2wordmax)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_selm log2wordmax)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_selm log2wordmax)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_selm log2wordmax)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_selm log2wordmax)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_selm log2wordmax)%expr @ x)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.fancy_selm log2wordmax)%expr @ x)%expr_pat + | _ => default end | ident.fancy_sell => fun x : defaults.expr (type.base (base.type.Z * base.type.Z * base.type.Z)%etype) => + llet default := UnderLets.Base (#(ident.fancy_sell)%expr @ x)%expr_pat in match x with | (#(idc) @ x1 @ x0)%expr_pat => match @@ -4962,43 +4386,31 @@ match idc in (ident t) return (Compile.value' true t) with (ident.to_fancy ident.fancy_sell)) (args1, args2, args3)%core)%expr - | None => - UnderLets.Base - (#(ident.fancy_sell)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_sell)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_sell)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_sell)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_sell)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_sell)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base (#(ident.fancy_sell)%expr @ x)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.fancy_sell)%expr @ x)%expr_pat + | _ => default end - | None => UnderLets.Base (#(ident.fancy_sell)%expr @ x)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.fancy_sell)%expr @ x)%expr_pat + | _ => default end | ident.fancy_addm => fun x : defaults.expr (type.base (base.type.Z * base.type.Z * base.type.Z)%etype) => + llet default := UnderLets.Base (#(ident.fancy_addm)%expr @ x)%expr_pat in match x with | (#(idc) @ x1 @ x0)%expr_pat => match @@ -5086,38 +4498,25 @@ match idc in (ident t) return (Compile.value' true t) with (ident.to_fancy ident.fancy_addm)) (args1, args2, args3)%core)%expr - | None => - UnderLets.Base - (#(ident.fancy_addm)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_addm)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_addm)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_addm)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base - (#(ident.fancy_addm)%expr @ x)%expr_pat + | None => default end - | _ => - UnderLets.Base - (#(ident.fancy_addm)%expr @ x)%expr_pat + | _ => default end - | None => - UnderLets.Base (#(ident.fancy_addm)%expr @ x)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.fancy_addm)%expr @ x)%expr_pat + | _ => default end - | None => UnderLets.Base (#(ident.fancy_addm)%expr @ x)%expr_pat + | None => default end - | _ => UnderLets.Base (#(ident.fancy_addm)%expr @ x)%expr_pat + | _ => default end end : Compile.value' true t -- cgit v1.2.3