├── .gitignore ├── README.md ├── code ├── SBMF │ ├── Example.v │ ├── Extraction.v │ ├── LibTactics.v │ ├── LibTactics.v.d │ ├── Unify.v │ ├── Unify.v.d │ └── makefile └── SCP │ ├── Infer.v │ ├── Infer.v.d │ ├── LibTactics.v │ ├── LibTactics.v.d │ ├── Sample.v │ ├── TypeInfer.hs │ ├── Unify.v │ ├── Unify.v.d │ ├── infer │ ├── .stack-work │ │ ├── dist │ │ │ └── x86_64-osx │ │ │ │ └── Cabal-1.22.5.0 │ │ │ │ ├── build │ │ │ │ ├── Lib.dyn_hi │ │ │ │ ├── Lib.dyn_o │ │ │ │ ├── Lib.hi │ │ │ │ ├── Lib.o │ │ │ │ ├── STLC.dyn_hi │ │ │ │ ├── STLC.dyn_o │ │ │ │ ├── STLC.hi │ │ │ │ ├── STLC.o │ │ │ │ ├── TypeInfer.dyn_hi │ │ │ │ ├── TypeInfer.dyn_o │ │ │ │ ├── TypeInfer.hi │ │ │ │ ├── TypeInfer.o │ │ │ │ ├── autogen │ │ │ │ │ ├── Paths_infer.hs │ │ │ │ │ └── cabal_macros.h │ │ │ │ ├── infer-exe │ │ │ │ │ ├── infer-exe │ │ │ │ │ └── infer-exe-tmp │ │ │ │ │ │ ├── Main.hi │ │ │ │ │ │ ├── Main.o │ │ │ │ │ │ └── app │ │ │ │ │ │ └── Main.dump-hi │ │ │ │ ├── infer-test │ │ │ │ │ ├── infer-test │ │ │ │ │ └── infer-test-tmp │ │ │ │ │ │ ├── Main.hi │ │ │ │ │ │ ├── Main.o │ │ │ │ │ │ └── test │ │ │ │ │ │ └── Spec.dump-hi │ │ │ │ ├── libHSinfer-0.1.0.0-GRIso7t0dG64cDznbtL76i-ghc7.10.3.dylib │ │ │ │ ├── libHSinfer-0.1.0.0-GRIso7t0dG64cDznbtL76i.a │ │ │ │ ├── libHSinfer-0.1.0.0-JPdxjDRtTHTGgk22J8vzY5-ghc7.10.3.dylib │ │ │ │ ├── libHSinfer-0.1.0.0-JPdxjDRtTHTGgk22J8vzY5.a │ │ │ │ ├── libHSinfer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n-ghc7.10.3.dylib │ │ │ │ ├── libHSinfer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n.a │ │ │ │ └── src │ │ │ │ │ ├── Lib.dump-hi │ │ │ │ │ ├── STLC.dump-hi │ │ │ │ │ └── TypeInfer.dump-hi │ │ │ │ ├── package.conf.inplace │ │ │ │ ├── infer-0.1.0.0-inplace.conf │ │ │ │ └── package.cache │ │ │ │ ├── setup-config │ │ │ │ ├── stack-build-cache │ │ │ │ ├── stack-cabal-mod │ │ │ │ ├── stack-config-cache │ │ │ │ └── stack-test-success │ │ └── install │ │ │ └── x86_64-osx │ │ │ └── lts-6.7 │ │ │ └── 7.10.3 │ │ │ ├── bin │ │ │ └── infer-exe │ │ │ ├── doc │ │ │ └── infer-0.1.0.0 │ │ │ │ └── LICENSE │ │ │ ├── flag-cache │ │ │ ├── QuickCheck-2.8.2-689294ba274b5a3ef051e2a1626c397e │ │ │ ├── infer-0.1.0.0-15b5af3f96e517cea1194b9118e9bfa8 │ │ │ ├── infer-0.1.0.0-234ebd3170bb5d1903c75095051c7d00 │ │ │ ├── infer-0.1.0.0-9ea701db68559be6463572a4ebacad35 │ │ │ ├── infer-0.1.0.0-aa65685820c8be06e383f7258cead19b │ │ │ ├── infer-0.1.0.0-c3dca5a78102af2aa0e5d260be96f9e8 │ │ │ ├── infer-0.1.0.0-c9ff5f278d75ebf7ac3225dc9ab253c1 │ │ │ ├── mtl-2.2.1-3af90341e75ee52dfc4e3143b4e5d219 │ │ │ ├── primitive-0.6.1.0-b2a7b9f8d5591c0d4ce7ef238a3217d2 │ │ │ ├── random-1.1-bddd14dad36e804462e2232164520f8f │ │ │ └── tf-random-0.5-25d1329eed590dd8e86f993637cb2c5e │ │ │ ├── lib │ │ │ └── x86_64-osx-ghc-7.10.3 │ │ │ │ ├── infer-0.1.0.0-GRIso7t0dG64cDznbtL76i │ │ │ │ ├── Lib.dyn_hi │ │ │ │ ├── Lib.hi │ │ │ │ ├── libHSinfer-0.1.0.0-GRIso7t0dG64cDznbtL76i-ghc7.10.3.dylib │ │ │ │ └── libHSinfer-0.1.0.0-GRIso7t0dG64cDznbtL76i.a │ │ │ │ └── infer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n │ │ │ │ ├── STLC.dyn_hi │ │ │ │ ├── STLC.hi │ │ │ │ ├── TypeInfer.dyn_hi │ │ │ │ ├── TypeInfer.hi │ │ │ │ ├── libHSinfer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n-ghc7.10.3.dylib │ │ │ │ └── libHSinfer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n.a │ │ │ └── pkgdb │ │ │ ├── infer-0.1.0.0-9ea701db68559be6463572a4ebacad35.conf │ │ │ └── package.cache │ ├── LICENSE │ ├── Setup.hs │ ├── app │ │ └── Main.hs │ ├── infer.cabal │ ├── src │ │ ├── Lib.hs │ │ ├── STLC.hs │ │ └── TypeInfer.hs │ ├── stack.yaml │ └── test │ │ └── Spec.hs │ └── makefile ├── paper ├── SBMF2015 │ ├── algorithm.tex │ ├── aliascnt.sty │ ├── conclusion.tex │ ├── coq-taste.tex │ ├── definitions.tex │ ├── introduction.tex │ ├── llncs.cls │ ├── llncs.ind │ ├── llncsdoc.sty │ ├── makefile │ ├── proof.sty │ ├── related.tex │ ├── remreset.sty │ ├── soundness.tex │ ├── splncs.bst │ ├── splncs03.bst │ ├── splncs_srt.bst │ ├── sprmindx.sty │ ├── subjidx.ind │ ├── tactics.tex │ ├── termination.tex │ ├── unify.bbl │ ├── unify.bib │ ├── unify.blg │ └── unify.tex └── SCP │ ├── algorithm.tex │ ├── aliascnt.sty │ ├── conclusion.tex │ ├── coq-taste.tex │ ├── definitions.tex │ ├── evaluation.tex │ ├── introduction.tex │ ├── llncs.cls │ ├── llncs.ind │ ├── llncsdoc.sty │ ├── makefile │ ├── proof.sty │ ├── related.tex │ ├── remreset.sty │ ├── soundness.tex │ ├── splncs.bst │ ├── splncs03.bst │ ├── splncs_srt.bst │ ├── sprmindx.sty │ ├── subjidx.ind │ ├── tactics.tex │ ├── termination.tex │ ├── unify.bbl │ ├── unify.bib │ ├── unify.blg │ └── unify.tex └── slides ├── lstcoq.sty ├── makefile └── slides.tex /.gitignore: -------------------------------------------------------------------------------- 1 | *.vo 2 | *~ 3 | *.glob 4 | .DS_Store 5 | *.aux 6 | *.log 7 | *.nav 8 | *.pdf 9 | *.nav 10 | *.out 11 | *.vrb 12 | *.toc 13 | *.snm -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | A Texbook Proof of a Type Unification in Coq 2 | ============================ 3 | 4 | A formalization of a type unification algorithm in Coq. 5 | 6 | Structure 7 | --------- 8 | 9 | - Folder paper/SBMF2015: Source code for SBMF paper. 10 | - Folder paper/SCP: Draft for extended version. 11 | - Folder code/SBMF2015: Coq source code for the formalization of SBMF 12 | paper. 13 | - Folder code/SCP: Code for extended version. 14 | 15 | Both directories have makefile to build them. 16 | -------------------------------------------------------------------------------- /code/SBMF/Example.v: -------------------------------------------------------------------------------- 1 | (* A tiny example of Coq code *) 2 | 3 | Section EXAMPLE. 4 | Variables A B C : Prop. 5 | Theorem example : (A -> B) -> (B -> C) -> A -> C. 6 | Proof. 7 | intros H H' HA. apply H'. apply H. assumption. 8 | Qed. 9 | 10 | Definition example' : (A -> B) -> (B -> C) -> A -> C := 11 | fun (H : A -> B) (H' : B -> C) (HA : A) => H' (H HA). 12 | Print example. 13 | End EXAMPLE. 14 | -------------------------------------------------------------------------------- /code/SBMF/Extraction.v: -------------------------------------------------------------------------------- 1 | Require Import Unify. 2 | 3 | Extraction Language Haskell. 4 | 5 | Cd "dist". 6 | 7 | Extract Inductive sumbool => "Prelude.Bool" ["Prelude.True" "Prelude.False"]. 8 | Extract Inductive sumor => "Prelude.Maybe" ["Prelude.Just" "Prelude.Nothing"]. 9 | 10 | 11 | Recursive Extraction Library Unify. 12 | -------------------------------------------------------------------------------- /code/SBMF/LibTactics.v.d: -------------------------------------------------------------------------------- 1 | LibTactics.vo LibTactics.glob LibTactics.v.beautified: LibTactics.v 2 | -------------------------------------------------------------------------------- /code/SBMF/Unify.v.d: -------------------------------------------------------------------------------- 1 | Unify.vo Unify.glob Unify.v.beautified: Unify.v 2 | Unify.vio: Unify.v 3 | -------------------------------------------------------------------------------- /code/SBMF/makefile: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## v # The Coq Proof Assistant ## 3 | ## "$@" || ( RV=$$?; rm -f "$@"; exit $${RV} ) 211 | 212 | %.v.beautified: 213 | $(COQC) $(COQDEBUG) $(COQFLAGS) -beautify $* 214 | 215 | # WARNING 216 | # 217 | # This Makefile has been automagically generated 218 | # Edit at your own risks ! 219 | # 220 | # END OF WARNING 221 | 222 | -------------------------------------------------------------------------------- /code/SCP/Infer.v.d: -------------------------------------------------------------------------------- 1 | Infer.vo Infer.glob Infer.v.beautified: Infer.v ./LibTactics.vo ./Unify.vo 2 | Infer.vio: Infer.v ./LibTactics.vio ./Unify.vio 3 | -------------------------------------------------------------------------------- /code/SCP/LibTactics.v.d: -------------------------------------------------------------------------------- 1 | LibTactics.vo LibTactics.glob LibTactics.v.beautified: LibTactics.v 2 | LibTactics.vio: LibTactics.v 3 | -------------------------------------------------------------------------------- /code/SCP/Sample.v: -------------------------------------------------------------------------------- 1 | Section PRED. 2 | 3 | Inductive nat : Set := 4 | | O : nat 5 | | S : nat -> nat. 6 | 7 | Definition pred (n : nat) : {m | n = S m} + {n = O}. 8 | exact (match n as n' return {m | n' = S m} + {n' = O} with 9 | | O => inright eq_refl 10 | | S m => inleft _ (exist _ m eq_refl) 11 | end). 12 | Defined. 13 | End PRED. 14 | Extraction Language Haskell. 15 | Extract Inductive sumor => "Maybe" ["Just" "Nothing"]. 16 | Recursive Extraction pred. 17 | Print sig. -------------------------------------------------------------------------------- /code/SCP/TypeInfer.hs: -------------------------------------------------------------------------------- 1 | module TypeInfer where 2 | 3 | import qualified Prelude 4 | 5 | __ :: any 6 | __ = Prelude.error "Logical or arity value used" 7 | 8 | data Nat = 9 | O 10 | | S Nat 11 | 12 | nat_rect :: a1 -> (Nat -> a1 -> a1) -> Nat -> a1 13 | nat_rect f f0 n = 14 | case n of { 15 | O -> f; 16 | S n0 -> f0 n0 (nat_rect f f0 n0)} 17 | 18 | nat_rec :: a1 -> (Nat -> a1 -> a1) -> Nat -> a1 19 | nat_rec = 20 | nat_rect 21 | 22 | data List a = 23 | Nil 24 | | Cons a (List a) 25 | 26 | app :: (List a1) -> (List a1) -> List a1 27 | app l m = 28 | case l of { 29 | Nil -> m; 30 | Cons a l1 -> Cons a (app l1 m)} 31 | 32 | type Sig a = 33 | a 34 | -- singleton inductive, whose constructor was exist 35 | 36 | sumbool_rect :: (() -> a1) -> (() -> a1) -> Bool -> a1 37 | sumbool_rect f f0 s = 38 | case s of { 39 | False -> f __; 40 | True -> f0 __} 41 | 42 | sumbool_rec :: (() -> a1) -> (() -> a1) -> Bool -> a1 43 | sumbool_rec = 44 | sumbool_rect 45 | 46 | add :: Nat -> Nat -> Nat 47 | add n m = 48 | case n of { 49 | O -> m; 50 | S p -> S (add p m)} 51 | 52 | acc_rect :: (a1 -> () -> (a1 -> () -> a2) -> a2) -> a1 -> a2 53 | acc_rect f x = 54 | f x __ (\y _ -> acc_rect f y) 55 | 56 | well_founded_induction_type :: (a1 -> (a1 -> () -> a2) -> a2) -> a1 -> a2 57 | well_founded_induction_type x a = 58 | acc_rect (\x0 _ x1 -> x x0 x1) a 59 | 60 | well_founded_induction :: (a1 -> (a1 -> () -> a2) -> a2) -> a1 -> a2 61 | well_founded_induction = 62 | well_founded_induction_type 63 | 64 | eq_dec :: Nat -> Nat -> Bool 65 | eq_dec n = 66 | nat_rec (\m -> 67 | case m of { 68 | O -> False; 69 | S _ -> True}) (\_ iHn m -> 70 | case m of { 71 | O -> True; 72 | S m0 -> iHn m0}) n 73 | 74 | type Id = Nat 75 | 76 | eq_id_dec :: Id -> Id -> Bool 77 | eq_id_dec = 78 | eq_dec 79 | 80 | data Ty = 81 | Var Id 82 | | Arr Ty Ty 83 | | Con 84 | 85 | ty_rect :: (Id -> a1) -> (Ty -> a1 -> Ty -> a1 -> a1) -> a1 -> Ty -> a1 86 | ty_rect f f0 f1 t = 87 | case t of { 88 | Var i -> f i; 89 | Arr t0 t1 -> f0 t0 (ty_rect f f0 f1 t0) t1 (ty_rect f f0 f1 t1); 90 | Con -> f1} 91 | 92 | ty_rec :: (Id -> a1) -> (Ty -> a1 -> Ty -> a1 -> a1) -> a1 -> Ty -> a1 93 | ty_rec = 94 | ty_rect 95 | 96 | eq_ty_dec :: Ty -> Ty -> Bool 97 | eq_ty_dec t t' = 98 | ty_rec (\i t'0 -> 99 | case t'0 of { 100 | Var i0 -> sumbool_rec (\_ -> False) (\_ -> True) (eq_id_dec i i0); 101 | _ -> True}) (\_ h _ h0 t'0 -> 102 | case t'0 of { 103 | Arr t2 t3 -> 104 | sumbool_rec (\_ -> sumbool_rec (\_ -> False) (\_ -> True) (h0 t3)) (\_ -> True) (h t2); 105 | _ -> True}) (\t'0 -> 106 | case t'0 of { 107 | Con -> False; 108 | _ -> True}) t t' 109 | 110 | type Constr = (,) Ty Ty 111 | 112 | type List_constr = List Constr 113 | 114 | type Varctxt = List Id 115 | 116 | type Constraints = (,) Varctxt List_constr 117 | 118 | mk_constraints :: Varctxt -> List_constr -> Constraints 119 | mk_constraints c l = 120 | (,) c l 121 | 122 | occurs_dec :: Id -> Ty -> Bool 123 | occurs_dec v t = 124 | case t of { 125 | Var n -> eq_id_dec n v; 126 | Arr l r -> 127 | case occurs_dec v l of { 128 | False -> False; 129 | True -> occurs_dec v r}; 130 | Con -> True} 131 | 132 | sub :: Ty -> Id -> Ty -> Ty 133 | sub t1 x t2 = 134 | case t2 of { 135 | Var n -> 136 | case eq_id_dec x n of { 137 | False -> t1; 138 | True -> Var n}; 139 | Arr l r -> Arr (sub t1 x l) (sub t1 x r); 140 | Con -> Con} 141 | 142 | remove :: Id -> Varctxt -> Varctxt 143 | remove v ctx = 144 | case ctx of { 145 | Nil -> Nil; 146 | Cons y ys -> 147 | case eq_id_dec y v of { 148 | False -> remove v ys; 149 | True -> Cons y (remove v ys)}} 150 | 151 | type Substitution = List ((,) Id Ty) 152 | 153 | apply_subst :: Substitution -> Ty -> Ty 154 | apply_subst s t = 155 | case s of { 156 | Nil -> t; 157 | Cons p s' -> 158 | case p of { 159 | (,) v t' -> apply_subst s' (sub t' v t)}} 160 | 161 | apply_subst_constraint :: Substitution -> List_constr -> List_constr 162 | apply_subst_constraint s l = 163 | case l of { 164 | Nil -> Nil; 165 | Cons c l' -> 166 | case c of { 167 | (,) t t1 -> Cons ((,) (apply_subst s t) (apply_subst s t1)) (apply_subst_constraint s l')}} 168 | 169 | minus :: Varctxt -> (List Id) -> Varctxt 170 | minus c xs = 171 | case xs of { 172 | Nil -> c; 173 | Cons x xs0 -> remove x (minus c xs0)} 174 | 175 | type Unify_type = () -> Maybe Substitution 176 | 177 | unify_body :: Constraints -> (Constraints -> () -> Unify_type) -> Maybe Substitution 178 | unify_body l unify0 = 179 | case l of { 180 | (,) c l0 -> 181 | case l0 of { 182 | Nil -> Just Nil; 183 | Cons c0 l' -> 184 | case c0 of { 185 | (,) t t' -> 186 | case eq_ty_dec t t' of { 187 | False -> unify0 (mk_constraints c l') __ __; 188 | True -> 189 | case t of { 190 | Var v -> 191 | case occurs_dec v t' of { 192 | False -> Nothing; 193 | True -> 194 | case unify0 195 | (mk_constraints (minus c (Cons v Nil)) 196 | (apply_subst_constraint (Cons ((,) v t') Nil) l')) __ __ of { 197 | Just s0 -> Just (Cons ((,) v t') s0); 198 | Nothing -> Nothing}}; 199 | Arr l1 r -> 200 | case t' of { 201 | Var v -> 202 | case occurs_dec v t of { 203 | False -> Nothing; 204 | True -> 205 | case unify0 206 | (mk_constraints (minus c (Cons v Nil)) 207 | (apply_subst_constraint (Cons ((,) v t) Nil) l')) __ __ of { 208 | Just s0 -> Just (Cons ((,) v t) s0); 209 | Nothing -> Nothing}}; 210 | Arr l1' r' -> 211 | unify0 (mk_constraints c (Cons ((,) l1 l1') (Cons ((,) r r') l'))) __ __; 212 | Con -> Nothing}; 213 | Con -> 214 | case t' of { 215 | Var v -> 216 | case occurs_dec v t of { 217 | False -> Nothing; 218 | True -> 219 | case unify0 220 | (mk_constraints (minus c (Cons v Nil)) 221 | (apply_subst_constraint (Cons ((,) v t) Nil) l')) __ __ of { 222 | Just s0 -> Just (Cons ((,) v t) s0); 223 | Nothing -> Nothing}}; 224 | _ -> Nothing}}}}}} 225 | 226 | unify :: Constraints -> Maybe Substitution 227 | unify l = 228 | well_founded_induction (\x x0 _ -> unify_body x x0) l __ 229 | 230 | data Term = 231 | Var_t Id 232 | | App_t Term Term 233 | | Lam_t Id Term 234 | | Const_t 235 | 236 | type Tyctx = List ((,) Id Ty) 237 | 238 | data Tc_state = 239 | MkState Id (List Id) (List ((,) Ty Ty)) 240 | 241 | type TcM a = Tc_state -> Maybe ((,) Tc_state a) 242 | 243 | ret :: a1 -> TcM a1 244 | ret x s = 245 | Just ((,) s x) 246 | 247 | bind :: (TcM a1) -> (a1 -> TcM a2) -> TcM a2 248 | bind c c' s = 249 | case c s of { 250 | Just p -> 251 | case p of { 252 | (,) s' v -> c' v s'}; 253 | Nothing -> Nothing} 254 | 255 | failT :: TcM a1 256 | failT _ = 257 | Nothing 258 | 259 | fresh :: TcM Ty 260 | fresh s = 261 | case s of { 262 | MkState n ts cs -> Just ((,) (MkState (add (S O) n) (app ts (Cons n Nil)) cs) (Var n))} 263 | 264 | add_constr :: Ty -> Ty -> TcM () 265 | add_constr t t' s = 266 | case s of { 267 | MkState n ts cs -> Just ((,) (MkState n ts (Cons ((,) t t') cs)) ())} 268 | 269 | look :: Id -> Tyctx -> TcM Ty 270 | look x g = 271 | case g of { 272 | Nil -> failT; 273 | Cons p g' -> 274 | case p of { 275 | (,) y t -> 276 | case eq_id_dec x y of { 277 | False -> ret t; 278 | True -> look x g'}}} 279 | 280 | gen_constr :: Tyctx -> Term -> TcM Ty 281 | gen_constr g t = 282 | case t of { 283 | Var_t v -> look v g; 284 | App_t l r -> 285 | bind (gen_constr g l) (\t1 -> 286 | bind (gen_constr g r) (\t2 -> 287 | bind fresh (\t0 -> bind (add_constr t1 (Arr t2 t0)) (\_ -> ret t0)))); 288 | Lam_t v t0 -> 289 | bind fresh (\t1 -> bind (gen_constr (Cons ((,) v t1) g) t0) (\t2 -> ret (Arr t1 t2))); 290 | Const_t -> ret Con} 291 | 292 | type_infer :: Term -> Maybe Ty 293 | type_infer e = 294 | let {x = gen_constr Nil e (MkState O Nil Nil)} in 295 | case x of { 296 | Just p -> 297 | case p of { 298 | (,) t0 t -> 299 | case t0 of { 300 | MkState _ d cs -> 301 | case unify ((,) d cs) of { 302 | Just s0 -> Just (apply_subst s0 t); 303 | Nothing -> Nothing}}}; 304 | Nothing -> Nothing} 305 | 306 | -------------------------------------------------------------------------------- /code/SCP/Unify.v.d: -------------------------------------------------------------------------------- 1 | Unify.vo Unify.glob Unify.v.beautified: Unify.v ./LibTactics.vo 2 | Unify.vio: Unify.v ./LibTactics.vio 3 | -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Lib.dyn_hi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Lib.dyn_hi -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Lib.dyn_o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Lib.dyn_o -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Lib.hi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Lib.hi -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Lib.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Lib.o -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/STLC.dyn_hi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/STLC.dyn_hi -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/STLC.dyn_o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/STLC.dyn_o -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/STLC.hi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/STLC.hi -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/STLC.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/STLC.o -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/TypeInfer.dyn_hi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/TypeInfer.dyn_hi -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/TypeInfer.dyn_o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/TypeInfer.dyn_o -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/TypeInfer.hi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/TypeInfer.hi -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/TypeInfer.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/TypeInfer.o -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen/Paths_infer.hs: -------------------------------------------------------------------------------- 1 | module Paths_infer ( 2 | version, 3 | getBinDir, getLibDir, getDataDir, getLibexecDir, 4 | getDataFileName, getSysconfDir 5 | ) where 6 | 7 | import qualified Control.Exception as Exception 8 | import Data.Version (Version(..)) 9 | import System.Environment (getEnv) 10 | import Prelude 11 | 12 | catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a 13 | catchIO = Exception.catch 14 | 15 | version :: Version 16 | version = Version [0,1,0,0] [] 17 | bindir, libdir, datadir, libexecdir, sysconfdir :: FilePath 18 | 19 | bindir = "/Users/rodrigo/Dropbox/projects/coq/infer/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/bin" 20 | libdir = "/Users/rodrigo/Dropbox/projects/coq/infer/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n" 21 | datadir = "/Users/rodrigo/Dropbox/projects/coq/infer/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/share/x86_64-osx-ghc-7.10.3/infer-0.1.0.0" 22 | libexecdir = "/Users/rodrigo/Dropbox/projects/coq/infer/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/libexec" 23 | sysconfdir = "/Users/rodrigo/Dropbox/projects/coq/infer/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/etc" 24 | 25 | getBinDir, getLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath 26 | getBinDir = catchIO (getEnv "infer_bindir") (\_ -> return bindir) 27 | getLibDir = catchIO (getEnv "infer_libdir") (\_ -> return libdir) 28 | getDataDir = catchIO (getEnv "infer_datadir") (\_ -> return datadir) 29 | getLibexecDir = catchIO (getEnv "infer_libexecdir") (\_ -> return libexecdir) 30 | getSysconfDir = catchIO (getEnv "infer_sysconfdir") (\_ -> return sysconfdir) 31 | 32 | getDataFileName :: FilePath -> IO FilePath 33 | getDataFileName name = do 34 | dir <- getDataDir 35 | return (dir ++ "/" ++ name) 36 | -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen/cabal_macros.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT: This file is automatically generated by Cabal */ 2 | 3 | /* package base-4.8.2.0 */ 4 | #define VERSION_base "4.8.2.0" 5 | #define MIN_VERSION_base(major1,major2,minor) (\ 6 | (major1) < 4 || \ 7 | (major1) == 4 && (major2) < 8 || \ 8 | (major1) == 4 && (major2) == 8 && (minor) <= 2) 9 | 10 | /* package mtl-2.2.1 */ 11 | #define VERSION_mtl "2.2.1" 12 | #define MIN_VERSION_mtl(major1,major2,minor) (\ 13 | (major1) < 2 || \ 14 | (major1) == 2 && (major2) < 2 || \ 15 | (major1) == 2 && (major2) == 2 && (minor) <= 1) 16 | 17 | /* package QuickCheck-2.8.2 */ 18 | #define VERSION_QuickCheck "2.8.2" 19 | #define MIN_VERSION_QuickCheck(major1,major2,minor) (\ 20 | (major1) < 2 || \ 21 | (major1) == 2 && (major2) < 8 || \ 22 | (major1) == 2 && (major2) == 8 && (minor) <= 2) 23 | 24 | /* tool alex-3.1.4 */ 25 | #define TOOL_VERSION_alex "3.1.4" 26 | #define MIN_TOOL_VERSION_alex(major1,major2,minor) (\ 27 | (major1) < 3 || \ 28 | (major1) == 3 && (major2) < 1 || \ 29 | (major1) == 3 && (major2) == 1 && (minor) <= 4) 30 | 31 | /* tool cpphs-1.19.3 */ 32 | #define TOOL_VERSION_cpphs "1.19.3" 33 | #define MIN_TOOL_VERSION_cpphs(major1,major2,minor) (\ 34 | (major1) < 1 || \ 35 | (major1) == 1 && (major2) < 19 || \ 36 | (major1) == 1 && (major2) == 19 && (minor) <= 3) 37 | 38 | /* tool gcc-4.2.1 */ 39 | #define TOOL_VERSION_gcc "4.2.1" 40 | #define MIN_TOOL_VERSION_gcc(major1,major2,minor) (\ 41 | (major1) < 4 || \ 42 | (major1) == 4 && (major2) < 2 || \ 43 | (major1) == 4 && (major2) == 2 && (minor) <= 1) 44 | 45 | /* tool ghc-7.10.3 */ 46 | #define TOOL_VERSION_ghc "7.10.3" 47 | #define MIN_TOOL_VERSION_ghc(major1,major2,minor) (\ 48 | (major1) < 7 || \ 49 | (major1) == 7 && (major2) < 10 || \ 50 | (major1) == 7 && (major2) == 10 && (minor) <= 3) 51 | 52 | /* tool ghc-pkg-7.10.3 */ 53 | #define TOOL_VERSION_ghc_pkg "7.10.3" 54 | #define MIN_TOOL_VERSION_ghc_pkg(major1,major2,minor) (\ 55 | (major1) < 7 || \ 56 | (major1) == 7 && (major2) < 10 || \ 57 | (major1) == 7 && (major2) == 10 && (minor) <= 3) 58 | 59 | /* tool haddock-2.16.1 */ 60 | #define TOOL_VERSION_haddock "2.16.1" 61 | #define MIN_TOOL_VERSION_haddock(major1,major2,minor) (\ 62 | (major1) < 2 || \ 63 | (major1) == 2 && (major2) < 16 || \ 64 | (major1) == 2 && (major2) == 16 && (minor) <= 1) 65 | 66 | /* tool happy-1.19.5 */ 67 | #define TOOL_VERSION_happy "1.19.5" 68 | #define MIN_TOOL_VERSION_happy(major1,major2,minor) (\ 69 | (major1) < 1 || \ 70 | (major1) == 1 && (major2) < 19 || \ 71 | (major1) == 1 && (major2) == 19 && (minor) <= 5) 72 | 73 | /* tool hpc-0.67 */ 74 | #define TOOL_VERSION_hpc "0.67" 75 | #define MIN_TOOL_VERSION_hpc(major1,major2,minor) (\ 76 | (major1) < 0 || \ 77 | (major1) == 0 && (major2) < 67 || \ 78 | (major1) == 0 && (major2) == 67 && (minor) <= 0) 79 | 80 | /* tool hsc2hs-0.67 */ 81 | #define TOOL_VERSION_hsc2hs "0.67" 82 | #define MIN_TOOL_VERSION_hsc2hs(major1,major2,minor) (\ 83 | (major1) < 0 || \ 84 | (major1) == 0 && (major2) < 67 || \ 85 | (major1) == 0 && (major2) == 67 && (minor) <= 0) 86 | 87 | #define CURRENT_PACKAGE_KEY "infer_LATtaxaRTSJFnVvXBzV43n" 88 | 89 | -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/infer-exe/infer-exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/infer-exe/infer-exe -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/infer-exe/infer-exe-tmp/Main.hi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/infer-exe/infer-exe-tmp/Main.hi -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/infer-exe/infer-exe-tmp/Main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/infer-exe/infer-exe-tmp/Main.o -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/infer-exe/infer-exe-tmp/app/Main.dump-hi: -------------------------------------------------------------------------------- 1 | 2 | ==================== FINAL INTERFACE ==================== 3 | 2016-07-22 19:30:35.908828 UTC 4 | 5 | interface main@main:Main 7103 6 | interface hash: 5a730286cb5d077bc30e3065d47d1667 7 | ABI hash: 64df79fad42b6f5b092d34d9db05ccf8 8 | export-list hash: 1f196230d46b142ebbd063e2f9b9ee1f 9 | orphan hash: 693e9af84d3dfcc71e640e005bdc5e2e 10 | flag hash: 2a36ba365fe2093c9d9b097d1fd9b194 11 | sig of: Nothing 12 | used TH splices: False 13 | where 14 | exports: 15 | Main.main 16 | module dependencies: 17 | package dependencies: base-4.8.2.0* ghc-prim-0.4.0.0 18 | integer-gmp-1.0.0.0 19 | orphans: base-4.8.2.0:GHC.Base base-4.8.2.0:GHC.Float 20 | family instance modules: base-4.8.2.0:Control.Applicative 21 | base-4.8.2.0:Data.Either base-4.8.2.0:Data.Monoid 22 | base-4.8.2.0:Data.Type.Equality base-4.8.2.0:GHC.Generics 23 | import -/ base-4.8.2.0:GHC.Base 1db77db5dae73d8c424c85b09fbadb89 24 | import -/ base-4.8.2.0:Prelude 694dcaf039efe62df1c44834e2dbd2fb 25 | import -/ ghc-prim-0.4.0.0:GHC.Types 6b27fb3fdbd0e3f0925a4496c66513bb 26 | af2b36a248de583f582751c621a3db6b 27 | main :: GHC.Types.IO () 28 | {- Arity: 1, HasNoCafRefs, Strictness: , 29 | Unfolding: InlineRule (0, True, True) 30 | Main.main1 `cast` (Sym (GHC.Types.NTCo:IO[0] <()>_R)) -} 31 | f62b28a6d268640d9622fcde82205d24 32 | main1 :: 33 | GHC.Prim.State# GHC.Prim.RealWorld 34 | -> (# GHC.Prim.State# GHC.Prim.RealWorld, () #) 35 | {- Arity: 1, HasNoCafRefs, Strictness: , 36 | Unfolding: InlineRule (1, True, False) 37 | (\ s :: GHC.Prim.State# GHC.Prim.RealWorld[OneShot] -> 38 | (# s, GHC.Tuple.() #)) -} 39 | 0b48c248a879ef9c56f7083ec362638d 40 | main2 :: 41 | GHC.Prim.State# GHC.Prim.RealWorld 42 | -> (# GHC.Prim.State# GHC.Prim.RealWorld, () #) 43 | {- Arity: 1, 44 | Unfolding: (GHC.TopHandler.runMainIO1 45 | @ () 46 | Main.main1 `cast` (Sym (GHC.Types.NTCo:IO[0] <()>_R))) -} 47 | vectorised variables: 48 | vectorised tycons: 49 | vectorised reused tycons: 50 | parallel variables: 51 | parallel tycons: 52 | trusted: safe 53 | require own pkg trusted: False 54 | 55 | -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/infer-test/infer-test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/infer-test/infer-test -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/infer-test/infer-test-tmp/Main.hi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/infer-test/infer-test-tmp/Main.hi -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/infer-test/infer-test-tmp/Main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/infer-test/infer-test-tmp/Main.o -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/libHSinfer-0.1.0.0-GRIso7t0dG64cDznbtL76i-ghc7.10.3.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/libHSinfer-0.1.0.0-GRIso7t0dG64cDznbtL76i-ghc7.10.3.dylib -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/libHSinfer-0.1.0.0-GRIso7t0dG64cDznbtL76i.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/libHSinfer-0.1.0.0-GRIso7t0dG64cDznbtL76i.a -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/libHSinfer-0.1.0.0-JPdxjDRtTHTGgk22J8vzY5-ghc7.10.3.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/libHSinfer-0.1.0.0-JPdxjDRtTHTGgk22J8vzY5-ghc7.10.3.dylib -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/libHSinfer-0.1.0.0-JPdxjDRtTHTGgk22J8vzY5.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/libHSinfer-0.1.0.0-JPdxjDRtTHTGgk22J8vzY5.a -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/libHSinfer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n-ghc7.10.3.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/libHSinfer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n-ghc7.10.3.dylib -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/libHSinfer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/libHSinfer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n.a -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/src/Lib.dump-hi: -------------------------------------------------------------------------------- 1 | 2 | ==================== FINAL INTERFACE ==================== 3 | 2016-07-22 19:18:47.06164 UTC 4 | 5 | interface infer_JPdxjDRtTHTGgk22J8vzY5:Lib 7103 6 | interface hash: cea334d2040ed4340070617ec5059e2c 7 | ABI hash: 36e813f960e5fe997de2b0310b9f333c 8 | export-list hash: 233d8a923b0d4a80d0178529cf9cc4e0 9 | orphan hash: 693e9af84d3dfcc71e640e005bdc5e2e 10 | flag hash: 4c0a7b65a6dddbc4161c2e2bfabe3dc3 11 | sig of: Nothing 12 | used TH splices: False 13 | where 14 | exports: 15 | Lib.someFunc 16 | module dependencies: 17 | package dependencies: base-4.8.2.0* ghc-prim-0.4.0.0 18 | integer-gmp-1.0.0.0 19 | orphans: base-4.8.2.0:GHC.Base base-4.8.2.0:GHC.Float 20 | family instance modules: base-4.8.2.0:Control.Applicative 21 | base-4.8.2.0:Data.Either base-4.8.2.0:Data.Monoid 22 | base-4.8.2.0:Data.Type.Equality base-4.8.2.0:GHC.Generics 23 | import -/ base-4.8.2.0:Prelude 694dcaf039efe62df1c44834e2dbd2fb 24 | import -/ base-4.8.2.0:System.IO 0899686bfc1d9ef72dff3de85e99862a 25 | import -/ ghc-prim-0.4.0.0:GHC.Types 6b27fb3fdbd0e3f0925a4496c66513bb 26 | 839a1e61a72dee86aa32f0d8facc9616 27 | someFunc :: GHC.Types.IO () 28 | {- Arity: 1, Strictness: , 29 | Unfolding: InlineRule (0, True, True) 30 | Lib.someFunc1 `cast` (Sym (GHC.Types.NTCo:IO[0] <()>_R)) -} 31 | e2298325bbc40ba02526d4d5fad52c50 32 | someFunc1 :: 33 | GHC.Prim.State# GHC.Prim.RealWorld 34 | -> (# GHC.Prim.State# GHC.Prim.RealWorld, () #) 35 | {- Arity: 1, Strictness: , 36 | Unfolding: (\ eta :: GHC.Prim.State# GHC.Prim.RealWorld[OneShot] -> 37 | GHC.IO.Handle.Text.hPutStr2 38 | GHC.IO.Handle.FD.stdout 39 | Lib.someFunc2 40 | GHC.Types.True 41 | eta) -} 42 | f6db12377121ac16625d87790890eab0 43 | someFunc2 :: [GHC.Types.Char] 44 | {- Unfolding: (GHC.CString.unpackCString# "someFunc"#) -} 45 | vectorised variables: 46 | vectorised tycons: 47 | vectorised reused tycons: 48 | parallel variables: 49 | parallel tycons: 50 | trusted: safe 51 | require own pkg trusted: False 52 | 53 | -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/package.conf.inplace/infer-0.1.0.0-inplace.conf: -------------------------------------------------------------------------------- 1 | name: infer 2 | version: 0.1.0.0 3 | id: infer-0.1.0.0-inplace 4 | key: infer_LATtaxaRTSJFnVvXBzV43n 5 | license: BSD3 6 | copyright: 2016 Author name here 7 | maintainer: example@example.com 8 | homepage: https://github.com/githubuser/infer#readme 9 | synopsis: Initial project template from stack 10 | description: 11 | Please see README.md 12 | category: Web 13 | author: Author name here 14 | exposed: True 15 | exposed-modules: 16 | STLC TypeInfer 17 | trusted: False 18 | import-dirs: /Users/rodrigo/Dropbox/projects/coq/infer/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build 19 | library-dirs: /Users/rodrigo/Dropbox/projects/coq/infer/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build 20 | data-dir: /Users/rodrigo/Dropbox/projects/coq/infer/infer 21 | hs-libraries: HSinfer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n 22 | depends: 23 | base-4.8.2.0-cc43d8e06aa74e9c4c0132becc49ee25 24 | mtl-2.2.1-3af90341e75ee52dfc4e3143b4e5d219 25 | haddock-interfaces: /Users/rodrigo/Dropbox/projects/coq/infer/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/doc/html/infer/infer.haddock 26 | haddock-html: /Users/rodrigo/Dropbox/projects/coq/infer/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/doc/html/infer 27 | -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/package.conf.inplace/package.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/package.conf.inplace/package.cache -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/setup-config: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/setup-config -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/stack-build-cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/stack-build-cache -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/stack-cabal-mod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/stack-cabal-mod -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/stack-config-cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/stack-config-cache -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/stack-test-success: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/stack-test-success -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/bin/infer-exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/bin/infer-exe -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/doc/infer-0.1.0.0/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright Author name here (c) 2016 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the following 13 | disclaimer in the documentation and/or other materials provided 14 | with the distribution. 15 | 16 | * Neither the name of Author name here nor the names of other 17 | contributors may be used to endorse or promote products derived 18 | from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/flag-cache/QuickCheck-2.8.2-689294ba274b5a3ef051e2a1626c397e: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/flag-cache/QuickCheck-2.8.2-689294ba274b5a3ef051e2a1626c397e -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/flag-cache/infer-0.1.0.0-15b5af3f96e517cea1194b9118e9bfa8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/flag-cache/infer-0.1.0.0-15b5af3f96e517cea1194b9118e9bfa8 -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/flag-cache/infer-0.1.0.0-234ebd3170bb5d1903c75095051c7d00: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/flag-cache/infer-0.1.0.0-234ebd3170bb5d1903c75095051c7d00 -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/flag-cache/infer-0.1.0.0-9ea701db68559be6463572a4ebacad35: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/flag-cache/infer-0.1.0.0-9ea701db68559be6463572a4ebacad35 -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/flag-cache/infer-0.1.0.0-aa65685820c8be06e383f7258cead19b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/flag-cache/infer-0.1.0.0-aa65685820c8be06e383f7258cead19b -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/flag-cache/infer-0.1.0.0-c3dca5a78102af2aa0e5d260be96f9e8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/flag-cache/infer-0.1.0.0-c3dca5a78102af2aa0e5d260be96f9e8 -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/flag-cache/infer-0.1.0.0-c9ff5f278d75ebf7ac3225dc9ab253c1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/flag-cache/infer-0.1.0.0-c9ff5f278d75ebf7ac3225dc9ab253c1 -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/flag-cache/mtl-2.2.1-3af90341e75ee52dfc4e3143b4e5d219: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/flag-cache/mtl-2.2.1-3af90341e75ee52dfc4e3143b4e5d219 -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/flag-cache/primitive-0.6.1.0-b2a7b9f8d5591c0d4ce7ef238a3217d2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/flag-cache/primitive-0.6.1.0-b2a7b9f8d5591c0d4ce7ef238a3217d2 -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/flag-cache/random-1.1-bddd14dad36e804462e2232164520f8f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/flag-cache/random-1.1-bddd14dad36e804462e2232164520f8f -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/flag-cache/tf-random-0.5-25d1329eed590dd8e86f993637cb2c5e: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/flag-cache/tf-random-0.5-25d1329eed590dd8e86f993637cb2c5e -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-GRIso7t0dG64cDznbtL76i/Lib.dyn_hi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-GRIso7t0dG64cDznbtL76i/Lib.dyn_hi -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-GRIso7t0dG64cDznbtL76i/Lib.hi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-GRIso7t0dG64cDznbtL76i/Lib.hi -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-GRIso7t0dG64cDznbtL76i/libHSinfer-0.1.0.0-GRIso7t0dG64cDznbtL76i-ghc7.10.3.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-GRIso7t0dG64cDznbtL76i/libHSinfer-0.1.0.0-GRIso7t0dG64cDznbtL76i-ghc7.10.3.dylib -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-GRIso7t0dG64cDznbtL76i/libHSinfer-0.1.0.0-GRIso7t0dG64cDznbtL76i.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-GRIso7t0dG64cDznbtL76i/libHSinfer-0.1.0.0-GRIso7t0dG64cDznbtL76i.a -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n/STLC.dyn_hi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n/STLC.dyn_hi -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n/STLC.hi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n/STLC.hi -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n/TypeInfer.dyn_hi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n/TypeInfer.dyn_hi -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n/TypeInfer.hi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n/TypeInfer.hi -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n/libHSinfer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n-ghc7.10.3.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n/libHSinfer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n-ghc7.10.3.dylib -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n/libHSinfer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n/libHSinfer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n.a -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/pkgdb/infer-0.1.0.0-9ea701db68559be6463572a4ebacad35.conf: -------------------------------------------------------------------------------- 1 | name: infer 2 | version: 0.1.0.0 3 | id: infer-0.1.0.0-9ea701db68559be6463572a4ebacad35 4 | key: infer_LATtaxaRTSJFnVvXBzV43n 5 | license: BSD3 6 | copyright: 2016 Author name here 7 | maintainer: example@example.com 8 | homepage: https://github.com/githubuser/infer#readme 9 | synopsis: Initial project template from stack 10 | description: 11 | Please see README.md 12 | category: Web 13 | author: Author name here 14 | exposed: True 15 | exposed-modules: 16 | STLC TypeInfer 17 | trusted: False 18 | import-dirs: /Users/rodrigo/Dropbox/projects/coq/infer/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n 19 | library-dirs: /Users/rodrigo/Dropbox/projects/coq/infer/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/lib/x86_64-osx-ghc-7.10.3/infer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n 20 | data-dir: /Users/rodrigo/Dropbox/projects/coq/infer/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/share/x86_64-osx-ghc-7.10.3/infer-0.1.0.0 21 | hs-libraries: HSinfer-0.1.0.0-LATtaxaRTSJFnVvXBzV43n 22 | depends: 23 | base-4.8.2.0-cc43d8e06aa74e9c4c0132becc49ee25 24 | mtl-2.2.1-3af90341e75ee52dfc4e3143b4e5d219 25 | haddock-interfaces: /Users/rodrigo/Dropbox/projects/coq/infer/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/doc/infer-0.1.0.0/infer.haddock 26 | haddock-html: /Users/rodrigo/Dropbox/projects/coq/infer/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/doc/infer-0.1.0.0 27 | -------------------------------------------------------------------------------- /code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/pkgdb/package.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigogribeiro/unification/f622364a63fdd959867410151749797c3e58e9b5/code/SCP/infer/.stack-work/install/x86_64-osx/lts-6.7/7.10.3/pkgdb/package.cache -------------------------------------------------------------------------------- /code/SCP/infer/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright Author name here (c) 2016 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the following 13 | disclaimer in the documentation and/or other materials provided 14 | with the distribution. 15 | 16 | * Neither the name of Author name here nor the names of other 17 | contributors may be used to endorse or promote products derived 18 | from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /code/SCP/infer/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /code/SCP/infer/app/Main.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | 4 | main :: IO () 5 | main = return () 6 | -------------------------------------------------------------------------------- /code/SCP/infer/infer.cabal: -------------------------------------------------------------------------------- 1 | name: infer 2 | version: 0.1.0.0 3 | synopsis: Initial project template from stack 4 | description: Please see README.md 5 | homepage: https://github.com/githubuser/infer#readme 6 | license: BSD3 7 | license-file: LICENSE 8 | author: Author name here 9 | maintainer: example@example.com 10 | copyright: 2016 Author name here 11 | category: Web 12 | build-type: Simple 13 | -- extra-source-files: 14 | cabal-version: >=1.10 15 | 16 | library 17 | hs-source-dirs: src 18 | exposed-modules: STLC 19 | , TypeInfer 20 | build-depends: base >= 4.7 && < 5 21 | , mtl 22 | default-language: Haskell2010 23 | 24 | executable infer-exe 25 | hs-source-dirs: app 26 | main-is: Main.hs 27 | ghc-options: -threaded -rtsopts -with-rtsopts=-N 28 | build-depends: base 29 | , infer 30 | default-language: Haskell2010 31 | 32 | test-suite infer-test 33 | type: exitcode-stdio-1.0 34 | hs-source-dirs: test 35 | main-is: Spec.hs 36 | build-depends: base 37 | , infer 38 | , mtl 39 | , QuickCheck 40 | ghc-options: -threaded -rtsopts -with-rtsopts=-N 41 | default-language: Haskell2010 42 | 43 | source-repository head 44 | type: git 45 | location: https://github.com/githubuser/infer 46 | -------------------------------------------------------------------------------- /code/SCP/infer/src/Lib.hs: -------------------------------------------------------------------------------- 1 | module Lib 2 | ( someFunc 3 | ) where 4 | 5 | someFunc :: IO () 6 | someFunc = putStrLn "someFunc" 7 | -------------------------------------------------------------------------------- /code/SCP/infer/src/STLC.hs: -------------------------------------------------------------------------------- 1 | module STLC where 2 | 3 | -- definition of lambda term syntax 4 | 5 | data Nat = O | S Nat deriving (Eq, Ord, Show) 6 | 7 | type Id = Nat 8 | 9 | data Ty = Var Id | Arr Ty Ty | Con deriving (Eq, Ord, Show) 10 | 11 | data Term = 12 | Var_t Id 13 | | App_t Term Term 14 | | Lam_t Id Term 15 | | Const_t 16 | deriving (Eq, Ord, Show) 17 | 18 | 19 | -- definition of constraints 20 | 21 | type Constr = (Ty,Ty) 22 | 23 | type Constraints = [Constr] 24 | 25 | occurs_dec :: Id -> Ty -> Bool 26 | occurs_dec v (Var v') = v == v' 27 | occurs_dec v (Arr t t') = occurs_dec v t || occurs_dec v t' 28 | occurs_dec v Con = False 29 | 30 | sub :: Ty -> Id -> Ty -> Ty 31 | sub t v (Var v') = if v == v' then t else (Var v') 32 | sub t v Con = Con 33 | sub t v (Arr t1 t1') = Arr (sub t v t1) (sub t v t1') 34 | 35 | type Substitution = [(Id,Ty)] 36 | 37 | apply_subst :: Substitution -> Ty -> Ty 38 | apply_subst s t = foldr (\(i,t') ac -> sub t' i ac) t s 39 | 40 | apply_subst_constraint :: Substitution -> Constraints -> Constraints 41 | apply_subst_constraint s cs = map (\(t,t') -> (apply_subst s t, apply_subst s t')) cs 42 | 43 | -- unification 44 | 45 | unify :: Constraints -> Maybe Substitution 46 | unify [] = Just [] 47 | unify ((Con,Con) : cs) = unify cs 48 | unify ((Var v, t) : cs) = if occurs_dec v t then Nothing 49 | else maybe Nothing (\xs -> Just $ xs ++ [(v , t)]) (unify cs') 50 | where 51 | cs' = apply_subst_constraint [(v,t)] cs 52 | unify ((t, Var v) : cs) = if occurs_dec v t then Nothing 53 | else maybe Nothing (\xs -> Just $ xs ++ [(v , t)]) (unify cs') 54 | where 55 | cs' = apply_subst_constraint [(v,t)] cs 56 | unify ((Arr l r, Arr l' r'):cs) = unify ((l,l') : (r,r') : cs) 57 | unify _ = Nothing 58 | 59 | -- typing contexts 60 | 61 | type Tyctx = [(Id,Ty)] 62 | 63 | -- Tc monad 64 | 65 | data TcState = TcState { 66 | next :: Id 67 | , constrs :: Constraints 68 | } 69 | 70 | newtype TcM a = TcM { runTcM :: TcState -> (TcState, Maybe a) } 71 | 72 | instance Functor TcM where 73 | fmap f m = TcM (\s -> 74 | let 75 | (s,t) = runTcM m s 76 | in maybe (s, Nothing) (\x -> (s, Just (f x))) t) 77 | 78 | instance Applicative TcM where 79 | pure x = TcM (\s -> (s, Just x)) 80 | (TcM f) <*> m = undefined 81 | 82 | instance Monad TcM where 83 | return x = TcM (\s -> (s,Just x)) 84 | fail _ = TcM (\s -> (s, Nothing)) 85 | (TcM m) >>= f = TcM (\s -> 86 | let 87 | (s',r) = m s 88 | in case r of 89 | Nothing -> (s', Nothing) 90 | Just t -> runTcM (f t) s') 91 | 92 | put :: TcState -> TcM () 93 | put s = TcM (\_ -> (s, Just ())) 94 | 95 | get :: TcM TcState 96 | get = TcM (\s -> (s, Just s)) 97 | 98 | modify :: (TcState -> TcState) -> TcM () 99 | modify f = get >>= \s -> put (f s) 100 | 101 | fresh :: TcM Ty 102 | fresh = do 103 | s <- get 104 | put (s{next = S (next s)}) 105 | return (Var (next s)) 106 | 107 | add_constr :: Ty -> Ty -> TcM () 108 | add_constr t t'= modify (\s -> s{constrs = (t,t') : (constrs s)}) 109 | 110 | look :: Id -> Tyctx -> TcM Ty 111 | look v [] = fail "Undefined value" 112 | look v ((v',t) : ctx) 113 | = if v == v' then return t 114 | else look v ctx 115 | 116 | 117 | gen_constr' :: Tyctx -> Term -> TcM Ty 118 | gen_constr' ctx Const_t = return Con 119 | gen_constr' ctx (Var_t v) = look v ctx 120 | gen_constr' ctx (Lam_t v t) 121 | = do 122 | v' <- fresh 123 | t' <- gen_constr' ((v,v') : ctx) t 124 | return (Arr v' t') 125 | gen_constr' ctx (App_t l r) 126 | = do 127 | t <- gen_constr' ctx l 128 | t' <- gen_constr' ctx r 129 | v <- fresh 130 | add_constr t (Arr t' v) 131 | return v 132 | 133 | gen_constr :: Tyctx -> Term -> (Constraints, Maybe Ty) 134 | gen_constr ctx e = (constrs tc, t) 135 | where 136 | r = runTcM (gen_constr' ctx e) (TcState O []) 137 | t = snd r 138 | tc = fst r 139 | 140 | 141 | type_infer :: Term -> Maybe Ty 142 | type_infer e 143 | = let (c,x) = gen_constr [] e 144 | r = unify c 145 | in case (r,x) of 146 | (Just s, Just t) -> Just (apply_subst s t) 147 | _ -> Nothing 148 | 149 | -------------------------------------------------------------------------------- /code/SCP/infer/src/TypeInfer.hs: -------------------------------------------------------------------------------- 1 | module TypeInfer where 2 | 3 | import qualified Prelude 4 | 5 | __ :: any 6 | __ = Prelude.error "Logical or arity value used" 7 | 8 | data Nat = 9 | O 10 | | S Nat 11 | 12 | nat_rect :: a1 -> (Nat -> a1 -> a1) -> Nat -> a1 13 | nat_rect f f0 n = 14 | case n of { 15 | O -> f; 16 | S n0 -> f0 n0 (nat_rect f f0 n0)} 17 | 18 | nat_rec :: a1 -> (Nat -> a1 -> a1) -> Nat -> a1 19 | nat_rec = 20 | nat_rect 21 | 22 | data List a = 23 | Nil 24 | | Cons a (List a) 25 | 26 | app :: (List a1) -> (List a1) -> List a1 27 | app l m = 28 | case l of { 29 | Nil -> m; 30 | Cons a l1 -> Cons a (app l1 m)} 31 | 32 | type Sig a = 33 | a 34 | -- singleton inductive, whose constructor was exist 35 | 36 | sumbool_rect :: (() -> a1) -> (() -> a1) -> Prelude.Bool -> a1 37 | sumbool_rect f f0 s = 38 | case s of { 39 | Prelude.False -> f __; 40 | Prelude.True -> f0 __} 41 | 42 | sumbool_rec :: (() -> a1) -> (() -> a1) -> Prelude.Bool -> a1 43 | sumbool_rec = 44 | sumbool_rect 45 | 46 | add :: Nat -> Nat -> Nat 47 | add n m = 48 | case n of { 49 | O -> m; 50 | S p -> S (add p m)} 51 | 52 | acc_rect :: (a1 -> () -> (a1 -> () -> a2) -> a2) -> a1 -> a2 53 | acc_rect f x = 54 | f x __ (\y _ -> acc_rect f y) 55 | 56 | well_founded_induction_type :: (a1 -> (a1 -> () -> a2) -> a2) -> a1 -> a2 57 | well_founded_induction_type x a = 58 | acc_rect (\x0 _ x1 -> x x0 x1) a 59 | 60 | well_founded_induction :: (a1 -> (a1 -> () -> a2) -> a2) -> a1 -> a2 61 | well_founded_induction = 62 | well_founded_induction_type 63 | 64 | eq_dec :: Nat -> Nat -> Prelude.Bool 65 | eq_dec n = 66 | nat_rec (\m -> 67 | case m of { 68 | O -> Prelude.False; 69 | S _ -> Prelude.True}) (\_ iHn m -> 70 | case m of { 71 | O -> Prelude.True; 72 | S m0 -> iHn m0}) n 73 | 74 | type Id = Nat 75 | 76 | eq_id_dec :: Id -> Id -> Prelude.Bool 77 | eq_id_dec = 78 | eq_dec 79 | 80 | data Ty = 81 | Var Id 82 | | Arr Ty Ty 83 | | Con 84 | 85 | ty_rect :: (Id -> a1) -> (Ty -> a1 -> Ty -> a1 -> a1) -> a1 -> Ty -> a1 86 | ty_rect f f0 f1 t = 87 | case t of { 88 | Var i -> f i; 89 | Arr t0 t1 -> f0 t0 (ty_rect f f0 f1 t0) t1 (ty_rect f f0 f1 t1); 90 | Con -> f1} 91 | 92 | ty_rec :: (Id -> a1) -> (Ty -> a1 -> Ty -> a1 -> a1) -> a1 -> Ty -> a1 93 | ty_rec = 94 | ty_rect 95 | 96 | eq_ty_dec :: Ty -> Ty -> Prelude.Bool 97 | eq_ty_dec t t' = 98 | ty_rec (\i t'0 -> 99 | case t'0 of { 100 | Var i0 -> sumbool_rec (\_ -> Prelude.False) (\_ -> Prelude.True) (eq_id_dec i i0); 101 | _ -> Prelude.True}) (\_ h _ h0 t'0 -> 102 | case t'0 of { 103 | Arr t2 t3 -> 104 | sumbool_rec (\_ -> sumbool_rec (\_ -> Prelude.False) (\_ -> Prelude.True) (h0 t3)) (\_ -> 105 | Prelude.True) (h t2); 106 | _ -> Prelude.True}) (\t'0 -> 107 | case t'0 of { 108 | Con -> Prelude.False; 109 | _ -> Prelude.True}) t t' 110 | 111 | type Constr = (,) Ty Ty 112 | 113 | type List_constr = List Constr 114 | 115 | type Varctxt = List Id 116 | 117 | type Constraints = (,) Varctxt List_constr 118 | 119 | mk_constraints :: Varctxt -> List_constr -> Constraints 120 | mk_constraints c l = 121 | (,) c l 122 | 123 | occurs_dec :: Id -> Ty -> Prelude.Bool 124 | occurs_dec v t = 125 | case t of { 126 | Var n -> eq_id_dec n v; 127 | Arr l r -> 128 | case occurs_dec v l of { 129 | Prelude.False -> Prelude.False; 130 | Prelude.True -> occurs_dec v r}; 131 | Con -> Prelude.True} 132 | 133 | sub :: Ty -> Id -> Ty -> Ty 134 | sub t1 x t2 = 135 | case t2 of { 136 | Var n -> 137 | case eq_id_dec x n of { 138 | Prelude.False -> t1; 139 | Prelude.True -> Var n}; 140 | Arr l r -> Arr (sub t1 x l) (sub t1 x r); 141 | Con -> Con} 142 | 143 | remove :: Id -> Varctxt -> Varctxt 144 | remove v ctx = 145 | case ctx of { 146 | Nil -> Nil; 147 | Cons y ys -> 148 | case eq_id_dec y v of { 149 | Prelude.False -> remove v ys; 150 | Prelude.True -> Cons y (remove v ys)}} 151 | 152 | type Substitution = List ((,) Id Ty) 153 | 154 | apply_subst :: Substitution -> Ty -> Ty 155 | apply_subst s t = 156 | case s of { 157 | Nil -> t; 158 | Cons p s' -> 159 | case p of { 160 | (,) v t' -> apply_subst s' (sub t' v t)}} 161 | 162 | apply_subst_constraint :: Substitution -> List_constr -> List_constr 163 | apply_subst_constraint s l = 164 | case l of { 165 | Nil -> Nil; 166 | Cons c l' -> 167 | case c of { 168 | (,) t t1 -> Cons ((,) (apply_subst s t) (apply_subst s t1)) (apply_subst_constraint s l')}} 169 | 170 | minus :: Varctxt -> (List Id) -> Varctxt 171 | minus c xs = 172 | case xs of { 173 | Nil -> c; 174 | Cons x xs0 -> remove x (minus c xs0)} 175 | 176 | type Unify_type = () -> Prelude.Maybe Substitution 177 | 178 | unify_body :: Constraints -> (Constraints -> () -> Unify_type) -> Prelude.Maybe Substitution 179 | unify_body l unify0 = 180 | case l of { 181 | (,) c l0 -> 182 | case l0 of { 183 | Nil -> Prelude.Just Nil; 184 | Cons c0 l' -> 185 | case c0 of { 186 | (,) t t' -> 187 | case eq_ty_dec t t' of { 188 | Prelude.False -> unify0 (mk_constraints c l') __ __; 189 | Prelude.True -> 190 | case t of { 191 | Var v -> 192 | case occurs_dec v t' of { 193 | Prelude.False -> Prelude.Nothing; 194 | Prelude.True -> 195 | case unify0 196 | (mk_constraints (minus c (Cons v Nil)) 197 | (apply_subst_constraint (Cons ((,) v t') Nil) l')) __ __ of { 198 | Prelude.Just s0 -> Prelude.Just (Cons ((,) v t') s0); 199 | Prelude.Nothing -> Prelude.Nothing}}; 200 | Arr l1 r -> 201 | case t' of { 202 | Var v -> 203 | case occurs_dec v t of { 204 | Prelude.False -> Prelude.Nothing; 205 | Prelude.True -> 206 | case unify0 207 | (mk_constraints (minus c (Cons v Nil)) 208 | (apply_subst_constraint (Cons ((,) v t) Nil) l')) __ __ of { 209 | Prelude.Just s0 -> Prelude.Just (Cons ((,) v t) s0); 210 | Prelude.Nothing -> Prelude.Nothing}}; 211 | Arr l1' r' -> 212 | unify0 (mk_constraints c (Cons ((,) l1 l1') (Cons ((,) r r') l'))) __ __; 213 | Con -> Prelude.Nothing}; 214 | Con -> 215 | case t' of { 216 | Var v -> 217 | case occurs_dec v t of { 218 | Prelude.False -> Prelude.Nothing; 219 | Prelude.True -> 220 | case unify0 221 | (mk_constraints (minus c (Cons v Nil)) 222 | (apply_subst_constraint (Cons ((,) v t) Nil) l')) __ __ of { 223 | Prelude.Just s0 -> Prelude.Just (Cons ((,) v t) s0); 224 | Prelude.Nothing -> Prelude.Nothing}}; 225 | _ -> Prelude.Nothing}}}}}} 226 | 227 | unify :: Constraints -> Prelude.Maybe Substitution 228 | unify l = 229 | well_founded_induction (\x x0 _ -> unify_body x x0) l __ 230 | 231 | data Term = 232 | Var_t Id 233 | | App_t Term Term 234 | | Lam_t Id Term 235 | | Const_t 236 | 237 | type Tyctx = List ((,) Id Ty) 238 | 239 | data Tc_state = 240 | MkState Id (List Id) (List ((,) Ty Ty)) 241 | 242 | type TcM a = Tc_state -> Prelude.Maybe ((,) Tc_state a) 243 | 244 | ret :: a1 -> TcM a1 245 | ret x s = 246 | Prelude.Just ((,) s x) 247 | 248 | bind :: (TcM a1) -> (a1 -> TcM a2) -> TcM a2 249 | bind c c' s = 250 | case c s of { 251 | Prelude.Just p -> 252 | case p of { 253 | (,) s' v -> c' v s'}; 254 | Prelude.Nothing -> Prelude.Nothing} 255 | 256 | failT :: TcM a1 257 | failT _ = 258 | Prelude.Nothing 259 | 260 | fresh :: TcM Ty 261 | fresh s = 262 | case s of { 263 | MkState n ts cs -> Prelude.Just ((,) (MkState (add (S O) n) (app ts (Cons n Nil)) cs) (Var 264 | n))} 265 | 266 | add_constr :: Ty -> Ty -> TcM () 267 | add_constr t t' s = 268 | case s of { 269 | MkState n ts cs -> Prelude.Just ((,) (MkState n ts (Cons ((,) t t') cs)) ())} 270 | 271 | look :: Id -> Tyctx -> TcM Ty 272 | look x g = 273 | case g of { 274 | Nil -> failT; 275 | Cons p g' -> 276 | case p of { 277 | (,) y t -> 278 | case eq_id_dec x y of { 279 | Prelude.False -> ret t; 280 | Prelude.True -> look x g'}}} 281 | 282 | gen_constr :: Tyctx -> Term -> TcM Ty 283 | gen_constr g t = 284 | case t of { 285 | Var_t v -> look v g; 286 | App_t l r -> 287 | bind (gen_constr g l) (\t1 -> 288 | bind (gen_constr g r) (\t2 -> 289 | bind fresh (\t0 -> bind (add_constr t1 (Arr t2 t0)) (\_ -> ret t0)))); 290 | Lam_t v t0 -> 291 | bind fresh (\t1 -> bind (gen_constr (Cons ((,) v t1) g) t0) (\t2 -> ret (Arr t1 t2))); 292 | Const_t -> ret Con} 293 | 294 | type_infer :: Term -> Prelude.Maybe Ty 295 | type_infer e = 296 | let {x = gen_constr Nil e (MkState O Nil Nil)} in 297 | case x of { 298 | Prelude.Just p -> 299 | case p of { 300 | (,) t0 t -> 301 | case t0 of { 302 | MkState _ d cs -> 303 | case unify ((,) d cs) of { 304 | Prelude.Just s0 -> Prelude.Just (apply_subst s0 t); 305 | Prelude.Nothing -> Prelude.Nothing}}}; 306 | Prelude.Nothing -> Prelude.Nothing} 307 | 308 | -------------------------------------------------------------------------------- /code/SCP/infer/stack.yaml: -------------------------------------------------------------------------------- 1 | # This file was automatically generated by 'stack init' 2 | # 3 | # Some commonly used options have been documented as comments in this file. 4 | # For advanced use and comprehensive documentation of the format, please see: 5 | # http://docs.haskellstack.org/en/stable/yaml_configuration/ 6 | 7 | # Resolver to choose a 'specific' stackage snapshot or a compiler version. 8 | # A snapshot resolver dictates the compiler version and the set of packages 9 | # to be used for project dependencies. For example: 10 | # 11 | # resolver: lts-3.5 12 | # resolver: nightly-2015-09-21 13 | # resolver: ghc-7.10.2 14 | # resolver: ghcjs-0.1.0_ghc-7.10.2 15 | # resolver: 16 | # name: custom-snapshot 17 | # location: "./custom-snapshot.yaml" 18 | resolver: lts-6.7 19 | 20 | # User packages to be built. 21 | # Various formats can be used as shown in the example below. 22 | # 23 | # packages: 24 | # - some-directory 25 | # - https://example.com/foo/bar/baz-0.0.2.tar.gz 26 | # - location: 27 | # git: https://github.com/commercialhaskell/stack.git 28 | # commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a 29 | # - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a 30 | # extra-dep: true 31 | # subdirs: 32 | # - auto-update 33 | # - wai 34 | # 35 | # A package marked 'extra-dep: true' will only be built if demanded by a 36 | # non-dependency (i.e. a user package), and its test suites and benchmarks 37 | # will not be run. This is useful for tweaking upstream packages. 38 | packages: 39 | - '.' 40 | # Dependency packages to be pulled from upstream that are not in the resolver 41 | # (e.g., acme-missiles-0.3) 42 | extra-deps: [] 43 | 44 | # Override default flag values for local packages and extra-deps 45 | flags: {} 46 | 47 | # Extra package databases containing global packages 48 | extra-package-dbs: [] 49 | 50 | # Control whether we use the GHC we find on the path 51 | # system-ghc: true 52 | # 53 | # Require a specific version of stack, using version ranges 54 | # require-stack-version: -any # Default 55 | # require-stack-version: ">=1.1" 56 | # 57 | # Override the architecture used by stack, especially useful on Windows 58 | # arch: i386 59 | # arch: x86_64 60 | # 61 | # Extra directories used by stack for building 62 | # extra-include-dirs: [/path/to/dir] 63 | # extra-lib-dirs: [/path/to/dir] 64 | # 65 | # Allow a newer minor version of GHC than the snapshot specifies 66 | # compiler-check: newer-minor -------------------------------------------------------------------------------- /code/SCP/infer/test/Spec.hs: -------------------------------------------------------------------------------- 1 | import STLC 2 | import Control.Monad 3 | import Test.QuickCheck 4 | import Data.Maybe 5 | import qualified TypeInfer as Infer 6 | 7 | -- some instances to be used by QuickCheck test generators 8 | 9 | instance Arbitrary Nat where 10 | arbitrary 11 | = oneof [ return O 12 | , liftM S arbitrary ] 13 | 14 | instance Arbitrary Ty where 15 | arbitrary 16 | = oneof [ return Con 17 | , liftM2 Arr arbitrary arbitrary ] 18 | 19 | -- checking if a type is inhabited, i.e. is an intuitionistic logic tautology 20 | 21 | taut :: [Ty] -> Ty -> Bool 22 | taut ctx (Arr l r) = taut (l : ctx) r 23 | taut ctx t = atom ctx t 24 | 25 | atom :: [Ty] -> Ty -> Bool 26 | atom ctx t = try [] ctx 27 | where 28 | try js [] = False 29 | try js (h : hs) = from h t (js ++ hs) || 30 | try (h : js) hs 31 | 32 | from :: Ty -> Ty -> [Ty] -> Bool 33 | from Con a ctx = a == Con 34 | from (Arr l r) a ctx = from r a ctx && taut ctx l 35 | 36 | 37 | -- generates only type correct terms 38 | 39 | typeCorrect :: Gen Term 40 | typeCorrect 41 | = do 42 | t <- suchThat arbitrary (taut []) 43 | genTerm [] t 44 | 45 | genTerm :: Tyctx -> Ty -> Gen Term 46 | genTerm [] Con = return Const_t 47 | genTerm ctx Con 48 | = do 49 | let ctx' = [p | p <- ctx, Con == (snd p)] 50 | if null ctx' then return Const_t 51 | else liftM (Var_t . fst) (elements ctx') 52 | genTerm ctx (Arr l r) 53 | = do 54 | v <- arbitrary :: Gen Nat 55 | liftM (Lam_t v) (genTerm ((v,l):ctx) r) 56 | 57 | -- some isos 58 | 59 | convertTy :: Infer.Ty -> Ty 60 | convertTy Infer.Con = Con 61 | convertTy (Infer.Var v) = Var (convertNat1 v) 62 | convertTy (Infer.Arr l r) = Arr (convertTy l) (convertTy r) 63 | 64 | convertNat1 :: Infer.Nat -> Nat 65 | convertNat1 Infer.O = O 66 | convertNat1 (Infer.S n) = S (convertNat1 n) 67 | 68 | convertNat :: Nat -> Infer.Nat 69 | convertNat O = Infer.O 70 | convertNat (S n) = Infer.S (convertNat n) 71 | 72 | convertTerm :: Term -> Infer.Term 73 | convertTerm Const_t = Infer.Const_t 74 | convertTerm (Var_t v) = Infer.Var_t (convertNat v) 75 | convertTerm (Lam_t v t) = Infer.Lam_t (convertNat v) (convertTerm t) 76 | convertTerm (App_t l r) = Infer.App_t (convertTerm l) (convertTerm r) 77 | 78 | -- property for well typed terms 79 | 80 | typeInferCorrect :: (Term -> Bool) -> Property 81 | typeInferCorrect f = forAll typeCorrect f 82 | 83 | -- running test suite 84 | 85 | main :: IO () 86 | main = do 87 | verboseCheck (typeInferCorrect (isJust . type_infer)) 88 | verboseCheck (typeInferCorrect (isJust . Infer.type_infer . convertTerm)) 89 | -------------------------------------------------------------------------------- /code/SCP/makefile: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## v # The Coq Proof Assistant ## 3 | ## $@ 202 | printf 'cd "$${DSTROOT}"$(COQLIBINSTALL)/Top && rm -f $(VOFILES) $(VFILES) $(GLOBFILES) $(NATIVEFILES) $(CMOFILES) $(CMIFILES) $(CMAFILES) && find . -type d -and -empty -delete\ncd "$${DSTROOT}"$(COQLIBINSTALL) && find "Top" -maxdepth 0 -and -empty -exec rmdir -p \{\} \;\n' >> "$@" 203 | printf 'cd "$${DSTROOT}"$(COQDOCINSTALL)/Top \\\n' >> "$@" 204 | printf '&& rm -f $(shell find "html" -maxdepth 1 -and -type f -print)\n' >> "$@" 205 | printf 'cd "$${DSTROOT}"$(COQDOCINSTALL) && find Top/html -maxdepth 0 -and -empty -exec rmdir -p \{\} \;\n' >> "$@" 206 | chmod +x $@ 207 | 208 | uninstall: uninstall_me.sh 209 | sh $< 210 | 211 | clean:: 212 | rm -f $(OBJFILES) $(OBJFILES:.o=.native) $(NATIVEFILES) 213 | find . -name .coq-native -type d -empty -delete 214 | rm -f $(VOFILES) $(VOFILES:.vo=.vio) $(GFILES) $(VFILES:.v=.v.d) $(VFILES:=.beautified) $(VFILES:=.old) 215 | rm -f all.ps all-gal.ps all.pdf all-gal.pdf all.glob $(VFILES:.v=.glob) $(VFILES:.v=.tex) $(VFILES:.v=.g.tex) all-mli.tex 216 | - rm -rf html mlihtml uninstall_me.sh 217 | 218 | cleanall:: clean 219 | rm -f $(patsubst %.v,.%.aux,$(VFILES)) 220 | 221 | archclean:: 222 | rm -f *.cmx *.o 223 | 224 | printenv: 225 | @"$(COQBIN)coqtop" -config 226 | @echo 'CAMLC = $(CAMLC)' 227 | @echo 'CAMLOPTC = $(CAMLOPTC)' 228 | @echo 'PP = $(PP)' 229 | @echo 'COQFLAGS = $(COQFLAGS)' 230 | @echo 'COQLIBINSTALL = $(COQLIBINSTALL)' 231 | @echo 'COQDOCINSTALL = $(COQDOCINSTALL)' 232 | 233 | ################### 234 | # # 235 | # Implicit rules. # 236 | # # 237 | ################### 238 | 239 | $(VOFILES): %.vo: %.v 240 | $(COQC) $(COQDEBUG) $(COQFLAGS) $* 241 | 242 | $(GLOBFILES): %.glob: %.v 243 | $(COQC) $(COQDEBUG) $(COQFLAGS) $* 244 | 245 | $(VFILES:.v=.vio): %.vio: %.v 246 | $(COQC) -quick $(COQDEBUG) $(COQFLAGS) $* 247 | 248 | $(GFILES): %.g: %.v 249 | $(GALLINA) $< 250 | 251 | $(VFILES:.v=.tex): %.tex: %.v 252 | $(COQDOC) $(COQDOCFLAGS) -latex $< -o $@ 253 | 254 | $(HTMLFILES): %.html: %.v %.glob 255 | $(COQDOC) $(COQDOCFLAGS) -html $< -o $@ 256 | 257 | $(VFILES:.v=.g.tex): %.g.tex: %.v 258 | $(COQDOC) $(COQDOCFLAGS) -latex -g $< -o $@ 259 | 260 | $(GHTMLFILES): %.g.html: %.v %.glob 261 | $(COQDOC) $(COQDOCFLAGS) -html -g $< -o $@ 262 | 263 | $(addsuffix .d,$(VFILES)): %.v.d: %.v 264 | $(COQDEP) $(COQLIBS) "$<" > "$@" || ( RV=$$?; rm -f "$@"; exit $${RV} ) 265 | 266 | $(addsuffix .beautified,$(VFILES)): %.v.beautified: 267 | $(COQC) $(COQDEBUG) $(COQFLAGS) -beautify $* 268 | 269 | # WARNING 270 | # 271 | # This Makefile has been automagically generated 272 | # Edit at your own risks ! 273 | # 274 | # END OF WARNING 275 | 276 | -------------------------------------------------------------------------------- /paper/SBMF2015/algorithm.tex: -------------------------------------------------------------------------------- 1 | \section{The Unification Algorithm}\label{algorithm-section} 2 | 3 | We use the following standard presentation of the first-order 4 | unification algorithm, where $\tau\equiv\tau'$ denotes a decidable 5 | equality test between $\tau$ and $\tau'$: 6 | 7 | \begin{figure} 8 | \[ 9 | \small{ 10 | \begin{array}{ll} 11 | (1) & \unify([\: ]) = [\: ]\\ 12 | (2) & \unify((\alpha \eeq \alpha) :: \mathbb{C}) = \unify(\mathbb{C})\\ 13 | (3) & \unify((\alpha \eeq\tau) :: \mathbb{C}) = 14 | \If \occurs(\alpha,\tau) \Then \fail \Else \unify([\alpha\mapsto\tau]\mathbb{C})\circ [\alpha \mapsto \tau]\\ 15 | (4) & \unify((\tau \eeq\alpha) :: \mathbb{C}) = 16 | \If \occurs(\alpha,\tau) \Then \fail \Else \unify([\alpha\mapsto\tau]\mathbb{C})\circ [\alpha \mapsto \tau]\\ 17 | (5) & \unify((\tau_1\to\tau_2 \eeq \tau\to\tau')::\mathbb{C}) = 18 | \unify((\tau_1\eeq\tau)::(\tau_2\eeq\tau')::\mathbb{C}) \\ 19 | (6) & \unify((\tau \eeq \tau')::\mathbb{C}) = \If \tau\equiv\tau' \Then \unify(\mathbb{C}) \Else \fail 20 | \end{array}} 21 | \] 22 | \caption{Unification algorithm.} 23 | \label{unifyalgorithm} 24 | \end{figure} 25 | 26 | Our formalization differs from the presented algorithm (Figure 27 | \ref{unifyalgorithm}) in two aspects: 28 | \begin{itemize} 29 | \item Since this presentation of the unification algorithm is 30 | general recursive, i.e., the recursive calls aren't necessarily 31 | made on structurally smaller arguments, we need to define it 32 | using recursion on proofs that $\unify$'s arguments form a 33 | well-founded relation~\ccite{Bertot04}. 34 | \item Instead of returning just a substitution that represents the 35 | argument constraint unifier, we return a proof that such 36 | substitution is indeed its most general unifier or a proof 37 | explaining that such unifier does not exist, when $\unify$ fails. 38 | \end{itemize} 39 | 40 | These two aspect are discussed in Sections \ref{termination} and 41 | \ref{soundness}, respectively. 42 | 43 | It is worth mentioning that there are some Coq extensions that make 44 | the definitions of general recursive functions and functions defined 45 | by pattern matching on dependent types easier, namely commands 46 | \texttt{Function} and \texttt{Program}, respectively. However, 47 | according to \cite{coq}, these are experimental extensions. Thus, we 48 | prefer to use well established approaches to overcome these problems: 49 | 1) use of a recursion principle derived from the definition of a 50 | well-founded relation~\ccite{Bertot04} and 2) annotate every pattern 51 | matching construct in order to make explicit the relation between 52 | function argument and return types. 53 | -------------------------------------------------------------------------------- /paper/SBMF2015/aliascnt.sty: -------------------------------------------------------------------------------- 1 | %% 2 | %% This is file `aliascnt.sty', 3 | %% generated with the docstrip utility. 4 | %% 5 | %% The original source files were: 6 | %% 7 | %% aliascnt.dtx (with options: `package') 8 | %% 9 | %% This is a generated file. 10 | %% 11 | %% Project: aliascnt 12 | %% Version: 2009/09/08 v1.3 13 | %% 14 | %% Copyright (C) 2006, 2009 by 15 | %% Heiko Oberdiek 16 | %% 17 | %% This work may be distributed and/or modified under the 18 | %% conditions of the LaTeX Project Public License, either 19 | %% version 1.3c of this license or (at your option) any later 20 | %% version. This version of this license is in 21 | %% http://www.latex-project.org/lppl/lppl-1-3c.txt 22 | %% and the latest version of this license is in 23 | %% http://www.latex-project.org/lppl.txt 24 | %% and version 1.3 or later is part of all distributions of 25 | %% LaTeX version 2005/12/01 or later. 26 | %% 27 | %% This work has the LPPL maintenance status "maintained". 28 | %% 29 | %% This Current Maintainer of this work is Heiko Oberdiek. 30 | %% 31 | %% This work consists of the main source file aliascnt.dtx 32 | %% and the derived files 33 | %% aliascnt.sty, aliascnt.pdf, aliascnt.ins, aliascnt.drv. 34 | %% 35 | \NeedsTeXFormat{LaTeX2e} 36 | \ProvidesPackage{aliascnt}% 37 | [2009/09/08 v1.3 Alias counter (HO)]% 38 | \newcommand*{\newaliascnt}[2]{% 39 | \begingroup 40 | \def\AC@glet##1{% 41 | \global\expandafter\let\csname##1#1\expandafter\endcsname 42 | \csname##1#2\endcsname 43 | }% 44 | \@ifundefined{c@#2}{% 45 | \@nocounterr{#2}% 46 | }{% 47 | \expandafter\@ifdefinable\csname c@#1\endcsname{% 48 | \AC@glet{c@}% 49 | \AC@glet{the}% 50 | \AC@glet{theH}% 51 | \AC@glet{p@}% 52 | \expandafter\gdef\csname AC@cnt@#1\endcsname{#2}% 53 | \expandafter\gdef\csname cl@#1\expandafter\endcsname 54 | \expandafter{\csname cl@#2\endcsname}% 55 | }% 56 | }% 57 | \endgroup 58 | } 59 | \newcommand*{\aliascntresetthe}[1]{% 60 | \@ifundefined{AC@cnt@#1}{% 61 | \PackageError{aliascnt}{% 62 | `#1' is not an alias counter% 63 | }\@ehc 64 | }{% 65 | \expandafter\let\csname the#1\expandafter\endcsname 66 | \csname the\csname AC@cnt@#1\endcsname\endcsname 67 | }% 68 | } 69 | \newcommand*{\AC@findrootcnt}[1]{% 70 | \@ifundefined{AC@cnt@#1}{% 71 | #1% 72 | }{% 73 | \expandafter\AC@findrootcnt\csname AC@cnt@#1\endcsname 74 | }% 75 | } 76 | \def\AC@patch#1{% 77 | \expandafter\let\csname AC@org@#1reset\expandafter\endcsname 78 | \csname @#1reset\endcsname 79 | \expandafter\def\csname @#1reset\endcsname##1##2{% 80 | \csname AC@org@#1reset\endcsname{##1}{\AC@findrootcnt{##2}}% 81 | }% 82 | } 83 | \RequirePackage{remreset} 84 | \AC@patch{addto} 85 | \AC@patch{removefrom} 86 | \endinput 87 | %% 88 | %% End of file `aliascnt.sty'. 89 | -------------------------------------------------------------------------------- /paper/SBMF2015/conclusion.tex: -------------------------------------------------------------------------------- 1 | \section{Conclusion}\label{conclusion} 2 | 3 | We have given a complete formalization of termination, soundness and 4 | completeness of a type unification algorithm in the Coq proof 5 | assistant. To the best of our knowledge, the proposed formalization is 6 | the first to follow the structure of termination proofs presented in 7 | classical textbooks on type systems~\ccite{Pierce02,Mitchell96}. Soundness and completeness proofs of 8 | unification are coupled with the algorithm definition and are filled 9 | by scripted proof tactics using previously proved lemmas. 10 | 11 | The developed formalization has 610 lines of code and around 94 lines of comments. 12 | The formalization is composed of 31 lemmas and theorems, 34 type and 13 | function definitions and 2 inductive types. Most of the implementation 14 | effort has been done on proving termination, which takes 293 lines of 15 | our code, expressed in 21 theorems. Compared with Kothari's 16 | implementation, that is written in more than 1000 lines, our code is 17 | more compact. 18 | 19 | We intend to use this formalization to develop a complete type 20 | inference algorithm for Haskell in the Coq proof assistant. The 21 | developed work is available online~\ccite{unify-rep}. 22 | -------------------------------------------------------------------------------- /paper/SBMF2015/coq-taste.tex: -------------------------------------------------------------------------------- 1 | \section{A Taste of Coq Proof Assistant}\label{coq} 2 | 3 | Coq is a proof assistant based on the calculus of inductive 4 | constructions (CIC) \ccite{Bertot04}, a higher order typed 5 | $\lambda$-calculus extended with inductive definitions. Theorem 6 | proving in Coq follows the ideas of the so-called 7 | ``BHK-cor\-res\-pon\-dence''\footnote{Abbreviation of Brouwer, Heyting, 8 | Kolmogorov, de Bruijn and Martin-L\"of Correspondence. This is also 9 | known as the Curry-Howard ``isomorphism''.}, where types represent 10 | logical formulas, $\lambda$-terms represent proofs 11 | \ccite{CurryHoward06} and the task of checking if a piece of text is a 12 | proof of a given formula corresponds to checking if the term that 13 | represents the proof has the type corresponding to the given formula. 14 | 15 | However, writing a proof term whose type is that of a logical formula 16 | can be a hard task, even for very simple propositions. In order to 17 | make the writing of complex proofs easier, Coq provides 18 | \emph{tactics}, which are commands that can be used to construct proof 19 | terms in a more user friendly way. 20 | 21 | As a tiny example, consider the task of proving the following simple 22 | formula of propositional logic: 23 | \[ 24 | (A \to B)\to (B\to C) \to A \to C 25 | \] 26 | In Coq, such theorem can be expressed as: 27 | \begin{lstlisting} 28 | Section EXAMPLE. 29 | Variables A B C : Prop. 30 | Theorem example : (A -> B) -> (B -> C) -> A -> C. 31 | Proof. 32 | intros H H' HA. apply H'. apply H. assumption. 33 | Qed. 34 | End EXAMPLE. 35 | \end{lstlisting} 36 | In the previous source code piece, we have defined a Coq section named 37 | \texttt{EXAMPLE}\footnote{In Coq, we can use sections to delimit the 38 | scope of local variables.} which declares variables \texttt{A}, 39 | \texttt{B} and \texttt{C} as being propositions (i.e. with type 40 | \texttt{Prop}). Tactic \texttt{intros} introduces variables 41 | \texttt{H}, \texttt{H'} and \texttt{HA} into the (typing) context, 42 | respectively with types \texttt{A -> B}, \texttt{B -> C} and 43 | \texttt{A} and leaves goal \texttt{C} to be proved. Tactic 44 | \texttt{apply}, used with a term \texttt{t}, generates goal \texttt{P} 45 | when there exists \texttt{t: P -> Q} in the typing context and the 46 | current goal is \texttt{Q}. Thus, \texttt{apply H'} changes the goal 47 | from \texttt{C} to \texttt{B} and \texttt{apply H} changes the goal to 48 | \texttt{A}. Tactic \texttt{assumption} traverses the typing context to 49 | find a hypothesis that matches with the goal. 50 | 51 | We define next a proof of the previous propositional logical formula 52 | that, in contrast to the previous proof, that was built using tactics 53 | (\texttt{intros}, \texttt{apply} and \texttt{assumption}), is coded 54 | directly as a function: 55 | \begin{lstlisting} 56 | Definition example' : (A -> B) -> (B -> C) -> A -> C := 57 | fun (H : A -> B) (H' : B -> C) (HA : A) => H' (H HA). 58 | \end{lstlisting} 59 | However, even for very simple theorems, coding a definition directly 60 | as a Coq term can be a hard task. Because of this, the use of tactics 61 | has become the standard way of proving theorems in Coq. Furthermore, 62 | the Coq proof assistant provides not only a great number of tactics 63 | but also a domain specific language for scripted proof automation, 64 | called $\mathcal{L}$tac. In this work, the developed proofs follow the 65 | style advocated by Chlipala~\cite{Chlipala13}, where most proofs are 66 | built using $\mathcal{L}$tac scripts, to automate proof steps and make 67 | them more robust. Details about $\mathcal{L}$tac can be found 68 | in~\cite{Chlipala13,Bertot04}. 69 | 70 | %We briefly illustrate these notions by means of a small example, shown 71 | % in Figure \ref{fig:coq-code-ex1}. 72 | % \begin{figure}[h] 73 | % \begin{lstlisting} 74 | % Inductive nat : Set := 75 | % | O : nat 76 | % | S : nat -> nat. 77 | 78 | % Fixpoint plus (n m : nat) : nat := 79 | % match n with 80 | % | O => m 81 | % | S n' => S (plus n' m) 82 | % end. 83 | 84 | % Theorem plus_0_r : forall n, plus n 0 = n. 85 | % Proof. 86 | % intros n. 87 | % induction n as [| n']. 88 | % (**Case n = 0**) 89 | % reflexivity. 90 | % (**Case n = S n' **) 91 | % simpl. 92 | % rewrite -> IHn'. 93 | % reflexivity. 94 | % Qed. 95 | % \end{lstlisting} 96 | % \centering 97 | % \caption{Sample Coq code} 98 | % \label{fig:coq-code-ex1} 99 | % \end{figure} 100 | 101 | % The source code in Figure~\ref{fig:coq-code-ex1} shows some basic 102 | % features of the Coq proof assistant: types, functions and proof definitions. 103 | % In this example, a new inductive type is defined to represent 104 | % natural numbers in Peano notation. This 105 | % type is formed by two data constructors: \texttt{O}, that represents the 106 | % number $0$; and \texttt{S}, the successor function. For instance, in this 107 | % notation the number 108 | % $2$ is represented by the term \texttt{S (S O)} of type \texttt{nat}. 109 | 110 | % The command \texttt{Fixpoint} allows the definition of structural recursive 111 | % functions. Function \texttt{plus} defines the sum of two unary 112 | % natural numbers, in a straightforward way. It is noteworthy that, in order 113 | % to maintain logical consistency, all functions in Coq must be total. 114 | 115 | % Besides the declaration of inductive types and functions, we can 116 | % define and prove theorems in Coq. 117 | % Figure~\ref{fig:coq-code-ex1} 118 | % shows an example of a simple theorem about function \texttt{plus}, namely 119 | % that, for an arbitrary value \texttt{n} of type \texttt{nat}, we have that 120 | % \texttt{plus n 0 = n}. The command \texttt{Theorem} allows 121 | % us to state some formula that we want to prove and it starts the 122 | % \emph{interactive proof mode}, in which tactics can be used to produce 123 | % the wanted proof term. In an interactive section of Coq (after enunciation of 124 | % theorem \texttt{plus\_O\_r}), we must prove the following goal: 125 | % \begin{lstlisting} 126 | % ============================= 127 | % forall n : nat, plus n 0 = n 128 | % \end{lstlisting} 129 | % After command \texttt{Proof.}, one can use tactics to build, step by 130 | % step, a term of the given type. The first tactic, \texttt{intros}, is used 131 | % to move premisses and universally quantified variables from the goal to the 132 | % hypothesis. Now, we need to prove: 133 | % \begin{lstlisting} 134 | % n : nat 135 | % ============================= 136 | % plus n 0 = n 137 | % \end{lstlisting} 138 | % The quantified variable \texttt{n} has been moved from the \texttt{goal} 139 | % to the hypothesis. Now, we can proceed by induction over the structure of 140 | % \texttt{n}. This can be achieved by using tactic \texttt{induction}, that 141 | % generates one goal for each constructor of type \texttt{nat}. This will 142 | % leave us with the following two goals to be proved: 143 | % \begin{lstlisting} 144 | % 2 subgoals 145 | 146 | % ============================ 147 | % plus 0 0 = 0 148 | 149 | % subgoal 2 is: 150 | % S n' + 0 = S n' 151 | % \end{lstlisting} 152 | % The goal \texttt{plus 0 0 = 0} holds trivaly by the definition of \texttt{plus}. 153 | % Tactic \texttt{reflexivity} proves trivial equalities, after reducing both sides 154 | % of the equality to their normal forms. The next goal to be proved is: 155 | % \begin{lstlisting} 156 | % n' : nat 157 | % IHn' : plus n' 0 = n' 158 | % ============================ 159 | % plus (S n') 0 = S n' 160 | % \end{lstlisting} 161 | % The hypothesis \texttt{IHn'} is the automatically generated induction hypothesis for 162 | % this theorem. In order to finish this proof, we need to transform the goal to 163 | % use the inductive hypothesis. To do this, we use the tactic \texttt{simpl}, which performs 164 | % reductions based on the definition of function \texttt{plus}. This changes the goal 165 | % to: 166 | % \begin{lstlisting} 167 | % n' : nat 168 | % IHn' : plus n' 0 = n' 169 | % ============================ 170 | % S (plus n' 0) = S n' 171 | % \end{lstlisting} 172 | % Since the goal now has as a subterm the exact left hand side of the hypothesis 173 | % \texttt{IHn'}, we can use the \texttt{rewrite} tactic, which replaces some term by 174 | % another using some equality in the hypothesis. Now, we have the following goal: 175 | % \begin{lstlisting} 176 | % n' : nat 177 | % IHn' : plus n' 0 = n' 178 | % ============================ 179 | % S n' = S n' 180 | % \end{lstlisting} 181 | % This can be proved immediately using the \texttt{reflexivity} tactic. 182 | % This tactic script builds the following term: 183 | % \begin{lstlisting} 184 | % fun n : nat => 185 | % nat_ind 186 | % (fun n0 : nat => n0 + 0 = n0) (eq_refl 0) 187 | % (fun (n' : nat) (IHn' : n' + 0 = n') => 188 | % eq_ind_r (fun n0 : nat => S n0 = S n') 189 | % (eq_refl (S n')) IHn') n 190 | % : forall n : nat, n + 0 = n 191 | % \end{lstlisting} 192 | % Instead of using tactics, one could instead write CIC terms directly 193 | % to prove theorems. This is however a complex task, even for simple 194 | % theorems like \mbox{\texttt{plus\_O\_r}}, since the manual writing of 195 | % proof terms requires know\-ledge of the CIC type system. Thus, 196 | % tactics frees us from the details of constructing type correct CIC 197 | % terms. 198 | 199 | % An interesting feature of Coq is the possibility of defining inductive 200 | % types that mix computational and logic parts. This allows us to define 201 | % functions that compute values together with a proof that this value 202 | % has some desired property. Type \texttt{sig}, also called ``subset 203 | % type'', is defined in Coq's standard library as: 204 | % \begin{lstlisting} 205 | % Inductive sig (A : Set) 206 | % (P : A -> Prop) : Set := 207 | % | exist : forall x : A, P x -> sig A P. 208 | % \end{lstlisting} 209 | % The \texttt{exist} constructor takes two arguments: the value \texttt{x} 210 | % of type \texttt{A} --- that represents the computational part --- and 211 | % an argument of type \texttt{P x} --- the ``certificate'' that the value 212 | % \texttt{x} has the property specified by the predicate \texttt{P}. 213 | % As an example of a \texttt{sig} type, consider: 214 | % \begin{lstlisting} 215 | % forall n : nat, n <> 0 -> {p | n = S p}. 216 | % \end{lstlisting} 217 | 218 | % %This uses the Notation: 219 | % % "{ x : A | P }" := sig (fun x : A => P) 220 | % %That is, it is equivalent to: 221 | % %\begin{lstlisting} 222 | % %forall n : nat, n <> 0 -> sig (fun (S p) => n) 223 | % %\end{lstlisting} 224 | 225 | % This type represents a function that returns the predecessor of a natural 226 | % number \texttt{n}, together with a proof that the returned value \texttt{p} really 227 | % is the predecessor of \texttt{n}. Defining functions using the \texttt{sig} type 228 | % requires writing the corresponding logical certificate. As with theorems, 229 | % we can use tactics to define such functions. 230 | % \begin{lstlisting} 231 | % Definition pred_certified : 232 | % forall n : nat, n <> 0 -> {p | n = S p}. 233 | % intros n H. 234 | % destruct n as [| n']. 235 | % (**Case n = 0**) 236 | % elim H. reflexivity. 237 | % (**Case n = S n'**) 238 | % exists n'. reflexivity. 239 | % Defined. 240 | % \end{lstlisting} 241 | 242 | % Using the command \texttt{Extraction pred\_certified} we can discard 243 | % the logical part of this function definition and get a certified 244 | % implementation of this function in OCaml~\cite{OCaml}, Haskell~\cite{Haskell98} or Scheme~\cite{Scheme}. 245 | % The OCaml code of this function, obtained through extraction, is the following: 246 | 247 | % % pred_cert below should be: pred_certified 248 | 249 | % \begin{lstlisting} 250 | % (** val pred_cert : nat -> nat **) 251 | % let pred_cert = function 252 | % | O -> assert false (* absurd case *) 253 | % | S n0 -> n0 254 | % \end{lstlisting} 255 | -------------------------------------------------------------------------------- /paper/SBMF2015/introduction.tex: -------------------------------------------------------------------------------- 1 | \section{Introduction} 2 | 3 | Modern functional programming languages like Haskell~\ccite{Haskell98} 4 | and ML~\ccite{Milner90} provide type inference to free the programmer 5 | from having to write (almost all) type annotations in 6 | programs. Compilers for these languages can discover missing type 7 | information through a process called type inference~\ccite{Milner78}. 8 | 9 | Type inference algorithms are usually divided into two components: 10 | constraint generation and constraint solving~\ccite{Pottier05}. For 11 | languages that use ML-style (or parametric) polymorphism, constraint 12 | solving reduces to first order unification. 13 | 14 | A sound and complete algorithm for first order unification is due to 15 | Robinson~\ccite{Robinson65}. The soundness and completeness proofs 16 | have a constructive nature, and can thus be formalized in proof 17 | assistant systems based on type theory, like Coq~\ccite{Bertot04} and 18 | Agda~\ccite{Bove09}. Formalizations of unification have been reported 19 | before in the literature~\ccite{Paulson93,Bove99,McBride03,Kothari10} 20 | using different proof assistants, but none of them follows the style 21 | of textbook proofs (cf.~e.g.~\ccite{Mitchell96,Pierce02}). 22 | 23 | As a first step towards a full formalization of a type inference 24 | algorithm for Haskell, in this article, we describe 25 | an axiom-free formalization of type unification in the Coq proof 26 | assistant, that follows classic algorithms on type systems for 27 | programming languages~\ccite{Mitchell96,Pierce02}. The formalization 28 | is ``axiom-free'' because it does not depend on axioms like function 29 | extensionality, proof irrelevance or the law of the excluded middle, 30 | i.e.~our results are integrally proven in Coq. 31 | 32 | More specifically, our contributions are: 33 | \begin{enumerate} 34 | 35 | \item A mechanization of a termination proof as it can be found in 36 | e.g.~\ccite{Mitchell96,Pierce02}. In these books, the proof is 37 | described as ``easy to check''. In our formalization, it was 38 | necessary to decompose the proof in several lemmas in order to 39 | convince Coq's termination checker. 40 | 41 | \item A correct by construction formalization of unification. In our 42 | formalization the unification function has a dependent type that 43 | specifies that unification produces the most general unifier of a 44 | given set of equality constraints, or a proof that explains why 45 | this set of equalities does not have a unifier (i.e.~our 46 | unification definition is a view~\ccite{McBride04} on lists of 47 | equality constraints). 48 | \end{enumerate} 49 | 50 | We chose Coq to develop this formalization because it is an industrial 51 | strength proof assistant that has been used in several large scale 52 | projects such as a Certified C compiler~\ccite{XLeroy09}, a Java Card 53 | platform~\ccite{Barthe02} and on verification of mathematical theorems 54 | (cf.~e.g.~\ccite{Gonthier07,Gonthier13}). 55 | 56 | The rest of this paper is organized as follows. Section \ref{coq} 57 | presents a brief introduction to the Coq proof assistant. Section 58 | \ref{definitions} presents some definitions used in the 59 | formalization. Section \ref{algorithm-section} presents the 60 | unification algorithm. Termination, soundness and completeness proofs 61 | are described in Sections \ref{termination} and \ref{soundness}, 62 | respectively. Section \ref{tactics} presents details about proof 63 | automation techniques used in our formalization. 64 | Section \ref{related} presents related work and Section \ref{conclusion} 65 | concludes. 66 | 67 | While all the code on which this paper is based has been developed in 68 | Coq, we adopt a ``lighter'' syntax in the presentation of its code 69 | fragments. In the introductory Section \ref{coq}, however, we present 70 | small Coq source code pieces. We chose this presentation style in 71 | order to improve readability, because functions that use dependently 72 | typed pattern matching require a high number of type annotations, that 73 | would deviate from our objective of providing a formalization that is 74 | easy to understand. 75 | %The only exception is the tactics used to prove 76 | %soundness and completeness theorems, that are presented in Section 77 | %\ref{tactics}. 78 | For theorems and lemmas, we sketch the proof strategy 79 | but omit tactic scripts. The developed formalization was verified 80 | using Coq version 8.4 and it is available online~\ccite{unify-rep}. 81 | -------------------------------------------------------------------------------- /paper/SBMF2015/llncsdoc.sty: -------------------------------------------------------------------------------- 1 | % This is LLNCSDOC.STY the modification of the 2 | % LLNCS class file for the documentation of 3 | % the class itself. 4 | % 5 | \def\AmS{{\protect\usefont{OMS}{cmsy}{m}{n}% 6 | A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}} 7 | \def\AmSTeX{{\protect\AmS-\protect\TeX}} 8 | % 9 | \def\ps@myheadings{\let\@mkboth\@gobbletwo 10 | \def\@oddhead{\hbox{}\hfil\small\rm\rightmark 11 | \qquad\thepage}% 12 | \def\@oddfoot{}\def\@evenhead{\small\rm\thepage\qquad 13 | \leftmark\hfil}% 14 | \def\@evenfoot{}\def\sectionmark##1{}\def\subsectionmark##1{}} 15 | \ps@myheadings 16 | % 17 | \setcounter{tocdepth}{2} 18 | % 19 | \renewcommand{\labelitemi}{--} 20 | \newenvironment{alpherate}% 21 | {\renewcommand{\labelenumi}{\alph{enumi})}\begin{enumerate}}% 22 | {\end{enumerate}\renewcommand{\labelenumi}{enumi}} 23 | % 24 | \def\bibauthoryear{\begingroup 25 | \def\thebibliography##1{\section*{References}% 26 | \small\list{}{\settowidth\labelwidth{}\leftmargin\parindent 27 | \itemindent=-\parindent 28 | \labelsep=\z@ 29 | \usecounter{enumi}}% 30 | \def\newblock{\hskip .11em plus .33em minus -.07em}% 31 | \sloppy 32 | \sfcode`\.=1000\relax}% 33 | \def\@cite##1{##1}% 34 | \def\@lbibitem[##1]##2{\item[]\if@filesw 35 | {\def\protect####1{\string ####1\space}\immediate 36 | \write\@auxout{\string\bibcite{##2}{##1}}}\fi\ignorespaces}% 37 | \begin{thebibliography}{} 38 | \bibitem[1982]{clar:eke3} Clarke, F., Ekeland, I.: Nonlinear 39 | oscillations and boundary-value problems for Hamiltonian systems. 40 | Arch. Rat. Mech. Anal. {\bf 78} (1982) 315--333 41 | \end{thebibliography} 42 | \endgroup} 43 | -------------------------------------------------------------------------------- /paper/SBMF2015/makefile: -------------------------------------------------------------------------------- 1 | default: pdf 2 | 3 | clean : 4 | rm *.pdf 5 | rm *.toc 6 | rm *.aux 7 | rm *.log 8 | rm *.blg 9 | 10 | pdf: 11 | pdflatex unify.tex 12 | bibtex unify 13 | pdflatex unify.tex 14 | pdflatex unify.tex 15 | -------------------------------------------------------------------------------- /paper/SBMF2015/proof.sty: -------------------------------------------------------------------------------- 1 | % proof.sty (Proof Figure Macros) 2 | % 3 | % version 3.1 (for both LaTeX 2.09 and LaTeX 2e) 4 | % Nov 24, 2005 5 | % Copyright (C) 1990 -- 2005, Makoto Tatsuta (tatsuta@nii.ac.jp) 6 | % 7 | % This program is free software; you can redistribute it or modify 8 | % it under the terms of the GNU General Public License as published by 9 | % the Free Software Foundation; either versions 1, or (at your option) 10 | % any later version. 11 | % 12 | % This program is distributed in the hope that it will be useful 13 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | % GNU General Public License for more details. 16 | % 17 | % Usage: 18 | % In \documentstyle, specify an optional style `proof', say, 19 | % \documentstyle[proof]{article}. 20 | % 21 | % The following macros are available: 22 | % 23 | % In all the following macros, all the arguments such as 24 | % and are processed in math mode. 25 | % 26 | % \infer 27 | % draws an inference. 28 | % 29 | % Use & in to delimit upper formulae. 30 | % consists more than 0 formulae. 31 | % 32 | % \infer returns \hbox{ ... } or \vbox{ ... } and 33 | % sets \@LeftOffset and \@RightOffset globally. 34 | % 35 | % \infer[