コード例 #1
0
        private List <Expr> DisjointnessExprs(IEnumerable <Variable> availableVars)
        {
            var domainNameToScope = new Dictionary <string, HashSet <Variable> >();

            foreach (var domainName in linearTypeChecker.linearDomains.Keys)
            {
                domainNameToScope[domainName] = new HashSet <Variable>();
            }
            foreach (var v in availableVars)
            {
                var domainName = linearTypeChecker.FindDomainName(v);
                domainNameToScope[domainName].Add(MapVariable(v));
            }
            var newExprs = new List <Expr>();

            foreach (var domainName in linearTypeChecker.linearDomains.Keys)
            {
                var permissionExprs =
                    linearTypeChecker
                    .PermissionExprForEachVariable(domainName, domainNameToScope[domainName])
                    .Union(
                        domainNameToHoleVar.ContainsKey(domainName)
                        ? new List <Expr> {
                    Expr.Ident(domainNameToHoleVar[domainName])
                }
                        : new List <Expr>());
                var expr = linearTypeChecker.DisjointnessExprForPermissions(domainName, permissionExprs);
                if (!expr.Equals(Expr.True))
                {
                    newExprs.Add(expr);
                }
            }
            return(newExprs);
        }