Documentation

VerifiedMBSE.Behavior.StateMachineKripke

StateMachine → KripkeStructure via ToKripke #

StateMachine S D inv に対する ToKripke instance を提供する。 これにより Always sm P 等の呼び出しが型クラス resolution 経由で透過的に解決される。

Coe からの移行理由 #

Coe (StateMachine S D inv) (KripkeStructure S D) instance は、inv が α 側のみに 現れるため Lean 4.30 の strict semi-out-params チェックに引っかかる (β = KripkeStructure S D から inv が flow できない)。

ToKripke 型クラスは State / Data のみ outParam とし、α = StateMachine S D inv 全体に対する instance matching を行うため、inv も含めて自然に解決される。

B-8 での拡張 #

KripkeStructureinv / step / reachable_inv / step_preserves_reachable を 持つようになったため、StateMachine.toKripke もこれらを埋める必要がある:

abbrev のまま維持することで (sm.toKripke).inv = inv / (sm.toKripke).reachable s d = Reachable sm s d の defeq が保たれる。

@[reducible, inline]
abbrev VerifiedMBSE.Behavior.StateMachine.toKripke {S D : Type} {inv : SDProp} (sm : StateMachine S D inv) :

StateMachine を KripkeStructure として見る。

abbrev なので reducible で、以下の defeq 関係が成立する:

  • (sm.toKripke).inv = inv (型引数そのもの)
  • (sm.toKripke).reachable s d = Reachable sm s d
  • (sm.toKripke).step s d s' d' = 遷移の存在量化

step の定義 #

step s d s' d' は「ある遷移 t ∈ sm.transitions が存在して、 t.source = s かつ t.guard d が成立し、t.target = s' かつ t.effect d = d' となる」ことを表す。

step_preserves_reachable の証明 #

step の存在量化を展開すると、対応する t と各等式が手に入るので、 Reachable.step コンストラクタをそのまま適用できる。

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    @[implicit_reducible]
    instance VerifiedMBSE.Behavior.instToKripkeStateMachine {S D : Type} {inv : SDProp} :
    ToKripke (StateMachine S D inv) S D

    StateMachine に対する ToKripke instance。

    これにより Always sm P で sm : StateMachine S D inv が渡されると、 ToKripke (StateMachine S D inv) S D が resolve され、 State = S, Data = D が outParam で決定される。

    Equations
    theorem VerifiedMBSE.Behavior.StateMachine.wellFormed_imp_nonEmpty {S D : Type} {inv : SDProp} {sm : StateMachine S D inv} (hwf : sm.WellFormed) :

    sm.WellFormed から sm.toKripke.NonEmpty を導く。

    theorem VerifiedMBSE.Behavior.StateMachine.WellFormed.nonEmpty {S D : Type} {inv : SDProp} {sm : StateMachine S D inv} (hwf : sm.WellFormed) :

    ドット記法用のエイリアス: hwf.nonEmpty.