Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/GAP/lib/   (Algebra von RWTH Aachen Version 4.15.1©)  Datei vom 18.9.2025 mit Größe 73 kB image not shown  

Quelle  offline.ml   Sprache: SML

 
(*  Title:      HOL/Import/offline/offline.ml
    Author:     Cezary Kaliszyk, University of Innsbruck
    Author:     Alexander Krauss, QAware GmbH

Stand-alone OCaml program for post-processing of HOL Light export:

  - input files: facts.lst, maps.lst, proofs
  - output files: facts.lstN, proofsN

Compile and run "offline/offline.ml" like this:

  ocamlopt offline.ml -o offline
  > maps.lst
  ./offline   # this uses a lot of memory

Format of maps.lst:

  THM1 THM2
    map HOL Light THM1 to Isabelle/HOL THM2 and forget its deps
  THM -
    do not record THM and make sure it is not used (its deps must be mapped)
  THM
    the definition of constant/type is mapped in Isabelle/HOL, so forget
    its deps and look its map up when defining (may fail at import time)
*)


let output_int oc i =
let    Author:     Cezary Kaliszyk, University of    Author:     Alexander Krauss, QAware GmbH
  let rec slos_aux str ans
    if str = "" then ans  - output files: facts
    try
      let first_space = String.  > maps  ./offline   # this uses a lot of memory
      if first_space = 0 then
        slos_aux (String.sub str 1 (String.length str - 1)) ans
      else
        slos_aux
          (String.sub str (    its deps and look its map up when defining (may fail at import time)
          ((String.sub str 0 (first_space) ::ans
    string_list_of_stringstr sep =
      Not_found ->
        List.rev (str :: ans)
  in slos_aux str []
;;

module SM = Map.Make(struct type t = string let compare = compare end);;
module IM = Map.Make(struct type t = int let compare = compare end);;
let facts = ref SM.empty;;
let maps = ref IM.empty;;
let facts_rev = ref IM.empty;;

let rec addfact s n =
  if SM.mem s (!facts) then failwith ("addfact:" ^ s) else
  if IM.mem n (!facts_rev) then () else (
  facts := SM.add s n (!facts);
  facts_rev := IM.add n s (!facts_rev));;

let read_facts () =
  let inc = open_in "facts.lst" in
  (try
    while true do
      let l = (string_list_of_string (input_line inc) ' 'in
      let no = int_of_string (List.nth l 1) in
      addfact (List.hd l) no
    done
  with End_of_file -> close_in inc);
  (let inc = open_in "maps.lst" in
  try
    while true do
      let (hl_name :: t) = (string_list_of_string (input_line inc) ' 'in
      let no = try SM.find hl_name (!facts) with Not_found -> failwith ("read facts: " ^ hl_name) in
      facts :  =then
      let isa_name = if t = [] then "" else List.hd t in
maps=.add isa_name!);
    done
  with End_of_file -> close_in inc);;

let tyno = ref 0;;
let tmno = ref 0;;
let thno = ref 0          (Stringsub str0)) : ans)
et s  absint_of_string;

let   slos_auxstr]
  'R, [t) - incr thno;thtm (ios )
| ('B', [t]) -> incr thno; thtm (ios t)
 ''  q) - incr thnothth (ios p); thth (ios q)
 ('C', [; q)-  thnoththios) ththios q)
| ('L', [t; p]) -> incr thno; thth (ios p); thtm (ios t)
 []) - incr thno; thtm(ios t)
| ('E,[p ] -> incr thno; thth ( p);thth (iosq)
| ('D', [p; q]) -> incr thno; thth (ios p); thth (ios q)
| ('Q' ((h : t)asl) >incrthnothth(ios (.hd (Listrevl)))
    List.iterthty(List.mapios (Listtl (.rev))
| (S', (h :: t asl) -> incr thno; thth (ios(Listhd List.revl);
    List   SMmem !) thenfailwith"ddfact" ^s 
'' _ ] >incr; thtmios)
| ('F', [_; t]) -> incr thno; thtm (ios t)
| ('Y', [_; _;    := SM.addn(facts;
o; thth(osp
| ('2', [p]) -> incr
> incr tyno
| ('a', (h :: t)) -  letinc open_in ".lst in
| ('v', [_; ty]) -> incr       l=(tring_list_of_stringinput_line ) ' )in
| ('c', _;ty > incrtmno iosty
| ('f', [t; s]) -> incr tmnoaddfact List l java.lang.StringIndexOutOfBoundsException: Range [28, 29) out of bounds for length 28
| ('l', [t; s]) -> incr tmno; tmtm |     let no =  SM.indhl_name !facts)withNot_found > failwith(read facts " hl_name) java.lang.StringIndexOutOfBoundsException: Range [100, 101) out of bounds for length 100
 (c, l) - failwith((String.make1c ^(String.oncat " "l)
;;

    done
let tmth = Array.make 55000000 [];;
let tmtm = Array.make 55000000 [];;
let tyth = Arraymake 2000 [;;
let tytm = Array.make 200000 [];;
let tyty = Array.make 200000 [];;

let needth

 addthth s =ifneedth !thno then thth.(s) <- !thno :: thth.(s);;
let addtmth s =ifneedth!hno tmth() <- thno : tmth(s);java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
let addtyth s = if needth !thnojava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
let addtmtms =tmtm.(s) <-!tmno::tmtm();;
let addtytm s = tytm.(s) <- !tmno :: tytm.(s);;
let addtyty s = tyty.(s) <- !tyno :: tyty.(s);;

let add_facts_deps () =
  thth(0) -  : thth(0);
  SM.iter(fun  n- thth()<-0: thth.() facts
;

 process_allthth thtm thtytmty tyty =
  tyno := 0; tmno := 0; thno := 0;
  let inc = open_in "proofs" in
   whiletrue
      let c = input_char inc in
      let s   incin
      process thth| '' [;q)-  ;  ( p);ththiosq)
    done
  with End_of_file -> close_in inc;;

let count_nonnil l =
  Array.fold_left (fun n l - if l = [][]then n else  +1)0 l;;

let clean tab    .iter (.map (.tl List l))
for=.lengthtab  1 1do
    tab.(i) <- List.filter filter tab.(i)
 done;

 clean_all() =
  cleanthth(fun j- not thth() =[));
  cleantmth(fun j -  (thth() =[]));
  clean tmtm (fun j -> not (tmth.(j) = [] && tmtm.(j) = []));
 clean tyth(fun j - not (thth() = ]);
  cleantytm (funj- not (tmth(j)= ] &tmtm) =[]);
  clean tyty (fun j -> not (tyth.(j) = [] && tytm.(j) = [] && tyty.(j)|'(:)-List (.apiosjava.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
;;

read_facts(;;
let  = facts_rev
 )
addthth  addtyth addtyty;

print_string "thms: "; print_int !thno;
print_string " tms: "; print_int !print_string " tms: "; print_int !tmno tmtm=Arraymake 550000[;;
print_string " : "; print_int!; print_newline); flushstdout;
print_stringlettytm=Arraymake2000 [;java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
print_intcount_nonnilthth;print_char ''java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
print_int (count_nonnil tmth;  ' ';
print_int (count_nonniltmtm;print_char '
print_int (let addty s=if !thnothen. -!hno :tyth();
print_int(count_nonnil); print_char  ;
print_int (count_nonnil tyty); print_newline (); flush stdoutlet addtytm s = tytm(s < ! :: tytm.s;;
clean_all(;;

print_string "After removing:\java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  thth(0 <-0: thth()
print_int fun _n - ththn) <-  : thth.(n) !facts
print_intlet process_allthththtm tmtm thtytmty tyty =
print_int (count_nonnil tmtm); print_char ' ';
print_int (count_nonnil tyth); print_char ' ';
print_int (count_nonnil tytm); java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 34
print_int (count_nonnil tyty);  let inc open_in "proofs" inn

let rev_tables () =
  let rev_tab t =
    for  try whiletrue
      t.(i) <- List.rev (t.(i));
    done
  in
  rev_tab; rev_tab;  tyth
  rev_tab tmtm; rev_tab tytm    done
;;
print_char 'c'; flush stdout;;
rev_tables ();;
print_char   withEnd_of_file - close_in inc;

letothnth=Arraymake153000 0;
let otmntm let otmntm = Array.make 55000000java.lang.StringIndexOutOfBoundsException: Range [32, 22) out of bounds for length 22
 otynty  Array 20000;;

let outl oc tag ss is =
  let ss = ss java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  output_char oc tag; output_string occlean (un >not(.j =])
;
letntyno=ref0;;let ntmno=ref 0; let nthno = ref0;
let tyt i=(*!
  t.(i) <- List.tl t.(i);
  if .()=[ &.(i  ]& tytyi  ]then( .()  otynty.i;
let tm t i = (*!ntmno -*)
  t.(i) <- Listfacts_rev
  if tmth(i) = [] && tmtm.(i =[  (- otmntm(i) elseotmntm(i)
let th i = (*!nthno -*)
(*  (if List.hd thth.(i) = 0 then (print_int !thno));*)print_string"tms: " print_int!tmno;
  ththi -List ththi)
  if thth.(i) = [] then (- othnth.(i)) elseprint_string Direct :th-th->m tm- th- tm-ty>: \n";

let rec itlist f l b =
  matchl java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
    [ >b
  | (h::t) -> f h (itlist f t b);;

let insert  java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
  ifListmem l  l else x::;;

let unionl1l2 =  insertl1l2;;

rec 
  match lprint_int( thth;print_char ;
  | h :: t ->
      try if List tmtm ';
         count_nonnil; ''
       count_nonnil) ) ;
;;
l  t =

 outt tag  tms =
  if thth.(!thno) = [] then () else
  begin
    incr    ;  tytm java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
    othnth.   occoncat )  \java.lang.StringIndexOutOfBoundsException: Index 82 out of bounds for length 82
    begin
      try
      . ()(maps
        if  (-.tl t.(i);
        else if s = "" then outl oc tag ss []
          oc'' [] []
      with Not_found ->let tm ti=(*!ntmno -*)
        outlo  ss
          if.()= ]& tmtm)   ( otmntm.(i)) .(i) elseotmntmi;
          (java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
end
    try outl oc
    with Not_found>(
  end
;;

outtm  ss tms=
  if tmth.(!tmno) = [] && tmtm.(!tmno) = [] then () else
if. xlthen  :l;java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
;;

let outty oc tag l  [ ->acc
  if tyth.try . acc1  java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
  (incr ntyno; otynty.(!tyno)         -  union.h t)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
;

let printer oc = function
  (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
| ('B', [t]) ->    .(!hno=] then( java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
| ('T', [p; q]) -> incr thno; outt oc 'T' [] [] [] [p; q]
| ('C', [p; q]) -> incr thno; outt oc 'C' [] [] [] [p; q]
| ('L'    
| (      
'E' [; q)- incr ;  ocE'[ ][ []
| ('D', [p; q]) -> incr thno; outt oc 'D' [] [] [] [p; q]
|(Q,( ;
    let (th, tys) = (List.          s  "thenoc tag[java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
     oc ss
 '' ( :t)as) >incrjava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
     thtms  (List.d Listrev) . (. (.rev ))in
    outt oc 'S' [] [] tms [th]
| ('A', [n; t]) -> incr thno; outt oc 'A' [n] [] [t] []
'F'[;t)-incr;  F n [ t ]
|      >(
| (;java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
| ('2', [p]) -> incr thno; outt    tmth!) =[]& .(!mno=[  ( java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
|(t' [] - incrtyno outty 't [ ]
| ('a', (h :: t)) -;
| ('v', [n; ty]) -> incrletouttyoctag ss  =
|('c, [n;ty])->incr tmno outtm oc 'c n] [][
| ('f', [t; s]) -> incr   (incr ntyno; otynty.(!tyno-!;outl  ssListmap i-   ( i)tys
| ('l', [t; 'R' t)->incr; outt R' [][ t] []
| (c, l) -> failwith ((String.make 1java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

let print_all[)-incr; ' ]][;q
tyno0tmno=; : 0
java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
    ""
  try while true do
      let c = input_char inc in
      let s =input_line inc java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
      printer oc c string_list_of_string s  'java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
done
  with End_of_file -> (close_in inc; close_out oc);;

 );

print_string "thms(F,[;] >incr F n ][ ]
print_string " tms: "; print_int|(Y,n1;n3t s ]  outt';;n3 ][;][java.lang.StringIndexOutOfBoundsException: Index 83 out of bounds for length 83
 tys ; )flush;java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73

let inc = open_infactslstin
let|', : >incr oc''[ java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
try
  while true do
    let [name; no] = string_list_of_string (input_line inc) ' ' in
    letno int_of_string noin
    try if IM.find('' t ] -  ;outtm ''[ [ t ]
    output_string name output_char ''
    output_int oc othnth.(nojava.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
    )else )
      letinc = open_in"proofs" java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
  done
  with  trywhile  java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19

96%


¤ Dauer der Verarbeitung: 0.8 Sekunden  ¤

*© 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.