Require Import List.
Import ListNotations.
Require Import String.

(* Borrow from CompCert *)
Require Import Coqlib.
Require Import Integers.

Require Import AST.
Require Import Semantics.
Require Import Utils.
Require Import Builtins.
Require Import BuiltinSem.
Require Import Values.

Require Import Tactics.

Import HaskellListNotations.
Open Scope string.

Definition whole_prog :=
[(NonRecursive (Decl (0,"demote") DPrim)),(NonRecursive (Decl (1,"+") DPrim)),(NonRecursive (Decl (2,"-") DPrim)),(NonRecursive (Decl (3,"*") DPrim)),(NonRecursive (Decl (4,"/") DPrim)),(NonRecursive (Decl (5,"%") DPrim)),(NonRecursive (Decl (6,"^^") DPrim)),(NonRecursive (Decl (7,"lg2") DPrim)),(NonRecursive (Decl (9,"True") DPrim)),(NonRecursive (Decl (10,"False") DPrim)),(NonRecursive (Decl (11,"negate") DPrim)),(NonRecursive (Decl (12,"complement") DPrim)),(NonRecursive (Decl (13,"<") DPrim)),(NonRecursive (Decl (14,">") DPrim)),(NonRecursive (Decl (15,"<=") DPrim)),(NonRecursive (Decl (16,">=") DPrim)),(NonRecursive (Decl (17,"==") DPrim)),(NonRecursive (Decl (18,"!=") DPrim)),(NonRecursive (Decl (19,"===") (DExpr (ETAbs (87,"a") (ETAbs (88,"b") (EAbs (89,"f") (EAbs (90,"g") (EAbs (91,"x") (EApp (EApp (ETApp (EVar (17,"==")) (TVar (TVBound 31 KType))) (EApp (EVar (89,"f")) (EVar (91,"x")))) (EApp (EVar (90,"g")) (EVar (91,"x")))))))))))),(NonRecursive (Decl (20,"!==") (DExpr (ETAbs (92,"a") (ETAbs (93,"b") (EAbs (94,"f") (EAbs (95,"g") (EAbs (96,"x") (EApp (EApp (ETApp (EVar (18,"!=")) (TVar (TVBound 41 KType))) (EApp (EVar (94,"f")) (EVar (96,"x")))) (EApp (EVar (95,"g")) (EVar (96,"x")))))))))))),(NonRecursive (Decl (21,"min") (DExpr (ETAbs (97,"a") (EAbs (98,"x") (EAbs (99,"y") (EIf (EApp (EApp (ETApp (EVar (13,"<")) (TVar (TVBound 50 KType))) (EVar (98,"x"))) (EVar (99,"y"))) (EVar (98,"x")) (EVar (99,"y"))))))))),(NonRecursive (Decl (22,"max") (DExpr (ETAbs (100,"a") (EAbs (101,"x") (EAbs (102,"y") (EIf (EApp (EApp (ETApp (EVar (14,">")) (TVar (TVBound 56 KType))) (EVar (101,"x"))) (EVar (102,"y"))) (EVar (101,"x")) (EVar (102,"y"))))))))),(NonRecursive (Decl (23,"/\\") (DExpr (EAbs (103,"x") (EAbs (104,"y") (EIf (EVar (103,"x")) (EVar (104,"y")) (EVar (10,"False")))))))),(NonRecursive (Decl (24,"\\/") (DExpr (EAbs (105,"x") (EAbs (106,"y") (EIf (EVar (105,"x")) (EVar (9,"True")) (EVar (106,"y")))))))),(NonRecursive (Decl (25,"==>") (DExpr (EAbs (107,"a") (EAbs (108,"b") (EIf (EVar (107,"a")) (EVar (108,"b")) (EVar (9,"True")))))))),(NonRecursive (Decl (26,"&&") DPrim)),(NonRecursive (Decl (27,"||") DPrim)),(NonRecursive (Decl (28,"^") DPrim)),(NonRecursive (Decl (29,"zero") DPrim)),(NonRecursive (Decl (30,"<<") DPrim)),(NonRecursive (Decl (31,">>") DPrim)),(NonRecursive (Decl (32,"<<<") DPrim)),(NonRecursive (Decl (33,">>>") DPrim)),(NonRecursive (Decl (34,"#") DPrim)),(NonRecursive (Decl (35,"splitAt") DPrim)),(NonRecursive (Decl (36,"join") DPrim)),(NonRecursive (Decl (37,"split") DPrim)),(NonRecursive (Decl (38,"reverse") DPrim)),(NonRecursive (Decl (39,"transpose") DPrim)),(NonRecursive (Decl (40,"@") DPrim)),(NonRecursive (Decl (41,"@@") DPrim)),(NonRecursive (Decl (42,"!") DPrim)),(NonRecursive (Decl (43,"!!") DPrim)),(NonRecursive (Decl (44,"update") DPrim)),(NonRecursive (Decl (45,"updateEnd") DPrim)),(NonRecursive (Decl (46,"updates") (DExpr (ETAbs (162,"a") (ETAbs (163,"b") (ETAbs (164,"c") (ETAbs (165,"d") (EAbs (166,"xs0") (EAbs (167,"idxs") (EAbs (168,"vals") (EWhere (EApp (EApp (ETApp (ETApp (ETApp (EVar (42,"!")) (TCon (TF TCAdd) [TCon (TC (TCNum 1)) [],TVar (TVBound 124 KNum)])) (TCon (TC TCSeq) [TVar (TVBound 121 KNum),TVar (TVBound 122 KType)])) (TCon (TC (TCNum 0)) [])) (EVar (169,"xss"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 0)) [])) (TCon (TC (TCNum 0)) []))) [(Recursive [(Decl (169,"xss") (DExpr (EApp (EApp (ETApp (ETApp (ETApp (EVar (34,"#")) (TCon (TC (TCNum 1)) [])) (TVar (TVBound 124 KNum))) (TCon (TC TCSeq) [TVar (TVBound 121 KNum),TVar (TVBound 122 KType)])) (EList [(EVar (166,"xs0"))])) (EComp (EApp (EApp (EApp (ETApp (ETApp (ETApp (EVar (44,"update")) (TVar (TVBound 121 KNum))) (TVar (TVBound 122 KType))) (TVar (TVBound 123 KNum))) (EVar (170,"xs"))) (EVar (171,"i"))) (EVar (172,"b"))) [[(From (170,"xs") (EVar (169,"xss")))],[(From (171,"i") (EVar (167,"idxs")))],[(From (172,"b") (EVar (168,"vals")))]]))))])]))))))))))),(NonRecursive (Decl (47,"updatesEnd") (DExpr (ETAbs (173,"a") (ETAbs (174,"b") (ETAbs (175,"c") (ETAbs (176,"d") (EAbs (177,"xs0") (EAbs (178,"idxs") (EAbs (179,"vals") (EWhere (EApp (EApp (ETApp (ETApp (ETApp (EVar (42,"!")) (TCon (TF TCAdd) [TCon (TC (TCNum 1)) [],TVar (TVBound 159 KNum)])) (TCon (TC TCSeq) [TVar (TVBound 156 KNum),TVar (TVBound 157 KType)])) (TCon (TC (TCNum 0)) [])) (EVar (180,"xss"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 0)) [])) (TCon (TC (TCNum 0)) []))) [(Recursive [(Decl (180,"xss") (DExpr (EApp (EApp (ETApp (ETApp (ETApp (EVar (34,"#")) (TCon (TC (TCNum 1)) [])) (TVar (TVBound 159 KNum))) (TCon (TC TCSeq) [TVar (TVBound 156 KNum),TVar (TVBound 157 KType)])) (EList [(EVar (177,"xs0"))])) (EComp (EApp (EApp (EApp (ETApp (ETApp (ETApp (EVar (45,"updateEnd")) (TVar (TVBound 156 KNum))) (TVar (TVBound 157 KType))) (TVar (TVBound 158 KNum))) (EVar (181,"xs"))) (EVar (182,"i"))) (EVar (183,"b"))) [[(From (181,"xs") (EVar (180,"xss")))],[(From (182,"i") (EVar (178,"idxs")))],[(From (183,"b") (EVar (179,"vals")))]]))))])]))))))))))),(NonRecursive (Decl (48,"fromThen") DPrim)),(NonRecursive (Decl (49,"fromTo") DPrim)),(NonRecursive (Decl (50,"fromThenTo") DPrim)),(NonRecursive (Decl (51,"infFrom") DPrim)),(NonRecursive (Decl (52,"infFromThen") DPrim)),(NonRecursive (Decl (53,"error") DPrim)),(NonRecursive (Decl (54,"pmult") DPrim)),(NonRecursive (Decl (55,"pdiv") DPrim)),(NonRecursive (Decl (56,"pmod") DPrim)),(NonRecursive (Decl (57,"random") DPrim)),(NonRecursive (Decl (61,"take") (DExpr (ETAbs (209,"front") (ETAbs (210,"back") (ETAbs (211,"elem") (EAbs (212,"__p1") (EWhere (EVar (214,"x")) [(NonRecursive (Decl (213,"__p2") (DExpr (EApp (ETApp (ETApp (ETApp (EVar (35,"splitAt")) (TVar (TVBound 214 KNum))) (TVar (TVBound 215 KNum))) (TVar (TVBound 216 KType))) (EVar (212,"__p1")))))),(NonRecursive (Decl (214,"x") (DExpr (ESel (EVar (213,"__p2")) (TupleSel 0))))),(NonRecursive (Decl (215,"__p0") (DExpr (ESel (EVar (213,"__p2")) (TupleSel 1)))))])))))))),(NonRecursive (Decl (62,"drop") (DExpr (ETAbs (216,"front") (ETAbs (217,"back") (ETAbs (218,"elem") (EAbs (219,"__p4") (EWhere (EVar (222,"y")) [(NonRecursive (Decl (220,"__p5") (DExpr (EApp (ETApp (ETApp (ETApp (EVar (35,"splitAt")) (TVar (TVBound 231 KNum))) (TVar (TVBound 232 KNum))) (TVar (TVBound 233 KType))) (EVar (219,"__p4")))))),(NonRecursive (Decl (221,"__p3") (DExpr (ESel (EVar (220,"__p5")) (TupleSel 0))))),(NonRecursive (Decl (222,"y") (DExpr (ESel (EVar (220,"__p5")) (TupleSel 1)))))])))))))),(NonRecursive (Decl (63,"tail") (DExpr (ETAbs (223,"a") (ETAbs (224,"b") (EAbs (225,"xs") (EApp (ETApp (ETApp (ETApp (EVar (62,"drop")) (TCon (TC (TCNum 1)) [])) (TVar (TVBound 249 KNum))) (TVar (TVBound 250 KType))) (EVar (225,"xs"))))))))),(NonRecursive (Decl (64,"width") (DExpr (ETAbs (226,"bits") (ETAbs (227,"len") (ETAbs (228,"elem") (EAbs (229,"__p6") (ETApp (ETApp (EVar (0,"demote")) (TVar (TVBound 256 KNum))) (TVar (TVBound 255 KNum)))))))))),(NonRecursive (Decl (65,"undefined") (DExpr (ETAbs (230,"a") (EApp (ETApp (ETApp (EVar (53,"error")) (TVar (TVBound 260 KType))) (TCon (TC (TCNum 9)) [])) (EList [(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 117)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 100)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 101)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 101)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 100)) [])) (TCon (TC (TCNum 8)) []))])))))),(NonRecursive (Decl (66,"groupBy") (DExpr (ETAbs (231,"each") (ETAbs (232,"parts") (ETAbs (233,"elem") (ETApp (ETApp (ETApp (EVar (37,"split")) (TVar (TVBound 266 KNum))) (TVar (TVBound 265 KNum))) (TVar (TVBound 267 KType))))))))),(NonRecursive (Decl (68,"trace") DPrim)),(NonRecursive (Decl (69,"traceVal") (DExpr (ETAbs (238,"n") (ETAbs (239,"a") (EAbs (240,"msg") (EAbs (241,"x") (EApp (EApp (EApp (ETApp (ETApp (ETApp (EVar (68,"trace")) (TVar (TVBound 273 KNum))) (TVar (TVBound 274 KType))) (TVar (TVBound 274 KType))) (EVar (240,"msg"))) (EVar (241,"x"))) (EVar (241,"x")))))))))),(NonRecursive (Decl (242,"Ch") (DExpr (EAbs (268,"x") (EAbs (269,"y") (EAbs (270,"z") (EApp (EApp (ETApp (EVar (28,"^")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (EVar (26,"&&")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EVar (268,"x"))) (EVar (269,"y")))) (EApp (EApp (ETApp (EVar (26,"&&")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (ETApp (EVar (12,"complement")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EVar (268,"x")))) (EVar (270,"z")))))))))),(NonRecursive (Decl (243,"Maj") (DExpr (EAbs (271,"x") (EAbs (272,"y") (EAbs (273,"z") (EApp (EApp (ETApp (EVar (28,"^")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (EVar (28,"^")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (EVar (26,"&&")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EVar (271,"x"))) (EVar (272,"y")))) (EApp (EApp (ETApp (EVar (26,"&&")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EVar (271,"x"))) (EVar (273,"z"))))) (EApp (EApp (ETApp (EVar (26,"&&")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EVar (272,"y"))) (EVar (273,"z")))))))))),(NonRecursive (Decl (244,"S0") (DExpr (EAbs (274,"x") (EApp (EApp (ETApp (EVar (28,"^")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (EVar (28,"^")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (ETApp (ETApp (EVar (33,">>>")) (TCon (TC (TCNum 32)) [])) (TCon (TC (TCNum 2)) [])) (TCon (TC TCBit) [])) (EVar (274,"x"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 2)) [])) (TCon (TC (TCNum 2)) [])))) (EApp (EApp (ETApp (ETApp (ETApp (EVar (33,">>>")) (TCon (TC (TCNum 32)) [])) (TCon (TC (TCNum 4)) [])) (TCon (TC TCBit) [])) (EVar (274,"x"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 13)) [])) (TCon (TC (TCNum 4)) []))))) (EApp (EApp (ETApp (ETApp (ETApp (EVar (33,">>>")) (TCon (TC (TCNum 32)) [])) (TCon (TC (TCNum 5)) [])) (TCon (TC TCBit) [])) (EVar (274,"x"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 22)) [])) (TCon (TC (TCNum 5)) [])))))))),(NonRecursive (Decl (245,"S1") (DExpr (EAbs (275,"x") (EApp (EApp (ETApp (EVar (28,"^")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (EVar (28,"^")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (ETApp (ETApp (EVar (33,">>>")) (TCon (TC (TCNum 32)) [])) (TCon (TC (TCNum 3)) [])) (TCon (TC TCBit) [])) (EVar (275,"x"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 6)) [])) (TCon (TC (TCNum 3)) [])))) (EApp (EApp (ETApp (ETApp (ETApp (EVar (33,">>>")) (TCon (TC (TCNum 32)) [])) (TCon (TC (TCNum 4)) [])) (TCon (TC TCBit) [])) (EVar (275,"x"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 11)) [])) (TCon (TC (TCNum 4)) []))))) (EApp (EApp (ETApp (ETApp (ETApp (EVar (33,">>>")) (TCon (TC (TCNum 32)) [])) (TCon (TC (TCNum 5)) [])) (TCon (TC TCBit) [])) (EVar (275,"x"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 25)) [])) (TCon (TC (TCNum 5)) [])))))))),(NonRecursive (Decl (246,"s0") (DExpr (EAbs (276,"x") (EApp (EApp (ETApp (EVar (28,"^")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (EVar (28,"^")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (ETApp (ETApp (EVar (33,">>>")) (TCon (TC (TCNum 32)) [])) (TCon (TC (TCNum 3)) [])) (TCon (TC TCBit) [])) (EVar (276,"x"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 7)) [])) (TCon (TC (TCNum 3)) [])))) (EApp (EApp (ETApp (ETApp (ETApp (EVar (33,">>>")) (TCon (TC (TCNum 32)) [])) (TCon (TC (TCNum 5)) [])) (TCon (TC TCBit) [])) (EVar (276,"x"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 18)) [])) (TCon (TC (TCNum 5)) []))))) (EApp (EApp (ETApp (ETApp (ETApp (EVar (31,">>")) (TCon (TC (TCNum 32)) [])) (TCon (TC (TCNum 2)) [])) (TCon (TC TCBit) [])) (EVar (276,"x"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 3)) [])) (TCon (TC (TCNum 2)) [])))))))),(NonRecursive (Decl (247,"s1") (DExpr (EAbs (277,"x") (EApp (EApp (ETApp (EVar (28,"^")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (EVar (28,"^")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (ETApp (ETApp (EVar (33,">>>")) (TCon (TC (TCNum 32)) [])) (TCon (TC (TCNum 5)) [])) (TCon (TC TCBit) [])) (EVar (277,"x"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 17)) [])) (TCon (TC (TCNum 5)) [])))) (EApp (EApp (ETApp (ETApp (ETApp (EVar (33,">>>")) (TCon (TC (TCNum 32)) [])) (TCon (TC (TCNum 5)) [])) (TCon (TC TCBit) [])) (EVar (277,"x"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 19)) [])) (TCon (TC (TCNum 5)) []))))) (EApp (EApp (ETApp (ETApp (ETApp (EVar (31,">>")) (TCon (TC (TCNum 32)) [])) (TCon (TC (TCNum 4)) [])) (TCon (TC TCBit) [])) (EVar (277,"x"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 10)) [])) (TCon (TC (TCNum 4)) [])))))))),(NonRecursive (Decl (248,"K") (DExpr (EList [(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1116352408)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1899447441)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 3049323471)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 3921009573)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 961987163)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1508970993)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 2453635748)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 2870763221)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 3624381080)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 310598401)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 607225278)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1426881987)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1925078388)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 2162078206)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 2614888103)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 3248222580)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 3835390401)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 4022224774)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 264347078)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 604807628)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 770255983)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1249150122)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1555081692)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1996064986)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 2554220882)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 2821834349)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 2952996808)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 3210313671)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 3336571891)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 3584528711)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 113926993)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 338241895)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 666307205)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 773529912)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1294757372)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1396182291)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1695183700)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1986661051)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 2177026350)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 2456956037)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 2730485921)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 2820302411)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 3259730800)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 3345764771)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 3516065817)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 3600352804)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 4094571909)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 275423344)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 430227734)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 506948616)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 659060556)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 883997877)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 958139571)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1322822218)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1537002063)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1747873779)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1955562222)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 2024104815)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 2227730452)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 2361852424)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 2428436474)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 2756734187)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 3204031479)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 3329325298)) [])) (TCon (TC (TCNum 32)) []))])))),(NonRecursive (Decl (249,"preprocess") (DExpr (ETAbs (278,"msgLen") (ETAbs (279,"contentLen") (ETAbs (280,"chunks") (ETAbs (281,"padding") (EAbs (282,"msg") (EApp (ETApp (ETApp (ETApp (EVar (37,"split")) (TVar (TVBound 405 KNum))) (TCon (TC (TCNum 512)) [])) (TCon (TC TCBit) [])) (EApp (EApp (ETApp (ETApp (ETApp (EVar (34,"#")) (TVar (TVBound 403 KNum))) (TCon (TF TCAdd) [TCon (TC (TCNum 65)) [],TVar (TVBound 406 KNum)])) (TCon (TC TCBit) [])) (EVar (282,"msg"))) (EApp (EApp (ETApp (ETApp (ETApp (EVar (34,"#")) (TCon (TC (TCNum 1)) [])) (TCon (TF TCAdd) [TCon (TC (TCNum 64)) [],TVar (TVBound 406 KNum)])) (TCon (TC TCBit) [])) (EList [(EVar (9,"True"))])) (EApp (EApp (ETApp (ETApp (ETApp (EVar (34,"#")) (TVar (TVBound 406 KNum))) (TCon (TC (TCNum 64)) [])) (TCon (TC TCBit) [])) (ETApp (EVar (29,"zero")) (TCon (TC TCSeq) [TVar (TVBound 406 KNum),TCon (TC TCBit) []]))) (ETApp (ETApp (EVar (0,"demote")) (TVar (TVBound 403 KNum))) (TCon (TC (TCNum 64)) [])))))))))))))),(NonRecursive (Decl (250,"H0") (DExpr (EList [(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1779033703)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 3144134277)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1013904242)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 2773480762)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1359893119)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 2600822924)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 528734635)) [])) (TCon (TC (TCNum 32)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1541459225)) [])) (TCon (TC (TCNum 32)) []))])))),(NonRecursive (Decl (251,"SHA256MessageSchedule") (DExpr (EAbs (283,"M") (EWhere (EVar (284,"W")) [(Recursive [(Decl (284,"W") (DExpr (EApp (EApp (ETApp (ETApp (ETApp (EVar (34,"#")) (TCon (TC (TCNum 16)) [])) (TCon (TC (TCNum 48)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EVar (283,"M"))) (EComp (EApp (EApp (ETApp (EVar (1,"+")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (EVar (1,"+")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (EVar (1,"+")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EVar (247,"s1")) (EApp (EApp (ETApp (ETApp (ETApp (EVar (40,"@")) (TCon (TC (TCNum 64)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 8)) [])) (EVar (284,"W"))) (EApp (EApp (ETApp (EVar (2,"-")) (TCon (TC TCSeq) [TCon (TC (TCNum 8)) [],TCon (TC TCBit) []])) (EVar (285,"j"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 2)) [])) (TCon (TC (TCNum 8)) [])))))) (EApp (EApp (ETApp (ETApp (ETApp (EVar (40,"@")) (TCon (TC (TCNum 64)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 8)) [])) (EVar (284,"W"))) (EApp (EApp (ETApp (EVar (2,"-")) (TCon (TC TCSeq) [TCon (TC (TCNum 8)) [],TCon (TC TCBit) []])) (EVar (285,"j"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 7)) [])) (TCon (TC (TCNum 8)) [])))))) (EApp (EVar (246,"s0")) (EApp (EApp (ETApp (ETApp (ETApp (EVar (40,"@")) (TCon (TC (TCNum 64)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 8)) [])) (EVar (284,"W"))) (EApp (EApp (ETApp (EVar (2,"-")) (TCon (TC TCSeq) [TCon (TC (TCNum 8)) [],TCon (TC TCBit) []])) (EVar (285,"j"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 15)) [])) (TCon (TC (TCNum 8)) []))))))) (EApp (EApp (ETApp (ETApp (ETApp (EVar (40,"@")) (TCon (TC (TCNum 64)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 8)) [])) (EVar (284,"W"))) (EApp (EApp (ETApp (EVar (2,"-")) (TCon (TC TCSeq) [TCon (TC (TCNum 8)) [],TCon (TC TCBit) []])) (EVar (285,"j"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 16)) [])) (TCon (TC (TCNum 8)) []))))) [[(From (285,"j") (ETApp (ETApp (ETApp (EVar (49,"fromTo")) (TCon (TC (TCNum 16)) [])) (TCon (TC (TCNum 63)) [])) (TCon (TC (TCNum 8)) [])))]]))))])]))))),(NonRecursive (Decl (252,"SHA256Compress") (DExpr (EAbs (286,"H") (EAbs (287,"W") (EWhere (EList [(EApp (EApp (ETApp (EVar (1,"+")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (ETApp (ETApp (EVar (42,"!")) (TCon (TC (TCNum 65)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 0)) [])) (EVar (297,"as"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 0)) [])) (TCon (TC (TCNum 0)) [])))) (EApp (EApp (ETApp (ETApp (ETApp (EVar (40,"@")) (TCon (TC (TCNum 8)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 0)) [])) (EVar (286,"H"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 0)) [])) (TCon (TC (TCNum 0)) [])))),(EApp (EApp (ETApp (EVar (1,"+")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (ETApp (ETApp (EVar (42,"!")) (TCon (TC (TCNum 65)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 0)) [])) (EVar (296,"bs"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 0)) [])) (TCon (TC (TCNum 0)) [])))) (EApp (EApp (ETApp (ETApp (ETApp (EVar (40,"@")) (TCon (TC (TCNum 8)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 1)) [])) (EVar (286,"H"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1)) [])) (TCon (TC (TCNum 1)) [])))),(EApp (EApp (ETApp (EVar (1,"+")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (ETApp (ETApp (EVar (42,"!")) (TCon (TC (TCNum 65)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 0)) [])) (EVar (295,"cs"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 0)) [])) (TCon (TC (TCNum 0)) [])))) (EApp (EApp (ETApp (ETApp (ETApp (EVar (40,"@")) (TCon (TC (TCNum 8)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 2)) [])) (EVar (286,"H"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 2)) [])) (TCon (TC (TCNum 2)) [])))),(EApp (EApp (ETApp (EVar (1,"+")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (ETApp (ETApp (EVar (42,"!")) (TCon (TC (TCNum 65)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 0)) [])) (EVar (294,"ds"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 0)) [])) (TCon (TC (TCNum 0)) [])))) (EApp (EApp (ETApp (ETApp (ETApp (EVar (40,"@")) (TCon (TC (TCNum 8)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 2)) [])) (EVar (286,"H"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 3)) [])) (TCon (TC (TCNum 2)) [])))),(EApp (EApp (ETApp (EVar (1,"+")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (ETApp (ETApp (EVar (42,"!")) (TCon (TC (TCNum 65)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 0)) [])) (EVar (293,"es"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 0)) [])) (TCon (TC (TCNum 0)) [])))) (EApp (EApp (ETApp (ETApp (ETApp (EVar (40,"@")) (TCon (TC (TCNum 8)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 3)) [])) (EVar (286,"H"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 4)) [])) (TCon (TC (TCNum 3)) [])))),(EApp (EApp (ETApp (EVar (1,"+")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (ETApp (ETApp (EVar (42,"!")) (TCon (TC (TCNum 65)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 0)) [])) (EVar (292,"fs"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 0)) [])) (TCon (TC (TCNum 0)) [])))) (EApp (EApp (ETApp (ETApp (ETApp (EVar (40,"@")) (TCon (TC (TCNum 8)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 3)) [])) (EVar (286,"H"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 5)) [])) (TCon (TC (TCNum 3)) [])))),(EApp (EApp (ETApp (EVar (1,"+")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (ETApp (ETApp (EVar (42,"!")) (TCon (TC (TCNum 65)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 0)) [])) (EVar (291,"gs"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 0)) [])) (TCon (TC (TCNum 0)) [])))) (EApp (EApp (ETApp (ETApp (ETApp (EVar (40,"@")) (TCon (TC (TCNum 8)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 3)) [])) (EVar (286,"H"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 6)) [])) (TCon (TC (TCNum 3)) [])))),(EApp (EApp (ETApp (EVar (1,"+")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (ETApp (ETApp (EVar (42,"!")) (TCon (TC (TCNum 65)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 0)) [])) (EVar (290,"hs"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 0)) [])) (TCon (TC (TCNum 0)) [])))) (EApp (EApp (ETApp (ETApp (ETApp (EVar (40,"@")) (TCon (TC (TCNum 8)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 3)) [])) (EVar (286,"H"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 7)) [])) (TCon (TC (TCNum 3)) []))))]) [(Recursive [(Decl (288,"T1") (DExpr (EComp (EApp (EApp (ETApp (EVar (1,"+")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (EVar (1,"+")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (EVar (1,"+")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (EVar (1,"+")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EVar (298,"h"))) (EApp (EVar (245,"S1")) (EVar (299,"e"))))) (EApp (EApp (EApp (EVar (242,"Ch")) (EVar (299,"e"))) (EVar (300,"f"))) (EVar (301,"g"))))) (EVar (302,"k")))) (EVar (303,"w"))) [[(From (298,"h") (EVar (290,"hs")))],[(From (299,"e") (EVar (293,"es")))],[(From (300,"f") (EVar (292,"fs")))],[(From (301,"g") (EVar (291,"gs")))],[(From (302,"k") (EVar (248,"K")))],[(From (303,"w") (EVar (287,"W")))]]))),(Decl (289,"T2") (DExpr (EComp (EApp (EApp (ETApp (EVar (1,"+")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EVar (244,"S0")) (EVar (304,"a")))) (EApp (EApp (EApp (EVar (243,"Maj")) (EVar (304,"a"))) (EVar (305,"b"))) (EVar (306,"c")))) [[(From (304,"a") (EVar (297,"as")))],[(From (305,"b") (EVar (296,"bs")))],[(From (306,"c") (EVar (295,"cs")))]]))),(Decl (297,"as") (DExpr (EApp (ETApp (ETApp (ETApp (EVar (61,"take")) (TCon (TC (TCNum 65)) [])) (TCon (TC (TCNum 0)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (ETApp (ETApp (EVar (34,"#")) (TCon (TC (TCNum 1)) [])) (TCon (TC (TCNum 64)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EList [(EApp (EApp (ETApp (ETApp (ETApp (EVar (40,"@")) (TCon (TC (TCNum 8)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 0)) [])) (EVar (286,"H"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 0)) [])) (TCon (TC (TCNum 0)) [])))])) (EComp (EApp (EApp (ETApp (EVar (1,"+")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EVar (309,"t1"))) (EVar (310,"t2"))) [[(From (309,"t1") (EVar (288,"T1")))],[(From (310,"t2") (EVar (289,"T2")))]]))))),(Decl (296,"bs") (DExpr (EApp (ETApp (ETApp (ETApp (EVar (61,"take")) (TCon (TC (TCNum 65)) [])) (TCon (TC (TCNum 1)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (ETApp (ETApp (EVar (34,"#")) (TCon (TC (TCNum 1)) [])) (TCon (TC (TCNum 65)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EList [(EApp (EApp (ETApp (ETApp (ETApp (EVar (40,"@")) (TCon (TC (TCNum 8)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 1)) [])) (EVar (286,"H"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1)) [])) (TCon (TC (TCNum 1)) [])))])) (EVar (297,"as")))))),(Decl (295,"cs") (DExpr (EApp (ETApp (ETApp (ETApp (EVar (61,"take")) (TCon (TC (TCNum 65)) [])) (TCon (TC (TCNum 1)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (ETApp (ETApp (EVar (34,"#")) (TCon (TC (TCNum 1)) [])) (TCon (TC (TCNum 65)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EList [(EApp (EApp (ETApp (ETApp (ETApp (EVar (40,"@")) (TCon (TC (TCNum 8)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 2)) [])) (EVar (286,"H"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 2)) [])) (TCon (TC (TCNum 2)) [])))])) (EVar (296,"bs")))))),(Decl (294,"ds") (DExpr (EApp (ETApp (ETApp (ETApp (EVar (61,"take")) (TCon (TC (TCNum 65)) [])) (TCon (TC (TCNum 1)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (ETApp (ETApp (EVar (34,"#")) (TCon (TC (TCNum 1)) [])) (TCon (TC (TCNum 65)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EList [(EApp (EApp (ETApp (ETApp (ETApp (EVar (40,"@")) (TCon (TC (TCNum 8)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 2)) [])) (EVar (286,"H"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 3)) [])) (TCon (TC (TCNum 2)) [])))])) (EVar (295,"cs")))))),(Decl (293,"es") (DExpr (EApp (ETApp (ETApp (ETApp (EVar (61,"take")) (TCon (TC (TCNum 65)) [])) (TCon (TC (TCNum 0)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (ETApp (ETApp (EVar (34,"#")) (TCon (TC (TCNum 1)) [])) (TCon (TC (TCNum 64)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EList [(EApp (EApp (ETApp (ETApp (ETApp (EVar (40,"@")) (TCon (TC (TCNum 8)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 3)) [])) (EVar (286,"H"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 4)) [])) (TCon (TC (TCNum 3)) [])))])) (EComp (EApp (EApp (ETApp (EVar (1,"+")) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EVar (307,"d"))) (EVar (308,"t1"))) [[(From (307,"d") (EVar (294,"ds")))],[(From (308,"t1") (EVar (288,"T1")))]]))))),(Decl (292,"fs") (DExpr (EApp (ETApp (ETApp (ETApp (EVar (61,"take")) (TCon (TC (TCNum 65)) [])) (TCon (TC (TCNum 1)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (ETApp (ETApp (EVar (34,"#")) (TCon (TC (TCNum 1)) [])) (TCon (TC (TCNum 65)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EList [(EApp (EApp (ETApp (ETApp (ETApp (EVar (40,"@")) (TCon (TC (TCNum 8)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 3)) [])) (EVar (286,"H"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 5)) [])) (TCon (TC (TCNum 3)) [])))])) (EVar (293,"es")))))),(Decl (291,"gs") (DExpr (EApp (ETApp (ETApp (ETApp (EVar (61,"take")) (TCon (TC (TCNum 65)) [])) (TCon (TC (TCNum 1)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (ETApp (ETApp (EVar (34,"#")) (TCon (TC (TCNum 1)) [])) (TCon (TC (TCNum 65)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EList [(EApp (EApp (ETApp (ETApp (ETApp (EVar (40,"@")) (TCon (TC (TCNum 8)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 3)) [])) (EVar (286,"H"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 6)) [])) (TCon (TC (TCNum 3)) [])))])) (EVar (292,"fs")))))),(Decl (290,"hs") (DExpr (EApp (ETApp (ETApp (ETApp (EVar (61,"take")) (TCon (TC (TCNum 65)) [])) (TCon (TC (TCNum 1)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EApp (EApp (ETApp (ETApp (ETApp (EVar (34,"#")) (TCon (TC (TCNum 1)) [])) (TCon (TC (TCNum 65)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (EList [(EApp (EApp (ETApp (ETApp (ETApp (EVar (40,"@")) (TCon (TC (TCNum 8)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 3)) [])) (EVar (286,"H"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 7)) [])) (TCon (TC (TCNum 3)) [])))])) (EVar (291,"gs"))))))])])))))),(NonRecursive (Decl (253,"SHA256Block") (DExpr (EAbs (311,"H") (EAbs (312,"M") (EApp (EApp (EVar (252,"SHA256Compress")) (EVar (311,"H"))) (EApp (EVar (251,"SHA256MessageSchedule")) (EVar (312,"M"))))))))),(NonRecursive (Decl (254,"SHA256'") (DExpr (ETAbs (313,"a") (EAbs (314,"blocks") (EWhere (EApp (EApp (ETApp (ETApp (ETApp (EVar (42,"!")) (TCon (TF TCAdd) [TCon (TC (TCNum 1)) [],TVar (TVBound 799 KNum)])) (TCon (TC TCSeq) [TCon (TC (TCNum 8)) [],TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []]])) (TCon (TC (TCNum 0)) [])) (EVar (315,"hash"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 0)) [])) (TCon (TC (TCNum 0)) []))) [(Recursive [(Decl (315,"hash") (DExpr (EApp (EApp (ETApp (ETApp (ETApp (EVar (34,"#")) (TCon (TC (TCNum 1)) [])) (TVar (TVBound 799 KNum))) (TCon (TC TCSeq) [TCon (TC (TCNum 8)) [],TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []]])) (EList [(EVar (250,"H0"))])) (EComp (EApp (EApp (EVar (253,"SHA256Block")) (EVar (316,"h"))) (EVar (317,"b"))) [[(From (316,"h") (EVar (315,"hash")))],[(From (317,"b") (EVar (314,"blocks")))]]))))])])))))),(NonRecursive (Decl (255,"SHA256") (DExpr (ETAbs (318,"a") (EAbs (319,"msg") (EApp (ETApp (ETApp (ETApp (EVar (36,"join")) (TCon (TC (TCNum 8)) [])) (TCon (TC (TCNum 32)) [])) (TCon (TC TCBit) [])) (EApp (ETApp (EVar (254,"SHA256'")) (TCon (TF TCDiv) [TCon (TF TCAdd) [TCon (TC (TCNum 576)) [],TCon (TF TCMul) [TCon (TC (TCNum 8)) [],TVar (TVBound 823 KNum)]],TCon (TC (TCNum 512)) []])) (EComp (EApp (ETApp (ETApp (ETApp (EVar (37,"split")) (TCon (TC (TCNum 16)) [])) (TCon (TC (TCNum 32)) [])) (TCon (TC TCBit) [])) (EVar (320,"x"))) [[(From (320,"x") (EApp (ETApp (ETApp (ETApp (ETApp (EVar (249,"preprocess")) (TCon (TF TCMul) [TCon (TC (TCNum 8)) [],TVar (TVBound 823 KNum)])) (TCon (TF TCAdd) [TCon (TC (TCNum 65)) [],TCon (TF TCMul) [TCon (TC (TCNum 8)) [],TVar (TVBound 823 KNum)]])) (TCon (TF TCDiv) [TCon (TF TCAdd) [TCon (TC (TCNum 576)) [],TCon (TF TCMul) [TCon (TC (TCNum 8)) [],TVar (TVBound 823 KNum)]],TCon (TC (TCNum 512)) []])) (TCon (TF TCMod) [TCon (TF TCSub) [TCon (TC (TCNum 512)) [],TCon (TF TCMod) [TCon (TF TCAdd) [TCon (TC (TCNum 65)) [],TCon (TF TCMul) [TCon (TC (TCNum 8)) [],TVar (TVBound 823 KNum)]],TCon (TC (TCNum 512)) []]],TCon (TC (TCNum 512)) []])) (EApp (ETApp (ETApp (ETApp (EVar (36,"join")) (TVar (TVBound 823 KNum))) (TCon (TC (TCNum 8)) [])) (TCon (TC TCBit) [])) (EVar (319,"msg")))))]])))))))),(NonRecursive (Decl (257,"kats") (DExpr (EList [(ETuple [(EApp (ETApp (EVar (255,"SHA256")) (TCon (TC (TCNum 56)) [])) (EList [(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 97)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 98)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 99)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 100)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 98)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 99)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 100)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 101)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 99)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 100)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 101)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 100)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 101)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 103)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 101)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 103)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 103)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 103)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 111)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 111)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 112)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 111)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 112)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 113)) [])) (TCon (TC (TCNum 8)) []))])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 16533122207477069341668099752125637525043274373652441057433006174010909329089)) [])) (TCon (TC (TCNum 256)) []))]),(ETuple [(EApp (ETApp (EVar (255,"SHA256")) (TCon (TC (TCNum 0)) [])) (EList [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102987336249554097029535212322581322789799900648198034993379397001115665086549)) [])) (TCon (TC (TCNum 256)) []))]),(ETuple [(EApp (ETApp (EVar (255,"SHA256")) (TCon (TC (TCNum 112)) [])) (EList [(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 97)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 98)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 99)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 100)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 101)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 103)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 98)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 99)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 100)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 101)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 103)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 99)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 100)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 101)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 103)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 100)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 101)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 103)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 101)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 103)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 103)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 103)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 111)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 111)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 112)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 111)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 112)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 113)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 111)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 112)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 113)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 114)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 111)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 112)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 113)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 114)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 115)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 111)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 112)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 113)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 114)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 115)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 116)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 111)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 112)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 113)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 114)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 115)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 116)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 117)) [])) (TCon (TC (TCNum 8)) []))])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 93789699093071375310876825772826470999347754471583810071657638912869466565073)) [])) (TCon (TC (TCNum 256)) []))])])))),(NonRecursive (Decl (256,"katsPass") (DExpr (EApp (EApp (ETApp (EVar (17,"==")) (TCon (TC TCSeq) [TCon (TC (TCNum 3)) [],TCon (TC TCBit) []])) (EApp (ETApp (EVar (12,"complement")) (TCon (TC TCSeq) [TCon (TC (TCNum 3)) [],TCon (TC TCBit) []])) (ETApp (EVar (29,"zero")) (TCon (TC TCSeq) [TCon (TC (TCNum 3)) [],TCon (TC TCBit) []])))) (EComp (EApp (EApp (ETApp (EVar (17,"==")) (TCon (TC TCSeq) [TCon (TC (TCNum 256)) [],TCon (TC TCBit) []])) (EVar (322,"test"))) (EVar (323,"kat"))) [[(From (321,"__p0") (EVar (257,"kats"))),(MLet (Decl (322,"test") (DExpr (ESel (EVar (321,"__p0")) (TupleSel 0))))),(MLet (Decl (323,"kat") (DExpr (ESel (EVar (321,"__p0")) (TupleSel 1)))))]]))))),(NonRecursive (Decl (259,"SHA256Init") (DExpr (ERec [("h",(EVar (250,"H0"))),("block",(ETApp (EVar (29,"zero")) (TCon (TC TCSeq) [TCon (TC (TCNum 64)) [],TCon (TC TCSeq) [TCon (TC (TCNum 8)) [],TCon (TC TCBit) []]]))),("n",(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 0)) [])) (TCon (TC (TCNum 16)) []))),("sz",(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 0)) [])) (TCon (TC (TCNum 64)) [])))])))),(NonRecursive (Decl (262,"update") (DExpr (ETAbs (332,"a") (ETAbs (333,"b") (ETAbs (334,"c") (EAbs (335,"a") (EAbs (336,"i") (EAbs (337,"x") (EComp (EIf (EApp (EApp (ETApp (EVar (17,"==")) (TCon (TC TCSeq) [TVar (TVBound 897 KNum),TCon (TC TCBit) []])) (EVar (339,"j"))) (EVar (336,"i"))) (EVar (337,"x")) (EVar (338,"e"))) [[(From (338,"e") (EVar (335,"a")))],[(From (339,"j") (ETApp (ETApp (ETApp (EVar (49,"fromTo")) (TCon (TC (TCNum 0)) [])) (TCon (TF TCSub) [TCon (TF TCExp) [TCon (TC (TCNum 2)) [],TVar (TVBound 897 KNum)],TCon (TC (TCNum 1)) []])) (TVar (TVBound 897 KNum))))]])))))))))),(NonRecursive (Decl (260,"SHA256Update1") (DExpr (EAbs (324,"s") (EAbs (325,"b") (EIf (EApp (EApp (ETApp (EVar (17,"==")) (TCon (TC TCSeq) [TCon (TC (TCNum 16)) [],TCon (TC TCBit) []])) (ESel (EVar (324,"s")) (RecordSel "n"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 64)) [])) (TCon (TC (TCNum 16)) []))) (ERec [("h",(EApp (EApp (EVar (253,"SHA256Block")) (ESel (EVar (324,"s")) (RecordSel "h"))) (EApp (ETApp (ETApp (ETApp (EVar (37,"split")) (TCon (TC (TCNum 16)) [])) (TCon (TC (TCNum 32)) [])) (TCon (TC TCBit) [])) (EApp (ETApp (ETApp (ETApp (EVar (36,"join")) (TCon (TC (TCNum 64)) [])) (TCon (TC (TCNum 8)) [])) (TCon (TC TCBit) [])) (ESel (EVar (324,"s")) (RecordSel "block")))))),("block",(EApp (EApp (ETApp (ETApp (ETApp (EVar (34,"#")) (TCon (TC (TCNum 1)) [])) (TCon (TC (TCNum 63)) [])) (TCon (TC TCSeq) [TCon (TC (TCNum 8)) [],TCon (TC TCBit) []])) (EList [(EVar (325,"b"))])) (ETApp (EVar (29,"zero")) (TCon (TC TCSeq) [TCon (TC (TCNum 63)) [],TCon (TC TCSeq) [TCon (TC (TCNum 8)) [],TCon (TC TCBit) []]])))),("n",(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1)) [])) (TCon (TC (TCNum 16)) []))),("sz",(EApp (EApp (ETApp (EVar (1,"+")) (TCon (TC TCSeq) [TCon (TC (TCNum 64)) [],TCon (TC TCBit) []])) (ESel (EVar (324,"s")) (RecordSel "sz"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 8)) [])) (TCon (TC (TCNum 64)) []))))]) (ERec [("h",(ESel (EVar (324,"s")) (RecordSel "h"))),("block",(EApp (EApp (EApp (ETApp (ETApp (ETApp (EVar (262,"update")) (TCon (TC TCSeq) [TCon (TC (TCNum 8)) [],TCon (TC TCBit) []])) (TCon (TC (TCNum 64)) [])) (TCon (TC (TCNum 16)) [])) (ESel (EVar (324,"s")) (RecordSel "block"))) (ESel (EVar (324,"s")) (RecordSel "n"))) (EVar (325,"b")))),("n",(EApp (EApp (ETApp (EVar (1,"+")) (TCon (TC TCSeq) [TCon (TC (TCNum 16)) [],TCon (TC TCBit) []])) (ESel (EVar (324,"s")) (RecordSel "n"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 1)) [])) (TCon (TC (TCNum 16)) [])))),("sz",(EApp (EApp (ETApp (EVar (1,"+")) (TCon (TC TCSeq) [TCon (TC (TCNum 64)) [],TCon (TC TCBit) []])) (ESel (EVar (324,"s")) (RecordSel "sz"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 8)) [])) (TCon (TC (TCNum 64)) []))))]))))))),(NonRecursive (Decl (261,"SHA256Update") (DExpr (ETAbs (326,"n") (EAbs (327,"sinit") (EAbs (328,"bs") (EWhere (EApp (EApp (ETApp (ETApp (ETApp (EVar (42,"!")) (TCon (TF TCAdd) [TCon (TC (TCNum 1)) [],TVar (TVBound 962 KNum)])) (TUser (258,"SHA256State") [] (TRec [("h",(TCon (TC TCSeq) [TCon (TC (TCNum 8)) [],TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []]])),("block",(TCon (TC TCSeq) [TCon (TC (TCNum 64)) [],TCon (TC TCSeq) [TCon (TC (TCNum 8)) [],TCon (TC TCBit) []]])),("n",(TCon (TC TCSeq) [TCon (TC (TCNum 16)) [],TCon (TC TCBit) []])),("sz",(TCon (TC TCSeq) [TCon (TC (TCNum 64)) [],TCon (TC TCBit) []]))]))) (TCon (TC (TCNum 0)) [])) (EVar (329,"ss"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 0)) [])) (TCon (TC (TCNum 0)) []))) [(Recursive [(Decl (329,"ss") (DExpr (EApp (EApp (ETApp (ETApp (ETApp (EVar (34,"#")) (TCon (TC (TCNum 1)) [])) (TVar (TVBound 962 KNum))) (TUser (258,"SHA256State") [] (TRec [("h",(TCon (TC TCSeq) [TCon (TC (TCNum 8)) [],TCon (TC TCSeq) [TCon (TC (TCNum 32)) [],TCon (TC TCBit) []]])),("block",(TCon (TC TCSeq) [TCon (TC (TCNum 64)) [],TCon (TC TCSeq) [TCon (TC (TCNum 8)) [],TCon (TC TCBit) []]])),("n",(TCon (TC TCSeq) [TCon (TC (TCNum 16)) [],TCon (TC TCBit) []])),("sz",(TCon (TC TCSeq) [TCon (TC (TCNum 64)) [],TCon (TC TCBit) []]))]))) (EList [(EVar (327,"sinit"))])) (EComp (EApp (EApp (EVar (260,"SHA256Update1")) (EVar (330,"s"))) (EVar (331,"b"))) [[(From (330,"s") (EVar (329,"ss")))],[(From (331,"b") (EVar (328,"bs")))]]))))])]))))))),(NonRecursive (Decl (263,"SHA256Final") (DExpr (EAbs (340,"s") (EWhere (EApp (ETApp (ETApp (ETApp (EVar (36,"join")) (TCon (TC (TCNum 8)) [])) (TCon (TC (TCNum 32)) [])) (TCon (TC TCBit) [])) (EApp (EApp (EVar (253,"SHA256Block")) (EVar (343,"h"))) (EVar (345,"b'")))) [(NonRecursive (Decl (341,"s'") (DExpr (EApp (EApp (EVar (260,"SHA256Update1")) (EVar (340,"s"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 128)) [])) (TCon (TC (TCNum 8)) [])))))),(NonRecursive (Decl (342,"__p1") (DExpr (EIf (EApp (EApp (ETApp (EVar (15,"<=")) (TCon (TC TCSeq) [TCon (TC (TCNum 16)) [],TCon (TC TCBit) []])) (ESel (EVar (341,"s'")) (RecordSel "n"))) (ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 56)) [])) (TCon (TC (TCNum 16)) []))) (ETuple [(ESel (EVar (341,"s'")) (RecordSel "h")),(ESel (EVar (341,"s'")) (RecordSel "block"))]) (ETuple [(EApp (EApp (EVar (253,"SHA256Block")) (ESel (EVar (341,"s'")) (RecordSel "h"))) (EApp (ETApp (ETApp (ETApp (EVar (37,"split")) (TCon (TC (TCNum 16)) [])) (TCon (TC (TCNum 32)) [])) (TCon (TC TCBit) [])) (EApp (ETApp (ETApp (ETApp (EVar (36,"join")) (TCon (TC (TCNum 64)) [])) (TCon (TC (TCNum 8)) [])) (TCon (TC TCBit) [])) (ESel (EVar (341,"s'")) (RecordSel "block"))))),(ETApp (EVar (29,"zero")) (TCon (TC TCSeq) [TCon (TC (TCNum 64)) [],TCon (TC TCSeq) [TCon (TC (TCNum 8)) [],TCon (TC TCBit) []]]))]))))),(NonRecursive (Decl (343,"h") (DExpr (ESel (EVar (342,"__p1")) (TupleSel 0))))),(NonRecursive (Decl (344,"b") (DExpr (ESel (EVar (342,"__p1")) (TupleSel 1))))),(NonRecursive (Decl (345,"b'") (DExpr (EApp (ETApp (ETApp (ETApp (EVar (37,"split")) (TCon (TC (TCNum 16)) [])) (TCon (TC (TCNum 32)) [])) (TCon (TC TCBit) [])) (EApp (EApp (ETApp (EVar (27,"||")) (TCon (TC TCSeq) [TCon (TC (TCNum 512)) [],TCon (TC TCBit) []])) (EApp (ETApp (ETApp (ETApp (EVar (36,"join")) (TCon (TC (TCNum 64)) [])) (TCon (TC (TCNum 8)) [])) (TCon (TC TCBit) [])) (EVar (344,"b")))) (EApp (EApp (ETApp (ETApp (ETApp (EVar (34,"#")) (TCon (TC (TCNum 448)) [])) (TCon (TC (TCNum 64)) [])) (TCon (TC TCBit) [])) (ETApp (EVar (29,"zero")) (TCon (TC TCSeq) [TCon (TC (TCNum 448)) [],TCon (TC TCBit) []]))) (ESel (EVar (340,"s")) (RecordSel "sz"))))))))]))))),(NonRecursive (Decl (264,"SHA256Imp") (DExpr (ETAbs (346,"a") (EAbs (347,"msg") (EApp (EVar (263,"SHA256Final")) (EApp (EApp (ETApp (EVar (261,"SHA256Update")) (TVar (TVBound 1047 KNum))) (EVar (259,"SHA256Init"))) (EVar (347,"msg"))))))))),(NonRecursive (Decl (266,"katsImp") (DExpr (EList [(ETuple [(EApp (ETApp (EVar (264,"SHA256Imp")) (TCon (TC (TCNum 56)) [])) (EList [(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 97)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 98)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 99)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 100)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 98)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 99)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 100)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 101)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 99)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 100)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 101)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 100)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 101)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 103)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 101)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 103)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 103)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 103)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 111)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 111)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 112)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 111)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 112)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 113)) [])) (TCon (TC (TCNum 8)) []))])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 16533122207477069341668099752125637525043274373652441057433006174010909329089)) [])) (TCon (TC (TCNum 256)) []))]),(ETuple [(EApp (ETApp (EVar (264,"SHA256Imp")) (TCon (TC (TCNum 0)) [])) (EList [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102987336249554097029535212322581322789799900648198034993379397001115665086549)) [])) (TCon (TC (TCNum 256)) []))]),(ETuple [(EApp (ETApp (EVar (264,"SHA256Imp")) (TCon (TC (TCNum 112)) [])) (EList [(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 97)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 98)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 99)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 100)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 101)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 103)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 98)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 99)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 100)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 101)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 103)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 99)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 100)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 101)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 103)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 100)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 101)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 103)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 101)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 103)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 102)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 103)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 103)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 104)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 111)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 105)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 111)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 112)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 106)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 111)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 112)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 113)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 107)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 111)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 112)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 113)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 114)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 108)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 111)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 112)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 113)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 114)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 115)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 109)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 111)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 112)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 113)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 114)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 115)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 116)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 110)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 111)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 112)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 113)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 114)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 115)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 116)) [])) (TCon (TC (TCNum 8)) [])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 117)) [])) (TCon (TC (TCNum 8)) []))])),(ETApp (ETApp (EVar (0,"demote")) (TCon (TC (TCNum 93789699093071375310876825772826470999347754471583810071657638912869466565073)) [])) (TCon (TC (TCNum 256)) []))])])))),(NonRecursive (Decl (265,"katsPassImp") (DExpr (EApp (EApp (ETApp (EVar (17,"==")) (TCon (TC TCSeq) [TCon (TC (TCNum 3)) [],TCon (TC TCBit) []])) (EApp (ETApp (EVar (12,"complement")) (TCon (TC TCSeq) [TCon (TC (TCNum 3)) [],TCon (TC TCBit) []])) (ETApp (EVar (29,"zero")) (TCon (TC TCSeq) [TCon (TC (TCNum 3)) [],TCon (TC TCBit) []])))) (EComp (EApp (EApp (ETApp (EVar (17,"==")) (TCon (TC TCSeq) [TCon (TC (TCNum 256)) [],TCon (TC TCBit) []])) (EVar (349,"test"))) (EVar (350,"kat"))) [[(From (348,"__p2") (EVar (266,"katsImp"))),(MLet (Decl (349,"test") (DExpr (ESel (EVar (348,"__p2")) (TupleSel 0))))),(MLet (Decl (350,"kat") (DExpr (ESel (EVar (348,"__p2")) (TupleSel 1)))))]]))))),(NonRecursive (Decl (267,"imp_correct") (DExpr (ETAbs (0,"") (EAbs (351,"msg") (EApp (EApp (ETApp (EVar (17,"==")) (TCon (TC TCSeq) [TCon (TC (TCNum 256)) [],TCon (TC TCBit) []])) (EApp (ETApp (EVar (255,"SHA256")) (TVar (TVBound 1105 KNum))) (EVar (351,"msg")))) (EApp (ETApp (EVar (264,"SHA256Imp")) (TVar (TVBound 1105 KNum))) (EVar (351,"msg")))))))))].


