Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file arrays.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111moduleId=Dolmen.Std.Id(* Ae arrays *)(* ************************************************************************ *)moduleAe=structmoduleTff(Type:Tff_intf.S)(Ty:Dolmen.Intf.Ty.Ae_Arraywithtypet:=Type.Ty.t)(T:Dolmen.Intf.Term.Ae_Arraywithtypet:=Type.T.t)=structtype_Type.err+=|Bad_farray_arity:Dolmen.Std.Term.tType.errletparseenvs=matchswith|Type.Id{name=Simple"farray";ns=Sort}->`Ty(funastargs->matchargswith|[ty]->Ty.arrayTy.int(Type.parse_tyenvty)|[ity;vty]->Ty.array(Type.parse_tyenvity)(Type.parse_tyenvvty)|_->Type._errorenv(Astast)Bad_farray_arity)|Type.BuiltinArray_get->`Term(Base.term_app2(moduleType)envsT.select)|Type.BuiltinArray_set->`Term(Base.term_app3(moduleType)envsT.store)|_->`Not_foundendend(* Smtlib arrays *)(* ************************************************************************ *)moduleSmtlib2=struct(* Restrictions imposed by some theories on the kinds of arrays that
are allowed to occur. This tecnically brings some cross-theory
dependency, but since the restrictions are simple enough, we can
get by with simple syntactic checks on the sort declarations.
The restrictions are as follows:
- AUFLIA, QF_AUFLIA : int -> int
- AUFLIRA : int -> real & int -> (int -> real)
- QF_ABV, QF_AUFBV : bitvec _ -> bitvec _
*)typearrays=|All|Only_int_int|Only_ints_real|Only_bitvecmoduleTff(Type:Tff_intf.S)(Ty:Dolmen.Intf.Ty.Smtlib_Arraywithtypet:=Type.Ty.t)(T:Dolmen.Intf.Term.Smtlib_Arraywithtypet:=Type.T.t)=structtype_Type.err+=|Forbidden:string->Dolmen.Std.Term.tType.errletmsg=function|All->assertfalse|Only_int_int->"Only array types of the form (Array Int Int) are allowed by the logic"|Only_ints_real->"Only array types of the form (Array Int Int) or (Array Int (Array (Int Real))) \
are allowed by the logic"|Only_bitvec->"Only array types of the form (Array (_ BitVec i) (_ BitVec j)) for some i, j \
are allowed by the logic"letmk_array_tyenvarraysastsrcdst=leterror()=Type._errorenv(Astast)(Forbidden(msgarrays))inbeginmatcharrays,Ty.viewsrc,Ty.viewdstwith|All,_,_->()(* AUFLIA, QF_AUFLIA restrictions *)|Only_int_int,`Int,`Int->()|Only_int_int,_,_->error()(* AUFLIRA restriction *)|Only_ints_real,`Int,`Real->()|Only_ints_real,`Int,`Array(src',dst')->beginmatchTy.viewsrc',Ty.viewdst'with|`Int,`Real->()|_,_->error()end|Only_ints_real,_,_->error()(* QF_ABV, QF_AUFBV restrictions *)|Only_bitvec,`Bitv_,`Bitv_->()|Only_bitvec,_,_->error()end;Ty.arraysrcdstletparse~arrays_versionenvs=matchswith|Type.Id{name=Simple"Array";ns=Sort}->`Ty(Base.ty_app2_ast(moduleType)envs(mk_array_tyenvarrays))|Type.Id{name=Simple"select";ns=Term}->`Term(Base.term_app2(moduleType)envsT.select)|Type.Id{name=Simple"store";ns=Term}->`Term(Base.term_app3(moduleType)envsT.store)|_->`Not_foundendend