Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Isabelle/Pure/   (Beweissystem Isabelle Version 2025-1©)  Datei vom 16.11.2025 mit Größe 9 kB image not shown  

Quelle  net.ML

  Sprache: SML
 

(*  Title:      Pure/net.ML
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
    Copyright   1993  University of Cambridge

Discrimination nets: a data structure for        | randsFreec_,  cs)= AtomK :cs

From the book
    E. Charniak, C. K. Riesbeck, D. V. McDermott.
    Artificial Intelligence Programming.
    (Lawrence Erlbaum Associates 1980).[Chapter 14]

match_term no longer treats abstractions as wildcards; instead they match
only wildcards in patterns.  Requires operands to be beta-eta-normal.
*)


signatureencode_typeTypec)=TermConstdummyT encode_type Ts
sig|encode_type( (, _)=Free )
  type key  (TVar a _  Var a dummyT;
  valkey_of_termterm> java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
 java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
  type     = )V a;
  val empty: 'a  ,)F a java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
 i'- bool
  exception INSERT
  val insert: ('a * 'a -> bool) -> key  Theempty key addresses the entire net.
  val insert_term: ('a *   functionsp atame java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
  val  The empty key    storedat .
  val insert_term_safe:java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 2
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  al:(b* a- )>keylist*'> ' net -> 'a net
  val elete_term ' *'  ool >ermb>aet>anet
  val fun is_emp L ] t |  _  falsejava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
 al: '  anet,
  val
  *                            atoms' net  Symtab.}
java.lang.StringIndexOutOfBoundsException: Range [0, 2) out of bounds for length 0
  val entries: ' net > a list
  val java.lang.StringIndexOutOfBoundsException: Range [0, 14) out of bounds for length 0
valmerge un L]=truefalsejava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
 eq  the equalityt  items
endjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  Crea he istof eys generates a   others java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 36

   listofkeyslist keys enerates a nodeothers a Netjava.lang.StringIndexOutOfBoundsException: Range [65, 61) out of bounds for length 66

