Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file build_problem.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358openFmlibopenAlba_coretypepos=Position.ttyperange=pos*postypetype_in_context=Build_context.type_in_contexttypedescription=|Overflow|No_name|Incomplete_typeoftype_in_context|Cannot_infer_bound|Not_a_functionoftype_in_contextlist|Wrong_typeof(type_in_context*type_in_context)list|Wrong_baseoftype_in_contextlist*type_in_contextlist|Ambiguousoftype_in_contextlist|Name_violationofstring*string(* case, kind *)|Ambiguous_definition|Wrong_parameter_countofint|Wrong_parameter_nameofstring|Wrong_parameter_typeofTerm.typ*Gamma.t|Missing_inductive_type|No_inductive_type|Duplicate_inductive|Duplicate_constructor|Wrong_type_constructedofTerm.typ*Gamma.t|Negative|Nested_negativeofInductive.t*int*Gamma.t|Not_positiveofTerm.typ*Gamma.t|Not_yet_implementedofstringtypet=range*descriptionmodulePrint(P:Pretty_printer.SIG)=structmodulePP=Term_printer.Pretty(Gamma)(P)modulePPInd=Print_inductive.Make(Gamma)(P)lettype_or_types(l:'alist):P.t=matchlwith|[_]->P.wrap_words"the type"|_::_::_->P.wrap_words"one of the types"|_->assertfalse(* Illegal call! *)lettyp(holes:intlist)(tp:Term.typ)(gamma:Gamma.t):P.t=lettp=PP.printtpgammainletopenPinmatchholeswith|[]->tp|_->letholes=char'['<+>list_separated(char','<+>groupspace)(List.map(funlevel->letv=Gamma.variable_at_levellevelgammaandvtp=Gamma.type_at_levellevelgammainPP.printvgamma<+>char':'<+>char' '<+>PP.printvtpgamma)holes)<+>char']'intp<+>nest4(cut<+>string"unknown: "<+>holes)lettype_list(lst:type_in_contextlist):P.t=letopenPinnest4(list_separatedcut(List.map(fun(holes,tp,gamma)->(typholestpgamma))lst))letwrong_type(reqs:type_in_contextlist)(acts:type_in_contextlist):P.t=letopenPinwrap_words"I was expecting a term which has"<+>groupspace<+>type_or_typesreqs<+>cut<+>cut<+>type_listreqs<+>cut<+>cut<+>wrap_words"and the highlighted term has"<+>groupspace<+>type_or_typesacts<+>cut<+>cut<+>type_listacts<+>cut<+>cutletdescription(descr:description):P.t=letopenPinmatchdescrwith|Overflow->wrap_words"The number does not fit into a machine word"<+>cut|No_name->string"I cannot find this name or operator"<+>cut|Cannot_infer_bound->wrap_words"I cannot infer a type for this variable"<+>cut|Incomplete_typetp->wrap_words"I cannot infer a complete type of the expression. \
Only the incomplete type"<+>cut<+>cut<+>type_list[tp]<+>cut<+>cut<+>wrap_words"This usually happens if I cannot infer the types \
of some bound variables."<+>cut|Not_a_functionlst->assert(lst<>[]);wrap_words"I was expecting a function which can be applied to \
arguments. But the expression has"<+>groupspace<+>type_or_typeslst<+>cut<+>cut<+>type_listlst<+>cut<+>cut<+>wrap_words"which is not a function type."<+>cut|Wrong_typelst->assert(lst<>[]);letreqs,acts=List.splitlstinwrong_typereqsacts|Wrong_base(reqs,acts)->wrong_typereqsacts|Ambiguoustypes->wrap_words"This term is ambiguous. It can have the following types."<+>cut<+>cut<+>type_listtypes<+>cut<+>cut<+>wrap_words"Please give me more type information to infer a unique type."<+>cut|Name_violation(case,kind)->ifcase="Upper"thenwrap_words"This identifier must not start with an upper case letter. \
Identifiers starting with upper case letters are allowed \
only for types and type constructors. \
The highlighted identifier is a"<+>groupspace<+>stringkind<+>cutelsewrap_words"This identifier must not start with a lower case letter. \
Identifiers starting with lower case letters are allowed \
only for object variables, proofs and propositions. \
But the highlighted identifier is a"<+>groupspace<+>stringkind<+>cut|Ambiguous_definition->wrap_words"There is already a definition with the same name and \
the same signature. Remember that there can be multiple \
definitions with the same name only if they have \
different signatures."<+>cut|Wrong_parameter_countrequired->wrap_words"This inductive type is part of an inductive family. \
All members of the family must have"<+>groupspace<+>string(string_of_intrequired)<+>groupspace<+>wrap_words"parameter(s)."<+>cut|Wrong_parameter_namerequired->wrap_words"All corresponding parameters of an inductive family must \
have the same name. This parameter should have the name"<+>groupspace<+>string("\""^required^"\"")<+>cut|Wrong_parameter_type(required,gamma)->wrap_words"All corresponding parameters of an inductive family must \
have the same type. This parameter should have the type"<+>cut<+>nest4(cut<+>PP.printrequiredgamma)<+>cut|Missing_inductive_type->wrap_words"The inductive type has indices. Therefore the constructor \
has to indicate explicitly the type of the object it \
constructs with all parameters and indices. Please add a \
type annotation."<+>cut|No_inductive_type->wrap_words"This is not an allowed type of an inductive type. A legal \
type of an inductive type must have a form like"<+>cut<+>cut<+>nest4(list_separatedcut[string"Any";string"Proposition";string"Int -> Int -> Proposition"])<+>cut<+>cut<+>wrap_words"or any type which reduces to one of these forms. \
The final type must be either \"Any\" or \
\"Proposition\""<+>cut|Duplicate_inductive->wrap_words"All types of an inductive family must have different \
names."<+>cut|Duplicate_constructor->wrap_words"All constructors of an inductive type must have different \
names."<+>cut|Wrong_type_constructed(res,gamma)->wrap_words"All constructors of an inductive type must construct an \
object of the inductive type. The constructed type must have \
the form"<+>cut<+>cut<+>nest4(string"I p1 p2 ... i1 i2 ...")<+>cut<+>cut<+>wrap_words"where 'I' is the name of the inductive type, 'p1 p2 ...' \
are the parameters and 'i1 i2 ...' are the indices. However \
the constructed type has the form"<+>cut<+>cut<+>nest4(PP.printresgamma)<+>cut<+>cut|Negative->wrap_words"The constructor does not satisfy the positivity condition. \
One of its argument types is a function type which uses \
an object of some of the inductive types as an argument i.e. \
one of the inductive types appears in a negative position."<+>cut|Nested_negative(ind,iparam,gamma)->wrap_words"The constructor does not satisfy the nested positivity \
condition. One of its arguments uses an inductive type of \
this definition nested within the inductive type"<+>cut<+>nest4(cut<+>PPInd.printindgamma)<+>cut<+>cut<+>wrap_words"as the parameter <"<+>string(Inductive.parameter_nameiparamind)<+>wrap_words"> which does not satisfy the \
positivity condition."<+>cut|Not_positive(typ,gamma)->wrap_words"The constructor does not satisfy the positivity condition. \
One of its argument types uses an inductive type of the family \
in the positive position:"<+>cut<+>cut<+>nest4(PP.printtypgamma)<+>cut<+>cut<+>wrap_words"However it is not used in the correct format."<+>cut|Not_yet_implementedstr->char'<'<+>stringstr<+>char'>'<+>groupspace<+>wrap_words"is not yet implemented"letprint_with_source(src:string)((range,desc):t):P.t=letmoduleP0=Printer.Make(P)inletopenPinP0.print_error_header"TYPE"<+>P0.print_sourcesrcrange[]<+>descriptiondesc<+>cutletprint_with_source_lines(lines:stringSequence.t)((range,desc):t):P.t=letmoduleP0=Printer.Make(P)inletopenPinP0.print_error_header"TYPE"<+>P0.print_source_lineslinesrange[]<+>descriptiondesc<+>cutendletstring_of_problem(src:string)(problem:t):string=letmodulePretty_printer=Pretty_printer.Pretty(String_printer)inletmoduleError_print=Print(Pretty_printer)inString_printer.run(Pretty_printer.run07070(Error_print.print_with_sourcesrcproblem))