第5章修改稿

Similar documents
勤 學 * 卓 越 * 快 樂 成 長 本 校 在 老 師 群 策 群 力 共 同 討 論 下, 型 塑 了 學 校 願 景 : 勤 學 卓 越 快 樂 成 長 ( 一 ) 勤 學 運 用 真 的 力 量 培 養 勤 學, 以 語 文 教 為 基 礎 紮 根 ( 二 ) 卓 越 利 用 美 的 感

<4D F736F F D AB4FA5C0A448ADFBA4FEAFC5C0B3C0CBB8EAAEC6B2C4A447B3A1A5F E646F63>


<4D F736F F D D2D AB4FA5C0A448ADFBB3E6A440AFC5C0CBA977B8D5C344B2C4A447B3A1A5F75FB6C25F2E646F63>

竞赛报名与报名审核

zyk00168ZW.PDF

( ) Wuhan University

第8章修改稿

<3935BCC6A5D2C1CDB6D52E747066>

Microsoft Word 生物02.doc

数 学 高 分 的 展 望 一 管 理 类 联 考 分 析 第 一 篇 大 纲 解 析 篇 编 写 : 孙 华 明 1 综 合 能 力 考 试 时 间 :014 年 1 月 4 日 上 午 8:30~11:30 分 值 分 配 : 数 学 :75 分 逻 辑 :60 分 作 文 :65 分 ; 总

校园之星

腰部酸痛保健法


Microsoft Word - mei.doc

untitled

酒 神 (长篇小说)

(Microsoft Word - 136\260g\270\364\252\272\267s\256Q.doc)



2014教师资格证考试《中学综合素质》仿真模拟题(4)

粤社保函〔2013〕80号

( CIP).:,3.7 ISBN TB CIP (3) ( ) ISBN O78 : 3.

2006..,1..,2.,.,2..,3..,3 22..,4..,4 :..,5..,5 :..,5..,6..,6..,8..,10 :..,12..,1..,6..,6.., ,5,:..,1 :..,1 :..,1 :..,2..,2..,3 :..,1 :..,1..,1.

重 庆 市 万 州 区 人 民 政 府 公 报 卷 首 语 开 启 加 快 建 设 重 庆 第 二 大 城 市 新 征 程 1 万 州 区 委 区 政 府 文 件 传 达 政 令 宣 传 政 策 指 导 工 作 服 务 全 区 中 共 重 庆 市 万 州 区 委 重 庆 市 万 州 区 人 民 政

微积分 授课讲义

論鄭玄對《禮記‧月令》的考辨


桃園縣南美國民小學102學年度學校課程計畫

國立中山大學學位論文典藏.PDF

Python a p p l e b e a r c Fruit Animal a p p l e b e a r c 2-2


. () ; () ; (3) ; (4).. () : P.4 3.4; P. A (3). () : P. A (5)(6); B. (3) : P.33 A (9),. (4) : P. B 5, 7(). (5) : P.8 3.3; P ; P.89 A 7. (6) : P.

重 要 声 明 长 城 证 券 股 份 有 限 公 司 编 制 本 报 告 的 内 容 及 信 息 来 源 于 陕 西 东 岭 工 贸 集 团 股 份 有 限 公 司 提 供 的 证 明 文 件 以 及 第 三 方 中 介 机 构 出 具 的 专 业 意 见 长 城 证 券 对 报 告 中 所 包

避孕篇


Avision

EP-X Postscript data

,,,,,,., Penrose i,, i j X A {i,, i j }-, X A {, 3}-, A,3 ; A Moore- Penrose A = A,2,3,4., A 5,, Moore-Penrose A {}- A, A. m n Moore-Penrose A, {}- A,

國家圖書館典藏電子全文

(Microsoft Word - \246D\252k\267\247\255n_\275\306\277\357_.docx)

VHDL(Statements) (Sequential Statement) (Concurrent Statement) VHDL (Architecture)VHDL (PROCESS)(Sub-program) 2

