Changeset 11856

Show
Ignore:
Timestamp:
30.06.2009 17:12:48 (9 months ago)
Author:
maeder
Message:

do not create fresh type variables for lambda patterns

Location:
trunk/HasCASL
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/HasCASL/TypeCheck.hs

    r11855 r11856  
    403403              (s, cs, typ, QuantifiedTerm quant decls tr ps)) rs 
    404404        LambdaTerm pats part resTrm ps -> do 
    405             pvs <- mapM freshTypeVar pats 
    406             rty <- freshTypeVar resTrm 
    407             let myty = getFunType rty part pvs 
    408             ls <- checkList True (map Just pvs) pats 
    409             rs <- mapM ( \ ( s, cs, _, nps) -> do 
     405            ls <- checkList True (map (const Nothing) pats) pats 
     406            rs <- mapM ( \ ( s, cs, pats, nps) -> do 
    410407                       mapM_ (addLocalVar True) $ concatMap extractVars nps 
    411                        es <- fmap (addSuperType $ subst s rty) 
    412                          $ infer False resTrm 
     408                       es <- infer False resTrm 
    413409                       putLocalVars vs 
    414                        return $ map ( \ (s2, cr, _, rtm) -> 
     410                       return $ map ( \ (s2, cr, rty, rtm) -> 
    415411                                      let s3 = compSubst s s2 
    416                                           typ = subst s3 myty in 
    417                                       (s3, joinC (substC s2 cs) cr, typ, 
     412                                          typ = getFunType (subst s rty) 
     413                                             part $ map (subst s2) pats 
     414                                      in 
     415                                      (s3, joinC (substC s2 cs) $ substC s cr 
     416                                      , typ, 
    418417                                       TypedTerm 
    419418                                       (LambdaTerm nps part rtm ps) 
  • trunk/HasCASL/test/BasicSpec.hascasl.output

    r11855 r11856  
    171171### Hint 30.40, no type found for 't1' 
    172172### Hint 30.40, no type found for 't1' 
    173 ### Hint 30.40, untypeable term (with type: ? _v61) 't1' 
     173### Hint 30.40, untypeable term (with type: ? _v59) 't1' 
    174174### Hint 30.40-30.52, 
    175 untypeable term (with type: ? _v55 * ? _v57_b) '(t1 (), t2 ())' 
     175untypeable term (with type: ? _v53 * ? _v55_b) '(t1 (), t2 ())' 
    176176*** Error 30.38, 
    177177no typing for 
     
    180180*** Error 34.12, unexpected mixfix token: or 
    181181### Hint 37.27, no type found for 'all' 
    182 ### Hint 37.27, untypeable term (with type: _v71 ->? _v72) 'all' 
     182### Hint 37.27, untypeable term (with type: _v69 ->? _v70) 'all' 
    183183*** Error 37.25, 
    184184no typing for 
     
    186186         = all \ r : ? Unit . (all \ x : s . p x impl r) impl r' 
    187187### Hint 40.20, no type found for 'all' 
    188 ### Hint 40.20, untypeable term (with type: _v79 ->? _v80) 'all' 
     188### Hint 40.20, untypeable term (with type: _v77 ->? _v78) 'all' 
    189189### Hint 40.3, rebound variable 'ff' 
    190190### Hint 40.20, no type found for 'all' 
    191 ### Hint 40.20, untypeable term (with type: _v81 ->? _v82) 'all' 
     191### Hint 40.20, untypeable term (with type: _v79 ->? _v80) 'all' 
    192192*** Error 40.18, 
    193193no typing for 'program ff () : ? Unit = all \ r : ? Unit . r ()' 
  • trunk/HasCASL/test/Classical.hascasl.output

    r11855 r11856  
    2121. p \/ not p; %implied 
    2222var 
    23 t : Type %(var_92)% 
     23t : Type %(var_88)% 
    2424op choose : forall t : Type . Pred t ->? t %(op)% 
    2525op epsilon : forall t : Type . Pred t -> t %(op)% 
     
    6363in type of '(var a : Logical)' 
    6464  typename 'Unit' 
    65   is not unifiable with type 'Unit ->? _v124' (14.32) 
     65  is not unifiable with type 'Unit ->? _v116' (14.32) 
    6666### Hint 18.23, not a class 'Logical' 
    6767### Hint 18.41, 
    6868in type of '(var a : Logical)' 
    6969  typename 'Unit' 
    70   is not unifiable with type 'Unit ->? _v162' (18.41) 
     70  is not unifiable with type 'Unit ->? _v154' (18.41) 
    7171### Hint 18.55, 
    7272in type of '(var a : Logical)' 
    7373  typename 'Unit' 
    74   is not unifiable with type 'Unit ->? _v168' (18.55) 
     74  is not unifiable with type 'Unit ->? _v160' (18.55) 
    7575### Hint 18.63, 
    7676in type of '(var a : Logical)' 
    7777  typename 'Unit' 
    78   is not unifiable with type 'Unit ->? _v169' (18.63) 
     78  is not unifiable with type 'Unit ->? _v161' (18.63) 
    7979### Hint 20.13, not a class 't' 
    8080### Hint 20.36, not a class 'Logical' 
     
    8383in type of '(var a : Logical)' 
    8484  typename 'Unit' 
    85   is not unifiable with type 'Unit ->? _v190' (21.30) 
     85  is not unifiable with type 'Unit ->? _v182' (21.30) 
    8686### Hint 21.38, 
    8787in type of '(var a : Logical)' 
    8888  typename 'Unit' 
    89   is not unifiable with type 'Unit ->? _v191' (21.38) 
     89  is not unifiable with type 'Unit ->? _v183' (21.38) 
    9090### Hint 23.7, not a class 't' 
    9191### Hint 23.10, not a class 't' 
  • trunk/HasCASL/test/Coproducts.hascasl.output

    r11855 r11856  
    102102 (op inl : forall a : Type; b : Type . a -> Sum a b) ())' 
    103103  typename 'Unit' (19.23) 
    104   is not unifiable with type 'Sum Unit _v266_b' (19.18) 
     104  is not unifiable with type 'Sum Unit _v250_b' (19.18) 
    105105### Hint 24.8-24.21, 
    106106in type of '((op False : Bool), 
    107107 (op inr : forall a : Type; b : Type . b -> Sum a b) ())' 
    108108  typename 'Unit' (19.23) 
    109   is not unifiable with type 'Sum _v288_a Unit' (19.18) 
     109  is not unifiable with type 'Sum _v272_a Unit' (19.18) 
  • trunk/HasCASL/test/FunctorMonadTransformer.hascasl.output

    r11855 r11856  
    4646ST := \ state : Type . \ a : Type . state ->? a * state 
    4747vars 
    48 a : Type %(var_955)%; 
    49 b : Type %(var_956)%; 
    50 c : Type %(var_110)%; 
     48a : Type %(var_899)%; 
     49b : Type %(var_900)%; 
     50c : Type %(var_106)%; 
    5151f : Functor %(var_1)%; 
    52 m : Monad %(var_687)%; 
    53 state : Type %(var_953)%; 
    54 t : MonadT %(var_686)% 
     52m : Monad %(var_651)%; 
     53state : Type %(var_897)%; 
     54t : MonadT %(var_650)% 
    5555op __>>=__ : forall m : Monad; a : Type; b : Type 
    5656             . m a * (a -> m b) -> m b 
     
    146146 (var q : a ->? m b))' 
    147147### Hint 14.14-14.24, 
    148 untypeable term (with type: _v146_v133_m _v134_a * (_v134_a -> _v146_v133_m _v135_b)) 
     148untypeable term (with type: _v142_v129_m _v130_a * (_v130_a -> _v142_v129_m _v131_b)) 
    149149'(ret x, q)' 
    150150### Hint 15.12, rebound variable 'x' 
     
    154154 (var r : b ->? m c))' 
    155155### Hint 15.19-15.33, 
    156 untypeable term (with type: _v224_v211_m _v212_a * (_v212_a -> _v224_v211_m _v213_b)) 
     156untypeable term (with type: _v218_v205_m _v206_a * (_v206_a -> _v218_v205_m _v207_b)) 
    157157'(ret (f x), r)' 
    158158### Hint 15.3-15.33, 
     
    165165    (var r : b ->? m c)))' 
    166166### Hint 15.3-15.26, 
    167 untypeable term (with type: _v196_v183_m _v184_a * (_v184_a -> _v196_v183_m _v185_b)) 
     167untypeable term (with type: _v192_v179_m _v180_a * (_v180_a -> _v192_v179_m _v181_b)) 
    168168'(p, \ x : a . ret (f x) >>= r)' 
    169169### Hint 15.12, rebound variable 'x' 
     
    173173 (var r : b ->? m c))' 
    174174### Hint 15.19-15.33, 
    175 untypeable term (with type: _v270_v257_m _v258_a * (_v258_a -> _v270_v257_m _v259_b)) 
     175untypeable term (with type: _v260_v247_m _v248_a * (_v248_a -> _v260_v247_m _v249_b)) 
    176176'(ret (f x), r)' 
    177177### Hint 16.13, rebound variable 'x' 
     
    180180 \ x : a . (var r : b ->? m c) ((var f : a ->? b) (var x : a)))' 
    181181### Hint 16.5-16.25, 
    182 untypeable term (with type: _v314_v301_m _v302_a * (_v302_a -> _v314_v301_m _v303_b)) 
     182untypeable term (with type: _v302_v289_m _v290_a * (_v290_a -> _v302_v289_m _v291_b)) 
    183183'(p, \ x : a . r (f x))' 
    184184### Hint 16.13, rebound variable 'x' 
     
    186186rejected '__->?__ < __->__' of '((var p : m a), (var q : a ->? m b))' 
    187187### Hint 18.4-18.10, 
    188 untypeable term (with type: _v434_v421_m _v422_a * (_v422_a -> _v434_v421_m _v423_b)) 
     188untypeable term (with type: _v414_v401_m _v402_a * (_v402_a -> _v414_v401_m _v403_b)) 
    189189'(p, q)' 
    190190### Hint 18.3-18.17, 
     
    194194 (var r : b ->? m c))' 
    195195### Hint 18.3-18.17, 
    196 untypeable term (with type: _v408_v395_m _v396_a * (_v396_a -> _v408_v395_m _v397_b)) 
     196untypeable term (with type: _v388_v375_m _v376_a * (_v376_a -> _v388_v375_m _v377_b)) 
    197197'(p >>= q, r)' 
    198198### Hint 18.4-18.10, 
    199199rejected '__->?__ < __->__' of '((var p : m a), (var q : a ->? m b))' 
    200200### Hint 18.4-18.10, 
    201 untypeable term (with type: _v460_v447_m _v448_a * (_v448_a -> _v460_v447_m _v449_b)) 
     201untypeable term (with type: _v440_v427_m _v428_a * (_v428_a -> _v440_v427_m _v429_b)) 
    202202'(p, q)' 
    203203### Hint 18.29, rebound variable 'x' 
     
    205205rejected '__->?__ < __->__' of '((var q : a ->? m b) (var x : a), (var r : b ->? m c))' 
    206206### Hint 18.36-18.44, 
    207 untypeable term (with type: _v514_v501_m _v502_a * (_v502_a -> _v514_v501_m _v503_b)) 
     207untypeable term (with type: _v492_v479_m _v480_a * (_v480_a -> _v492_v479_m _v481_b)) 
    208208'(q x, r)' 
    209209### Hint 18.21-18.44, 
     
    214214   ((var q : a ->? m b) (var x : a), (var r : b ->? m c)))' 
    215215### Hint 18.21-18.36, 
    216 untypeable term (with type: _v486_v473_m _v474_a * (_v474_a -> _v486_v473_m _v475_b)) 
     216untypeable term (with type: _v466_v453_m _v454_a * (_v454_a -> _v466_v453_m _v455_b)) 
    217217'(p, \ x : a . q x >>= r)' 
    218218### Hint 18.29, rebound variable 'x' 
     
    220220rejected '__->?__ < __->__' of '((var q : a ->? m b) (var x : a), (var r : b ->? m c))' 
    221221### Hint 18.36-18.44, 
    222 untypeable term (with type: _v552_v539_m _v540_a * (_v540_a -> _v552_v539_m _v541_b)) 
     222untypeable term (with type: _v526_v513_m _v514_a * (_v514_a -> _v526_v513_m _v515_b)) 
    223223'(q x, r)' 
    224224### Warning 20.16, refined class 'Monad' 
     
    242242   ((var f : a -> b) (var y : a)))' 
    243243### Hint 22.13-22.35, 
    244 untypeable term (with type: _v649_v636_m _v637_a * (_v637_a -> _v649_v636_m _v638_b)) 
     244untypeable term (with type: _v621_v608_m _v609_a * (_v609_a -> _v621_v608_m _v610_b)) 
    245245'(x, \ y : a . ret (f y))' 
    246246### Hint 22.21, rebound variable 'y' 
     
    296296  is not unifiable with type 'a * state' (35.25) 
    297297### Hint 37.3-37.9, 
    298 untypeable term (with type: _v1006_v993_m _v994_a * (_v994_a -> _v1006_v993_m _v995_b)) 
     298untypeable term (with type: _v945_v932_m _v933_a * (_v933_a -> _v945_v932_m _v934_b)) 
    299299'(p, q)' 
    300300### Hint 37.3-37.9, 
     
    303303  is not unifiable with type 'a * state' (35.25) 
    304304### Hint 37.3-37.9, 
    305 untypeable term (with type: _v1015_v996_m _v997_a * (_v997_a ->? _v1015_v996_m _v998_b)) 
     305untypeable term (with type: _v954_v935_m _v936_a * (_v936_a ->? _v954_v935_m _v937_b)) 
    306306'(p, q)' 
    307307### Hint 37.5-37.54, 
    308 untypeable term (with type: ? _v987_a * ? _v987_a) 
     308untypeable term (with type: ? _v926_a * ? _v926_a) 
    309309'(p >>= q, \ s1 : state . let (z, s2) = p s1 in q z s2)' 
    310310*** Error 37.5, 
  • trunk/HasCASL/test/Prelude.hascasl.output

    r11855 r11856  
    132132s : Type 
    133133vars 
    134 c : Cpo %(var_515)%; 
    135 d : Cpo %(var_516)%; 
    136 f : Flatcpo %(var_513)%; 
    137 p : Pcpo %(var_510)%; 
     134c : Cpo %(var_457)%; 
     135d : Cpo %(var_458)%; 
     136f : Flatcpo %(var_455)%; 
     137p : Pcpo %(var_452)%; 
    138138t : Type %(var_2)% 
    139139op Y : forall p : Pcpo . (p --> p) --> p %(fun)% 
     
    263263in term '(op fst : forall s : Type; t : Type . s * t -> s) = __res__' 
    264264 are uninstantiated type variables 
    265 '[_v87_v79_t, _v88_v78_s]' 
     265'[_v63_v55_t, _v64_v54_s]' 
    266266### Hint 72.11, 
    267267no kind found for 's' 
     
    292292### Hint 90.45, no type found for 't1' 
    293293### Hint 90.45, no type found for 't1' 
    294 ### Hint 90.45, untypeable term (with type: ? _v419) 't1' 
     294### Hint 90.45, untypeable term (with type: ? _v361) 't1' 
    295295### Hint 90.45-90.47, 
    296 untypeable term (with type: _v417 ->? _v418) 't1 ()' 
     296untypeable term (with type: _v359 ->? _v360) 't1 ()' 
    297297### Hint 90.45-90.50, 
    298 untypeable term (with type: _v415 ->? _v416) 't1 () und' 
     298untypeable term (with type: _v357 ->? _v358) 't1 () und' 
    299299### Hint 90.45, no type found for 't1' 
    300300### Hint 90.45, no type found for 't1' 
    301 ### Hint 90.45, untypeable term (with type: ? _v424) 't1' 
     301### Hint 90.45, untypeable term (with type: ? _v366) 't1' 
    302302### Hint 90.45-90.47, 
    303 untypeable term (with type: _v422 ->? _v423) 't1 ()' 
     303untypeable term (with type: _v364 ->? _v365) 't1 ()' 
    304304### Hint 90.45-90.50, 
    305 untypeable term (with type: _v420 ->? _v421) 't1 () und' 
     305untypeable term (with type: _v362 ->? _v363) 't1 () und' 
    306306### Hint 90.45-90.54, 
    307 untypeable term (with type: ? _v414) 't1 () und t2' 
     307untypeable term (with type: ? _v356) 't1 () und t2' 
    308308*** Error 90.43, 
    309309no typing for 
     
    312312*** Error 95.11, unexpected mixfix token: or 
    313313### Hint 98.39, no type found for 'all' 
    314 ### Hint 98.39, untypeable term (with type: _v443 ->? _v444) 'all' 
     314### Hint 98.39, untypeable term (with type: _v385 ->? _v386) 'all' 
    315315*** Error 98.37, 
    316316no typing for 
     
    318318         = all \ r : Pred Unit . (all \ x : s . p x impl r) impl r' 
    319319### Hint 101.29, no type found for 'all' 
    320 ### Hint 101.29, untypeable term (with type: _v457 ->? _v458) 'all' 
     320### Hint 101.29, untypeable term (with type: _v399 ->? _v400) 'all' 
    321321### Hint 101.9, rebound variable 'ff' 
    322322### Hint 101.29, no type found for 'all' 
    323 ### Hint 101.29, untypeable term (with type: _v459 ->? _v460) 'all' 
     323### Hint 101.29, untypeable term (with type: _v401 ->? _v402) 'all' 
    324324*** Error 101.27, 
    325325no typing for 
     
    328328### Hint 103.44, untypeable term (with type: Unit) 'impl' 
    329329### Hint 103.42-103.44, 
    330 untypeable term (with type: _v477 ->? _v478) 'r impl' 
     330untypeable term (with type: _v419 ->? _v420) 'r impl' 
    331331*** Error 103.40, 
    332332no typing for 'program neg (r : Pred Unit) : Pred Unit = r impl ff' 
    333333### Hint 108.3, no type found for 'all' 
    334 ### Hint 108.3, untypeable term (with type: _v483 ->? _v484) 'all' 
     334### Hint 108.3, untypeable term (with type: _v425 ->? _v426) 'all' 
    335335*** Error 108.3-108.63, 
    336336no typing for 
     
    345345     found: {Cpo} 
    346346### Hint 121.3, no type found for 'all' 
    347 ### Hint 121.3, untypeable term (with type: _v486 ->? _v487) 'all' 
     347### Hint 121.3, untypeable term (with type: _v428 ->? _v429) 'all' 
    348348*** Error 121.3-121.16, no typing for 'all \ x : c . x <<= x' 
    349349### Hint 122.3, no type found for 'all' 
    350 ### Hint 122.3, untypeable term (with type: _v490 ->? _v491) 'all' 
     350### Hint 122.3, untypeable term (with type: _v432 ->? _v433) 'all' 
    351351*** Error 122.3-122.44, 
    352352no typing for 
    353353'all \ (x, y, z : c) . (x <<= y) und (y <<= z) impl x <<= z' 
    354354### Hint 123.3, no type found for 'all' 
    355 ### Hint 123.3, untypeable term (with type: _v494 ->? _v495) 'all' 
     355### Hint 123.3, untypeable term (with type: _v436 ->? _v437) 'all' 
    356356*** Error 123.3-123.57, 
    357357no typing for 
    358358'all \ (x, y, z : c) . (x <<= y) und (y <<= x) impl eq (x, y)' 
    359359### Hint 125.32, no type found for 'all' 
    360 ### Hint 125.32, untypeable term (with type: _v498 ->? _v499) 'all' 
     360### Hint 125.32, untypeable term (with type: _v440 ->? _v441) 'all' 
    361361*** Error 125.14-125.46, 
    362362no typing for '(all \ n : nat . s n <<= s (Suc n)) as Unit' 
    363363### Hint 126.15, rebound variable 'x' 
    364364### Hint 126.38, no type found for 'all' 
    365 ### Hint 126.38, untypeable term (with type: _v502 ->? _v503) 'all' 
     365### Hint 126.38, untypeable term (with type: _v444 ->? _v445) 'all' 
    366366*** Error 126.14-126.52, 
    367367no typing for '(all \ n : nat . s n <<= x) as Unit' 
     
    375375 (\ x : c . ((((isBound (x, s)) impl) sup) s) <<= x)) 
    376376### Hint 130.3, no type found for 'all' 
    377 ### Hint 130.3, untypeable term (with type: _v505 ->? _v506) 'all' 
     377### Hint 130.3, untypeable term (with type: _v447 ->? _v448) 'all' 
    378378*** Error 130.3-131.74, 
    379379no typing for 
     
    384384    (\ x : c . isBound (x, s) impl sup (s) <<= x))' 
    385385### Hint 134.3, no type found for 'all' 
    386 ### Hint 134.3, untypeable term (with type: _v508 ->? _v509) 'all' 
     386### Hint 134.3, untypeable term (with type: _v450 ->? _v451) 'all' 
    387387*** Error 134.3-134.46, 
    388388no typing for 'all \ s : nat -> c . isChain s impl def (sup s)' 
     
    391391ignoring declaration for builtin identifier 'bottom' 
    392392### Hint 143.3, no type found for 'all' 
    393 ### Hint 143.3, untypeable term (with type: _v511 ->? _v512) 'all' 
     393### Hint 143.3, untypeable term (with type: _v453 ->? _v454) 'all' 
    394394*** Error 143.3-143.22, no typing for 'all \ x : p . bottom <<= x' 
    395395### Hint 148.6, is type variable 'f' 
     
    413413((var x1 : c), (var x2 : c))' 
    414414  typename 'Unit' (119.14) 
    415   is not unifiable with type '_v528 ->? _v529' (159.45) 
     415  is not unifiable with type '_v470 ->? _v471' (159.45) 
    416416### Hint 159.37, 
    417 untypeable term (with type: _v528 ->? _v529) 'x1 <<= x2' 
     417untypeable term (with type: _v470 ->? _v471) 'x1 <<= x2' 
    418418### Hint 159.33-159.45, 
    419 untypeable term (with type: _v526 ->? _v527) '(x1 <<= x2) und' 
     419untypeable term (with type: _v468 ->? _v469) '(x1 <<= x2) und' 
    420420*** Error 159.31, 
    421421no typing for 
     
    442442### Warning 176.11, variable also known as type variable 'f' 
    443443### Hint 176.31, no type found for 'all' 
    444 ### Hint 176.31, untypeable term (with type: _v558 ->? _v559) 'all' 
     444### Hint 176.31, untypeable term (with type: _v500 ->? _v501) 'all' 
    445445*** Error 176.29, 
    446446no typing for 
     
    489489     found: {Pcpo} 
    490490### Hint 192.3, no type found for 'all' 
    491 ### Hint 192.3, untypeable term (with type: _v579 ->? _v580) 'all' 
     491### Hint 192.3, untypeable term (with type: _v521 ->? _v522) 'all' 
    492492*** Error 192.3-193.47, 
    493493no typing for 
  • trunk/HasCASL/test/StateMonad.hascasl.output

    r11855 r11856  
    1414vars 
    1515a : Type %(var_2)%; 
    16 b : Type %(var_43)%; 
     16b : Type %(var_38)%; 
    1717m : Type -> Type %(var_1)%; 
    1818state : Type %(var_3)% 
     
    5656  is not unifiable with type 'a * state' (10.18) 
    5757### Hint 13.3-13.9, 
    58 untypeable term (with type: _v64_v54_m _v55_a * (_v55_a -> _v64_v54_m _v56_b)) 
     58untypeable term (with type: _v59_v49_m _v50_a * (_v50_a -> _v59_v49_m _v51_b)) 
    5959'(p, q)' 
    6060### Hint 13.5-13.54, 
    61 untypeable term (with type: ? _v48_a * ? _v48_a) 
     61untypeable term (with type: ? _v43_a * ? _v43_a) 
    6262'(p >>= q, \ s2 : state . let (z, s2) = p s1 in q z s2)' 
    6363*** Error 13.5,