Formal Reasoning in Practice

  1. Making a Claim About Program State

    A state claim describes values allowed at a particular point. Specifying that point matters because operations can change whether the claim holds.

    Undergraduate
  2. Reading an Assignment as a State Transition

    A simple assignment evaluates its right-hand expression using the prior state, then updates the destination indicated by the assignment.

    Undergraduate
  3. Proving a Postcondition for One Increment

    A proof for a simple assignment can relate its post-update value to the input. Use the target property to identify adequate initial states.

    Undergraduate
  4. An Intermediate Assertion Between Assignments

    An intermediate assertion can connect the promised result of one step to the starting requirement of the next.

    Undergraduate
  5. Proving a Conditional by Splitting on Its Test

    Each branch can be proved under the conditions allowing it to run. Together the cases support a claim for the whole conditional.

    Undergraduate
  6. Checking a Loop Invariant Before the First Step

    Initialization establishes that a loop invariant holds even when the body has run zero times.

    Undergraduate
  7. Checking That One Loop Step Preserves an Invariant

    Preservation assumes an invariant before an allowed iteration and proves it remains true afterward.

    Undergraduate
  8. Using a Loop Invariant at Exit

    An invariant describes maintained facts. The loop's exit condition says which facts about remaining work hold when it finishes.

    Undergraduate
  9. An Inductive Invariant for a Reservation Counter

    An inductive state invariant is true initially and maintained by every allowed transition. A counter rule can be checked at each operation.

    Undergraduate
  10. Proving Termination with Remaining Work

    A decreasing measure into the natural numbers can show that an operation eventually reaches a base case or stops looping.

    Undergraduate
  11. Partial and Total Correctness

    Partial correctness establishes a promised result whenever an operation terminates normally from allowed state. Total correctness also supplies termination under those conditions.

    Undergraduate
  12. A Counterexample as a State Trace

    A reachable sequence of steps can refute a claim by showing a first state where the promised property fails.

    Undergraduate
  13. Checking a Small State Graph Explicitly

    For a finite model, systematic reachability can inspect every state accessible from the specified initial conditions.

    Undergraduate
  14. What a Bounded State Check Covers

    A bounded check explores execution only within a stated horizon. Failure within that horizon can give a concrete trace.

    Undergraduate
  15. A Safety Property for a Queue Limit

    A safety invariant can rule out a state with too many queued items. A finite bad prefix can demonstrate a violation.

    Undergraduate
  16. A Liveness Property for Eventual Work

    A liveness claim can say that an accepted request will eventually reach a specified outcome under stated assumptions.

    Undergraduate
  17. Using an Implication with a Preconditions Check

    A precondition can establish facts useful for later reasoning. Its direction matters when using it to justify an operation.

    Undergraduate
  18. Equivalent Results for Two Pure Rules

    Two pure implementations can be compared by checking whether their output agrees for every input in the stated domain.

    Undergraduate
  19. Representing Allowed States with Types

    A data type can encode distinct alternatives and require each to carry the fields meaningful for that state.

    Undergraduate
  20. Checking Exhaustiveness After Adding a Variant

    An exhaustive match handles every currently allowed form. Adding a new variant can reveal callers needing a decision about that case.

    Undergraduate
  21. What Changes When Two Quantifiers Swap

    Changing the order of existential and universal quantifiers can change whether one shared witness suffices or each item can have its own.

    Undergraduate
  22. A Countermodel with Two Boolean Flags

    A countermodel for entailment is a valuation where the premises hold and the claimed conclusion fails.

    Undergraduate
  23. Two Constraints Can Describe an Empty Range

    Constraints on the same quantity can be individually satisfiable while no value satisfies them together.

    Undergraduate
  24. An Abstraction Can Lose a Relationship Between Variables

    Summarizing variables separately can preserve individual ranges while forgetting which combinations are possible together.

    Undergraduate
  25. A Worklist Check on a Small Dependency Graph

    When checking reachability or propagating facts, a worklist retains pending nodes. Processing can add later work depending on what changed.

    Undergraduate
  26. What a Property Test Establishes

    A property test checks a specified relation on selected instances. A general proof establishes a claim over every input covered by its assumptions.

    Undergraduate
  27. Representing Two Workers by Interleavable Steps

    A model of concurrent work should specify which steps are atomic and which can be ordered differently between workers.

    Undergraduate
  28. Choosing Assertions from a Useful Interface Contract

    Assertions used in a proof or analysis should capture the observable requirements and the facts needed to establish them.

    Undergraduate
  29. Reviewing a State Model with an Example Trace

    A small ordinary trace can show whether a model has the same transitions and observable distinctions as the intended workflow.

    Undergraduate
  30. Stating Assumptions Alongside a Correctness Claim

    A correctness result depends on the assumed input set, execution model, and required observations. State them near the claimed property.

    Undergraduate