-
Notifications
You must be signed in to change notification settings - Fork 0
/
Noninterference.agda
39 lines (33 loc) · 1.59 KB
/
Noninterference.agda
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
module Noninterference where
open import Data.Nat using (ℕ)
open import Data.Vec using (Vec; []; _∷_)
open import Data.List using (List)
open import Machine
open import Defs
open import Imp
-- Low-projection equality for two states.
data _≈ₗ[_]_ : {∣V∣ : ℕ} → Vec ℕ ∣V∣ → level-assignment ∣V∣ → Vec ℕ ∣V∣ → Set where
≈ₗ-nil : [] ≈ₗ[ [] ] []
≈ₗ-cons-L : ∀ {∣V∣ : ℕ} {dom : level-assignment ∣V∣} {σ σ′ : State ∣V∣}
(v : ℕ)
→ σ ≈ₗ[ dom ] σ′
→ (v ∷ σ) ≈ₗ[ low ∷ dom ] (v ∷ σ′)
≈ₗ-cons-H : ∀ {∣V∣ : ℕ} {dom : level-assignment ∣V∣} {σ σ′ : State ∣V∣}
(v v′ : ℕ)
→ σ ≈ₗ[ dom ] σ′
→ (v ∷ σ) ≈ₗ[ high ∷ dom ] (v′ ∷ σ′)
-- noninterference property
noninterference : {∣V∣ : ℕ} → level-assignment ∣V∣ → Stmt ∣V∣ → Set
noninterference {∣V∣} level stmt =
∀ {σ₀ σ₀′ σ₂ σ₂′ : State ∣V∣}
→ σ₀ ≈ₗ[ level ] σ₂
→ ⟨ σ₀ , stmt ⟩⇓ σ₀′
→ ⟨ σ₂ , stmt ⟩⇓ σ₂′
→ σ₀′ ≈ₗ[ level ] σ₂′
noninterferenceₘ : ∀ {∣V∣ : ℕ} → level-assignment ∣V∣ → List (Instr ∣V∣) → Set
noninterferenceₘ {∣V∣} level prog =
∀ {M₀ M₁ : Memory ∣V∣} {C₀ C₁ : Config ∣V∣}
→ M₀ ≈ₗ[ level ] M₁
→ [ init-config M₀ , prog ]halts-with C₀
→ [ init-config M₁ , prog ]halts-with C₁
→ Config.mem C₀ ≈ₗ[ level ] Config.mem C₁