Require Export Utf8.
Require Export Coq.funind.Recdef.
Require Export Coq.Logic.FunctionalExtensionality.
Require Export Coq.Program.Basics.
Require Export Coq.Program.Equality.
Require Export Coq.Relations.Relation_Definitions.

Open Scope program_scope.

Notation "V ↑ n" := (iter Type n option V) (at level 5, left associativity) : type_scope.
Notation "^ V" := (option V) (at level 4, right associativity) : type_scope.

Inductive Void : Type := .
Notation "∅" := (Void).
Definition from_void {A} (v : ∅) : A := match v with end.

Class Functor (F : Type → Type) :=
  { fmap : ∀ {A B}, (A → B) → F A → F B

  (** Functor laws **)
  ; fmap_identity : ∀ A (x : F A) (f : A → A),
      (∀ x, f x = x) → fmap f x = x
  ; fmap_composition :
      ∀ A B C (f : B → C) (g : A → B) (x : F A), fmap (f ∘ g) x = fmap f (fmap g x)
  }.

Inductive multi {X : Type} (R : relation X) : relation X :=
| multi_refl : ∀ (x : X), multi R x x
| multi_step : ∀ (x y z : X), R x y → multi R y z → multi R x z.
Global Hint Constructors multi : core.

Lemma multi_trans : ∀ {X} {R : relation X} {x y z},
  multi R x y →
  multi R   y z →
  multi R x   z.
