Skip to content

Preconditions and Postconditions

This document explains how Askalot analyzes preconditions (when items are reachable) and postconditions (what answers are valid) through formal satisfiability analysis.

Preconditions: Item Reachability

For each item \(I_i\), the precondition \(P_i\) is a Boolean formula over the answer variables \(\mathbf{S} = (S_1, \dots, S_n)\) that determines whether the item is presented to the respondent.

Recall from Questionnaire Analysis that:

  • If an assignment \(\mathbf{a}\) satisfies \(P_i\) (written \(\mathbf{a} \models P_i\)), then item \(I_i\) is accessible (asked)
  • If \(\mathbf{a} \not\models P_i\), then item \(I_i\) is not presented
  • Evaluation is always with respect to domain-respecting assignments: \(\mathbf{a} \in \mathrm{Dom}\)

Reachability Classification

For each item \(I_i\), we classify its precondition \(P_i\) with respect to the base constraints \(B\) into three categories:

\[ \begin{aligned} \textbf{ALWAYS} &:\quad \mathrm{UNSAT}\bigl(B \wedge \lnot P_i\bigr)\\ \textbf{NEVER} &:\quad \mathrm{UNSAT}\bigl(B \wedge P_i\bigr)\\ \textbf{CONDITIONAL} &:\quad \text{otherwise} \end{aligned} \]

These classifications reveal the reachability properties of items:

ALWAYS Reachable

\(P_i\) is always reachable (always satisfiable) if for every valid assignment \(\mathbf{a}\) (i.e., \(\mathbf{a}\) satisfies the domain constraints), \(\mathbf{a}\) satisfies \(P_i\).

Formally:

\[ \forall\,\mathbf{a} \in \mathrm{Dom}, \quad \mathbf{a} \models P_i \]

where \(\mathrm{Dom}\) is the set of all domain-respecting assignments. In practice, this means item \(I_i\) is always presented regardless of how previous questions are answered.

Always Reachable Item

Demographic Survey:

  • \(I_1\): "What is your age?" with precondition \(P_1 = \text{True}\)
  • \(I_2\): "What is your gender?" with precondition \(P_2 = \text{True}\)

These opening demographic questions have no dependencies and are always asked, so they are ALWAYS reachable.

NEVER Reachable

\(P_i\) is never reachable (never satisfiable) if for every valid assignment \(\mathbf{a}\), \(\mathbf{a}\) does not satisfy \(P_i\).

Formally:

\[ \forall\,\mathbf{a} \in \mathrm{Dom}, \quad \mathbf{a} \not\models P_i \]

This indicates a logical error—there is no scenario where \(I_i\) can be accessed.

Never Reachable Item (Design Error)

Employee Survey with Logic Error:

  • \(I_1\): "Years of employment" with \(S_1 \in [0, 50]\)
  • \(I_2\): "Retirement benefits" with precondition \(P_2 = (S_1 \geq 20) \land (S_1 < 10)\)

The precondition \(P_2\) requires years of employment to be both ≥20 and <10 simultaneously, which is impossible. Item \(I_2\) is NEVER reachable, indicating a questionnaire design error that must be fixed.

CONDITIONALLY Reachable

\(P_i\) is conditionally reachable (conditionally satisfiable) if neither always nor never reachable; equivalently, there exists at least one valid assignment where \(P_i\) is satisfied and at least one where it is not satisfied.

Formally, there exist two domain-respecting assignments such that:

\[ \begin{array}{l} \exists\,\mathbf{a} \in \mathrm{Dom}, \quad \mathbf{a} \models P_i \\ \exists\,\mathbf{b} \in \mathrm{Dom}, \quad \mathbf{b} \not\models P_i \end{array} \]

This is the normal case for conditional questions that appear based on prior answers.

Conditionally Reachable Item

Family Survey:

  • \(I_1\): "Do you have children?" with \(S_1 \in \{0, 1\}\) (0=No, 1=Yes)
  • \(I_2\): "How many children do you have?" with precondition \(P_2 = (S_1 = 1)\)
  • \(I_3\): "Age of oldest child" with precondition \(P_3 = (S_2 > 0)\)

Both \(I_2\) and \(I_3\) are CONDITIONALLY reachable:

  • \(I_2\) is reached when \(S_1 = 1\) (has children), not reached when \(S_1 = 0\)
  • \(I_3\) is reached when \(S_2 > 0\) (reported children), not reached when \(S_2 = 0\)

