// "./cfa prolog.c"

extern "C" { extern int printf( const char *fmt, ... ); }

void printResult( int x ) { printf( "int\n" ); }
void printResult( double x ) { printf( "double\n" ); }
void printResult( char * x ) { printf( "char*\n" ); }

void is_arithmetic( int x ) {}
void is_arithmetic( double x ) {}

void is_integer( int x ) {}

context ArithmeticType( type T ) {
    void is_arithmetic( T );
};

context IntegralType( type T | ArithmeticType( T ) ) {
    void is_integer( T );
};

forall( type T | IntegralType( T ) | { void printResult( T ); } )
void hornclause( T param ) {
    printResult( param );
}

int main() {
    int x;
    double x;
    char * x;
    hornclause( x );
}
