Revising before next lecture

This commit is contained in:
Adam Chlipala 2021-04-24 12:59:10 -04:00
parent b549b15af7
commit 513e01bd3b
3 changed files with 11 additions and 11 deletions

View file

@ -12,8 +12,8 @@ Set Asymmetric Patterns.
Definition heap := fmap nat nat.
Hint Extern 1 (_ <= _) => linear_arithmetic : core.
Hint Extern 1 (@eq nat _ _) => linear_arithmetic : core.
Local Hint Extern 1 (_ <= _) => linear_arithmetic : core.
Local Hint Extern 1 (@eq nat _ _) => linear_arithmetic : core.
Ltac simp := repeat (simplify; subst; propositional;
try match goal with
@ -376,7 +376,7 @@ Proof.
unfold star, himp in *; simp; eauto 7.
Qed.
Hint Constructors hoare_triple : core.
Local Hint Constructors hoare_triple : core.
Lemma invert_Bind : forall {result' result} (c1 : cmd result') (c2 : result' -> cmd result) P Q,
hoare_triple P (Bind c1 c2) Q
@ -785,7 +785,7 @@ Proof.
eauto using deallocate_None.
Qed.
Hint Constructors step : core.
Local Hint Constructors step : core.
Lemma progress : forall {result} (c : cmd result) P Q,
hoare_triple P c Q
@ -1313,7 +1313,7 @@ Proof.
simp.
Qed.
Hint Resolve move_along : core.
Local Hint Resolve move_along : core.
Theorem length_ok : forall p ls,
{{linkedList p ls}}

View file

@ -9,8 +9,8 @@ Notation "m $! k" := (match m $? k with Some n => n | None => O end) (at level 3
Definition heap := fmap nat nat.
Definition assertion := heap -> Prop.
Hint Extern 1 (_ <= _) => linear_arithmetic : core.
Hint Extern 1 (@eq nat _ _) => linear_arithmetic : core.
Local Hint Extern 1 (_ <= _) => linear_arithmetic : core.
Local Hint Extern 1 (@eq nat _ _) => linear_arithmetic : core.
Ltac simp := repeat (simplify; subst; propositional;
try match goal with
@ -601,7 +601,7 @@ Proof.
simp.
Qed.
Hint Resolve move_along : core.
Local Hint Resolve move_along : core.
Theorem length_ok : forall p ls,
{{linkedList p ls}}
@ -637,7 +637,7 @@ Proof.
unfold star, himp in *; simp; eauto 7.
Qed.
Hint Constructors hoare_triple : core.
Local Hint Constructors hoare_triple : core.
Lemma invert_Bind : forall {result' result} (c1 : cmd result') (c2 : result' -> cmd result) P Q,
hoare_triple P (Bind c1 c2) Q
@ -1033,7 +1033,7 @@ Proof.
eauto using deallocate_None.
Qed.
Hint Constructors step : core.
Local Hint Constructors step : core.
Lemma progress : forall {result} (c : cmd result) P Q,
hoare_triple P c Q

View file

@ -4314,7 +4314,7 @@ In our Hoare-logic examples so far, we have intentionally tread lightly when it
Generally, we have only worked with, for instance, a single array at a time.
Reasoning about multi-array programs usually depends on the fact that the arrays don't overlap in memory at all.
Things are even more complicated with linked data structures, like linked lists and trees, which we haven't even attempted up to now.
However, by using \emph{separation logic}\index{separation logic}, a popular variant of Hoare logic, we will find it quite pleasant to prove programs that used linked structures, with no need for explicit reasoning about aliasing, assuming that we keep all of our data structures disjoint from each other through simple coding patterns.
However, by using \emph{separation logic}\index{separation logic}, a popular variant of Hoare logic, we will find it quite pleasant to prove programs that use linked structures, with no need for explicit reasoning about aliasing, assuming that we keep all of our data structures disjoint from each other through simple coding patterns.
\section{An Object Language with Dynamic Memory Allocation}