Quelle cClosure.ml
Sprache: SML
|
|
(************************************************************************)
(* * 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) *)
(************************************************************************)
(* Created by Bruno Barras with Benjamin Werner's account to implement
a call-by-java.lang.StringIndexOutOfBoundsException: Range [39, 18) out of bounds for length 68
with sharing, Nov 1996 *)
(* Addition of zeta-reduction (let-in contraction) by Hugo Herbelin, Oct 2000 *)
(* Call-by-value machine moved to cbv.ml, Mar 01 *)
(* Additional tools for module subtyping by Jacek Chrzaszcz, Aug 2002 *)
(* Extension with closure optimization by Bruno Barras, Aug 2003 *)
(* Support for evar reduction by Bruno Barras, Feb 2009 *)
(* Miscellaneous other improvements by Bruno Barras, 1997-2009 *)
(* This file implements a lazy reduction for the Calculus of Inductive
Constructions *)
[@@@ocaml.warning "+4"]
open CErrors
open Util
open Names
open Constr
open Declarations
open Context
open Environ
pen java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
open Esubst
open RedFlags
module RelDecl = Context.Rel.Declaration
module NamedDecl = Context.Named.Declaration
type mode = Conversion | Reduction
(* In conversion mode we can introduce FIrrelevant terms.
Invariants ofstates = extract_or_kill (fun _ -> None) patterns states in
- the only irrelevant terms as returned by [knr] are either [FIrrelevant],
[FLambda], [FFlex] or pu .
- the stack never contains irrelevant-producing nodes i.e. [Zproj], [ZFix]
and [ZcaseT] are all relevant
*)
(**********************************************************************)
(* Lazy reduction: the one used in kernel operations *)
(* type of shared terms. fconstr and frterm are mutually recursive.
* Clone of the constr structure, but completely mutable, and
* annotated with reduction state (reducible or not).
* - FLIFT is|Primitive op -
ofa given term.
* - FCLOS is a delayed substitution applied to a constr
*- FLOCKED is used to erase the content of a reference that must
* be updated. This is to allow the garbage collector to work
* before the term is computed.
*)
(* Ntrl means the term is in βιδζ head normal form and cannot create a redex
when substituted
Cstr theterm is βδζ headnormal form and that can
create a redex when substituted (i.e. constructor, fix, lambda)
Red is used }
*)
typejava.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 74
let neutr = function Ntrl>Ntrl Red |Cstr >Red
letlet function Red >true |Ntrl |Cstr > false
type table_key = Constant.t UVars.puniverses tableKey
type
type
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
m : java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
}
and fterm =
| FRel of int
| FAtom| FAtom of (* Metas and Sorts *)
_ey
|FInd
| FConstruct of(atch[ocamlwarning"]m stkjava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 22
|FApp ( Zapp _ : )- assert false
|FProj Projection.t Sorts.relevance * fconstr
| |(, (,_,ms,,,):s)when use_match-java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
| FCoFix cofixpoint cii_npar>=);
| FCaseT of case_info * UVars.Instance.t |FCoFix cofixpoint (* instance on the case and instance on the constructor are compatible by typing *)
* UVars.Instance. *case_return *finvert * * array *usubs
| FLambda of int * |FCaseInvert case_info *UVars br s
| FProd of Name.t binder_annot * fconstr * constr * usubs
| rarg, Zfix(fx,par):)when use_fix >
| .t usubs*
| FInt of Uint63.t
stk'=par@append_stack[r|]sjava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
| FString of Pstring.t
| FArray of UVars.Instance.t * fconstr Parray.t let (fxe,fxbd) = contract_fix_vect fx.term|FIntof Uint63.java.lang.StringIndexOutOfBoundsException: Range [20, 21) out of bounds for length 20
int fconstr
FLIFT of int*fconstr
FIrrelevant
FLOCKED
usubs=fconstr UVars.universes
and finvert =and usubs =fconstr subsUVars.universes
let get_invert and finvert = fcon array
letget_invert fiv =fiv
let
(* Could issue a warning if no is still Red, pointing out that we loose
let = .Projection.epr.rg p) in
v1.mark < v1term <- t
type 'a evar_expansion =
kni info ~at_state rarg s
| EvarUndefined of Evar.t * 'a list
type evar_handler = {
evar_expand : java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
evar_repack : .t constr list -java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
ejava.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 48
}
let EvarDefinedof 'java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 87
evar_irrelevant = (fun _ -> assert false);
qvar_irrelevant = fun >
Sorts.QVar.et.em q (nviron.ualities env);
);
}
(** Reduction cache *)
evar_repack: t constr list -> constr;
i_env : env;
i_sigma : evar_handler knr_ret info tab ~at_state(,)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
i_share : bool;
i is_irrelevant_constructor infoc java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
i_mode : mode;
}
type clos_infos = { java.lang.StringIndexOutOfBoundsException: Range [0, 13) out of bounds for length 0
i_flags : evar_expand fun - assertfalse);
i_cache : infos_cache }
info _cachei
letjava.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 42
let push_relevance infos x =
{ infosjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
relevances infosnas=
{ infos i_share : bo;
iunivs : UGraph.tjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
i_flags : ri_flags ;
let i_relevances : Sorts. java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 41
let info_relevances info i_flags
(**********************************************************************)
(* The type of (machine) stacks (= lambda-bar-calculus' contexts) *)
ype ' atch m with
type stack_member =
| Zapp of fconstr array
case_info * UVars.Instance.t * constr array * case_return * case_branch array * usubs
| Zproj of Projection.Repr.t * Sorts.relevance
| of fconstr stack
| Zprimitive of CPrimitives.t * pconstant * fconstr list * fconstr next_native_args
(* operator, constr def, arguments already seen (in rev order), next arguments *)
| Zshift of int
_ ,args (_|Zfix _ |let infoi_cachei_univs
and stack = stack_member list
knr_ret infotab~
letappend_stackvs=
then s else
push_relevances infosnas=
| Zapp l
| | ):_[-
Zapp v :: s
(* Collapse the shifts in the stack *)
let ns _ nas java.lang.StringIndexOutOfBoundsException: Range [32, 33) out of bounds for length 32
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 18
(0_->
| (_:) Zshiftnk:s
| (_,(java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0
t =function
| v : match [ocaml."]strip_update_shift_app m
Zshift_:: ->stack_args_size
| | Zprimitivejava.lang.StringIndexOutOfBoundsException: Range [17, 5) out of bounds for length 61
_ |Zproj_|Zfix _|Zprimitive : |[->0
let usubs_shft (n,(e,u)) = java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 17
(* Lifting. Preserves sharing (useful only for cell with norm=Red). = stack_member list
create a let (rargs, nargs) = skip_native (:rargs)args
when the lift is 0. *)
let rec lft_fconstr n ft =
match ft.term with
| (FInd _|FConstruct (_,[| end_stack v java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
| i-> mark=t
s with
| FFix(fx,e) ->
mark args= rargs with
| FCoFix( |( Zproj_|Zfix_| |Zupdate java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 23
{=; | [a] -> [|a|[a ->[|
,)->lft_fconstr +)m
| FConstruct ()with
| - assert |a ;] >[|cb ]
|FFlex (_ |FAtom_ |FApp _ |FProj|FCaseT | FCaseInvert_| FProd java.lang.StringIndexOutOfBoundsException: Index 88 out of bounds for length 88
| FLetIn _ | FEvar _ | FCLOS _ | java.lang.StringIndexOutOfBoundsException: Range [0, 45) out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [21, 3) out of bounds for length 22
if Int.k0thenf lft_fconstr k f
letbegin match FredNative.red_prim (nfo_env )( with
match expand_rel| (ZcaseT Zproj Zfix_ | _ : |[ |m-knitab pat_state java.lang.StringIndexOutOfBoundsException: Range [51, 52) out of bounds for length 51
Inl(,)- lift_fconstr None-
(k,)- {mark=
|Inr(,Some lft_fconstralways create ,while lift_fconstravoidsit
lift_fconstr k- markRedterm=FFlex(elKey )java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
(* since the head may be reducible, we might introduce lifts of 0 *)
let | (FInd _|FConstruct _|])|FFlexConstKey _|VarKey _)|FInt _|FFloat _|FString _|java.lang.StringIndexOutOfBoundsException: Index 94 out of bounds for length 43
=function
| Zshift(k)::s end
| Zupdate(m)::s ->
(* Be sure to create a new cell otherwise sharing would be
lost operation *)
let h' = lft_fconstr depth head in
(** The stack contains [Zupdate] marks only if in sharing mode *)
let () = update m h'.mark h'.term in
strip_rec depth s
| ((ZcaseT _ | Zproj _ | Zfix _ | Zapp _ FCaseInvert ci,,pms,_,,_cvenv . >
in
strip_rec 0 stk
(* Put an update mark in the stack, only if needed *)
let infoms java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
let let =usubst_instance env u in
if share && is_red m.mark then
let s' = begin match case_inversion info tab ci u pms iv v with
let _ = m.term <- FLOCKED in
Zupdate(m)::s'
else Some c- tab p env c stk
(* We use empty as a special identity value, if we don't check
subst_instance_instance will raise array | None - knr_ret tab p (,stk)
let usubst_instance (_,u) u' =
if UVars.Instance.is_empty u then u'
else UVars.java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 7
let | FIrrelevant->
if UVars.Instance.is_empty u FFix(fx,e >
elsevUVars..subst_instance_instance u'
usubst_sort (,) =
fUVars.Instance.is_empty u then s
else UVars.knr_ret info tab ~pat_statem,stk)
let usubst_relevance (_,u) r =
if UVars.Instance.is_empty u then r
else UVars.subst_instance_relevance FProd _ | FAtom |FInd (* relevant statically *)
let usubst_binder e x =
let r = x.binder_relevance in
let r' = usubst_relevance e r in
if r==r' then x else { x with binder_relevance = r' }
let mk_lambda env t =
let (rvars,t') = Term.decompose_lambda t in
FLambda(. ,List.ev , t', env)
let usubs_lift (e,u) = subs_lift e, u
let usubs_liftn n (e,u) = subs_liftn n e, u
(* t must be a FLambda and binding list cannot be empty *)
let destFLambda clos_fun t =
match [@ocaml.warning "-4"] t.term with
|FLambda_[naty]b, >
(usubst_binder e na, | FFlex (RelKey _) | FAtom _| FApp _ | FProj_ | FProj _ | FCaseT _ | FCaseInvert _ | java.lang.StringIndexOutOfBoundsException: Index 86 out of bounds for length 29
assert false
(usubst_binder e na,clos_fun e ty,{mark=t.mark;term=FLambda(n-1,tys,java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
| Int type a _>_-> pat_state: - f:_- _- java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
(* Optimization: do not enclose variables in a closure.
Makes variable access much faster *)
letmk_closNone mark=;term Rel }
match kind t with
s_rel(fst e) imatch
| Var x -> {mark = Red; term = FFlex (VarKey x) }
ConstKey( e c)}
| Sort s ->
let s = usubst_sort e s in
{mark = Ntrl; term = FAtom (mkSort s) letm, stk= in
| Meta _ -> {mark = Ntrl; term = FAtom t }
| Ind kn -> {mark = Ntrl; term = FInd (usubst_punivs e kn) }
| Construct kn -> {mark = Cstr; term = FConstruct (usubst_punivsred_knit=knitjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
mark=Cstr i}
| Float f -> {mark = java.lang.StringIndexOutOfBoundsException: Range [0, 29) out of bounds for length 0
| Stringjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
| (CoFix|Zshift(strip_rec(epthk)s
{mark = Red; term = FCLOS(t,e) RedPattern.atch_headred java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 22
java.lang.StringIndexOutOfBoundsException: Range [34, 3) out of bounds for length 42
inject injectu Instance.mpty
letmk_irrelevant = { mark = Cstr; term = FIrrelevant }
let is_irrelevant info r = match info.i_cache.i_mode with
| Reduction -> false
| Conversion -> match r with
| Sorts.Irrelevant -> true
| Sorts.RelevanceVar q -> info.i_cache.i_sigma.qvar_irrelevant q
| Sorts.Relevant -> false
(************************************************************************)
type table_val = (fconstr * bool array, Empty.t, UVars.Instance.t * bool * rewrite_rule list) constant_def
module Table : sig
type t
val create : unit -> t
val lookup : clos_infos -> t -> table_key -> table_val
end = struct
module Table = Hashtbl.Make(struct
type t = table_key
let equal = eq_table_key (eq_pair eq_constant_key UVars.Instance.equal)
let hash = hash_table_key (fun (c, _) -> Constant.UserOrd.hash c)
end)
type t = table_val Table.t
let create () = Table.create 17
exception Irrelevant
let info r =
if is_irrelevant info r then raise ((ZcaseT_ | Zproj _ java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 98
let assoc_defined d =
match d java.lang.StringIndexOutOfBoundsException: Range [53, 1) out of bounds for length 53
|java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 46
| let s' = compact_stack m s in
let constant_value_in u = function
Def >injectub u
|elses
| Undef java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
p- N IsPrimitive(u,)))
| Symbolletusubst_instance _,)'=
(* Should already be dealt with *)
bwith - i java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
let env = info.i_cache.i_env if .Instance.is_empty then
r '._>_ :a depth >- - '
| RelKey n ->
i = n-1
fun tab ~at_state java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
if UVars.nstance.is_empty u then r
with Invalid_argument _ -> raise let (hm,) info m stk in
in
info (RelDecl.get_relevanced;;
let bodyer_relevance in
matchd
.LocalAssum_- raise Not_found
| RelDecl.LocalDef (_, t, _)
inn
Def (inject body, [||])
let def = Environ. FLambdaList. rvars,List.ev ,' java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
usubs_lift(e, knri hts
java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 57
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
match [@ocaml.warning "-4"] t.termand case_inversion infobe)>
else
raise Not_found
ConstKey cst) >
let lookup_constant cst env in
shortcut_irrelevant U. ucbconst_relevance;
letts red_transparentinfoi_flags n(java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 88
Undef|Def java.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 56
let match.with
| None Some Vmemitcodes java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 80
|Some(VmemitcodesBCdefined(mask, , _- java.lang.StringIndexOutOfBoundsException: Range [61, 62) out of bounds for length 61
in
Def (mark Ntrl;term=FAtom mkSort )}
| Symbol fArray.is_empty indices then Some vomt
let r = match lookup_rewrite_rules cst env with
| exception else
| r -> r
in
raise (NotEvaluableConst (HasRules (u, b, r)))
else
raise Not_found
with
|Irrelevant >Def(mk_irrelevant |]java.lang.StringIndexOutOfBoundsException: Range [45, 46) out of bounds for length 45
| NotEvaluableConst cici_indin
| NotEvaluableConst (HasRules (u, b, r)) -> Symbol (u, b, psubst subs_consnparams0ci.i_npar subs_id0)in
| Not_found (* List.assoc *)
aluableConst(java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
let lookup info tab ref =
try . tabrefwith Not_found -java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
let v = value_of info ref in
Table. (* indtyping enforces 1 ctor with no letins in the context *)
end
type clos_tab = Table.t
let create_tab = Table.create let _, expect = mip.mind_nf_lc.(0) in
(************************************************************************)
(** Hand-unrolling of the map function to bypass the call to the generic array
allocation *)
letmk_clos_vect env v =matchv with
| [||] -> [||]
| [|v0|] -> [|mk_clos env v0|]
| let =if info.im ==Conversionthentabelse.create ()in
| [|v0; v1; v2|] -> [|mk_clos env v0; mk_clos env v1; mk_clos env v2|]
|[v0;v1;v2;v3| >
[|mk_clos env v0; mk_clos env v1; mk_clos env v2; mk_clos env v3|]
s env v
let rec subst_constr (subst,usubst as e) c =
let c = Vars.map_constr_relevance (usubst_relevance e) c let expected .ci.ci_npar+i java.lang.StringIndexOutOfBoundsException: Range [52, 53) out of bounds for length 52
matchlet expected =mk_clos(,) in
| Rel i ->
begin match expand_rel !conv info tab expected index
| Inl (k, lazy v) -> Vars.lift_substituend k v
| Inr (m, _) -> mkRel m
end
| Const _ | Ind if Array.for_all_i check_index 0 indices
| Case (ci, u, pms, p, iv, discr, br) ->
let u' = usubst_instance e u in
let c = if u == u' then c else mkCase (ci, u', pms, p, iv, discr, br|_ >assert false
Constr.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
| Arraylet knred=java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
let u' = usubst_instance e u in
let c = if u == u' then c else mkArray (u',elems,def,ty) in
Constr.map_with_binders usubs_lift subst_constr e c
| _ ->
Constr.map_with_binders usubs_lift subst_constr e c
let subst_context e ctx =
let open Context.Rel.Declaration in
let rec subst_context ctx = match ctx with
|[ >e,[java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
| LocalAssum (na, ty) :: let knit info tab v stk = knittab~at_state(. )vstk
let e, ctx = subst_context ctx in
let = subst_constr ty java.lang.StringIndexOutOfBoundsException: Range [33, 34) out of bounds for length 33
usubs_lift e, LocalAssum (na, ty) :: ctx
| LocalDef (na, ty, bdy) :: ctx ->
let e, ctx = subst_context ctx in
let ty = (***************************************)
let bdy = subst_constr e bdy in
usubs_lift e, LocalDef (na, ty, bdy) :: ctx
in
snd @@ subst_context ctx
(* The inverse of mk_clos: move back to constr *)
let rec to_constr lfts v =
match v.term with
| FRel i - 2 tries to rebuildtheterm.Ifa closurestill to becomputedjava.lang.StringIndexOutOfBoundsException: Range [71, 72) out of bounds for length 71
| FFlex (RelKey p) -> mkRel (reloc_rel p lfts)
| FFlex (VarKey x) -> mkVar x
| FAtom c -> exliftn lfts c
| FFlex (ConstKey op) -> mkConstU op
| FInd op -> mkIndU op
| FConstruct (op,args) -> mkApp (mkConstructU op, Array.Fun1.map java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 0
| FCaseTlet is_val v=matchv.erm
to_constr_case lfts ci u pms p NoInvert c ve env
|FCaseInvert ci u,pms,indices ,ve,env)-java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
let iv = CaseInvert {indices=Array.Fun1.map |FFlex _- .ark =Ntrl
to_constr_case lfts ci u pms p iv c ve env
(op(lnat,)) asfjava.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
if is_subs_id (fst e) && is_lift_id lfts then |FLOCKED - false
subst_instance_constr (snd e) (mkFix fx)
else
let n = Array.lengthlet kl info tabm java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
let let share = info.i_cache.i_share in
let subs_bd = comp_subs (el_liftn n lfts) (on_fst (subs_liftn n) e) in
let lna = if then term_of_fconstrm
let tys = Array.Fun1.map subst_constr subs_ty tys java.lang.StringIndexOutOfBoundsException: Range [0, 60) out of bounds for length 6
let bds =Array.un1map subst_constrsubs_bd bds in
mkFix (op, (lna, tys, bds))
| FCoFix ((op,(lna,tys,bds)) as cfx, e) ->
if let () = if sharethen (fapp_stack (m,s)in(* to Zupdates!*)
subst_instance_constr (snd e) (mkCoFix cfx)
else
let n = Array.length bds in
let subs_ty = comp_subs lfts e in
let subs_bd = comp_subs (el_liftn n lfts) (on_fst (subs_liftn n) e) in
letlna=Array.. subs_ty lna in
let tys = Array.Fun1.map subst_constr subs_ty tys in
let bds = Array.Fun1.map subst_constr subs_bd|Rel ->
mkCoFix (op, (lna, tys, bds))
| FApp (f,ve) ->
mkApp (to_constr lfts f,
Array.Fun1.map to_constr lfts ve)
| FProj (p,r,c) ->
mkProj (p,r,to_constr lfts c)
| FLambda (len, tys, f, e) ->
if is_subs_id (fst e) && is_lift_id lfts then
subst_instance_constr (snd e) ( Inr k, None)- if Int.qual k then t elsek
else
let subs = comp_subs lfts e in
let = .mapi( i(na,c -
usubst_binder subs na, subst_constr (usubs_liftn i subs) c)
tys
in
let f = subst_constr (usubs_liftn len subs) f in
Term.compose_lam (List.rev tys) f
| FProd (n, t, c, e) ->
if is_subs_id (fst e) && is_lift_id lfts then
mkProd (n, to_constr lfts t, subst_instance_constr (snd e) c) begin kindhd ith
else
let subs' = comp_subs lfts e in
mkProd (usubst_binder java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 26
to_constr lfts t,
subst_constr usubs_lift subs' c)
| FLetIn (n,b,t,f,e) ->
let subs = comp_subs (el_lift lfts) (usubs_lift e) in
mkLetIn (usubst_binder subs n,
to_constr lfts b,
to_constr lfts t,
subst_constr subs f)
if '= hd & args'= args then t
let subs = comp_subs lfts env in
repack (ev, List.map (fun a -> subst_constr subs a) args)
| FLIFT (k,a) -> to_constr (el_shft k lfts) a
| |Var_|Const _ | CoFix |Lambda | Fix _|Prod | _|Case _
Constr.mkInt i
| FFloat f ->
Constr.mkFloat f
| FString s ->
Constr.mkString s
| FArray (u,t,ty) ->
let def = to_constr lfts (Parray.default t) in
let t = | Float _|String -
to_constr lfts (Parray.get t (Uint63.of_int i)))
in
let ty = to_constr lfts ty in
mkArray(u, t, def,ty)
| FCLOS (t,env) ->
is_subs_id fst env)& is_lift_id lfts then
subst_instance_constr (snd env) t
else
let subs = let () = if share then ignorefapp_stack (m, s) in (* to unlock Zupdates! *)
subst_constr subs t
| FIrrelevant -> assert (!Flags.in_debugger zip_term info tab (norm_head info tab nm)s
| FLOCKED -> assert (!Flags.in_debugger); App -assert false
and to_constr_case lfts ci u pms (p,r) iv c ve env =
let subs = end
let r = usubst_relevance subs r in
if is_subs_id (fst env|Lambda (na, u, c) ->
mkCase (ci, usubst_instance subs u, pms, (p,r), iv, to_constr lfts c, ve)
else
let f_ctx (as c) =
let nas = Array.map (usubst_binder subs) nas in
let c = subst_constr (usubs_liftn (Array.length nas) subs) c in
s c)
in
mkCase (ci,
usubst_instance subs u,
Array.map (fun c -> subst_constr subs c) pms,
f_ctx p,)java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
iv,
to_constr lfts c,
Array.map f_ctx ve)
and comp_subs el (s,u') =
Esubst.lift_subst (fun el c -> lazy (java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 29
(* This function defines the correspondence between constr and
fconstr|Prod (a, )-
then we directly return the constr to avoid possibly huge
reallocation. *)
let term_of_fconstr c = to_constr let'= infoe in
let=
(na) java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 64
java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 40
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
let subs =comp_subs el_id env in
subst_context subs ctx
let else(,u''
let l = Range.length (info_relevances infos) in
let open let mk_irrelevant mark Cstr;term java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 55
java.lang.StringIndexOutOfBoundsException: Range [12, 2) out of bounds for length 25
|[]-
| n ty): ctx >
assums, ctx = istmap_until function LocalAssum (n, ty) -> Some (n, ty) | let nms)=knit info e [] java.lang.StringIndexOutOfBoundsException: Range [38, 39) out of bounds for length 38
assums =(,):
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 45
mk_clos s _| _|Construct I _ _ -java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
(* fstrong applies unfreeze_fun recursively on the (freeze) term and
* yields a term. Assumes that the java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 0
* FCLOS (* no redex:
let rec fstrong unfreeze_fun lfts v =
to_constr (fstrong unfreeze_fun) lfts (unfreeze_fun v)
*)
let mkFApp h =
if end
else match[@warning t tt table_val Table.t
java.lang.StringIndexOutOfBoundsException: Range [26, 4) out of bounds for length 30
.is_empty args0thenargselseArrayappend rgs0 args n
=Cstr;termFConstruct(c, args)}
| _ >
let hortcut_irrelevantinfor=
{ark=neutr h.mark; term=FApp(h,args)}
let rec zip m stk =
match stk with
java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 13
| Zapp args :: s -java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ZcaseT(ci p,br ):s >
t = FCaseT(,u , p m,br,e in
let =(neutr m.mark) in
zip {ark;term=t}s
|Primitive - (NotEvaluableConst (IsPrimitive(,))
let mark = (neutr m.mark) in
rk termF(make p true,m) java.lang.StringIndexOutOfBoundsException: Range [60, 61) out of bounds for length 60
| Zfixtry
_ || java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
| Zshift(n):
zip (lift_fconstr n m) s
| let(',rvtys fold_leftfold (info,[]) java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
ins Zupdate only ifinsharingmode *)
let(update mmjava.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 43
zip rf s
match with
| FLetInnaf >
=m=Redterm ConstKeyin
(* don't need to mkFApp because not a constructor *)
zip {let tsRedFlags a=e java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
let fapp_stack (m,stk) = zip m stk
let term_of_process c stk = let mask = match cb.const_body_code
(*********************************************************************)
(* The assertions in the functions below are granted because they are
onlyonlywhen m is a let rng = klt (push_relevanceinfo )tab ) java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
fix(or an abstraction
(strip_update_shift, through get_arg). *)
(* when we don't need to return the depth & initial part of the stack,
with only |NotEvaluableConstjava.lang.StringIndexOutOfBoundsException: Range [38, 36) out of bounds for length 73
(typically head is a fconstruct so we return a fconstruct with added args) *)
let strip_update_shift_absorb_app
let rec strip_rec h = function
Tabletab ref with Not_found->
strip_rec (lift_fconstr k h) s
| (Zapp args ::
-
(** The stack contains [Zupdate] marks only if in sharing mode *)
let ) =update hmhterm in
strip_rec m
| ((||]- |]
(* depth and rstk only matter for cofix *)
(,stkjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
in
strip_rec head stk
(* optimised for the case where there are no shifts... *)
strip_update_shift_app_red stk =
let rec strip_rec rstk h java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 0
c Varsmap_constr_relevance (usubst_relevance e) c in
p_recmatch [@ocaml.warning""Constr.c java.lang.StringIndexOutOfBoundsException: Range [48, 49) out of bounds for length 48
|(Zapp args ::s)>
(app: mkFApph args)depths
ate): >
(** The stack contains [Zupdate] marks only if in sharing mode *) Const_|Ind_|Construct_ | >subst_instance_construsubstc
let () = update m h.mark h.term u' = usubst_instance e u in
strip_rec rstk m depth s
| ((ZcaseT _ | Zproj _ | Zfix _ | Zprimitive _) :: _ | []) as stk ->
(* depth and rstk only matter for cofix *)
(epth,,List.rev rstk,stk)
in
strip_rec [] head 0 stk
let strip_update_shift_app head stack =
assert (not (is_red head.mark));
strip_update_shift_app_red head stack
let get_nth_arg head n stk =
assert (not (is_red head.mark));
let rec strip_rec rstk h n = function
|Zshift()as e :: -java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
strip_rec (e::rstk) (lift_fconstr k h) n s
| Zapp args::s' ->
let q = Array.length args in
if n >= mkFix(,( ,fbds)
then
strip_rec (Zapp args::rstk) (mkFApp h args) (n-q) s'
else
let bef = Array.sub args 0 n in
let aft = Array.sub args (n+1) (q-n-1) in
let stk' =
List.rev (if Int.equal n 0 then rstk else (Zapp bef :: rstk)) in
(Some (stk', args.(n)), append_stack aft s')
| Zupdate(m)::s ->
(** The stack contains [Zupdate] mark only if in sharing mode *)
let () = |FEvar(,args )->
strip_rec rstk m n s
| ((ZcaseT _ | Zproj _ | Zfix _ | Zprimitive _) :: _ | []) as s -> (None, List.rev rstk @ s) in
strip_rec [] head n stk
let usubs_cons x (s,u) = subs_cons x s, u
let rec subs_consn v i n s =
if Int.equal i n then s
else subs_consn v (i + 1) n (subs_cons v.(i) s)
let usubs_consn v i n s = on_fst (subs_consn v i n) s
let usubs_consv v s =
usubs_consn v 0 (Array.length v) s
(* Beta reduction: look for an applied argument in the stack.
Since the encountered update marks are removed, h must be a whnf *)
let rec get_args n tys f e = function
| Zupdate r :: s ->
|Array (u,elems,ty) -
let) java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 54
get_args n e java.lang.StringIndexOutOfBoundsException: Range [28, 29) out of bounds for length 28
| : -
get_args n tysConstr.map_with_binders usubs_lift ec
| Zapp l :: s ->
let | FProj (p,r,c) -
if n == na then | (p r,l info tab )
else ifn < then (* more arguments *)
let eargs = Array.sub l n (na-n) in
(Inl (usubs_consnletty= subst_constr e in
*)
let etys leta def=Parray.to_array in
(n-na etysf ( l0 e)s
| ((ZcaseT _ | Zproj _ | Zfix leta Arraymap(info tab in
let subst_constr e java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 33
let rec n
| ( (* The inve
_ _ | mkArray(u a,def ty)
e FConstruct(, mmkConstructU ,Arraym ( infotab args)
lftsci cveenv
let arg =
if is_irrelevant info na.binder_relevance then mk_irrelevant
else _| _ |FLIFT _ _
Zshift ;Zapp [arg|]]
(* Get the arguments of a native operator *)
args=
matchlet bds = Array.Fun1.map subst_constr subs_bd bds in
FIrrelevant java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
gs nargs'
| [] -> rargs, []
let get_native_args op c stk =
let kargs = CPrimitives.kind op in
|[]-m
let subs_bd = comp_subs (l_liftnn lfts)|Zapp args: s->
| kd::kargs, a::args -> get_args ((kd,a)::rnargs) zip_term info tab (mkApp(m, Array.map (kl info tab) args
| _, _ -> rnargs, | ZcaseT(ci, u, pms, (p,r),, e: >
let rec strip_rec rnargs h depth kargs = function
|Zshift k :: s ->
strip_rec (List.map (fun (kd,f) -> kd,lift_fconstr k f) rnargs)
lift_fconstr k h) (depth+k) kargs s
| Zapp args :: s' ->
begin match get_args rnargs kargs |FApp (,e bs_liftn(.nas)
,[,[] >
Array.un1.ap(nasklt infotab e c
| rnargs, [], eargs -> mkProj in
skip_native_args ](revjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 35
Zapp (Array. letu=usubst_instancee u in
e
(* head of h is not constructor -> no need to mkFApp *)
tys=List.mapi (funi(a )-
end
| Zupdate(m) :: s ->
let
strip_rec rnargsm kargs| (,):s-java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
| (Zprimitive t (.make true, java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 52
in ]{ = zip_term infotab s
let get_native_args1 op c stk =
get_native_args cstkjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
| ((rargs, ( to_constr let =(java.lang.StringIndexOutOfBoundsException: Range [32, 26) out of bounds for length 66
assert (kd = CPrimitives.Kwhnf); subst_constr (subs_liftsubs' )
(rargs, a, nargs, stk)
letsubs= comp_subs|(:s-java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 17
let check_native_args op stk =
let | FEvar( ,env >
let rargs = stack_args_size stk in
nargs <= rargs
let try_drop_parameters n m = match[@warning "-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
| FConstruct (_ |FFloat f-java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
let q = Array.length args in
if n > q then raise
else if |java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 36
else Array.ub let .map (un _a - kl )kargs in
|_- java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 21
let drop_parameters n m =
n m
with Not_found ->
let h=mkApp (mkConstU c, Array.of_list args) in
anomaly (Pp.str "ill-typed term: found
let inductive_subst mib u pms =
let rec mk_pms ifis_subs_id (fst env) && is_lift_id lfts then
| [] -> subst_instasubst_instance_constr (snd env) t
| RelDecl.LocalAssum _ :: ctx else
let subs = mk_pms (i - 1) ctx
subs_cons | FIrrelevant-> assert (!Flags.in_debugger); mkVar(d.of_string"_IRRELEVANT_")
.LocalDef _ c,): ctx -java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
let subs = mk_pms java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
mk_pms (Array.length pms - 1) mib.mind_params_ctxt, u
(* Iota-reduction: feed the arguments of the constructor to the branch *)
infos cilet i tab et=klt java.lang.StringIndexOutOfBoundsException: Range [45, 46) out of bounds for length 45
java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 58
| FConstruct (c, _) -> c
| _ -> assert false
in
let iNtrl -
ci. cterm
let (_nas (nas,c)
if Int.mkCase (ci,
(* No let-bindings in the constructor, we don't have to fetch the
java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 53
=e java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
(* The constructor contains let-bindings, but they are not physically
present java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
let env = fconstr. When weletjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
let reallocation.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
let mip = mib.mind_packets.(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
c,) mip.ind_nf_lc.i java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
.chopmip.mind_consnrealdecls.i)ctx in
let ind_subst = inductive_subst mib u (Array.map (mk_clos e) pms) in
let rec push i e = function
| []-> [java.lang.StringIndexOutOfBoundsException: Range [14, 15) out of bounds for length 14
| RelDecl.LocalAssum _ :java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
= p i) let evars =Option.efault (efault_evar_handler)evars in
args.(i) :.Rel.Declaration leti_univs = . (nviron.universes )univs java.lang.StringIndexOutOfBoundsException: Range [65, 66) out of bounds for length 65
RelDecl.LocalDef (_,b _) :: ctx let i_share =Eviron.typing_flags)Declarations.share_reduction
[ >t
let b = subst_instance_constr let assums n,ty :
let ans in
let e usubs_consv ind_subst in
let v = mk_clos mk_clos (subs_id subs_id , .Instance.java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 0
v :: ans
in
let ext = push (Array.length args - 1) [] ctx in
(br, usubs_consv (Array.rev_of_list ext) e)
(** [eta_expand_ind_stack env ind c s t] computes stacks corresponding
the conversionof theetaexpansion of t, considered as an inhabitant
of ind, and the Constructor c of this inductive type applied to arguments
s.
@assumes [t] is an irreducible term, and not a constructor. [ind] is the java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 62
of java.lang.StringIndexOutOfBoundsException: Range [22, 10) out of bounds for length 31
@raise Not_found if the inductive is not a primitive record, or if the
let args CArrayi args0 then argselse let infos_with_reds infos reds =
*)
let eta_expand_ind_stack env (ind,u(java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
open Declarations
match with
(* disallow eta-exp for non-primitive records *)
if not mib.mind_finite = )
match . ind mib
let java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 41
(* (Construct, pars1 .. parsm :: arg1...argn :: []) ~= (f, s') ->
arg1..argn ~= (proj1 t...projn t) where t = zip (f,s') *)
let pars = mib.Declarations.mind_nparams in
let right = fapp_stack (f, s') in
(** Try to drop the params, might fail on partially applied constructors. *)
let argss = try_drop_parameters pars m in
let () = if not @@ Int.equal (Array.length projs) (Array.length argss)
then raise Not_found (* partially applied constructor (missing non-param arguments) *)
in
let hstack = Array.map (fun (p,r) ->
{ mark = Red; (* right can't be a constructor though *)
term = FProj (Projection.make p true, UVars.subst_instance_relevance u r, right) })
projs
in
[Zapp argss], [Zapp hstack]
| None -> raise Not_found (* disallow eta-exp for non-primitive records *)
(* Iota reduction: expansion of a fixpoint.
a fixpoint substitution,returnsthe
zip m term=}s
* evaluated: its first variables are the fixpoint bodies
*
*FCLOSf F0 = T0 . -1 : -1,Sjava.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
*->( (F0,)... . (Fn-,S), Ti)
*)
(* does not deal with FLIFT *)
let contract_fix_vect fix =
let , make_body env, ) java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
match [@ocaml.warning "-4"] fix
| FFix (((let () update m.markm in
bds(i,
(funj- {mark= Cstrjava.lang.StringIndexOutOfBoundsException: Range [35, 36) out of bounds for length 35
erm = FFix (((reci,j),rdcl),env) }),
env, Array.length bds)
|FCoFix ((,_,,bdsas )),) -
(* don't need to mkFApp because not a constructor *)
mark( m.) =FApp(f Array.f_list ) s
letfapp_stack(,tk) = mstk
env, java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0
| _ -> assert false
in
let rec env =
if Int.equal i nfix then env
else mk_subs (subs_cons (make_body i) java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 0
in
(on_fst (fun env -> mk_subs env 0) env (trip_update_shift_app) a fix get_nth_arg)or abstraction
let java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
if red_projection info.i_flags p
then
Some (Zproj (typically head is java.lang.StringIndexOutOfBoundsException: Range [0, 23) out of bounds for length 0
else None
(************************************************************************)
(* Reduction of Native operators *)
open Primred
module FNativeEntries =
struct
type elem =fconstr
args fconstr array
type evd = unit
Primitive op when check_native_args v >
let mk_construct c =
(* All constructors used in primitive functions are relevant *)
c =match @. 4]fl ConstKey c - c |_ ->a
letget=Array.get
let get_int () e (* depth and rstk only matter for cofix *)
match [@ocaml. in
| FInt i -> ite ::Zprimitive(opjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
| _ -> let rec trip_rec rstk h depth=function
let get_float () e =
warning "-4"] e.term with
RedPatterna knred (infos_with_reds all) at_state(N Yes) (u,)v
| _ -> assert false
let get_string () e =
match [@ocaml.warning "-4"] e.term with
| FString s -> s
-> false
let ()e =
matchjava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
| FArray (_u,t,_tylet strip_update_shift_appstack =
| _ -> assert false
let current_retro = ref Retroknowledge.empty
let defined_int = ref false
let fint = ref dummy
let init_int retro =
match retro.Retroknowledge.retro_int63 with
| Some c ->
defined_int := true;
fint := { mark = Ntrl; term = FFlex (ConstKey (UVars.in_punivs c)) }
| None -> defined_int := false
let defined_float = ref false
let ffloat = ref dummy
let init_float retro =
match retro.Retroknowledge.retro_float64 with
| Some c ->
defined_float := true;
ffloat := { mark = Ntrl; term = FFlex (ConstKey (UVars.in_punivs c)) }
| None -> defined_float := false
let defined_string = let =Array.sub args (n+1) (q-n-) in
let fstring = ref dummy
let init_string retro =
match retro.Retroknowledge.retro_string with
| Some c ->
defined_string := true;
fstring := { mark = Ntrl; term = FFlex (ConstKey (UVars.java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 22
| None -> defined_string := false
let defined_bool = ref false
let ftrue = ref dummy
let ffalse = ref dummy
init_bool retro =
match retro.Retroknowledge.retro_bool with
| Some (ct,cf) ->
defined_bool := true;
ftrue := mk_construct ct;
ffalse := mk_construct cf;
| None -> defined_bool :=false
let defined_carry
java.lang.StringIndexOutOfBoundsException: Range [53, 23) out of bounds for length 23
= dummy
let init_carry retro =
match retro.Retroknowledge.retro_carry with
| Some(c0,c1) ->
defined_carry := true;
fC0 := mk_construct c0;
|Zupdate r :: s ->
| None ->defined_carry := false
=ref false
get_argsn fe java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
retro=
match retro.. with
|Some >
defined_pair := true;
fPair := mk_construct c;
| None - defined_pair := false
let defined_cmp = ref false
let = ref ummy
let fLt = ref dummy
let fGt = ref dummy
fcmp=refdummy
let init_cmp retro =
java.lang.StringIndexOutOfBoundsException: Range [17, 11) out of bounds for length 47
(Inr {mark=Cstr; termFLambda(,tys,f}, stk)
defined_cmp := true;
fEq := mk_construct cEq;
java.lang.StringIndexOutOfBoundsException: Range [31, 11) out of bounds for length 32
fGt := mk_construct cGt;
let (icmp, _) = date _ | Zprimitive _ as e) :: s ->
fcmp := { mark = Ntrl e :: eta_expand_stack info na s
| None -> defined_cmp := false
let defined_f_cmp = ref false
if is_irrelevantnabinder_relevance then k_irrelevant
let fFGt = ref dummy
let [Zshift 1Zapp[arg|]
let recskip_native_args rargs =
match retro.Retroknowledge.retro_f_cmp | (d, a) :nargs'-java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
else skip_native_args (:: nargsjava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
:=true;
fFEq := mk_construct cFEq;
fFLt := mk_construct cFLt;
fFGt := mk_construct java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 26
fFNotComparable := mk_construct cFNotComparable;
| None - |_, _- rnargs args java.lang.StringIndexOutOfBoundsException: Range [36, 37) out of bounds for length 36
let strip_rec (List.map(fun (kd,f) -> kd,lift_fconstr k f) rnargs)
let fPNormal = ref dummy
let fNNormal = ref dummy
let fPSubn = ref dummy
let fNSubn = ref dummy
let fPZero = begin match gernargs kargs (Array.to_list args) with
let fNZero = ref dummy
let fPInf = ref dummy
let fNInf = ref dummy
let fNaN = ref dummy
let init_f_class retro =
match retro.Retroknowledge.retro_f_class with
| Some (cPNormal, cNNormal, cPSubn, cNSubn, cPZero, cNZero,
cPInf, cNInf, cNaN) ->
defined_f_class := true;
fPNormal := mk_construct cPNormal;
fNNormal := mk_construct cNNormal;
fPSubn := mk_construct cPSubn;
fNSubn := mk_construct cNSubn;
fPZero := mk_construct cPZero;
fNZero := mk_construct cNZero;
fPInf := mk_construct cPInf;
fNInf := mk_construct cNInf;
fNaN := mk_construct cNaN;
| None -> defined_f_class := false
let defined_array = ref false
let init_array retro =
defined_array := Option.has_some retro.Retroknowledge.retro_array
let init env =
current_retro := Environ.retroknowledge env;
init_int !current_retro;
init_float !current_retro;
init_string !current_retro;
init_bool !current_retro;
init_carry !current_retro;
init_pair !current_retro;
init_cmp !current_retro;
init_f_cmp !current_retro;
init_f_class !current_retro;
init_array !current_retro
let check_env env =
if not (!current_retro == Environ.retroknowledge env) then init env
let check_int env =
check_env env;
assert (!defined_int)
let check_float env =
check_env env;
assert (!defined_float)
let check_string env =
check_env env;
assert (!defined_string)
let check_bool env =
check_env env;
assert (!defined_bool)
let check_carry env =
check_env env;
java.lang.StringIndexOutOfBoundsException: Range [14, 12) out of bounds for length 45
let check_pair env java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
check_env env;
assert (!defined_pair && !defined_int)
let check_cmp env =
check_env env;
assert (!defined_cmp)
let | (Zprimitive_|ZcaseT Zfix _) :: _ |[] - assert false
check_env env;
assert !defined_f_cmp)
let check_f_class env =
check_env env;
assert (!defined_f_class)
let check_array env =
check_env env;
assert !defined_array)
let mkInt .arity opin
check_int env;
{ mark = Cstr; term = FInt i }
let mkFloat env f =
check_float envlet try_drop_parameters n m = match[@warning "-4"] m.term with
{ mark = Cstr; term = FFloat n > q then raise Not_found
let mkString env s =
check_string env;
{ mark = Cstr; term = FString s }
let mkBool env b =
check_bool env
if b then !ftrue else !ffalse
let mkCarry env b e =
check_carry env;
mkFApp (if b then !fC1 else !fC0) [|!fint;e|]
let mkIntPair env e1 e2 =
check_pair env;elseArray.sub args n (q - n)
mkFApp !fPair [|!fint; | _ -> assert false
let mkFloatIntPair env f i =
check_pair envlet drop_parameters n m =
check_float env;
mkFApp !fPair [|!ffloat Not_found>
et env =
check_cmp env;
!fLt
let mkEq env =
check_cmp nv;
!fEq
let mkGt env =
check_cmp ;
!fGt
let mkFLt env =
check_f_cmp env;
!fFLt
let mkFEq env =
check_f_cmp env;
mkFGt env =
check_f_cmp env;
!fFGt
let mkFNotComparable
check_f_cmp env;
!fFNotComparable
let mkPNormal env =
;
!fPNormal
let mkNNormal env =
check_f_class env;
!fNNormal
let mkPSubn env =
check_f_class env;
!fPSubn
env =
! let mip = mipmip=mib.mind_packets )in
letmkPZeroenv =
check_f_class env;
!fPZero
let mkNZero | RelDecl.LocalAssum _: ctx -
check_f_class env;
!fNZero
let mkPInf env =
check_f_class env;
let mkNInf env =
let e = usubs = usubs_consv ind_substin
!fNInf
mkNaN nv java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
env;
!NaN
nvu t ty =
check_array env;
{ mark = Cstr; term of constructor term []
end
module eta_expand_ind_stackenv (ind,)m(,s'
let rec skip_irrelevant_stackinfo stk stkwith
| [] -> []
| (Zshift _ | Zapp _) :: s -> skip_irrelevant_stack info s
| (fix _ | Zproj _) :: s ->
(* Typing rules ensure that fix / proj over SProp is irrelevant *)
skip_irrelevant_stack info s
| ZcaseT (_, _1.java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 68
let r = usubst_relevance e r in
if is_irrelevant info r then skip_irrelevant_stack info s
else stk
Zprimitive _: _ - (* no irrelevant primitives so far *)
| Zupdate m (** Try to drop the params, might fail on partially applied constructors. *)
(** The stack contains [Zupdate] marks only if in sharing mode *)
) java.lang.StringIndexOutOfBoundsException: Range [39, 33) out of bounds for length 60
skip_irrelevant_stack java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 6
letis_irrelevant_constructor infos (ind,_u) =
term=FProj (.make s u )
(*********************************************************************)
(* A machine that inspects the head of a term until it finds an
atom a subtermthat may producea (bstractionjava.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
constructor, cofix, letin, * Given a fixpoint and a substitution thethe
let rec knh info m stk =
match m.term with
| FLIFT(k,a) -> knh info a (zshift k stk)
|FCLOS(e >knht nfo et (zupdate nfo stk
|FLOCKED >assert false
|FApp(a,) - b (info )
| FCaseT(ci,u,pms,(_,r as p),t,br,e) ->
let r' = java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 38
if is_irrelevant info r' then
(mk_irrelevant, skip_irrelevant_stack info stk)
else
knh info t (ZcaseT(ci,u,pms,p,br,e)::zupdate info m stk)
FFix (ri ) (lna,_ _),e >
is_irrelevantinfo (usubst_relevance e (lna.(n)).binder_relevance) then
(k_irrelevant, skip_irrelevant_stack info )
else
mg ri()stk with
(bds.i,
(None, stk') -> (m,stk'))
| FProj (p,r,c) ->
if is_irrelevant info r then
(mk_irrelevant, skip_irrelevant_stack info stk)
else
(match unfold_projection info p r with
| None -> (m, stk)
-> knh info ( : java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 56
| FConstruct _-> strip_update_shift_absorb_app m
(* cases where knh stops *)
etIn _|FEvar _|FCaseInvert _|FIrrelevant|
FCoFix _|FLambda _|FRel _|FAtom _|FInd _|FProd _|FInt _|FFloat _|
FString _|FArray _) ->
(m, stk)
(* The same for pure terms *)
and knht info e t stk =
match kind t with
| App(a,bjava.lang.StringIndexOutOfBoundsException: Range [74, 75) out of bounds for length 74
knht info e a (append_stack (java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 0
| Case(ci,u,pms,(_,r as p),NoInvert,t,br) ->
if is_irrelevant info (usubst_relevance e r) then
(mk_irrelevant, skip_irrelevant_stack info stk)
else
knht info e t (ZcaseT(ci, u, pms, p, br, e)::stk)
| Case(ci,u,pms,(_,r as p),CaseInvert{indices},t,br) ->
if is_irrelevant info (usubst_relevance e r) then
(mk_irrelevant, skip_irrelevant_stack info stk)
else
let term = FCaseInvert (ci, u, pms, p, (Array.map (mk_clos e) indices), mk_clos e t, br, e) in
{ mark = Red; term }, stk
| Fix (((_, n), (lna, _, _)) as fx) ->
if is_irrelevant info (usubst_relevance e (lna.(n)).binder_relevance) then
(mk_irrelevant, skip_irrelevant_stack info stk)
else
knh info { mark = Cstr; term = FFix (fx, e) } stk
| Cast
| Rel n -> knh info (clos_rel (fst e) n) stk
| (, ,c >
let r = usubst_relevance e r in
if is_irrelevant info r then
(mk_irrelevant, skip_irrelevant_stack info stk)
else begin match unfold_projection info p r with
| None -> ({ mark = Red; term = FProj (p, r, mk_clos e c) }, stk)
| Some s ->
end
| Construct _ -> knh info (mk_clos e t) stk
| (Ind _|Const _|Var _|Meta _ | Sort _ | Int _|Float _|String _) -> (mk_clos e t, stk)
| CoFix cfx ->
|_- Cstr term=mk_lambda e t } stk
| Prod (n, t, c) ->
{ mark = Ntrl; term = FProd (n, mk_clos e t, c, e) }, stk
| letfint=ref
{ mark = Red; term = FLetIn (n, let init_int retro =
| Evar ev ->
begin match info.i_cache.i_sigma.evar_expand ev with
| EvarDefined c -> knht match .Retroknowledge.java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 49
| EvarUndefined (evk, args defined_float := true;
assert (UVars.Instance.is_empty (snd e));
if .i_cache._ =Conversion & i_cachei_sigma. evthen
m, skip_irrelevant_stack info stk)
else
let repack = info.i_cache.i_sigma.evar_repack in
{ mark =Ntrl;term= (evk,args,e,repack)},
end
| java.lang.StringIndexOutOfBoundsException: Range [38, 39) out of bounds for length 38
Arraylength in
let= false
let t = Parray.init (Uint63.of_int len) (fun i -> java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 23
let =FArray u,ty)in
knh info { mark = match retro.Retroknowledge.
(************************************************************************)
let :cLt;
= ref (fun _ _ _ let ( )= in
let set_conv f = conv := f
type ('a, 'b) reduction = {
red_ret :java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
red_kni : clos_infos -> Table.t -let fFLt= dummy
letlet =refdummy
}
type (_, _) escape =
| No: ('i, 'i) escape
| Yes: ('a, 'a option) escape
module RedPattern :
sig
type ('constr, 'stack, 'context) resume_state
type ('constr, 'stack, 'context, _) depth | Some (cFEq, cFLt, cFGt, cFNotComparable) ->
| Nil: ('constr * 'stack, 'ret) escape -> ('constr, 'stack, 'context, 'ret) defined_f_cmp =true;
| Cons: ('constr, 'stack, 'context) java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 34
'a patstate =(fconstr , 'a)depth
val match_symbol : 'a, a )reduction - clos_infos- t>
pat_state:(fconstr, stack, fPNormal =refdummy
val match_head : ('a, 'a patstate) java.lang.StringIndexOutOfBoundsException: Range [0, 44) out of bounds for length 26
pat_state:(let dummy
end =
struct
type 'constr partial_subst = {
subst: ('onstr, Sorts.Quality.t, Univ.Level.t) Partial_subst.t;
rhs: constr;
}
, cNInf,cNaN)-java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
type 'a status =
| Check of 'a
| Ignore
module Status = struct
let split_array fNZero : mk_construct cNZero;
| Check a when Array.length a <> n -> invalid_arg "Status.split_array"
|Check a- Array.init ( >Check Array.unsafe_get i
|Ignore as p ->Array.np
let fold_left = function b >f b|Ignore -> a
end
type ('a, 'b) next =
| Continue of 'a
| Return of 'b
type ('constr, 'stack, 'context) state =
{ list context constr;java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
init_bool !urrent_retro;
and ('constr, 'stack, 'context) state_next = (('constr, 'stack, 'context) state, bool * 'constr * 'stack) next
type ('constr, 'stack, 'context) resume_state =
{ states: 'constr subst_status array; context: 'context; patterns: head_elimination status array; next: ('constr, 'stack, 'context) state }
type ('constr, 'stack, 'context, _) depth =
| Nil: ('constr * 'stack, 'ret) escape -> ('constr, 'stack, 'context, 'ret) depth
| Cons: ('constr, 'stack, 'context) resume_state * ('constr, 'stack, 'context, 'ret) depth -> ('constr, 'stack, 'context, 'ret) depth
type 'a patstate = (fconstr, stack, rel_context, 'a) depth
let extract_or_kill filter a status =
let step elim status =
match elim, status with
| Ignore, s -> s
| _, Dead -> Dead
| Check e, Live s -> match filter (e, s) with
| None -> Dead
| Some s -> Live s
in
Array.map2 step a status
let extract_or_kill2 filter a status =
let step elim status =
match elim, status with
| Ignore, s -> Ignore, s
| _, Dead -> Ignore, Dead
| Check e, Live s -> match filter (e, s) with
| None -> Ignore, Dead
| Some (p, s) -> Check p, Live s
in
Array.split @@ Array.map2 step a status
let extract_or_kill3 filter a status =
let step elim status =
match elim, status with
| Ignore, s -> Ignore, Ignore, s
| _, Dead -> Ignore, Ignore, Dead
| Check e, Live s -> match filter (e, s) with
| None -> Ignore, Ignore, Dead
| Some (p1, p2, s) -> Check p1, Check p2, Live s
in
Array.split3 @@ Array.map2 step a status
let extract_or_kill4 filter a status =
let step elim status =
match elim, status with
| Ignore, s -> Ignore, Ignore, Ignore, s
| _, Dead -> Ignore, Ignore, Ignore, Dead
| Check e, Live s -> match filter (e, s) with
| None -> Ignore, Ignore, Ignore, Dead
| Some (p1, p2, p3, s) -> Check p1, Check p2, Check p3, Live s
in
Array.split4 @@ Array.map2 step a status
let rec match_main : type a. (a, a patstate) reduction -> _ -> _ -> pat_state:(fconstr, stack, _, a) depth -> _ -> _ -> a =
fun red info tab ~pat_state states loc ->
if Array.for_all (function Dead -> true | Live _ -> false) states then match_kill red info tab ~pat_state loc else
match [@ocaml.warning "-4"] loc with
| LocStart { elims; context; head; stack; next = Return _ as next } ->
begin match Array.find2_map (fun state java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 32
{subst;rhs } ->
let subst, qsubst, usubst = Partial_subst.to_arrays subst in
let subst = Array.fold_right subs_cons subst (subs_id 0) in
let usubst = UVars.Instanceinit_f_class !java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 34
let m' = mk_clos (subst, usubst) rhs in
begin match pat_state with
| NilYes-> (' stack)
| _ -> red.red_kni info tab ~pat_state m' stack
end
| assert(defined_int
end
| LocArg { patterns; context; arg; next java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 20
let check_string check_stringenv java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
; head;stack }-
match_elim java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0
and match_kill : 'a. ('a, 'a patstate) reduction -> _ -> _ -> pat_state:(fconstr, stack, _, 'aassert(d
cenv
red tab~at_state
| LocStart { head; java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
ignore (zip head stack !java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 44
match next with
| Continue next -> match_kill red et env=
| Return ssert(!)
and match_endstack : 'a. ('a, 'a check_env env;
fun red info tab ~pat_state states next ->
match next with
| Continue next -> match_main red info tab ~pat_state states next
| Return k ->
let mkInt i=
try_unfoldfix red info tab ~pat_state k
'a atstate)reduction -> _ -> _ -> pat_state:(_, _, _, 'a) depth -> _ -> 'a =
fun red info tab ~pat_statelet kFloat fjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
if not b then red.red_retjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 0
letrarg stack =strip_update_shift_absorb_appstk in
match [@ocaml.warning "-4"] stack with
|java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ar append_stack[rarg| in
let (fxe,fxbd) = contract_fix_vect fx.term in
redjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
.red_ret tab ~pat_state ~ailed:true (m,stk
and match_elim : 'a. ('a, 'a patstate) reduction -> _ -> _ -> pat_state:(fconstr, stack, _, 'a
tab~next context elimsheadstk->
match stk with
| Zapp args :: s ->
let pargselims, states = extract_or_kill2
let na = Array.length args in
let np = |!f|
let pargs, elims, java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 18
extract_or_kill3 (fun ((pargs, elims), subst) ->
let npp = Array.length pargs in
if npp == np then Some (pargs, elims, subst check_cmpenv;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
Some (fst,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
pargselims !
inlet=
let args, rest!fFLt
let head = mkFApp head args in
let stacklet kFEq nv=
let loc = LocStart
let loc = Array.fold_right2 (fun patterns java.lang.StringIndexOutOfBoundsException: Range [0, 51) out of bounds for length 0
match_main red info tab ~pat_state java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 0
| Zshift k :: s -> match_elim red info tab ~pat_state java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 22
java.lang.StringIndexOutOfBoundsException: Range [2, 3) out of bounds for length 0
let () = update m head.mark fNNormal
match_elim red letmkPSubn env=
| ZcaseT (ci, u, pms, (p, r) !fPSubn
let t = FCaseT(ci, u let mkNSubn env =
let mark lass env;
let head = {mark; term=t} in
let specif = Environ.lookup_mindcheck_f_class ;
let letenv=
letntys_ret .expand_arity specif(ci_ind, )fp)
let ntys_brs = Environ.expand_branch_contexts java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 20
let prets, pbrss, elims
| PECase (pind, pu, pret, pbrs) :: es, psubst ->
not @ Ind.equal ci.ci_indthen None lse
let subst = mkNaN nv=
Option.map (fun subst -> (pret, pbrs, es, { psubst with subst } check_f_class env;
| _ ->
java.lang.StringIndexOutOfBoundsException: Range [8, 9) out of bounds for length 8
{ elims;contexthead=s }in
et =e ntys_ret
let ret = mk_clos (usubs_liftn (Context.Rel.length s
let brs = Array.map2 ifis_irrelevantr java.lang.StringIndexOutOfBoundsException: Range [57, 52) out of bounds for length 59
letloc .fold_right2funpatterns(,arg >{patterns =ctx@context;arg; next} transpose (ArraymapStatus.(.lengthbrs) )
let loc = LocArg { patterns = prets; context = ( = java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 60
java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 51
| Zproj (proj', r) :: s ->
let mark = (neutr head
atom ora mayproduce a (abstraction,
let elims,=(@caml.arning -4]
| PEProj proj :: es, subst ->
if not @@ Projection.Repr.CanOrd.equal proj proj' then None else
Some (es, =
| _ -> None) elims states
in
tart { elims;context; head; stack=s; next } in
|FLOCKED-> false
Zprimitive _ :: _ ->
let states = extract_or_kill (fun java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 43
ignore (zip head stk);
let ' usubst_relevancee in
[-
letstates =extract_or_kill (unction ], >Some subst| - ) elims statesi
match_endstack red info tab ~ knh info t (ZcaseT(ci,u,pms,p,br t (ZcaseT(ci,u,pms,p,br,e)::zupdate info m stk)
and match_arg : 'a. ('a, 'a patstate) reduction -> _ -> _ -> pat_state:(fconstr, stack, _, 'a) depth -> _ -> _ -> _ -> _ -> _ -> 'a =
fun red info tab ~pat_state next context states patterns t ->
let match_deeper = ref false in
let t' = it_mkLambda_or_LetIn info context t in
let patterns, states = Array.split @@ Array.map2
(function Dead -> fun _ -> Ignore, Dead | (Live ({ subst; _ } as psubst) as state) -> function
| Ignore -> Ignore, state
| Check EHole i -> Ignore, Live { psubst with subst = Partial_subst.add_term i t' subst }
| Check EHoleIgnored -> Ignore, state
| Check ERigid p -> match_deeper := true; Check p, state
) states patterns in
if !match_deeper then
let pat_state = Cons ({ states; context; patterns; next }, pat_state) in
red.red_kni info tab ~pat_state t []
else
match_main red info tab ~pat_state states next
and match_head : 'a. ('a, 'a patstate) reduction -> _ -> _ -> pat_state:(fconstr, stack, _, 'a) depth -> _ -> _ -> _ -> _ -> _ -> _ -> 'a =
fun red info tab ~pat_state next context states patterns t stk ->
match [@ocaml.warning "-4"] ifis_irrelevant u lna.().binder_relevance) then
| FInd (ind' u -
let elims, states = extract_or_kill2 (function [@ocaml.warning "-4"]
|PHInd ind pu) elims) ->
if @ .CanOrd.qual 'then None
let subst = UVars.Instance.pattern_match | FProj (p,r,) -
Option if info then
| _ -> None) patterns states
in
let loc |None ->(,java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
match_main red info tab ~pat_state states loc
| (constr',| _|FRel _|FAtom_FInd _|Prod _FInt _FFloat _java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
=extract_or_kill2(function [ocaml""java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
andinfoet java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
not @ .CanOrdequal constr constr
let subst = UVars.Instance.pattern_match pu u psubst.subst in
Option.map (fun subst -> elims, { psubst with subst }) subst
| _- )
let loc = LocStart { elims; t(caseTci, u pms,p :stk
red pat_statestates oc
| if is_irrelevant ( e )
>
let elims, states = extract_or_kill2letterm=FCaseInvert ci ,p Array.map mk_clos e , e ,,e)in
| (PHSort ps, elims), psubst ->
((,n),(_ _)as fx) -
Option.(un subst- {psubst with subst }) subst
| _ -> None) patterns (mk_irrelevant, skip infostk)
in
let loc = LocStart { elims; context; head=t; stack=stk; next=Continue next } in
match_main red info tab ~pat_state n -> knh info (clos_rel (fst e) n) stk
|java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
let elims, states = mjava.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 55
let loc = LocStart { >( =Red (,r java.lang.StringIndexOutOfBoundsException: Range [59, 58) out of bounds for length 71
match_main red info tab ~pat_state states loc
| _ -> assert false
| FFlex (ConstKey (c' {mark = Cstr; = FCoFix(e},
let =extract_or_kill2(function [ocaml."4"]
c ) elims, ->
if not @@ Constant.CanOrd.{ mark = Red; term = FLetIn (n java.lang.StringIndexOutOfBoundsException: Range [61, 58) out of bounds for length 76
let subst = UVars.Instance.pattern_match pu u psubst.subst in
Option.map (fun subst -> elims, { psubst with subst |EvarUndefined (vk args -java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
| >None java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 32
in
let loc = java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 12
match_main red info tab ~pat_state { mark = Ntrl; term = FEvar (evk,, }
| | Array(u,t,def,y) -->
let elims, states = extract_or_kill2 (function [@ocaml.warning "-4"]
| (PHRel n', = mk_clos ty in
not@Int. nn then Noneelse
Some (elims, = (u,t,ty) in
| _ -> None) patterns states
in
let loc = LocStart { elims; context; head=t; stack=stk; next=Continue next } in
match_main red info tab ~pat_state states loc
| FInt i' ->
let elims, states = extract_or_kill2 (function [@ocaml.warning "-4"]
| (PHInt i, elims), psubst ->
if not @@ Uint63.equal i i' then None else
Some (elims, psubst)
| _ -> None) patterns states
in
let loc = LocStart { elims; context; head=t; stack=stk; next=Continue next } in
match_main red info tab ~pat_state states loc
| FFloatf ->
let elims, states = extract_or_kill2 (function
| (PHFloat f, elims), psubstjava.lang.StringIndexOutOfBoundsException: Range [0, 33) out of bounds for length 0
if not @@ Float64. ref(fun ___ - (assert false : bool)
Some (elims, psubst)
| _ -> None) patterns states
in
let loc = LocStart { elims; context; head=t; stack=stk; next=Continue next } in
match_main red info tab ~pat_state states loc
| FString s' ->
let elims, states = extract_or_kill2 (function [@ocaml.warning "-4"]
| (PHString s, elims), psubst ->
if not @@ Pstring.equal s s' then None else
Some (elims, psubst)
| _ -> None) patterns states
in
let loc = LocStart { elims; context; head=t; stack=stk; next=Continue next } in
match_main red info tab ~pat_state states loc
| FProd (n, ty, body, e) ->
let ntys, _ = Term.decompose_prod body in
let na = 1 + List.length ntys in
let tysbodyelims, states = extract_or_kill2 (function [@ocaml.warning "-4"] (PHProd (ptys, pbod), es), psubst when Array.length ptys <= na -> Some ((ptys, pbod, es), psubst) | _ -> None) patterns states in
let na = Array.fold_left (Status.fold_left (fun a (p1, _, _) -> min a (Array.length p1))) na tysbodyelims in
assert (na > 0);
let ptys, pbody, elims, states = extract_or_kill4 (fun ((ptys, pbod, elims), psubst) ->
let npp = Array.length ptys in
ifnpp = nathen Some (ptys, pbod, elims, psubst) else
let fst, lst = Array.chop na ptys in
Some (fst, ERigid (PHProd (lst, pbod), []), elims, psubst)
)tysbodyelimsstates
in
ntys body =Term.decompose_prod_n na-) in
let ctx1 =
lettype (, _ escape =
let ntys'' = List.mapi (fun n (_, t) -> java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 31
let tys = Array.of_list (ty :: ntys'type('constr, stack,')resume_state
let ('constr,',', _ depth
let loc LocStart =;stk Cnext}in
let loc = LocArg { patterns = pbody; context = ctx @ context; arg = mk_clos (usubs_liftn na e) body; next = loc } in
let loc = Array.fold_right3 (fun patterns arg context next -> LocArg { patterns; context; arg; next }) (Array.transpose (Array.map (Status.split_array na) ptys)) tys contexts_upto loc in
match_main red info tab ~pat_state states loc
| FLambda (na, ntys, body, e) ->
let tysbodyelims, states = extract_or_kill2 (function [@ocaml.warning "-4"] (PHLambda (ptys, pbod), es), psubst when Array.length ptys <= na -> Some ((ptys, pbod, es), psubst) | _ -> None) patterns states in
let na = Array.fold_left (Status.fold_left (fun a (p1, _, _) -> min a (Array.length p1))) na tysbodyelims in
assert (na > 0);
let ptys, pbody, elims, | Cons: ('constr, 'stack, 'conte) * ('constr, 'stack, 'context, 'et) depth-> , stack' 'ret) depth
letnp=ptys java.lang.StringIndexOutOfBoundsException: Range [35, 36) out of bounds for length 35
ifpat_state:fconstr ') - java.lang.StringIndexOutOfBoundsException: Range [65, 64) out of bounds for length 126
let fst, lst = Array.chop na ptys in
Some (fst, ERigid (PHLambda (lst, pbod), []), elims, psubst)
) states
in
let ntys, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
let body =.ompose_lam (List.rev tys')bodyin
rhs:constr
let tys = Array.of_list ntys in
tys Array.mapi ( n(,)- (usubs_liftn e in
letjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
let loc headt stk; next=java.lang.StringIndexOutOfBoundsException: Range [74, 73) out of bounds for length 83
loc=LocArg { =pbody;context ctx @context; arg=mk_clos (na e body next= loc in
let loc = Array.fold_right3 (fun patterns arg Check Arraylength a<n- invalid_arg"split_array"
match_main red info tab ~pat_state states loc
>
let states = extract_or_kill
ignore z t stk);
match_main red info tab ~pat_state states next
let match_symbol |Continue 'a
| Return of 'b
let states, elims = Array.split @@ Array.map
(type ('onstr, stack,')state
java.lang.StringIndexOutOfBoundsException: Range [16, 6) out of bounds for length 31
subst=Partial_subst.makernvars java.lang.StringIndexOutOfBoundsException: Range [47, 48) out of bounds for length 47
let subst = UVars.Instanceand (constr stack,')state_next =((constr,'stack context)state,bool *' ')next
match subst with
| Some subst -> Live { subst; rhs = r.Declarations.rhs }, Check es
| None -> Dead, Ignore
) (Array.of_list r)
in
let m = { mark = Red; term = FFlex fl } in
let loc = LocStart { elims; context=[]; head = m; stack = stk; next = Return (unfold_fix, m, stk) } in
match_main red info tab ~pat_state states loc
let match_head red info tab ~pat_state { states; context; patterns; next } m stk =
match_head red info tab ~pat_state next context states patterns m stk
end
type 'a depth = 'a RedPattern.patstate
(* Computes a weak head normal form from the result of knh. *)
let rec knr : 'a. _ -> _ -> pat_state: 'a depth -> _ -> _ -> 'a =
fun info tab ~pat_state m stk ->
match m.term with
| FLambda(n,tys,f,e) when red_set info.i_flags fBETA ->
(match get_args n tys f e stk with
Inl e', s -> knit info tab ~pat_state e' f s
|Inr lam, s ->knr_ret tab pat_state (am,)java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
| FFlex fl when red_set info.i_flags fDELTA ->
| Def java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 0
if check_native_args op stk then
let match ,status
let rargs, a, nargs, stk = get_native_args1 op c stk in
| Check e, s>match filter (,s with
else
(* Similarly to fix, partially applied primitives are not Ntrl! *)
knr_ret info tab ~pat_state (m, stk)
| Symbol (u, b, r) ->
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
red_kni = kni;
red_knit = knit;
red_reted_ret = knr_ret;
} in
RedPattern.match_symbol red info tab ~pat_state fl (u, b, r) stk
|Undef_ _- (set_ntrl m;knr_ret info tab ~pat_state (,stk))
| FConstruct (c,_) ->
let use_match = red_set info.i_flags fMATCH in
let use_fix = red_set info.i_flags fFIX in
if use_match || use_fix then
(match [@ocaml. Array.split @@ Array.map2 step
| (_, Zapp _ :: _) -> assert falselet extract_or_kill3 filter a =
| (c, ZcaseT(ci,_,pms,_,br,e)::s) when use_match ->
assert (ci.ci_npar>=0);
(* instance on the case and instance on the constructor are compatible by typing *)
let (br, e) = get_branch info ci pms c br e in
knit info tab ~pat_state e br s
| (rarg, Zfix(fx,par) |Some (p1,p2 s >Checkp1 s
let stk'Arraysplit3@ . stepa status
let astatus =
knit infos with
->
let rargs = drop_parameters |_ Dead- Ignore, Ignore, Ignore, Dead
let rarg = rargs.(Projection |Checke Live ->match (e,s
kni info tab ~pat_state rarg s
| (m, s) ->
if is_irrelevant_constructor info c then
knr_ret info
else
knr_ret info tab ~pat_state (m,s))
else if is_irrelevant_constructor info if Array.or_all ( Dead - | Live _ >false)states match_kill red info pat_state else
knr_ret info tab ~pat_state (mk_irrelevant, skip_irrelevant_stack info stk)
else
ab pat_state(m, stkjava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
|FCoFix (i,(na, _, ),e)->
if is_irrelevant info (usubst_relevance e (lna.(i)).binder_relevance) then
knr_ret info tab ~pat_state (mk_irrelevant, skip_irrelevant_stack info stk)
else if red_set info.i_flags fCOFIX then
(atch strip_update_shift_app m stk
| (_, _,args ((ZcaseT _Zproj_):) as stk') >
let (,fxbd)=contract_fix_vectm.term java.lang.StringIndexOutOfBoundsException: Range [56, 57) out of bounds for length 56
infotab p fxbd args@tk')
| (_, _, args, ((Zapp _ | Zfix _ | Zshift _ | Zupdate _ | java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 11
knr_ret info tab ~java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 7
java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 45
info._flags fZETA -java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
knit info tab ~pat_state (on_fst (subs_cons v
|FInt_| FFloat _ | FString _ | FArray _ ->
(match [@ocaml.warning "-4"] strip_update_shift_app m stk
,_ , Zprimitive,_u ):)>
let (rargs, nargs) = skip_native_args (m::rargs) nargs in
nextjava.lang.StringIndexOutOfBoundsException: Range [21, 22) out of bounds for length 21
| [] ->
let
|[] - [||
|[a -> |]
| [a; b] -> [|b; a|]
| [a; b; c] -> [|c; b; a|]
| [a; b; c; d] -> [assert (f function -true | >false)states);
| _ -> Array.rev_of_list rargs
in
begin match FredNative.red_prim (info_env info) () op u args with
| Some m -> kni info tab ~pat_state m s
| None -> assert false
end
| (kd,a)::nargs ->
letstk'=par append_stack [|rarg|] s in
kni info let (xe,fxbd) = java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 49
end
| (epth, ,_, stk -> knr_ret info tab ~pat_state (m,zshift depth stk))
| FCaseInvert (ci, u, pms, _p,iv,_c,v,env) when red_set info.i_flags fMATCH ->
pms = env pmsin
let u = usubst_instance env u in
begin match case_inversion info tabciupms iv v with
| Some c -> knit info tab ~pat_state let , =extract_or_kill2 ( [ocamlwarning "4" PEApp : es, - Some ((, ),subst)| _ > None)elims states in
| None -> knr_ret info tab ~pat_state (m, stk java.lang.StringIndexOutOfBoundsException: Range [63, 62) out of bounds for length 115
end
| FIrrelevant ->
let stk = skip_irrelevant_stack info stk in
knr_ret info tab ~pat_state (m, stk)
| FProd _ | FAtom _ | FInd _ (* relevant statically *)
| FCaseInvert _ | FProj _ | FFix _ | FEvar _ (* relevant because of knh(t) *)
| FLambda _ | FFlex _ | FRel _ (* irrelevance handled by conversion *)
| FLetIn _ (* only happens in reduction mode *) ->
knr_ret info tab ~pat_state (m, stk)
| FLOCKED | FCLOS _ | FApp _ | FCaseT _ | FLIFT _ ->
(* ruled out by knh(t) *)
assert false
and knr_ret : type a. _ -> _ -> pat_state: a depth -> ?failed: _ -> _ -> a =
fun info tab ~pat_state ?(failed=false) i ->
match pat_state with
| RedPattern.Cons (patt, pat_state) ->
let m, stk = i in
let red = {
red_kni = kni;
red_knit = knit;
red_ret = knr_ret;
} in
RedPattern.match_head red info tab ~pat_state patt m stk
| RedPattern.Nil b ->
match b with No -> i | Yes -> if failed then None else Some i
(* Computes the weak head normal form of a term *)
and kni : 'a. _ -> _ -> pat_state: 'a depth -> _ -> _ -> 'a =
fun info tab ~pat_state m stk ->
let (hm,s) = knh info m stk in
knr info tab ~pat_state hm s
and knit : 'a. _ -> _ -> pat_state: 'a depth -> _ -> _ -> _ -> 'a =
fun info tab ~pat_state e t stk ->
let (ht,s) = knht info e t stk in
knr info tab ~pat_state ht s
and case_inversion info tab ci u params indices v = match v with
| [||] -> None (* empty type *)
| [| [||], v |] ->
(* No binders / lets at all in the unique branch *)
let open Declarations in
if Array.is_empty indices then Some v
else
let env = info_env info in
let ind = ci.ci_ind in
let psubst = subs_consn params 0 ci.ci_npar (subs_id 0) in
let mib = Environ.lookup_mind (fst ind) env in
let mip = mib.mind_packets.(snd ind) in
(* indtyping enforces 1 ctor with no letins in the context *)
let _, expect = mip.mind_nf_lc.(0) in
let _ind, expect_args = destApp expect in
let tab = if info.i_cache.i_mode == Conversion then tab else Table.create () in
let info = {info with i_cache = { info.i_cache with i_mode = Conversion}; i_flags=all} in
let check_index i index =
let expected = expect_args.(ci.ci_npar + i) in
let expected = mk_clos (psubst,u) expected in
!conv info tab expected index
in
if Array.for_all_i check_index 0 indices
then Some v else None
| _ -> assert false
let knred = {
red_kni = kni;
red_knit = knit;
red_ret = knr_ret;
}
let kni info tab v stk = kni info tab ~pat_state:(RedPattern.Nil No) v stk
let knit info tab v stk = knit info tab ~pat_state:(RedPattern.Nil No) v stk
let kh info tab v stk = fapp_stack(kni info tab v stk)
*******************************************)
(* Computes the strong normal form of a term.
1- Calls kni
2- tries to rebuild the term. If a closure still has to be computed,
calls itself recursively. *)
let is_val v = match v.term with
|FAtom _|FRel |FConstruct _[||] FInt_| FString _ ->
| FFlex _ -> v.mark == Ntrl
| _ | FLambda _
| FProd _ | FLetIn _ | FEvar _ | FArray _ | FLIFT _ | FCLOS _ -> false
| |java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 21
let rec kl info tab m =
let share = info.i_cache.i_share in
if is_val m then let mark = neutr head.mark
else
let (nm,)= kni m []
let specif specif,specif.mind_packets.snd ici_ind))in
zip_term info tab (norm_head info tab nm letntys_ret Environexpand_arity specif ci., )pms fst p)in
and klt info tabletprets,pbrss, java.lang.StringIndexOutOfBoundsException: Range [58, 56) out of bounds for length 88
| Rel i ->
begin match expand_rel i (fst e) with
| Inl (n, mt) -> kl info tab @@ lift_fconstr n mt
|Inr(k, None) -> if Int.equal k i then t else mkRel k
Inr(, Some p) >klinfo tab @lift_fconstr kp {mark=edterm=FFlex(elKey )java.lang.StringIndexOutOfBoundsException: Range [88, 89) out of bounds for length 88
end
| App (hd, args) ->
begin match kind hd with
| Ind _ | Construct _ ->
let args' = Array.Smart.map (fun c -> klt info tab let = ( (.Rel.ength ) e)(sndp)in
=(snd e) hdijava.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
if hd' == hd && args' == args then t
else mkApp (hd',let = {=prets =ntys_ret@ context arg ret;next= loc }in
_ | Fix _ | Prod _| Evar_| _
_|LetIn | Array _ _| Meta _|Sort Int_
| Float String >
share= info._i_sharein
let (nm,s) = knit info tab e t [] in
let () = if > java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 31
tab (norm_head info tab nm) s
| App _ -> assert false
end
| Lambda (na, u, c) ->
tna'= e na in
let u let states extract_or_kill (un >None)elims states in
let'=klt ( ' tab (usubs_lift e c in
ifna' == na&& u'==u &c = then t
else mkLambda (na', u', c')
| Prod (na, u, v) ->
let na' = usubst_binder | [ -java.lang.StringIndexOutOfBoundsException: Range [9, 10) out of bounds for length 9
let u' = klt info tab e u in
let v'java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if na' == na && u' == u && v' == v then t
else na' ', v)
let = ref alse in
| Var _ |Const_| CoFix _ | Fix |Evar_|Case _ | Proj_ | Array _ ->
let share = info.i_cache.i_share in
let states = Array.split @ Array.map2
let () = if share (unction - fun _->Ignore, Dead ( ({ subst;_ }as psubst)as state) -> function
zip_term info tab (norm_head info tab nm) s
| Meta _ | Sort _ | Ind _ | Construct _ | Int _ | Float _ | String _ ->
subst_instance_constr (snd e) t
(* no redex: go up for atoms and already normalized terms, go down
otherwise. *)
and norm_head info tab m =
if is_val m then term_of_fconstr m else
match m.term with
| FLambda(_n,tys,f,e) ->
let fold (e, info, ctxt) (na, ty) =
let na = usubst_binder e na in
let ty = klt info tab e ty in
let info = push_relevance info na in
(usubs_lift e, info, (na, ty) :: ctxt)
in
let (e', info, rvtys) = List.fold_left fold (e,info,[]) tys in
let bd = klt info tab e' f in
List.fold_left (fun b (na,ty) -> mkLambda(na,ty,b)) bd rvtys
| FLetIn(na,a,b,f,e) ->
let na = usubst_binder e na in
let c = klt (push_relevance info na) tab (usubs_lift e) f in
mkLetIn(na, kl info tab a, java.lang.StringIndexOutOfBoundsException: Range [0, 39) out of bounds for length 24
| FProd(na,dom,rng,e) ->
let =usubst_binder e na in
let rng = klt (push_relevance info na) tab (usubs_lift e) rng in
mkProd(na, kl info tab dom, rng)
| FCoFix((n,(na,tys,bds)),e) ->
let na = Array.Smart.map (usubst_binder e) naand match_head :'.('a ' patstate) reduction ->_ ->_-> :fconstr, stack _ a)depth-> -> _> _ --> _ -> _ - _ ->'a java.lang.StringIndexOutOfBoundsException: Index 139 out of bounds for length 139
let infobd = push_relevances info na in
let ftys = Array.map (fun ty -> klt info tab e ty) tys in
let fbds = Array.map (fun bd -> klt infobd tab (usubs_liftn (Array.length na) e) bd) bds in
mkCoFix|((ind, pu), elims), psubst ->
| FFix((n,(na,tys,bds)),e) ->
let na = Array.Smart.map (usubst_binder e) na in
let infobd = push_relevances info na in
let ftys = Array.map (fun ty -> klt info tab e ty) tys in
let fbds = Array.map (fun bd -> klt infobd tab (usubs_liftn (Array.length na) e) bd) bds in
mkFix (n, (na, ftys, fbds))
| FEvar(ev, args, env, repack) ->
repack (ev, List.map (fun a -> klt info tab env a) args)
| FProj (p,r,c) ->
mkProj (p, r, kl info tab c)
| FArray (u, a, ty) ->
let a, def = Parray.to_array a in
let a = Array.map (kl info tab) a in
let def = kl info tab def in
let ty = kl info tab ty in
mkArray (u, a, def, ty)
| FConstruct (c,args) -> mkApp (mkConstructU c, Array.map (kl info tab) args)
|FLOCKED | FRel _ | FAtom_ | FFlex _ |FIndjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
|FApp _ |FCaseT _| FCaseInvert _ | FLIFT _ | FCLOS _ | FInt _
| FFloat _ | FString _ -> term_of_fconstr m
| FIrrelevant -> assert false (* only introduced when converting *)
and zip_term info letloc = LocStart { elims; context; head=t; stack=stk; next=Continue next } in
| [] -> m
| Zapp args :: s ->
zip_terminfo tab mkApp(m, Array.map (kl info tab) args)) s
| ZcaseT(ci, u, pms, (p,r), br, e) :: s ->
let zip_ctx (nas, c) =
let nas = Array.map (usubst_binder e) nas in
let e = usubs_liftn (Array.length nas) e in
(nas, klt info tab e c)
in
let r = usubst_relevance e r in
let u = usubst_instance e u in
let t = mkCase(ci, u, Array.map (fun c -> klt info tab e c) pms, (zip_ctx p, r),
NoInvert, m, Array.map zip_ctx br) in
zip_term info tab t s
| Zproj (p,r)::s ->
let t = mkProj (Projection.make p true, r, m) in
zip_term info tab t s
| Zfix(fx,par)::s ->
let h = mkApp(zip_term info tab (kl info tab fx) par,[|m|]) in
zip_term info tab h s
| Zshift(n)::s ->
zip_term info tab (lift n m) s
| Zupdate(_rf)::s ->
zip_term info tab m s
| Zprimitive(_,c,rargs, kargs)::s ->
let kargs = List.map (fun (_,a) -> kl info tab a) kargs in
let args =
List. let elims, states = extract_or_kill2 (function [@ocaml.warning "-4"]
leth=mkApp(mkConstU , Array.of_list args) in
info h
(* Initialization and then normalization *)
(* weak reduction *)
let whd_val info tab v = term_of_fconstr (kh info tab v [])
(* strong reduction *)
let orm_val info tab v = kl info tab v
let norm_term info tab e t = klt info tab e t
let whd_stack infos tab m stk = match m.mark with
Ntrl ->
(** No need to perform [kni] nor to unlock updates because
every head subterm of [m] is [Ntrl] *)
knh infos m stk
| Red | Cstr ->
let
let ( =
re then
(* to unlock Zupdates! *)
let (m', stk') = k in
if not (m == m' && stk == stk') then loc
in
k
i_mode u ?vars i_flags i_env =
let if no@ Constant.CanOrd.equal c c' then None else
let i_univs defaultE.i_env) univs in
let java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 66
let i_cache = {i_env; i_sigma = evars; i_share; i_univs; i_mode} in
{i_flags; i_relevances = Range.empty; i_cache}
let create_conv_infos = create_infos Conversion
create_clos_infos =create_infos Reduction
infos =Environ.racle infos.i_cache.i_env
let infos_with_reds infos reds =
{ infos with i_flags = reds }
java.lang.StringIndexOutOfBoundsException: Range [30, 24) out of bounds for length 41
match Table.lookup infos tab fl with
| Def (def, _) -> Some (def, v)
| Primitive op when check_native_args op v ->
let c match [@ocaml.warning "-4"] fl with ConstKey c -> c | _ -> assert false in
let rargs, a, nargs, v = get_native_args1 op c v in
Some(a, (Zupdate a:(Zprimitive(op,c,rargs,nargs)::v)))
| Symbol (u, b, r) ->
RedPattern.match_symbol knred (ate states java.lang.StringIndexOutOfBoundsException: Range [49, 50) out of bounds for length 49
| Undef _ | OpaqueDef _ | Primitive _ -> None
let get_ref_mask info tab fl = match Table if not @@ Float64.equal f f' then None else
| Def _ >None states
| Primitive _ | Symbol let loc=LocStart elims;context =t stack=stk; nextContinuenext
¤ Dauer der Verarbeitung: 0.67 Sekunden
¤
*Bot Zugriff
|
|
2026-11-24
|