equal
deleted
inserted
replaced
100 "plus_parity x Either = Either" |
100 "plus_parity x Either = Either" |
101 |
101 |
102 text{* First we instantiate the abstract value interface and prove that the |
102 text{* First we instantiate the abstract value interface and prove that the |
103 functions on type @{typ parity} have all the necessary properties: *} |
103 functions on type @{typ parity} have all the necessary properties: *} |
104 |
104 |
105 interpretation Val_semilattice |
105 permanent_interpretation Val_semilattice |
106 where \<gamma> = \<gamma>_parity and num' = num_parity and plus' = plus_parity |
106 where \<gamma> = \<gamma>_parity and num' = num_parity and plus' = plus_parity |
107 proof txt{* of the locale axioms *} |
107 proof txt{* of the locale axioms *} |
108 fix a b :: parity |
108 fix a b :: parity |
109 assume "a \<le> b" thus "\<gamma>_parity a \<subseteq> \<gamma>_parity b" |
109 assume "a \<le> b" thus "\<gamma>_parity a \<subseteq> \<gamma>_parity b" |
110 by(auto simp: less_eq_parity_def) |
110 by(auto simp: less_eq_parity_def) |
121 |
121 |
122 text{* Instantiating the abstract interpretation locale requires no more |
122 text{* Instantiating the abstract interpretation locale requires no more |
123 proofs (they happened in the instatiation above) but delivers the |
123 proofs (they happened in the instatiation above) but delivers the |
124 instantiated abstract interpreter which we call @{text AI_parity}: *} |
124 instantiated abstract interpreter which we call @{text AI_parity}: *} |
125 |
125 |
126 interpretation Abs_Int |
126 permanent_interpretation Abs_Int |
127 where \<gamma> = \<gamma>_parity and num' = num_parity and plus' = plus_parity |
127 where \<gamma> = \<gamma>_parity and num' = num_parity and plus' = plus_parity |
128 defines aval_parity is aval' and step_parity is step' and AI_parity is AI |
128 defines aval_parity is aval' and step_parity is step' and AI_parity is AI |
129 .. |
129 .. |
130 |
130 |
131 |
131 |
152 value "show_acom (the(AI_parity test2_parity))" |
152 value "show_acom (the(AI_parity test2_parity))" |
153 |
153 |
154 |
154 |
155 subsubsection "Termination" |
155 subsubsection "Termination" |
156 |
156 |
157 interpretation Abs_Int_mono |
157 permanent_interpretation Abs_Int_mono |
158 where \<gamma> = \<gamma>_parity and num' = num_parity and plus' = plus_parity |
158 where \<gamma> = \<gamma>_parity and num' = num_parity and plus' = plus_parity |
159 proof |
159 proof |
160 case goal1 thus ?case |
160 case goal1 thus ?case |
161 by(induction a1 a2 rule: plus_parity.induct) |
161 by(induction a1 a2 rule: plus_parity.induct) |
162 (auto simp add:less_eq_parity_def) |
162 (auto simp add:less_eq_parity_def) |
163 qed |
163 qed |
164 |
164 |
165 definition m_parity :: "parity \<Rightarrow> nat" where |
165 definition m_parity :: "parity \<Rightarrow> nat" where |
166 "m_parity x = (if x = Either then 0 else 1)" |
166 "m_parity x = (if x = Either then 0 else 1)" |
167 |
167 |
168 interpretation Abs_Int_measure |
168 permanent_interpretation Abs_Int_measure |
169 where \<gamma> = \<gamma>_parity and num' = num_parity and plus' = plus_parity |
169 where \<gamma> = \<gamma>_parity and num' = num_parity and plus' = plus_parity |
170 and m = m_parity and h = "1" |
170 and m = m_parity and h = "1" |
171 proof |
171 proof |
172 case goal1 thus ?case by(auto simp add: m_parity_def less_eq_parity_def) |
172 case goal1 thus ?case by(auto simp add: m_parity_def less_eq_parity_def) |
173 next |
173 next |