Designing IDP4

Matthias van der Hallen - Vigor Day (5/6/15)

Predicates and Functions:

Two sides of the same coin?

Predicate P:

Function P'::𝒟→ 𝔹

Function F:

Predicate F' 𝒟⨯𝒟

Still, the difference is important from a KR perspective 

I choose you

Language designers: Often 'Choose one and stick with it'!

Haskell: Functions

Prolog: Predicates

edge :: Vertex -> Vertex -> Bool
edge E1 E2 = True
edge E1 E3 = True
edge E2 E3 = True
edge _ _ = False
sum(zero, M, M).
sum(s(N), M, s(R)):-
    sum(N, M, R).

It seems reasonable to want both

Problems arise:

Can we, in the backend, treat functions and predicates in an agnostic way?

min { x : even(x) }

Representing predicates as functions to Bool:

Representing functions as predicates:

We suddenly want minimum over domain, not range.

∃c,h: Sum(a,b,c) ∧ Sum(f,g,h)
      ∧ Sum(c,h,x).

We do not want to lose function application.

Question:

Can we, in the backend, treat functions and predicates in an agnostic way?

Made with Slides.com