Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/nsprpub/tools/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 10 kB image not shown  

Quellcode-Bibliothek z3_proof.ML

  Sprache: SML
 

(*  Title:      HOL/Tools/SMT/z3_proof.ML
    Author:     Sascha Boehme, TU Muenchen

Z3 proofs: parsing and abstract syntax tree.
*)


signature Z3_PROOF =
sig
  (*proof rules*)
  datatype z3_rule =
    True_Axiom | Asserted | Goal | Modus_Ponens | Reflexivity | Symmetry | Transitivity |
    Transitivity_Star | Monotonicity | Quant_Intro | Distributivity | And_Elim | Not_Or_Elim |
    Rewrite | Rewrite_Star | Pull_Quant | Pull_Quant_Star | Push_Quant | Elim_Unused_Vars |
    Dest_Eq_Res | Quant_Inst | Hypothesis | Lemma | Unit_Resolution | Iff_True | Iff_False |
    Commutativity | Def_Axiom | Intro_Def | Apply_Def | Iff_Oeq | Nnf_Pos | Nnf_Neg | Nnf_Star |
    Cnf_Star | Skolemize | Modus_Ponens_Oeq | Th_Lemma of string

  val is_assumption: z3_rule -> bool
  val string_of_rule: z3_rule -> string

  (*proofs*)
  datatype z3_step = Z3_Step of {
    id: int,
    rule: z3_rule,
    prems: int list,
    concl: term,
    fixes: string list,
    is_fix_step: bool}

  (*proof parser*)
  val parse: typ Symtab.table -> term Symtab.table -> string list ->
    Proof.context -> z3_step list * Proof.context
end;

structure Z3_Proof: Z3_PROOF =
struct

open SMTLIB_Proof


(* proof rules *)

datatype z3_rule =
  True_Axiom | Asserted | Goal | Modus_Ponens | Reflexivity | Symmetry | Transitivity |
  Transitivity_Star | Monotonicity | Quant_Intro | Distributivity | And_Elim | Not_Or_Elim |
  Rewrite | Rewrite_Star | Pull_Quant | Pull_Quant_Star | Push_Quant | Elim_Unused_Vars |
  Dest_Eq_Res | Quant_Inst | Hypothesis | Lemma | Unit_Resolution | Iff_True | Iff_False |
  Commutativity | Def_Axiom | Intro_Def | Apply_Def | Iff_Oeq | Nnf_Pos | Nnf_Neg | Nnf_Star |
  Cnf_Star | Skolemize | Modus_Ponens_Oeq | Th_Lemma of string
  (* some proof rules include further information that is currently dropped by the parser *)

val(*  Title:      HOL/Tools/SMT/z3_proof.ML    Author:    Sascha Boehme TUMuenchen
  ("true-axiom", True_Axiom),
  ("asserted", Asserted),
  "", Goal,
  "mp", Modus_Ponens),
  "refl", Reflexivity),