Proof.
  intros. generalize dependent z. induction H; intros; auto.
  apply IHmulti in H1.
  eapply multi_step; eassumption.
Qed.

Ltac inv H := dependent destruction H.
Ltac inj H := injection H; intros; subst; clear H.

Class Lift (F : Type → Type) := lift : ∀ {A}, F A → F ^A.
Notation "↑ e" := (lift e) (at level 0).

Lemma option_map_id_law : ∀ A,
  option_map id = @id ^A.
Proof.
  intros. apply functional_extensionality; intros [x|]; auto.
Qed.

Lemma option_map_comp_law : ∀ A B C (f : A → B) (g : B → C),
  option_map g ∘ option_map f = option_map (g ∘ f).
Proof.
  intros. apply functional_extensionality. intros. generalize dependent B. generalize dependent C.
  induction x; intros; cbn; auto.
Qed.

Lemma option_map_some_law : ∀ {A B} (f : A → B),
  option_map (option_map f ∘ Some) = option_map (Some ∘ f).
Proof.
  intros. apply functional_extensionality. intros. generalize dependent B.
  induction x; intros; cbn; auto.
Qed.

Lemma aux : ∀ {A} (a: A),
  option_map Some (Some a) = Some (Some a).
Proof.
  reflexivity.
Qed.