Summary of Reachability Classifications

  • ALWAYS \(\quad\leftrightarrow\quad \forall \mathbf{a}\in \mathrm{Dom},\; \mathbf{a} \models P_i\)
  • NEVER \(\quad\leftrightarrow\quad \forall \mathbf{a}\in \mathrm{Dom},\; \mathbf{a} \not\models P_i\)
  • CONDITIONAL \(\quad\leftrightarrow\quad \exists\,\mathbf{a},\mathbf{b}\in\mathrm{Dom}\) such that \(\mathbf{a} \models P_i\) and \(\mathbf{b} \not\models P_i\)

Postconditions: Response Constraints

The postcondition \(Q_i\) is a Boolean formula over \(\mathbf{S}\) that constrains acceptable outcomes for item \(I_i\) to maintain semantic consistency with prior answers.

Postconditions are only evaluated when the item is asked (when \(P_i\) holds). Valid questionnaire responses must satisfy: \(P_i \implies Q_i\) (if the precondition holds, then the postcondition must hold).

Response Constraint Classification

Let \(B\) denote the base constraints, \(P_i\) the precondition, and \(Q_i\) the postcondition of item \(I_i\). We classify postconditions relative to their preconditions:

\[ \begin{aligned} \textbf{VACUOUS} &:\quad \mathrm{UNSAT}(B \wedge P_i) \\ \textbf{TAUTOLOGICAL} &:\quad \mathrm{UNSAT}(B \wedge P_i \wedge \lnot Q_i) \\ \textbf{CONSTRAINING} &:\quad \mathrm{SAT}(B \wedge P_i \wedge Q_i) \text{ and } \mathrm{SAT}(B \wedge P_i \wedge \lnot Q_i) \\ \textbf{INFEASIBLE} &:\quad \mathrm{UNSAT}(B \wedge P_i \wedge Q_i) \end{aligned} \]

VACUOUS Postconditions

If \(\mathrm{UNSAT}(B \wedge P_i)\) where \(B = \bigwedge_{k=1}^n D_k(S_k)\), the item is never reachable (precondition is never satisfiable), so the postcondition check is vacuous—it has no practical significance since the item never appears.

Formally:

\[ \forall\,\mathbf{a} \in \mathrm{Dom}, \quad \mathbf{a} \not\models P_i \]

Vacuity

Vacuous postconditions occur when the associated item is NEVER reachable. The postcondition itself may be well-formed, but it's irrelevant because the item never appears in any valid survey execution.

TAUTOLOGICAL Postconditions

\(Q_i\) is tautological relative to \(P_i\) if whenever the item is reached (under valid domain assignments), the postcondition is automatically satisfied regardless of the answer given.

Formally:

\[ \forall\,\mathbf{a} \in \mathrm{Dom}, \quad (\mathbf{a} \models P_i) \implies (\mathbf{a} \models Q_i) \]

Equivalently: \(B \wedge P_i \models Q_i\) where \(B = \bigwedge_{k=1}^n D_k(S_k)\). This typically indicates the postcondition adds no meaningful constraint beyond what the precondition and domain constraints already enforce.

Tautological Postcondition

Customer Satisfaction Survey:

  • \(I_1\): "Overall satisfaction rating" with \(S_1 \in [1, 5]\)
  • \(I_2\): "Would you recommend us?" with \(S_2 \in \{0, 1\}\) (0=No, 1=Yes), precondition \(P_2 = (S_1 \geq 3)\)
  • Postcondition \(Q_2 = (S_2 \geq 0)\)

The postcondition \(Q_2\) is TAUTOLOGICAL because \(S_2 \geq 0\) is already guaranteed by the domain constraint \(S_2 \in \{0, 1\}\). This postcondition provides no additional validation and should be removed or strengthened.

CONSTRAINING Postconditions

\(Q_i\) is constraining if it meaningfully restricts the acceptable answers when the item is reached. There exist valid assignments where the item is reached and the postcondition is satisfied, as well as assignments where it is reached but the postcondition is violated.

Formally, there exist two domain-respecting assignments such that:

\[ \begin{array}{l} \exists\,\mathbf{a} \in \mathrm{Dom}, \quad (\mathbf{a} \models P_i) \text{ and } (\mathbf{a} \models Q_i) \\ \exists\,\mathbf{b} \in \mathrm{Dom}, \quad (\mathbf{b} \models P_i) \text{ and } (\mathbf{b} \not\models Q_i) \end{array} \]

This is the normal case where postconditions provide meaningful validation of responses.

Postconditions serve two complementary roles:

  1. Validation role: Check whether the given answer makes sense regarding previous answers
  2. Domain restriction role: Further limit the base constraint (the available answers) based on prior responses

Constraining Postcondition: Validation Role

Income Survey:

  • \(I_1\): "Your personal income" with \(S_1 \in [0, 1000000]\)
  • \(I_2\): "Your spouse's income" with \(S_2 \in [0, 1000000]\), precondition \(P_2 = (S_{\text{married}} = 1)\)
  • \(I_3\): "Total household income" with \(S_3 \in [0, 2000000]\), postcondition \(Q_3 = (S_3 \geq S_1 + S_2)\)

The postcondition \(Q_3\) is CONSTRAINING and serves a validation role:

  • It is satisfied when \(S_3 \geq S_1 + S_2\) (valid responses exist, e.g., \(S_1=30000, S_2=25000, S_3=60000\))
  • It is violated when \(S_3 < S_1 + S_2\) (invalid responses exist, e.g., \(S_1=30000, S_2=25000, S_3=40000\))

This postcondition validates that household income is logically consistent with individual incomes reported earlier.

Constraining Postcondition: Domain Restriction Role

Age-Based Survey:

  • \(I_1\): "Your age" with \(S_1 \in [0, 120]\)
  • \(I_2\): "Your child's age" with \(S_2 \in [0, 120]\), precondition \(P_2 = (S_{\text{has\_children}} = 1)\)
  • Postcondition: \(Q_2 = (S_2 < S_1)\)

The postcondition \(Q_2\) is CONSTRAINING and serves a domain restriction role:

  • Base domain: \(S_2 \in [0, 120]\) (120 possible values)
  • With postcondition \(S_2 < S_1\): If parent is 40, child's age must be in \([0, 39]\) (40 possible values)
  • The postcondition dynamically restricts the available answer domain based on the parent's age

This demonstrates how postconditions can narrow down the valid answer space based on prior responses, not just validate after the fact.

INFEASIBLE Postconditions

\(Q_i\) is infeasible if it cannot be satisfied whenever the item is reached under valid domain assignments.

Formally:

\[ \forall\,\mathbf{a} \in \mathrm{Dom}, \quad (\mathbf{a} \models P_i) \text{ and } (\mathbf{a} \not\models Q_i) \]

Equivalently: there does not exist any \(\mathbf{a} \in \mathrm{Dom}\) such that both \(\mathbf{a} \models P_i\) and \(\mathbf{a} \models Q_i\). This represents a logical error—the item asks for an impossible answer given its preconditions and domain constraints.

Infeasible Postcondition (Design Error)

Budget Allocation Survey:

  • \(I_1\): "Marketing budget" with \(S_1 \in [10000, 50000]\)
  • \(I_2\): "R&D budget" with \(S_2 \in [20000, 80000]\)
  • \(I_3\): "Total annual budget" with \(S_3 \in [0, 60000]\), postcondition \(Q_3 = (S_3 \geq S_1 + S_2)\)

The postcondition \(Q_3\) is INFEASIBLE because:

  • Minimum required value: \(S_3 \geq 10000 + 20000 = 30000\)
  • But even at minimum, we could have \(S_1=10000, S_2=20000\), requiring \(S_3 \geq 30000\)
  • However, when \(S_1=50000, S_2=80000\), we need \(S_3 \geq 130000\)
  • The domain constraint \(S_3 \leq 60000\) makes this impossible

This is a design error: the domain of \(S_3\) is too restrictive given the postcondition requirement.

Summary of Response Constraint Classifications

  • VACUOUS: Item never reachable, postcondition irrelevant
  • TAUTOLOGICAL: Postcondition always satisfied when item is reached (adds no constraint)
  • CONSTRAINING: Postcondition sometimes satisfied, sometimes violated (meaningful validation)
  • INFEASIBLE: Postcondition never satisfiable when item is reached (design error)

Further Reading