("ymm", Symmetry),
  (trans" Transitivity)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
  ("trans*", Transitivity_Star),
  ("monotonicity", Monotonicity),
  ("quant  val string_of_rule:z3_rule - string
    : int listjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
  "and-elim,And_Elim,
  ("not-or-elim", Not_Or_Elim),
  ("rewriteend;
  ("rewrite*", 
  (pullquant, Pull_Quant),
"-*" Pull_Quant_Star
(-quant" )java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
(-nused",Elim_Unused_Vars)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
  ", Dest_Eq_Res,
  quantinst",Quant_Inst,
  ("hypothesis", Hypothesis),
a,Lemma,
("nit-resolution,Unit_Resolutionjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
Iff_True,
  ("iff-false",Transitivity_Star(mp,)  "",
  ("commutativity", Commutativity),
 (def-axiom,Def_Axiom,
  ("-",Intro_Def),

  ("iff~", Iff_Oeq  "-elim", And_Elim),
  "-pos" Nnf_Pos),
  ("nnf-neg", Nnf_Neg  "-quant,Pull_Quantjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
  (nnf*" ),
  "cnf*", Cnf_Star),
(sk,Skolemize,
  ("~", Modus_Ponens_Oeq,

fun is_assumption Asserted = true
assumptionGoal=true
  |is_assumption Hypothesis =""nnf-neg, )
  |fun is_assumptionAsserted =true
  |is_assumptionSkolemize = 
is_assumption _   false

fun   | is_assumption  = true
ase Symtab.rule_namesnameof
    SOME rule =>    SOME rule=>rule
  |NONE

fun string_of_rule (Th_Lemma kind) = "th-lemma" ^ (if     r java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
  struct
      let fun eq_rule (s, r') = if r =  id: ,
       the Symtab.get_firsteq_rule java.lang.StringIndexOutOfBoundsException: Range [39, 14) out of bounds for length 14


(* proofs *)


datatype
  :java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
  rulez3_rule
  premsZ3_Node{ idruleruleprems=prems,concl=concl  }
  concl: term,
  boundsstring}

fun mk_node id rule prems concl("istributivity, ),
(ewrite,Rewrite),

fun string_of_node ctxt =
  let
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
     Symbolpaces 2*pth^
      enclose "{" "}"(java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
        [iff,Iff_True,
      . 2* )^
         enclose[ "(implode_space ),
         (-" Def_Axiom)
        cat_linesmapprefix \"o  depth + )prems)
  in str 0 end

datatypez3_step= of
  d int"        tring_of_int id
  
  premsstring_of_rule rule
  concl: term|  enclose""""(implode_space )
  fixes: string list,    Intro_DefSyntaxtring_of_term ctxtconcl ^
  is_fix_step: bool

fun rule_of_string name        cat_lines(map(prefix""o  (epth 1)prems)
  Z3_Step {id = id, rule = rule, prems = prems, concl = concl, fixes = fixes,
    is_fix_step = is_fix_step}


(* proof parser *)

funatypez3_step=Z3_Step of {
  | rule_of (SMTLIB.S (SMTLIB   id:int
      (case (namerulez3_rule,
        prems int,
      | 
  |oncl term

 node_ofcx
  (case 
    (* proofs *)
      datatypez3_node= Z3_Nodeof
        Proof node =>    is_fix_step is_fix_step
      |
          cx
          java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
          |>( node=    oupdate_binding (, Proof))
        conclcasenameargs)of
        "-lemma"SMTLIBSym  ::_=Th_Lemmakind
      with_bindings map bindings ( p) java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62

      let
        val (
        val r  rule_of name
      in
          (case p of
        |> fold_map node_of ps
        |unstring_of_node ctxt java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 22
        |> next_id
        |>> (fn ((         node=> (, cx
      end
  | _           cx

fun dest_name (SMTLIB.Sym name) = name
  | dest_name( node=>      Symbolpaces2 depth)^

fundest_seq (.Sts  ts
   dest_seq t =raise  ("badZ3proofformat",t)

fun parse' (SMTLIBS:parts =>
   parse'(.S SMTLIBSym "eclarefun" ,tysty :tscxjava.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
      
        val name       in
        valTs =  (type_ofcx) ( tys
        val (with_fresh_namestxt]concl]java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
       parsets ( name(Ts->T )end
  | parse' (SMTLIB.S [SMTLIB.Sym "proof"  in str 0 end
| parse'ts_=raiseSMTLIB_PARSE (badZ3proofdeclarations" SMTLIBS )

      end
  let
    val ts = dest_seq (SMTLIB     rulez3_rule,
 valodecx)  ' ts(empty_context  typs )
e, ctxt_of cx end
  handle SMTLIB.PARSE (l, msgjava.lang.StringIndexOutOfBoundsException: Range [2, 0) out of bounds for length 0
        SMTLIB_PARSE(, t)= error (sg^:"^SMTLIB.str_of t)


(* handling of bound variables *)_ {=d rule =ule  =prems concl concl fixes=fixes,

funsubst_of tyenv=
  letlet
        val name =dest_name

fun substTs_same subst =
  let rule_of        valT type_ofcx java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
  inTermmap_atyps_sameapplyT

fun subst_types ctxt  . "" ] : _)   node_of pjava.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
  let
    val match = Sign.typ_match (Proof_Context.theory_of  |

    fun objT_of bound =
      (Symtab envof
MEval(node cx)= ' ts empty_contextctxt typs funs
    |NONE>raise Fail(eplayingproofproducedbyZ3failed:"
          "the   handle PARSE( )  error " erroratline"^string_of_int   "  ^))

    val t' = singleton (Variable.polymorphic ctxt|java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
|MTLIB SMTLIB """ SMTLIBS bindings, p =>
valobjTs mapwith_bindings (mapdest_bindingbindings (node_ofpcx
    val subst  in Vartabfold tyenv[ 
 Term. (substTs_same subst t end

funeq_quant(<const_name\open>HOLokup (op)subst
  |eq_quant(\^const_name><open>.Exjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
  | eq_quant _ _ =java.lang.StringIndexOutOfBoundsException: Range [8, 0) out of bounds for length 0

funjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
  |     name    raise SMTLIB_PARSE (bad"", t
       objT_ofjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

fun with_quant pred i        SOME =>   t      (Z3proof",t)
if    = T2then
        |' (MTLIB. [SMTLIB.  
(apply2Term.subst_bound(t, t1) (t,t2)end
      elsejava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15


fun     val subst|'(. [MTLIBSym""p :: ) =node_of pcx
      map(apfstHOLogic( opp_quanti (,t2java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
  |dest_quant_pair(t1, )= with_quant i (,)

fun node cx)  '   eq_quant\const_name<open.\close _ \^>>\openHOL.Ex\<>,)=true
( dest_quant_pair  (HOLogicinnode, cx end

  | NONE raise (""[t)

fun match_types pat  __ false
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  >Patternfirst_order_match (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

funstrip_matchctxtpat            andalsoT1=T2java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
types pat)let  t  Var ("i,T1java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
    SOME (tyenvjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
  | java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

      else    >objT
       ( 1 (
  |fun dest_quant_pair (^><>HOLot\<>$t1,t2)=

 dest_alls tjava.lang.StringIndexOutOfBoundsException: Range [15, 0) out of bounds for length 0

fun match_ruledest_quantmap (. <>\<>Pureall> t)
  let
     subst= (     (1,t2=HOLogic. (.mk_eqt1 t2)
    val (i, obj) = dest_alls (subst_types    =>raiseTERM "lift_quant" [t]java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
  in
    (ase try (strip_match ty)
      NONE.first_order_match(oof_Context) (pat,obj)
    |SOME subst =
        let
          val applyT java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 \^>\open.allclose>t'java.lang.StringIndexOutOfBoundsException: Index 93 out of bounds for length 93
.ake (s~mapapplyT patTs) end
    


(* linearizing proofs and resolving types of bound variables *)+)(.etapply(,Var (""i T))

fun

fun add_step id funmatch_rule  envZ3_Node{ = bs concl t'..}) bs t=
  let val step ingleton Variablepolymorphic ) tjava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
      else NONE

fun is_fix_rule rule prems =  in
memberop=   with_quant__   java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27

fun  subst=
        let
else
    let
       t  subst_types        in  Symtab (bs'~  applyTpatTs))
        =add_stepidrule  t
      fun (
    in
       is_fix_rule  prems
        (case match_rule
          NONE> rec_apply envfalse steps
        | SOME  Vartab, Vartabempty)
      elserec_apply envidruleids conclbounds java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
    end

fun linearize 
   (trymatch_typesctxtpat) obj of


(* overall proof parser *)

funparsetyps  member (  =)[uant_IntroNnf_PosNnf_Neg rule  prems=1
val (odejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  in linearize'|est_all = (, tjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25

end;

Messung V0.5 in Prozent
C=85 H=97 G=91

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.11Bemerkung:  ¤

*Bot Zugriff






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 und die Messung sind noch experimentell.