|
| 1 | +(defhol |
| 2 | + :fns ((cond (:arrow* :bool a a a))) |
| 3 | + :defs ((:forall ((x a) (y a)) |
| 4 | + (equal (hap* (cond (typ (:arrow* :bool a a a))) (hp-true) x y) x)) |
| 5 | + (:forall ((x a) (y a)) |
| 6 | + (equal (hap* (cond (typ (:arrow* :bool a a a))) (hp-false) x y) y)))) |
| 7 | + |
| 8 | +(defhol |
| 9 | + :fns ((comma (:arrow* a b (:hash a b)))) |
| 10 | + :defs ((:forall ((x a) (y b)) |
| 11 | + (equal (hap* (comma (typ (:arrow* a b (:hash a b)))) x y) |
| 12 | + (hp-comma x y))))) |
| 13 | + |
| 14 | +(defhol |
| 15 | + :fns ((fst (:arrow* (:hash a b) a))) |
| 16 | + :defs ((:forall ((x a) (y b)) |
| 17 | + (equal (hap* (fst (typ (:arrow* (:hash a b) a))) (hp-comma x y)) x)))) |
| 18 | + |
| 19 | +(defhol |
| 20 | + :fns ((snd (:arrow* (:hash a b) b))) |
| 21 | + :defs ((:forall ((x a) (y b)) |
| 22 | + (equal (hap* (snd (typ (:arrow* (:hash a b) b))) (hp-comma x y)) y)))) |
| 23 | + |
| 24 | +(defhol |
| 25 | + :fns ((suc (:arrow* :num :num))) |
| 26 | + :defs ((:forall ((m :num)) |
| 27 | + (equal (hap* (suc (typ (:arrow* :num :num))) m) (hp+ (hp-num 1) m))))) |
| 28 | + |
| 29 | +(defhol |
| 30 | + :fns ((<= (:arrow* :num :num :bool))) |
| 31 | + :defs ((:forall ((x :num) (y :num)) |
| 32 | + (equal (hap* (<= (typ (:arrow* :num :num :bool))) x y) |
| 33 | + (hp-or (hp< x y) (hp= x y)))))) |
| 34 | + |
| 35 | +(defhol |
| 36 | + :fns ((hd (:arrow* (:list a) a))) |
| 37 | + :defs ((:forall ((h a) (t (:list a))) |
| 38 | + (equal (hap* (hd (typ (:arrow* (:list a) a))) (hp-cons h t)) h)))) |
| 39 | + |
| 40 | +(defhol |
| 41 | + :fns ((null (:arrow* (:list a) :bool))) |
| 42 | + :defs ((equal |
| 43 | + (hap* (null (typ (:arrow* (:list a) :bool))) (hp-nil (typ a))) |
| 44 | + (hp-true)) |
| 45 | + (:forall ((h a) (t (:list a))) |
| 46 | + (equal (hap* (null (typ (:arrow* (:list a) :bool))) (hp-cons h t)) |
| 47 | + (hp-false))))) |
| 48 | + |
| 49 | +(defhol |
| 50 | + :fns ((exp (:arrow* :num :num :num))) |
| 51 | + :defs ((:forall ((m :num)) |
| 52 | + (equal (hap* (exp (typ (:arrow* :num :num :num))) m (hp-num 0)) |
| 53 | + (hp-num 1))) |
| 54 | + (:forall ((m :num) (n :num)) |
| 55 | + (equal |
| 56 | + (hap* (exp (typ (:arrow* :num :num :num))) m |
| 57 | + (hap* (suc (typ (:arrow* :num :num))) n)) |
| 58 | + (hp* m (hap* (exp (typ (:arrow* :num :num :num))) m n)))))) |
| 59 | + |
| 60 | +(defhol |
| 61 | + :fns ((polyp (:arrow* (:list (:hash :num :num)) :bool))) |
| 62 | + :defs ((equal |
| 63 | + (hap* (polyp (typ (:arrow* (:list (:hash :num :num)) :bool))) |
| 64 | + (hp-nil (typ (:hash :num :num)))) (hp-true)) |
| 65 | + (:forall ((e :num) (c :num)) |
| 66 | + (equal |
| 67 | + (hap* (polyp (typ (:arrow* (:list (:hash :num :num)) :bool))) |
| 68 | + (hp-cons (hp-comma c e) (hp-nil (typ (:hash :num :num))))) |
| 69 | + (hp-and (hp< (hp-num 0) c) |
| 70 | + (hap* (<= (typ (:arrow* :num :num :bool))) (hp-num 0) e)))) |
| 71 | + (:forall |
| 72 | + ((r (:list (:hash :num :num))) (e2 :num) (e1 :num) (c2 :num) (c1 :num)) |
| 73 | + (equal |
| 74 | + (hap* (polyp (typ (:arrow* (:list (:hash :num :num)) :bool))) |
| 75 | + (hp-cons (hp-comma c1 e1) (hp-cons (hp-comma c2 e2) r))) |
| 76 | + (hp-and (hp< (hp-num 0) c1) |
| 77 | + (hp-and (hap* (<= (typ (:arrow* :num :num :bool))) (hp-num 0) e1) |
| 78 | + (hp-and (hp< e2 e1) |
| 79 | + (hap* (polyp (typ (:arrow* (:list (:hash :num :num)) :bool))) |
| 80 | + (hp-cons (hp-comma c2 e2) r))))))))) |
| 81 | + |
| 82 | +(defhol |
| 83 | + :fns ((eval_poly (:arrow* (:list (:hash :num :num)) :num :num))) |
| 84 | + :defs ((:forall ((v :num)) |
| 85 | + (equal |
| 86 | + (hap* (eval_poly (typ (:arrow* (:list (:hash :num :num)) :num :num))) |
| 87 | + (hp-nil (typ (:hash :num :num))) v) (hp-num 0))) |
| 88 | + (:forall ((v :num) (r (:list (:hash :num :num))) (e :num) (c :num)) |
| 89 | + (equal |
| 90 | + (hap* (eval_poly (typ (:arrow* (:list (:hash :num :num)) :num :num))) |
| 91 | + (hp-cons (hp-comma c e) r) v) |
| 92 | + (hp+ (hp* c (hap* (exp (typ (:arrow* :num :num :num))) v e)) |
| 93 | + (hap* (eval_poly (typ (:arrow* (:list (:hash :num :num)) :num :num))) |
| 94 | + r v)))))) |
| 95 | + |
| 96 | +(defhol |
| 97 | + :fns ((sum_polys |
| 98 | + (:arrow* (:list (:hash :num :num)) (:list (:hash :num :num)) |
| 99 | + (:list (:hash :num :num))))) |
| 100 | + :defs ((equal |
| 101 | + (hap* |
| 102 | + (sum_polys |
| 103 | + (typ |
| 104 | + (:arrow* (:list (:hash :num :num)) (:list (:hash :num :num)) |
| 105 | + (:list (:hash :num :num))))) (hp-nil (typ (:hash :num :num))) |
| 106 | + (hp-nil (typ (:hash :num :num)))) (hp-nil (typ (:hash :num :num)))) |
| 107 | + (:forall ((v7 (:list (:hash :num :num))) (v6 (:hash :num :num))) |
| 108 | + (equal |
| 109 | + (hap* |
| 110 | + (sum_polys |
| 111 | + (typ |
| 112 | + (:arrow* (:list (:hash :num :num)) (:list (:hash :num :num)) |
| 113 | + (:list (:hash :num :num))))) (hp-nil (typ (:hash :num :num))) |
| 114 | + (hp-cons v6 v7)) (hp-cons v6 v7))) |
| 115 | + (:forall ((v3 (:list (:hash :num :num))) (v2 (:hash :num :num))) |
| 116 | + (equal |
| 117 | + (hap* |
| 118 | + (sum_polys |
| 119 | + (typ |
| 120 | + (:arrow* (:list (:hash :num :num)) (:list (:hash :num :num)) |
| 121 | + (:list (:hash :num :num))))) (hp-cons v2 v3) |
| 122 | + (hp-nil (typ (:hash :num :num)))) (hp-cons v2 v3))) |
| 123 | + (:forall |
| 124 | + ((r2 (:list (:hash :num :num))) (r1 (:list (:hash :num :num))) (e2 :num) |
| 125 | + (e1 :num) (c2 :num) (c1 :num)) |
| 126 | + (equal |
| 127 | + (hap* |
| 128 | + (sum_polys |
| 129 | + (typ |
| 130 | + (:arrow* (:list (:hash :num :num)) (:list (:hash :num :num)) |
| 131 | + (:list (:hash :num :num))))) (hp-cons (hp-comma c1 e1) r1) |
| 132 | + (hp-cons (hp-comma c2 e2) r2)) |
| 133 | + (hap* |
| 134 | + (cond |
| 135 | + (typ |
| 136 | + (:arrow* :bool (:list (:hash :num :num)) (:list (:hash :num :num)) |
| 137 | + (:list (:hash :num :num))))) (hp= e1 e2) |
| 138 | + (hp-cons (hp-comma (hp+ c1 c2) e1) |
| 139 | + (hap* |
| 140 | + (sum_polys |
| 141 | + (typ |
| 142 | + (:arrow* (:list (:hash :num :num)) (:list (:hash :num :num)) |
| 143 | + (:list (:hash :num :num))))) r1 r2)) |
| 144 | + (hap* |
| 145 | + (cond |
| 146 | + (typ |
| 147 | + (:arrow* :bool (:list (:hash :num :num)) (:list (:hash :num :num)) |
| 148 | + (:list (:hash :num :num))))) (hp< e1 e2) |
| 149 | + (hp-cons (hp-comma c2 e2) |
| 150 | + (hap* |
| 151 | + (sum_polys |
| 152 | + (typ |
| 153 | + (:arrow* (:list (:hash :num :num)) (:list (:hash :num :num)) |
| 154 | + (:list (:hash :num :num))))) (hp-cons (hp-comma c1 e1) r1) r2)) |
| 155 | + (hp-cons (hp-comma c1 e1) |
| 156 | + (hap* |
| 157 | + (sum_polys |
| 158 | + (typ |
| 159 | + (:arrow* (:list (:hash :num :num)) (:list (:hash :num :num)) |
| 160 | + (:list (:hash :num :num))))) r1 (hp-cons (hp-comma c2 e2) r2))))))))) |
| 161 | + |
| 162 | +(defhol |
| 163 | + :name eval_sum_poly_distrib |
| 164 | + :goal (:forall |
| 165 | + ((x (:list (:hash :num :num))) (y (:list (:hash :num :num))) (v :num)) |
| 166 | + (hp-implies |
| 167 | + (hp-and (hap* (polyp (typ (:arrow* (:list (:hash :num :num)) :bool))) x) |
| 168 | + (hap* (polyp (typ (:arrow* (:list (:hash :num :num)) :bool))) y)) |
| 169 | + (hp= |
| 170 | + (hap* (eval_poly (typ (:arrow* (:list (:hash :num :num)) :num :num))) |
| 171 | + (hap* |
| 172 | + (sum_polys |
| 173 | + (typ |
| 174 | + (:arrow* (:list (:hash :num :num)) (:list (:hash :num :num)) |
| 175 | + (:list (:hash :num :num))))) x y) v) |
| 176 | + (hp+ |
| 177 | + (hap* (eval_poly (typ (:arrow* (:list (:hash :num :num)) :num :num))) |
| 178 | + x v) |
| 179 | + (hap* (eval_poly (typ (:arrow* (:list (:hash :num :num)) :num :num))) |
| 180 | + y v)))))) |
0 commit comments