Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Seclib.Ghost

GhostProperty — ⚪ definition

structure · source

structure GhostProperty where

[BEq — ⚪ definition

instance · source

instance [BEq α] : BEq (RefStatus α) where

FindingSeverity.toNat — ⚪ definition

def · source

def FindingSeverity.toNat : FindingSeverity → Nat
  | .safe => 0
  | .low => 1
  | .medium => 2
  | .high => 3
  | .critical => 4

— ⚪ definition

instance · source

instance : LE FindingSeverity where

— ⚪ definition

instance · source

instance (a b : FindingSeverity) : Decidable (a ≤ b)

— ⚪ definition

instance · source

instance : Ord FindingSeverity where

ghostConservative — ⚪ definition

def · source

Conservativeness — the central proof obligation A ghost finding is conservative when for every possible concrete instantiation of the ghost referent, the finding under the ghost assumption is at least as severe as the finding with full information. Any control that produces a finding about a ghost must prove this.

def ghostConservative
    (control : α → FindingSeverity)
    (_assume : GhostAssumption)
    (ghostFinding : FindingSeverity) : Prop

ghostAssumptionsCompatible — ⚪ definition

def · source

def ghostAssumptionsCompatible (a b : GhostAssumption) : Bool

RefStatus.isResolved — ⚪ definition

def · source

Helpers

def RefStatus.isResolved : RefStatus α → Bool
  | .resolved _ => true
  | .ghost _ _ => false

RefStatus.isGhost — ⚪ definition

def · source

def RefStatus.isGhost : RefStatus α → Bool
  | .resolved _ => false
  | .ghost _ _ => true

ObsScope — ⚪ definition

structure · source

Observation scope tracking ghost references and their assumptions. Consistency: no contradictory assumptions on the same reference.

structure ObsScope where

ObsScope.empty — ⚪ definition

def · source

def ObsScope.empty : ObsScope

DischargesGhosts — ⚪ definition

structure · source

Scope B discharges A’s ghost assumptions by providing resolved data.

structure DischargesGhosts (resolving : ObsScope) (assumptions : List (String × GhostAssumption)) : Prop where

ghost_contradiction_detected — 🟢 proved

theorem · source

Two controls with incompatible ghost assumptions on the same reference cannot coexist in a consistent scope.

theorem ghost_contradiction_detected
    {scope : ObsScope} {refId : String} {G₁ G₂ : GhostAssumption}
    (h1 : (refId, G₁) ∈ scope.ghostRefs)
    (h2 : (refId, G₂) ∈ scope.ghostRefs)
    (hContra : ghostAssumptionsCompatible G₁ G₂ = false) :
    False

ghost_composition — 🟢 proved

theorem · source

When scope B resolves a ghost from scope A, the conservative finding from A is still valid: for any concrete instantiation, the ghost finding is at least as severe.

theorem ghost_composition
    {α : Type} {scopeA scopeB : ObsScope}
    {control : α → FindingSeverity}
    {ga : GhostAssumption} {ghostFinding : FindingSeverity}
    {refId : String}
    (_hGhostInA : (refId, ga) ∈ scopeA.ghostRefs)
    (_hConservative : ghostConservative control ga ghostFinding)
    (_hDischarge : DischargesGhosts scopeB [(refId, ga)]) :