Unit 1-Lecture 9:State Machine

1 Definition

  • A state machine is nothing more than a binary relation on a set, except that the elements of the set are called “states,”
  • The relation is called the transition relation, and an arrow in the graph of the transition relation is called a transition.

2 The Invariant Principle

  • A preserved invariant of a state machine is a predicate, P , on states, such that whenever P(q) is true of a state, q, and q r for some state, r, then P(r) holds.
  • The Invariant Principle:
    If a preserved invariant of a state machine is true for the start state, then it is true for all reachable states.
  • The Invariant Principle is nothing more than the Induction Principle reformulated in a convenient form for state machines.

3 Two required properties to verify a program

  • Partial correctness:
    Partial correctness means that when there is a result, it is correct, but the process might not always produce a result, perhaps because it gets stuck in a loop.
  • Termination:
    Termination is that the process does always produce some final value.
  • Partial correctness can commonly be proved using the Invariant Principle.
  • Termination can commonly be proved using the Well Ordering Principle.

4 Derived Variables

  • Strickly decreasing and weakly decreasing.
  • If f is a strictly decreasing N-valued derived variable of a state machine, then the length of any execution starting at state q is at most f(q).
  • If there exists a strictly decreasing derived variable whose range is a well ordered set, then every execution terminates

Reference

[1] Lehman E, Leighton F H, Meyer A R. Mathematics for Computer Science[J]. 2015.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值