M ( ) K F ( ) A M ( ) 1815 (probable error) F W ( ) J ( ) n! M ( ) T ( ) L ( ) T (171

第 三 条 基 金 管 理 人 基 金 托 管 人 和 基 金 份 额 持 有 人 的 权 利 义 务, 依 照 本 法 在 基 金 合 同 中 约 定 基 金 管 理 人 基 金 托 管 人 依 照 本 法 和 基 金 合 同 的 约 定, 履 行 受 托 职 责 通 过 公 开 募 集 方 式

学报 2017 年第 2 期 Z[\]^-!"F _YB$` G (RB.+,,/67 (R #; +K H 4 B2 # RS _ c ; ; 2 +K X2 #; +K X ` : B # P N :#2 & ` 2 $ H ` 2 ` & 2 #; & &+K L` ; 2 &+K Bc 2

幻灯片 1

6 C51 ANSI C Turbo C C51 Turbo C C51 C51 C51 C51 C51 C51 C51 C51 C C C51 C51 ANSI C MCS-51 C51 ANSI C C C51 bit Byte bit sbit

新 社 會 政 策 雙 月 刊 內 地 女 性 在 香 港 所 生 的 活 產 嬰 兒 數 目 年 份 活 產 嬰 兒 數 目 其 配 偶 為 香 港 永 久 性 居 民 其 配 偶 為 非 香 港 永 久 性 居 民 其 他 小 計 ,219 L

第一章合成.ppt

Ps22Pdf

G(z 0 + "z) = G(z 0 ) + "z dg(z) dz z! # d" λ "G = G(z 0 ) + #cos dg(z) ( & dz ) * nv #., - d+ - - r 2 sin cosds e / r # ddr 4.r 2 #cos! "G = G(z 0 )

996,,,,,,, 997 7, 40 ; 998 4,,, 6, 8, 3, 5, ( ),, 3,,, ;, ;,,,,,,,,,

,

$!#!"!"! # $!%%! & ( ) ) ( * &% #% - (%!B &% CB # $!#%& #!#%& $!#%& " * &&!#%& ( ) ) # ( &! &)( &+ &# $)! &$ "&( &( & *+(!,(-& &,.+/ ,

ebook14-4

untitled

新 竹 市 都 市 計 畫 委 員 會 第 233 次 會 議 紀 錄 壹 時 間 :102 年 8 月 28 日 ( 星 期 三 ) 上 午 9 時 30 分 貳 地 點 : 本 府 第 一 會 議 室 參 主 持 人 : 許 主 任 委 員 明 財 肆 出 席 委 員 : 詳 簽 到 簿 伍 列

春 天 来 了, 万 物 复 苏, 小 草 绿 了 小 河 解 冻 了 柳 树 发 芽 了 桃 花 盛 开 了 春 天 给 大 自 然 带 来 了 盎 然 生 机 春 天 的 景 物 是 美 丽 的, 春 天 的 故 事 是 动 人 的, 我 们 有 取 之 不 尽 的 以 春 为 主 题 的 作


重點一不等式的意義

食品伙伴网

WL100079ZW.PDF

頭 上 下 舌 齒 三 十 二 相 大 智 度 論 卷 4 ( 大 正 25,90a-91a) (22) 四 十 齒 相 (23) 齒 齊 相 (24) 牙 白 相 (26) 味 中 得 上 味 相 (27) 大 舌 相 八 十 種 好 大 般 若 經 卷 381 ( 大 正 6,968a9-969

扬州大学(上)

长 赵 金 勇 党 组 书 记 王 文 娟 金 华 市 市 长 暨 军 民 和 汉 诺 威 米 兰 展 览 ( 上 海 ) 有 限 公 司 总 经 理 符 禹 等 出 席 开 幕 式, 金 华 市 副 市 长 义 乌 市 市 长 盛 秋 平 主 持 开 幕 式 并 致 辞 专 业 展 会 呈 现 多

《晚年周恩来》目录

《西游记》(一)

PURPOSE

Microsoft Word - 功医检测问&答


[1] (p.28) / / 3 4 [1] (p.26) [2] (p.171)

<4D F736F F D20C7B3CCB8CBDCC1CFB4FCD3EBC9E7BBE1B8A3C0FBA1AAA1AAD6ECC7A7B7AB2E646F63>

第10章修改稿

cumcm0110.PDF

untitled

婚姻與生育初探

Spyder Anaconda Spyder Python Spyder Python Spyder Spyder Spyder 開始 \ 所有程式 \ Anaconda3 (64-bit) \ Spyder Spyder IPython Python IPython Sp

!"#$ % & ())*$ $ +,-./0)1)1/.21/.$ 3 4$ 5 4$ 6 789:;9< $ = :; A B CD ())* E )FG(*? H$ $ $ $ $ $ $ $ $ $ % IJ!"#% &$ KLMNO 2(* H 2G))(2 $ PQ R

, 7, Windows,,,, : ,,,, ;,, ( CIP) /,,. : ;, ( 21 ) ISBN : -. TP CIP ( 2005) 1

:

!# $#!#!%%& $# &% %!# (# )#! "

Solutions to Exercises in "Discrete Mathematics Tutorial"


UDC


新时期共青团工作实务全书(三十九)

6寸PDF生成工具

B4C2









1

Solutions to Exercises in "Discrete Mathematics Tutorial"


Transcription:

(Programming Language), ok,, if then else,(), ()() 5.0 5.0.0, (Variable Declaration) var x : T x, T, x,,,, var x : T P = x, x' : T P P, () var x:t P,,, yz, var x : int x:=2. y := x+z = x, x' : int x' =2 y' =2+z z' =z = y' =2+z z' =z, var x : int y:=x = x, x' : int x' =x y' =x z' =z = z' =z z, x, y var x : int y := x x = y' =0 z' =z,,,, undefined,,

var x : T P = x : undefined x' : T, undefined P, et var x : T := e P = x : e x' : T P s,, var x, y, z : T P = x, x', y, y', z, z' : T P --------------------------------------------------------------------------------------------------------------------------------------------------------,, 5.0.1 w, x, yzwx, frame w, x, var frame w, x P = P y' =y z' =z Pwx, (import), Pyz, (, )frame (frame) frame x := e = frame x x' = e ------------------------------------------------------------------------------------------------------------------------------------------------------- s' = Ls, L s:= Ls, n, 0#L s := L = frame s var n : nat s' = L, s, L, n, -----------------------------------------------------------------------------------------------------------------------------------------------------------

5.1 5.1.0, (Array)A23 A(2) := 3 A, i, e, A i := e = A' i=e ( j j i A' j = A j ) x' =x y' =y..., Aie, A,, A(A2) := 3 = A' (A2)=3 ( j j A2 A' j=aj ) x' =x y' =y... x := e. P = (Pxe),, A2 :=3. i:=2. A i := 4. A i = A2 T, i=2, A2=A2T, A2:=3. i:=2. A i := 4. A i = A2 = A2:=3. i:=2. 4=A2 = A2:=3. 4=A2 = 4=3 = A2:=2. A(A2):=3. A2=2,, A2=3, A2:=2. A(A2):=3. A2=2 = A2:=2. A2=2 = 2 =2 = T :=, A i := e

= A' i = e ( j j i A' j=aj) x' =x y' =y... = A' = i e A x' =x y' = y... = A:= i e A, A := i e A A:=2 3 A. i:=2. A:=i 4 A. A i = A2 = A:=2 3 A. i:=2. (i 4 A) i = (i 4 A)2 = A:=2 3 A. (2 4 A)2 = (2 4 A)2 = A:=2 3 A. T = T A:=2 2 A. A:= A2 3 A. A2=2 = A:=2 2 A. (A2 3 A)2=2 = ((2 2 A)2 3 (2 2 A)2=2 = (2 3 2 2 A)2=2 = 3=2 =, A i := e A := i e A A ij := ea := ( i ; j ) e A; -------------------------------------------------------------------------------------------------------------------------------------------------------------- 5.1.1, (records)(structures), person person = "name" text "age" nat p p var p : person p := "name" "Josh" "age" 17 (component)(field) p"age" := 18 p := "age" 18 p --------------------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------------- 5.2 5.2.0 While, while(while Loop) while b do P b, P, b,, while b T, P, whilewhile,, s' = s + L[n;..#L] t' =t+#l n W while b do P W if b then (P.W) else ok while n #L do (s:=s+ln. n:=n+1. t:=t+1) s' = s+ L[n;..#L] t' = t+#l n if n #L then (s:=s+ln. n:= n+1. t := t+1. s' =s+ L[n;..#L] t' =t+#l n) else ok, W if b then (P.W) else ok, while,, while while b do P = if b then (P. while b do P) else ok while 265 x y while x = y = 0 do if y > 0 then y : = y! 1 else ( x : = x! 1. var n : nat! y : = n) y 0 x 1 y y 0 x 1 y x y 0 t P! if x = y = 0 then ok else if y > 0 then ( y : = y! 1. t : = t + 1. P)

else ( x : = x # 1.( " n! y : = n). t : = t + 1. P) x y y n P n x y x y n x f x f f : nat! nat nat nat f s =! f [ 0;.. x] s f x t' = t + x + y + s! if x = y = 0 then ok else if y > 0 then ( y : = y! 1. t : = t + 1. t' = t + x + y + s) else ( x : = x! 1. y : = fx. t : = t + 1. t' = t + x + y + s) x = y = 0! ok " x = y = s = 0! t' = t! t ' = t + x + y + s y > 0 " ( y : = y! 1. t : = t + 1. t' = t + x + y + s) = y > 0 " t' = t + 1+ x + y! 1+ s! t ' = t + x + y + s x > 0 " y = 0 " ( x : = x! 1. y : = fx. t : = t + 1. t' = t + x + y + s) = x > 0 # y = 0 # t' = t + 1+ x " 1+ f ( x " 1) +! f [0;.. x " 1]! t ' = t + x + y + s x + y + x ------------------------------------------------------------------------------------------------------------------------------------------------------While 5.2.1 P loop P end exit when b b break exit 5.2.0,, L loop A. exit when b. C

end L A. if b then ok else (C. L),,, go to, go toexit n when bb n, P :: loop A. loop E B. exit 2 when c. D end. end Q P! AQ. Q! B. if c then ok else ( D. Q),, E, P! loop A. exit 1 when b. I C. loop D. exit 2 when e. F. exit 1 when g. H end. end Q P! A. if b then ok else ( C. Q)

Q! D. if e then ok else (F. if g then ( I. P) else ( H. Q)),,,, ----------------------------------------------------------------------------------------------------------------------------------------------- P!

!! j = m!!!!!!!!!! Fmn " m = n! ok

Fik # m " i < j < k " n! ( Fij. Fjk) Fmn! i := m;.. n m " i < n! Fi( i +1) Fmn m m n n m = n Fmn m j j n m! i < n j! i F = $ i, j : nat # x' = x " 2 Fmn # L' = # L # " i : 0,..# L! L' i = Li + 1 Fik i k Fik = # L' = # L # (" j : i,.. k! L' j = Lj + 1) # (" j : (0,.. i),( k,..# L)! L' j = Lj) F 0(# L) " 0 = # L! ok Fik # 0 " i < j < k "# L! ( Fij. Fjk) F0(# L)! i := 0;..# L Fi( i +1) Fi( i +1) Fi ( i + 1) " L : = i! Li + 1 L Fmn I m! I' n I I' I Ii Fii = ok Fik! ( Fij. Fjk)

n x'= 2! x : = 1. I0! I' n I 2 i = " i : nat! x = I 0! I' n! i := 0;.. n Ii! I' ( i + 1) Ii! I' ( i + 1)! x : = 2! x 5.2.4,, go togo to,, go to, go to,, go to,

go to (), (),,,,, go to -------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------- 5.3,,,,, deadline : = t + 5 if t! deadline then. else t := 5,,, w, wait until w = t := max t w, t := max t w, wait until w if t w then ok else ( t :=t+1. wait until w),, t w ok = t w ( t := t ) t := max t w t<w (t:=t+1. t:=max t w) = t+1 w ( t := max (t+1) w ) = t+1 w ( t := w ) = t< w ( t := max t w ) t := max t w, t : int,

wait until w 275(b) t s t s s --------------------------------------------------------------------------------------------------------------------------------------------- 5.4 5.4.0, assert b bb,,,,, assert b = if b then ok else (print "error". wait until ) b, assert b okb,, -------------------------------------------------------------------------------------------------------------------------------------------------------------- 5.4.1 PQ, P Q, PQ P " Q! P P " Q! Q, or, x:=0 or x:=1, x01 b, ensure b = if b then ok else = b ok ensure b assert b, ensure bbokb,, (b),,

, xy x :=0 or x:=1. ensure x=1 = x", y" (x"=0 y"=y x"=1 y"=y) x"=1 x' =x" y' =y" = x' =1 y' =y = x := 1 x:=0x:=1,, (), ensure,,,, (bookkeeping), Prolog, (),,, ------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------- 5.5 5.5.0 Result P, e,, P result e, Pe, var term, sum : rat :=1 for i:=1;..15 do (term := term/i. sum := sum+term) result sum result x x' = ( P result e) = P. x' =e termsum,, y:=y+1 result y y:=y+1, yy x := ( y := y+1 result y ) = x' = ( y :=y+1 result y) y' = y = ( y := y+1. x' =y ) y' =y = x' = y+1 y' =y

= x := y +1 (), result,, result result,, x+x=2 x, x = x, x x = ( y:=y+1 result y ),, result, x := ( P result e) ( P. x :=e ) P,, P x := e, x := y + ( P result e) ( var z := y P. x := z+e ) () result, result result result ---------------------------------------------------------------------------------------------------------------------------------------------------Result 5.5.1,,, result C, int bexp(int n) { int r=1; int i; for (i=0;i<n;i++) r=r*2; return r; } b exp = " n : int! var r : int := 1! for i := 0;.. n do r : = r! 2. assert r : int result r ),,,, result

, (90) ------------------------------------------------------------------------------------------------------------------------------------------------------------- 5.5.2 (Procedure) (),,,,,,,, xp P = λ x : int a' < x < b' ab,, P,, P3 = a' < 3 < b' P(a+1) = a' < a+1 < b' a' < x < b' a:=x 1. b:=x+1 PP ( λ p : D B ) a = (var p : D := a B),,,,,,,,, var,, "! (! " x : int x :=3 b := a ) a = a :=3. b:= a = a' = b' = 3,,,, (! " p : D B ) a = (λ p, p' : D. B ) a a',,, x,

x:=3. b:=a = b:=a. x:=3, -------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------- 5.6, r, i 2 p address of A[1] 4 A[0] 1 *p, A[1] 3 A[i], A[2] 2 A[3] 3, p, A[1], *pa[1] i 2, A[i]A[2] r, i, ri, (Alias),,,,,,,,, i 0 p 1 *p 2 r 3 A[0] 4 A[1] 5 A[2] : A[3] : A[i] address of A[1]

p := address of A[3]i := 4, i 2 p 3 A 4 0 1 : [1;3;2;3] :,, (), ------------------------------------------------------------------------------------------------------------------------------------------------------------- prob = r : real " 0! r! 1 T n : nat + 1 2! n % n % n (# n : nat + 1! 2 : prob) " ( $ n : nat + 1! 2 ) = 1 2! n n 3!n!m n, m : nat + 1 2 % n% m % n% m (# n, m : nat + 1! 2 : prob) " ( $ n, m : nat + 1! 2 ) = 1!n!m 2 n m!n!m n, m : nat + 1 2! " n" m m : nat + 1# 2 2! n

n!n!m 2 n!m 2! " 2 n m v p e! v # e " p n 2! n nat + 1 n 2 2! n!n!m $ n : nat + 1# n " 2 n m 2 nat + 1 n! m! " n" m n, m : nat + 1$ ( n " m) # 2!! '! $ # S " P x y x x ( x = 7)! 1/ 3 + ( x = 8)! 2 / 3 x ( 7 = 7)! 1/ 3 + (7 = 8)! 2 / 3 T! 1 / 3+ "! 2 / 3 1! 1/ 3 + 0! 2 / 3 x x x y x Y = ( y = 7)! 1/ 3 + ( y = 8)! 2 / 3 X! Y S! x, y # S " X " Y! x, y & ( x = y " x' = y' = 0 % x $ y " x' $ abs( x # y) " y' = 1)! (( x = 7) / 3 + ( x = 8)! 2 / 3)! (( y = 7) / 3 + ( y = 8)! 2 / 3) ( x' = y' = 0)! 5 / 9 + ( x' = y' = 1)! 4 / 9 x' = y' = 0 x' = y' = 1 n ok n n'! n, n' " n' = n! n ' = n T

! n '" n' = n n ok n' n' n n' = n + 1 n n' n + 1 n ok! ( n : = n + 1) n n = 5 n ok n'= 5 n : = n + 1 n'= 6 n'= 5 n'= 6! $ # S " p S ok! ( n : = n + 1) n! n' # ok " ( n : = n + 1) P # Q = " b : bool! b P Q b! P + ( 1" b)! Q P. Q =!# ''" P! '! ''! Q!! '' x x = 0! x'' " (( x'' = 0) / 3 + ( x'' = 1)! 2 / 3! (( x'' = 0)! (( x' = x'' + 2) / 2 + ( x' = x'' + 3) / 2) + ( x'' " 0)! (( x' = x'' + 4) / 4 + ( x' = x'' + 5)! 3/ 4))

( x' = 2) / 6 + ( x' = 3) / 6 + ( x' = 5) / 6 + ( x' = 6) / 2! $ # S " p p S ( p'. S) p' p n P, Q R n! P. Q = n! ( P. Q) = P. n! Q P + Q. R = ( P. R) + ( Q. R) P. Q + R = ( P. Q) + ( P. R) n : nat + 1 rand n 0,.. n rand n ( r : 0,.. n) / n r x = x T x + x = 2! x! ( r : 0,.. n) / n r : 0,.. n x r s r : 0,..2 # s : 0,..3# ( x : = r. x : = x + s) " 1/ 2 1/ 3!! "! r 0,..2! s : 0,..3" ( x' = r + : " s) / 6 (( x' = 0 + 0) + ( x' = 0 + 1) + ( x' = 0 + 2) + ( x' = 1+ 0) + ( x' = 1+ 1) + ( x' = 1+ 2)) / 6 ( x' = 0) / 6 + ( x' = 1) / 3 + ( x' = 2) / 3 + ( x' = 3) / 6 x' ( r : 0,.. n) / n x ( x': 0,..2) / 2.( x': x + (0,..3)) / 3! x' '#( x'': 0,..2) / 2" ( x': x'' + (0,..3)) / 3 1/ 2! ( x ': 0,..3) / 3 + 1/ 2! ( x':1,..4) / 3

( x' = 0) / 6 + ( x' = 1) / 3 + ( x' = 2) / 3 + ( x' = 3) / 6 rand 2 + rand3 ( n = 0! n = 3) / 6 + ( n = 1! n = 2) / 3 n rand8 < 3 b! r : 0,..8" ( b = ( r < 3)) / 8 ( b = T )! 3/ 8 + ( b =" )! 5 / 8! b / 4 b T! x ( x': (0,..13) + 1) /13. x < 7 ( x': x + (0,..13) + 1) / 13 x ' = x! x' ' $ ( x' ': 1,..14) / 13" (( x' ' < 7) " ( x': x' ' + 1,.. x' ' + 14) / 13 + ( x' ' # 7) " ( x' = x' ' )) (( 2 # x ' < 7) " ( x'! 1) + (7 # x' < 14) " 19 + (14 # x' < 20) " (20! x')) / 169 x' x' c d x n y n + 1 x c : = ( rand13) + 1. d : = ( rand13) + 1. c < n x : = c + d x : = c. c < n + 1 y : = c + d y : = c. y < x! 14 " x! 14 < y ( c ': (0,..13) + 1! d': (0,..13) + 1! x' = x! y' = y) /13/13. x := c < n c + d c. y : = c < n + 1 c + d c. y < x! 14 " x! 14 < y ( c ': (0,..13) + 1! d': (0,..13) + 1! x' = x! y' = y) /169. c < n + 1 c + d c c < n c + d c! 14! c < n c + d c! 14 c < n + 1 c + d c ( c ': (0,..13) + 1! d': (0,..13) + 1! x' = x! y' = y) /169. c = n " d > 14! n! c' ', d'', x'', y'' "

( c'': (0,..13) + 1" d'': (0,..13) + 1" x'' = x " y'' = y) /169# ( c'' = n " d'' > 14! n)! d' ':1,..14 # ( d'' > 14 " n) / 169 ( n!1) / 169 x ( n!1) / 169 y ( 14! n) / 169 n < 8 n + 1 n n! 8 n n +1 R R! u : = ( rand6) + 1. v : = ( rand6) + 1. u = v ok ( t : = t + 1. R) t t' #t ( t' " t)! (5 / 6)! 1/ 6 u : = ( rand6) + 1. v : = ( rand6) + 1. rand t' #t u = v t ' = t ( t : = t + 1.( t' " t)! (5 / 6)! 1/ 6) (( u ':1,..7)! v' = v! t' = t) / 6.( u' = u! ( v':1,..7)! t' = t) / 6. t'! t!1 u = v t ' = t ( t' # t + 1) " (5/ 6) / 6 (( u ':1,..7)! ( v':1,..7)! t' = t) / 36. t'! t!1 u = v t ' = t ( t' # t + 1) " (5/ 6) / 6! u' ', v'':1,..7! t'' #( t'' = t) / 36 " (( u'' = v'') " ( t' = # t'' ) t'! t''! 1 + ( u'' $ v'') " ( t' # t'' + 1) " (5/ 6) / 6) t'! t!1 1/ 36 " (6 " ( t' = t) + 30 " ( t' # t + 1) " (5/ 6) / 6) t' #t ( t' " t)! (5/ 6)! 1/ 6 t' t' % t t' # t'!( t' " t)! (5 / 6)! 1/ 6 = t + 5 $ ( x' = 0) /1+ ( x' = 1)! 2 / 3

x' p!! 5.8 (imperative), (),, ()

,, (142), λ L : [* rat] L, n n 0 L = ( λ n : 0,..#L+1 L[n;..#L] ) 0 λ L : [*rat] L =... L =..., L, n,, n 0,..#L+1 = (0,..#L), #L λ n : 0,..#L+1 L [n;..#l] = ( λ n : 0,..#L L [n;..#l] ) ( λ n : #L L [n;..#l] ), n < #L n = #L λ n : 0,..#L L[n;..#L] = λ n : 0,..#L L n + L[n+1;..#L] λ n : #L L[n;..#L] = λ n : #L 0 n, L[n+1;..#L] = ( λ n : 0,..#L+1 L[n;..#L] ) (n+1) if then else, ( λ v : A x ) ( λ v : B y ) = λ v : A, B if v : A then x else y,,, 1, 0, λ L : [*rat] #L,, n n, #L = ( λ n : 0,..#L+1 #L n) 0 λ n : 0,..#L+1 #L n = ( λ n : 0,..#L #L n) ( λ n : #L #L n ), 1, λ n : 0,..#L #L n = λ n : 0,..#L 1 + #L n 1, 0 λ n : #L #L n = λ n : #L 0 #L n 1 = ( λ n : 0,..#L+1 #L n) (n+1) (),, 1

, λ L : [*rat] #L #L = ( λ n : 0,..#L+1 #L n ) 0 λ n : 0,..#L+1 #L n = ( λ n : 0,..#L #L n) ( λ n : #L #L n ) λ n : 0,..#L #L n = λ n : 0,..#L #L n λ n : #L #L n = λ n : #L 0 #L n = 1+ ( λ n : 0,..#L+1 #L n ) (n+1) 5.8.0, x' : 2, 3, 4,, 2, 3, 4, Sx, S x = 0 Sx, S x > 0 Sx, S x! 1 Sx, S x >1 Sx, y y : S x S, x y y : S x ( xs, ys ) x S x null λ L : [*int] λ x : int n : 0,..#L L n = x Lx, LxxL,, xl,, xll, λ L : [*int] λ x : int if x : L(0,..#L) then n : 0,..#L L n = x else #L,.., P()S(), SP, S : P,, S : P,, ::, PS P :: S, 0,, xl (if x : L(0,..#L) then n : 0,..#L Ln = x else #L,.. ) ::

( λ i : nat if x : L (i,..#l) then n : i,..#l L n = x else #L,.. ) 0, = :: i if then else ( if x : L (i,..#l) then n : i,..#l. L n = x else #L,.. ) :: if i=#l then #L else if x = L i then i else (λ i if x : L (i,..#l) then n : i,..#l L n = x else #L,.. ) (i+1), λ L λ x 0,..#L +1, #L+1 0,..#L i+1 :: if i = #L then 0 0,..#L+1 :: ( λ i 0,..#L i +1 ) 0 else if x = L i then 0 else 1+ (λ i 0,..#L i +1) (i+1) --------------------------------------------------------------------------------------------------------------------------------------------------------,,, (), (" v : D! b) x = (bvx) x:=e.p = (Pxe) ----------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------