• Keine Ergebnisse gefunden

Perspective: Normal Horn Clauses

N/A
N/A
Protected

Academic year: 2022

Aktie "Perspective: Normal Horn Clauses"

Copied!
18
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Perspective: Normal Horn Clauses

• Prolog may no longer be the sexiest programming language :-)

• Horn clauses, though, are very well suited for the specification of analysis problems.

• It is a separate problem then to solve the stated analysis problem :-)

• If the least solution cannot be computed exactly, approximate solutions may at least yield approximative answers ...

Example: Cryptographic Protocols

(2)

Rules for the Exchange of Messages:

{Nb}pub(Bob) {Na,Nb}pub(Alice) {Alice,Na}pub(Bob)

Alice Bob

Properties to be verified:

secrecy, authenticity, ...

(3)

The Dolev-Yao Model:

• Messages are terms:

Representation

{m}k encrypt(m,k) hm1,m2i pair(m1,m2)

==⇒ Distinct terms represent distinct messages :-)

==⇒ perfect cryptography. Therefore, we have:

{m}k = {m}k iff m = m and k = k

• The attacker has full control over the network:

All messages are exchanged with the attacker.

(4)

Example: The Needham-Schroeder Protocol

1. A −→ B : {a, na}kb 2. B −→ A : {na, nb}ka 3. A −→ B : {nb}kb

Abstraction:

• Unbounded number of sessions !!

• Nonces sind not necessarily fresh ??

(5)

Idea:

Characterize the knowledge of the attacker by means of Horn clauses ...

1. A −→ B : {a, na}kb known

({

a, na

}

kb

) ←

2. B −→ A : {na, nb}ka known

({

X, nb

}

ka

) ←

known

({

a, X

}

kb

)

3. A −→ B : {nb}kb known

({

X

}

kb

) ←

known

({

na, X

}

ka

)

Secrecy of Nb :

known

(

nb

)

.

(6)

Discussion:

• We have abstracted all nonces with finitely many.

• Less restrictive (though still correct) abstractions are still possible ...

1. A −→ B : {a,na}kb . . .

2. B −→ A : {na, nb}ka known

({

X,nb(X)}ka

) ←

known

({

a, X

}

kb

)

3. A −→ B : {nb}kb . . .

The fresh nonce is a function of the received nonce :-)

Blanchet 2001

(7)

Further capabilities of the attacker:

known

({

X

}

Y

) ←

known

(

X

)

, known

(

Y

)

// The attacker can encode known

(h

X,Y

i) ←

known

(

X

)

, known

(

Y

)

// The attacker can construct pairs known

(

X

) ←

known

({

X

}

Y

)

,known

(

Y

)

// The attacker can decode known

(

X

) ←

known

(h

X, Y

i)

known

(

Y

) ←

known

(h

X, Y

i)

// The attacker can project

(8)

Discussion

• Type inference for Prolog computed a regular abstraction of the set of paths of the denotational semantics.

• Sometimes, this is too imprecise :-(

• Instead, we now approximate the denotational semantics directly :-)

• This, however, can be quite expensive

==⇒ not well suited for compilers :-(

==⇒ in general, much more precise :-)

(9)

Simplification:

We only consider clauses whose heads are of the form:

p

(

f

(

X1, . . . , Xk

))

or p

(

b

)

or p

(

X1, . . . , Xk

)

Such clauses are called H1.

Theorem

• Every finite set of H1-clauses is equivalent to a finite set of simple H1-clauses of the form:

p

(

f

(

X1, . . . , Xk

)) ←

p1

(

Xi1

)

, . . . , pr

(

Xi1

)

p

(

X1, . . . , Xk

) ←

p1

(

Xi1

)

, . . . , pr

(

Xi1

)

p

(

b

) ←

• ... or even to a finite set of normal H1-clauses.

(10)

Idea:

We successively introduce simper clauses until the complicated ones become superfluous ...

Rule 1: Splitting

We separate independent parts from the pre-conditions:

head

rest, p1

(

X

)

, . . . , pm

(

X

)

(

X does not occur in head, rest

)

is replaced with:

head

rest, q

()

q

() ←

p1

(

X

)

, . . . , pm

(

X

)

for a new predicate q/0.

(11)

Rule 2: Simplification

We introduce simpler derived clauses:

head

p

(

f

(

t1, . . . , tk

))

, rest p

(

f

(

X1, . . . , Xk

)) ←

p1

(

Xi1

)

, . . . , pr

(

Xir

)

implies:

head

p1

(

ti1

)

, . . . , pr

