Matthias van der Hallen - Vigor Day (5/6/15)
Predicate P:
Function P'::𝒟→ 𝔹
Function F:
Predicate F' ⊆𝒟⨯𝒟
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).
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.
By Matthias van der Hallen