時間限制 5000 ms ・ 記憶體限制 256 MB

題目描述

給完整deterministic acceptor作teacher,initial state0、alphabet前k字母。Membership T(w)是從0讀w後接受bit,空字epsilon。模擬以下固定L*式觀察表流程,不只輸最小化結果,不連網。Word排序一律shortlex:先長度再字典序。 初始S={epsilon},E={epsilon}。row(s)=(T(se):e依shortlex)。固定迴圈優先序:

  1. Closure:枚SΣ所有不同word t,依shortlex;若row(t)不等任何s∈S的row,取第一t,輸CLOSE t,S加t,重啟。
  2. 若closed,檢consistency:找s1<s2、row(s1)=row(s2)、字母a、e∈E使T(s1ae)≠T(s2ae)。按tuple(shortlex(s1),shortlex(s2),a,shortlex(e))最小取一組,輸SPLIT s1 s2 a e,E加ae,重啟。ae必原本不在E。
  3. Closed且consistent,造hypothesis:每個不同S row一state,代表是該row的shortlex最小S字。代表按shortlex編stateID0起,initial是epsilon代表的0。接受bit=T(rep),字母a轉移到row(rep+a)的state。輸完整hypothesis及當前S/E。
  4. 若teacher與hypothesis接受語言不同,找shortestlex counterexample c,輸CE c,同時將c全部prefix(含epsilon與c)加S,再回第1步。已有prefix不重加,也不另輸CLOSE。若全部有限word都相同,輸ACCEPT結束。 Equivalence可在兩機器product graph搜尋acceptbit不同的狀態;不能只任意試幾個短字。流程保持S prefixclosed、E suffixclosed並保證終止。Teacher可有不可達或等價states,最後hypothesis只留實際必要states。會員查詢呼叫次數不輸,cache順序不影響答案。

輸入格式

第一行n k。第二行n個accept bits。接n行各k個next state IDs,依alphabet a/b順序。

輸出格式

依流程輸事件,不加總行數。CLOSE/CE後接word;SPLIT後接s1 s2 a e。每次hypothesis輸HYP h;再S count及全部S words一行、E count及全部E words一行,words按shortlex。再h行id representative acceptbit及k個nextIDs,按id升序。最後ACCEPT。所有空word用-,包括SPLIT的e。

限制

1≤n≤4;1≤k≤2;accept bits0/1;next IDs0..n−1。Teacher initial0,所有轉移完整。

範例說明

三states,accept0,1,0,a都回0,b依0→1→2→0。先CLOSE b造兩states hypothesis,但word bbb為反例。加入bb/bbb後,SPLIT epsilon bb b epsilon把b加E,得到正確三states,不能只在最初rows看相同就永久合併。

Teacher所有states皆不接受時,語言空,初始一state hypothesis直接ACCEPT;不因teacher有四個states就必輸四states。全接受同理。

範例測資

範例輸入 1

3 2
0 1 0
0 1
0 2
0 0

範例輸出 1

CLOSE b
HYP 2
S 2 - b
E 1 -
0 - 0 0 1
1 b 1 0 0
CE bbb
SPLIT - bb b -
HYP 3
S 4 - b bb bbb
E 2 - b
0 - 0 0 1
1 b 1 0 2
2 bb 0 0 0
ACCEPT

範例輸入 2

4 2
0 0 0 0
1 2
2 3
3 0
0 1

範例輸出 2

HYP 1
S 1 -
E 1 -
0 - 0 0 0
ACCEPT
請先登入後再提交程式碼

討論與題解

載入討論區…

更多