1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586openGospelmoduleIdent=Identifier.Identtypexpost=Ttypes.xsymbol*Tterm.patternoption*Tterm.termtypenew_state_formulae={model:Ident.t;(* the name of the model's field *)description:Tterm.term;(* the new value for the model's field *)}typeterm=int*Tterm.term(* XXX TODO decide whether we need checks here (if checks is false, state does
not change) *)typenext_state={(* description of the new values are stored with the index of the
postcondition they come from *)formulae:(int*new_state_formulae)list;modifies:(Ident.t*Ppxlib.Location.t)list;}typepostcond={normal:termlist;exceptional:xpostlist;checks:Tterm.termlist;}typevalue={id:Ident.t;ty:Ppxlib.core_type;inst:(string*Ppxlib.core_type)list;sut_var:Ident.t;args:(Ppxlib.core_type*Ident.toption)list;(* arguments of unit types can be nameless *)ret:Ident.tlist;next_state:next_state;precond:Tterm.termlist;postcond:postcond;}typeinit_state={arguments:(Tast.lb_arg*Ppxlib.expression)list;returned_sut:Ident.t;descriptions:new_state_formulaelist;}letget_return_typevalue=letopenPpxlibinletrecauxty=matchty.ptyp_descwithPtyp_arrow(_,_,r)->auxr|_->tyinauxvalue.tyletvalueidtyinstsut_varargsretnext_stateprecondpostcond={id;ty;inst;sut_var;args;ret;next_state;precond;postcond}typet={state:(Ident.t*Ppxlib.core_type)list;init_state:init_state;ghost_functions:Tast.function_list;values:valuelist;}letpp_stateppfstate=letopenFmtinletpp_modelppf(id,ty)=pfppf"@[%a: %a@]"Ident.ppidPpxlib_ast.Pprintast.core_typetyinpfppf"@[%a@]@."(list~sep:(any"; ")pp_model)stateletpp_instppfinst=letopenFmtinletpp_bindingppf(v,t)=pfppf"%a/%a"stringvPpxlib_ast.Pprintast.core_typetinpfppf"[%a]"(list~sep:(any", ")pp_binding)instletpp_valueppfv=letopenFmtinpfppf"id = %a; ty = %a; inst = %a@."Ident.ppv.idPpxlib_ast.Pprintast.core_typev.typp_instv.instletppppft=letopenFmtinpfppf"@[state = %a@]@[values = %a@]@."pp_statet.state(listpp_value)t.values