概要

通常の論理を拡張して、みらいに関するある種の主張(assertion)を含むようにしたもの。このページでは主に並行プログラムにおけるTemporal logic (Linear Temporal Logic)についてまとめる。

: now and forever (常に) : now or sometime in the future (最終的に、Eventually)

並行プログラム

  • : sequence of program states
    • 以下の条件を満たしてstate transitionを起こす
      • Valid starting state: is possible program state
      • Transition: について、からに含まれる1つのアトミック処理によって引き起こされる
      • Fairness: に含まれるアトミック処理は、の実行にいつか含まれる
  • 現在のステートのみから次の遷移可能なステート群が決まる

Immediate Assertions

  • Temporal logicは、, , などの一般的な論理記号と, からなる、Immediate Assertion(即時アサーション)から構築される
  • プログラムのステートにおける関数
  • 記法
    • : ステートにおいて、即時アサーションが真である
      • 例: はステートにおいてが満たされていることを示す
  • : プログラムの制御がステートメントの開始地点にある状態を示す (は実行可能なプログラムのステートメント)
  • : プログラムの制御がの開始地点あるいは内部の何処かにある状態を示す
  • : プログラムの制御がの直後にある状態を示す
    • whileループのafterは、ループの条件式テスト地点にいることを示す
    • Aがcobeginの中のステートメントの場合、cobegin全体が終了しているか、cobeginは実行中だがAは終わっている、という状態

Temporal Assertions

  • プログラムの実行シーケンスにおける関数
  • 記法
    • : プログラムの無限の実行シーケンスにおいてtemporal assertion が真である
  • Immediate assertionsとの関連性:
    • if and only if
  • 時相演算子を使う場合
    • if and only if
    • if and only if

公式

  • (含意): if is true now, then will always be true
  • (不変条件): if ever becomes true, then it will remain true forever
  • : if ever becomes true, then will be true at the same time or later
    • : leads ともいう
  • : Pは最終的に真になるか、永遠に偽でありつづけるかのどちらかである
  • : 推移律

Proof lattices

以下が言えれば、推移律からが言える

  • Proof latticeの定義: A proof lattice for a program is a fnite directed acyclic graph in which each node is labeled with an assertion, such that
    • There is a single entry node having no incoming edges (図の)
    • There is a single exit node having no outgoing edges (図の)
    • If a node labeled has outgoing edges to nodes labeled , then holds for the program
  • ということは、ある時点でがtrueの場合もtrue

定理: If there is a proof lattice for a program with entry node labeled and exit node labeled , then is true for that program

Safetyの時相論理による表現

  • : でプログラムを開始したら、は常にtrueであり続ける
  • partial correctnessの表現:
  • Mutexの時相論理による表現:

Livenessの時相論理による表現

  • 以下のfairnessを前提に置く
    • Atomic assignment axiom: for any atomic assignment statement :
    • while control flow axiom: For the statement : while <> do s: S od,
  • 「悪いことが起こらない」というSafetyと「何かが最終的に起こる」というfairnessを組み合わせて、「なにか良いことが最終的に起こる」というlivenessを導く

参考