(** * Trace erasure preserves spinlock clean and well-synchronized*)
From mathcomp.ssreflect Require Import ssreflect ssrbool ssrnat ssrfun eqtype seq fintype finfun.
Set Implicit Arguments.
(*NOTE: because of redefinition of [val], these imports must appear after Ssreflect eqtype.*)
Set Bullet Behavior "None".
Set Bullet Behavior "Strict Subproofs".
Module SpinLocksSC.
Open Scope nat.

(* Specifications: *)
Lemma event_erasure_action:
forall ev ev',
event_erasure ev ev' ->
action ev = action ev'.
Lemma memval_erasure_list_length:
forall mval mval',
ValErasure.memval_erasure_list mval mval' ->
length mval = length mval'.
Lemma event_erasure_location:
forall ev ev',
event_erasure ev ev' ->
location ev = location ev'.
Lemma event_erasure_sameLocation:
forall ev1 ev1' ev2 ev2',
event_erasure ev1 ev1' ->
event_erasure ev2 ev2' ->
sameLocation ev1' ev2' ->
sameLocation ev1 ev2.
Lemma trace_erasure_nth:
forall tr tr' i ev'
(Herased: trace_erasure tr tr')
(Hi: nth_error tr' i = Some ev'),
exists ev, nth_error tr i = Some ev /\
event_erasure ev ev'.
Lemma trace_erasure_nth':
forall tr tr' i ev
(Herased: trace_erasure tr tr')
(Hi: nth_error tr i = Some ev),
exists ev', nth_error tr' i = Some ev' /\
event_erasure ev ev'.
Lemma trace_erasure_spinlock_clean:
forall tr tr'
(Herased: trace_erasure tr tr')
(Hclean: spinlock_clean tr),
spinlock_clean tr'.
Lemma event_erasure_caction:
forall ev ev',
event_erasure ev ev' ->
caction ev' -> caction ev.
Lemma event_erasure_is_internal:
forall ev ev',
event_erasure ev ev' ->
is_internal ev = is_internal ev'.
Lemma event_erasure_is_external:
forall ev ev',
event_erasure ev ev' ->
is_external ev = is_external ev'.
Lemma event_erasure_thread_id:
forall ev ev',
event_erasure ev ev' ->
thread_id ev = thread_id ev'.
Lemma event_erasure_competes:
forall ev1 ev2 ev1' ev2'
(Herasure1: event_erasure ev1 ev1')
(Herasure2: event_erasure ev2 ev2'),
competes ev1' ev2' ->
competes ev1 ev2.
Lemma trace_erasure_spinlock_synchronized:
forall tr tr'
(Herased: trace_erasure tr tr')
(Hsync: spinlock_synchronized tr),
spinlock_synchronized tr'.