From 2f7ac38cca2ebab41b8adb76b69e0949eeae488d Mon Sep 17 00:00:00 2001 From: Kai Stevenson Date: Tue, 13 Jun 2023 01:59:43 -0700 Subject: fixed bugs, just_is_sound works for conjunct intro --- eval.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 eval.c (limited to 'eval.c') diff --git a/eval.c b/eval.c new file mode 100644 index 0000000..02b85f1 --- /dev/null +++ b/eval.c @@ -0,0 +1,37 @@ +#include +#include "eval.h" +#include "parse.h" +char just_is_sound(prop_t prop, just_t just, lineSet_t lines) { + prop_t a; + prop_t b; + if (!prop.isSimple) { + a = *prop.propA; + b = *prop.propB; + } + prop_t w; + prop_t x; + prop_t y; + prop_t z; + if (just.referencesCount > 0) { + w = lines.lines[just.references[0] - 1].proposition; + } + if (just.referencesCount > 1) { + x = lines.lines[just.references[1] - 1].proposition; + } + if (just.referencesCount > 2) { + y = lines.lines[just.references[2] - 1].proposition; + } + if (just.referencesCount > 3) { + z = lines.lines[just.references[3] - 1].proposition; + } + switch (just.rule) { + case PREMISE_R: + return 1; + case ASSUMPTION_R: + return 1; + case CONJUNCT_INTRO: + return (peq(a, w) && peq(b, x)) || (peq(a, x) && peq(b, w)); + default: + return 0; + } +} -- cgit v1.3.1