Skip to content

Commit 4b2f867

Browse files
author
Carmine Abate
committed
Definition of twoSC from Mastroeni & Pasqua SAS18
1 parent fd4c362 commit 4b2f867

File tree

2 files changed

+59
-19
lines changed

2 files changed

+59
-19
lines changed

Criteria.v

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -259,17 +259,25 @@ Theorem R2SCHC_R2SCHP : R2SCHC <-> R2SCHP.
259259
Proof.
260260
split.
261261
- intros ssc P H HH. rewrite contra_RHP. intros [C' H0].
262-
specialize (ssc P C'). unfold twoSC in HH. destruct HH as [t1 [t2 HH]].
263-
specialize (ssc t1 t2). destruct ssc as [C h0].
264-
split; firstorder.
265-
exists C. firstorder.
266-
- unfold R2SCHC. intros h0 P C' t1 t2 [H1 H2].
262+
specialize (ssc P C'). rewrite (HH (beh (C' [P ↓]))) in H0.
263+
destruct H0 as [t1 [t2 [b_t1 [b_t2 H_t1_t2]]]].
264+
destruct (ssc t1 t2) as [Cs [bs_t1 bs_t2]]. auto.
265+
exists Cs. rewrite (HH _). exists t1, t2. split; auto.
266+
- unfold R2SCHC. intros h0 P C' t1 t2 [H1 H2].
267267
specialize (h0 P).
268-
assert (s : twoSC (fun π => (~(sem tgt ( C' [ P ↓ ]) t1 -> π t1)) \/ (~(sem tgt ( C' [ P ↓ ]) t2 -> π t2)))).
269-
{ unfold twoSC. intros. exists t1, t2. intros b. split.
270-
intros. apply de_morgan2 in H. destruct H as [H1' H2'].
271-
apply dne in H1'. apply dne in H2'. split; auto.
272-
intros H. apply de_morgan2. split; rewrite <- dne; destruct H; intros; try assumption.
268+
assert (s : twoSC (fun π => (~(sem tgt ( C' [ P ↓ ]) t1 -> π t1)) \/
269+
(~(sem tgt ( C' [ P ↓ ]) t2 -> π t2)))).
270+
{ unfold twoSC. intros. split.
271+
+ intros h.
272+
exists t1, t2. rewrite de_morgan2 in h. destruct h as [h1 h2].
273+
rewrite <- dne in h1, h2.
274+
repeat (split; auto).
275+
intros [k | k]; apply k; [ now left | now right ].
276+
+ intros [t3 [t4 [b_t3 [b_t4 K]]]].
277+
rewrite de_morgan2. rewrite <- dne. rewrite <- dne.
278+
rewrite de_morgan2 in K. destruct K as [k1 k2]. rewrite <- dne in k1,k2.
279+
specialize (k1 H1). specialize (k2 H2).
280+
destruct k1, k2; now subst.
273281
}
274282
specialize (h0 (fun π => (~(sem tgt ( C' [ P ↓ ]) t1 -> π t1)) \/ (~(sem tgt ( C' [ P ↓ ]) t2 -> π t2)))).
275283
specialize (h0 s).
@@ -335,12 +343,11 @@ Proof.
335343
Qed.
336344

337345
Lemma R2SCHC_R2HSC : R2SCHC -> R2HSC.
338-
Proof.
339-
intros rsc P Ct m1 m2 H. unfold spref in *.
340-
destruct (H m1) as [t1 [Ht1 Hpref1]]; auto.
341-
destruct (H m2) as [t2 [Ht2 Hpref2]]; auto.
342-
specialize (rsc P Ct t1 t2). destruct rsc as [Cs [K1 K2]]; auto.
343-
exists Cs. intros x [H1 | H2]; subst; [now exists t1 | now exists t2].
346+
Proof.
347+
rewrite R2SCHC_R2SCHP. rewrite R2HSC_R2HSP.
348+
intros twosc P S two_safetyS.
349+
apply twoSC_H2Safe in two_safetyS.
350+
now apply (twosc P S).
344351
Qed.
345352

346353

Properties.v

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,28 @@ Proof.
208208
+ unfold lifting in *. now apply (subset_trans k h π).
209209
Qed.
210210

211+
(* definition by "Verifying Bounded Subset-Closed Hyperproperties"
212+
- Mastroeni, Pasqua *)
211213
Definition twoSC (H : hprop) : Prop :=
212-
exists t1 t2, forall b, ~ (H b) <-> (b t1 /\ b t2).
214+
forall b, ~ (H b) <-> (exists t1 t2, (b t1 /\ b t2 /\ ~ H (fun t => t = t1 \/ t = t2))).
215+
216+
Lemma twoSC_SSC (H: hprop) : twoSC H -> SSC H.
217+
Proof.
218+
intros twosc b H_b b' b'_leq_b.
219+
apply NNPP. intros not_H_b'.
220+
rewrite (twosc b') in not_H_b'. destruct not_H_b' as [t1 [t2 [b_t1 [b_t2 H_t1_t2]]]].
221+
rewrite dne in H_b. apply H_b.
222+
rewrite (twosc _). exists t1, t2. split; auto.
223+
Qed.
213224

214225
(* 2SC Hyperproperties *)
215226

216-
(* CA : according to this definition
227+
(* CA : according to the old definition
228+
229+
H ∈ twoSC iff ∃ t1 t2. ∀ b. ~ (H b) <-> (b t1 /\ b t2).
230+
231+
hence
232+
217233
H ∈ k-SC iff
218234
∃ t1 .. tk, H = lifting (true \ t1) ∪ .. ∪ lifting (true \ tk)
219235
@@ -285,7 +301,24 @@ Definition H2Safe (H : hprop) : Prop :=
285301
spref (fun m => m = m1 \/ m = m2) b /\
286302
forall b', spref (fun m => m = m1 \/ m = m2) b' -> ~(H b')).
287303

288-
304+
Lemma twoSC_H2Safe (H : hprop) : H2Safe H -> twoSC H.
305+
Proof.
306+
intros hsafe_H b. split.
307+
+ intros not_H_b. destruct (hsafe_H b not_H_b) as [m1 [m2 [spref_b wit]]].
308+
destruct (spref_b m1) as [t1 [b_t1 m1_t1]]; auto.
309+
destruct (spref_b m2) as [t2 [b_t2 m2_t2]]; auto.
310+
exists t1, t2. repeat (split; auto). apply wit.
311+
intros m [M1 | M2]; subst; [exists t1 | exists t2]; auto.
312+
+ intros [t1 [t2 [b_t1 [b_t2 not_H]]]].
313+
destruct (hsafe_H _ not_H) as [m1 [m2 [spref_b wit]]].
314+
apply wit.
315+
intros m [M1 | M2]; subst.
316+
++ destruct (spref_b m1) as [t [b_t pref_t]]; auto.
317+
destruct b_t; subst; [now exists t1 | now exists t2].
318+
++ destruct (spref_b m2) as [t [b_t pref_t]]; auto.
319+
destruct b_t; subst; [now exists t1 | now exists t2].
320+
Qed.
321+
289322
(** *HyperLiveness *)
290323
Definition HLiv (H : hprop) : Prop :=
291324
forall M, Observations M ->

0 commit comments

Comments
 (0)