@@ -175,8 +175,8 @@ function contradiction(input) {
// input list of list of ast, return list of sequents
functionaxiom(input){
constgivens=input[0];// list type, given list of sequent
constconclusion=input[1][0];//list type of sequent
constgivens=input[0];// list of expressions
constconclusion=input[1][0];//expression
if (ast.containExpNode(givens,conclusion)){
return[];
...
...
@@ -186,6 +186,29 @@ function axiom(input) {
}
// input list of sequent, return list of sequents
functionexludedMiddle(input){
constconclusion=input[1][0];// expression, after the turnstile
if (conclusion.type=="and"){
constleft=conclusion.left;
constright=conclusion.right;
if (right.type=="not"){
if (ast.toEqual(left,right.left)){
return[];
}else{
thrownewError("Invalid application for Exluded Middle law");
}
}else{
thrownewError("Invalid statement type for Exluded Middle law: The statement in right hand side of And must be type 'Not' to apply the law of Exluded Middle.");
}
}else{
thrownewError("Invalid statement type for Exluded Middle law: The statement must be type 'And' to apply the law of Exluded Middle.");
@@ -236,4 +237,14 @@ test('Axiom should throw an error for invalid application', () => {
constinput=parse("|- !A & B");
expect(()=>axiom(input)).toThrow("Invalid application for axiom rule: The list of formulas in left hand side of turnstile must contain the formula in right hand side of turnstile, to apply the imply introduction rule.");
});
//exludedMiddle
test('exludedMiddle should return the correct premises',()=>{