Lemma lambda_match_just_some : ∀ {A B} (f : A → B) non,
  (λ a : ^ A,
    match a with
    | Some a => f a
    | None => non
    end) ∘ Some = λ a, f a.
Proof.
  intros. apply functional_extensionality; intros a; cbn; auto.
Qed.


Require Export Basic.
Require Export Labels.

(** * Joined syntax of terms for the 3 calculi we consider *)

(** ** Variables *)

Definition Var := nat.

Lemma eq_var_dec : forall (x1 x2 : Var), {x1=x2} + {x1<>x2}.
Proof.
  intros x1 x2. destruct (eq_nat_decide x1 x2) as [H | H].
    apply eq_nat_eq in H. left. apply H.
    right. intros Hc. apply eq_eq_nat in Hc. apply H. apply Hc.
Qed.

(** ** Exception names *)

Definition Excp := nat.

Definition eBracket : Excp := 0.
Definition eType : Excp := 1.

(** Some silly errors in the small-step semantics that should never
    happen if all invariants are respected (e.g. closed programs) *)
Definition eUnbound : Excp := 2.
Definition eStack : Excp := 3.
Definition eLanguage : Excp := 4.

(** ** Dynamic type tags *)

Inductive Tag :=
  TagFun | TagUnit | TagSum | TagLab | TagTag | TagExcp.

