src/Tools/isac/Knowledge/Test_Build_Thydata.thy
author wenzelm
Wed, 26 May 2021 16:24:05 +0200
changeset 60286 31efa1b39a20
parent 60266 4921574fd67f
child 60289 a7b88fc19a92
permissions -rw-r--r--
command 'setup_rule' semantic equivalent for KEStore_Elems.add_rlss;
     1 (* Minimal Thydata for test/../thy-hierarchy *)
     2 
     3 theory Test_Build_Thydata
     4   imports "Specify.ProgLang"
     5 begin
     6 
     7 ML \<open>
     8 open Rule
     9 fun termlessI (_: subst) uv = LibraryC.termless uv;
    10 \<close>
    11 axiomatization where
    12   thm111: "thm111 = thm111 + (111::int)" and
    13   thm222: "thm222 = thm222 + (222::int)"
    14 
    15 ML \<open>
    16 val rls111 = Rule_Def.Repeat {id = "rls111", 
    17 	preconds = [], rew_ord = ("termlessI", termlessI), erls = Rule_Set.empty, 
    18 	srls = Rule_Set.Empty, calc = [], errpatts = [],
    19 	rules = [Rule.Thm ("thm111", @{thm thm111}), Rule.Thm ("refl", @{thm refl})],
    20 	scr = Rule.Empty_Prog};
    21 
    22 val rls222 = Rule_Def.Repeat {id = "rls222", 
    23 	preconds = [], rew_ord = ("termlessI", termlessI), erls = Rule_Set.empty, 
    24 	srls = Rule_Set.Empty, calc = [], errpatts = [],
    25 	rules = [Rule.Thm ("sym_thm111", @{thm thm111} RS @{thm sym}), Rule.Thm ("o_def", @{thm o_def})],
    26 	scr = Rule.Empty_Prog};
    27 
    28 val prep_rls' = Auto_Prog.prep_rls @{theory};
    29 \<close>
    30 
    31 setup_rule
    32   rls111 = \<open>prep_rls' rls111\<close> and
    33   rls222 = \<open>prep_rls' rls222\<close>
    34 
    35 ML \<open>
    36   @{thm refl};
    37   @{thm o_def};
    38 
    39 \<close> ML \<open>
    40 val [aaa, bbb, ccc, ddd, eee] = KEStore_Elems.get_rlss @{theory};
    41 \<close> ML \<open>
    42 if eq_set op = (map fst [aaa, bbb, ccc], ["e_rrls", "empty", "prog_expr"]) then ()
    43 else raise ERROR "test/../thy-hierarchy CHANGED"
    44 \<close> ML \<open>
    45 case ddd of
    46   ("rls111",
    47     ("Test_Build_Thydata",
    48      Rule_Def.Repeat {calc = [], erls =
    49           Rule_Def.Repeat {calc = [], erls = Rule_Set.Empty, errpatts = [], id = "empty", preconds = [], rew_ord =
    50                ("dummy_ord", _), rules = [], scr = Empty_Prog, srls = Rule_Set.Empty},
    51           errpatts = [], id = "rls111", preconds = [], rew_ord = ("termlessI", _), rules =
    52           [Thm ("thm111", _), Thm ("refl", _)], scr = Empty_Prog, srls = Rule_Set.Empty})) => ()
    53 | _ => raise ERROR "test/../thy-hierarchy CHANGED 4";
    54 \<close> ML \<open>
    55 case eee of
    56   ("rls222",
    57     ("Test_Build_Thydata",
    58      Rule_Def.Repeat {calc = [], erls =
    59           Rule_Def.Repeat {calc = [], erls = Rule_Set.Empty, errpatts = [], id = "empty", preconds = [], rew_ord =
    60                ("dummy_ord", _), rules = [], scr = Empty_Prog, srls = Rule_Set.Empty},
    61           errpatts = [], id = "rls222", preconds = [], rew_ord = ("termlessI", _), rules =
    62           [Thm ("sym_thm111", _), Thm ("o_def", _)], scr = Empty_Prog, srls = Rule_Set.Empty})) => ()
    63 | _ => raise ERROR "test/../thy-hierarchy CHANGED 5";
    64 \<close>
    65 
    66 ML \<open>
    67 \<close> ML \<open>
    68 \<close>
    69 end