10 val del: term list -> attribute |
10 val del: term list -> attribute |
11 val add: term list -> attribute |
11 val add: term list -> attribute |
12 val setup: theory -> theory |
12 val setup: theory -> theory |
13 end; |
13 end; |
14 |
14 |
15 structure Cooper_Data : COOPER_DATA = |
15 structure CooperData : COOPER_DATA = |
16 struct |
16 struct |
17 |
17 |
18 type entry = simpset* (term list); |
18 type entry = simpset * (term list); |
19 val start_ss = HOL_ss (* addsimps @{thms "Groebner_Basis.comp_arith"} |
19 val start_ss = HOL_ss (* addsimps @{thms "Groebner_Basis.comp_arith"} |
20 addcongs [if_weak_cong, @{thm "let_weak_cong"}];*) |
20 addcongs [if_weak_cong, @{thm "let_weak_cong"}];*) |
21 val allowed_consts = |
21 val allowed_consts = |
22 [@{term "op + :: int => _"}, @{term "op + :: nat => _"}, |
22 [@{term "op + :: int => _"}, @{term "op + :: nat => _"}, |
23 @{term "op - :: int => _"}, @{term "op - :: nat => _"}, |
23 @{term "op - :: int => _"}, @{term "op - :: nat => _"}, |
44 @{term "0::int"}, @{term "1::int"}, @{term "0::nat"}, @{term "1::nat"}, |
44 @{term "0::int"}, @{term "1::int"}, @{term "0::nat"}, @{term "1::nat"}, |
45 @{term "True"}, @{term "False"}]; |
45 @{term "True"}, @{term "False"}]; |
46 |
46 |
47 structure Data = GenericDataFun |
47 structure Data = GenericDataFun |
48 ( |
48 ( |
49 val name = "Cooper-Data"; |
49 type T = simpset * (term list); |
50 type T = simpset * (term list) |
50 val empty = (start_ss, allowed_consts); |
51 val empty = (start_ss, allowed_consts); |
51 fun extend (ss, ts) = (MetaSimplifier.inherit_context empty_ss ss, ts); |
52 fun extend (ss,ts) = (MetaSimplifier.inherit_context empty_ss ss, ts); |
52 fun merge _ ((ss1, ts1), (ss2, ts2)) = |
53 fun merge _ ((ss1,ts1), (ss2,ts2)) = (merge_ss (ss1,ss2), |
53 (merge_ss (ss1, ss2), Library.merge (op aconv) (ts1, ts2)); |
54 Library.merge (op aconv) (ts1,ts2))); |
54 ); |
55 |
55 |
56 val get = Data.get o Context.Proof; |
56 val get = Data.get o Context.Proof; |
57 |
57 |
58 fun add ts = Thm.declaration_attribute (fn th => fn context => |
58 fun add ts = Thm.declaration_attribute (fn th => fn context => |
59 context |> Data.map (fn (ss,ts') => |
59 context |> Data.map (fn (ss,ts') => |
60 (ss addsimps [th], Library.merge (op aconv) (ts',ts) ))) |
60 (ss addsimps [th], merge (op aconv) (ts',ts) ))) |
61 |
61 |
62 fun del ts = Thm.declaration_attribute (fn th => fn context => |
62 fun del ts = Thm.declaration_attribute (fn th => fn context => |
63 context |> Data.map (fn (ss,ts') => |
63 context |> Data.map (fn (ss,ts') => |
64 (ss delsimps [th], Library.subtract (op aconv) ts' ts ))) |
64 (ss delsimps [th], subtract (op aconv) ts' ts ))) |
|
65 |
65 |
66 |
66 (* concrete syntax *) |
67 (* concrete syntax *) |
|
68 |
67 local |
69 local |
68 fun keyword k = Scan.lift (Args.$$$ k -- Args.colon) >> K (); |
70 fun keyword k = Scan.lift (Args.$$$ k -- Args.colon) >> K (); |
69 |
71 |
70 val constsN = "consts"; |
72 val constsN = "consts"; |
71 val any_keyword = keyword constsN |
73 val any_keyword = keyword constsN |