Definition beq_tag (T1 T2 : Tag) : bool :=
  match T1, T2 with
  | TagFun, TagFun => true
  | TagUnit, TagUnit => true
  | TagSum, TagSum => true
  | TagLab, TagLab => true
  | TagTag, TagTag => true
  | TagExcp, TagExcp => true
  | _, _ => false
  end.

Lemma eq_tag_dec : forall (T1 T2: Tag), {T1 = T2} + {T1 <> T2}.
Proof. decide equality. Qed.

(** ** Constants *)

(** Note: exception constants are only used in LambdaThrow and LambdaNaV. *)
Inductive Const : Type :=
  | CUnit : Const
  | CLab : Lab -> Const
  | CTag : Tag -> Const
  | CExcp : Excp -> Const.

Definition tag_of_const (c : Const) : Tag :=
  match c with
  | CUnit => TagUnit
  | CLab _ => TagLab
  | CTag _ => TagTag
  | CExcp _ => TagExcp
  end.

Definition beq_const (c1 c2 : Const) : bool :=
  match c1, c2 with
  | CUnit, CUnit => true
  | CLab l1, CLab l2 =>
    if flows_dec l1 l2 then
      if flows_dec l2 l1 then true
      else false
    else false
  | CTag T1, CTag T2 => beq_tag T1 T2
  | CExcp e1, CExcp e2 => beq_nat e1 e2
  | _, _ => false
  end.

