Procedures

Inheritance diagram of authorityspoke.procedures.Procedure
class authorityspoke.procedures.Procedure(outputs, inputs=None, despite=None, name='', absent=False, generic=False)

A (potential) rule for courts to use in resolving litigation.

Described in terms of inputs and outputs, and also potentially “despite” Factors, which occur when a Rule could be said to apply “even if” some “despite” factor is true.

Users generally should not need to interact with this class directly, under the current design. Instead, they should interact with the class Rule.

Parameters
  • outputs (ComparableGroup[Factor]) – an outcome that a court may accept based on the presence of the inputs

  • inputs (Optional[ComparableGroup[Factor]]) – supporting Factors in favor of the output. The input Factors are not treated as potential undercutters.

  • despite (Optional[ComparableGroup[Factor]]) – Factors that do not prevent the court from imposing the output. These could be considered “failed undercutters” in defeasible logic. If a Factor is relevant both as support for the output and as a potential undercutter, include it in both inputs and despite.

  • name (str) – An identifier that can be used to reference and incorporate an existing procedure in a new Factor, instead of constructing a new copy of the Procedure.

  • absent (bool) – Whether the absence, rather than presence, of this Procedure is being referenced. The usefulness of this is unclear, but I’m not prepared to eliminate it before the Argument class has been implemented and tested.

  • generic (bool) – Whether the this Procedure is being referenced as a generic example, which could be replaced by any other Procedure.

__init__(outputs, inputs=None, despite=None, name='', absent=False, generic=False)

Initialize self. See help(type(self)) for accurate signature.

_trigger_addition(other, context)

Add two Procedures, given that they have already been found to be addable.

__add__(other)

Show how first Procedure triggers the second if not both are universal.

Return type

Optional[Procedure]

add_if_universal(other)

Show how first Procedure triggers the second if both are universal.

Return type

Optional[Procedure]

partial_explanations_union(other, context=None)

Yield as much of the context as seems likely correct based on this Procedure.

Return type

Iterable[ContextRegister]

union_from_explanation(other, context)

Combine two Procedures into one.

The new Procedure will have all of the inputs, outputs, and despite Factors of both self and other.

All of the context Factors of self will remain the same.

Return type

Optional[Procedure]

__len__()

Get number of generic Factors specified for self.

Returns

the number of generic Factors that need to be specified for this Procedure.

__repr__()

Return repr(self).

__str__()

Return str(self).

property factors_all

Get Factors in inputs, outputs, and despite.

Return type

List[Factor]

Returns

a list of all Factors.

property generic_factors_by_name

Factors that can be replaced without changing selfs meaning.

If self.generic is True then the only generic Factor is self. This could happen if the Procedure was mentioned generically in an Argument about preserving objections for appeal, for instance.

Return type

Dict[str, Comparable]

Returns

self’s generic Factors, which must be matched to other generic Factors to perform equality or implication tests between Factors with Factor.means() or Factor.__ge__().

add_factor(incoming, role='inputs')

Add an output, input, or despite Factor.

Parameters
  • incoming (Factor) – the new Factor to be added to input, output, or despite

  • role (str) – specifies whether the new Factor should be added to input, output, or despite

Return type

Procedure

Returns

a new version of self with the specified change

contradicts(other, context=None)

Find if self applying in some cases implies other cannot apply in some.

Raises an error because, by analogy with Procedure.implies(), users might expect this method to return True only when Rule with universal=False and Procedure self would contradict another Rule with universal=False and Procedure other. But that would never happen.

Return type

bool

contradicts_some_to_all(other, context=None)

Find if self applying in some cases implies other cannot apply in all.

Return type

bool

Returns

whether the assertion that self applies in some cases contradicts that other applies in all cases, where at least one of the Rules is mandatory.

has_input_or_despite_factors_implied_by_all_inputs_of(other, context=None)

Check if every input of other implies some input or despite factor of self.

Return type

Iterator[ContextRegister]

has_input_or_despite_factors_implying_all_inputs_of(other, context=None)

Check if every input of other is implied by some input or despite factor of self.

Return type

Iterator[ContextRegister]

explain_contradiction_some_to_all(other, context=None)

Explain why other can’t apply in all cases if self applies in some.

Return type

Iterator[ContextRegister]

explain_implication_all_to_all(other, context=None)

Yield contexts establishing that if self is always valid, other is always valid.

Return type

Iterator[ContextRegister]

implies_all_to_all(other, context=None)

Find if self applying in all cases implies other applies in all.

self does not imply other if any output of other is not equal to or implied by some output of self.

For self to imply other, every input of self must be implied by some input of other.

self does not imply other if any despite of other contradicts() an input of self.

Return type

bool

Returns

whether the assertion that self applies in all cases implies that other applies in all cases.

explain_implication_all_to_some(other, context=None)

Yield contexts establishing that if self is always valid, other is sometimes valid.

Return type

Iterator[ContextRegister]

implies_all_to_some(other, context=None)

Find if self applying in all cases implies other applies in some.

For self to imply other, every output of other must be equal to or implied by some output of self.

For self to imply other, every input of self must not be contradicted by any input or despite of other.

self does not imply other if any “despite” Factors of other are not implied by inputs of self.

Return type

bool

Returns

whether the assertion that self applies in all cases implies that other applies in some cases (that is, if the list of self’s inputs is not considered an exhaustive list of the circumstances needed to invoke the procedure).

_implies_if_present(other, context=None)

Find if self would imply other if they aren’t absent.

When self and other are included in Rules that both apply in some cases:

self does not imply other if any output of other is not equal to or implied by some output of self.

self does not imply other if any input of other is not equal to or implied by some input of self.

self does not imply other if any despite of other is not equal to or implied by some despite or input of self.

Return type

Iterator[ContextRegister]

Returns

whether the assertion that self applies in some cases implies that the Procedure other applies in some cases.

explanations_same_meaning(other, context=None)

Yield contexts that could cause self to have the same meaning as other.

Return type

Iterator[ContextRegister]

means(other, context=None)

Determine whether other has the same meaning as self.

Return type

bool

Returns

whether the two Procedures have all the same Factors with the same context factors in the same roles.

new_context(changes)

Create new Procedure, replacing keys of changes with values.

Parameters

changes (ContextRegister) – a dict of Factors to replace matched to the Factors that should replace them

Return type

Procedure

Returns

new Procedure object, replacing keys of changes with their values.

triggers_next_procedure(other, context=None)

Test if Factors from firing self would trigger other.

Note

To be confident that self actually can trigger other, we would have to assume that self or other has universal: True since otherwise there could be a mismatch between what is provided and what is needed to trigger other.

Parameters

other (Procedure) – another Procedure to test to see whether it can be triggered by triggering self

Return type

Iterator[ContextRegister]

Returns

whether the set of Factors that exist after self is fired could trigger other

triggers_next_procedure_if_universal(other, context=None)

Test if Factors from firing self trigger other if both are universal.

The difference from triggers_next_procedure() is that this function doesn’t require the “despite” Factors to be addressed. If both calling Ruless apply in “ALL” cases where their inputs are present, then it doesn’t matter what Factors they apply “despite”.

Parameters

other (Procedure) – another Procedure to test to see whether it can be triggered by triggering self

Return type

Iterator[ContextRegister]

Returns

whether the set of Factors that exist after self is fired could trigger other