Skip to content

Commit c6195a1

Browse files
a few updates and edits to sptrees Script
1 parent 2fe9aea commit c6195a1

File tree

1 file changed

+125
-118
lines changed

1 file changed

+125
-118
lines changed

hol/policy_to_table/bdd_cake_trans/sptrees_bdd_trans_ProgScript.sml

Lines changed: 125 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ open fromSexpTheory;
99

1010
val _ = new_theory "sptrees_bdd_trans_Prog";
1111

12-
12+
(*)
13+
val _ = ml_prog_update (open_module "cake_sptrees_bdd_trans_Prog");
14+
*)
1315

1416
val _ = translation_extends "basisProg"
1517
val _ = intLib.deprecate_int();
@@ -301,6 +303,7 @@ val res = append_prog o process_topdecs $
301303
);’;
302304

303305

306+
304307
val res = append_prog o process_topdecs $
305308
fun print_list_pairs xs =
306309
let
@@ -386,11 +389,125 @@ val r = translate spts_to_alist_def;
386389
val r = translate toSortedAList_def;
387390

388391

392+
393+
val res = append_prog o process_topdecs $
394+
395+
fun print_atom p =
396+
case p of
397+
True_2 => TextIO.print "True"
398+
| False_2 => TextIO.print "False"
399+
| Var_1 cs => (TextIO.print "Var \""; print_string cs; TextIO.print "\"")
400+
| Not_1 cs => (TextIO.print "Not \""; print_string cs; TextIO.print "\"")
401+
| Notfalse => TextIO.print "NotFalse"
402+
| Nottrue => TextIO.print "NotTrue"
403+
’;
404+
405+
406+
407+
val res = append_prog o process_topdecs $
408+
fun print_al_n_s (atom_l, n_state) =
409+
let
410+
411+
fun loop xs =
412+
case xs of
413+
[] => ()
414+
| [atom] => print_atom atom
415+
| atom::rest => (print_atom atom ; TextIO.print "; " ; loop rest)
416+
in
417+
( TextIO.print "([";
418+
loop atom_l;
419+
TextIO.print "],";
420+
TextIO.print (Int.toString (fst n_state));
421+
TextIO.print ",";
422+
print_action (snd n_state);
423+
TextIO.print ")"
424+
)
425+
end’;
426+
427+
428+
429+
430+
val res = append_prog o process_topdecs $
431+
fun print_list_tbl xs =
432+
let
433+
434+
fun loop_inner tbl =
435+
case tbl of
436+
[] => ()
437+
| [al_n_s] => print_al_n_s al_n_s
438+
| al_n_s::rest => (print_al_n_s al_n_s ; TextIO.print "; " ; loop_inner rest)
439+
440+
fun loop xs =
441+
case xs of
442+
[] => ()
443+
| [x] => (TextIO.print "[" ; loop_inner x ; TextIO.print "]")
444+
| x::rest => ( TextIO.print "[" ; loop_inner x ; TextIO.print "]; " ; loop rest)
445+
in
446+
TextIO.print "[";
447+
loop xs;
448+
TextIO.print "]"
449+
end;’;
450+
451+
452+
453+
val res = append_prog o process_topdecs $
454+
fun print_table_label lab =
455+
case lab of
456+
Non_termn (optname, lst_n) =>
457+
(TextIO.print "non_termn (";
458+
(case optname of
459+
None => TextIO.print "NONE"
460+
| Some cs => (TextIO.print "SOME \""; print_string cs; TextIO.print "\"")
461+
);
462+
TextIO.print ", ";
463+
print_list_tbl (fst lst_n); (*print tablesl [[];[];[]] *)
464+
TextIO.print ", ";
465+
TextIO.print (Int.toString (snd lst_n)); (*input state*)
466+
TextIO.print ")")
467+
| Termn (fin, lst_n) =>
468+
(TextIO.print "termn (";
469+
print_action (fin);
470+
TextIO.print ",";
471+
print_list_tbl (fst lst_n); (*print tablesl [[];[];[]] *)
472+
TextIO.print ", ";
473+
TextIO.print (Int.toString (snd lst_n)); (*input state*)
474+
TextIO.print ")");
475+
’;
476+
477+
478+
479+
val res = append_prog o process_topdecs $
480+
fun print_list_tables_lbl xs =
481+
let
482+
fun loop xs =
483+
case xs of
484+
[] => ()
485+
| [x] => (TextIO.print "(";
486+
TextIO.print (Int.toString (fst x));
487+
TextIO.print ", ";
488+
print_table_label (snd x);
489+
TextIO.print ")")
490+
| x::rest =>
491+
(TextIO.print "(";
492+
TextIO.print (Int.toString (fst x));
493+
TextIO.print ", ";
494+
print_table_label (snd x);
495+
TextIO.print "); \n ";
496+
loop rest)
497+
in
498+
TextIO.print "[";
499+
loop xs;
500+
TextIO.print "]"
501+
end;
502+
’;
503+
504+
505+
389506
(***************************************)
390507

