a modal language for the safety of mobile values (work in progress) ropas @ snu 4/7/2006 박성우...
TRANSCRIPT
A Modal Language for the Safety of Mobile Values
(work in progress)
ROPAS @ SNU
4/7/2006
박성우 Sungwoo ParkPOSTECH
2
Distributed Computation• Heterogeneous nodes with different local resources• Mobile term (code)
abstract datatype
local heap
3
Modal Logic• Modalities ¤ and }
– ¤ A : necessarily A– } A : possibly A
• Spatially:– ¤ A : everywhere A– } A : somewhere A
4
Modal Type Theory• Basic idea: enrich the type system with modal types
• Staged computation: temporal interpretation– box M : ¤ A
M has type A at all subsequent stages
• Spatial interpretation– box M : ¤ A
M has type A at every node, i.e., globally– dia M : } A
M has type A at some node
5
Modal Type System for Distributed Computation
• Borghuis and Fejis '00• Jia and Walker, ESOP '04
– box M : ¤ A, M = mobile term, valid at every node– dia M : } A, M = mobile term, valid at some node– uses hybrid logic
• Murphy et al, LICS '04– box M : ¤ A, M = mobile term, valid at every node– dia l : } A, l = reference to local resource
• Moody, '03– box M : ¤ A, M = mobile term, valid at every node– dia M : } A, M = mobile term, valid at some node
9
Harsh Reality• Jia and Walker, ESOP '04
– uses hybrid logic (i.e., indices)
• Murphy et al, LICS '04– Every term is mobile!– Then what is the ¤ modality for?
10
Why This Complication?• Because they do not take into consideration
value mobility!
• Consider a term M such that:
– Term (code) mobility:Is the term M valid at a remote node?
– Value mobility:Is the value V valid at a remote node?
– These two are independent.
M : A V : A
11
¤ (int ! int), term: mobile, value: immobile
letval new_reference = ref 0val f = fn x => x + !new_reference
inf
end
• The term is valid at any node.• The result f is local, however.
12
¤ (int ! int), term: immobile, value: mobile
letval v = !some_existing_referenceval f = fn x => x + v
inf
end
• The term is local.• The result f is valid at any node, however.
13
Key Idea• box M : ¤ A
M is valid at any node.V is valid at the current node,
but we know nothing about its mobility.
• cir M : O A
M is valid at the current node,but we know nothing about its mobility.
V is valid at any node, however.
M : A V : A
M : A V : A
14
Outline• Introduction V
• Modal language ¤O with ¤ and O modalities
• Modal language with value mobility• Logic of direct evidence
26
¤O= ¤+ O
• Additional typing rule and substitution
• Special rules for primitive types– e.g., booleans, integers, …
28
Bad Things about ¤O
• Complexity– when the system is augmented with indices and
communication constructs• 30 pages of type safety proof
even without mutable references– Mechanizing type safety proof seems necessary.
• POPLMark Challenge
• Redundancy– 'really' serious problem
29
Key Observation: Redundancy• Term mobility is a special case of value mobility.
Term M is mobile? Value x:_. M is mobile?
Value box M is mobile?
Value … M … is mobile?
,
Conclusion: ditch the ¤ modality.
30
Outline• Introduction V
• Modal language ¤O with ¤ and O modalities V
• Modal language ¡} with value mobility
• Logic of direct evidence
31
Key Idea: Value Mobility Only• box M : ¡ A
V is valid at every node.I.e., ¡ = O ¼ necessity modality
• dia M : } A
V is valid at some node.I.e., } ¼ possibility modality
M : A V : A
M : A V : A
43
Application• Robotics
– communication constructs– does not use code mobility.
• Grid computing– distributed computation on the network– makes heavy use of code mobility.
44
Outline• Introduction V
• Modal language ¤O with ¤ and O modalities V
• Modal language ¡} with value mobility
• Logic of direct evidence
45
Motivation• What is the logic for ¡} under the Curry-Howard
isomorphism?– Type-theoretically, we distinguish between
values and ordinary terms.
– Logically, we distinguish between(weak) normal proofs andordinary proofs.
• So we develop a logic of normal proofs, or direct evidence.