Changeset 11873
- Timestamp:
- 03.07.2009 16:16:41 (9 months ago)
- Location:
- trunk/HasCASL
- Files:
-
- 2 modified
-
VarDecl.hs (modified) (2 diffs)
-
test/Subtype.hascasl.output (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/HasCASL/VarDecl.hs
r11328 r11873 23 23 import qualified Data.Set as Set 24 24 import Common.Id 25 import Common.Lib.Rel (setToMap) 25 26 import Common.Lib.State 26 27 import Common.Result … … 45 46 mkEnvForall :: Env -> Term -> Range -> Term 46 47 mkEnvForall e t ps = 47 let tys = Set.fromList $ map (fst . snd) $ concatMap (leaves (>= 0)) 48 $ getAllTypes t 49 tyVs = map ( \ (i, TypeVarDefn v vk rk c) -> GenTypeVarDecl $ 50 TypeArg i v vk rk c Other ps) $ Map.toList 51 $ Map.filterWithKey ( \ i _ -> Set.member i tys) $ localTypeVars e 48 let tys = getAllTypes t 49 tyVs = map GenTypeVarDecl $ getTypeVars (localTypeVars e) tys ps 52 50 vs = tyVs ++ map GenVarDecl (Set.toList $ freeVars t) 53 51 in if null vs then t else QuantifiedTerm Universal vs t ps 52 53 getTypeVars :: LocalTypeVars -> [Type] -> Range -> [TypeArg] 54 getTypeVars e tys ps = 55 let is = Set.unions $ map (idsOf (>= 0)) tys 56 tyVs = Map.intersection e $ setToMap is 57 dTys = Map.fold (\ (TypeVarDefn _ vk _ _) l -> case vk of 58 Downset ty -> ty : l 59 _ -> l) [] tyVs 60 dis = Set.unions $ map (idsOf (>= 0)) dTys 61 in if Set.isSubsetOf dis is then 62 map ( \ (i, TypeVarDefn v vk rk c) -> TypeArg i v vk rk c Other ps) 63 $ Map.toList tyVs 64 else getTypeVars e (dTys ++ tys) ps 54 65 55 66 anaStarType :: Type -> State Env (Maybe Type) -
trunk/HasCASL/test/Subtype.hascasl.output
r11869 r11873 59 59 forall a < b : Type; b < c : Type; c : Type; x : a 60 60 . up (up x : b) = (up x : c) 61 forall a < b : Type; b < c : Type; x : a . up x = (x : b)61 forall a < b : Type; b < c : Type; c : Type; x : a . up x = (x : b) 62 62 forall e : Type; f : Type; f : e -> f 63 63 . (up f : e ->? f) = \ x : e . f x