Changeset 14


Ignore:
Timestamp:
Nov 16, 2012, 10:38:01 AM (13 years ago)
Author:
gobi
Message:

removing some debug

Location:
sizechecking
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sizechecking/Constraints.hs

    r6 r14  
    158158        l1 <- checkCond1 v1 (Condition ((h `LTC` f):d) e' x) 
    159159        l2 <- checkCond1 v2 (Condition ((h `GEC` f):d) g' x) 
    160         putStrLn $ " -> " ++ show l1 
    161         putStrLn $ " -> " ++ show l2 
     160--        putStrLn $ " -> " ++ show l1 
     161--        putStrLn $ " -> " ++ show l2 
    162162        return $ l1 ++ l2 
    163163    checkCond1 v z@(Condition d (App (Var a) x) (App (Var b) y)) | a==b = 
     
    321321    '-' -> al - bl 
    322322    '*' -> al * bl 
     323    '/' -> al `SBV.sDiv` bl 
    323324    where 
    324325    al = compilel v a 
  • sizechecking/Examples.hs

    r12 r14  
    4646 
    4747t27 :: (SizedExp se) => Size se ((a -> a) -> a -> a) 
    48 t27 = bind ( App t3s t3s) $ t3 `app` t3 
     48t27 = bind (App t3s t3s) $ t3 `app` t3 
    4949 
    5050t27_ :: (SizedExp se) => Size se ((a -> a) -> a -> a) 
    51 t27_ = bind ( App t3s t3s) $  
     51t27_ = bind (App t3s t3s) $  
    5252        \f ->  t3 `app` t3 `app` f 
    5353 
    5454t27__ :: (SizedExp se) => Size se ((a -> a) -> a -> a) 
    55 t27__ = bind ( App t3s t3s) $ \f x -> 
     55t27__ = bind (App t3s t3s) $ \f x -> 
    5656            t3 `app` t3 `app` f `app` x 
    5757 
     
    216216 
    217217 
    218 test2s = Abs 2 $ AAbs 18 5  $ appends `App` (Var 2 `App` List (Var 18) (Var 5)) `App` List (Var 18) (Var 5) 
     218test2s = Abs 2 $ AAbs 18 5  $ appends `App` (Var 2 `App` List (Var 18) (Var 5)) `App` 
     219  (appends `App` (Var 2 `App` List (Var 18) (Var 5)) `App` List (Var 18) (Var 5)) 
    219220test2 :: (SizedExp se)  => Size se (([a] -> [a]) -> [a] -> [a]) 
    220 test2 = bind test2s $ \f l -> append `app` (f `app` l) `app` l 
     221test2 = bind test2s $ \f l -> append `app` (f `app` l) `app` (append `app` (f `app` l) `app` l) 
    221222 
    222223data TestCase = forall a . TestCase P.String (forall se. SizedExp se => Size se a) 
     
    234235        , TestCase "t9" t9 
    235236--        , TestCase "t9_" t9_  -- too few arguments in definition 
    236         , TestCase "t27" t27 
    237         , TestCase "t27_" t27_ 
     237--        , TestCase "t27" t27 
     238--        , TestCase "t27_" t27_ 
    238239        , TestCase "t27__" t27__ 
    239240        , TestCase "addone" addone 
     
    251252        , TestCase "charm" charm 
    252253        , TestCase "comp" comp 
     254        , TestCase "merge" merge 
     255        , TestCase "split1" split1 
     256        , TestCase "split2" split2 
     257        , TestCase "mergesort" mergesort 
    253258    ] 
    254259 
  • sizechecking/SizedExp.hs

    r12 r14  
    8181        where 
    8282        (x, f) = u $ exp $ QSynt $ do  
    83             putStrLn $ "[Bind] var="++ show fv ++" of type "++ show (tk q) 
     83--            putStrLn $ "[Bind] var="++ show fv ++" of type "++ show (tk q) 
    8484            return [([], fv)] 
    8585        fv = fresh (tk q) s3 
     
    9090concatMapM :: (a -> IO [b]) -> [a] -> IO [b] 
    9191concatMapM f l = liftM concat $ mapM f l 
    92      
     92 
    9393type SExp = ([Constraint], L) 
    9494newtype Q a = Q { unQ :: () } 
    9595instance SizedExp Q where 
    96     data Size Q a = QSynt (IO [SExp]) | QProvable L (Supply Int -> IO [Condition])  
     96    data Size Q a = QSynt (IO [SExp]) | QProvable L (Supply Int -> IO [Condition]) 
    9797    known l = QSynt $return [([], l)] 
    9898    true = QSynt $ return [] 
     
    100100            match1 (cond, ltype) = do 
    101101                    x <- sizeof l 
    102                     putStrLn $ "ORIGINAL is " ++ show x 
    103                     putStrLn $ "[MATCH] ==> " ++ show ltype 
     102--                    putStrLn $ "ORIGINAL is " ++ show x 
     103--                    putStrLn $ "[MATCH] ==> " ++ show ltype 
    104104                    let lt = rall$  App (AAbs 18 5 $ Var 18) ltype 
    105                     putStrLn $ " --- NIL  ---" ++ show lt 
     105--                    putStrLn $ " --- NIL  ---" ++ show lt 
    106106                    nils <- sizeof nil 
    107                     print nils 
     107--                    print nils 
    108108                    let nilc = foldr addConstraint nils $ Zero lt:cond 
    109109                    let tx = rall $ App (AAbs 18 5 $ App (Var 5) (Op (Var 18) '-' (Num 1))) ltype 
    110110                    let txs = rall $App (AAbs 18 5 $ List (Op (Var 18) '-' (Num 1)) (Var 5)) ltype 
    111                     putStrLn $ " --- CONS --- "++ show tx ++" <-> "++ show txs 
     111--                    putStrLn $ " --- CONS --- "++ show tx ++" <-> "++ show txs 
    112112                    conss <- sizeof $ cons (QSynt$return [([], tx)]) (QSynt$return [([], txs)]) 
    113                     print conss 
     113--                    print conss 
    114114                    let consc = foldr addConstraint conss $ lt `GEC` Num 1:cond 
    115                     print "END MATCH" 
    116                     print  $ nilc ++ consc 
     115--                    print "END MATCH" 
     116--                    print  $ nilc ++ consc 
    117117                    return $ nilc ++ consc 
    118118        in QSynt $ sizeof l >>= concatMapM match1  
     
    139139            in do  
    140140                l3 <- sizeof sexp  
    141                 print l 
    142                 print ll 
     141--                print l 
     142--                print ll 
    143143                return $ map (\(c,l2) -> Condition (map rr c) ll (rall l2)) l3 
    144144 
     
    151151    signum = undefined 
    152152    fromInteger = num 
     153 
     154conditions :: Size Q b -> IO () 
     155conditions (QProvable l x) = do 
     156    (s1,s2,s3) <- liftM split3 $ newSupply 30 (+1) 
     157    c <- x s1 
     158    print c 
    153159 
    154160prove :: Size Q b -> IO Bool 
     
    178184        print y 
    179185        return False 
    180  
Note: See TracChangeset for help on using the changeset viewer.