Пример #1
0
        public Substitution MUnify(AccessibilityRelation relation, Formula formula)
        {
            var unif = Unify(formula);
            var eta  = relation.WorldUnify(WorldIndex, formula.WorldIndex);

            unif.Compose(eta);
            return(unif);
        }
Пример #2
0
        public Substitution WorldUnify(AccessibilityRelation relation, WorldIndex i, WorldIndex j)
        {
            //2b -> one is ground and the other world variable
            if (i.EndSymbol.IsGround || j.EndSymbol.IsGround)
            {
                //Need to verify if n is accessible from the parent of w
                var n = i.EndSymbol.IsGround ? i.EndSymbol : j.EndSymbol;
                var w = !i.EndSymbol.IsGround ? i.EndSymbol : j.EndSymbol;

                if (relation.Contains(w.ParentSymbol, n))
                {
                    var sub = new Substitution();
                    sub.Add(n, w);
                    return(sub);
                }

                return(null);
            }
            //2c -> both are world variables
            else
            {
                //(i)
                if (relation.Contains(i.EndSymbol.ParentSymbol, j.EndSymbol) || relation.Contains(j.EndSymbol.ParentSymbol, i.EndSymbol))
                {
                    return(new Substitution(i.EndSymbol, j.EndSymbol));
                }
                //(ii)
                else
                {
                    var parentUnification = relation.WorldUnify(i.ParentIndex, j.ParentIndex);
                    if (parentUnification == null)
                    {
                        return(null);
                    }
                    else
                    {
                        new Substitution(i.EndSymbol, j.EndSymbol).Compose(parentUnification);
                        return(parentUnification);
                    }
                }
            }
        }