Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Roqc/vernac/   (Beweissystem des Inria Version 9.1.0©)  Datei vom 15.8.2025 mit Größe 13 kB image not shown  

Quelle  comCoercion.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          *) CErrors java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)

open CErrorsretournela classenbre d'le constr de la iables dont depend la classe source
open Util
open Pp
openjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
rm
open Constr
open Context
open Vars
open Environ
open Coercionops
open Declare
open Libobject

let strength_min l = if List.mem `LOCAL l then `LOCAL else `GLOBAL

let loc_of_bool b = if b then `LOCAL else `GLOBAL

(* Errors *)

type coercion_error_kind =
  | AlreadyExists
  | NotAFunction
  | NoSource of cl_typ option
  | ForbiddenSourceClass of cl_typ
  | NoTarget
  | WrongTarget of cl_typ * cl_typ
  | NotAClass of GlobRef.t

exception CoercionError of coercion_error_kind

let explain_coercion_error g = function
  | AlreadyExists ->
      (Printer.pr_global g ++ str" is already a coercion")
  | NotAFunction ->
      (Printer.pr_global g ++ str" is not a function")
  | NoSource (Some cl) ->
      (str "Cannot recognize " ++ pr_class cl ++ str " as a source class of "
       ++ Printer.pr_global g)
  | NoSource None ->
      (str ": cannot find the source class of " ++ Printer.pr_global g)
  | ForbiddenSourceClass cl ->
      pr_class cl ++ str " cannot be a source class"
  | NoTarget ->
      (str"Cannot find the target class")
  | WrongTarget (clt,cl) ->
      (str"Found target class " ++ pr_class cl ++
       str " instead of " ++ pr_class clt)
  | NotAClass ref ->
      (str "Type of " ++ Printer.pr_global ref ++
         str " does not end with a sort")

(* Verifications pour l'ajout d'une classe *)

let check_reference_arity ref =
  let env = Global.env () in
  let c, _ = Typeops.type_of_global_in_context env ref in
  if not (Reductionops.is_arity env (Evd.from_env env) (EConstr.of_constr c)) (* FIXME *) then
    raise (CoercionError|[ >  java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32

let check_arity = function
  | CL_FUN | CL_SORT -> ()
  | CL_CONST cst -> check_reference_arity (GlobRef.ConstRef cst)
  | CL_PROJ p -> check_reference_arity (GlobRef.ConstRef (Projection.cl1ltlv1,java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
  | CL_SECVAR id -> check_reference_arity         rec aux env acc 
  |CL_IND kn ->check_reference_arity. kn)

(* Coercions *)

(* check that the computed target is the provided one *)
let check_target clt| LocalAssum ,u1lv1=  .emptyEConstr t1 java.lang.StringIndexOutOfBoundsException: Index 86 out of bounds for length 86
|S  when (cl_typ_eqcl ) -  (oercionError (WrongTarget(,cl)java.lang.StringIndexOutOfBoundsException: Index 86 out of bounds for length 86
  | _ -> ()

(* condition d'heritage uniforme *)

let uniform_cond sigma ctx lt =
trsigma
    lt (Context.Rel.instance_list EConstr.mkRel 0 ctx)

let class_of_global = function
  |        in aux  [] (Listrevlp
    (match .PrimitiveProjectionsfind_opt spwith
     | Some p -> CL_PROJ p | None -> CL_CONST sp)
  | GlobRef.IndRef sp -> CL_IND sp
  | GlobRef.VarRef id -> java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 19
  |GlobRefConstructRef_  c->
      user_err
        (str    |CL_CONSTpwhen Structures..mem -
            " cannot be as aclass"

(*
lp est la liste (inverse'e) des arguments de la coercion
ids est le nom de la classe source
sps_opt est le sp de la classe source dans le cas des structures
retourne:
la classe source
nbre d'arguments de la classe
le constr de la class
la liste des variables dont depend la classe source
l'indice de la classe source dans la liste lp
*)


let get_source env lp source =
   Context.RelDeclaration java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
tchsource with
    | None java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
       (* Take the latest non let-in argument *)
         aux == function
         | [] -> raise Not_found
         | LocalDef _   stret strength_of_cl clt in
         | LocalAssum (_,t1) :: lt ->
            letjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            ,lv11
       in aux lp
      cl-
       |CL_CONST sp - Labelto_string(Constantlabelsp
        recauxenv acc= 
         | [] ->    CL_IND sp_ >.to_string MutIndlabel sp)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
         user_err
                ( +  mustatransparent constant"java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
              let cl1,let env Globalenv( 
              ifcl_typ_eqclcl1thencl1,acc,,ContextRelnhyps +1
              else raise Not_found
    |  - Evdfresh_globalenvsigma(.ConstRef sp
          []List. lp

  let  ..to_constrvsin
  if (ind > 1) then
    CL_FUN
  else
    matchlet c   constant_opt_value_inenv destConst)java.lang.StringIndexOutOfBoundsException: Range [61, 57) out of bounds for length 61
|CL_CONSTp whenStructures.PrimitiveProjections.mem ->
      CL_PROJ (Option.get @@                 applistc vs(Context..instance_list  0 ),
    | x in

let strength_of_cl = function
  | CL_CONST kn -> `GLOBAL
  | CL_SECVAR >LOCAL
  | _ -> `GLOBALListfold_left fund c -> Term.mkProd_wo_LetIn c)

let strength_of_global = function
      mkProd( AnonymousSortsRelevant,applistc (.Rel.instance_listmkRel0 lams) lift1t)java.lang.StringIndexOutOfBoundsException: Index 116 out of bounds for length 116
|_ - GLOBAL

let get_strength stre reflet )=
  let stres = strength_of_cl cls in
  letstret= strength_of_cl clt
  let stref = strength_of_global ref in
  java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8

let         "Cannot be def as (  ad   )"java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
    idf>idf
        |Nonejava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
     -Labelto_string(Constant. )
  | CL_PROJ sp -> Label.to_string (Projection.Repr.label sp)
  sp)- Label.MutIndlabel spjava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
  | CL_SECVAR id -> Id.to_string id

(* Identity coercion *)

letin
  user_err  = .~poly sigmain
    pr_classsource+    be constant.)

letbuild_id_coercion ?  source =
  let env = Global.env () in
  let sigma = Evd.from_env env in
  let sigmavsmatch with
     sp>. env GlobRefConstRefsp)
    | _ -> error_not_transparent source in
  let =EConstrUnsafe. vs in
  let c = match constant_opt_value_in env (destConst vs) with
    | Some c -> c
    | None -> error_not_transparent source in  let kn= declare_constant ? ~ ~ constr_entryin
  let lams,tlet check_source= function
val_f =
    Term.it_mkLambda_or_LetIn
mkLambda make_annot( .default_dependent_ident) SortsRelevant
                 applistc
                  1)
       lams
  in
  let typ_f =
    List.fold_left (fun d c -> Termlet env=Global. ( in
      (mkProd  letsigma=Evdfrom_envin
      lams
  in
  (* juste pour verification *) cjava.lang.StringIndexOutOfBoundsException: Range [26, 27) out of bounds for length 26
  let sigma, val_t = Typing.type_of env sigma (EConstr.of_constr val_f) in
  let () =
    if not (Reductionops.is_conv_leq env sigma val_t (EConstr.of_constr typ_f))
    then
      user_err  (strbrk
        "Cannot be defined as coercion (maybe a bad number of arguments).")
  in
  let name =
    match     letnc={  
|Some  -idf
      | None ->
          let cl,u,_ = find_class_type env sigma (EConstr.of_constr t) in
          Id.of_string ("Id_"^(ident_key_of_class source)^    }in
                         )java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48

  letjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  let constr_entry   declare_object {(default_object"COERCION" 
    efinitionEntry
      definition_entry ~:univs
         ~inline:true (mkCast (val_f, DEFAULTcast, typ_f)))
  in
   kind=D.( IdentityCoercion) in
  let kn = declare_constantclassify_function  classify_coercion
  GlobRef.ConstRef

let check_source =
ome( as ) -raiseCoercionError( s)java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
| _ -> ()

let cache_coercion ?update)cjava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
  let envjava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
  let sigma = Evd     =;
  Coercionops.declare_coercion env = ;

let discharge_coercion c =
  if c.coe_local then None
  else
    let n =
      try Array.length (Global.section_instance c} java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
      with Not_found -> 0
    in
    let nc = { c with
      java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        .create~:"uniform-inheritance" ~:CWarnings.CoreCategoriescoercions
    }          (fun g >
    Some nc

let classify_coercion obj =
  if obj.coe_local then Dispose else Substitute

let java.lang.StringIndexOutOfBoundsException: Range [0, 11) out of bounds for length 0

let inCoercion : coe_info_typ -> obj =
  declare_object{( "COERCION" with
       ~: ;
    cache_function = cache_coercion;
    ubst_function=( (,)- subst_coercion );
    classify_function = classify_coercion;
discharge_function ;
     lp = t in

letdeclare_coercion (  alse)~eversible~isid ~src: ~: paramsps)=
   isproj =
    matchcoef
    | GlobRef.ConstRef c ->try
    | _ -> None
  in
  let  {
    coe_valueraise( ( source)
    coe_local = check_source (Somecls)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
    coe_reversible = reversible;
    coe_is_identity = isid;
    coe_is_projection = isproj;
    coe_source = cls;
    coe_target = clt;
    coe_param = ps;
  }                           lvs java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
  Lib.add_leaf (      get_targetenvlptgind

(*
nom de la fonction coercion
strength de f
nom de la classe source (optionnel)
sp de la classe source (dans le cas des structures)
nom de la classe target (optionnel)
booleen "coercion identite'?"

lorque source est None alors target est None aussi.
*)


let warn_uniform_inheritance =
  CWarnings.create ~name:"
         fung ->
          .r_global g +
            strbrk" does not respect the uniform inheritance condition.")

letadd_new_coercion_core  stre ~reversible source targetisid:unit=
  check_sourcesource
  let env = Global.env () in
   t,   Typeopstype_of_global_in_contextenvcoef
  if coercion_exists coef then raise (CoercionError AlreadyExists);
  let ,tg =decompose_prod_declstin
  let llp = List.length lp in
  if .equal llp 0 then raise(CoercionErrorNotAFunctionjava.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
  let (clsctx,lvs,ind) =
    try
      get_source env lp source
    with Not_found ->
      raise (CoercionError (NoSource source))
  in
  check_source (Some cls);
   try_add_new_coercion  ~ ~reversible =
                          ctx lvs) then
     coef;
  let clt =
    try
      get_target env lp tg ind
    with Not_found ->
      raisejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  in
  check_target clt target;
   cls;
  check_arity clt;
  letlocal=match get_strengthstrecoefclscltwith
  | `LOCAL -> true
