<commit_before>// Copyright 2015 <NAME>
// This file is part of vulcan.
// 
// vulcan is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// vulcan is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
// 
// You should have received a copy of the GNU Affero General Public License
// along with vulcan.  If not, see <http://www.gnu.org/licenses/>.

var assert = require("assert");
var util = require("../util.js");
var vulcan = require("../vulcan.js");



describe("Vulcan", function() {
	describe("prove()", function() {
		it("should prove modus ponens", function() {
			var proof = vulcan.prove(["A -> B", "A"], "A");
			assert(vulcan.isProofComplete(proof));

		});

		it("should not prove the converse of modus ponens", function() {
			var proof = vulcan.prove(["A -> B", "B"], "A");
			assert(! vulcan.isProofComplete(proof));

		});


		it("should prove bijective identity", function() {
			var proof = vulcan.prove(["A <-> B", "B"], "A");
			assert(vulcan.isProofComplete(proof));


		});

		it("should prove the inverse bijective identity", function() {
			var proof = vulcan.prove(["A <-> B", "!B"], "!A");
			assert(vulcan.isProofComplete(proof));


		});

		it("should not prove the converse of bijective identity", function() {
			var proof = vulcan.prove(["A <-> B", "!B"], "A");
			assert(! vulcan.isProofComplete(proof));

		});

		it("should find simple proofs", function () {
			var proof = vulcan.prove(["(A & B) | C", "!B"], "C");
			assert(vulcan.isProofComplete(proof));

			
		});

		it("should follow negation chains", function () {
			var proof = vulcan.prove(["A -> B", "B -> C"], "A -> C");
			assert(vulcan.isProofComplete(proof));
		});


	});
});<commit_msg>added tests<commit_after>// Copyright 2015 <NAME>
// This file is part of vulcan.
// 
// vulcan is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// vulcan is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
// 
// You should have received a copy of the GNU Affero General Public License
// along with vulcan.  If not, see <http://www.gnu.org/licenses/>.

var assert = require("assert");
var util = require("../util.js");
var vulcan = require("../vulcan.js");



describe("Vulcan", function() {
	describe("prove()", function() {
		it("should prove modus ponens", function() {
			var proof = vulcan.prove(["A -> B", "A"], "A");
			assert(vulcan.isProofComplete(proof));

		});

		it("should not prove the converse of modus ponens", function() {
			var proof = vulcan.prove(["A -> B", "B"], "A");
			assert(! vulcan.isProofComplete(proof));

		});


		it("should prove bijective identity", function() {
			var proof = vulcan.prove(["A <-> B", "B"], "A");
			assert(vulcan.isProofComplete(proof));


		});

		it("should prove the inverse bijective identity", function() {
			var proof = vulcan.prove(["A <-> B", "!B"], "!A");
			assert(vulcan.isProofComplete(proof));


		});

		it("should not prove the converse of bijective identity", function() {
			var proof = vulcan.prove(["A <-> B", "!B"], "A");
			assert(! vulcan.isProofComplete(proof));

		});

		it("should find simple proofs", function () {
			var proof = vulcan.prove(["(A & B) | C", "!B"], "C");
			assert(vulcan.isProofComplete(proof));

			
		});

		it("should be able to resolve implications", function () {
			var proof = vulcan.prove(["A -> B", "B -> C"], "A -> C");
			assert(vulcan.isProofComplete(proof));
		});

		it("should be able to resolve implications", function () {
			var proof = vulcan.prove(["A -> B", 
                                                  "B -> C", 
                                                  "C -> D",
                                                  "D -> E"], "A -> E");
			assert(vulcan.isProofComplete(proof));
		});


		it("should be able to resolve implications", function () {
			var proof = vulcan.prove(["A -> B", 
                                                  "B -> C", 
                                                  "C -> D",
                                                  "D -> E"], "B -> D");
			assert(vulcan.isProofComplete(proof));
		});

		it("should be able to resolve implications", function () {
			var proof = vulcan.prove(["A -> B", 
                                                  "!B | C", 
                                                  "C -> D",
                                                  "D -> E"], "B -> D");
			assert(vulcan.isProofComplete(proof));
		});

		it("should not falsely resolve complex queries", function () {
                        this.timeout(20000);
			var proof = vulcan.prove(["A -> B", 
                                                  "!B | C", 
                                                  "C -> D",
                                                  "D -> !E"], "!B | E");
			assert(!vulcan.isProofComplete(proof));
		});

		it("should resolve complex queries with extra info", function () {
                        this.timeout(20000);
			var proof = vulcan.prove(["A -> B", 
                                                  "!B | (C <-> B)", 
                                                  "C -> D",
                                                  "D -> !E"], "!B | E");
			assert(vulcan.isProofComplete(proof));
		});

	});
});
{'fraction_non_alphanumeric': 0.16038210155857216, 'fraction_numerical': 0.0033517680576504107, 'mean_word_length': 2.0636550308008212, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 44, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 30, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6572348', 'n_tokens_mistral': 1861, 'n_tokens_neox': 1634, 'n_words': 549}