Live data from Hacker News

Mangle, a programming language for deductive database programming

github.com

41–48 of 48 posts

Re: Mangle, a programming language for deductive database programming

#41
post #34

Other resources for logic programming and Go: ichiban/prolog - ISO Prolog interpreter in pure Go, getting close to v1: https://github.com/ichiban/prolog trealla-prolog/go - ISO Prolog interpreter embedded via WASM: https://github.com/trealla-prolog/go guregu/pengine - library for interfacing with Pengines (SWI-Prolog's RPC protocol): https://github.com/guregu/pengine biscuit-auth/biscuit-go - Biscuits are a fancy aut…

Thanks for sharing Biscuit, I was collecting examples of authentication policy languages.

Datalog is also the basis for Open Policy Agent https://www.openpolicyagent.org/docs/latest/ , more specifically it's Rego language which is also implemented in go https://github.com/open-policy-agent/opa/tree/main/rego

Re: Mangle, a programming language for deductive database programming

#42
post #8

Some of the other stuff looks intriguing, but regarding the claim that "Unlike SQL, our Mangle rule projects_with_vulnerable_log4j has a name and can be referenced in other queries." goes, SQL in a VIEW or common table expression (CTE) can also be referenced in other queries.

I don’t think a CTE or a VIEW is an intended reasoning behind this claim. It’s more like choosing a part of a WHERE statement based on previous criteria and prior results.

CTE's and VIEW's can indeed express inference in relational databases. A "projects_with_vulnerable_log4j" view is a nice example, but possibly-recursive CTE's can achieve pretty much arbitrary inference, e.g. on graph-like data.

Re: Mangle, a programming language for deductive database programming

#43

RDFox looks like the best bet for datalog databases, it computes changes incrementally, also with aggregation extensions. Logicblox, Soufflé, datomic, inter4ql, corese are also worth a look. Looks like there's a lot of innovation possible in the space, like distributed logic processing, incremental sorting, adding assert statements, figuring out why specific rules don't match recursively, etc

RDFox using datalog underneath is definitely interesting. Maybe worth making a distinction between products/services and open source projects that can be used as building blocks for such products/services or whatever custom setup one may have.

Re: Mangle, a programming language for deductive database programming

#44

This is my project! So soon ... I was considering a Show HN but wanted to wait until things like documentation are a bit more complete, but here we are. Ask me anything.

What is the provenance of the project? Is it for something you're working on at Google? Or is it a personal open source project?

I never got to work on anything this interesting in my 10 years at Google :-)

Re: Mangle, a programming language for deductive database programming

#45

This is my project! So soon ... I was considering a Show HN but wanted to wait until things like documentation are a bit more complete, but here we are. Ask me anything.

What is the provenance of the project? Is it for something you're working on at Google? Or is it a personal open source project? I never got to work on anything this interesting in my 10 years at Google :-)

Mangle is used in an internal application. That application is a staffed project with internal usage.

In mid 2021, I saw an opportunity to apply some ideas on query languages to support development of that particular application. That application was an early idea and a prototype back then.

It was clear that it would need integration with many data sources and that this data would need to be queried in various ways that were not fixed in advance and would evolve. A very common situation...

With the team, we decided to try a novel approach using datalog, and it did indeed help development. Soon they started asking for features, found my bugs, optimized a few things and pushed for design changes.

As the programming language person, I tried to keep internal consistency of the language design and ease of use (static checks!) and wrote most code, yet Mangle certainly would not exist without this team, the application, it's users and management support at various levels.

I insisted on keeping the language as a separate thing since I had these other uses in mind. Open sourcing was therefore not difficult. For the mentioned application, Mangle is merely a mechanism, a library that enables flexible access to data.

So Mangle is not my or anyone's main project, yet many people (including management support at various levels) contributed to it's development.

I am glad you find it interesting! I feel very privileged to work with the larger team of people whose efforts led to this opportunity to do this kind of applied language research.

Re: Mangle, a programming language for deductive database programming

#46
post #28

Earlier quoted context omitted.

>pure monotonic core of the language What does that mean? Monotonic describes a function, or a sequence, that only every increases or decreases, never a combination of both. What does an "always decreasing" or "always increasing" language core look like? This may make sense for concatenative languages.

In logic programming monotonic means that adding a fact or rule does not remove an answer. Like SQL has monotonic queries where adding entries to a relation never gives you fewer answers. More formally: Database1 subset Database2 implies Query(Database1) subset Query(Database2) for all databases Which is exactly the definition of monotonicity (x =< y implies f(x) =< f(y)) applied to sets and functions on sets.

I guess that makes sense. I wonder though what other adjectives might apply to a "language core" other than "monotonic"? Why did you pick that one? Also are there any language are are monotonically decreasing? This is less useless than it sounds, since this is an elegant way to model decay, and decay is hard to model.

Re: Mangle, a programming language for deductive database programming

#47
post #3

Interesting; Google engineer previously published Datalog variants for BigQuery: https://research.google/pubs/pub43462/ & https://logica.dev/ This new language seems similar to differential-Datalog (which is sadly in maintenance mode): https://news.ycombinator.com/item?id=33521561

That's right. And btw Logica is also open source: https://github.com/evgskv/logica

Re: Mangle, a programming language for deductive database programming

#48
post #38

Earlier quoted context omitted.

It was a conscious choice to stick the prolog-like syntax because there are numerous teaching resources (e.g. "foundations of databases") and also academic research papers available that all discuss datalog in this syntax. Like tmptmpgo I consider datalog something different entirely and worthy of study in its own right; a small kernel (or toy) language that by itself is not sufficient for many day-to-day tasks. It i…

> What we want is a well-behaved, predicable mix of programming and those relational operations. We have to end this SQL madness. These are great goals! Thank you a lot for working on them, and for taking the time to participate here! > We should be able to isolate syntactic fragments where it is easy to ensure safety properties, at the minimum the datalog fragment. Again a great goal! Luckily, for every given Prolog…

Looks like Mangle differs from Prolog when it needs to express aggregation. I am curious what prolog dialect/library you think has good(or best?) aggregation syntax?
Post reply on HN