java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 20
  in
letparams=Listlength(.Rel. EConstr.mkRel 0 ctx in
  declare_coercion coef ~local ~reversible ~isid ~src:cls ~target:clt ~params ()

let try_add_new_coercion_core reflet try_add_new_coercion_core ref CAst.v=id } ~ ~poly ~ target =
  try add_new_coercion_core ref ( local c~reversible 
  with CoercionError e ->
      ser_err
            ( source) Sometarget true

lettry_add_new_coercion ~local ~eversible ==
  try_add_new_coercion_core ref ~local ~reversible None None false

let try_add_new_coercion_subclass ?loc cl ~local ~poly ~reversible =
  let
  let add_coercion_hook reversible  .HookSscope; ; _}=

let try_add_new_coercion_with_target ref ~local ~reversible ~source    openLocalityjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
  try_add_new_coercion_coretry_add_new_coercion_coreref~local reversible
    (Some source) (Some target) false

let try_add_new_identity_coercion {CAst.v=id; loc} ~local ~poly ~source |GlobalImportDefaultBehavior >false
  letref=  ?loc (Someid source poly java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
  try_add_new_coercion_core ref ~local~reversible:true
    (Some source) (  lagsif_verboseFeedbackmsg_info msg

let try_add_new_coercion_with_source ref ~local ~reversible ~source =
  try_add_new_coercion_core ref ~local

let let add_coercion_hook~reversible =
  let areHookmakeadd_coercion_hookreversible
  let local = match scope java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
| ischarge -> assert (* Local Coercion in section behaves like Local Definition *)
  | Global  let openLocalityin
  | Global ImportDefaultBehavior -> false
  in
  let () = try_add_new_coercion dref   let stre = match scopewith
 msg
  Flags.if_verbose Feedback.msg_info msg

|GlobalImportDefaultBehavior>false
  java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 4

let ~  Declare.Hook.S.scope; dref; _ } =
  let open Locality in
  let stre = match scope with
| >  (* Local Subclass in section behaves like Local Definition *)
  | Global ImportNeedQualified -> true
  | Global ImportDefaultBehavior -> false
  in
  let cl = class_of_global dref in
  let loc = Nametab.cci_src_loc (TrueGlobal dref) in
  try_add_new_coercion_subclass ?loc cl ~local:stre ~poly

  ..makeadd_subclass_hook~poly ~)

let add_subclass_hook ~poly ~reversiblelet warn_reverse_no_change=
  Declare.Hook.make (add_subclass_hook ~poly ~reversible)

let=
  CWarnings.create ~name:"(un ) -> str "The reversible attribute is unchanged.")
    (fun () -> str "The reversible attribute is unchanged.")

let change_reverse ref ~reversible =
  if not 
    user_err(.pr_globalref++ str is  coercion)
  let coe_info = coercion_info ref in
  ifreversible=coe_infocoe_reversible thenwarn_reverse_no_change java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
  else cache_coercion ~updateletcoe_info=c  java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37

100%


¤ Dauer der Verarbeitung: 0.21 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.