You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$\textcolor{purple}{\texttt{Definition}}$parallel_inc_sum_locked(lock : val) : val.
One thread increases the given list by a given $n$. A second thread stores the list sum in a variable $sum$. Both threads acquire the same spinlock before executing their respective operation, and release it after. The function returns $sum$.
Invariant
$\textcolor{purple}{\texttt{Definition}}$inc_sum_inv(n : Z) (l : list Z) (v : val) : iProp$\Sigma$.
The function invariant states that there exists a list $l^\prime$ such that sum of $l$ is less than or equal to that of $l^\prime$, and separately, $v$ points to $l^\prime$.
$\textcolor{magenta}{\texttt{Theorem}}$parallel_inc_sum_locked_speclock l v (n : Z).
Pre-condition : is_lock lock with resource inc_sum_inv n l v, and separately, $n \geq 0$.
Function call : parallel_inc_sum_locked lock #n v.
Post-condition: The function returns an integer $m$ such that the list sum of $l$ is less than or equal to $m$.
References
All definitions and lemmas for "Lists" was taken from ex_02_sumlist.v distributed in the course.
All definitions and lemmas for "Spinlock" was taken from ex_03_spinlock.v distributed in the course.
No external references used.
About
Prove spec for a program that increases a list and sums it in parallel (Final project, CS 472, Spring 2024 @ UIC).