Section ClosedSetSearcher.
Hypothesis T:Type.
Hypothesis T_enc:T->positive.
Hypothesis T_enc_inj: is_inj T_enc.
Hypothesis In_T: (ExecState Σ)->T->Prop.
Hypothesis T_InitES:T.
Hypothesis In_T_InitES: In_T (InitES Σ Σ0) T_InitES.
Hypothesis T_step: (TM Σ)->T->option (list T).
Hypothesis T_step_spec:
forall (tm : TM Σ) (x : T),
match T_step tm x with
| Some ls =>
forall st0 : ExecState Σ,
In_T st0 x ->
exists (n : nat) (st1 : ExecState Σ) (x1 : T),
Steps Σ tm (1 + n) st0 st1 /\ In_T st1 x1 /\ In x1 ls
| None => True
end.
Definition T_eqb t1 t2 := Pos.eqb (T_enc t1) (T_enc t2).
Fixpoint ins_all(q:list T)(st:PositiveMap.tree unit)(ls:list T) :=
match ls with
| nil => (q,st)
| h::ls0 =>
let (q',st') := fst (set_ins T_enc (q,st) h) in
ins_all q' st' ls0
end.
Fixpoint T_close_set_searcher(tm:TM Σ)(n:nat)(q:list T)(st:PositiveMap.tree unit):
option (list T * PositiveMap.tree unit) :=
match n with
| O => Some (q,st)
| S n0 =>
match q with
| nil => Some (q,st)
| x::q0 =>
match T_step tm x with
| None => None
| Some ls =>
let (q',st') := ins_all q0 st ls in
T_close_set_searcher tm n0 q' st'
end
end
end.
Definition T_decider0(n:nat)(tm:TM Σ):bool :=
let (q0,st0) := fst (set_ins T_enc (nil, PositiveMap.empty unit) T_InitES) in
match T_close_set_searcher tm n q0 st0 with
| Some (nil,q2') =>
match PositiveMap.find (T_enc T_InitES) q2' with
| Some _ => true
| None => false
end
| _ => false
end.
Definition T_decider(n:nat):HaltDecider :=
fun tm => if T_decider0 n tm then Result_NonHalt else Result_Unknown.
Definition search_state_WF tm (qst:(list T * PositiveMap.tree unit)):=
let (q,st):=qst in
forall x,
set_in T_enc qst x -> (In x q \/
match T_step tm x with
| None => False
| Some ls => forall y, In y ls -> set_in T_enc qst y
end).
Definition in_search_state(st0:ExecState Σ)(S:(list T * PositiveMap.tree unit)) :=
exists s0, set_in T_enc S s0 /\ In_T st0 s0.
End ClosedSetSearcher.
Definition RepWL_ES_decider(n:nat):HaltDecider :=
(T_decider _ RepWL_ES_enc RepWL_InitES RepWL_step n).
End MacroMachine_secion.
Definition decider17 := (RepWL_ES_decider 4 3 320 10000).
Definition decider_all :=
(HaltDecider_list
(decider2::decider3::decider4::decider5::decider6::decider7::
decider9::decider10::
decider11::decider12::
decider13::decider14::
decider15::
decider16::
decider17::nil)).
Definition q0 := root_q_upd1_simplified.
Definition q_suc:SearchQueue->SearchQueue := (fun x => SearchQueue_upds x decider_all 13).
Definition q_0 := q0.
Definition q_1_def := q_suc q_0.
Time Definition q_1 := Eval vm_compute in q_1_def.
Definition q_2_def := q_suc q_1.
Time Definition q_2 := Eval vm_compute in q_2_def.
Definition q_3_def := q_suc q_2.
Time Definition q_3 := Eval vm_compute in q_3_def.
Definition q_4_def := q_suc q_3.
Time Definition q_4 := Eval vm_compute in q_4_def.
Definition q_5_def := q_suc q_4.
Time Definition q_5 := Eval vm_compute in q_5_def.
Definition q_6_def := q_suc q_5.
Time Definition q_6 := Eval vm_compute in q_6_def.
Definition q_7_def := q_suc q_6.
Time Definition q_7 := Eval vm_compute in q_7_def.
Definition q_8_def := q_suc q_7.
Time Definition q_8 := Eval vm_compute in q_8_def.
Definition q_9_def := q_suc q_8.
Time Definition q_9 := Eval vm_compute in q_9_def.
Definition q_10_def := q_suc q_9.
Time Definition q_10 := Eval vm_compute in q_10_def.
Definition q_11_def := q_suc q_10.
Time Definition q_11 := Eval vm_compute in q_11_def.
Definition q_12_def := q_suc q_11.
Time Definition q_12 := Eval vm_compute in q_12_def.
Definition q_13_def := q_suc q_12.
Time Definition q_13 := Eval vm_compute in q_13_def.
Definition q_14_def := q_suc q_13.
Time Definition q_14 := Eval vm_compute in q_14_def.
Definition q_15_def := q_suc q_14.
Time Definition q_15 := Eval vm_compute in q_15_def.
Definition q_16_def := q_suc q_15.
Time Definition q_16 := Eval vm_compute in q_16_def.
Definition q_17_def := q_suc q_16.
Time Definition q_17 := Eval vm_compute in q_17_def.
Definition q_18_def := q_suc q_17.
Time Definition q_18 := Eval vm_compute in q_18_def.
Definition q_19_def := q_suc q_18.
Time Definition q_19 := Eval vm_compute in q_19_def.
Definition q_20_def := q_suc q_19.
Time Definition q_20 := Eval vm_compute in q_20_def.
Definition q_21_def := q_suc q_20.
Time Definition q_21 := Eval vm_compute in q_21_def.
Definition q_22_def := q_suc q_21.
Time Definition q_22 := Eval vm_compute in q_22_def.
Definition q_23_def := q_suc q_22.
Time Definition q_23 := Eval vm_compute in q_23_def.
Definition q_24_def := q_suc q_23.
Time Definition q_24 := Eval vm_compute in q_24_def.
Definition q_25_def := q_suc q_24.
Time Definition q_25 := Eval vm_compute in q_25_def.
Definition q_26_def := q_suc q_25.
Time Definition q_26 := Eval vm_compute in q_26_def.
Definition q_27_def := q_suc q_26.
Time Definition q_27 := Eval vm_compute in q_27_def.
Definition q_28_def := q_suc q_27.
Time Definition q_28 := Eval vm_compute in q_28_def.
Definition q_29_def := q_suc q_28.
Time Definition q_29 := Eval vm_compute in q_29_def.
Definition q_30_def := q_suc q_29.
Time Definition q_30 := Eval vm_compute in q_30_def.
Definition q_31_def := q_suc q_30.
Time Definition q_31 := Eval vm_compute in q_31_def.
Definition q_32_def := q_suc q_31.
Time Definition q_32 := Eval vm_compute in q_32_def.
Definition q_33_def := q_suc q_32.
Time Definition q_33 := Eval vm_compute in q_33_def.
Definition q_34_def := q_suc q_33.
Time Definition q_34 := Eval vm_compute in q_34_def.
Definition q_35_def := q_suc q_34.
Time Definition q_35 := Eval vm_compute in q_35_def.
Definition q_36_def := q_suc q_35.
Time Definition q_36 := Eval vm_compute in q_36_def.
Definition q_37_def := q_suc q_36.
Time Definition q_37 := Eval vm_compute in q_37_def.
Definition q_38_def := q_suc q_37.
Time Definition q_38 := Eval vm_compute in q_38_def.
Definition q_39_def := q_suc q_38.
Time Definition q_39 := Eval vm_compute in q_39_def.
Definition q_40_def := q_suc q_39.
Time Definition q_40 := Eval vm_compute in q_40_def.
Definition q_41_def := q_suc q_40.
Time Definition q_41 := Eval vm_compute in q_41_def.
Definition q_42_def := q_suc q_41.
Time Definition q_42 := Eval vm_compute in q_42_def.
Definition q_43_def := q_suc q_42.
Time Definition q_43 := Eval vm_compute in q_43_def.
Definition q_44_def := q_suc q_43.
Time Definition q_44 := Eval vm_compute in q_44_def.
Definition q_45_def := q_suc q_44.
Time Definition q_45 := Eval vm_compute in q_45_def.
Definition q_46_def := q_suc q_45.
Time Definition q_46 := Eval vm_compute in q_46_def.
Definition q_47_def := q_suc q_46.
Time Definition q_47 := Eval vm_compute in q_47_def.
Definition q_48_def := q_suc q_47.
Time Definition q_48 := Eval vm_compute in q_48_def.
Definition q_49_def := q_suc q_48.
Time Definition q_49 := Eval vm_compute in q_49_def.
Definition q_50_def := q_suc q_49.
Time Definition q_50 := Eval vm_compute in q_50_def.
Definition q_51_def := q_suc q_50.
Time Definition q_51 := Eval vm_compute in q_51_def.
Definition q_52_def := q_suc q_51.
Time Definition q_52 := Eval vm_compute in q_52_def.
Definition q_53_def := q_suc q_52.
Time Definition q_53 := Eval vm_compute in q_53_def.
Definition q_54_def := q_suc q_53.
Time Definition q_54 := Eval vm_compute in q_54_def.
Definition q_55_def := q_suc q_54.
Time Definition q_55 := Eval vm_compute in q_55_def.
Definition q_56_def := q_suc q_55.
Time Definition q_56 := Eval vm_compute in q_56_def.
Definition q_57_def := q_suc q_56.
Time Definition q_57 := Eval vm_compute in q_57_def.
Definition q_58_def := q_suc q_57.
Time Definition q_58 := Eval vm_compute in q_58_def.
Definition q_59_def := q_suc q_58.
Time Definition q_59 := Eval vm_compute in q_59_def.
Definition q_60_def := q_suc q_59.
Time Definition q_60 := Eval vm_compute in q_60_def.
Definition q_61_def := q_suc q_60.
Time Definition q_61 := Eval vm_compute in q_61_def.
Definition q_62_def := q_suc q_61.
Time Definition q_62 := Eval vm_compute in q_62_def.
Definition q_63_def := q_suc q_62.
Time Definition q_63 := Eval vm_compute in q_63_def.
Definition q_64_def := q_suc q_63.
Time Definition q_64 := Eval vm_compute in q_64_def.
Definition q_65_def := q_suc q_64.
Time Definition q_65 := Eval vm_compute in q_65_def.
Definition q_66_def := q_suc q_65.
Time Definition q_66 := Eval vm_compute in q_66_def.
Definition q_67_def := q_suc q_66.
Time Definition q_67 := Eval vm_compute in q_67_def.
Definition q_68_def := q_suc q_67.
Time Definition q_68 := Eval vm_compute in q_68_def.
Definition q_69_def := q_suc q_68.
Time Definition q_69 := Eval vm_compute in q_69_def.
Definition q_70_def := q_suc q_69.
Time Definition q_70 := Eval vm_compute in q_70_def.
Definition q_71_def := q_suc q_70.
Time Definition q_71 := Eval vm_compute in q_71_def.
Definition q_72_def := q_suc q_71.
Time Definition q_72 := Eval vm_compute in q_72_def.
Definition q_73_def := q_suc q_72.
Time Definition q_73 := Eval vm_compute in q_73_def.
Definition q_74_def := q_suc q_73.
Time Definition q_74 := Eval vm_compute in q_74_def.
Definition q_75_def := q_suc q_74.
Time Definition q_75 := Eval vm_compute in q_75_def.
Definition q_76_def := q_suc q_75.
Time Definition q_76 := Eval vm_compute in q_76_def.
Definition q_77_def := q_suc q_76.
Time Definition q_77 := Eval vm_compute in q_77_def.
Definition q_78_def := q_suc q_77.
Time Definition q_78 := Eval vm_compute in q_78_def.
Definition q_79_def := q_suc q_78.
Time Definition q_79 := Eval vm_compute in q_79_def.
Definition q_80_def := q_suc q_79.
Time Definition q_80 := Eval vm_compute in q_80_def.
Definition q_81_def := q_suc q_80.
Time Definition q_81 := Eval vm_compute in q_81_def.
Definition q_82_def := q_suc q_81.
Time Definition q_82 := Eval vm_compute in q_82_def.
Definition q_83_def := q_suc q_82.
Time Definition q_83 := Eval vm_compute in q_83_def.
Definition q_84_def := q_suc q_83.
Time Definition q_84 := Eval vm_compute in q_84_def.
Definition q_85_def := q_suc q_84.
Time Definition q_85 := Eval vm_compute in q_85_def.
Definition q_86_def := q_suc q_85.
Time Definition q_86 := Eval vm_compute in q_86_def.
Definition q_87_def := q_suc q_86.
Time Definition q_87 := Eval vm_compute in q_87_def.
Definition q_88_def := q_suc q_87.
Time Definition q_88 := Eval vm_compute in q_88_def.
Definition q_89_def := q_suc q_88.
Time Definition q_89 := Eval vm_compute in q_89_def.
Definition q_90_def := q_suc q_89.
Time Definition q_90 := Eval vm_compute in q_90_def.
Definition q_91_def := q_suc q_90.
Time Definition q_91 := Eval vm_compute in q_91_def.
Definition q_92_def := q_suc q_91.
Time Definition q_92 := Eval vm_compute in q_92_def.
Definition q_93_def := q_suc q_92.
Time Definition q_93 := Eval vm_compute in q_93_def.
Definition q_94_def := q_suc q_93.
Time Definition q_94 := Eval vm_compute in q_94_def.
Definition q_95_def := q_suc q_94.
Time Definition q_95 := Eval vm_compute in q_95_def.
Definition q_96_def := q_suc q_95.
Time Definition q_96 := Eval vm_compute in q_96_def.
Definition q_97_def := q_suc q_96.
Time Definition q_97 := Eval vm_compute in q_97_def.
Definition q_98_def := q_suc q_97.
Time Definition q_98 := Eval vm_compute in q_98_def.
Definition q_99_def := q_suc q_98.
Time Definition q_99 := Eval vm_compute in q_99_def.
Definition q_100_def := q_suc q_99.
Time Definition q_100 := Eval vm_compute in q_100_def.
Definition q_101_def := q_suc q_100.
Time Definition q_101 := Eval vm_compute in q_101_def.
Definition q_102_def := q_suc q_101.
Time Definition q_102 := Eval vm_compute in q_102_def.
Definition q_103_def := q_suc q_102.
Time Definition q_103 := Eval vm_compute in q_103_def.
Definition q_104_def := q_suc q_103.
Time Definition q_104 := Eval vm_compute in q_104_def.
Definition q_105_def := q_suc q_104.
Time Definition q_105 := Eval vm_compute in q_105_def.
Definition q_106_def := q_suc q_105.
Time Definition q_106 := Eval vm_compute in q_106_def.
Definition q_107_def := q_suc q_106.
Time Definition q_107 := Eval vm_compute in q_107_def.
Definition q_108_def := q_suc q_107.
Time Definition q_108 := Eval vm_compute in q_108_def.
Definition q_109_def := q_suc q_108.
Time Definition q_109 := Eval vm_compute in q_109_def.
Definition q_110_def := q_suc q_109.
Time Definition q_110 := Eval vm_compute in q_110_def.
Definition q_111_def := q_suc q_110.
Time Definition q_111 := Eval vm_compute in q_111_def.
Definition q_112_def := q_suc q_111.
Time Definition q_112 := Eval vm_compute in q_112_def.
Definition q_113_def := q_suc q_112.
Time Definition q_113 := Eval vm_compute in q_113_def.
Definition q_114_def := q_suc q_113.
Time Definition q_114 := Eval vm_compute in q_114_def.
Definition q_115_def := q_suc q_114.
Time Definition q_115 := Eval vm_compute in q_115_def.
Definition q_116_def := q_suc q_115.
Time Definition q_116 := Eval vm_compute in q_116_def.
Definition q_117_def := q_suc q_116.
Time Definition q_117 := Eval vm_compute in q_117_def.
Definition q_118_def := q_suc q_117.
Time Definition q_118 := Eval vm_compute in q_118_def.
Definition q_119_def := q_suc q_118.
Time Definition q_119 := Eval vm_compute in q_119_def.
Definition q_120_def := q_suc q_119.
Time Definition q_120 := Eval vm_compute in q_120_def.
Definition q_121_def := q_suc q_120.
Time Definition q_121 := Eval vm_compute in q_121_def.
Definition q_122_def := q_suc q_121.
Time Definition q_122 := Eval vm_compute in q_122_def.
Definition q_123_def := q_suc q_122.
Time Definition q_123 := Eval vm_compute in q_123_def.
Definition q_124_def := q_suc q_123.
Time Definition q_124 := Eval vm_compute in q_124_def.
Definition q_125_def := q_suc q_124.
Time Definition q_125 := Eval vm_compute in q_125_def.
Definition q_126_def := q_suc q_125.
Time Definition q_126 := Eval vm_compute in q_126_def.
Definition q_127_def := q_suc q_126.
Time Definition q_127 := Eval vm_compute in q_127_def.
Definition q_128_def := q_suc q_127.
Time Definition q_128 := Eval vm_compute in q_128_def.
Definition q_129_def := q_suc q_128.
Time Definition q_129 := Eval vm_compute in q_129_def.
Definition q_130_def := q_suc q_129.
Time Definition q_130 := Eval vm_compute in q_130_def.
Definition q_131_def := q_suc q_130.
Time Definition q_131 := Eval vm_compute in q_131_def.
Definition q_132_def := q_suc q_131.
Time Definition q_132 := Eval vm_compute in q_132_def.
Definition q_133_def := q_suc q_132.
Time Definition q_133 := Eval vm_compute in q_133_def.
Definition q_134_def := q_suc q_133.
Time Definition q_134 := Eval vm_compute in q_134_def.
Definition q_135_def := q_suc q_134.
Time Definition q_135 := Eval vm_compute in q_135_def.
Definition q_136_def := q_suc q_135.
Time Definition q_136 := Eval vm_compute in q_136_def.
Definition q_137_def := q_suc q_136.
Time Definition q_137 := Eval vm_compute in q_137_def.
Definition q_138_def := q_suc q_137.
Time Definition q_138 := Eval vm_compute in q_138_def.
Definition q_139_def := q_suc q_138.
Time Definition q_139 := Eval vm_compute in q_139_def.
Definition q_140_def := q_suc q_139.
Time Definition q_140 := Eval vm_compute in q_140_def.
Definition q_141_def := q_suc q_140.
Time Definition q_141 := Eval vm_compute in q_141_def.
Definition q_142_def := q_suc q_141.
Time Definition q_142 := Eval vm_compute in q_142_def.
Definition q_143_def := q_suc q_142.
Time Definition q_143 := Eval vm_compute in q_143_def.
Definition q_144_def := q_suc q_143.
Time Definition q_144 := Eval vm_compute in q_144_def.
Definition q_145_def := q_suc q_144.
Time Definition q_145 := Eval vm_compute in q_145_def.
Definition q_146_def := q_suc q_145.
Time Definition q_146 := Eval vm_compute in q_146_def.
Definition q_147_def := q_suc q_146.
Time Definition q_147 := Eval vm_compute in q_147_def.
Definition q_148_def := q_suc q_147.
Time Definition q_148 := Eval vm_compute in q_148_def.
Definition q_149_def := q_suc q_148.
Time Definition q_149 := Eval vm_compute in q_149_def.
Definition q_150_def := q_suc q_149.
Time Definition q_150 := Eval vm_compute in q_150_def.
Definition q_151_def := q_suc q_150.
Time Definition q_151 := Eval vm_compute in q_151_def.
Definition q_152_def := q_suc q_151.
Time Definition q_152 := Eval vm_compute in q_152_def.
Definition q_153_def := q_suc q_152.
Time Definition q_153 := Eval vm_compute in q_153_def.
Definition q_154_def := q_suc q_153.
Time Definition q_154 := Eval vm_compute in q_154_def.
Definition q_155_def := q_suc q_154.
Time Definition q_155 := Eval vm_compute in q_155_def.
Definition q_156_def := q_suc q_155.
Time Definition q_156 := Eval vm_compute in q_156_def.
Definition q_157_def := q_suc q_156.
Time Definition q_157 := Eval vm_compute in q_157_def.
Definition q_158_def := q_suc q_157.
Time Definition q_158 := Eval vm_compute in q_158_def.
Definition q_159_def := q_suc q_158.
Time Definition q_159 := Eval vm_compute in q_159_def.
Definition q_160_def := q_suc q_159.
Time Definition q_160 := Eval vm_compute in q_160_def.
Definition q_161_def := q_suc q_160.
Time Definition q_161 := Eval vm_compute in q_161_def.
Definition q_162_def := q_suc q_161.
Time Definition q_162 := Eval vm_compute in q_162_def.
Definition q_163_def := q_suc q_162.
Time Definition q_163 := Eval vm_compute in q_163_def.
Definition q_164_def := q_suc q_163.
Time Definition q_164 := Eval vm_compute in q_164_def.
Definition q_165_def := q_suc q_164.
Time Definition q_165 := Eval vm_compute in q_165_def.
Definition q_166_def := q_suc q_165.
Time Definition q_166 := Eval vm_compute in q_166_def.
Definition q_167_def := q_suc q_166.
Time Definition q_167 := Eval vm_compute in q_167_def.
Definition q_168_def := q_suc q_167.
Time Definition q_168 := Eval vm_compute in q_168_def.
Definition q_169_def := q_suc q_168.
Time Definition q_169 := Eval vm_compute in q_169_def.
Definition q_170_def := q_suc q_169.
Time Definition q_170 := Eval vm_compute in q_170_def.
Definition q_171_def := q_suc q_170.
Time Definition q_171 := Eval vm_compute in q_171_def.
Definition q_172_def := q_suc q_171.
Time Definition q_172 := Eval vm_compute in q_172_def.
Definition q_173_def := q_suc q_172.
Time Definition q_173 := Eval vm_compute in q_173_def.
Definition q_174_def := q_suc q_173.
Time Definition q_174 := Eval vm_compute in q_174_def.
Definition q_175_def := q_suc q_174.
Time Definition q_175 := Eval vm_compute in q_175_def.
Definition q_176_def := q_suc q_175.
Time Definition q_176 := Eval vm_compute in q_176_def.
Definition q_177_def := q_suc q_176.
Time Definition q_177 := Eval vm_compute in q_177_def.
Definition q_178_def := q_suc q_177.
Time Definition q_178 := Eval vm_compute in q_178_def.
Definition q_179_def := q_suc q_178.
Time Definition q_179 := Eval vm_compute in q_179_def.
Definition q_180_def := q_suc q_179.
Time Definition q_180 := Eval vm_compute in q_180_def.
Definition q_181_def := q_suc q_180.
Time Definition q_181 := Eval vm_compute in q_181_def.
Definition q_182_def := q_suc q_181.
Time Definition q_182 := Eval vm_compute in q_182_def.
Definition q_183_def := q_suc q_182.
Time Definition q_183 := Eval vm_compute in q_183_def.
Definition q_184_def := q_suc q_183.
Time Definition q_184 := Eval vm_compute in q_184_def.
Definition q_185_def := q_suc q_184.
Time Definition q_185 := Eval vm_compute in q_185_def.
Definition q_186_def := q_suc q_185.
Time Definition q_186 := Eval vm_compute in q_186_def.
Definition q_187_def := q_suc q_186.
Time Definition q_187 := Eval vm_compute in q_187_def.
Definition q_188_def := q_suc q_187.
Time Definition q_188 := Eval vm_compute in q_188_def.
Definition q_189_def := q_suc q_188.
Time Definition q_189 := Eval vm_compute in q_189_def.
Definition q_190_def := q_suc q_189.
Time Definition q_190 := Eval vm_compute in q_190_def.
Definition q_191_def := q_suc q_190.
Time Definition q_191 := Eval vm_compute in q_191_def.
Definition q_192_def := q_suc q_191.
Time Definition q_192 := Eval vm_compute in q_192_def.
Definition q_193_def := q_suc q_192.
Time Definition q_193 := Eval vm_compute in q_193_def.
Definition q_194_def := q_suc q_193.
Time Definition q_194 := Eval vm_compute in q_194_def.
Definition q_195_def := q_suc q_194.
Time Definition q_195 := Eval vm_compute in q_195_def.
Definition q_196_def := q_suc q_195.
Time Definition q_196 := Eval vm_compute in q_196_def.
Definition q_197_def := q_suc q_196.
Time Definition q_197 := Eval vm_compute in q_197_def.
Definition q_198_def := q_suc q_197.
Time Definition q_198 := Eval vm_compute in q_198_def.
Definition q_199_def := q_suc q_198.
Time Definition q_199 := Eval vm_compute in q_199_def.
Definition q_200_def := q_suc q_199.
Time Definition q_200 := Eval vm_compute in q_200_def.

Lemma iter_S{A}(f:A->A)(x x0:A) n:
x0 = Nat.iter n f x ->
f x0 = Nat.iter (S n) f x.