Hacker News new | ask | show | jobs
by avodonosov 583 days ago
Bottom-up? Ok, I see. From the tutorial it seems Logica reifies every predicate into an actual table (except for what they call "infinite predicates")

I found a way to look at the SQL it generates without installing anything:

Execute the first two cells in the online tutorial collab (the Install and Import). Then replace the 3rd cell content with the following and execute it:

    %%logica Composite

    @Engine("sqlite"); # don't try to authorise and use BigQuery

    # Define numbers 1 to 30.
    Number(x + 1) :- x in Range(30);
  
    # Defining composite numbers.
    Composite(a * b) distinct :- Number(a), Number(b), a > 1, b > 1;
  
    # Defining primes as "not composite".
    Prime(n) distinct :- Number(n), n > 1, ~Composite(n);

Look at the SQL tab in the results.