(

tir

)

,rest

head

p

(

t1, . . . , tk

)

,rest p

(

X1, . . . , Xk

) ←

p1

(

Xi1

)

, . . . , pr

(

Xir

)

implies:

head

p1

(

ti1

)

, . . . , pr

(

tir

)

,rest

(12)

Rule 3 (Cont.): Simplification

p

(

X

) ←

p1

(

X

)

, . . . , pm

(

X

)

pi

(

f

(

X1, . . . , Xk

)) ←

pi1

(

Xi1

)

, . . . , piri

(

Xiri

)

implies:

p

(

f

(

X1, . . . , Xk

))) ←

p11

(

X11

)

, . . . , pmrm

(

Xmrm

)

head

p

(

b

)

,rest

p

(

b

) ←

implies:

head

rest

(13)

Rule 4: Guard Simplification

p

() ←

p1

(

X

)

, . . . , pm

(

X

)

pi

(

f

(

X1, . . . , Xk

)) ←

pi1

(

Xi1

)

, . . . , piri

(

Xiri

)

implies:

p

() ←

p11

(

X11

)

, . . . , pmrm

(

Xmrm

)

p

() ←

p1

(

X

)

, . . . , pm

(

X

)

pi

(

b

) ←

implies:

p

() ←

(14)

Theorem

Assume that

C

is finite set of clauses which is closed under splitting and simplification and guard simplification.

Let

C

0

⊆ C

denote the subset of simple clauses of

C

. Then for all occurring predicates p,

[[

p

]]

C0

= [[

p

]]

C

Proof:

Induction on the depth of terms in tuples of

[[

p

]]

C :-)

(15)

Transformation into normal clauses:

Introduce fresh predicates for conjunctions of unary predicates.

Assume A

= {

p1, . . . , pm

}

. Then:

[

A

](

b

) ←

whenever pi

(

b

) ←

for all i.

[

A

](

f

(

X1, . . . , Xk

)) ← [

B1

](

X1

)

, . . . ,

[

Bk

](

Xk

)

whenever Bi

= {

pjl

|

Xijl

=

Xi

}

for pj

(

f

(

X1, . . . , Xk

)) ←

pj1

(

Xij1

)

, . . . , pjrj

(

Xijr j

)

(16)

Warning:

• The emptiness problem for Horn clauses in H1 is DEXPTIME-complete !

• In many cases, our method still terminates quickly ;-)

• Not all Horn clauses are in H1 :-(

==⇒ an approximation technique is required ...

(17)

Approximation of Horn Clauses

Step 1:

Simplification of pre-conditions by splitting, simplification and guard simplification (as before :-)

Step 2:

Introduction of copies of variables X. Every copy receives all literals of X as pre-condition.

p

(

f

(

X, X

)) ←

q

(

X

)

yields :

p

(

f

(

X, X

)) ←

q

(

X

)

,q

(

X

)

(18)

Step 3:

Introduction of an auxiliary predicate for every non-variable subterm of the head.

p

(

f

(

g

(

X, Y

)

, Z

)) ←

q1

(

X

)

, q2

(

Y

)

,q3

(

Z

)

yields :

p1

(

g

(

X,Y

)) ←

q1

(

X

)

, q2

(

Y

)

,q3

(

Z

)

p

(

f

(

H, Z

)) ←

p1

(

H

)

, q1

(

X

)

, q2

(

Y

)

, q3

(

Z

)

Referenzen

ÄHNLICHE DOKUMENTE

Drawing on literature emerging from the field of service user research in mental health, the paper attempts to go beyond the boundaries of a psychiatric biomedical perspective

These chapters are particularly interesting because of the zoogeo- graphic situation of Cyprus as one of the big Mediterra- nean islands which had a rich endemic megafauna in the

Audiovisual translation (AVT) in the Arab world remains outside the scope of translation departments at a time when there is an obvious need to espouse the concept,

As usual, I will define the formalism by way of a deductive system, and the natural choice is classical propositional logic. It is possible to define the formalism in isolation, in

Preferential trade agreements (PTAs) cover a much wider diversity of environmental clauses than World Trade Organization (WTO) agreements. Which PTA environmental

SIRIUS performs metabolite identification in a two step approach: Firstly, the molecular formula of the query compound is determined via isotope pattern analysis and

Sampling from the primal patches of the normal cycle numerically is an interesting problem for convex hulls of sets: In this case, it is not clear how to sample boundary points of

Concerning engine types, we assume that the energy required for the propulsion of the mining and transport vessels is generated by the ship’s main engine