Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refill_budget_check_ccorres #821

Open
wants to merge 2 commits into
base: rt
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/Word_Lib/Word_32.thy
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ lemma word32_and_max_simp:
using word_and_full_mask_simp [of x]
by (simp add: numeral_eq_Suc mask_Suc_exp)

lemma max_minus_one_word32:
michaelmcinerney marked this conversation as resolved.
Show resolved Hide resolved
"(0xFFFFFFFF :: word32) = - 1"
by (simp add: maxBound_word)

end

end
4 changes: 4 additions & 0 deletions lib/Word_Lib/Word_64.thy
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ lemma word64_and_max_simp:
using word_and_full_mask_simp [of x]
by (simp add: numeral_eq_Suc mask_Suc_exp)

lemma max_minus_one_word64:
"(0xFFFFFFFFFFFFFFFF :: word64) = - 1"
by (simp add: maxBound_word)

end

end
84 changes: 0 additions & 84 deletions proof/crefine/RISCV64/SchedContext_C.thy
Original file line number Diff line number Diff line change
Expand Up @@ -11,90 +11,6 @@ begin

context kernel_m begin

lemma getRefillSize_exs_valid[wp]:
"\<lbrace>(=) s\<rbrace> getRefillSize scPtr \<lbrace>\<lambda>r. (=) s\<rbrace>"
by (wpsimp simp: getRefillSize_def)

crunch getRefillSize
for (empty_fail) empty_fail[wp]

lemma refill_add_tail_ccorres:
"ccorres dc xfdc
(active_sc_at' scPtr and invs')
(\<lbrace>\<acute>sc = Ptr scPtr\<rbrace> \<inter> {s'. crefill_relation new (refill_' s')}) []
(refillAddTail scPtr new) (Call refill_add_tail_'proc)"
supply sched_context_C_size[simp del] refill_C_size[simp del] len_bit0[simp del]

apply (simp add: refillAddTail_def)
apply (rule ccorres_symb_exec_l'[rotated, OF _ getRefillSize_sp]; wpsimp)
apply (rule ccorres_symb_exec_l'[rotated, OF _ get_sc_sp']; wpsimp?)
apply (rule ccorres_symb_exec_l'[rotated, OF _ assert_sp]; wpsimp)

apply (cinit' lift: sc_' refill_' simp: updateRefillIndex_def)
apply (rule ccorres_move_c_guard_sc)
apply (ctac add: refill_next_ccorres)
apply (rule ccorres_move_c_guard_sc)
apply clarsimp
apply (rule ccorres_split_nothrow[where r'=dc and xf'=xfdc])
apply (rule_tac P=\<top> in updateSchedContext_ccorres_lemma2)
apply vcg
apply fastforce
apply clarsimp
apply (rule_tac sc'="scRefillTail_C_update (\<lambda>_. new_tail) sc'"
in rf_sr_sc_update_no_refill_buffer_update2;
fastforce?)
apply (clarsimp simp: typ_heap_simps')
apply (clarsimp simp: csched_context_relation_def)
apply (fastforce intro: refill_buffer_relation_sc_no_refills_update)
apply ceqv
apply (rule_tac P="\<lambda>sc. scRefillTail sc = unat new_tail"
and P'="active_sc_at' scPtr and invs'"
in updateSchedContext_ccorres_lemma3)
apply vcg
apply fastforce
apply normalise_obj_at'
apply (frule (1) sc_ko_at_valid_objs_valid_sc'[OF _ invs_valid_objs'])
apply (intro conjI)
apply (fastforce dest: sc_at_h_t_valid[rotated])
apply (rule disjCI2)
apply (rule_tac n="length (scRefills sc)" in array_assertion_shrink_right)
apply (fastforce intro: sc_at_array_assertion'
simp: valid_sched_context'_def MIN_REFILLS_def)
apply (clarsimp simp: typ_heap_simps valid_sched_context'_def obj_at_simps
active_sc_at'_def csched_context_relation_def)
apply (frule rf_sr_refill_buffer_relation)
apply (frule_tac n="scRefillTail sc" in h_t_valid_refill; fastforce?)
apply (clarsimp simp: valid_sched_context'_def active_sc_at'_def obj_at'_def)
apply fastforce
apply (clarsimp simp: sc_ptr_to_crefill_ptr_def typ_heap_simps csched_context_relation_def)
apply (clarsimp simp: ret__ptr_to_struct_refill_C_'_update_rf_sr_helper
cong: StateSpace.state.fold_congs)
apply (rule_tac old_sc=sc and n="scRefillTail sc" and refill=new and refill'=refill
in rf_sr_refill_update2;
fastforce?)
apply (clarsimp simp: valid_sched_context'_def active_sc_at'_def obj_at'_def)
apply (fastforce simp: sched_context.expand)
apply (clarsimp simp: typ_heap_simps sc_ptr_to_crefill_ptr_def csched_context_relation_def)
apply (clarsimp simp: csched_context_relation_def)
apply ((rule hoare_vcg_conj_lift
| wpsimp wp: updateSchedContext_active_sc_at' updateSchedContext_refills_invs'
| wpsimp wp: updateSchedContext_wp)+)[1]
apply vcg
apply (wpsimp wp: getRefillNext_wp)
apply vcg
apply normalise_obj_at'
apply (frule (1) sc_ko_at_valid_objs_valid_sc'[OF _ invs_valid_objs'])
apply (elim conjE)
apply (frule (1) length_scRefills_bounded)
apply (intro conjI)
apply fastforce
apply (clarsimp simp: valid_sched_context'_def word_bits_len_of refillSizeBytes_def)
apply (fastforce simp: obj_at'_def objBits_simps opt_map_def ps_clear_def)
apply (fastforce simp: valid_sched_context'_def refillNext_def refillSize_def split: if_splits)
apply (clarsimp simp: valid_sched_context_size'_def)
apply (fastforce dest: obj_at_cslift_sc simp: csched_context_relation_def typ_heap_simps)
done

lemma maybe_add_empty_tail_ccorres:
"ccorres dc xfdc
(active_sc_at' scPtr and invs') \<lbrace>\<acute>sc = Ptr scPtr\<rbrace> []
Expand Down
Loading