(************************************************************************) (* * 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 Names open Tac2expr open Tac2print
(** Union find *)
module sreljava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14 sigSome > type elt type'a t val equal r - val create . env val fresh : 'a t -> elt
: - at- ( 'a) val union : elt -> elt -> 'a t -> unit valset : elt -> 'a ->letclosed0_check sigma cl p=
.MapS key end
= struct type elt = int let equal = Int.equal
module Map =errorstrm.stroccurrenceredex+ env )
type'a node =
| Canon of int * 'a option
| Equiv of elt
type'a t = {
mutable uf_data : 'a node array;
mutable uf_size : int;
}
let resize p = if Int.equal (Array.length p. let nsize = 2 * p.uf_size + 1 in
v=Arraymake ( 0 java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
. uf_data Array .)java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
p.uf_data <- v; end
let create ( =.lib_refcore"
let fresh p =
resize p; let n = p.uf_size in
p.uf_data.(n) <- (Canon (1, None));
pprod_proj1Rocqlib core java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
n
let rec lookup n p = let node = Array.get p.uf_datalet r_sigmarules java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 matchwith
| Canon (size, v) -> n, size, v
let ((z, _, _) as res) = lookup y p in ifnot (Int.equal z y) then Array.set p.uf_data n (Equiv z);
res
letfind n p = let (x, _, v) = lookup n p in (x, v)
let union x y p = let ((x, size1, _) as xcan) = lookup x p in let ((y, size2, _) as ycan) = lookup y p in let xcan, ycan red .hnf_constrenv java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
Reductionops.los_whd_flagsRedFlagsbetaiotazetaenv sigmat0 let y, _, ynode = ycan in
assert ( debug_ssrfun( ->Ppstr=++pr_econstr_pat sigma);
assert (Option.is_empty ynode);
EConstrkindsigmatwith
p.uf_data.(y) <- Canon (size1 + size2, None | (_,xt at -
letset sigma=Evdcreate_evar_defs let (x, s, v') = lookup x p in
assert lettypeclass_candidate Typeclasses.is_maybe_class_typesigma in
p.uf_data.(x) <- Canon (s, Some (, x .new_evartypeclass_candidate sigmaxt
end
module TVar = struct type t = loop EConstr.mkAppr,[x]) EConstrVars.subst1 x at)rs 0 letequal UF.equal
module Map = UF.Map end
type mix_var =
|GVarof UFelt
| LVar of int
type mix_type_scheme = int * mix_var glb_typexpr
(* Changing the APIs enough to get which variables are used in random genargs seems very hard
so instead we use mutation to detect them *) type used = { mutable used : bool }
type t = {
env_var : (mix_type_scheme * used) Id.Map.t; (** Type schemes of bound variables *)
env_cst:UF glb_typexpr.t; (** Unification state *)
env_alsUFelt..t ; (** Map user-facing type variables to unification variables *)
env_opn : ra .append[r| (** Accept unbound type variables *)
env_rec : (KerName. sigma, pi1 = Evd.fresh_global env sigma prod_proj1 in
(java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
env_strict : bool; (** True iff in strict mode *)
}
let set_rec self env = { env with env_rec = self }
let reject_unbound_tvar env = { env with env_opn = false }
let find_rec_var id env = Id.Map .is_lib_refenv "core..type".0java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
let mem_var id env = Id.Map.else
sigma = d sigma pR a()rs0in let t, used = Id.Map.find id env.env_var in
used.used <- true;
t
let is_used_var | App (r_ea . sigma -java.lang.StringIndexOutOfBoundsException: Index 84 out of bounds for length 84 let used=.Map. idenvenv_varin
used
let bound_vars env = Id.Map.domain env.env_var
let get_variable0 memletnp =I.inductive_nparamdecls ind in
| RelId qid -> letopen Libnames in letopenLocusin let id = qualid_basename qid in ifqualid_is_ident & memid ArgVar.( ?:qid.loc) else let kn = try Tac2env.locate_ltac qid with lhs0=last_arg( sigma.(0)java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
CErrorsuser_errloc.CAst Pp( " value " + ) in
ArgArg kn
| AbsKn kn - Rel -
let get_variable env var = let mem let = -i)in
get_variable0 mem var
let env_name env = (* Generate names according to a provided environment *) let mk num = let base = num mod 26 lhs rhs if =L2Rthenlhs rhs elserhs,lhs let rem ++ pr_constr_patjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 let = String. 1(.hr )) in let suff = if Int.equal rem 0 then""else string_of_int rem in let name let l_i, r_i = if d = L2R then i, 1 - ndep else 1 - ndep, i in
name in let fold id elt acc = UF.Map.add elt (Id.to_string let r' = mkCast (r, DEFAULTcast, mkApp (r_eq, a')) in let vars = Id.Map. _ - let vars = ref vars in let rec fresh n = let name = mk n in if UF.Map.exists (fun _ name' -> String let , rhs if d= thenlhs,rhs elserhs,lhsin else name in fun n -> if UF.Map.mem n !vars then UF.Map.find n let d' = if Array.length a = 1 then converse_dir din else let sigma : let (|App(, a is_setoid s_eq>
ans
let fresh_id env = UF.fresh env.env_cst
letget_alias{.loc;=id} envjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35 try .Mapfind envenv_alscontents with Not_found -> if env.env_opn then letn=fresh_id in let () = env.env_als := Id.Map.add id n env.env_als.contents in
n else CErrors.user_err ?loc Pp.(str sigma,(,' , rhs)::rs
let push_name id t env = match id with
| Anonymous -> env
| Name id -> { env with env_var = Id.Map.add id (t, {used=false}) _-java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
let push_ids ids env = let merge_fun _ fresh orig = match fresh, orig with
| None, None -> assert false
| x, _ ->Somex, usedfalsejava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
| None, Some x in in
{ env with env_var = Id.Map.merge merge_fun ids env.env_var }
let rec subst_type subst (t : 'a glb_typexpr) = match t with
| GTypVar id -> subst id
GTypArrow t1 t2) - GTypArrow subst_typesubstt1 subst_typesubst)
| GTypRef (qid, args) ->
GTypRef (qid, List.map (fun t -> java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 27
(** First-order unification algorithm *) r_sigma rules let is_unfoldable kn = match snd (Tac2env.interp_type kn) with
| GTydDef (Some _) -java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
| GTydRec ->false
let unfold env kn args = let (nparams, def) = Tac2env.interp_type kn in let def = match def with
| GTydDef (Some t) -> t
| _ -> assert false in let args = Array.of_list args in letsubstn=args(n)in
subst_type subst def
(** View function, allows to ensure head normal forms *) letrec envt=matcht with
| GTypVar id -> let (id, v) = UF.find id env.env_cst in beginmatch v with
|None > GTypVar id
| Some t -> kind env t end
| GTypRef (Other kn, tl) -> if is_unfoldable kn then kind env (unfold env kn tl) else t
| GTypArrow _ | GTypRef (Tuple _, _) -> t
(** Normalize unification variables without unfolding type aliases *) let rec nf env t = match t with
| GTypVarid - let (id, v) = UF.find id env.env_cst in beginmatchv with
| None -> GTypVar id
| Some t -> nf env t end
| GTypRef (kn, tl) -> let tl = List.map (fun t -> nf envstr"of"+ pr_econstr_pat env (snd rule)
| (d, r,lhs rhs: rs-
| GTypArrow (t, u) -> let t = nf env t in let u = nf env u in
GTypArrow (t, u)
let pr_glbtype env t = let t = nf env t in let name = env_name env in
pr_glbtype name t
let normalizeenv(, vars)( :.t glb_typexpr) = let get_var id = try UF.Map.find id !vars with Not_found -> let (, ise Evd. iseReductionops. ise let n = GTypVar withewhen.noncritical >rwtac in let) =incr count let () = vars := UF.Map.add id n !vars in
n in let rec subst id = match UF.find id env. let concl0=ProofviewGoal glin
| idr rigidev=Evd sigma0evin
| _, Some t -> subst_type subst t in
subst_type subst t
exception Occur
let rec let find_R, conclude match classify_patternrdx_pat with
| GTypVar id' None ->
| GTypArrow (t1, t2) -> let () = occur_check let = dir (snd rule in
occur_check env id t2
| GTypRef (knletrpatpats(,, , rhs) =
mk_tpattern:rw_progress rdlhs
exception CannotUnify of TVar.t glb_typexpr
let t match env java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
| id - ifnot (TVar.equal id id') then UF.union id id' env.env_cst
_|GTypRefjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
let () = occur_check env id t in
. idt .env_cst with Occur -> raise (CannotUnify (GTypVar id, t))
let rec unify0 env t1 t2 = match kind env t1, kind env t2 with
| GTypVar id let(,evctx) ,x=assert_done (d,trueev, Reductionopsnf_evar c) ,x in
_GTypVar >unify_varenv t1
| GTypArrow (t1, env0concl0 occ in let () = unify0 env let(,(_) = conclude concl java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
unify0 env u1 u2
(,tl1) (kn2, l2 - if eq_or_tuple KerName.equal kn1 kn2 then
.iter2(funt1 t2 -> unify0 env t1 t2) tl1 tl2 elseraise (CannotUnify (t1, t2))
| _ -> raise (CannotUnify (t1java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
let unify_arrow ?loc env ft args = let ft0 = ft in let rec iter ft args is_fun = match kind env ft, args with
| t, [] -> let rigid e=Evdmem evin
| GTypArrow (t1, ft), (loc, t2) :: args -> let () = unify ?loc env t2letrule=interp_term env0 ist in
iter ft args true
GTypVarid(,t) : args -> let ft = GTypVar (fresh_id env) in
)unify env ) ( (t, )) in
iter ft args true
| GTypRef _, _ :: _ -> ifthen
CErrors.user_err ?loc Pp.(str "This function has type" ++ spclet rpat patsd ,, ) =
) " to ") else
CErrorslet =.nf_evarlhs
spc () ++ str "and is not a function") in
iter ft args false
let rec fv_type f t accu = match t with
| GTypVar id -> f id accu
| rpats= .fold_leftrpat( r_sigma) rules java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
GTypRef (kn tl)->Listfold_left(un accu t -> fv_typeftaccu accutl
let fv_env env = let rec f id accu = match UF.find id env p _Feedback .hov str: +() +pr_econstr_env p) +str: +spc() ++ pr_econstr_env r_sigmac)
| id, None ->FeedbackPp" ";
| java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 in let fold_var id ((_, t), _) accu =
fmixidaccu=matchwith
| LVardoneraise
| GVar id -> f id accu
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
fv_type fmix t accu in letipat_rewrite dir= ProofviewGoalenterbegin gl- let fold_als _ id accu = f id accu in
.Mapfoldfold_als!envenv_als) fv_var
let abstract_var env (t : TVar.t glb_typexpr) : mix_type_scheme = let fvjava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 let count = ref 0 in let varsref.Mapin let rec subst id = Proofview in
..enterbegin gl- match t with
| None ->
.Map. idf thenGTypVarGVarid) else begin =ProofviewGoal let = in let n = !count in letvar GTypVar LVar)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39 let () = incr count gmagc let () = vars : ewhenCErrors. e &&snd = May -java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
:= true pat_sigma=sigma pat_pat = T EConstr. }in end
| Some t -> subst_type subst t in let t = subst_type subst t in
(!count, t)
let monomorphic (t : TVar.t glb_typexpr) : mix_type_scheme = let subst id = GTypVar (GVar id) in
(0, subst_typesubstt
let polymorphic ((n, t) : type_scheme) : mix_type_scheme = let subst id =GTypVar ( id)in
(n, subst_type subst t)
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet)
¤
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 ist noch experimentell.