From: Andrew Reynolds Date: Tue, 7 Aug 2018 01:28:15 +0000 (-0500) Subject: Remove support for Enum sygus syntax. (#2264) X-Git-Tag: cvc5-1.0.0~4813 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e4e3ac9d4dc62cad7f88f57bb0e80a3f2b32eecc;p=cvc5.git Remove support for Enum sygus syntax. (#2264) --- diff --git a/src/parser/smt2/Smt2.g b/src/parser/smt2/Smt2.g index 31d8b1a80..c512ee1da 100644 --- a/src/parser/smt2/Smt2.g +++ b/src/parser/smt2/Smt2.g @@ -919,7 +919,6 @@ sygusCommand [std::unique_ptr* cmd] sygusGTerm[CVC4::SygusGTerm& sgt, std::string& fun] @declarations { std::string name, name2; - bool readEnum = false; Kind k; Type t; CVC4::DatatypeConstructor* ctor = NULL; @@ -1080,48 +1079,36 @@ sygusGTerm[CVC4::SygusGTerm& sgt, std::string& fun] sgt.d_gterm_type = SygusGTerm::gterm_op; } | symbol[name,CHECK_NONE,SYM_VARIABLE] - ( SYGUS_ENUM_CONS_TOK symbol[name2,CHECK_NONE,SYM_VARIABLE] - { readEnum = true; } - )? - { if( readEnum ){ - name = name + "__Enum__" + name2; - Debug("parser-sygus") << "Sygus grammar " << fun << " : Enum constant " + { + if( name[0] == '-' ){ //hack for unary minus + Debug("parser-sygus") << "Sygus grammar " << fun + << " : unary minus integer literal " << name + << std::endl; + sgt.d_expr = MK_CONST(Rational(name)); + sgt.d_name = name; + sgt.d_gterm_type = SygusGTerm::gterm_op; + }else if( PARSER_STATE->isDeclared(name,SYM_VARIABLE) ){ + Debug("parser-sygus") << "Sygus grammar " << fun << " : symbol " << name << std::endl; - Expr c = PARSER_STATE->getVariable(name); - sgt.d_expr = MK_EXPR(kind::APPLY_CONSTRUCTOR,c); + sgt.d_expr = PARSER_STATE->getVariable(name); sgt.d_name = name; sgt.d_gterm_type = SygusGTerm::gterm_op; }else{ - if( name[0] == '-' ){ //hack for unary minus + //prepend function name to base sorts when reading an operator + std::stringstream ss; + ss << fun << "_" << name; + name = ss.str(); + if( PARSER_STATE->isDeclared(name, SYM_SORT) ){ + Debug("parser-sygus") << "Sygus grammar " << fun + << " : nested sort " << name << std::endl; + sgt.d_type = PARSER_STATE->getSort(name); + sgt.d_gterm_type = SygusGTerm::gterm_nested_sort; + }else{ Debug("parser-sygus") << "Sygus grammar " << fun - << " : unary minus integer literal " << name + << " : unresolved symbol " << name << std::endl; - sgt.d_expr = MK_CONST(Rational(name)); + sgt.d_gterm_type = SygusGTerm::gterm_unresolved; sgt.d_name = name; - sgt.d_gterm_type = SygusGTerm::gterm_op; - }else if( PARSER_STATE->isDeclared(name,SYM_VARIABLE) ){ - Debug("parser-sygus") << "Sygus grammar " << fun << " : symbol " - << name << std::endl; - sgt.d_expr = PARSER_STATE->getVariable(name); - sgt.d_name = name; - sgt.d_gterm_type = SygusGTerm::gterm_op; - }else{ - //prepend function name to base sorts when reading an operator - std::stringstream ss; - ss << fun << "_" << name; - name = ss.str(); - if( PARSER_STATE->isDeclared(name, SYM_SORT) ){ - Debug("parser-sygus") << "Sygus grammar " << fun - << " : nested sort " << name << std::endl; - sgt.d_type = PARSER_STATE->getSort(name); - sgt.d_gterm_type = SygusGTerm::gterm_nested_sort; - }else{ - Debug("parser-sygus") << "Sygus grammar " << fun - << " : unresolved symbol " << name - << std::endl; - sgt.d_gterm_type = SygusGTerm::gterm_unresolved; - sgt.d_name = name; - } } } } @@ -2219,15 +2206,6 @@ termNonVariable[CVC4::Expr& expr, CVC4::Expr& expr2] } } } - | symbol[name,CHECK_NONE,SYM_VARIABLE] SYGUS_ENUM_CONS_TOK - symbol[name2,CHECK_NONE,SYM_VARIABLE] - { std::string cname = name + "__Enum__" + name2; - Debug("parser-sygus") << "Check for enum const " << cname << std::endl; - expr = PARSER_STATE->getVariable(cname); - // expr.getType().isConstructor() && - // ConstructorType(expr.getType()).getArity()==0; - expr = MK_EXPR(CVC4::kind::APPLY_CONSTRUCTOR, expr); - } /* attributed expressions */ | LPAREN_TOK ATTRIBUTE_TOK term[expr, f2] @@ -3169,8 +3147,6 @@ DECLARE_PRIMED_VAR_TOK : 'declare-primed-var'; CONSTRAINT_TOK : 'constraint'; INV_CONSTRAINT_TOK : 'inv-constraint'; SET_OPTIONS_TOK : 'set-options'; -SYGUS_ENUM_TOK : { PARSER_STATE->sygus() }? 'Enum'; -SYGUS_ENUM_CONS_TOK : { PARSER_STATE->sygus() }? '::'; SYGUS_CONSTANT_TOK : { PARSER_STATE->sygus() }? 'Constant'; SYGUS_VARIABLE_TOK : { PARSER_STATE->sygus() }? 'Variable'; SYGUS_INPUT_VARIABLE_TOK : { PARSER_STATE->sygus() }? 'InputVariable'; diff --git a/test/regress/regress1/sygus/enum-test.sy b/test/regress/regress1/sygus/enum-test.sy index 47099eeed..7364747fc 100644 --- a/test/regress/regress1/sygus/enum-test.sy +++ b/test/regress/regress1/sygus/enum-test.sy @@ -1,6 +1,7 @@ ; EXPECT: unsat ; COMMAND-LINE: --cegqi-si=all --sygus-out=status (set-logic LIA) +;; this is the custom enumeration datatype syntax from an early proposal of the sygus standard (define-sort D (Enum (a b))) (define-fun f ((x D)) Int (ite (= x D::a) 3 7)) (synth-fun g () D ((Start D (D::a D::b))))