1 | (**************************************************************************) |
---|
2 | (* ___ *) |
---|
3 | (* ||M|| *) |
---|
4 | (* ||A|| A project by Andrea Asperti *) |
---|
5 | (* ||T|| *) |
---|
6 | (* ||I|| Developers: *) |
---|
7 | (* ||T|| The HELM team. *) |
---|
8 | (* ||A|| http://helm.cs.unibo.it *) |
---|
9 | (* \ / *) |
---|
10 | (* \ / This file is distributed under the terms of the *) |
---|
11 | (* v GNU General Public License Version 2 *) |
---|
12 | (* *) |
---|
13 | (**************************************************************************) |
---|
14 | |
---|
15 | include "Traces.ma". |
---|
16 | |
---|
17 | record monoid: Type[1] ≝ |
---|
18 | { carrier :> Type[0] |
---|
19 | ; op: carrier → carrier → carrier |
---|
20 | ; e: carrier |
---|
21 | ; neutral_r : ∀x. op … x e = x |
---|
22 | ; neutral_l : ∀x. op … e x = x |
---|
23 | ; is_associative: ∀x,y,z. op … (op … x y) z = op … x (op … y z) |
---|
24 | }. |
---|
25 | |
---|
26 | record monoid_action (I : monoid) (M : Type[0]) : Type[0] ≝ |
---|
27 | { act :2> I → M → M |
---|
28 | ; act_neutral : ∀x.act (e …) x = x |
---|
29 | ; act_op : ∀i,j,x.act (op … i j) x = act j (act i x) |
---|
30 | }. |
---|
31 | |
---|
32 | record concrete_transition_sys : Type[2] ≝ |
---|
33 | { trans_sys :> abstract_status |
---|
34 | }. |
---|
35 | |
---|
36 | record abstract_transition_sys : Type[1] ≝ |
---|
37 | { abs_state_t :> Type[0] |
---|
38 | ; abs_instr : monoid |
---|
39 | ; act_abs : monoid_action abs_instr abs_state_t |
---|
40 | }. |
---|
41 | |
---|
42 | notation "〚 term 19 C 〛 term 90 A" with precedence 10 for @{ 'sem $C $A }. |
---|
43 | interpretation "act_abs" 'sem f x = (act ?? (act_abs ?) f x). |
---|
44 | |
---|
45 | record galois_rel (C : concrete_transition_sys) |
---|
46 | (A : abstract_transition_sys) : Type[0] ≝ |
---|
47 | { rel_galois :2> C → A → Prop |
---|
48 | }. |
---|
49 | |
---|
50 | record galois_connection : Type[2] ≝ |
---|
51 | { concr : concrete_transition_sys |
---|
52 | ; abs_d : abstract_transition_sys |
---|
53 | ; galois_rel:> galois_rel concr abs_d |
---|
54 | }. |
---|
55 | |
---|
56 | record abstract_interpretation : Type[2] ≝ |
---|
57 | { galois_conn:> galois_connection |
---|
58 | ; instr_t : Type[0] |
---|
59 | ; fetch : concr galois_conn → option instr_t |
---|
60 | ; instr_map : instr_t → abs_instr … (abs_d galois_conn) |
---|
61 | ; instr_map_ok : |
---|
62 | ∀s,s': concr … galois_conn. ∀a: abs_d … galois_conn.∀l,i. |
---|
63 | as_execute … l s s' → |
---|
64 | fetch … s = Some ? i → |
---|
65 | ∀I. instr_map … i = I → |
---|
66 | galois_conn s a → galois_conn s' (〚I〛 a) |
---|
67 | }. |
---|