(** ** Binary operations *)

Inductive BOp :=
  BEq | BCmp | BJoin.

Definition tags_args (b : BOp) : list Tag :=
  match b with
  | BEq => [TagUnit, TagLab, TagTag, TagExcp]
  | BCmp => [TagLab]
  | BJoin => [TagLab]
  end.

(** ** Direction (for Inl/Inr) *)

Inductive Dir :=
  DLeft | DRight.

Definition d_choose {A:Type} (d : Dir) (t' t'' : A) : A :=
  match d with
  | DLeft => t'
  | DRight => t''
  end.

(** ** Terms *)

(** Not sure if it's such a good idea to share the term syntax. The
    only(?) advantage is that this way we don't have to duplicate the
    derived forms below?
    - Also generating random terms in Haskell is now shared.
*)

Inductive Tm : Type :=
| TVar : Var -> Tm
| TConst : Const -> Tm
| TLet : Var -> Tm -> Tm -> Tm
| TAbs : Var -> Tm -> Tm
| TApp : Var -> Var -> Tm
| TInx : Dir -> Var -> Tm
| TMatch : Var -> Var -> Tm -> Tm -> Tm
| TTag : Var -> Tm
| TBOp : BOp -> Var -> Var -> Tm
| TBracket : Var -> Tm -> Tm
| TLabelOf : Var -> Tm
| TGetPc : Tm
(** LambdaNaV-specific *)
| TMkNav : Var -> Tm
| TToSum : Var -> Tm
(** LambdaThrow-specific *)
| TThrow : Var -> Tm
| TCatch : Tm -> Var -> Tm -> Tm.

Tactic Notation "Tm_cases" tactic(first) ident(c) :=
  first; [
  (* perl -ne 'print "    Case_aux c \"$1\" |\n" if /\| (T\w+)\s/' < Terms.v *)
    Case_aux c "TVar" |
    Case_aux c "TConst" |
    Case_aux c "TLet" |
    Case_aux c "TAbs" |
    Case_aux c "TApp" |
    Case_aux c "TInx" |
    Case_aux c "TMatch" |
    Case_aux c "TTag" |
    Case_aux c "TBOp" |
    Case_aux c "TBracket" |
    Case_aux c "TLabelOf" |
    Case_aux c "TGetPc" |
    Case_aux c "TMkNav" |
    Case_aux c "TToSum" |
    Case_aux c "TThrow" |
    Case_aux c "TCatch"
  ].

(* TODO: this produces lists with lots of duplicates;
   would it be hard to avoid creating duplicates? *)
Fixpoint fv_tm (t : Tm) : list Var :=
  match t with
  | TVar x => [x]
  | TConst c => []
  | TLet x t1 t2 => fv_tm t1 ++ (remove eq_var_dec x (fv_tm t2))
  | TAbs x t => remove eq_var_dec x (fv_tm t)
  | TApp x1 x2 => [x1,x2]
  | TInx _ x => [x]
  | TMatch x x' t1 t2 => x :: (remove eq_var_dec x' (fv_tm t1))
                           ++ (remove eq_var_dec x' (fv_tm t2))
  | TTag x => [x]
  | TBOp _ x1 x2 => [x1,x2]
  | TBracket x t => x :: fv_tm t
  | TLabelOf x => [x]
  | TGetPc => []
  | TMkNav x => [x]
  | TToSum x => [x]
  | TThrow x => [x]
  | TCatch t1 x t2 => fv_tm t1 ++ (remove eq_var_dec x (fv_tm t2))
  end.

Fixpoint size_tm (t : Tm) : nat :=
  match t with
  | TVar _ => 1
  | TConst c => 1
  | TLet _ t1 t2 => size_tm t1 + size_tm t2 + 1
  | TAbs _ t => size_tm t + 1
  | TApp _ _ => 1
  | TInx _ _ => 1
  | TMatch _ _ t1 t2 => size_tm t1 + size_tm t2 + 1
  | TTag _ => 1
  | TBOp _ _ _ => 1
  | TBracket _ t => size_tm t + 1
  | TLabelOf _ => 1
  | TGetPc => 1
  | TMkNav _ => 1
  | TToSum _ => 1
  | TThrow _ => 1
  | TCatch t1 x t2 => size_tm t1 + size_tm t2 + 1
  end.

(** * Convenient derived constructs *)

Definition fresh xs := proj1_sig (fresh_for_list xs).

(** ** Constant terms *)

Definition tCUnit := TConst CUnit.
Definition tCLab l := TConst (CLab l).
Definition tCTag T := TConst (CTag T).
Definition tCExcp e := TConst (CExcp e).

(** ** Non-ANF constructs *)

Definition tApp (t1 t2 : Tm) : Tm :=
  let x1 := fresh (fv_tm t1 ++ fv_tm t2) in
  let x2 := fresh (x1 :: fv_tm t1 ++ fv_tm t2) in
  TLet x1 t1 (TLet x2 t2 (TApp x1 x2)).

Definition tInl (t : Tm) : Tm :=
  TLet 0 t (TInx DLeft 0).
Definition tInr (t : Tm) : Tm :=
  TLet 0 t (TInx DRight 0).
Definition tMatch t x' t1 t2 : Tm :=
  let x := fresh (fv_tm t1 ++ fv_tm t2) in
  TLet x t (TMatch x x' t1 t2).

Definition tTag (t : Tm) : Tm :=
  let x := fresh (fv_tm t) in
  TLet x t (TTag x).

Definition tBOp b (t1 t2 : Tm) : Tm :=
  let x1 := fresh (fv_tm t1 ++ fv_tm t2) in
  let x2 := fresh (x1 :: fv_tm t1 ++ fv_tm t2) in
  TLet x1 t1 (TLet x2 t2 (TBOp b x1 x2)).

Definition tEq := tBOp BEq.
Definition tCmp := tBOp BCmp.
Definition tJoin := tBOp BJoin.

Definition tBracket (t1 t2 : Tm) : Tm :=
  let x1 := fresh (fv_tm t1 ++ fv_tm t2) in
  TLet x1 t1 (TBracket x1 t2).

Definition tLabelOf (t : Tm) : Tm :=
  let x := fresh (fv_tm t) in
  TLet x t (TLabelOf x).

Definition tThrow (t : Tm) : Tm :=
  let x := fresh (fv_tm t) in
  TLet x t (TThrow x).

Definition tMkNav (t : Tm) : Tm :=
  let x := fresh (fv_tm t) in
  TLet x t (TMkNav x).

Definition tToSum (t : Tm) : Tm :=
  let x := fresh (fv_tm t) in
  TLet x t (TToSum x).

(** ** More derived constructs *)

(** Identity and constant functions *)
Definition tId : Tm := (TAbs 0 (TVar 0)).
Definition tCst (t : Tm) : Tm :=
  let x := fresh (fv_tm t) in
  TAbs x t.

(** Booleans *)
Definition tTrue : Tm := tInl tCUnit.
Definition tFalse : Tm := tInr tCUnit.
Definition tIf (t : Tm) (t1 t2 : Tm) : Tm :=
  let x' := fresh ((fv_tm t1) ++ (fv_tm t2)) in
  tMatch t x' t1 t2.
Definition tNot (t : Tm) := tIf t tFalse tTrue.

(** ** Auxiliary commonly used by encodings *)

Definition tHasTag T (t tk : Tm) : Tm :=
  tIf (tEq (tTag t) (TConst (CTag T)))
    tk (tInr (TConst (CExcp eType))).

Definition tSBind tsum xk tk :=
  tMatch tsum xk tk (TInx DRight xk).


Require Import Coq.omega.Omega.
Require Import Examples.AutoSep Examples.Malloc Examples.Bags.

(** * Queue ADT *)

Definition ifZero (n : nat) (p1 p2 : W)  := n = 0 -> p1 = p2.

Inductive focusOnFront : Prop := FF.
Inductive focusOnBack : Prop := FB.

Module Type QUEUE.
  Parameter queue : bag -> W -> HProp.
  Parameter llist : bag -> nat -> W -> W -> HProp.
  Parameter lseg : bag -> nat -> W -> W -> HProp.

  Axiom queue_extensional : forall b p, HProp_extensional (queue b p).
  Axiom llist_extensional : forall b n fr ba, HProp_extensional (llist b n fr ba).
  Axiom lseg_extensional : forall b n fr ba, HProp_extensional (lseg b n fr ba).

  Axiom lseg_extensional' : forall ba n b b' fr,
    b %= b'
    -> lseg b n fr ba ===> lseg b' n fr ba.

  Axiom llist_extensional' : forall ba n b b' fr,
    b %= b'
    -> llist b n fr ba ===> llist b' n fr ba.

  Axiom queue_fwd : forall b p,
    queue b p
    ===> Ex fr, Ex ba, Ex n, [| freeable p 2 |] * (p ==*> fr, ba) * llist b n fr ba.

  Axiom queue_bwd : forall b p,
    (Ex fr, Ex ba, Ex n, [| freeable p 2 |] * (p ==*> fr, ba) * llist b n fr ba)
    ===> queue b p.

  Axiom llist_empty_fwd : forall b n (fr : W) ba,
    fr = 0
    -> llist b n fr ba ===> [| b %= empty |] * [| n = O |].

  Axiom llist_empty_bwd : forall b n (fr : W) ba,
    fr = 0
    -> [| b %= empty |] * [| n = O |] ===> llist b n fr ba.

  Axiom llist_nonempty_fwd : forall ba n (fr : W) b,
    fr <> 0
    -> focusOnFront
    -> llist b n fr ba ===> Ex n', Ex v1, Ex v2, Ex p, [| n = S n' |] * [| (v1, v2) %in b |] * [| freeable fr 3 |] * (fr ==*> v1, v2, p) * [| ifZero n' fr ba |] * llist (b %- (v1, v2)) n' p ba.

  Axiom llist_end_fwd : forall ba n (fr : W) b,
    fr <> 0
    -> focusOnBack
    -> llist b n fr ba ===> Ex n', Ex v1, Ex v2, [| n = S n' |] * [| (v1, v2) %in b |] * lseg (b %- (v1, v2)) n' fr ba * [| ba <> 0 |] * [| freeable ba 3 |] * (ba ==*> v1, v2, $0).

  Axiom llist_nonempty_fwd_b : forall b n fr ba,
    ~(b %= empty)
    -> focusOnFront
    -> llist b n fr ba ===> [| fr <> 0 |] * Ex n', Ex v1, Ex v2, Ex p, [| n = S n' |] * [| (v1, v2) %in b |]
      * (fr ==*> v1, v2, p) * [| freeable fr 3 |] * [| ifZero n' fr ba |] * llist (b %- (v1, v2)) n' p ba.

  Axiom llist_nonempty_bwd : forall b n (fr ba : W),
    fr <> 0
    -> focusOnFront
    -> (Ex n', Ex v1, Ex v2, Ex p, [| n = S n' |] * [| (v1, v2) %in b |]
      * (fr ==*> v1, v2, p) * [| freeable fr 3 |] * [| ifZero n' fr ba |] * llist (b %- (v1, v2)) n' p ba) ===> llist b n fr ba.

  Axiom llist_end_bwd : forall (ba : W) n (fr : W) b,
    fr <> 0
    -> focusOnBack
    -> (Ex v1, Ex v2, Ex v1', Ex v2', Ex n', Ex p,
      [| n = S (S n') |] * [| (v1', v2') %in b |] * [| (v1, v2) %in b %- (v1', v2')|]
      * lseg (b %- (v1, v2) %- (v1', v2')) n' fr p
      * [| p <> 0 |] * [| freeable p 3 |] * (p ==*> v1, v2, ba)
      * [| ba <> 0 |] * [| freeable ba 3 |] * (ba ==*> v1', v2', $0))
    ===> llist b n fr ba.
End QUEUE.

Module Queue : QUEUE.
  Open Scope Sep_scope.

  Fixpoint llist (b : bag) (n : nat) (fr ba : W) : HProp :=
    match n with
      | O => [| fr = 0 /\ b %= empty |]
      | S n' => [| fr <> 0 |] * Ex v1, Ex v2, Ex p, [| (v1, v2) %in b |] * (fr ==*> v1, v2, p) * [| freeable fr 3 |] * [| ifZero n' fr ba |] * llist (b %- (v1, v2)) n' p ba
    end.

  Fixpoint lseg (b : bag) (n : nat) (fr ba : W) : HProp :=
    match n with
      | O => [| fr = ba /\ b %= empty |]
      | S n' => [| fr <> 0 |] * Ex v1, Ex v2, Ex p, [| (v1, v2) %in b |] * (fr ==*> v1, v2, p) * [| freeable fr 3 |] * lseg (b %- (v1, v2)) n' p ba
    end.

  Definition queue (b : bag) (p : W) : HProp :=
    Ex fr, Ex ba, Ex n, [| freeable p 2 |] * (p ==*> fr, ba) * llist b n fr ba.

  Theorem llist_extensional : forall b n fr ba, HProp_extensional (llist b n fr ba).
    destruct n; reflexivity.
  Qed.

  Theorem lseg_extensional : forall b n fr ba, HProp_extensional (lseg b n fr ba).
    destruct n; reflexivity.
  Qed.

  Theorem queue_extensional : forall b p, HProp_extensional (queue b p).
    reflexivity.
  Qed.

  Theorem lseg_extensional' : forall ba n b b' fr,
    b %= b'
    -> lseg b n fr ba ===> lseg b' n fr ba.
    induction n; sepLemma.
  Qed.

  Theorem llist_extensional' : forall ba n b b' fr,
    b %= b'
    -> llist b n fr ba ===> llist b' n fr ba.
    induction n; sepLemma.
  Qed.

  Theorem queue_fwd : forall b p,
    queue b p
    ===> Ex fr, Ex ba, Ex n, [| freeable p 2 |] * (p ==*> fr, ba) * llist b n fr ba.
    unfold queue; sepLemma.
  Qed.

  Theorem queue_bwd : forall b p,
    (Ex fr, Ex ba, Ex n, [| freeable p 2 |] * (p ==*> fr, ba) * llist b n fr ba)
    ===> queue b p.
    unfold queue; sepLemma.
  Qed.

  Theorem llist_empty_fwd : forall b n (fr : W) ba,
    fr = 0
    -> llist b n fr ba ===> [| b %= empty |] * [| n = O |].
    destruct n; sepLemma.
  Qed.

  Theorem llist_empty_bwd : forall b n (fr : W) ba,
    fr = 0
    -> [| b %= empty |] * [| n = O |] ===> llist b n fr ba.
    destruct n; sepLemma.
  Qed.

  Theorem llist_nonempty_fwd : forall ba n (fr : W) b,
    fr <> 0
    -> focusOnFront
    -> llist b n fr ba ===> Ex n', Ex v1, Ex v2, Ex p, [| n = S n' |] * [| (v1, v2) %in b |] * [| freeable fr 3 |] * (fr ==*> v1, v2, p) * [| ifZero n' fr ba |] * llist (b %- (v1, v2)) n' p ba.
    destruct n; sepLemma.
  Qed.

  Theorem llist_end_fwd : forall ba n (fr : W) b,
    fr <> 0
    -> focusOnBack
    -> llist b n fr ba ===> Ex n', Ex v1, Ex v2, [| n = S n' |] * [| (v1, v2) %in b |] * lseg (b %- (v1, v2)) n' fr ba * [| ba <> 0 |] * [| freeable ba 3 |] * (ba ==*> v1, v2, $0).
    induction n.

    sepLemma.

    sepLemmaLhsOnly.
    destruct n.
    specialize (H4 (refl_equal _)); subst.
    sepLemma.
    sepLemma.
    clear H4.
    transitivity ([| x <> 0 |] * llist (b %- (x1, x0)) (S n) x ba *
      SEP.ST.star (fr =*> x1)
        (SEP.ST.star ((fr ^+ $4) =*> x0) ((fr ^+ $8) =*> x))).
    sepLemma.
    remember (S n).
    sepLemmaLhsOnly.
    etransitivity.
    eapply himp_star_frame; [ auto | reflexivity ].
    sepLemma.
    sepLemma.
    injection H4; clear H4; intros; subst.
    apply lseg_extensional'; bags.
  Qed.

  Theorem llist_nonempty_fwd_b : forall b n (fr : W) ba,
    ~(b %= empty)
    -> focusOnFront
    -> llist b n fr ba ===> [| fr <> 0 |] * Ex n', Ex v1, Ex v2, Ex p, [| n = S n' |] * [| (v1, v2) %in b |]
      * (fr ==*> v1, v2, p) * [| freeable fr 3 |] * [| ifZero n' fr ba |] * llist (b %- (v1, v2)) n' p ba.
    destruct n; sepLemma.
  Qed.

  Theorem llist_nonempty_bwd : forall b n (fr ba : W),
    fr <> 0
    -> focusOnFront
    -> (Ex n', Ex v1, Ex v2, Ex p, [| n = S n' |] * [| (v1, v2) %in b |]
      * (fr ==*> v1, v2, p) * [| freeable fr 3 |] * [| ifZero n' fr ba |] * llist (b %- (v1, v2)) n' p ba) ===> llist b n fr ba.
    destruct n; sepLemma; match goal with
                            | [ H : S _ = S _ |- _ ] => injection H; intros; subst
                          end; auto; sepLemma.
  Qed.

  Lemma llist_end_bwd' : forall (ba : W) n (fr : W) b,
    (Ex v1, Ex v2, Ex v1', Ex v2', Ex n', Ex p,
      [| n = S (S n') |] * [| (v1', v2') %in b |] * [| (v1, v2) %in b %- (v1', v2')|]
      * lseg (b %- (v1, v2) %- (v1', v2')) n' fr p
      * [| p <> 0 |] * [| freeable p 3 |] * (p ==*> v1, v2, ba)
      * [| ba <> 0 |] * [| freeable ba 3 |] * (ba ==*> v1', v2', $0))
    ===> llist b n fr ba.
    induction n.

    sepLemma.

    destruct n.
    sepLemma.

    destruct n.
    sepLemmaLhsOnly.
    injection H; clear H; intros; subst.
    sepLemmaLhsOnly.
    sepLemma.

    remember (S (S n)).
    sepLemmaLhsOnly.
    remember (S (S n)).
    replace x0 with (S n) by omega.
    sepLemmaLhsOnly.
    remember (S (S n)).
    sepLemma.
    etransitivity; try apply IHn.
    sepLemma.
    apply lseg_extensional'; bags.
  Qed.

  Theorem llist_end_bwd : forall (ba : W) n (fr : W) b,
    fr <> 0
    -> focusOnBack
    -> (Ex v1, Ex v2, Ex v1', Ex v2', Ex n', Ex p,
      [| n = S (S n') |] * [| (v1', v2') %in b |] * [| (v1, v2) %in b %- (v1', v2')|]
      * lseg (b %- (v1, v2) %- (v1', v2')) n' fr p
      * [| p <> 0 |] * [| freeable p 3 |] * (p ==*> v1, v2, ba)
      * [| ba <> 0 |] * [| freeable ba 3 |] * (ba ==*> v1', v2', $0))
    ===> llist b n fr ba.
    intros; apply llist_end_bwd'.
  Qed.
End Queue.

Import Queue.
Export Queue.

Hint Immediate llist_extensional lseg_extensional queue_extensional.

Definition hints : TacPackage.
  prepare (queue_fwd, llist_empty_fwd, llist_nonempty_fwd, llist_end_fwd, llist_nonempty_fwd_b)
  (queue_bwd, llist_empty_bwd, llist_nonempty_bwd, llist_end_bwd).
Defined.

(** * The code *)

Definition initS := initS queue 7.
Definition isEmptyS := isEmptyS queue 0.
Definition dequeueS := dequeueS queue 6.
Definition enqueueS := enqueueS queue 9.

Definition queueM := bimport [[ "malloc"!"malloc" @ [mallocS], "malloc"!"free" @ [freeS] ]]
  bmodule "queue" {{
  bfunction "init"("r") [initS]
    "r" <-- Call "malloc"!"malloc"(0)
    [PRE[_, R] R =?> 2 * [| freeable R 2 |]
     POST[R'] [| R' = R |] * queue empty R ];;
    "r" *<- 0;;
    Return "r"
  end with bfunction "isEmpty"("b") [isEmptyS]
    "b" <-* "b";;
    If ("b" = 0) {
      Return 1
    } else {
      Return 0
    }
  end with bfunction "enqueue"("b", "v1", "v2", "r", "tmp", "tmp2") [enqueueS]
    "r" <-- Call "malloc"!"malloc"(1)
    [Al b,
      PRE[V, R] queue b (V "b") * R =?> 3 * [| R <> 0 |] * [| freeable R 3 |]
      POST[_] queue (b %+ (V "v1", V "v2")) (V "b")];;

    "r" *<- "v1";;
    "tmp" <- "r" + 4;;
    "tmp" *<- "v2";;
    "tmp" <- "r" + 8;;
    "tmp" *<- 0;;

    "tmp" <-* "b";;
    If ("tmp" = 0) {
      (* Empty queue *)

      "b" *<- "r"
    } else {
      (* Nonempty queue *)

      "tmp" <- "b" + 4;;
      "tmp" <-* "tmp";;
      "tmp" <- "tmp" + 8;;
      "tmp" *<- "r"
    };;

    "tmp" <- "b" + 4;;
    "tmp" *<- "r";;

    Return 0
  end with bfunction "dequeue"("b", "r", "fr", "tmp") [dequeueS]
    "fr" <-* "b";;

    "tmp" <-* "fr";;
    "r" *<- "tmp";;
    "tmp" <- "fr" + 4;;
    "tmp" <-* "tmp";;
    "r" <- "r" + 4;;
    "r" *<- "tmp";;

    "tmp" <- "fr" + 8;;
    "tmp" <-* "tmp";;
    "b" *<- "tmp";;

    If ("tmp" = 0) {
      "b" <- "b" + 4;;
      "b" *<- 0
    } else {
      Skip
    };;

    Call "malloc"!"free"("fr", 1)
    [PRE[_] Emp
     POST[_] Emp];;
    Return 0
  end
}}.

Local Hint Extern 5 (@eq W _ _) => words.
Local Hint Extern 1 (himp _ (lseg _ _ _ _) (lseg _ _ _ _)) => apply lseg_extensional'.
Local Hint Extern 1 (himp _ (llist _ _ _ _) (llist _ _ _ _)) => apply llist_extensional'.

Ltac choose E := assert E by constructor.

Ltac chooser :=
  match goal with
    | [ _ : context[_ %+ _],
        _ : evalInstrs _ _ (Binop _ _ Plus (RvImm (natToW 4))
          :: Assign (LvReg Rv) _
          :: Assign _ (RvLval (LvMem (Reg Rv)))
          :: _) = _
        |- _ ] => choose focusOnBack
    | _ => choose focusOnFront
 end.

Ltac combined :=
  match goal with
    | [ |- context[Assign (LvMem (Indir Sp (natToW 0))) (RvLval (LvReg Rp)) :: nil] ] =>
      sep' auto_ext (* Easy case; standard automation suffices *)
    | _ => post; chooser; sep hints; auto
  end.

Theorem queueMOk : moduleOk queueM.
  vcgen; abstract combined.
Qed.


From Coqprime Require Import PocklingtonRefl.
Local Open Scope positive_scope.

Lemma primo82:
  prime  1659108721->
  prime  4732254109989697.
Proof.
intro H.
apply (Pocklington_refl
     (Ell_certif
      4732254109989697
      2852287
      ((1659108721,1)::nil)
      0
      1238519631397054
      3549190582492305
      4436488228116381)
     ((Proof_certif _ H) :: nil)).
native_cast_no_check (refl_equal true).
Time Qed.