Example #1
0
        public SingletonEmbedding(TypeEmbedder owner, Symbol symbol)
        {
            Contract.Requires(owner != null);
            Contract.Requires(symbol != null && symbol.IsNonVarConstant);
            Owner = owner;
            bool wasAdded;

            if (symbol.Kind == SymbolKind.BaseCnstSymb)
            {
                var bc = (BaseCnstSymb)symbol;
                if (bc.CnstKind == CnstKind.Numeric && ((Rational)bc.Raw).IsInteger)
                {
                    var r = Index.MkApply(symbol, TermIndex.EmptyArgs, out wasAdded);
                    Type = Index.MkApply(Index.RangeSymbol, new Term[] { r, r }, out wasAdded);
                }
                else
                {
                    Type = Index.MkApply(symbol, TermIndex.EmptyArgs, out wasAdded);
                }
            }
            else
            {
                Type = Index.MkApply(symbol, TermIndex.EmptyArgs, out wasAdded);
            }

            singletonCon = Context.MkConstructor(
                string.Format(CreatorName, symbol.PrintableName),
                string.Format(TesterName, symbol.PrintableName));

            Representation = Context.MkDatatypeSort(string.Format(SortName, symbol.PrintableName), new Z3Con[] { singletonCon });
            CreationFun    = singletonCon.ConstructorDecl;
            TesterFun      = singletonCon.TesterDecl;
            DefaultMember  = new Tuple <Term, Z3Expr>(Value, CreationFun.Apply());
        }
Example #2
0
 private Z3Expr MkCoercion(Z3Expr t, AppFreeCanUnn unn, UnionEmbedding te)
 {
     return(CreationFun.Apply());
 }
Example #3
0
 public Z3Expr MkGround(Symbol symb, Z3Expr[] args)
 {
     Contract.Assert(symb != null && symb == Value.Symbol);
     Contract.Assert(args == null || args.Length == 0);
     return(CreationFun.Apply());
 }