Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file arrays.ml
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576moduleId=Dolmen.Std.Id(* 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{Id.name="Array";ns=Id.Sort}->`Ty(Base.ty_app2_ast(moduleType)env"Array"(mk_array_tyenvarrays))|Type.Id{Id.name="select";ns=Id.Term}->`Term(Base.term_app2(moduleType)env"select"T.select)|Type.Id{Id.name="store";ns=Id.Term}->`Term(Base.term_app3(moduleType)env"select"T.store)|_->`Not_foundendend