summaryrefslogtreecommitdiff
path: root/snapshots/hol4/lem/hol-lib/lem_show_extraScript.sml
blob: 6be94271d59782dff038e2f1a798f522e885af2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
(*Generated by Lem from show_extra.lem.*)
open HolKernel Parse boolLib bossLib;
open lem_stringTheory lem_maybeTheory lem_numTheory lem_basic_classesTheory lem_setTheory lem_relationTheory lem_showTheory lem_set_extraTheory lem_string_extraTheory;

val _ = numLib.prefer_num();



val _ = new_theory "lem_show_extra"



(*open import String Maybe Num Basic_classes Set Relation Show*) 
(*import Set_extra String_extra*)

val _ = Define `
((instance_Show_Show_nat_dict:(num)Show_class)= (<|

  show_method := num_to_dec_string|>))`;


val _ = Define `
((instance_Show_Show_Num_natural_dict:(num)Show_class)= (<|

  show_method := num_to_dec_string|>))`;


val _ = Define `
((instance_Show_Show_Num_int_dict:(int)Show_class)= (<|

  show_method := lem_string_extra$stringFromInt|>))`;


val _ = Define `
((instance_Show_Show_Num_integer_dict:(int)Show_class)= (<|

  show_method := lem_string_extra$stringFromInteger|>))`;


val _ = Define `
 ((stringFromSet:('a -> string) -> 'a set -> string) showX xs= 
   (STRCAT"{"  (STRCAT(lem_show$stringFromListAux showX (SET_TO_LIST xs)) "}")))`;


(* Abbreviates the representation if the relation is transitive. *)
val _ = Define `
 ((stringFromRelation:('a#'a -> string) ->('a#'a)set -> string) showX rel=
   (if transitive rel then
    let pruned_rel = (withoutTransitiveEdges rel) in
    if (! (e :: rel). (e IN pruned_rel)) then
      (* The relations are the same (there are no transitive edges),
         so we can just as well print the original one. *)
      stringFromSet showX rel
    else 
      STRCAT"trancl of " (stringFromSet showX pruned_rel)
  else
    stringFromSet showX rel))`;


val _ = Define `
((instance_Show_Show_set_dict:'a Show_class ->('a set)Show_class)dict_Show_Show_a= (<|

  show_method := (\ xs. stringFromSet  
  dict_Show_Show_a.show_method xs)|>))`;

val _ = export_theory()