Theory list_reverse
theory list_reverse
imports "AutoCorres2.CTranslation" "MachineWords"
begin
declare hrs_simps [simp add]
declare exists_left [simp add]
declare sep_conj_ac [simp add]
primrec
list :: "machine_word list ⇒ machine_word ptr ⇒ heap_state ⇒ bool"
where
"list [] i = (λs. i=NULL ∧ □ s)"
| "list (x#xs) i = (λs. i=Ptr x ∧ x≠0 ∧ (∃j. ((i ↦ j) ∧⇧* list xs (Ptr j)) s))"
lemma list_empty [simp]:
shows "list xs NULL = (λs. xs = [] ∧ □ s)"
by (cases xs) (auto dest!: sep_conj_mapD)
declare sep_conj_com [simp del]
declare sep_conj_left_com [simp del]