Exemple #1
0
        public List <Expression> GetLeafData()
        {
            Contract.Ensures(Contract.Result <List <Expression> >() != null);
            List <Expression> leafs = new List <Expression>();

            if (IsLeaf())
            {
                leafs.Add(Data);
            }
            else
            {
                leafs.AddRange(LChild.GetLeafData());
                if (RChild != null)
                {
                    leafs.AddRange(RChild.GetLeafData());
                }
            }

            return(leafs);
        }
Exemple #2
0
        public static bool IsResolvable(ExpressionTree expt, ProofState state)
        {
            Contract.Requires(expt.IsRoot());
            var leafs = expt.GetLeafData();

            if (leafs == null)
            {
                throw new ArgumentNullException(nameof(leafs));
            }

            foreach (var leaf in leafs)
            {
                if (leaf is NameSegment)
                {
                    var ns = leaf as NameSegment;
                    if (state.ContainTacnyVal(ns))
                    {
                        var local = state.GetTacnyVarValue(ns);
                        if (local is ApplySuffix || local is IVariable || local is NameSegment || local is Statement)
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else if (!(leaf is LiteralExpr))
                {
                    if (leaf is ApplySuffix)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Exemple #3
0
    public static bool IsResolvable(ExpressionTree expt, ProofState state) {
      Contract.Requires(expt.IsRoot());
      var leafs = expt.GetLeafData();
      if (leafs == null) throw new ArgumentNullException(nameof(leafs));

      foreach (var leaf in leafs) {
        if (leaf is NameSegment) {
          var ns = leaf as NameSegment;
          if (state.ContainTacnyVal(ns)) {
            var local = state.GetTacnyVarValue(ns);
            if (local is ApplySuffix || local is IVariable || local is NameSegment || local is Statement)
              return false;
          } else {
            return false;
          }
        } else if (!(leaf is LiteralExpr)) {
          if (leaf is ApplySuffix) {
            return false;
          }
        }
      }
      return true;
    }