Microsoft.Automata.Z3.RankedAlphabet.ContainsConstructor C# (CSharp) Метод

ContainsConstructor() публичный Метод

Returns true iff the constructor belongs to the alphabet.
public ContainsConstructor ( FuncDecl symbol ) : bool
symbol Microsoft.Z3.FuncDecl constructor
Результат bool
        public bool ContainsConstructor(FuncDecl symbol)
        {
            return idMap.ContainsKey(symbol.Name.ToString()) && GetConstructor(symbol.Name.ToString()).Equals(symbol);
        }

Same methods

RankedAlphabet::ContainsConstructor ( string symbol ) : bool

Usage Example

Пример #1
0
 //adds identity states when A=B and a child is ouput without transformation
 internal Expr NormalizeOutput(Expr t, RankedAlphabet A, RankedAlphabet B, int rank)
 {
     if (Z.IsVar(t))
     {
         if (Z.GetVarIndex(t) > rank || !t.Sort.Equals(A.AlphabetSort))
         {
             throw new AutomataException(AutomataExceptionKind.TreeTheory_UnexpectedVariable);
         }
         else
         {
             return(Z.MkApp(GetTrans(A.AlphabetSort, B.AlphabetSort), identityState, t));
         }
     }
     else if (t.ASTKind == Z3_ast_kind.Z3_APP_AST)
     {
         var f    = t.FuncDecl;
         var args = t.Args;
         if (B.ContainsConstructor(f))
         {
             CheckAttribute(args[0], A);
             var args1 = new Expr[args.Length];
             args1[0] = args[0];
             for (int j = 1; j < args.Length; j++)
             {
                 args1[j] = NormalizeOutput(args[j], A, B, rank);
             }
             return(Z.MkApp(f, args1));
         }
         else if (IsTrans(f))
         {
             if (args[0].ASTKind != Z3_ast_kind.Z3_NUMERAL_AST || !Z.IsVar(args[1]) || Z.GetVarIndex(args[1]) > rank || Z.GetVarIndex(args[1]) < 1)
             {
                 throw new AutomataException(AutomataExceptionKind.TreeTheory_UnexpectedVariable);
             }
             else
             {
                 return(t);
             }
         }
         else
         {
             throw new AutomataException(AutomataExceptionKind.TreeTheory_UnexpectedOutput);
         }
     }
     else
     {
         throw new AutomataException(AutomataExceptionKind.TreeTheory_UnexpectedOutput);
     }
 }