Skip to content

Commit

Permalink
absences of contradictory facts consistent
Browse files Browse the repository at this point in the history
Two facts that would contradict each other may both be absent. There's no law of the excluded middle in AuthoritySpoke.
  • Loading branch information
mscarey committed Jun 29, 2019
1 parent ab38701 commit 7a28fcd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion authorityspoke/factors.py
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ def _contradicts_if_factor(self, other: Factor) -> bool:

if self.absent:
if other.absent:
return other._contradicts_if_present(self)
return False
return other._implies_if_present(self)
if not other.absent:
return self._contradicts_if_present(other)
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ def watt_factor(make_predicate, make_entity, watt_mentioned) -> Dict[str, Factor
"f8_higher_int": Fact(p["p8_higher_int"], (0, 2), case_factors=c),
"f8_int": Fact(p["p8_int"], (0, 2), case_factors=c),
"f8_less": Fact(p["p8_less"], (0, 2), case_factors=c),
"f8_less_absent": Fact(p["p8_less"], (0, 2), absent=True, case_factors=c),
"f8_meters": Fact(p["p8_meters"], (0, 2), case_factors=c),
"f9_absent": Fact(p["p9"], absent=True, case_factors=c),
"f9_absent_miles": Fact(p["p9_miles"], absent=True, case_factors=c),
Expand Down
16 changes: 15 additions & 1 deletion tests/test_factors.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ def test_factor_reciprocal_unequal(self, watt_factor):
def test_factor_different_predicate_truth_unequal(self, watt_factor):
assert not watt_factor["f7"].means(watt_factor["f7_opposite"])

def test_unequal_because_one_factor_is_absent(self, watt_factor):
assert not watt_factor["f8"].means(watt_factor["f8_absent"])

def test_copies_of_identical_factor(self, make_factor):
"""
Even if the two factors have different entity markers in self.context_factors,
Expand Down Expand Up @@ -420,7 +423,7 @@ def test_equal_factors_not_gt(self, watt_factor):

def test_standard_of_proof_comparison(self, watt_factor):
f = watt_factor
assert f["f2_clear_and_convincing"] >= f["f2_preponderance_of_evidence"]
assert f["f2_clear_and_convincing"].implies(f["f2_preponderance_of_evidence"])
assert f["f2_beyond_reasonable_doubt"] >= f["f2_clear_and_convincing"]

def test_no_implication_between_factors_with_and_without_standards(
Expand Down Expand Up @@ -459,6 +462,9 @@ def test_factor_contradiction_absent_predicate(self, watt_factor):
assert watt_factor["f3"].contradicts(watt_factor["f3_absent"])
assert watt_factor["f3_absent"].contradicts(watt_factor["f3"])

def test_two_absences_dont_contradict(self, watt_factor):
assert not watt_factor["f8_absent"].contradicts(watt_factor["f8_less_absent"])

def test_factor_no_contradiction_no_truth_value(self, watt_factor):
assert not watt_factor["f2"].contradicts(watt_factor["f2_no_truth"])
assert not watt_factor["f2_no_truth"].contradicts(watt_factor["f2_false"])
Expand Down Expand Up @@ -564,3 +570,11 @@ def test_check_entity_consistency_type_error(
])
def test_addition(self, make_factor, left, right, expected):
assert make_factor[left] + make_factor[right] == make_factor[expected]

def test_add_unrelated_factors(self, make_factor):
assert make_factor["f_murder"] + make_factor["f_crime"] is None

def test_cant_add_enactment_to_fact(self, watt_factor, make_enactment):
with pytest.raises(TypeError):
print(watt_factor["f3"] + make_enactment["search_clause"])

0 comments on commit 7a28fcd

Please sign in to comment.