-
Notifications
You must be signed in to change notification settings - Fork 0
/
Declass.agda
79 lines (67 loc) · 2.18 KB
/
Declass.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
module Declass where
open import Semiring
open import Data.Nat
open import Data.Nat.Properties
open import Data.Sum
open import Data.Unit
open import Relation.Binary.PropositionalEquality
data Declass : Set where
Fin : ℕ -> Declass
Omega : Declass
data _<<_ : Declass -> Declass -> Set where
OmegaBot : (d : Declass) -> Omega << d
Lt : (n m : ℕ) -> n ≤ m -> Fin m << Fin n
meet : Declass -> Declass -> Declass
meet Omega _ = Omega
meet _ Omega = Omega
meet (Fin n) (Fin m) = Fin (n ⊔ m)
-- Int % n -> Int
-- Int % m -> Int
-- Int % n -> Int
times : Declass -> Declass -> Declass
times Omega x = x
times x Omega = x
times (Fin n) (Fin m) = Fin (n ⊓ m)
declassS : Semiring
declassS = record
{ grade = Declass
; 1R = Omega
; 0R = Fin 0
; _+R_ = meet
; _*R_ = times
; _≤_ = _<<_
; _≤d_ = {!!}
; leftUnit+ = {!!}
; rightUnit+ = {!!}
; comm+ = {!!}
; leftUnit* = {!!}
; rightUnit* = {!!}
; leftAbsorb = {!!}
; rightAbsorb = {!!}
; assoc* = {!!}
; assoc+ = {!!}
; distrib1 = {!!}
; distrib2 = {!!}
; monotone* = {!!}
; monotone+ = {!!}
; reflexive≤ = {!!}
; transitive≤ = {!!}
}
zeroTop : {d : Declass} -> d << Fin 0
zeroTop {Fin x} = Lt zero x z≤n
zeroTop {Omega} = OmegaBot (Fin zero)
asym : {d d' : Declass} -> d << d' -> d' << d -> d ≡ d'
asym (OmegaBot .Omega) (OmegaBot .Omega) = refl
asym (Lt .zero .zero z≤n) (Lt .zero .zero z≤n) = refl
asym (Lt .(suc _) .(suc _) (s≤s x)) (Lt .(suc _) .(suc _) (s≤s x₁))
rewrite asym (Lt _ _ x) (Lt _ _ x₁) = {!!}
laxidem : {d : Declass} -> times d d << d
laxidem {Fin x} rewrite m≤n⇒m⊓n≡m {x} {x} (≤-reflexive refl) = Lt x x (≤-reflexive refl)
laxidem {Omega} = OmegaBot Omega
declassSI : NonInterferingSemiring {{declassS}}
declassSI = record
{ oneIsBottom = \{d} -> OmegaBot d
; zeroIsTop = zeroTop
; antisymmetry = asym
; idem*lax = laxidem
}