Procedures

Inheritance diagram of authorityspoke.procedures.Procedure
class authorityspoke.procedures.Procedure(**data)

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 – an outcome that a court may accept based on the presence of the inputs

  • inputs – supporting Factors in favor of the output. The input Factors are not treated as potential undercutters.

  • despiteFactors 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 – 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 – 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 – Whether the this Procedure is being referenced as a generic example, which could be replaced by any other Procedure.

property outputs_group

Get input Factors as a FactorGroup.

Return type

FactorGroup

property inputs_group

Get input Factors as a FactorGroup.

Return type

FactorGroup

property despite_group

Get despite Factors as a FactorGroup.

Return type

FactorGroup

property groups

Get input, output, and despite Factors as FactorGroups.

Return type

List[FactorGroup]

add(other, context=None)

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

Return type

Optional[Procedure]

__add__(other)

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

Return type

Optional[Procedure]

_add_if_universal(other, explanation)

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

Return type

Optional[Procedure]

_trigger_addition(other, explanation)

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

Return type

Procedure

_explanations_union_partial(other, context=None)

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

Return type

Iterable[ContextRegister]

explanations_union(other, context=None)

Yield explanations of contexts that allow combining these Procedures.

Return type

Iterator[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.

__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 recursive_terms

Collect self’s terms, and their terms, recursively.

Return type

Dict[str, Term]

Returns

a dict (instead of a set, to preserve order) of Terms.

property terms

Get Factors used in comparisons with other Factors.

Return type

TermSequence

Returns

a tuple of attributes that are designated as the terms for whichever subclass of Factor calls this method. These can be used for comparing objects using consistent_with()

generic_terms_by_str()

Factors that can be replaced without changing selfs meaning.

self.generic can’t be True for Procedure.

Return type

Dict[str, Term]

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)

Add an input Factor.

Parameters

incoming (Factor) – the new Factor to be added to input

Return type

None

Returns

None

with_factor(incoming)

Create new Procedure with added input Factor.

Parameters

incoming (Factor) – the new Factor to be added to input

Return type

Optional[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)

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

Return type

Iterator[Explanation]

_has_input_or_despite_factors_implying_all_inputs_of(other, context)

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

Return type

Iterator[Explanation]

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[Explanation]

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[Explanation]

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[Explanation]

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.

set_inputs(factors)

Set factors required to invoke this Procedure.

Return type

None

set_despite(factors)

Set factors that do not preclude application of this Procedure.

Return type

None

set_outputs(factors)

Set the outputs of this Procedure.

Return type

None

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[Explanation]

Returns

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

union(other, context=None)

Get a procedure with all the inputs and outputs of self and other.

Return type

Optional[Comparable]

valid_for_exclusive_tag()

Check if Procedure is suitable to be labeled the “exclusive” method to reach an output.

Return type

None

__weakref__

list of weak references to the object (if defined)