Skip to content

Commit 4f788ca

Browse files
committed
Add Prop 4.1 :: (i) <-> (iv)
1 parent 27b9289 commit 4f788ca

1 file changed

Lines changed: 97 additions & 23 deletions

File tree

TraceTheory/TraceTheory/Language.lean

Lines changed: 97 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,14 @@ namespace Trace
55

66
variable {α : Type} {I : Independence α}
77

8-
lemma foldl_append_eq (a : List α) (bs : List (List α)) :
9-
List.foldl List.append a bs = a ++ List.foldl List.append [] bs := by
10-
induction bs using List.reverseRecOn with
11-
| nil => simp
12-
| append_singleton bsuf b ih => simp [ih]
13-
14-
lemma indep_of_foldl {u : List α} {vs : List (List α)} (i : Fin vs.length) (h : independent I u (vs.foldl List.append [])) :
8+
lemma indep_of_flatten {u : List α} {vs : List (List α)} (i : Fin vs.length) (h : independent I u vs.flatten) :
159
independent I u vs[i] := by
1610
replace ⟨i, hi⟩ := i
1711
induction vs generalizing i with
1812
| nil =>
1913
simp at hi
2014
| cons v vs' ih =>
2115
simp at h ⊢
22-
rw [foldl_append_eq] at h
2316
cases i with
2417
| zero => exact (indep_of_concat h).left
2518
| succ i =>
@@ -29,12 +22,12 @@ lemma indep_of_foldl {u : List α} {vs : List (List α)} (i : Fin vs.length) (h
2922
/-- (i) → (ii) of Corollary (2.3) in `Partial Commutation and Traces`.
3023
Note that t₁, t₂, …, tₙ is expressed as a list [ts], and (t₁ ++ t₂ ++ … ++ tₙ) via [ts.foldl].
3124
Similarly, p₁, …, pₙ is [ps] and q₁, …, qₙ is [qs]. -/
32-
theorem levi_lemma_gen (u v : List α) (ts : List (List α)) [DecidableEq α] (h : TraceEquiv I (u ++ v) (ts.foldl List.append [])) :
25+
theorem levi_lemma_gen (u v : List α) (ts : List (List α)) [DecidableEq α] (h : TraceEquiv I (u ++ v) ts.flatten) :
3326
∃ (ps qs : List (List α)),
3427
ps.length = ts.length
3528
∧ qs.length = ts.length
36-
∧ TraceEquiv I u (ps.foldl List.append [])
37-
∧ TraceEquiv I v (qs.foldl List.append [])
29+
∧ TraceEquiv I u ps.flatten
30+
∧ TraceEquiv I v qs.flatten
3831
∧ (∀ i : Fin (min ts.length (min ps.length qs.length)), TraceEquiv I ts[i] (ps[i] ++ qs[i]))
3932
∧ ∀ i : Fin qs.length, ∀ j : Fin ps.length, i.val < j.val → independent I qs[i] ps[j] := by
4033
induction ts generalizing u v with
@@ -46,12 +39,7 @@ theorem levi_lemma_gen (u v : List α) (ts : List (List α)) [DecidableEq α] (h
4639
intro ⟨i, hi⟩
4740
simp at hi
4841
| cons t tsuf ih =>
49-
have equiv_split : TraceEquiv I (u ++ v) (t ++ (tsuf.foldl List.append [])) := by
50-
unfold List.foldl at h
51-
simp at h
52-
rw [foldl_append_eq _ _] at h
53-
exact h
54-
have ⟨p, psuf, q, qsuf, h_ind, h_up, h_vq, h_tpq, h_tpq_suf⟩ := levi_lemma equiv_split
42+
have ⟨p, psuf, q, qsuf, h_ind, h_up, h_vq, h_tpq, h_tpq_suf⟩ := levi_lemma h
5543
replace ih := ih psuf qsuf h_tpq_suf.symm
5644
have ⟨ps_i, qs_i, ih_p_len, ih_q_len, ih_p, ih_q, ih_tpq, ih_ind⟩ := ih
5745
clear ih
@@ -61,11 +49,9 @@ theorem levi_lemma_gen (u v : List α) (ts : List (List α)) [DecidableEq α] (h
6149
· simp [ih_q_len]
6250
· apply TraceEquiv.trans h_up
6351
simp
64-
rw [foldl_append_eq]
6552
exact TraceEquiv.compat (TraceEquiv.refl p) ih_p
6653
· apply TraceEquiv.trans h_vq
6754
simp
68-
rw [foldl_append_eq]
6955
exact TraceEquiv.compat (TraceEquiv.refl q) ih_q
7056
· intro ⟨i, hi⟩
7157
by_cases hzi : i = 0
@@ -83,7 +69,7 @@ theorem levi_lemma_gen (u v : List α) (ts : List (List α)) [DecidableEq α] (h
8369
| zero =>
8470
simp at hj ⊢
8571
have h_ind_ps := indep_of_indep_of_equiv (indep_symm h_ind) ih_p
86-
exact indep_of_foldl ⟨j, hj⟩ h_ind_ps
72+
exact indep_of_flatten ⟨j, hj⟩ h_ind_ps
8773
| succ i =>
8874
simp at hi hj hij ⊢
8975
exact ih_ind ⟨i, hi⟩ ⟨j, hj⟩ hij
@@ -221,7 +207,6 @@ theorem recognizableDFMA_is_recognizable (S : Set M) :
221207
exact hm'
222208

223209

224-
225210
variable {T : Set M}
226211

227212
def syntacticCongr (T : Set M) (x y : M) := ∀ u v : M, u * x * v ∈ T ↔ u * y * v ∈ T
@@ -306,7 +291,7 @@ theorem recognizable_is_finSyntacticIndex :
306291
IsRecognizable T → Finite (syntacticMonoid T) := by
307292
unfold IsRecognizable
308293
intro ⟨N, N_mon, N_fin, N_dec, φ, h⟩
309-
have : ∀ a b, φ a = φ b → syntacticCongr T a b := by
294+
have h_img_syn : ∀ a b, φ a = φ b → syntacticCongr T a b := by
310295
intro a b hab u v
311296
rw [h]
312297
simp [hab]
@@ -318,9 +303,98 @@ theorem recognizable_is_finSyntacticIndex :
318303
rw [<- hm]
319304
apply Quotient.sound
320305
intro u v
321-
apply this
306+
apply h_img_syn
322307
have hm : φ m ∈ ⇑φ '' Set.univ := Set.mem_image_of_mem (⇑φ) trivial
323308
exact (Classical.choose_spec hm).2
324309
exact Finite.of_surjective f f_surj
325310

311+
/-- Prop 4.1 (i) => (iv) -/
312+
theorem recognizable_has_recognizablePreImage (L : Type) [Monoid L] (φ : L →* M) :
313+
IsRecognizable T → IsRecognizable (φ ⁻¹' T) := by
314+
intro h
315+
unfold IsRecognizable at h ⊢
316+
rcases h with ⟨N, N_mon, N_fin, N_dec, ψ, hψ⟩
317+
use N, N_mon, N_fin, N_dec
318+
use {
319+
toFun := ψ ∘ φ
320+
map_one' := by simp
321+
map_mul' := by simp
322+
}
323+
simp
324+
ext x
325+
apply Iff.intro
326+
· intro hx
327+
rw [Set.mem_preimage] at hx
328+
rw [Set.mem_preimage, Set.mem_image]
329+
use x
330+
simp [hx]
331+
· intro hx
332+
rw [Set.mem_preimage, Set.mem_image] at hx
333+
obtain ⟨y, hy, h⟩ := hx
334+
have hφy : φ y ∈ T := by rwa [Set.mem_preimage] at hy
335+
have : ψ (φ x) ∈ ψ '' T := by
336+
rw [Set.mem_image]
337+
exact ⟨φ y, hφy, h⟩
338+
have : φ x ∈ ψ ⁻¹' (ψ '' T) := by rwa [Set.mem_preimage]
339+
rw [← hψ] at this
340+
rw [Set.mem_preimage]
341+
exact this
342+
343+
noncomputable def preImage_syntacticMonoid_iso (L : Type) [Monoid L] (φ : L →* M) (hφ : Function.Surjective φ) :
344+
syntacticMonoid (φ ⁻¹' T) ≃* syntacticMonoid T := by
345+
refine ⟨?_, ?_⟩
346+
· refine ⟨?_, ?_, ?_, ?_⟩
347+
· exact Quotient.lift (fun l => ⟦φ l⟧) (by
348+
intro a b hab
349+
simp
350+
apply Quotient.sound
351+
intro u v
352+
have ⟨u', hu'⟩ := hφ u
353+
have ⟨v', hv'⟩ := hφ v
354+
replace hab := hab u' v'
355+
rw [Set.mem_preimage] at hab
356+
simp [hu', hv'] at hab
357+
exact hab
358+
)
359+
· exact Quotient.lift (fun m => ⟦Classical.choose (hφ m)⟧) (by
360+
intro a b hab
361+
simp
362+
apply Quotient.sound
363+
intro u v
364+
simp [Set.mem_preimage]
365+
rw [Classical.choose_spec (hφ a), Classical.choose_spec (hφ b)]
366+
exact hab (φ u) (φ v)
367+
)
368+
· intro x
369+
rcases x
370+
rename_i l
371+
simp
372+
apply Quotient.sound
373+
intro u v
374+
simp [Set.mem_preimage]
375+
rw [Classical.choose_spec (hφ (φ l))]
376+
· intro x
377+
rcases x
378+
rename_i m
379+
simp
380+
apply Quotient.sound
381+
intro u v
382+
rw [Classical.choose_spec (hφ m)]
383+
· intro x y
384+
rcases x
385+
rcases y
386+
rename_i l₁ l₂
387+
apply Quotient.sound
388+
intro u v
389+
rw [MonoidHom.map_mul φ l₁ l₂]
390+
391+
/-- Prop 4.1 (iv) => (i) -/
392+
theorem recognizablePreImage_is_recognizable (L : Type) [Monoid L] (φ : L →* M) (hφ : Function.Surjective φ) :
393+
IsRecognizable (φ ⁻¹' T) → IsRecognizable T := by
394+
intro h
395+
apply recognizable_is_finSyntacticIndex at h
396+
apply finSyntacticIndex_is_recognizable
397+
have ψ := @preImage_syntacticMonoid_iso M _ T L _ φ hφ
398+
exact ψ.finite_iff.mp h
399+
326400
end Trace

0 commit comments

Comments
 (0)