Skip to content

Commit

Permalink
add Factorial exercise
Browse files Browse the repository at this point in the history
  • Loading branch information
kamalfarahani committed Jul 24, 2021
1 parent 312f81f commit 9d49fa9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions plf/Hoare2.v
Original file line number Diff line number Diff line change
Expand Up @@ -1010,18 +1010,18 @@ Qed.
Excluding both operations from your loop invariant is advisable.
{{ X = m }} ->>
{{ }}
{{ 1 * X! = m! }}
Y := 1;
{{ }}
{{ Y * X! = m! }}
while ~(X = 0)
do {{ }} ->>
{{ }}
do {{ Y * X! = m! && X <> 0 }} ->>
{{ (Y * X) * (X - 1)! = m! }}
Y := Y * X;
{{ }}
{{ Y * (X - 1)! = m! }}
X := X - 1
{{ }}
{{ Y * X! = m! }}
end
{{ }} ->>
{{ Y * X! = m! && X = 0 }} ->>
{{ Y = m! }}
Briefly justify each use of [->>].
Expand Down

0 comments on commit 9d49fa9

Please sign in to comment.