391508
(* EXAMPLE OF USAGE *)
392509

393-
510+
(*
394511
395512
Definition policy_order_test_def:
396513
policy_order_test = (["x";"y";"z"]:string list)
@@ -554,122 +671,6 @@ End
554671
555672
val r = translate table_main_hol4_def;
556673
557-
558-
559-
560-
561-
val res = append_prog o process_topdecs $
562-
563-
fun print_atom p =
564-
case p of
565-
True_2 => TextIO.print "True"
566-
| False_2 => TextIO.print "False"
567-
| Var_1 cs => (TextIO.print "Var \""; print_string cs; TextIO.print "\"")
568-
| Not_1 cs => (TextIO.print "Not \""; print_string cs; TextIO.print "\"")
569-
| Notfalse => TextIO.print "NotFalse"
570-
| Nottrue => TextIO.print "NotTrue"
571-
’;
572-
573-
574-
575-
val res = append_prog o process_topdecs $
576-
fun print_al_n_s (atom_l, n_state) =
577-
let
578-
579-
fun loop xs =
580-
case xs of
581-
[] => ()
582-
| [atom] => print_atom atom
583-
| atom::rest => (print_atom atom ; TextIO.print "; " ; loop rest)
584-
in
585-
( TextIO.print "([";
586-
loop atom_l;
587-
TextIO.print "],";
588-
TextIO.print (Int.toString (fst n_state));
589-
TextIO.print ",";
590-
print_action (snd n_state);
591-
TextIO.print ")"
592-
)
593-
end’;
594-
595-
596-
597-
598-
val res = append_prog o process_topdecs $
599-
fun print_list_tbl xs =
600-
let
601-
602-
fun loop_inner tbl =
603-
case tbl of
604-
[] => ()
605-
| [al_n_s] => print_al_n_s al_n_s
606-
| al_n_s::rest => (print_al_n_s al_n_s ; TextIO.print "; " ; loop_inner rest)
607-
608-
fun loop xs =
609-
case xs of
610-
[] => ()
611-
| [x] => (TextIO.print "[" ; loop_inner x ; TextIO.print "]")
612-
| x::rest => ( TextIO.print "[" ; loop_inner x ; TextIO.print "]; " ; loop rest)
613-
in
614-
TextIO.print "[";
615-
loop xs;
616-
TextIO.print "]"
617-
end;’;
618-
619-
620-
621-
val res = append_prog o process_topdecs $
622-
fun print_table_label lab =
623-
case lab of
624-
Non_termn (optname, lst_n) =>
625-
(TextIO.print "non_termn (";
626-
(case optname of
627-
None => TextIO.print "NONE"
628-
| Some cs => (TextIO.print "SOME \""; print_string cs; TextIO.print "\"")
629-
);
630-
TextIO.print ", ";
631-
print_list_tbl (fst lst_n); (*print tablesl [[];[];[]] *)
632-
TextIO.print ", ";
633-
TextIO.print (Int.toString (snd lst_n)); (*input state*)
634-
TextIO.print ")")
635-
| Termn (fin, lst_n) =>
636-
(TextIO.print "termn (";
637-
print_action (fin);
638-
TextIO.print ",";
639-
print_list_tbl (fst lst_n); (*print tablesl [[];[];[]] *)
640-
TextIO.print ", ";
641-
TextIO.print (Int.toString (snd lst_n)); (*input state*)
642-
TextIO.print ")");
643-
’;
644-
645-
646-
647-
val res = append_prog o process_topdecs $
648-
fun print_list_tables_lbl xs =
649-
let
650-
fun loop xs =
651-
case xs of
652-
[] => ()
653-
| [x] => (TextIO.print "(";
654-
TextIO.print (Int.toString (fst x));
655-
TextIO.print ", ";
656-
print_table_label (snd x);
657-
TextIO.print ")")
658-
| x::rest =>
659-
(TextIO.print "(";
660-
TextIO.print (Int.toString (fst x));
661-
TextIO.print ", ";
662-
print_table_label (snd x);
663-
TextIO.print "); \n ";
664-
loop rest)
665-
in
666-
TextIO.print "[";
667-
loop xs;
668-
TextIO.print "]"
669-
end;
670-
’;
671-
672-
673674
674675
val res = append_prog o process_topdecs $
675676
‘fun main () =
@@ -748,5 +749,11 @@ val content_term =
748749
parsed
749750
end;
750751
752+
*)
753+
754+
755+
(*)
756+
val _ = ml_prog_update (close_module NONE);
757+
*)
751758

752759
val _ = export_theory ();

0 commit comments

Comments
 (0)