Skip to content
Snippets Groups Projects
Commit fc43b4fa authored by Robbert Krebbers's avatar Robbert Krebbers
Browse files

Make indentation consistent.

parent d26f21ed
No related branches found
No related tags found
No related merge requests found
...@@ -137,7 +137,8 @@ Section proof. ...@@ -137,7 +137,8 @@ Section proof.
}}} }}}
array_init_loop #l #i #n f @ stk; E array_init_loop #l #i #n f @ stk; E
{{{ vs, RET #(); {{{ vs, RET #();
length vs = k (l + i) ↦∗ vs [ list] jv vs, Q (i + j) v }}}. length vs = k (l + i) ↦∗ vs [ list] jv vs, Q (i + j) v
}}}.
Proof. Proof.
iIntros (Hn Φ) "[Hl Hf] HΦ". iIntros (Hn Φ) "[Hl Hf] HΦ".
iInduction k as [|k] "IH" forall (i Hn); simplify_eq/=; wp_rec; wp_pures. iInduction k as [|k] "IH" forall (i Hn); simplify_eq/=; wp_rec; wp_pures.
...@@ -163,7 +164,8 @@ Section proof. ...@@ -163,7 +164,8 @@ Section proof.
}]] }]]
array_init_loop #l #i #n f @ stk; E array_init_loop #l #i #n f @ stk; E
[[{ vs, RET #(); [[{ vs, RET #();
length vs = k (l + i) ↦∗ vs [ list] jv vs, Q (i + j) v }]]. length vs = k (l + i) ↦∗ vs [ list] jv vs, Q (i + j) v
}]].
Proof. Proof.
iIntros (Hn Φ) "[Hl Hf] HΦ". iIntros (Hn Φ) "[Hl Hf] HΦ".
iInduction k as [|k] "IH" forall (i Hn); simplify_eq/=; wp_rec; wp_pures. iInduction k as [|k] "IH" forall (i Hn); simplify_eq/=; wp_rec; wp_pures.
...@@ -184,10 +186,13 @@ Section proof. ...@@ -184,10 +186,13 @@ Section proof.
Lemma wp_array_init stk E n f : Lemma wp_array_init stk E n f :
(0 < n)%Z (0 < n)%Z
{{{ [ list] i seq 0 (Z.to_nat n), WP f #(i : nat) @ stk; E {{ Q i }} }}} {{{
[ list] i seq 0 (Z.to_nat n), WP f #(i : nat) @ stk; E {{ Q i }}
}}}
array_init #n f @ stk; E array_init #n f @ stk; E
{{{ l vs, RET #l; {{{ l vs, RET #l;
Z.of_nat (length vs) = n l ↦∗ vs [ list] kv vs, Q k v }}}. Z.of_nat (length vs) = n l ↦∗ vs [ list] kv vs, Q k v
}}}.
Proof. Proof.
iIntros (Hn Φ) "Hf HΦ". wp_lam. wp_alloc l as "Hl"; first done. iIntros (Hn Φ) "Hf HΦ". wp_lam. wp_alloc l as "Hl"; first done.
wp_apply (wp_array_init_loop _ _ _ 0 n (Z.to_nat n) wp_apply (wp_array_init_loop _ _ _ 0 n (Z.to_nat n)
...@@ -199,10 +204,13 @@ Section proof. ...@@ -199,10 +204,13 @@ Section proof.
Qed. Qed.
Lemma twp_array_init stk E n f : Lemma twp_array_init stk E n f :
(0 < n)%Z (0 < n)%Z
[[{ [ list] i seq 0 (Z.to_nat n), WP f #(i : nat) @ stk; E [{ Q i }] }]] [[{
[ list] i seq 0 (Z.to_nat n), WP f #(i : nat) @ stk; E [{ Q i }]
}]]
array_init #n f @ stk; E array_init #n f @ stk; E
[[{ l vs, RET #l; [[{ l vs, RET #l;
Z.of_nat (length vs) = n l ↦∗ vs [ list] kv vs, Q k v }]]. Z.of_nat (length vs) = n l ↦∗ vs [ list] kv vs, Q k v
}]].
Proof. Proof.
iIntros (Hn Φ) "Hf HΦ". wp_lam. wp_alloc l as "Hl"; first done. iIntros (Hn Φ) "Hf HΦ". wp_lam. wp_alloc l as "Hl"; first done.
wp_apply (twp_array_init_loop _ _ _ 0 n (Z.to_nat n) wp_apply (twp_array_init_loop _ _ _ 0 n (Z.to_nat n)
...@@ -231,11 +239,14 @@ Section proof. ...@@ -231,11 +239,14 @@ Section proof.
Lemma wp_array_init_fmap stk E n f : Lemma wp_array_init_fmap stk E n f :
(0 < n)%Z (0 < n)%Z
{{{ [ list] i seq 0 (Z.to_nat n), {{{
WP f #(i : nat) @ stk; E {{ v, x, v = g x Q i x }} }}} [ list] i seq 0 (Z.to_nat n),
WP f #(i : nat) @ stk; E {{ v, x, v = g x Q i x }}
}}}
array_init #n f @ stk; E array_init #n f @ stk; E
{{{ l xs, RET #l; {{{ l xs, RET #l;
Z.of_nat (length xs) = n l ↦∗ (g <$> xs) [ list] kx xs, Q k x }}}. Z.of_nat (length xs) = n l ↦∗ (g <$> xs) [ list] kx xs, Q k x
}}}.
Proof. Proof.
iIntros (Hn Φ) "Hf HΦ". iApply (wp_array_init with "Hf"); first done. iIntros (Hn Φ) "Hf HΦ". iApply (wp_array_init with "Hf"); first done.
iIntros "!>" (l vs). iDestruct 1 as (<-) "[Hl Hvs]". iIntros "!>" (l vs). iDestruct 1 as (<-) "[Hl Hvs]".
...@@ -244,11 +255,14 @@ Section proof. ...@@ -244,11 +255,14 @@ Section proof.
Qed. Qed.
Lemma twp_array_init_fmap stk E n f : Lemma twp_array_init_fmap stk E n f :
(0 < n)%Z (0 < n)%Z
[[{ [ list] i seq 0 (Z.to_nat n), [[{
WP f #(i : nat) @ stk; E [{ v, x, v = g x Q i x }] }]] [ list] i seq 0 (Z.to_nat n),
WP f #(i : nat) @ stk; E [{ v, x, v = g x Q i x }]
}]]
array_init #n f @ stk; E array_init #n f @ stk; E
[[{ l xs, RET #l; [[{ l xs, RET #l;
Z.of_nat (length xs) = n l ↦∗ (g <$> xs) [ list] kx xs, Q k x }]]. Z.of_nat (length xs) = n l ↦∗ (g <$> xs) [ list] kx xs, Q k x
}]].
Proof. Proof.
iIntros (Hn Φ) "Hf HΦ". iApply (twp_array_init with "Hf"); first done. iIntros (Hn Φ) "Hf HΦ". iApply (twp_array_init with "Hf"); first done.
iIntros (l vs). iDestruct 1 as (<-) "[Hl Hvs]". iIntros (l vs). iDestruct 1 as (<-) "[Hl Hvs]".
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment