Skip to content

Commit cd959e1

Browse files
committed
Sketch alternative for Ochmanski (i) => (ii)
1 parent e31bd55 commit cd959e1

1 file changed

Lines changed: 107 additions & 0 deletions

File tree

TraceTheory/TraceTheory/Ochmanski.lean

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,113 @@ lemma depTrClIn_refl {w : List α} {a : α} (h : a ∈ w) : dependencyTransClosu
182182
noncomputable instance : ∀ w x y, Decidable (dependencyTransClosureInL I w x y) :=
183183
fun w x y => Classical.propDecidable (dependencyTransClosureInL I w x y)
184184

185+
noncomputable def ccDec_aux' (I : Independence α) (w₀ w : List α) : List (List α) :=
186+
match w with
187+
| [] => [[]]
188+
| a :: w =>
189+
match ccDec_aux' I w₀ w with
190+
| [] => [] -- dummy value, unreachable by construction
191+
| v :: vs =>
192+
match v with
193+
| [] => [a] :: vs
194+
| b :: v =>
195+
if dependencyTransClosureInL I w₀ a b
196+
then (a :: b :: v) :: vs
197+
else [a] :: (b :: v) :: vs
198+
199+
lemma ccDec'_aux_nonempty' (w₀ w : List α) : (ccDec_aux' I w₀ w) ≠ [] := by
200+
induction w with
201+
| nil => simp [ccDec_aux']
202+
| cons a u ih =>
203+
simp [ccDec_aux']
204+
cases hs : ccDec_aux' I w₀ u
205+
· simp [hs] at ih
206+
· simp
207+
rename_i c_head c_tail
208+
cases c_head with
209+
| nil => simp
210+
| cons b c_head =>
211+
simp
212+
by_cases hab : dependencyTransClosureInL I w₀ a b
213+
all_goals simp [hab]
214+
215+
lemma ccDec'_aux_len (u w : List α) (a : α) :
216+
(ccDec_aux' I u (a :: w)).length = (ccDec_aux' I u w).length ∨
217+
(ccDec_aux' I u (a :: w)).length = (ccDec_aux' I u w).length + 1 := by
218+
simp [ccDec_aux']
219+
cases ccDec_aux' I u w
220+
· simp
221+
· rename_i c_head c_tail
222+
simp
223+
cases c_head with
224+
| nil => simp
225+
| cons b c_head =>
226+
simp
227+
by_cases hab : dependencyTransClosureInL I u a b
228+
all_goals simp [hab]
229+
230+
lemma ccDec'_aux_len_le (u w : List α) (a : α) :
231+
(ccDec_aux' I u w).length ≤ (ccDec_aux' I u (a :: w)).length := by
232+
cases ccDec'_aux_len u w a with
233+
| inl h => rw [h]
234+
| inr h => simp [h]
235+
236+
lemma ccDec'_aux_nonempty (u w : List α) (i : ℕ) (hi : i < (ccDec_aux' I u w).length) (hz : w ≠ []) :
237+
(ccDec_aux' I u w)[i] ≠ [] := by
238+
induction w generalizing i with
239+
| nil => simp at hz
240+
| cons a w ih =>
241+
clear hz
242+
by_cases hiz : i = 0
243+
· suffices hs_dec : (∃ _1 _2 _3, (ccDec_aux' I u (a :: w)) = (_1 :: _2) :: _3) ∨ (ccDec_aux' I u (a :: w)) = [] from by
244+
rcases hs_dec with ⟨hs_dec⟩
245+
· replace ⟨_1, _2, _3, hs_dec⟩ := hs_dec
246+
simp [hs_dec, hiz]
247+
· rename_i hs_dec
248+
simp [hs_dec] at hi
249+
simp [ccDec_aux']
250+
cases ccDec_aux' I u w
251+
· simp
252+
· rename_i c_head c_tail
253+
simp
254+
cases c_head with
255+
| nil => simp
256+
| cons b c_head =>
257+
simp
258+
by_cases hab : dependencyTransClosureInL I u a b
259+
all_goals simp [hab]
260+
· -- cases a
261+
have : (ccDec_aux' I u (a :: w))[i] = (ccDec_aux' I u w)[i]'sorry ∨ (ccDec_aux' I u (a :: w))[i] = (ccDec_aux' I u w)[i - 1]'sorry := by
262+
simp [ccDec_aux']
263+
/- cases ccDec_aux' I u w
264+
· simp
265+
· rename_i c_head c_tail
266+
simp
267+
cases c_head with
268+
| nil => simp
269+
| cons b c_head =>
270+
simp
271+
by_cases hab : dependencyTransClosureInL I u a b
272+
all_goals simp [hab] -/
273+
sorry
274+
cases this with
275+
| inl h =>
276+
rw [h]
277+
apply ih
278+
by_contra hz
279+
simp [ccDec_aux', hz] at hi
280+
exact hiz hi
281+
| inr h =>
282+
rw [h]
283+
have : i - 1 < (ccDec_aux' I u w).length := by sorry
284+
apply ih (i - 1) this
285+
by_contra hz
286+
simp [ccDec_aux', hz] at hi
287+
exact hiz hi
288+
289+
290+
291+
185292
noncomputable def ccDec_aux (I : Independence α) (w₀ w : List α) (p : α) : List (List α × List α) :=
186293
match w with
187294
| [] => [⟨[], []⟩]

0 commit comments

Comments
 (0)