public FVT(LVar variable)
     : base()
 {
     this.variable = variable;
     count++;
     varMS = new FVMS(variable);
 }
 public override int minVarDepth(LVar v)
 {
     if (!freeVariables.Contains(v))
     {
         return(int.MinValue);
     }
     return((from t in ftt where t.freeVariables.Contains(v) select t.minVarDepth(v)).Min() + 1);
 }
 public override int maxVarDepth(LVar v)
 {
     if (!freeVariables.Contains(v))
     {
         return(-1);
     }
     return((from t in ftt where t.freeVariables.Contains(v) select t.maxVarDepth(v)).Max() + 1);
 }
 public override int minVarDepth(LVar v)
 {
     if (v == variable)
     {
         return(0);
     }
     else
     {
         return(int.MinValue);
     }
 }
 public override int maxVarDepth(LVar v)
 {
     if (v == variable)
     {
         return(0);
     }
     else
     {
         return(-1);
     }
 }
 public IT this[LVar v]
 {
     get
     {
         Debug.Assert(has(v));
         return(map[v]);
     }
     set
     {
         Debug.Assert(!has(v));
         map.Add(v, value);
     }
 }
Exemple #7
0
        public int minVarDepth(LVar v)
        {
            int result;

            if (!freeVariables.Contains(v))
            {
                result = int.MaxValue;
            }
            else if (!minVarDepthMap.TryGetValue(v, out result))
            {
                minVarDepthMap[v] = result = (from t in iaf.itt select t.minVarDepth(v)).Min();
            }
            return(result);
        }
        internal SubstitutionEC add(LVar v, IT t)
        {
            Debug.Assert(!variables.Contains(v));
            Debug.Assert(!t.freeVariables.Intersect(variables).Any());
//            Debug.Assert(map.All(kv=>!kv.Value.freeVariables.Contains(v)));
            var ks = new HashSet <LVar>(map.Keys);

            foreach (var k in ks)
            {
                if (map[k].freeVariables.Contains(v))
                {
                    map[k] = map[k].substitute(new SubstitutionEC(universe, isGoal, v, t));
                }
            }
//            Debug.Assert(universe.transitiveMerge(t)==t);

            var nm = new Dictionary <LVar, IT>(map);

            nm[v] = t;
            return(new SubstitutionEC(universe, isGoal, nm));
        }
        public SubstitutionEC(Universe universe, bool isGoal, LVar v, IT t)
            : this(universe, isGoal)
        {
            this[v] = t;
//            Debug.Assert(universe.transitiveMerge(t)==t);
        }
 public FVMS(LVar v)
 {
     fvms[v] = 1;
 }
 public override int minVarDepth(LVar v)
 {
     return(int.MinValue);
 }
 public override int maxVarDepth(LVar v)
 {
     return(int.MaxValue);
 }
 public override int maxVarDepth(LVar v)
 {
     return(-1);
 }
 private bool has(LVar v)
 {
     return(map.ContainsKey(v));
 }
 public GroundSubstitutionEC(Universe universe, bool saturate, LVar v, GT t)
     : this(universe, saturate)
 {
     Debug.Assert(t == universe.transitiveMerge(t));
     this[v] = t;
 }
Exemple #16
0
 public abstract int minVarDepth(LVar v);
Exemple #17
0
 public abstract int maxVarDepth(LVar v);
 public bool has(LVar v)
 {
     return(map.ContainsKey(v));
 }
Exemple #19
0
 public VariableTermTrigger(FL atom, int index)
     : base(atom, index)
 {
     Debug.Assert(atom.faf.ftt[index] is FVT);
     variable = (atom.faf.ftt[index] as FVT).variable;
 }