source: src/ASM/StatusProofs.ma @ 1606

Last change on this file since 1606 was 1606, checked in by sacerdot, 6 years ago

Porting to last library of Matita.

File size: 9.2 KB
Line 
1include "ASM/Status.ma".
2
3lemma get_register_set_program_counter:
4 ∀T,s,pc. get_register T (set_program_counter … s pc) = get_register … s.
5 #T #s #pc %
6qed.
7
8lemma get_8051_sfr_set_program_counter:
9 ∀T,s,pc. get_8051_sfr T (set_program_counter … s pc) = get_8051_sfr … s.
10 #T #s #pc %
11qed.
12
13lemma get_bit_addressable_sfr_set_program_counter:
14 ∀T,s,pc. get_bit_addressable_sfr T (set_program_counter … s pc) = get_bit_addressable_sfr … s.
15 #T #s #pc %
16qed.
17
18lemma low_internal_ram_set_program_counter:
19 ∀T,s,pc. low_internal_ram T (set_program_counter … s pc) = low_internal_ram … s.
20 #T #s #pc %
21qed.
22
23example get_arg_8_set_program_counter:
24 ∀n.∀l:Vector addressing_mode_tag (S n).
25  ∀T,s,pc,b.∀arg:l.
26   ∀prf:is_in ?
27    [[direct;indirect;registr;acc_a;acc_b;data;acc_dptr;ext_indirect;ext_indirect_dptr]] arg.
28   get_arg_8 T (set_program_counter … s pc) b arg = get_arg_8 … s b arg.
29 [ #n #l #T #s #pc #b * *; #X try (#Y #H) try #H try % @⊥ @H
30 | cases arg in prf; *; normalize //
31 | skip ]
32qed.
33
34lemma set_bit_addressable_sfr_set_code_memory:
35  ∀T, U: Type[0].
36  ∀ps: PreStatus ?.
37  ∀code_mem.
38  ∀x.
39  ∀val.
40  set_bit_addressable_sfr ? (set_code_memory T U ps code_mem) x val =
41  set_code_memory T U (set_bit_addressable_sfr ? ps x val) code_mem.
42  #T #U #ps #code_mem #x #val
43  whd in ⊢ (??%?);
44  whd in ⊢ (???(???%?));
45  cases (eqb ? 128) [ normalize nodelta cases not_implemented
46  | normalize nodelta
47  cases (eqb (nat_of_bitvector 8 x) ?) [ normalize nodelta cases not_implemented
48  | normalize nodelta
49  cases (eqb (nat_of_bitvector 8 x) ?) [ normalize nodelta cases not_implemented
50  | normalize nodelta
51  cases (eqb ? 176) [ normalize nodelta %
52  | normalize nodelta
53  cases (eqb ? 153) [ normalize nodelta %
54  | normalize nodelta
55  cases (eqb ? 138) [ normalize nodelta %
56  | normalize nodelta
57  cases (eqb ? 139) [ normalize nodelta %
58  | normalize nodelta
59  cases (eqb ? 140) [ normalize nodelta %
60  | normalize nodelta
61  cases (eqb ? 141) [ normalize nodelta %
62  | normalize nodelta
63  cases (eqb ? 200) [ normalize nodelta %
64  | normalize nodelta
65  cases (eqb ? 202) [ normalize nodelta %
66  | normalize nodelta
67  cases (eqb ? 203) [ normalize nodelta %
68  | normalize nodelta
69  cases (eqb ? 204) [ normalize nodelta %
70  | normalize nodelta
71  cases (eqb ? 205) [ normalize nodelta %
72  | normalize nodelta
73  cases (eqb ? 135) [ normalize nodelta %
74  | normalize nodelta
75  cases (eqb ? 136) [ normalize nodelta %
76  | normalize nodelta
77  cases (eqb ? 137) [ normalize nodelta %
78  | normalize nodelta
79  cases (eqb ? 152) [ normalize nodelta %
80  | normalize nodelta
81  cases (eqb ? 168) [ normalize nodelta %
82  | normalize nodelta
83  cases (eqb ? 184) [ normalize nodelta %
84  | normalize nodelta
85  cases (eqb ? 129) [ normalize nodelta %
86  | normalize nodelta
87  cases (eqb ? 130) [ normalize nodelta %
88  | normalize nodelta
89  cases (eqb ? 131) [ normalize nodelta %
90  | normalize nodelta
91  cases (eqb ? 208) [ normalize nodelta %
92  | normalize nodelta
93  cases (eqb ? 224) [ normalize nodelta %
94  | normalize nodelta
95  cases (eqb ? 240) [ normalize nodelta %
96  | normalize nodelta
97    cases not_implemented
98  ]]]]]]]]]]]]]]]]]]]]]]]]]]
99qed.
100
101example set_arg_8_set_code_memory:
102  ∀n:nat.
103  ∀l:Vector addressing_mode_tag (S n).
104    ∀T: Type[0].
105    ∀U: Type[0].
106    ∀ps: PreStatus ?.
107    ∀code_mem.
108    ∀val.
109    ∀b: l.
110    ∀prf:is_in ?
111     [[direct;indirect;registr;acc_a;acc_b;ext_indirect;ext_indirect_dptr]] b.
112  set_arg_8 ? (set_code_memory T U ps code_mem) b val =
113  set_code_memory T U (set_arg_8 ? ps b val) code_mem.
114  [2,3: cases b in prf; *; normalize //]
115  #n #l #T #U #ps #code_mem #val * *;
116  #x try (#y #H) try #H whd in H; try cases H try %
117  whd in match set_arg_8; normalize nodelta
118  whd in match set_arg_8'; normalize nodelta
119  cases (split bool 4 4 ?) #nu' #nl' normalize nodelta
120  cases (split bool 1 3 nu') #bit1' #ignore' normalize nodelta
121  cases (get_index_v bool 4 nu' 0 ?) normalize nodelta
122  try % @set_bit_addressable_sfr_set_code_memory
123qed.
124
125example set_arg_8_set_program_counter:
126  ∀n:nat.
127  ∀l:Vector addressing_mode_tag (S n).
128    ∀T: Type[0].
129    ∀ps: PreStatus ?.
130    ∀pc.
131    ∀val.
132    ∀b: l.
133    ∀prf:is_in ?
134     [[direct;indirect;registr;acc_a;acc_b;ext_indirect;ext_indirect_dptr]] b.
135  set_arg_8 ? (set_program_counter T ps pc) b val =
136  set_program_counter T (set_arg_8 ? ps b val) pc.
137  [2,3: cases b in prf; *; normalize //]
138  #n #l #T #ps #pc #val * *;
139  #x try (#y #H) try #H whd in H; try cases H try %
140  whd in match set_arg_8; normalize nodelta
141  whd in match set_arg_8'; normalize nodelta
142  cases (split bool 4 4 ?) #nu' #nl' normalize nodelta
143  cases (split bool 1 3 nu') #bit1' #ignore' normalize nodelta
144  cases (get_index_v bool 4 nu' 0 ?) normalize nodelta
145  try % cases daemon (*@(set_bit_addressable_sfr_set_program_counter)*)
146qed.
147 
148
149lemma get_arg_8_set_code_memory:
150 ∀T1,T2,s,code_mem,b,arg.
151   get_arg_8 T1 (set_code_memory T2 T1 s code_mem) b arg = get_arg_8 … s b arg.
152 #T1 #T2 #s #code_mem #b #arg %
153qed.
154
155lemma set_code_memory_set_flags:
156 ∀T1,T2,s,f1,f2,f3,code_mem.
157  set_code_memory T1 T2 (set_flags T1 s f1 f2 f3) code_mem =
158   set_flags … (set_code_memory … s code_mem) f1 f2 f3.
159 #T1 #T2 #s #f1 #f2 #f3 #code_mem %
160qed.
161
162lemma set_program_counter_set_flags:
163 ∀T1,s,f1,f2,f3,pc.
164  set_program_counter T1 (set_flags T1 s f1 f2 f3) pc =
165   set_flags … (set_program_counter … s pc) f1 f2 f3.
166 #T1 #s #f1 #f2 #f3 #pc  %
167qed.
168
169lemma program_counter_set_flags:
170 ∀T1,s,f1,f2,f3.
171  program_counter T1 (set_flags T1 s f1 f2 f3) = program_counter … s.
172 #T1 #s #f1 #f2 #f3 %
173qed.
174
175lemma special_function_registers_8051_write_at_stack_pointer:
176 ∀T,s,x.
177    special_function_registers_8051 T (write_at_stack_pointer T s x)
178  = special_function_registers_8051 T s.
179 #T #s #x whd in ⊢ (??(??%)?);
180 cases (split ????) #nu #nl normalize nodelta;
181 cases (get_index_v bool ????) %
182qed.
183
184lemma get_8051_sfr_write_at_stack_pointer:
185 ∀T,s,x,y. get_8051_sfr T (write_at_stack_pointer T s x) y = get_8051_sfr T s y.
186 #T #s #x #y whd in ⊢ (??%%); >special_function_registers_8051_write_at_stack_pointer @refl
187qed.
188
189lemma code_memory_write_at_stack_pointer:
190 ∀T,s,x. code_memory T (write_at_stack_pointer T s x) = code_memory T s.
191 #T #s #x whd in ⊢ (??(??%)?);
192 cases (split ????) #nu #nl normalize nodelta;
193 cases (get_index_v bool ????) %
194qed.
195
196lemma set_program_counter_set_low_internal_ram:
197 ∀T,s,x,y.
198  set_program_counter T (set_low_internal_ram … s x) y =
199   set_low_internal_ram … (set_program_counter … s y) x.
200 //
201qed.
202
203lemma set_clock_set_low_internal_ram:
204 ∀T,s,x,y.
205  set_clock T (set_low_internal_ram … s x) y =
206   set_low_internal_ram … (set_clock … s y) x.
207 //
208qed.
209
210lemma set_program_counter_set_high_internal_ram:
211 ∀T,s,x,y.
212  set_program_counter T (set_high_internal_ram … s x) y =
213   set_high_internal_ram … (set_program_counter … s y) x.
214 //
215qed.
216
217lemma set_clock_set_high_internal_ram:
218 ∀T,s,x,y.
219  set_clock T (set_high_internal_ram … s x) y =
220   set_high_internal_ram … (set_clock … s y) x.
221 //
222qed.
223
224lemma set_low_internal_ram_set_high_internal_ram:
225 ∀T,s,x,y.
226  set_low_internal_ram T (set_high_internal_ram … s x) y =
227   set_high_internal_ram … (set_low_internal_ram … s y) x.
228 //
229qed.
230
231lemma external_ram_write_at_stack_pointer:
232 ∀T,s,x. external_ram T (write_at_stack_pointer T s x) = external_ram T s.
233 #T #s #x whd in ⊢ (??(??%)?);
234 cases (split ????) #nu #nl normalize nodelta;
235 cases (get_index_v bool ????) %
236qed.
237
238lemma special_function_registers_8052_write_at_stack_pointer:
239 ∀T,s,x.
240    special_function_registers_8052 T (write_at_stack_pointer T s x)
241  = special_function_registers_8052 T s.
242 #T #s #x whd in ⊢ (??(??%)?);
243 cases (split ????) #nu #nl normalize nodelta;
244 cases (get_index_v bool ????) %
245qed.
246
247lemma p1_latch_write_at_stack_pointer:
248 ∀T,s,x. p1_latch T (write_at_stack_pointer T s x) = p1_latch T s.
249 #T #s #x whd in ⊢ (??(??%)?);
250 cases (split ????) #nu #nl normalize nodelta;
251 cases (get_index_v bool ????) %
252qed.
253
254lemma p3_latch_write_at_stack_pointer:
255 ∀T,s,x. p3_latch T (write_at_stack_pointer T s x) = p3_latch T s.
256 #T #s #x whd in ⊢ (??(??%)?);
257 cases (split ????) #nu #nl normalize nodelta;
258 cases (get_index_v bool ????) %
259qed.
260
261lemma clock_write_at_stack_pointer:
262 ∀T,s,x. clock T (write_at_stack_pointer T s x) = clock T s.
263 #T #s #x whd in ⊢ (??(??%)?);
264 cases (split ????) #nu #nl normalize nodelta;
265 cases (get_index_v bool ????) %
266qed.
267
268axiom get_index_v_set_index:
269 ∀T,n,x,m,p,y. get_index_v T n (set_index T n x m y p) m p = y.
270
271lemma get_8051_sfr_set_8051_sfr:
272 ∀T,s,x,y. get_8051_sfr T (set_8051_sfr ? s x y) x = y.
273 #T *; #A #B #C #D #E #F #G #H #I #J *; #y whd in ⊢ (??(??%?)?);
274 whd in match get_8051_sfr; normalize nodelta @get_index_v_set_index
275qed.
276
277lemma program_counter_set_8051_sfr:
278 ∀T,s,x,y. program_counter T (set_8051_sfr ? s x y) = program_counter ? s.
279 //
280qed.
281
282axiom get_arg_8_set_low_internal_ram:
283 ∀M,s,x,b,z. get_arg_8 M (set_low_internal_ram ? s x) b z = get_arg_8 ? s b z.
284
285lemma split_eq_status:
286 ∀T.
287 ∀A1,A2,A3,A4,A5,A6,A7,A8,A9,A10.
288 ∀B1,B2,B3,B4,B5,B6,B7,B8,B9,B10.
289  A1=B1 → A2=B2 → A3=B3 → A4=B4 → A5=B5 → A6=B6 → A7=B7 → A8=B8 → A9=B9 → A10=B10 →
290   mk_PreStatus T A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 =
291   mk_PreStatus T B1 B2 B3 B4 B5 B6 B7 B8 B9 B10.
292 //
293qed.
Note: See TracBrowser for help on using the repository browser.