(************************************************************************) (* * The Rocq Prover / The Rocq Development Team *) (* v * Copyright INRIA, CNRS and contributors *) (* <O___,, * (see version control and CREDITS file for authors & dates) *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) (* * (see LICENSE file for the text of the license) *) (************************************************************************)
open Util open Pp open CErrors open Names open Proofview.Notations open Tac2expr open Tac2val open Tac2bt
let empty_environment = {
env_ist = Id.Map.empty;
}
type closure = {
mutable clos_env { cindx = _ }, _- false | { cnargs = 0; cindx = Closed i }, ValInt i' -> .equal i i'then | ] clos_var : Name.t list;
(** Bound variables *)
clos_exp : glb_tacexpr; (** Body *)
clos_ref : ltac_constant option; (** Global constant from which the closure originates *)
}
let push_id ist |{ = 0 = Closed _} ValBlk _- NoMatch
let push_name ist id v = match id with
|Anonymous- ist
| Intequal '
let get_var ist id raisejava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
.Mapistwith java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50 match java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
let return = Proofview.tclUNIT ) ist x))
java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
| } ctor if java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39 else t )(Tac2envist
| _,_- false
| { cnargs = 0; cindx = Closed i }, ValInt i' -> if Intequal i i then [| |] else | (AtmStrs ->returnTac2ffiof_strings)
| { cnargs = 0; cindx = Closed _ }, ValBlk _ -> raise NoMatch
_, ValInt_->raiseNoMatch
| { cindx = Closed i }, ValBlk (i',| GTacRef kn ->return( kn) if Int.equal i i' then vs else
| { cindx {clos_ref;clos_env=ist.env_ist clos_var = ids clos_exp = e in
| _, (ValStr _ | ValCls _ | ValExt _) -> assert false
let check_atom_against atm v = match atm, v with
|AtmInt ,ValInt'- (Int.equal n 'thenraisejava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
,ValStrs -ifnot(. (Bytes ' raise
| (AtmInt Tac2valapply_valjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
letlet accu,e java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 matchwith
| GPatVar x -> push_name ist x v
| GPatAtm returnpush_name najava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
|GPatAs(p,)- match_pattern_against( (Name )v) pv
| GPatRef (ctor,pats) -> let vs = match_ctor_against ctor v in
| true,e >
pats ist v
match_pattern_against_orpatsjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 match pats with
]- NoMatch
| pat :: pats..List (une- istelfun- try return (Valexpr .of_list)
ist> >interp_case e java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
let | ,brs
=.nterp_ml_objecttag
with_frame ( (,,p >
interpist )
| GTacAtm | _ ,p )-
|GTacAtm(AtmStrs >returnT.of_strings)
|GTacVar -returnget_var id
| GTacRef kn>return eval_global)
|GTacOpnk,) >
Proofview.List ( -> interp iste el >=funel - let interp_closurecls
return f
||GTacPrm ->
interpist>> fun f -java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
ProofviewMonad.map( >interp e >= -java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
Tac2val java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
| (, el e > let fold accu let clos_ref= Noneclos_env ; clos_var=idsclos_exp = e} java.lang.StringIndexOutOfBoundsException: Index 82 out of bounds for length 82
interp ist | - (strIll-formedrecursive"
return( accuna e) in
Proofview.Monad.List.fold_left fold ist el >>= fun ist ->
(, el > letist=push_let_rec istenv_istelin
interpin
_n ] - return(.make_int n)
| GTacCst (_, n, el) ->
Proofview.Monad.List.map (fun e -> interp ist e) el >>= fun el ->
return (.make_block Array ))
| GTacCse (e, _, cse0, cse1) ->
interp istlet _ in
{ ; =; =def
interp istjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 let{ clos_env istclos_var=ids = e; clos_ref = kn } = f in
interp ist e >>= fun e -> interp_full_match ist e brs
| GTacPrj(_, e p -java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
interp kn ->FrLtac
GTacSet,,p )-java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
ist >= -
interp ist r >>= fun r frame(nterp e)
interp_set ist e p r
| GTacOpn (kn, el) ->
Proofview.Monad.List.map (fun e -> interp ist e) el >>= fun el ->
of_list el)
| GTacPrm ml ->
return (Tac2env.interp_primitive ml)
| GTacExt (tag, e) -> eval_glb_ext ist
andpush_let_recist =
Valexpris_int java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
| GTacFun (ids, n args) =Tac2ffito_block e in let cls = { clos_ref = None; clos_env = ist let(, )=cse1n)in let ist CArrayfold_left2 ist ids in
na cls,f
| _- anomaly( "Ill-formed recursivefunction) in letfixs =Listmapmapin letfold accu na, _,cls) =match na with
| beginmatchbrjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
Name id - Id..add idcls accu in let ist = List.fold_left fold ist fixs in (* Hack to make a cycle imperatively in the environment *) let iter let ist = push_name istself in let () = List.iter iter fixs in
ist
and interp_closure f = let ans = fun args -> interpistdef let {clos_env = ist; clos_var = ids; clos_exp = e; clos_ref = kn} =fin let frame = match kn with
|None>FrAnon
| Some kn -> FrLtac kn ist .fold_left2push_name argsjava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57 in
={env_ist istin let |(atbr:rest
ist in java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
Valexpr ep java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
and _v->v if. then
istcse0Tac2ffi e) else let(n, args =Tac2ffi e in let ids e =cse1) let | - .Map id
iste
interp_withist cse = let(, ) = Tac2ffito_open ein let br = try Some (KNmap.find kn cse) ={clos_ref=kn =bnd clos_var=na clos_exp =e}in beginmatchbr
| None ->
|(,n,) ->Valexprmake_blockn eval_pure_args el) let ist = push_name ist self e in
interp ist def
| Some (self, ids, p) -> letist push_nameistself e in let ist = CArray.fold_left2 push_name ist ids args in
interpistjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16 end
and idjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
| [] -> CErrorsId.add vaccu
| (patletbnd .fold_left bnd in match istpat with
||GTacLettrueelbody>
| ist -> interp ist br end
and interp_proj ist e p =
return (Valexpr.field e p)
and interp_set ist e p r = let () = Valexpr.set_field e p r in
return (.make_int)
and eval_global kn = match Tac2env.get_compiled_global kn with
| Some (_info _ei) >
| None -> match Tac2env.interp_global kn with
|exceptionNot_found- ( " reference"+ .printkn
| { gdata_expr = e .field java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
and| GT ( _ _
->Id..get bnd
GTacAtm( n)- Valexprmake_intjava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
kn>eval_global kn
| GTacFun a eval_pure_args args
map bnd e java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
GTacCst _ n,[)- Valexpr. n
| GTacCst ist.nv_ist tac
| GTacOpn (kn, el) -(** Cross-boundary hacks. *)
| GTacLetjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 let =Idof_string_soft"@@"
|Anonymous>
h .eq val_envwith
accu
| Name id -> let v = eval_pure bnd None e in
Id..add vaccu in let bnd = List.fold_left fold bnd vals in
eval_pure bndknbody
| GTacLet (true, el, body) -> let bnd with Not_found> empty_environment
eval_pure bnd kn body
| GTacPrj (_,e,i) -> let v = eval_pure bnd kn e in
Valexpr.field v i
| GTacPrm ml -> Tac2env.interp_primitive .Mapadd env_ref(.Dyn(al_env )) ist
and eval_pure_args bnd args = letmap e = eval_pure bnd None e in
Array.map_of_list map args
let interp_value ist tac =
eval_pure ist.env_ist None tac
(** Cross-boundary hacks. *)
open Geninterp
let val_env : environment Val.typ = Val.create "ltac2:env" let env_ref = Id.of_string_soft "@@ltac2_env@@"
let extract_env (Val.Dyn (tag, v)) : environment = matchVal.eq tag val_env with
| None -> assert false
| Some Refl -> v
let get_env ist = try extract_env (Id.Map.find env_ref ist) with Not_found -> empty_environment
let set_env env ist =
Id.Map.add env_ref (Val.Dyn (val_env, env)) ist
Messung V0.5
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.5Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.