Internal Language IDP4

03/11/2016

If we want to support functions ...

Why differentiate between predicates and functions?

Predicate = Function to Bool

MINIMAL LAnguage constructs

  • Function Application
  • Lambda Abstraction
  • Set of constants

Using this we can easily recover FO

\forall x: P(x) \Rightarrow Q(x).
x:P(x)Q(x).\forall x: P(x) \Rightarrow Q(x).

IDP3

QuantForm(forall,+,x)

BoolForm(disjunctive,+)

PredForm(-,P)

PredForm(+,Q)

VarTerm

Var(X,Type)

VarTerm

Var(X,Type)

\forall x: P(x) \Rightarrow Q(x).
x:P(x)Q(x).\forall x: P(x) \Rightarrow Q(x).

IDP3

QuantForm(forall,+,x)

BoolForm(disjunctive,+)

PredForm(-,P)

PredForm(+,Q)

VarTerm

IDP4

Ap

Forall

Lambda

Ap

Implies

Ap

Ap

Ap

P

Var(0)

Q

Var(0)

Var(X,Type)

VarTerm

Var(X,Type)

Challenges

  • What set of builtins do we want?
    • Forall, Exists, And, Or, Not, Implies, ....?
  • Do we need N-ary application?
    • And, Or, +, *,  min, max, ... ?
    • Use lists/sets for N-ary language constructs
    • Binary version shorthand for list constructor
  • De Bruyne indices
    • Easy to make mistakes
    • Idempotent printing/parsing cycle?
p \land q \land r
pqrp \land q \land r

Ap

And

Ap

P

And

Ap

Q

Ap

R

Ap

And

Ap

[]

Ap

P

Ap

Q

Ap

Ap

R

Ap

Tentative list construction

From Fo to FO(.)

  • Arithmetic
    • Trivial
  • Types
    • Not needed in internal language
  • Partial Functions
    • Mainly a semantics issue, no representation issue
  • Aggregates
    • No fundamental difference between aggregate and quantifier

The easy ones

Constructors

Definitions

The Hard ones:

Constructors

  • Integration of GADT's in Lambda Calculus is well known
  • My stance: copy what they're doing
  • Missing: good insight in standard implementations

Extra Language Construct:

Case-construct

case x of  (a,b) -> a + b

Could be simulated as

return=c \leftarrow \exists a ,b: x = (a,b) \land c = (a + b)
return=ca,b:x=(a,b)c=(a+b)return=c \leftarrow \exists a ,b: x = (a,b) \land c = (a + b)

Definitions

  • Symmetry between Functions and Predicates breaks down
  • My Proposal: represent as specialized letrec
    • ​of type: U -> Bool, needed for uniform prop<->pred

Extra Language Construct:

Define-construct

let {
     p () = q ()
     q () = p ()
     z () = p () || q () 
}
let {
     transCl e (x,y) =  e (x,y) || exists (\z ->
                    e (x,z) && transCl e (z,y)
}

Some Remarks

  • No explicit polymorphism
    • Consequence:
      Compiling of polymorphic code will always be impossible
  • No explicit typing information could prevent sanity check of transformations
  • For some constructs, we will need smart specialization algorithms to IDP3-like data structures
  • What about the generators?

Lang constructs

  • Application
  • Abstraction
  • Builtin Constants
  • Variable References
  • Case
  • Definition

 

Let? (easily simulated internally using abstraction)

Internal Language IDP4

By Ingmar Dasseville