27 typechecker(v, *
this);
32static bool includes(
const std::set<variable>& s1,
const std::set<variable>& s2,
variable& culprit)
48 return isdigit(c) && c>
'0';
65 if (std::find(list.
begin(),list.
end(), el) == list.
end())
88 const abstraction& abstr=down_cast<const abstraction>(d);
95 strict_type_check(abstr.
body());
100 strict_type_check(abstr.
body());
107 const where_clause& where=down_cast<const where_clause>(d);
112 const assignment& t=down_cast<const assignment>(WhereElem);
113 strict_type_check(t.
rhs());
115 strict_type_check(where.
body());
135 strict_type_check(*i);
136 assert(i->sort()==s1);
149 strict_type_check(*i);
150 assert(i->sort()==s1);
163 strict_type_check(*i);
164 assert(i->sort()==s1);
167 strict_type_check(*i);
175 strict_type_check(head);
180 assert(appl.
size()==argument_sorts.
size());
184 assert(UnwindType(j->sort())==UnwindType(*i));
185 strict_type_check(*j);
204 const bool strictly_ambiguous,
206 const bool print_cast_error)
const
222 NeededType=UnwindType(NeededType);
223 Type=UnwindType(Type);
225 if (EqTypesA(NeededType,Type))
236 bool found_solution=
true;
240 r=UpCastNumericType(*i,Type,Par,DeclaredVars,strictly_ambiguous,warn_upcasting,print_cast_error);
244 found_solution=
false;
256 warn_upcasting=
false;
275#ifdef MCRL2_ENABLE_MACHINENUMBERS
276 Par=sort_nat::transform_positive_number_to_nat(Par);
282 was_warning_upcasting=
true;
283 mCRL2log(
warning) <<
"Upcasting " << OldPar <<
" to sort Nat by applying Pos2Nat to it." << std::endl;
299#ifdef MCRL2_ENABLE_MACHINENUMBERS
306 was_warning_upcasting=
true;
307 mCRL2log(
warning) <<
"Upcasting " << OldPar <<
" to sort Int by applying Pos2Int to it." << std::endl;
317 was_warning_upcasting=
true;
318 mCRL2log(
warning) <<
"Upcasting " << OldPar <<
" to sort Int by applying Nat2Int to it." << std::endl;
334#ifdef MCRL2_ENABLE_MACHINENUMBERS
345 was_warning_upcasting=
true;
346 mCRL2log(
warning) <<
"Upcasting " << OldPar <<
" to sort Real by applying Pos2Real to it." << std::endl;
358 was_warning_upcasting=
true;
359 mCRL2log(
warning) <<
"Upcasting " << OldPar <<
" to sort Real by applying Nat2Real to it." << std::endl;
369 was_warning_upcasting=
true;
370 mCRL2log(
warning) <<
"Upcasting " << OldPar <<
" to sort Real by applying Int2Real to it." << std::endl;
389 needed_argument_type=argument_type;
392 if (needed_similar_container_type==NeededType)
398 Type=TraverseVarConsTypeD(DeclaredVars,Par,
399 needed_similar_container_type,strictly_ambiguous,warn_upcasting,print_cast_error);
400 assert(UnwindType(Type)==UnwindType(needed_similar_container_type));
405 throw mcrl2::runtime_error(std::string(e.what()) +
"\nError occurred while trying to match argument types of " +
data::pp(NeededType) +
" and " +
422 if (Type==NeededType)
444 if (Type==NeededType)
463 assert(needed_function_type.
domain().
size()==1);
469 assert(needed_function_type.
domain().
size()==1);
485 PosType=UnwindType(PosType);
489 result=down_cast<container_sort>(PosType).element_sort();
507 NewPosType=UnwindType(NewPosType);
511 NewPosType=down_cast<const container_sort>(NewPosType).element_sort();
519 NewPosTypes=
reverse(NewPosTypes);
531 PosType=UnwindType(PosType);
535 result=down_cast<const container_sort>(PosType).element_sort();
553 NewPosType=UnwindType(NewPosType);
557 NewPosType=down_cast<const container_sort>(NewPosType).element_sort();
565 NewPosTypes=
reverse(NewPosTypes);
577 PosType=UnwindType(PosType);
581 result=down_cast<const container_sort>(PosType).element_sort();
599 NewPosType=UnwindType(NewPosType);
603 NewPosType=down_cast<const container_sort>(NewPosType).element_sort();
611 NewPosTypes=
reverse(NewPosTypes);
627 PosType=UnwindType(PosType);
631 const function_sort& s=down_cast<const function_sort>(PosType);
634 if (PosArgTypes.
size()!=ArgTypes.
size())
639 if (TypeMatchL(PosArgTypes,ArgTypes,temp))
647 TypeMatchL(ArgTypes,ExpandNumTypesUpL(PosArgTypes),temp);
667 NewPosType=UnwindType(NewPosType);
671 const function_sort& s=down_cast<const function_sort>(NewPosType);
673 if (PosArgTypes.
size()!=ArgTypes.
size())
678 if (TypeMatchL(PosArgTypes,ArgTypes,temp_list))
689 NewPosTypes=
reverse(NewPosTypes);
699 if (!TypeMatchA(Type1,Type2,result))
701 if (!TypeMatchA(Type1,ExpandNumTypesUp(Type2),result))
703 if (!TypeMatchA(Type2,ExpandNumTypesUp(Type1),result))
712 result=down_cast<untyped_possible_sorts>(result).sorts().front();
730 if (!UnifyMinType(Res,Args.
front(),Res))
735 if (!UnifyMinType(Res,Args.
front(),Res))
759 if (!UnifyMinType(Arg1,Arg2,Arg))
803 Res=down_cast<container_sort>(Res).element_sort();
814 Arg2=UnwindType(Arg2);
820 Arg2=down_cast<container_sort>(Arg2).element_sort();
823 if (!UnifyMinType(Res,Arg1,new_result))
828 if (!UnifyMinType(new_result,Arg2,Res))
851 Res=down_cast<container_sort>(Res).element_sort();
860 Arg1=UnwindType(Arg1);
866 Arg1=down_cast<container_sort>(Arg1).element_sort();
872 if (!UnifyMinType(Res,Arg1,new_result))
877 if (!UnifyMinType(new_result,Arg2,Res))
900 Res=down_cast<container_sort>(Res).element_sort();
910 Arg1=UnwindType(Arg1);
916 Arg1=down_cast<container_sort>(Arg1).element_sort();
923 Arg2=UnwindType(Arg2);
929 Arg2=down_cast<container_sort>(Arg2).element_sort();
932 if (!UnifyMinType(Res,Arg1,new_result))
937 if (!UnifyMinType(new_result,Arg2,Res))
962 Arg1=UnwindType(Arg1);
968 Arg1=down_cast<container_sort>(Arg1).element_sort();
971 if (!UnifyMinType(Res,Arg1,new_result))
1001 Arg=down_cast<container_sort>(Arg).element_sort();
1004 if (!UnifyMinType(Res,Arg,new_result))
1022 Res=UnwindType(Res);
1028 Res=down_cast<container_sort>(Res).element_sort();
1037 Arg=UnwindType(Arg);
1043 Arg=down_cast<container_sort>(Arg).element_sort();
1046 if (!UnifyMinType(Res,Arg,new_result))
1067 Res=UnwindType(Res);
1073 Res=down_cast<container_sort>(Res).element_sort();
1084 Arg=UnwindType(Arg);
1090 Arg=down_cast<container_sort>(Arg).element_sort();
1093 if (!UnifyMinType(Arg,Res,new_result))
1111 Res=UnwindType(Res);
1117 Res=down_cast<container_sort>(Res).element_sort();
1128 Arg1=UnwindType(Arg1);
1135 const sort_expression Arg12=down_cast<function_sort>(Arg1).codomain();
1144 if (Arg11l.
size()!=1)
1150 if (!UnifyMinType(Arg11,Res,new_result))
1160 Arg2=UnwindType(Arg2);
1169 if (!UnifyMinType(Arg21,new_result,new_result2))
1200 Res=UnwindType(Res);
1206 Res=down_cast<container_sort>(Res).element_sort();
1217 Arg1=UnwindType(Arg1);
1224 const sort_expression Arg12=down_cast<function_sort>(Arg1).codomain();
1233 if (Arg11l.
size()!=1)
1239 if (!UnifyMinType(Arg11,Res,new_result))
1249 Arg2=UnwindType(Arg2);
1258 if (!UnifyMinType(Arg21,new_result,new_result2))
1287 Arg2=UnwindType(Arg2);
1295 if (!UnifyMinType(Arg1,Arg2s,Arg))
1319 Arg2=UnwindType(Arg2);
1327 if (!UnifyMinType(Arg1,Arg2s,Arg))
1351 Arg2=UnwindType(Arg2);
1357 Arg3=UnwindType(Arg3);
1373 if (!UnifyMinType(Arg1,Arg3s,Arg3r))
1380 result=
function_sort({ Arg3r, Arg2r, fbag_type },fbag_type);
1398 Res=UnwindType(Res);
1419 Arg1=UnwindType(Arg1);
1437 Arg2=UnwindType(Arg2);
1460 if (!UnifyElementSort(Arg1, Arg2, temp_result))
1477 if (!UnifyElementSort(Arg1, Arg2, temp_result))
1494 if (!UnifyElementSort(Arg1, Arg2, temp_result))
1511 if (!UnifyElementSort(Arg1, Arg2, temp_result))
1524 if (!UnifyMinType(Res,Arg1,temp_result))
1529 if (!UnifyMinType(temp_result,Arg2,Res))
1546 Res=UnwindType(Res);
1564 Arg=UnwindType(Arg);
1576 Res=down_cast<container_sort>(Res).element_sort();
1581 Arg=down_cast<container_sort>(Arg).element_sort();
1584 if (!UnifyMinType(Res,Arg,temp_result))
1604 Res=UnwindType(Res);
1610 Res=down_cast<container_sort>(Res).element_sort();
1621 Arg=UnwindType(Arg);
1627 Arg=down_cast<container_sort>(Arg).element_sort();
1630 if (!UnifyMinType(Arg,Res,temp_result))
1653 if (!(Args.
size()==2))
1665 Arg2=UnwindType(Arg2);
1672 Arg2=down_cast<container_sort>(Arg2).element_sort();
1675 if (!UnifyMinType(Arg1,Arg2,Arg))
1707 if (!UnifyMinType(Arg1,Res,temp_result))
1711 Arg1 = atermpp::down_cast<function_sort>(UnwindType(temp_result));
1722 if (!UnifyMinType(A,Arg2,temp_result))
1726 if (!UnifyMinType(B,Arg3,temp_result))
1742 if (EqTypesA(Type1,Type2))
1841 result.push_back(ExpandNumTypesUp(*i));
1912 const function_sort& t=down_cast<const function_sort>(Type);
1917 NewTypeList.
push_front(ExpandNumTypesUp(UnwindType(TypeList.front())));
1942 Type=UnwindType(Type);
1945 bool function=
false;
1949 const function_sort& fs=down_cast<const function_sort>(Type);
2011 if (EqTypesA(Type,s))
2026 return UnwindType(Type1)==UnwindType(Type2);
2033 if (EqTypesL(Type,l))
2054 if (!EqTypesA(*i,s))
2074 assert(proposed_type.
defined());
2079 atermpp::down_cast<const untyped_identifier>(d).name():
2080 (down_cast<const data::function_symbol>(d).name());
2082 if (data::detail::if_symbol::is_symbol(data_term_name))
2085 if (!MatchIf(atermpp::down_cast<function_sort>(Type), NewType))
2092 if (data::detail::equal_symbol::is_symbol(data_term_name)
2093 || data::detail::not_equal_symbol::is_symbol(data_term_name)
2094 || data::detail::less_symbol::is_symbol(data_term_name)
2095 || data::detail::less_equal_symbol::is_symbol(data_term_name)
2096 || data::detail::greater_symbol::is_symbol(data_term_name)
2097 || data::detail::greater_equal_symbol::is_symbol(data_term_name)
2101 if (!MatchEqNeqComparison(atermpp::down_cast<function_sort>(Type), NewType))
2111 if (!MatchSqrt(atermpp::down_cast<function_sort>(Type), NewType))
2121 if (!MatchListOpCons(atermpp::down_cast<function_sort>(Type), NewType))
2131 if (!MatchListOpSnoc(atermpp::down_cast<function_sort>(Type), NewType))
2141 if (!MatchListOpConcat(atermpp::down_cast<function_sort>(Type), NewType))
2151 if (!MatchListOpEltAt(atermpp::down_cast<function_sort>(Type), NewType))
2163 if (!MatchListOpHead(atermpp::down_cast<function_sort>(Type), NewType))
2174 if (!MatchListOpTail(atermpp::down_cast<function_sort>(Type), NewType))
2184 if (!MatchSetOpSet2Bag(atermpp::down_cast<function_sort>(Type), NewType))
2194 if (!MatchListSetBagOpIn(atermpp::down_cast<function_sort>(Type), NewType))
2206 if (!MatchSetBagOpUnionDiffIntersect(data_term_name, atermpp::down_cast<function_sort>(Type), NewType))
2208 throw mcrl2::runtime_error(
"The function {Set,Bag}{Union,Difference,Intersect} has incompatible argument types " +
data::pp(Type) +
" (while typechecking " +
data::pp(d) +
").");
2217 if (!match_fset_insert(atermpp::down_cast<function_sort>(Type), NewType))
2227 if (!match_fbag_cinsert(atermpp::down_cast<function_sort>(Type), NewType))
2239 if (!MatchSetOpSetCompl(atermpp::down_cast<function_sort>(Type), NewType))
2249 if (!MatchBagOpBag2Set(atermpp::down_cast<function_sort>(Type), NewType))
2259 if (!MatchBagOpBagCount(atermpp::down_cast<function_sort>(Type), NewType))
2270 if (!MatchFuncUpdate(atermpp::down_cast<function_sort>(Type), NewType))
2280 if (!MatchSetConstructor(atermpp::down_cast<function_sort>(Type), NewType))
2291 if (!MatchBagConstructor(atermpp::down_cast<function_sort>(Type), NewType))
2301 if (!MatchFalseFunction(atermpp::down_cast<function_sort>(Type), NewType))
2311 if (!MatchBagConstructor(atermpp::down_cast<function_sort>(Type), NewType))
2327 const bool strictly_ambiguous,
2328 const std::size_t nFactPars,
2329 const bool warn_upcasting,
2330 const bool print_cast_error)
const
2336 atermpp::down_cast<const function_symbol>(DataTerm).name();
2339 bool TypeADefined=
false;
2341 std::map<core::identifier_string,sort_expression>::const_iterator i=DeclaredVars.
context().find(Name);
2343 if (i!=DeclaredVars.
context().end())
2363 std::map<core::identifier_string,sort_expression>::const_iterator i=DeclaredVars.
context().find(Name);
2364 if (i!=DeclaredVars.
context().end())
2369 if (!TypeMatchA(TypeA,PosType,temp))
2372 +
" is incompatible with " +
data::pp(PosType) +
" (typechecking " +
data::pp(DataTerm) +
").");
2379 std::map<core::identifier_string,sort_expression>::const_iterator i=user_constants.find(Name);
2380 if (i!=user_constants.end())
2385 if (!TypeMatchA(TypeA,PosType,temp))
2388 +
" is incompatible with " +
data::pp(PosType) +
" (typechecking " +
data::pp(DataTerm) +
").");
2395 std::map<core::identifier_string,sort_expression_list>::const_iterator j=system_constants.find(Name);
2397 if (j!=system_constants.end())
2400 if (ParList.
size()==1)
2426 const std::map <core::identifier_string,sort_expression_list>::const_iterator j_context=user_functions.find(Name);
2427 const std::map <core::identifier_string,sort_expression_list>::const_iterator j_gssystem=system_functions.find(Name);
2429 if (j_context==user_functions.end())
2431 if (j_gssystem!=system_functions.end())
2433 ParList=j_gssystem->second;
2437 if (nFactPars!=std::string::npos)
2439 throw mcrl2::runtime_error(
"Unknown operation " +
core::pp(Name) +
" with " + std::to_string(nFactPars) +
" parameter" + ((nFactPars != 1)?
"s.":
"."));
2447 else if (j_gssystem==system_functions.end())
2449 ParList=j_context->second;
2453 ParList=j_gssystem->second+j_context->second;
2462 if (nFactPars!=std::string::npos)
2464 for (; !ParList.
empty(); ParList=ParList.
tail())
2471 if (down_cast<function_sort>(Par).domain().size()!=nFactPars)
2480 if (!ParList.
empty())
2482 CandidateParList=ParList;
2488 for (; !ParList.
empty(); ParList=ParList.
tail())
2493 PosType=determine_allowed_type(DataTerm, PosType);
2495 if (TypeMatchA(Par,PosType,result))
2505 NewParList=
reverse(NewParList);
2507 if (NewParList.
empty())
2515 ParList=BackupParList;
2516 PosType=ExpandNumTypesUp(PosType);
2517 for (; !ParList.
empty(); ParList=ParList.
tail())
2521 if (TypeMatchA(Par,PosType,result))
2526 NewParList=
reverse(NewParList);
2527 if (NewParList.
size()>1)
2533 if (NewParList.
empty())
2538 ParList=BackupParList;
2540 PosType=ExpandNumTypesDown(ExpandNumTypesUp(PosType));
2541 for (; !ParList.
empty(); ParList=ParList.
tail())
2545 if (TypeMatchA(Par,PosType,result))
2550 NewParList=
reverse(NewParList);
2551 if (NewParList.
size()>1)
2559 if (ParList.
empty())
2563 if (CandidateParList.
size()==1)
2565 Sort=CandidateParList.
front();
2572 if (nFactPars!=std::string::npos)
2575 +
" with " + std::to_string(nFactPars) +
" argument" + ((nFactPars != 1)?
"s":
"")
2576 +
" that matches type " +
data::pp(PosType) +
".");
2584 if (ParList.
size()==1)
2595 result=TypeMatchA(Type,PosType,new_type);
2602 result=TypeMatchA(Type,DataTerm.
sort(),new_type);
2611 Type=determine_allowed_type(DataTerm,Type);
2632 if (strictly_ambiguous)
2634 if (nFactPars!=std::string::npos)
2636 throw mcrl2::runtime_error(
"Ambiguous operation " +
core::pp(Name) +
" with " + std::to_string(nFactPars) +
" parameter" + ((nFactPars != 1)?
"s.":
"."));
2651 return TraverseVarConsTypeD(DeclaredVars,DataTerm,PosType,strictly_ambiguous,warn_upcasting,print_cast_error);
2660 const bool strictly_ambiguous,
2661 const bool warn_upcasting,
2662 const bool print_cast_error)
const
2669 const abstraction& abstr=down_cast<const abstraction>(DataTerm);
2686 (*this)(comprehension_variables,DeclaredVars);
2695 if (comprehension_variables.
size()!=1)
2711 ResType=TraverseVarConsTypeD(CopyDeclaredVars,Data,
data::untyped_sort(),strictly_ambiguous,warn_upcasting,print_cast_error);
2715 throw mcrl2::runtime_error(std::string(e.what()) +
"\nThe condition or count of a set/bag comprehension " +
data::pp(DataTerm) +
" cannot be determined.");
2731#ifdef MCRL2_ENABLE_MACHINENUMBERS
2732 Data=sort_nat::transform_positive_number_to_nat(Data);
2740 throw mcrl2::runtime_error(
"The condition or count of a set/bag comprehension is not of sort Bool, Nat or Pos, but of sort " +
data::pp(ResType) +
".");
2743 if (!TypeMatchA(NewType,PosType,NewType))
2759 (*this)(bound_variables,DeclaredVars);
2763 throw mcrl2::runtime_error(std::string(e.what()) +
"\nError occurred while typechecking the quantification " +
data::pp(DataTerm) +
".");
2782 DataTerm=
abstraction(BindingOperator,bound_variables,Data);
2792 (*this)(bound_variables,DeclaredVars);
2796 throw mcrl2::runtime_error(std::string(e.what()) +
"\nError occurred while typechecking the lambda expression " +
data::pp(DataTerm) +
".");
2804 if (!UnArrowProd(ArgTypes,PosType,NewType))
2812 NewType=TraverseVarConsTypeD(CopyDeclaredVars,Data,NewType,strictly_ambiguous,warn_upcasting,print_cast_error);
2819 DataTerm=
abstraction(BindingOperator,bound_variables,Data);
2826 const where_clause& where=down_cast<const where_clause>(DataTerm);
2846 const assignment& t=down_cast<const assignment>(WhereElem);
2848 NewWhereVar=t.
lhs();
2849 sort_expression WhereType=TraverseVarConsTypeD(DeclaredVars,WhereTerm,NewWhereVar.
sort(),strictly_ambiguous,warn_upcasting,print_cast_error);
2854 NewWhereList=
reverse(NewWhereList);
2860 (*this)(where_variables,DeclaredVars);
2864 throw mcrl2::runtime_error(std::string(e.what()) +
"\nError occurred while typechecking the where expression " +
data::pp(DataTerm) +
".");
2871 sort_expression NewType=TraverseVarConsTypeD(CopyDeclaredVars,Data,PosType,strictly_ambiguous,warn_upcasting,print_cast_error);
2880 const application& appl=down_cast<application>(DataTerm);
2881 std::size_t nArguments=appl.
size();
2888 atermpp::down_cast<untyped_identifier>(Arg0).name();
2892 if (!UnList(PosType,Type))
2899 bool Type_is_stable=
true;
2906 Type0=TraverseVarConsTypeD(DeclaredVars,Argument,Type,strictly_ambiguous,warn_upcasting,
false);
2912 Type0=TraverseVarConsTypeD(DeclaredVars,Argument,
data::untyped_sort(),strictly_ambiguous,warn_upcasting,print_cast_error);
2915 Type_is_stable=Type_is_stable && (Type==Type0);
2921 if (!Type_is_stable)
2927 sort_expression Type0=TraverseVarConsTypeD(DeclaredVars,Argument,Type,strictly_ambiguous,warn_upcasting,print_cast_error);
2940 if (!UnFSet(PosType,Type))
2946 bool NewTypeDefined=
false;
2954 Type0=TraverseVarConsTypeD(DeclaredVars,Argument,Type,strictly_ambiguous,warn_upcasting,print_cast_error);
2962 if (!NewTypeDefined)
2965 NewTypeDefined=
true;
2970 if (!MaximumType(NewType,Type0,temp))
2975 NewTypeDefined=
true;
2982 assert(NewTypeDefined);
2994 Type0=TraverseVarConsTypeD(DeclaredVars,Argument,Type,strictly_ambiguous,warn_upcasting,print_cast_error);
3015 if (!UnFBag(PosType,Type))
3023 bool NewTypeDefined=
false;
3032 Type0=TraverseVarConsTypeD(DeclaredVars,Argument0,Type,strictly_ambiguous,warn_upcasting,print_cast_error);
3041 Type1=TraverseVarConsTypeD(DeclaredVars,Argument1,
sort_nat::nat(),strictly_ambiguous,warn_upcasting,print_cast_error);
3045 if (print_cast_error)
3055 if (!NewTypeDefined)
3058 NewTypeDefined=
true;
3063 if (!MaximumType(NewType,Type0,temp))
3069 NewTypeDefined=
true;
3073 assert(NewTypeDefined);
3087 Type0=TraverseVarConsTypeD(DeclaredVars,Argument0,Type,strictly_ambiguous,warn_upcasting,print_cast_error);
3091 if (print_cast_error)
3103 Type1=TraverseVarConsTypeD(DeclaredVars,Argument1,
sort_nat::nat(),strictly_ambiguous,warn_upcasting,print_cast_error);
3107 if (print_cast_error)
3148 NewType=TraverseVarConsTypeDN(DeclaredVars,
3152 false,nArguments,warn_upcasting,print_cast_error);
3156 throw mcrl2::runtime_error(std::string(e.what()) +
"\nType error while trying to cast an application of " +
3168 sort_expression_list NeededArgumentTypes=down_cast<function_sort>(UnwindType(NewType)).domain();
3170 if (NeededArgumentTypes.
size()!=Arguments.
size())
3173 " which does not match the number of provided arguments "
3174 +
data::pp(Arguments) +
" (while typechecking "
3180 for (; !Arguments.
empty(); Arguments=Arguments.
tail(),
3181 ArgumentTypes=ArgumentTypes.
tail(),NeededArgumentTypes=NeededArgumentTypes.
tail())
3183 assert(!Arguments.
empty());
3184 assert(!NeededArgumentTypes.
empty());
3188 if (!EqTypesA(NeededType,Type))
3193 Type=UpCastNumericType(NeededType,Type,Arg,DeclaredVars,strictly_ambiguous,warn_upcasting,print_cast_error);
3199 if (!EqTypesA(NeededType,Type))
3202 if (!TypeMatchA(NeededType,Type,NewArgType))
3204 if (!TypeMatchA(NeededType,ExpandNumTypesUp(Type),NewArgType))
3206 NewArgType=NeededType;
3211 NewArgType=TraverseVarConsTypeD(DeclaredVars,Arg,NewArgType,strictly_ambiguous,warn_upcasting,print_cast_error);
3223 Arguments=
reverse(NewArguments);
3224 ArgumentTypes=
reverse(NewArgumentTypes);
3230 NewType=TraverseVarConsTypeDN(DeclaredVars,
3232 strictly_ambiguous,nArguments,warn_upcasting,print_cast_error);
3243 sort_expression_list NeededArgumentTypes=down_cast<function_sort>(UnwindType(NewType)).domain();
3246 for (; !Arguments.
empty(); Arguments=Arguments.
tail(),
3247 ArgumentTypes=ArgumentTypes.
tail(),NeededArgumentTypes=NeededArgumentTypes.
tail())
3253 if (!EqTypesA(NeededType,Type))
3258 Type=UpCastNumericType(NeededType,Type,Arg,DeclaredVars,strictly_ambiguous,warn_upcasting,print_cast_error);
3264 if (!EqTypesA(NeededType,Type))
3267 if (!TypeMatchA(NeededType,Type,NewArgType))
3269 if (!TypeMatchA(NeededType,ExpandNumTypesUp(Type),NewArgType))
3271 NewArgType=NeededType;
3276 NewArgType=TraverseVarConsTypeD(DeclaredVars,Arg,NewArgType,strictly_ambiguous,warn_upcasting,print_cast_error);
3289 Arguments=
reverse(NewArguments);
3290 ArgumentTypes=
reverse(NewArgumentTypes);
3303 return UpCastNumericType(PosType, atermpp::down_cast<function_sort>(UnwindType(NewType)).codomain(),
3304 DataTerm,DeclaredVars,strictly_ambiguous,warn_upcasting,print_cast_error);
3307 return atermpp::down_cast<function_sort>(UnwindType(NewType)).codomain();
3311 if (!UnArrowProd(ArgumentTypes,NewType,temp_type))
3327 atermpp::down_cast<variable>(DataTerm).name();
3342 if (TypeMatchA(Sort,PosType,temp))
3351 CastedNewType=UpCastNumericType(PosType,Sort,DataTerm,DeclaredVars,strictly_ambiguous,warn_upcasting,print_cast_error);
3357 return CastedNewType;
3360 const std::map<core::identifier_string,sort_expression>::const_iterator it=DeclaredVars.
context().find(Name);
3361 if (it!=DeclaredVars.
context().end())
3367 if (TypeMatchA(Type,PosType,NewType))
3377 CastedNewType=UpCastNumericType(PosType,Type,DataTerm,DeclaredVars,strictly_ambiguous,warn_upcasting,print_cast_error);
3381 if (print_cast_error)
3398 std::map<core::identifier_string,sort_expression>::const_iterator i=user_constants.find(Name);
3399 if (i!=user_constants.end())
3403 if (TypeMatchA(Type,PosType,NewType))
3415 return UpCastNumericType(PosType,Type,DataTerm,DeclaredVars,strictly_ambiguous,warn_upcasting,print_cast_error);
3424 std::map<core::identifier_string,sort_expression_list>::const_iterator j=system_constants.find(Name);
3425 if (j!=system_constants.end())
3433 if (TypeMatchA(Type,PosType,result))
3440 if (ParList.
empty())
3450 Type=UpCastNumericType(PosType,Type,DataTerm,DeclaredVars,strictly_ambiguous,warn_upcasting,print_cast_error);
3453 if (TypeMatchA(Type,PosType,result))
3461 if (ParList.
empty())
3466 if (ParList.
size()==1)
3477 sort_expression r= UpCastNumericType(PosType,Type,DataTerm,DeclaredVars,strictly_ambiguous,warn_upcasting,print_cast_error);
3492 const std::map <core::identifier_string,sort_expression_list>::const_iterator j_context=user_functions.find(Name);
3493 const std::map <core::identifier_string,sort_expression_list>::const_iterator j_gssystem=system_functions.find(Name);
3496 if (j_context==user_functions.end())
3498 if (j_gssystem!=system_functions.end())
3500 ParList=j_gssystem->second;
3507 else if (j_gssystem==system_functions.end())
3509 ParList=j_context->second;
3513 ParList=j_gssystem->second+j_context->second;
3517 if (ParList.
size()==1)
3523 return UpCastNumericType(PosType,Type,DataTerm,DeclaredVars,strictly_ambiguous,warn_upcasting,print_cast_error);
3532 return TraverseVarConsTypeDN(DeclaredVars, DataTerm, PosType, strictly_ambiguous, std::string::npos, warn_upcasting,print_cast_error);
3536#ifdef MCRL2_ENABLE_MACHINENUMBERS
3548 std::size_t constr_number=constructors.size();
3550 functions_and_constructors.insert(functions_and_constructors.end(),mappings.begin(),mappings.end());
3556 check_sort_is_declared(FuncType);
3564 FuncType=NewFuncType;
3592 ConstructorType=down_cast<function_sort>(ConstructorType).codomain();
3594 ConstructorType=UnwindType(ConstructorType);
3612 check_for_empty_constructor_domains(normalized_constructors);
3620 if (user_constants.count(Name)>0)
3625 if (system_constants.count(Name)>0 || system_functions.count(Name)>0)
3639 if (TypeList.
size()!=PosTypeList.
size())
3649 if (!TypeMatchA(*i,*j,Type))
3705 if (TypeMatchA(Type,NewPosType,new_type))
3707 NewPosType=new_type;
3709 if (std::find(NewTypeList.
begin(),NewTypeList.
end(),NewPosType)==NewTypeList.
end())
3715 if (NewTypeList.
empty())
3719 if (NewTypeList.
tail().empty())
3721 result=NewTypeList.
front();
3731 Type=UnwindType(Type);
3735 PosType=UnwindType(PosType);
3748 if (!TypeMatchA(s.
element_sort(),down_cast<container_sort>(PosType).element_sort(),Res))
3765 if (!TypeMatchA(s.
element_sort(),down_cast<container_sort>(PosType).element_sort(),Res))
3783 if (!TypeMatchA(s.
element_sort(),down_cast<container_sort>(PosType).element_sort(),Res))
3801 if (!TypeMatchA(s.
element_sort(),down_cast<container_sort>(PosType).element_sort(),Res))
3819 if (!TypeMatchA(s.
element_sort(),down_cast<container_sort>(PosType).element_sort(),Res))
3837 const function_sort& fs=down_cast<const function_sort>(Type);
3838 const function_sort& posfs=down_cast<const function_sort>(PosType);
3865 std::map<core::identifier_string,sort_expression_list>::const_iterator i=system_constants.find(OpIdName);
3868 if (i!=system_constants.end())
3873 system_constants[OpIdName]=Types;
3884 const std::map <core::identifier_string,sort_expression_list>::const_iterator j=system_functions.find(OpIdName);
3887 if (j!=system_functions.end())
3892 system_functions[OpIdName]=Types;
3901 add_system_function(f);
3905 add_system_constant(f);
3930 assert(system_constants.find(
sort_pos::c1().
name())!=system_constants.end());
3935#ifdef MCRL2_ENABLE_MACHINENUMBERS
4035 if (system_constants.count(Name)>0)
4040 if (system_functions.count(Name)>0)
4045 std::map <core::identifier_string,sort_expression_list>::const_iterator j=user_functions.find(Name);
4050 if (j!=user_functions.end())
4053 if (InTypesA(Sort, Types))
4055 if (!allow_double_decls)
4061 user_functions[Name]=Types;
4073 check_basic_sort_is_declared(down_cast<basic_sort>(sort_expr));
4079 return read_sort(down_cast<container_sort>(sort_expr).element_sort());
4084 const function_sort& fs = atermpp::down_cast<function_sort>(sort_expr);
4098 std::map<core::identifier_string, sort_expression> duplicate_projections_warner;
4099 const structured_sort& struct_sort = atermpp::down_cast<structured_sort>(sort_expr);
4121 if (!proj.name().empty() && duplicate_projections_warner.count(proj.name())>0 && duplicate_projections_warner[proj.name()]!=proj.sort())
4123 mCRL2log(
warning) <<
"Warning. Projection function " << proj.name() <<
" occurs multiple times with different sorts in " << struct_sort <<
". " << std::endl;
4127 duplicate_projections_warner[proj.name()]=proj.sort();
4132 read_sort(proj_sort);
4151 if (EqTypesA(s,Type))
4173 return InTypesA(Type,down_cast<const untyped_possible_sorts>(PosType).sorts());
4177 return EqTypesA(Type,PosType);
4183 assert(TypeList.
size()==PosTypeList.
size());
4186 if (!IsTypeAllowedA(*i,*j))
4218 if (!IsNotInferredL(PosTypeList))
4220 if (InTypesL(PosTypeList,TypeListList))
4222 return std::make_pair(
true,PosTypeList);
4233 i!=TypeListList.
end(); ++i)
4236 if (IsTypeAllowedL(TypeList,PosTypeList))
4241 if (NewTypeListList.
empty())
4245 if (NewTypeListList.
size()==1)
4247 return std::make_pair(
true,NewTypeListList.
front());
4251 return std::make_pair(
true,GetNotInferredList(
reverse(NewTypeListList)));
4265 std::size_t nFormPars=TypeListList.
front().size();
4266 std::vector<sort_expression_list> Pars(nFormPars);
4267 for (std::size_t i=0; i<nFormPars; i++)
4275 for (std::size_t i=0; i<nFormPars; TypeList=TypeList.
tail(),i++)
4277 Pars[i]=InsertType(Pars[i],TypeList.
front());
4281 for (std::size_t i=nFormPars; i>0; i--)
4284 if (Pars[i-1].size()==1)
4286 Sort=Pars[i-1].front();
4299 was_warning_upcasting(false)
4313 throw mcrl2::runtime_error(std::string(e.what()) +
"\nType checking of data expression failed.");
4326 throw mcrl2::runtime_error(std::string(e.what()) +
"\nFailed to type check data specification.");
4342 throw mcrl2::runtime_error(std::string(e.what()) +
"\nType checking of data expression failed.");
4349 assert(strict_type_check(data));
4358 const std::map<core::identifier_string,sort_expression_list>::const_iterator i1=system_constants.find(v.
name());
4359 if (i1!=system_constants.end())
4362 " clashes with the system defined constant " +
core::pp(i1->first) +
":" +
data::pp(i1->second.front()) +
".");
4364 const std::map<core::identifier_string,sort_expression_list>::const_iterator i2=system_functions.find(v.
name());
4365 if (i2!=system_functions.end())
4368 " clashes with the system defined function " +
core::pp(i2->first) +
":" +
data::pp(i2->second.front()) +
".");
4370 const std::map<core::identifier_string,sort_expression>::const_iterator i3=user_constants.find(v.
name());
4371 if (i3!=user_constants.end())
4374 " clashes with the user defined constant " +
core::pp(i3->first) +
":" +
data::pp(i3->second) +
".");
4376 const std::map<core::identifier_string,sort_expression_list>::const_iterator i4=user_functions.find(v.
name());
4377 if (i4!=user_functions.end())
4380 " clashes with the user defined function " +
core::pp(i4->first) +
":" +
data::pp(i4->second.front()) +
".");
4394 const std::map<core::identifier_string,sort_expression>::const_iterator i=context_variables.
context().find(v.
name());
4396 if (i!=context_variables.
context().end() && !TypeMatchA(i->second,v.
sort(),temp))
4399 " is used in its surrounding context with a different sort " +
core::pp(i->second) +
".");
4411 (*this)(v, context_variables);
4415 std::set<core::identifier_string> variable_names;
4418 if (!variable_names.insert(v.name()).second)
4459 if (was_warning_upcasting)
4461 was_warning_upcasting=
false;
4462 mCRL2log(
warning) <<
"Warning occurred while typechecking " << left <<
" as left hand side of equation " << eqn <<
"." << std::endl;
4472 rightType=TraverseVarConsTypeD(DeclaredVars,right,leftType,
false);
4480 if (!EqTypesA(leftType,rightType))
4483 if (!TypeMatchA(leftType,rightType,Type))
4490 leftType=TraverseVarConsTypeD(DeclaredVars,left,Type,
true);
4494 throw mcrl2::runtime_error(std::string(e.what()) +
"\nTypes of the left- and right-hand-sides of the equation " +
data::pp(eqn) +
" do not match.");
4496 if (was_warning_upcasting)
4498 was_warning_upcasting=
false;
4499 mCRL2log(
warning) <<
"Warning occurred while typechecking " << left <<
" as left hand side of equation " << eqn <<
"." << std::endl;
4504 rightType=TraverseVarConsTypeD(DeclaredVars,right,leftType);
4508 throw mcrl2::runtime_error(std::string(e.what()) +
"\nTypes of the left- and right-hand-sides of the equation " +
data::pp(eqn) +
" do not match.");
4510 if (!TypeMatchA(leftType,rightType,Type))
4534 resulting_equations.push_back(
data_equation(vars,cond,left,right));
4536 eqns = resulting_equations;
4569 std::map<std::pair<data_expression, data_expression>,
data_equation> lhs_map;
4572 const auto find_result = lhs_map.find(std::make_pair(eqn.condition(), eqn.lhs()));
4573 if(find_result != lhs_map.end())
4575 mCRL2log(
warning) <<
"Warning: condition and left-hand side of equations " << find_result->second <<
" and " << eqn <<
" completely overlap." << std::endl;
4579 lhs_map[std::make_pair(eqn.condition(), eqn.lhs())] = eqn;
4582 data_spec=new_specification;
4587 return type_checked_data_spec;
4604 for (
const variable& VarDecl: VarDecls)
4617 return atermpp::down_cast<untyped_possible_sorts>(Type).sorts().front();
4666 return HasUnknown(down_cast<container_sort>(Type).element_sort());
4691 if (data::is_untyped_sort(Type))
4705 return TypeList.
front();
Term containing a string.
const_iterator end() const
Returns a const_iterator pointing past the last argument.
const_iterator begin() const
Returns an iterator pointing to the first argument.
const function_symbol & function() const
Returns the function symbol belonging to an aterm.
const std::string & name() const
Return the name of the function_symbol.
size_type size() const
Returns the size of the term_list.
const_iterator end() const
Returns a const_iterator pointing to the end of the term_list.
const term_list< Term > & tail() const
Returns the tail of the list.
const Term & front() const
Returns the first element of the list.
void pop_front()
Removes the first element of the list.
const_iterator begin() const
Returns a const_iterator pointing to the beginning of the term_list.
bool empty() const
Returns true if the list's size is 0.
void push_front(const Term &el)
Inserts a new element at the beginning of the current list.
void swap(unprotected_aterm_core &t) noexcept
Swaps this term with its argument.
bool defined() const
Returns true if this term is not equal to the term assigned by the default constructor of aterms,...
An abstraction expression.
const variable_list & variables() const
const data_expression & body() const
const binder_type & binding_operator() const
An application of a data expression to a number of arguments.
const_iterator end() const
Returns an iterator pointing past the last argument of the application.
const_iterator begin() const
Returns an iterator pointing to the first argument of the application.
const data_expression & head() const
Get the function at the head of this expression.
\brief Assignment expression
\brief Assignment of a data expression to a variable
const data_expression & rhs() const
const variable & lhs() const
\brief Binder for bag comprehension
\brief Container type for bags
const container_type & container_name() const
const sort_expression & element_sort() const
sort_expression sort() const
Returns the sort of the data expression.
const function_symbol_vector & user_defined_constructors() const
Gets the constructors defined by the user, excluding those that are system defined.
void add_mapping(const function_symbol &f)
Adds a mapping to this specification.
void add_equation(const data_equation &e)
Adds an equation to this specification.
const function_symbol_vector & user_defined_mappings() const
Gets all user defined mappings in this specification.
const data_equation_vector & user_defined_equations() const
Gets all user defined equations.
void add_constructor(const function_symbol &f)
Adds a constructor to this specification.
const function_symbol_vector & constructors() const
Gets all constructors including those that are system defined.
bool IsNotInferredL(sort_expression_list TypeList) const
bool TypeMatchL(const sort_expression_list &TypeList, const sort_expression_list &PosTypeList, sort_expression_list &result) const
bool UnFBag(sort_expression PosType, sort_expression &result) const
bool MatchIf(const function_sort &type, sort_expression &result) const
sort_expression TraverseVarConsTypeD(const detail::variable_context &DeclaredVars, data_expression &DataTerm, const sort_expression &PosType, const bool strictly_ambiguous=true, const bool warn_upcasting=false, const bool print_cast_error=true) const
bool MatchFalseFunction(const function_sort &type, sort_expression &result) const
bool MatchListOpCons(const function_sort &type, sort_expression &result) const
bool UnifyMinType(const sort_expression &Type1, const sort_expression &Type2, sort_expression &result) const
bool MatchListOpEltAt(const function_sort &type, sort_expression &result) const
const data_specification operator()() const
Yields a type checked data specification, provided typechecking was successful. If not successful an ...
bool EqTypesA(const sort_expression &Type1, const sort_expression &Type2) const
sort_expression UpCastNumericType(sort_expression NeededType, sort_expression Type, data_expression &Par, const detail::variable_context &DeclaredVars, const bool strictly_ambiguous, bool warn_upcasting=false, const bool print_cast_error=false) const
bool UnifyElementSort(sort_expression &Arg1, sort_expression &Arg2, sort_expression &result) const
bool MatchListSetBagOpIn(const function_sort &type, sort_expression &result) const
bool match_fbag_cinsert(const function_sort &type, sort_expression &result) const
bool MatchSqrt(const function_sort &type, sort_expression &result) const
bool MatchBagOpBag2Set(const function_sort &type, sort_expression &result) const
void read_constructors_and_mappings(const function_symbol_vector &constructors, const function_symbol_vector &mappings, const function_symbol_vector &normalized_constructors)
bool MatchEqNeqComparison(const function_sort &type, sort_expression &result) const
bool InTypesL(const sort_expression_list &Type, atermpp::term_list< sort_expression_list > Types) const
sort_expression UnwindType(const sort_expression &Type) const
bool strict_type_check(const data_expression &d) const
bool MatchBagConstructor(const function_sort &type, sort_expression &result) const
bool MatchBagOpBagCount(const function_sort &type, sort_expression &result) const
sort_expression ExpandNumTypesUp(sort_expression Type) const
sort_expression ExpandNumTypesDown(sort_expression Type) const
sort_expression_list ExpandNumTypesUpL(const sort_expression_list &type_list) const
void add_constant(const data::function_symbol &f, const std::string &msg)
bool MatchSetBagOpUnionDiffIntersect(const core::identifier_string &data_term_name, const function_sort &type, sort_expression &result) const
bool MatchListOpSnoc(const function_sort &type, sort_expression &result) const
bool UnFSet(sort_expression PosType, sort_expression &result) const
bool MatchListOpConcat(const function_sort &type, sort_expression &result) const
void add_system_function(const data::function_symbol &f)
void TransformVarConsTypeData(data_specification &data_spec)
void add_system_constants_and_functions(const std::vector< data::function_symbol > &v)
bool IsTypeAllowedA(const sort_expression &Type, const sort_expression &PosType) const
bool MatchSetOpSetCompl(const function_sort &type, sort_expression &result) const
void initialise_system_defined_functions(void)
bool InTypesA(const sort_expression &Type, sort_expression_list Types) const
bool MaximumType(const sort_expression &Type1, const sort_expression &Type2, sort_expression &result) const
data_type_checker(const data_specification &data_spec)
make a data type checker. Throws a mcrl2::runtime_error exception if the data_specification is not we...
bool UnList(sort_expression PosType, sort_expression &result) const
bool MatchFuncUpdate(const function_sort &type, sort_expression &result) const
void add_system_constant(const data::function_symbol &f)
bool MatchSetOpSet2Bag(const function_sort &type, sort_expression &result) const
std::pair< bool, sort_expression_list > AdjustNotInferredList(const sort_expression_list &PosTypeList, const atermpp::term_list< sort_expression_list > &TypeListList) const
bool EqTypesL(sort_expression_list Type1, sort_expression_list Type2) const
sort_expression determine_allowed_type(const data_expression &d, const sort_expression &proposed_type) const
void add_function(const data::function_symbol &f, const std::string &msg, bool allow_double_decls=false)
sort_expression_list GetNotInferredList(const atermpp::term_list< sort_expression_list > &TypeListList) const
void read_sort(const sort_expression &SortExpr)
bool MatchListOpHead(const function_sort &type, sort_expression &result) const
bool match_fset_insert(const function_sort &type, sort_expression &result) const
sort_expression TraverseVarConsTypeDN(const detail::variable_context &DeclaredVars, data_expression &DataTerm, sort_expression PosType, const bool strictly_ambiguous=true, const std::size_t nFactPars=std::string::npos, const bool warn_upcasting=false, const bool print_cast_error=true) const
sort_expression_list InsertType(const sort_expression_list &TypeList, const sort_expression &Type) const
bool UnArrowProd(const sort_expression_list &ArgTypes, sort_expression PosType, sort_expression &result) const
bool TypeMatchA(const sort_expression &Type_in, const sort_expression &PosType_in, sort_expression &result) const
bool IsTypeAllowedL(const sort_expression_list &TypeList, const sort_expression_list &PosTypeList) const
bool MatchSetConstructor(const function_sort &type, sort_expression &result) const
data_specification type_checked_data_spec
bool MatchListOpTail(const function_sort &type, sort_expression &result) const
void typecheck_variable(const data_type_checker &typechecker, const variable &v) const
void add_context_variables(const VariableContainer &variables)
const std::map< core::identifier_string, sort_expression > & context() const
const sort_expression & codomain() const
const sort_expression_list & domain() const
const core::identifier_string & name() const
const sort_expression & sort() const
\brief Binder for set comprehension
\brief Container type for sets
const basic_sort_vector & user_defined_sorts() const
Gets all sorts defined by a user (excluding the system defined sorts).
void add_alias(const alias &a)
Adds an alias (new name for a sort) to this specification.
void add_sort(const basic_sort &s)
Adds a sort to this specification.
const alias_vector & user_defined_aliases() const
Gets the user defined aliases.
const sort_specification & get_sort_specification() const
void check_sort_is_declared(const sort_expression &x) const
\brief An argument of a constructor of a structured sort
\brief A constructor for a structured sort
const structured_sort_constructor_list & constructors() const
\brief Assignment of a data expression to a string
const core::identifier_string & lhs() const
const data_expression & rhs() const
\brief An untyped identifier
\brief Multiple possible sorts
const sort_expression_list & sorts() const
\brief Unknown sort expression
const core::identifier_string & name() const
const sort_expression & sort() const
\brief A where expression
const data_expression & body() const
const assignment_expression_list & declarations() const
Standard exception class for reporting runtime errors.
Provides utilities for pretty printing.
add your file description here.
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
The main namespace for the aterm++ library.
term_list< Term > reverse(const term_list< Term > &l)
Returns the list with the elements in reversed order.
term_list< Term > push_back(const term_list< Term > &l, const Term &el)
Appends a new element at the end of the list. Note that the complexity of this function is O(n),...
identifier_string empty_identifier_string()
Provides the empty identifier string.
std::string pp(const identifier_string &x)
static bool HasUnknown(const sort_expression &Type)
static bool includes(const std::set< variable > &s1, const std::set< variable > &s2, variable &culprit)
atermpp::term_list< S > insert_sort_unique(const atermpp::term_list< S > &list, const S &el)
static bool IsPos(const core::identifier_string &Number)
static sort_expression MinType(const sort_expression_list &TypeList)
static bool IsNat(const core::identifier_string &Number)
static bool IsNumericType(const sort_expression &Type)
static sort_expression replace_possible_sorts(const sort_expression &Type)
static sort_expression_list GetVarTypes(variable_list VarDecls)
function_symbol difference(const sort_expression &s, const sort_expression &s0, const sort_expression &s1)
const core::identifier_string & set2bag_name()
Generate identifier Set2Bag.
const core::identifier_string & zero_function_name()
Generate identifier @zero_.
function_symbol bag2set(const sort_expression &s)
Constructor for function symbol Bag2Set.
function_symbol intersection(const sort_expression &s, const sort_expression &s0, const sort_expression &s1)
function_symbol count(const sort_expression &, const sort_expression &s0, const sort_expression &s1)
function_symbol set2bag(const sort_expression &s)
Constructor for function symbol Set2Bag.
const core::identifier_string & bag2set_name()
Generate identifier Bag2Set.
core::identifier_string const & bag_enumeration_name()
Generate identifier bag_enumeration.
function_symbol constructor(const sort_expression &s)
Constructor for function symbol @bag.
const core::identifier_string & constructor_name()
Generate identifier @bag.
function_symbol in(const sort_expression &, const sort_expression &s0, const sort_expression &s1)
function_symbol bag_enumeration(const sort_expression &s)
Constructor for function symbol bag_enumeration.
function_symbol union_(const sort_expression &s, const sort_expression &s0, const sort_expression &s1)
const core::identifier_string & count_name()
Generate identifier count.
bool is_bag(const sort_expression &e)
Recogniser for sort expression Bag(s)
container_sort bag(const sort_expression &s)
Constructor for sort expression Bag(S)
function_symbol zero_function(const sort_expression &s)
Constructor for function symbol @zero_.
function_symbol_vector bool_mCRL2_usable_mappings()
Give all system defined mappings that can be used in mCRL2 specs for bool_.
function_symbol_vector bool_mCRL2_usable_constructors()
Give all defined constructors which can be used in mCRL2 specs for bool_.
bool is_bool(const sort_expression &e)
Recogniser for sort expression Bool.
const basic_sort & bool_()
Constructor for sort expression Bool.
container_sort fbag(const sort_expression &s)
Constructor for sort expression FBag(S)
const core::identifier_string & cinsert_name()
Generate identifier @fbag_cinsert.
bool is_fbag(const sort_expression &e)
Recogniser for sort expression FBag(s)
function_symbol_vector fbag_mCRL2_usable_mappings(const sort_expression &s)
Give all system defined mappings that can be used in mCRL2 specs for fbag.
function_symbol_vector fbag_mCRL2_usable_constructors(const sort_expression &s)
Give all defined constructors which can be used in mCRL2 specs for fbag.
bool is_fset(const sort_expression &e)
Recogniser for sort expression FSet(s)
function_symbol_vector fset_mCRL2_usable_mappings(const sort_expression &s)
Give all system defined mappings that can be used in mCRL2 specs for fset.
function_symbol_vector fset_mCRL2_usable_constructors(const sort_expression &s)
Give all defined constructors which can be used in mCRL2 specs for fset.
const core::identifier_string & insert_name()
Generate identifier @fset_insert.
container_sort fset(const sort_expression &s)
Constructor for sort expression FSet(S)
function_symbol_vector int_mCRL2_usable_mappings()
Give all system defined mappings that can be used in mCRL2 specs for int_.
bool is_int(const sort_expression &e)
Recogniser for sort expression Int.
function_symbol_vector int_mCRL2_usable_constructors()
Give all defined constructors which can be used in mCRL2 specs for int_.
const function_symbol & cint()
Constructor for function symbol @cInt.
const basic_sort & int_()
Constructor for sort expression Int.
const core::identifier_string & rtail_name()
Generate identifier rtail.
const core::identifier_string & snoc_name()
Generate identifier <|.
function_symbol_vector list_mCRL2_usable_constructors(const sort_expression &s)
Give all defined constructors which can be used in mCRL2 specs for list.
const core::identifier_string & tail_name()
Generate identifier tail.
const core::identifier_string & rhead_name()
Generate identifier rhead.
const core::identifier_string & in_name()
Generate identifier in.
const core::identifier_string & head_name()
Generate identifier head.
const core::identifier_string & cons_name()
Generate identifier |>.
const core::identifier_string & concat_name()
Generate identifier ++.
function_symbol_vector list_mCRL2_usable_mappings(const sort_expression &s)
Give all system defined mappings that can be used in mCRL2 specs for list.
const core::identifier_string & element_at_name()
Generate identifier ..
function_symbol list_enumeration(const sort_expression &s)
Constructor for function symbol list_enumeration.
container_sort list(const sort_expression &s)
Constructor for sort expression List(S)
core::identifier_string const & list_enumeration_name()
Generate identifier list_enumeration.
bool is_list(const sort_expression &e)
Recogniser for sort expression List(s)
const basic_sort & machine_word()
Constructor for sort expression @word.
const function_symbol & cnat()
Constructor for function symbol @cNat.
function_symbol_vector nat_mCRL2_usable_mappings()
Give all system defined mappings that can be used in mCRL2 specs for nat.
const basic_sort & nat()
Constructor for sort expression Nat.
bool is_nat(const sort_expression &e)
Recogniser for sort expression Nat.
function_symbol_vector nat_mCRL2_usable_constructors()
Give all defined constructors which can be used in mCRL2 specs for nat.
const core::identifier_string & sqrt_name()
Generate identifier sqrt.
const function_symbol & pos2nat()
Constructor for function symbol Pos2Nat.
bool is_pos(const sort_expression &e)
Recogniser for sort expression Pos.
const function_symbol & c1()
Constructor for function symbol @c1.
function_symbol_vector pos_mCRL2_usable_constructors()
Give all defined constructors which can be used in mCRL2 specs for pos.
const basic_sort & pos()
Constructor for sort expression Pos.
function_symbol_vector pos_mCRL2_usable_mappings()
Give all system defined mappings that can be used in mCRL2 specs for pos.
const function_symbol & creal()
Constructor for function symbol @cReal.
const basic_sort & real_()
Constructor for sort expression Real.
function_symbol_vector real_mCRL2_usable_constructors()
Give all defined constructors which can be used in mCRL2 specs for real_.
bool is_real(const sort_expression &e)
Recogniser for sort expression Real.
function_symbol_vector real_mCRL2_usable_mappings()
Give all system defined mappings that can be used in mCRL2 specs for real_.
const core::identifier_string & constructor_name()
Generate identifier @set.
bool is_set(const sort_expression &e)
Recogniser for sort expression Set(s)
core::identifier_string const & set_enumeration_name()
Generate identifier set_enumeration.
const core::identifier_string & false_function_name()
Generate identifier @false_.
function_symbol set_enumeration(const sort_expression &s)
Constructor for function symbol set_enumeration.
const core::identifier_string & complement_name()
Generate identifier !.
function_symbol intersection(const sort_expression &s, const sort_expression &s0, const sort_expression &s1)
container_sort set_(const sort_expression &s)
Constructor for sort expression Set(S)
const core::identifier_string & intersection_name()
Generate identifier *.
function_symbol constructor(const sort_expression &s)
Constructor for function symbol @set.
function_symbol false_function(const sort_expression &s)
Constructor for function symbol @false_.
const core::identifier_string & union_name()
Generate identifier +.
function_symbol in(const sort_expression &, const sort_expression &s0, const sort_expression &s1)
function_symbol union_(const sort_expression &s, const sort_expression &s0, const sort_expression &s1)
const core::identifier_string & difference_name()
Generate identifier -.
function_symbol difference(const sort_expression &s, const sort_expression &s0, const sort_expression &s1)
function_symbol complement(const sort_expression &s)
Constructor for function symbol !.
Namespace for all data library functionality.
bool is_structured_sort(const atermpp::aterm &x)
Returns true if the term t is a structured sort.
function_symbol_vector function_update_mCRL2_usable_mappings(const sort_expression &s, const sort_expression &t)
Give all system defined mappings that can be used in mCRL2 specs for function_update.
function_symbol less_equal(const sort_expression &s)
Constructor for function symbol <=.
bool is_set_container(const atermpp::aterm &x)
function_symbol not_equal_to(const sort_expression &s)
Constructor for function symbol !=.
std::vector< sort_expression > sort_expression_vector
\brief vector of sort_expressions
bool is_list_container(const atermpp::aterm &x)
function_symbol less(const sort_expression &s)
Constructor for function symbol <.
bool is_where_clause(const atermpp::aterm &x)
Returns true if the term t is a where clause.
const core::identifier_string & function_update_name()
Generate identifier @func_update.
bool is_untyped_possible_sorts(const atermpp::aterm &x)
Returns true if the term t is an expression for multiple possible sorts.
bool is_untyped_sort(const atermpp::aterm &x)
Returns true if the term t is the unknown sort.
bool is_abstraction(const atermpp::aterm &x)
Returns true if the term t is an abstraction.
std::vector< data_equation > data_equation_vector
\brief vector of data_equations
bool is_untyped_identifier(const atermpp::aterm &x)
Returns true if the term t is an identifier.
bool is_set_comprehension_bi