mirror of
https://github.com/ellmau/adf-obdd.git
synced 2025-12-20 09:39:38 +01:00
Compare commits
6 Commits
72ffdc310b
...
19a49c7844
| Author | SHA1 | Date | |
|---|---|---|---|
| 19a49c7844 | |||
|
|
fc0042fcd1 | ||
|
|
bc403d10cb | ||
|
|
34d3af0c0d | ||
|
|
8cafca22eb | ||
|
|
3979f77d03 |
837
Cargo.lock
generated
837
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "adf-bdd-bin"
|
||||
version = "0.3.0"
|
||||
version = "0.3.0-dev"
|
||||
authors = ["Stefan Ellmauthaler <stefan.ellmauthaler@tu-dresden.de>"]
|
||||
edition = "2021"
|
||||
homepage = "https://ellmau.github.io/adf-obdd"
|
||||
|
||||
57
flake.lock
generated
57
flake.lock
generated
@ -2,45 +2,47 @@
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
"flake-utils": "flake-utils_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1685518550,
|
||||
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
|
||||
"lastModified": 1657226504,
|
||||
"narHash": "sha256-GIYNjuq4mJlFgqKsZ+YrgzWm0IpA4axA3MCrdKYj7gs=",
|
||||
"owner": "gytis-ivaskevicius",
|
||||
"repo": "flake-utils-plus",
|
||||
"rev": "2bf0f91643c2e5ae38c1b26893ac2927ac9bd82a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"owner": "gytis-ivaskevicius",
|
||||
"repo": "flake-utils-plus",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignoresrc": {
|
||||
"flake": false,
|
||||
"flake-utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1660459072,
|
||||
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
|
||||
"lastModified": 1689068808,
|
||||
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1686059680,
|
||||
"narHash": "sha256-sp0WlCIeVczzB0G8f8iyRg3IYW7KG31mI66z7HIZwrI=",
|
||||
"lastModified": 1690927903,
|
||||
"narHash": "sha256-D5gCaCROnjEKDOel//8TO/pOP87pAEtT0uT8X+0Bj/U=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a558f7ac29f50c4b937fb5c102f587678ae1c9fb",
|
||||
"rev": "bd836ac5e5a7358dea73cb74a013ca32864ccb86",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -52,11 +54,11 @@
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1686020360,
|
||||
"narHash": "sha256-Wee7lIlZ6DIZHHLiNxU5KdYZQl0iprENXa/czzI6Cj4=",
|
||||
"lastModified": 1690881714,
|
||||
"narHash": "sha256-h/nXluEqdiQHs1oSgkOOWF+j8gcJMWhwnZ9PFabN6q0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "4729ffac6fd12e26e5a8de002781ffc49b0e94b7",
|
||||
"rev": "9e1960bc196baf6881340d53dccb203a951745a2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -69,15 +71,14 @@
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"gitignoresrc": "gitignoresrc",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"rust-overlay": "rust-overlay"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"flake-utils",
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
@ -85,11 +86,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1686191569,
|
||||
"narHash": "sha256-8ey5FOXNms9piFGTn6vJeAQmSKk+NL7GTMSoVttsNTs=",
|
||||
"lastModified": 1691029059,
|
||||
"narHash": "sha256-QwVeE9YTgH3LmL7yw2V/hgswL6yorIvYSp4YGI8lZYM=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "b4b71458b92294e8f1c3a112d972e3cff8a2ab71",
|
||||
"rev": "99df4908445be37ddb2d332580365fce512a7dcf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
108
flake.nix
108
flake.nix
@ -1,57 +1,101 @@
|
||||
{
|
||||
description = "basic rust flake";
|
||||
description = "adf-bdd, Abstract Dialectical Frameworks solved by Binary Decision Diagrams; developed in Dresden";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
|
||||
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs = {
|
||||
nixpkgs.follows = "nixpkgs";
|
||||
flake-utils.follows = "flake-utils";
|
||||
flake-utils.follows = "flake-utils/flake-utils";
|
||||
};
|
||||
};
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
gitignoresrc = {
|
||||
url = "github:hercules-ci/gitignore.nix";
|
||||
flake = false;
|
||||
};
|
||||
flake-utils.url = "github:gytis-ivaskevicius/flake-utils-plus";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
outputs = inputs @ {
|
||||
self,
|
||||
nixpkgs,
|
||||
nixpkgs-unstable,
|
||||
flake-utils,
|
||||
gitignoresrc,
|
||||
rust-overlay,
|
||||
...
|
||||
} @ inputs:
|
||||
{
|
||||
#overlay = import ./nix { inherit gitignoresrc; };
|
||||
}
|
||||
// (flake-utils.lib.eachDefaultSystem (system: let
|
||||
unstable = import nixpkgs-unstable {inherit system;};
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [(import rust-overlay)];
|
||||
}:
|
||||
flake-utils.lib.mkFlake {
|
||||
inherit self inputs;
|
||||
channels.nixpkgs.overlaysBuilder = channels: [rust-overlay.overlays.default];
|
||||
outputsBuilder = channels: let
|
||||
pkgs = channels.nixpkgs;
|
||||
toolchain = pkgs.rust-bin.stable.latest.default;
|
||||
platform = pkgs.makeRustPlatform {
|
||||
cargo = toolchain;
|
||||
rustc = toolchain;
|
||||
};
|
||||
in rec {
|
||||
devShell = pkgs.mkShell {
|
||||
apps = rec {
|
||||
adf-bdd = flake-utils.lib.mkApp {
|
||||
drv = packages.adf-bdd;
|
||||
exePath = "/bin/adf-bdd";
|
||||
};
|
||||
};
|
||||
packages = rec {
|
||||
adf-bdd = platform.buildRustPackage {
|
||||
pname = "adf-bdd";
|
||||
version = "0.3.0-dev";
|
||||
src = ./.;
|
||||
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
|
||||
meta = {
|
||||
description = "adf-bdd, Abstract Dialectical Frameworks solved by Binary Decision Diagrams; developed in Dresden";
|
||||
homepage = "https://github.com/ellmau/adf-obdd";
|
||||
license = [pkgs.lib.licenses.mit];
|
||||
};
|
||||
|
||||
nativeBuildInputs = with platform; [
|
||||
cargoBuildHook
|
||||
cargoCheckHook
|
||||
];
|
||||
buildAndTestSubdir = "bin";
|
||||
};
|
||||
adf_bdd = platform.buildRustPackage {
|
||||
pname = "adf_bdd";
|
||||
version = "0.3.0";
|
||||
src = ./.;
|
||||
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
|
||||
meta = {
|
||||
description = "adf-bdd, Abstract Dialectical Frameworks solved by Binary Decision Diagrams; developed in Dresden";
|
||||
homepage = "https://github.com/ellmau/adf-obdd";
|
||||
license = [pkgs.lib.licenses.mit];
|
||||
};
|
||||
|
||||
nativeBuildInputs = with platform; [
|
||||
cargoBuildHook
|
||||
cargoCheckHook
|
||||
];
|
||||
buildAndTestSubdir = "lib";
|
||||
};
|
||||
};
|
||||
devShells.default = pkgs.mkShell {
|
||||
RUST_LOG = "debug";
|
||||
RUST_BACKTRACE = 1;
|
||||
buildInputs = [
|
||||
pkgs.rust-bin.stable.latest.rustfmt
|
||||
pkgs.rust-bin.stable.latest.default
|
||||
shellHook = ''
|
||||
export PATH=''${HOME}/.cargo/bin''${PATH+:''${PATH}}
|
||||
'';
|
||||
buildInputs = let
|
||||
notOn = systems:
|
||||
pkgs.lib.optionals (!builtins.elem pkgs.system systems);
|
||||
in
|
||||
[
|
||||
toolchain
|
||||
pkgs.rust-analyzer
|
||||
pkgs.cargo-audit
|
||||
pkgs.cargo-license
|
||||
pkgs.cargo-tarpaulin
|
||||
pkgs.cargo-kcov
|
||||
pkgs.valgrind
|
||||
pkgs.gnuplot
|
||||
pkgs.kcov
|
||||
];
|
||||
]
|
||||
++ (notOn ["aarch64-darwin" "x86_64-darwin"] [pkgs.kcov pkgs.cargo-kcov pkgs.gnuplot])
|
||||
++ (notOn ["aarch64-linux" "aarch64-darwin" "i686-linux"] [pkgs.cargo-tarpaulin])
|
||||
++ (notOn ["aarch64-darwin" "x86_64-darwin"] [pkgs.valgrind]);
|
||||
};
|
||||
};
|
||||
};
|
||||
}));
|
||||
}
|
||||
|
||||
@ -9,32 +9,32 @@
|
||||
"build": "parcel build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@parcel/transformer-inline-string": "2.8.3",
|
||||
"@types/node": "^18.15.11",
|
||||
"@types/react": "^18.0.26",
|
||||
"@types/react-dom": "^18.0.10",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.1",
|
||||
"@typescript-eslint/parser": "^5.48.1",
|
||||
"eslint": "^8.31.0",
|
||||
"@parcel/transformer-inline-string": "2.9.3",
|
||||
"@types/node": "^20.4.6",
|
||||
"@types/react": "^18.2.18",
|
||||
"@types/react-dom": "^18.2.7",
|
||||
"@typescript-eslint/eslint-plugin": "^6.2.1",
|
||||
"@typescript-eslint/parser": "^6.2.1",
|
||||
"eslint": "^8.46.0",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-config-airbnb-typescript": "^17.0.0",
|
||||
"eslint-plugin-import": "^2.27.4",
|
||||
"eslint-config-airbnb-typescript": "^17.1.0",
|
||||
"eslint-plugin-import": "^2.28.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.7.1",
|
||||
"eslint-plugin-react": "^7.32.0",
|
||||
"parcel": "^2.8.2",
|
||||
"eslint-plugin-react": "^7.33.1",
|
||||
"parcel": "^2.9.3",
|
||||
"process": "^0.11.10",
|
||||
"typescript": "^4.9.4"
|
||||
"typescript": "^5.1.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"@antv/g6": "^4.8.3",
|
||||
"@emotion/react": "^11.10.5",
|
||||
"@emotion/styled": "^11.10.5",
|
||||
"@fontsource/roboto": "^4.5.8",
|
||||
"@mui/icons-material": "^5.11.16",
|
||||
"@mui/material": "^5.11.4",
|
||||
"markdown-to-jsx": "^7.2.0",
|
||||
"@antv/g6": "^4.8.20",
|
||||
"@emotion/react": "^11.11.1",
|
||||
"@emotion/styled": "^11.11.0",
|
||||
"@fontsource/roboto": "^5.0.6",
|
||||
"@mui/icons-material": "^5.14.3",
|
||||
"@mui/material": "^5.14.3",
|
||||
"markdown-to-jsx": "^7.2.1",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-router-dom": "^6.10.0"
|
||||
"react-router-dom": "^6.14.2"
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ The Web UI mimics many options of the CLI version of the [underlying adf-bdd too
|
||||
|
||||
In the below form, you can either type/paste your `code` or upload a file in the same format.
|
||||
To put it briefly, an ADF consists of statements and accectance conditions for these statements.
|
||||
For instance, the following code indicates that `a,b,c,d` are statements, that `a` is assumed to be true (verum), `b` is true if is true (which is tautological), `c` is true if `a` and `b` are true, and `d` is true if `b` is false.
|
||||
For instance, the following code indicates that `a,b,c,d` are statements, that `a` is assumed to be true (verum), `b` is true if `b` is true (which is self-supporting), `c` is true if `a` and `b` are true, and `d` is true if `b` is false.
|
||||
|
||||
```
|
||||
s(a).
|
||||
|
||||
2045
frontend/yarn.lock
2045
frontend/yarn.lock
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,6 @@
|
||||
//! Collection of all nogood-related structures.
|
||||
|
||||
use std::{
|
||||
borrow::Borrow,
|
||||
fmt::{Debug, Display},
|
||||
ops::{BitAnd, BitOr, BitXor, BitXorAssign},
|
||||
};
|
||||
@ -23,11 +22,8 @@ pub struct NoGood {
|
||||
impl Eq for NoGood {}
|
||||
impl PartialEq for NoGood {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.active
|
||||
.borrow()
|
||||
.bitxor(other.active.borrow())
|
||||
.is_empty()
|
||||
&& self.value.borrow().bitxor(other.value.borrow()).is_empty()
|
||||
(&self.active).bitxor(&other.active).is_empty()
|
||||
&& (&self.value).bitxor(&other.value).is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,15 +109,11 @@ impl NoGood {
|
||||
/// Given a [NoGood] and another one, conclude a non-conflicting value which can be concluded on basis of the given one.
|
||||
pub fn conclude(&self, other: &NoGood) -> Option<(usize, bool)> {
|
||||
log::debug!("conclude: {:?} other {:?}", self, other);
|
||||
let implication = self
|
||||
.active
|
||||
.borrow()
|
||||
.bitxor(other.active.borrow())
|
||||
.bitand(self.active.borrow());
|
||||
let implication = (&self.active).bitxor(&other.active).bitand(&self.active);
|
||||
|
||||
let bothactive = self.active.borrow().bitand(other.active.borrow());
|
||||
let mut no_matches = bothactive.borrow().bitand(other.value.borrow());
|
||||
no_matches.bitxor_assign(bothactive.bitand(self.value.borrow()));
|
||||
let bothactive = (&self.active).bitand(&other.active);
|
||||
let mut no_matches = (&bothactive).bitand(&other.value);
|
||||
no_matches.bitxor_assign(bothactive.bitand(&self.value));
|
||||
|
||||
if implication.len() == 1 && no_matches.is_empty() {
|
||||
let pos = implication
|
||||
@ -140,16 +132,16 @@ impl NoGood {
|
||||
|
||||
/// Updates the [NoGood] and a second one in a disjunctive (bitor) manner.
|
||||
pub fn disjunction(&mut self, other: &NoGood) {
|
||||
self.active = self.active.borrow().bitor(&other.active);
|
||||
self.value = self.value.borrow().bitor(&other.value);
|
||||
self.active = (&self.active).bitor(&other.active);
|
||||
self.value = (&self.value).bitor(&other.value);
|
||||
}
|
||||
|
||||
/// Returns [true] if the other [Interpretation] matches with all the assignments of the current [NoGood].
|
||||
pub fn is_violating(&self, other: &Interpretation) -> bool {
|
||||
let active = self.active.borrow().bitand(other.active.borrow());
|
||||
let active = (&self.active).bitand(&other.active);
|
||||
if self.active.len() == active.len() {
|
||||
let lhs = active.borrow().bitand(self.value.borrow());
|
||||
let rhs = active.borrow().bitand(other.value.borrow());
|
||||
let lhs = (&active).bitand(&self.value);
|
||||
let rhs = (&active).bitand(&other.value);
|
||||
if lhs.bitxor(rhs).is_empty() {
|
||||
return true;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user