[3458] | 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 | ; cost_mon : monoid |
---|
| 35 | ; cost_of : trans_sys → cost_mon |
---|
| 36 | }. |
---|
| 37 | |
---|
| 38 | record abstract_transition_sys (concrete_costs : Type[0]) : Type[1] ≝ |
---|
| 39 | { abs_state_t :> Type[0] |
---|
| 40 | ; abs_instr : monoid |
---|
| 41 | ; act_abs : monoid_action abs_instr abs_state_t |
---|
| 42 | ; abs_cost : abs_state_t → concrete_costs |
---|
| 43 | }. |
---|
| 44 | |
---|
[3500] | 45 | notation "〚 term 19 C 〛 term 90 A" with precedence 10 for @{ 'sem $C $A }. |
---|
| 46 | interpretation "act_abs" 'sem f x = (act ?? (act_abs ??) f x). |
---|
| 47 | |
---|
| 48 | record galois_rel (C : concrete_transition_sys) |
---|
[3458] | 49 | (A : abstract_transition_sys (cost_mon C)) : Type[0] ≝ |
---|
| 50 | { rel_galois :2> C → A → Prop |
---|
| 51 | ; rel_galois_cost : ∀s,a.rel_galois … s a → abs_cost … a = cost_of … s |
---|
| 52 | }. |
---|
| 53 | |
---|
[3500] | 54 | record galois_connection : Type[2] ≝ |
---|
[3458] | 55 | { concr : concrete_transition_sys |
---|
| 56 | ; abs_d : abstract_transition_sys (cost_mon concr) |
---|
[3500] | 57 | ; galois_rel:> galois_rel concr abs_d |
---|
[3458] | 58 | }. |
---|
| 59 | |
---|
[3500] | 60 | record abstract_interpretation : Type[2] ≝ |
---|
| 61 | { galois_conn:> galois_connection |
---|
| 62 | ; instr_t : Type[0] |
---|
| 63 | ; fetch : concr galois_conn → option instr_t |
---|
| 64 | ; instr_map : instr_t → abs_instr … (abs_d galois_conn) |
---|
| 65 | ; instr_map_ok : |
---|
| 66 | ∀s,s': concr … galois_conn. ∀a: abs_d … galois_conn.∀l,i. |
---|
| 67 | as_execute … l s s' → |
---|
| 68 | fetch … s = Some ? i → |
---|
| 69 | ∀I. instr_map … i = I → |
---|
| 70 | galois_conn s a → galois_conn s' (〚I〛 a) |
---|
| 71 | }. |
---|