A scalable differentiable probabilistic Datalog engine, with Rust

Overview

Scallop

A scalable probabilistic datalog engine with Rust.

Usage

The Scallop system is best integrated inside of the Rust context. With scallop! { ... } macro, you can easily embed a Probablistic Datalog program.

>::new(); // Execute the program prog.run(); // Investigate the results for elem in prog.target().complete() { println!("{:?}", elem); } } ">
use scallop_codegen::scallop;

scallop! {
  VQARSmallExample {
    decl name(Symbol, String).
    decl attr(Symbol, String).
    decl is_a(String, String).
    decl target(Symbol).

    name(A, B) :- name(A, N), is_a(N, B).

    is_a("giraffe", "animal").
    is_a("tiger", "animal").
    is_a("wolf", "animal").

    0.8::name(1, "giraffe");
    0.01::name(1, "tiger");
    0.18::name(1, "wolf").

    0.3::attr(1, "tall").

    target(A) :- name(A, "animal"), attr(A, "tall").
  }
}

fn main() {
  let mut prog = VQARSmallExample::<TopKProbProofs<3>>::new();

  // Execute the program
  prog.run();

  // Investigate the results
  for elem in prog.target().complete() {
    println!("{:?}", elem);
  }
}

In a Rust program, one will instantiate a new Datalog program with its execution context, add input facts, can call run() to execute the Datalog program.

Build from source

Please install Rust and use the nightly branch (rustup default nightly). After that, please build using

$ cargo build --release

Make sure you add --release to ensure its performance.

Then you can install the compiler sclc by using the following command.

$ cargo install --path compiler
You might also like...
Learn-rust - An in-depth resource to learn Rust 馃

Learning Rust 馃 Hello friend! 馃憢 Welcome to my "Learning Rust" repo, a home for my notes as I'm learning Rust. I'm structuring everything into lesson

A highly modular Bitcoin Lightning library written in Rust. Its Rust-Lightning, not Rusty's Lightning!

Rust-Lightning is a Bitcoin Lightning library written in Rust. The main crate, lightning, does not handle networking, persistence, or any other I/O. Thus, it is runtime-agnostic, but users must implement basic networking logic, chain interactions, and disk storage. More information is available in the About section.

Telegram bot help you to run Rust code in Telegram via Rust playground
Telegram bot help you to run Rust code in Telegram via Rust playground

RPG_BOT (Rust Playground Bot) Telegram bot help you to run Rust code in Telegram via Rust playground Bot interface The bot supports 3 straightforward

`Debug` in rust, but only supports valid rust syntax and outputs nicely formatted using pretty-please
`Debug` in rust, but only supports valid rust syntax and outputs nicely formatted using pretty-please

dbg-pls A Debug-like trait for rust that outputs properly formatted code Showcase Take the following code: let code = r#" [ "Hello, World!

Playing with web dev in Rust. This is a sample Rust microservice that can be deployed on Kubernetes.

Playing with web dev in Rust. This is a sample Rust microservice that can be deployed on Kubernetes.

馃悁 Building a federated alternative to reddit in rust

Lemmy A link aggregator / Reddit clone for the fediverse. Join Lemmy 路 Documentation 路 Report Bug 路 Request Feature 路 Releases 路 Code of Conduct About

Applied offensive security with Rust
Applied offensive security with Rust

Black Hat Rust - Early Access Deep dive into offensive security with the Rust programming language Buy the book now! Summary Whether in movies or main

Rholang runtime in rust

Rholang Runtime A rholang runtime written in Rust.

Easy-to-use optional function arguments for Rust

OptArgs uses const generics to ensure compile-time correctness. I've taken the liberty of expanding and humanizing the macros in the reference examples.

Comments
  • Failed to install the complier

    Failed to install the complier

    Hi! I successfully build the project, but when I want to install the compiler, there is an error: (MacOS(ARM))

    % cargo install --path compiler
    error: there is nothing to install in `scallop-compiler v0.1.0 (/Users/xxx/Downloads/scallop-v1-master/compiler)`, because it has no binaries
    `cargo install` is only for installing programs, and can't be used with libraries.
    To use a library crate, add it as a dependency in a Cargo project instead.
    

    How to deal with this problem?

    opened by hz370299 1
Owner
null
This crate converts Rust compatible regex-syntax to Vim's NFA engine compatible regex.

This crate converts Rust compatible regex-syntax to Vim's NFA engine compatible regex.

kaiuri 1 Feb 11, 2022
MeiliSearch is a powerful, fast, open-source, easy to use and deploy search engine

MeiliSearch is a powerful, fast, open-source, easy to use and deploy search engine. Both searching and indexing are highly customizable. Features such as typo-tolerance, filters, and synonyms are provided out-of-the-box. For more information about features go to our documentation.

MeiliSearch 31.6k Dec 30, 2022
A collection of exponentially-smoothed camera controllers for the Bevy Engine.

smooth-bevy-cameras A collection of exponentially-smoothed camera controllers for the Bevy Engine. Look Transform All controllers are based on a LookT

Duncan 122 Dec 24, 2022
A simple induction and BMC engine.

Mikino is a (relatively) simple induction and BMC engine. Its goal is to serve as a simple yet interesting tool for those interested in formal verification, especially SMT-based induction.

OCamlPro 21 Oct 8, 2022
Blueboat is an open-source alternative to Cloudflare Workers. The monolithic engine for serverless web apps.

Blueboat Blueboat is an open-source alternative to Cloudflare Workers. Blueboat aims to be a developer-friendly, multi-tenant platform for serverless

Heyang Zhou 1.8k Jan 9, 2023
A prisma query-engine concurrency runner

Smash A prisma query-engine concurrency runner. Smash can be used to run concurrent requests against the prisma query engine. Currently it has workloa

garren smith 2 Jan 26, 2022
Toy: Layout-Engine

Toy: Layout-Engine

Oanakiaja 5 Mar 29, 2022
Safe API to embed an ECMAScript engine.

Kopi Kopi is a small abstraction to easily and safely embed an ECMAScript runtime inside a Rust based application. It uses the V8 execution engine to

Nils Hasenbanck 3 Dec 20, 2022
First Git on Rust is reimplementation with rust in order to learn about rust, c and git.

First Git on Rust First Git on Rust is reimplementation with rust in order to learn about rust, c and git. Reference project This project refer to the

Nobkz 1 Jan 28, 2022
A stupid macro that compiles and executes Rust and spits the output directly into your Rust code

inline-rust This is a stupid macro inspired by inline-python that compiles and executes Rust and spits the output directly into your Rust code. There

William 19 Nov 29, 2022