@@ -700,22 +700,32 @@ lemma exists_lcd {u v w : List α} (hu : isPrefix I ⟦u⟧ ⟦w⟧) (hv : isPre
700700 apply Quotient.sound
701701 exact hd'.symm
702702
703- open FreeMonoid
703+ instance : Monoid (List α) where
704+ one := []
705+ mul := List.append
706+ mul_assoc := List.append_assoc
707+ mul_one := List.append_nil
708+ one_mul := List.nil_append
704709
705710variable (I) in
706711@[ext]
707712structure DependenceMorphism (M : Type *) [Monoid M] where
708- toFun : FreeMonoid α →* M
709- A1 : ∀ w, toFun w = toFun 1 → w = 1
710- A2 : ∀ {a b}, I.rel a b → toFun (of a * of b) = toFun (of b * of a)
711- A3 : ∀ {u v} {a}, toFun (u * of a ) = toFun v → toFun u = toFun (v ÷ a)
712- A4 : ∀ {u v} {a b}, toFun (u * of a ) = toFun (v * of b ) ∧ a ≠ b → I.rel a b
713+ toFun : List α →* M
714+ A1 : ∀ w, toFun w = toFun 1 → w = []
715+ A2 : ∀ {a b}, I.rel a b → toFun [a, b] = toFun [b, a]
716+ A3 : ∀ {u v} {a}, toFun (u ++ [a] ) = toFun v → toFun u = toFun (v ÷ a)
717+ A4 : ∀ {u v} {a b}, toFun (u ++ [a] ) = toFun (v ++ [b] ) ∧ a ≠ b → I.rel a b
713718
714719instance {M} [Monoid M] : CoeFun (DependenceMorphism I M) (fun _ ↦ FreeMonoid α → M) where
715720 coe := fun morphism ↦ morphism.toFun
716721
717722attribute [coe] DependenceMorphism.toFun
718723
724+ lemma DependenceMorphism.map_append {I M} [Monoid M]
725+ (ϕ : DependenceMorphism I M) (u v : List α) :
726+ ϕ (u ++ v) = ϕ u * ϕ v :=
727+ ϕ.toFun.map_mul u v
728+
719729def mk' : FreeMonoid α →* Trace I where
720730 toFun := Quotient.mk (traceSetoid I)
721731 map_one' := rfl
@@ -738,7 +748,7 @@ def traceDependenceMorphism : DependenceMorphism I (Trace I) where -- (1.3.9)
738748 intro u v a huav
739749 replace huav := Quotient.exact huav
740750 apply Quotient.sound
741- have h_cancel : TraceEquiv I (u.toList ++ [a] ÷ a) (v ÷ a) := cancellation_rule I a huav
751+ have h_cancel : TraceEquiv I (u ++ [a] ÷ a) (v ÷ a) := cancellation_rule I a huav
742752 simp at h_cancel
743753 exact h_cancel
744754 A4 := by
@@ -747,4 +757,22 @@ def traceDependenceMorphism : DependenceMorphism I (Trace I) where -- (1.3.9)
747757 have h_indep := indep_and_decomp_of_equiv_of_neq_tail I h_equiv huvab.right
748758 exact h_indep.left
749759
760+ variable {M : Type *} [Monoid M]
761+
762+ lemma decomp_of_image_eq_of_neq_tail
763+ {ϕ : DependenceMorphism I M} {u v : List α} {a b : α}
764+ (heq : ϕ (u ++ [a]) = ϕ (v ++ [b])) (hne : a ≠ b) : -- (1.3.6)
765+ ∃ w, ϕ u = ϕ (w ++ [b]) ∧ ϕ v = ϕ (w ++ [a]) := by
766+ have hu : ϕ u = ϕ (v ÷ a ++ [b]) := by
767+ have h := ϕ.A3 heq
768+ simp [List.cancel_right_over_concat, hne] at h
769+ exact h
770+ have hu' : ϕ (u ÷ b) = ϕ (v ÷ a) := (ϕ.A3 hu.symm).symm
771+ use u ÷ b
772+ constructor
773+ · rw [hu, ϕ.map_append, ϕ.map_append, hu']
774+ · have hab : u ÷ b ++ [a] = u ++ [a] ÷ b := by simp [hne.symm]
775+ rw [hab]
776+ exact ϕ.A3 heq.symm
777+
750778end Trace
0 commit comments