@@ -69,46 +69,50 @@ inductive_cases unrepVariableE:
69
69
inductive_cases unrepConstVarE :
70
70
"unrep g (ConstantVar c) (g', nid)"
71
71
72
+ lemma uniqueDet :
73
+ assumes "unique g e (g'\<^sub>1, nid\<^sub>1)"
74
+ assumes "unique g e (g'\<^sub>2, nid\<^sub>2)"
75
+ shows "g'\<^sub>1 = g'\<^sub>2 \<and> nid\<^sub>1 = nid\<^sub>2"
76
+ using assms apply ( induction )
77
+ apply ( metis Pair_inject assms ( 1 ) assms ( 2 ) option.distinct ( 1 ) option.inject unique.cases )
78
+ by ( metis Pair_inject assms ( 1 ) assms ( 2 ) option.discI option.inject unique.cases )
79
+
72
80
lemma unrepDet :
73
81
assumes "unrep g e (g'\<^sub>1, nid\<^sub>1)"
74
82
assumes "unrep g e (g'\<^sub>2, nid\<^sub>2)"
75
83
shows "g'\<^sub>1 = g'\<^sub>2 \<and> nid\<^sub>1 = nid\<^sub>2"
76
84
using assms proof ( induction e arbitrary : g g' \<^sub >1 nid \<^sub >1 g' \<^sub >2 nid \<^sub >2 )
77
- case ( UnaryExpr op e )
78
- then obtain g' x where "g \<oplus> e \<leadsto> (g', x)"
79
- by ( meson unrepUnaryE )
80
- then have "\<forall>gg xx. g \<oplus> e \<leadsto> (gg, xx) \<longrightarrow> g' = gg \<and> x = xx"
81
- by ( simp add : UnaryExpr.IH )
85
+ case ( UnaryExpr op e )
82
86
then show ?case
83
- by ( smt ( verit , best ) UnaryExpr.prems ( 1 ) UnaryExpr.prems ( 2 ) option.discI option.inject unrepUnaryE )
87
+ by ( smt ( verit , best ) uniqueDet unrepUnaryE )
84
88
next
85
89
case ( BinaryExpr x1 e1 e2 )
86
90
then show ?case
87
- by ( smt ( verit ) option.distinct ( 1 ) option.inject unrepBinaryE )
91
+ by ( smt ( verit , best ) uniqueDet unrepBinaryE )
88
92
next
89
93
case ( ConditionalExpr e1 e2 e3 )
90
94
then show ?case
91
- by ( smt ( verit ) option.distinct ( 1 ) option.inject unrepConditionalE )
95
+ by ( smt ( verit , best ) uniqueDet unrepConditionalE )
92
96
next
93
97
case ( ParameterExpr x1 x2 )
94
98
then show ?case
95
- by ( smt ( verit ) option.distinct ( 1 ) option.inject unrepParamE )
99
+ by ( smt ( verit , best ) uniqueDet unrepParamE )
96
100
next
97
101
case ( LeafExpr x1 x2 )
98
102
then show ?case
99
- by ( smt ( verit ) option.distinct ( 1 ) option.inject unrepLeafE )
103
+ by ( smt ( verit , best ) uniqueDet unrepLeafE )
100
104
next
101
105
case ( ConstantExpr x )
102
106
then show ?case
103
- by ( smt ( verit ) option.distinct ( 1 ) option.inject unrepConstE )
107
+ by ( smt ( verit , best ) uniqueDet unrepConstE )
104
108
next
105
109
case ( ConstantVar x )
106
110
then show ?case
107
- by ( smt ( verit ) option.distinct ( 1 ) option.inject unrepConstVarE )
111
+ by ( smt ( verit , best ) uniqueDet unrepConstVarE )
108
112
next
109
113
case ( VariableExpr x1 x2 )
110
114
then show ?case
111
- by ( smt ( verit ) option.distinct ( 1 ) option.inject unrepVariableE )
115
+ by ( smt ( verit , best ) uniqueDet unrepVariableE )
112
116
qed
113
117
114
118
@@ -183,9 +187,13 @@ lemma
183
187
qed
184
188
*)
185
189
190
+ lemma insertConstUnique :
191
+ "\<exists>g' nid'. unique g (ConstantNode c, s) (g', nid')"
192
+ by ( meson not_None_eq unique.simps )
193
+
186
194
lemma insertConst :
187
195
"\<exists>g' nid'. unrep g (ConstantExpr c) (g', nid')"
188
- by ( meson not_None_eq unrep.intros ( 1 ) unrep.intros ( 2 ))
196
+ using UnrepConstantNode insertConstUnique by blast
189
197
190
198
lemma constantConditionTrue :
191
199
assumes "kind g ifcond = IfNode cond t f"
@@ -197,9 +205,9 @@ proof -
197
205
obtain g'' nid' where unrep : "unrep g (ConstantExpr (bool_to_val_width1 True)) (g'', nid')"
198
206
using insertConst by blast
199
207
then have "kind g'' nid' = ConstantNode (bool_to_val_width1 True)"
200
- by ( smt ( verit ) ConstUnrepE IRExpr.simps ( 18 ) IRExpr.simps ( 30 ) IRExpr.simps ( 40 ) IRExpr.simps ( 48 ) IRExpr.simps ( 54 ) IRExpr.simps ( 6 ) IRNode.simps ( 1141 ) find_exists_kind find_new_kind option. distinct( 1 ) option.inject unrep.simps )
208
+ by ( meson ConstUnrepE IRNode.distinct ( 1077 ) unique_kind )
201
209
also have "nid' \<noteq> ifcond"
202
- by ( smt ( verit ) IRExpr.simps ( 18 ) IRExpr.simps ( 30 ) IRExpr.simps ( 40 ) IRNode.distinct ( 981 ) \<open>g::IRGraph \<oplus> ConstantExpr (bool_to_val_width1 True) \<leadsto> (g''::IRGraph, nid'::nat)\<close> assms ( 1 ) calculation fresh_ids ifn not_in_g prod.inject unrep.simps )
210
+ by ( metis ConstUnrepE IRNode.distinct ( 981 ) assms ( 1 ) calculation fresh_ids ids_some ifn unique.cases unrep unrepDet )
203
211
moreover have "g' = replace_node ifcond (IfNode nid' t f, stamp g ifcond) g''"
204
212
using assms constantCondition_sem unrep by presburger
205
213
moreover have "kind g' nid' = ConstantNode (bool_to_val_width1 True)"
@@ -223,10 +231,10 @@ proof -
223
231
by fastforce
224
232
then have "[g', m, p] \<turnstile> nid' \<mapsto> IntVal 1 1"
225
233
using Value.distinct ( 1 ) \<open>kind g' nid' = ConstantNode (bool_to_val_width1 True)\<close>
226
- by ( metis bool_to_val_width1.simps ( 1 ) wf_value_def encodeeval_def ConstantExpr ConstantNode )
234
+ by ( metis bool_to_val_width1.simps ( 1 ) wf_value_def encodeeval.simps ConstantExpr ConstantNode )
227
235
from if ' c' show ?thesis
228
236
by ( metis ( no_types , opaque_lifting ) val_to_bool.simps ( 1 ) \<open>[g',m,p] \<turnstile> nid' \<mapsto> IntVal 1 1\<close>
229
- encodeeval_def zero_neq_one IfNode )
237
+ zero_neq_one IfNode )
230
238
qed
231
239
232
240
lemma constantConditionFalse :
@@ -239,11 +247,11 @@ proof -
239
247
obtain g'' nid' where unrep : "unrep g (ConstantExpr (bool_to_val_width1 False)) (g'', nid')"
240
248
using insertConst by blast
241
249
also have "kind g'' nid' = ConstantNode (bool_to_val_width1 False)"
242
- by ( smt ( verit ) IRExpr.sel ( 14 ) IRExpr.simps ( 18 ) IRExpr.simps ( 30 ) IRExpr.simps ( 40 ) IRExpr.simps ( 48 ) IRExpr.simps ( 54 ) IRNode.distinct ( 1077 ) find_exists_kind find_new_kind unrep unrep.simps unrepDet )
250
+ by ( meson ConstUnrepE IRNode.distinct ( 1077 ) unique_kind unrep )
243
251
moreover have "nid' \<noteq> ifcond"
244
- by ( smt ( verit ) IRExpr.simps ( 18 ) IRExpr.simps ( 30 ) IRExpr.simps ( 40 ) IRNode.distinct ( 981 ) assms ( 1 ) calculation fresh_ids ifn not_in_g prod.inject unrep.simps )
252
+ by ( metis ConstUnrepE IRNode.distinct ( 981 ) assms ( 1 ) calculation ( 2 ) fresh_ids ids_some ifn unique.cases unrep unrepDet )
245
253
moreover have "g' = replace_node ifcond (IfNode nid' t f, stamp g ifcond) g''"
246
- using assms constantCondition_sem unrep by presburger
254
+ using assms ( 1 ) assms ( 2 ) constantCondition_sem unrep by presburger
247
255
moreover have "kind g' nid' = ConstantNode (bool_to_val_width1 False)"
248
256
using assms constantCondition.simps ( 1 ) replace_node_unchanged
249
257
by ( metis DiffI calculation ( 2 ) calculation ( 3 ) calculation ( 4 ) emptyE insert_iff unrep unrep_contains )
@@ -257,9 +265,9 @@ proof -
257
265
have "valid_value (IntVal 1 0) (constantAsStamp (IntVal 1 0))"
258
266
by auto
259
267
then have "[g', m, p] \<turnstile> nid' \<mapsto> IntVal 1 0"
260
- by ( meson ConstantExpr ConstantNode c' encodeeval_def wf_value_def )
268
+ by ( meson ConstantExpr ConstantNode c' encodeeval.simps wf_value_def )
261
269
from if ' c' show ?thesis
262
- by ( meson IfNode \<open>[g'::IRGraph,m::nat \<Rightarrow> Value,p::Value list] \<turnstile> nid'::nat \<mapsto> IntVal (1::nat) (0::64 word)\<close> encodeeval_def val_to_bool.simps ( 1 ))
270
+ by ( meson IfNode \<open>[g'::IRGraph,m::nat \<Rightarrow> Value,p::Value list] \<turnstile> nid'::nat \<mapsto> IntVal (1::nat) (0::64 word)\<close> encodeeval.simps val_to_bool.simps ( 1 ))
263
271
qed
264
272
265
273
lemma diff_forall :
@@ -299,8 +307,9 @@ lemma changeonly_ConstantExpr:
299
307
shows "changeonly {} g g'"
300
308
using assms
301
309
apply ( cases "find_node_and_stamp g (ConstantNode c, constantAsStamp c) = None" )
302
- apply ( smt ( verit , del_insts ) ConstantNodeNew add_changed changeonly.simps fresh_ids insertE unrepDet )
303
- by ( smt ( verit ) IRExpr.sel ( 14 ) IRExpr.simps ( 18 ) IRExpr.simps ( 30 ) IRExpr.simps ( 40 ) IRExpr.simps ( 48 ) changeonly.simps unrep.simps unrepDet )
310
+ apply ( smt ( verit , ccfv_threshold ) New add_node_as_set_eq changeonly.simps fresh_ids new_def not_excluded_keep_type order.refl uniqueDet unrepConstE unrep_preserves_contains )
311
+ by ( metis changeonly.simps unique.cases unrepConstE unrepDet )
312
+
304
313
305
314
lemma constantCondition_changeonly :
306
315
assumes "nid \<in> ids g"
@@ -346,15 +355,15 @@ lemma constantConditionValid:
346
355
proof ( cases "const" )
347
356
case True
348
357
have ifstep : "g, p \<turnstile> (ifcond, m, h) \<rightarrow> (t, m, h)"
349
- by ( meson IfNode True assms ( 1 , 2 , 3 ) encodeeval_def )
358
+ by ( meson IfNode True assms ( 1 , 2 , 3 ) encodeeval.simps )
350
359
have ifstep' : "g', p \<turnstile> (ifcond, m, h) \<rightarrow> (t, m, h)"
351
360
using constantConditionTrue True assms ( 1 , 4 ) by presburger
352
361
from ifstep ifstep' show ?thesis
353
362
using StutterStep by blast
354
363
next
355
364
case False
356
365
have ifstep : "g, p \<turnstile> (ifcond, m, h) \<rightarrow> (f, m, h)"
357
- by ( meson IfNode False assms ( 1 , 2 , 3 ) encodeeval_def )
366
+ by ( meson IfNode False assms ( 1 , 2 , 3 ) encodeeval.simps )
358
367
have ifstep' : "g', p \<turnstile> (ifcond, m, h) \<rightarrow> (f, m, h)"
359
368
using constantConditionFalse False assms ( 1 , 4 ) by presburger
360
369
from ifstep ifstep' show ?thesis
0 commit comments