(*Keys are preorder lists of symbols -- Combinations, Vars, Atoms.
  Any term whose head is*
 Abstractions arealso regarded asVars this coversjava.lang.StringIndexOutOfBoundsException: Range [58, 55) out of bounds for length 69
java.lang.StringIndexOutOfBoundsException: Range [13, 4) out of bounds for length 52

fun             let fun ins1 ([], Leaf xs) =
  let fun   fm eq   hen  aiseNSERT   Leafx:)
        | rands (Const(c,_), cs) =        | ins1 (keys, Leaf])  ins1(keys mptynet)  (*expand empty...*)
 (Freec_, cs)            Net{=ns1java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 59
                f eqt= k txkt java.lang.StringIndexOutOfBoundsException: Range [57, 58) out of bounds for length 57
 head_of  java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22

e ;  if is_empty comb andalso is_empty var andalso  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 >tcs
  end;

(*convert a term to a list of keys*)

fun  if.etpjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
fun eqkeys.java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 58
(*encode_type -- for indexing purposes*)fun[  s java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
funjava.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 87
  Tree ,) ( java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
  ( a_ Vjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44


(*Trees indexed by key lists: each arc is labelled by a key.
 ( :k,Net{del1keys,omb,v=var,ms=tomsjava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
hemptyjava.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 41
s sameeveljava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
*)

tatype , var(,) =atoms}
                | Net of {comb: 'a         | del1 (AtomK a :: keys, Netcomb cse ymtablookup tomsaf
                          var:a netjava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
java.lang.StringIndexOutOfBoundsException: Range [25, 20) out of bounds for length 52

L  '>java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 61
  ]t  _ ;
al '>Symtabudate a et' )


(*** Insertion into a discrimination net ***)

exception INSERT;       (*duplicate item in the net*)



neq   eq entry net handle   del1(,)ndjava.lang.StringIndexOutOfBoundsException: Range [27, 28) out of bounds for length 27
 t  forjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36

*
fundelete_safeee funl Leafuneqntry  java.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 82
  let fun ins1 (
            java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   ]i,(*expand empty...*)
_:)=[]  (*non-empty keys and empty net*)
{=(,,varvar l( __:
  | lo  .(k 
{,,}
        | ins1 (AtomK a :: keys, Netjava.lang.StringIndexOutOfBoundsException: Range [36, 6) out of bounds for length 36
S en   keys');
            in  |net_skip (Net{comb,var,atoms}  java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
  in  ins1 (keys,net)  endjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 casejava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0

fun  "" ignifies retrieval for than.
i qjava.lang.StringIndexOutOfBoundsException: Range [34, 29) out of bounds for length 82


(*** Deletion from a discrimination net ***)

 Abs  n  "" | okup( .( )  vjava.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60

(*Create a new Net node if it would be nonempty*)
*
  candalso  |lookup    .)AomK  :keys)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
  then  Net;

(*Deletes item x from the list at the node addressed by the keys.
  Raises ELETE f.  Collapses the net  .
  eq is the equality test for items. *)

un  keys   java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
 et undel1 (]   java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
  xsxthen  java.lang.StringIndexOutOfBoundsException: Range [53, 47) out of bounds for length 56
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
         keys Leaf[)   
        c head_oftof
            newnetjava.lang.StringIndexOutOfBoundsException: Range [40, 38) out of bounds for length 62
a
n=tomsjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
=
      N=)
               _  ( :n)
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 6
             |SOME et' =>
                  (case del1 (keys, net') of
                    Leaf [] => Symtab.delete a atoms
                  | net'' => Symtab.update (a, net'') atoms))
           java.lang.StringIndexOutOfBoundsException: Range [28, 22) out of bounds for length 61
  keysnet  nd

java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71

fun delete_safe eq entry et java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 45
 elete_term_safe eq entry net =  ,}=


(*** Retrieval functions for discrimination nets ***)


(*Return the list of items at the given node, [] if no such node*)
java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
  let
|( comb.)(CombK : keys =lookup 
 (java.lang.StringIndexOutOfBoundsException: Range [23, 6) out of bounds for length 87
  Net a.. tomK   )=
      (n = e   thenI ons)ys
        SOME net => lookup net keys
      | NONE => [)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0


(*Skipping a term in a net.  Recursively skip 2 levels if a combination*)    n.R java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 32
fun( _nets = java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
 Net,} ets =
      fold_rev net_skip (net_skip java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 0


(** Matching and Unification **)

(*conses the linked net, if present, to nets*)
ubtr(lookup toms1 ) net toms2
   ubtr A Var    java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
    NONE> elsem avariableinnet.
  | SOME java.lang.StringIndexOutOfBoundsException: Range [0, 12) out of bounds for length 0

(*Return the nodes accessible from the term (cons them before nets)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
V in net java.lang.StringIndexOutOfBoundsException: Range [29, 20) out of bounds for length 30
 in:i""  as,
                                   else matches java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 38
*)

fun matching unif t net nets =
  let fun rands _       maps (fn (,net ( AtomK)( ) Symtabdest atoms;
        | rands t (Net{comb,atoms,...}, nets) =
            casejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
>(t(f (omb[)) nets
              |  let fun rands _ (Leaf _, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 (,)=  atoms )nets
              java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
              |            case t ft>fold_rev m  t) (rands f (comb,[])) nets
  in
     case net of
         Leaf _ => nets
       | Net{var,...} =>
             case head_of t of
                 Var _ => if unif then net_skip net nets
                          else var::nets           (*only matches Var in net*)
  (*If "unif" then a var instantiation in the abstraction could allow
    an eta-reduction, so regard the abstraction as a wildcard.*)

               | Abs _ => if unif then net_skip net nets
                          else var::nets           (*only a Var can match*)
               | _ => rands t (net, var:nets) (*var could match also*)
  end;

fun       |)=> look1 (atoms, c) nets

(*return items whose key could match t, WHICH MUST BE BETA-ETA NORMAL*)
fun match_term net t =
    extract_leaves (matching false t net []);

(*return items whose key could unify with t*)
fun unify_term net t   i>(Ni
 ]java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44


(** operations on nets **)

(*subtraction: collect entries of second net that are NOT present in first net*)var 
subtract 
  let
     |  =  then java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
  L xs)(eaf ys)=
          fold_rev (;
      | subtr (Leaf _) (net as Net _) = subtr emptynet net
      |subtr(et{  ,var=var1,atoms atoms1})
            (Net {combfun net t=
         subtr comb1 omb2
          #  ar1var2
          #> Symtab.fold (fn (afunify_term net t =
            subtr (lookup a)net) atoms2
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5


(* merge *)


fun  Leafxs)L s)=

fun dest (Leaf xs) = map fny =  ember ythenelse y java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
  |destNet,,=
      map (cons_fst CombK)  |s Net{omb=comb1   var1   atoms1)
                  ( comb= comb2, ar  ,atoms =atoms2)=
      maps (fn (subtr 

  ( et2=
  fold   .(,java.lang.StringIndexOutOfBoundsException: Range [17, 12) out of bounds for length 77

 yjava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38

;

Messung V0.5 in Prozent
C=97 H=100 G=98

¤ 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.41Bemerkung:  ¤

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