Skip to content

Commit 3d8254f

Browse files
committed
Move lemma about right cancellation over concatenation to Basic.lean
1 parent 016c92a commit 3d8254f

2 files changed

Lines changed: 17 additions & 16 deletions

File tree

TraceTheory/TraceTheory/Basic.lean

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,23 @@ lemma singleton_cancel_right {a : α} : [a].cancel_right a = [] := by
317317
rw [← List.nil_append [a], List.cancel_right_snoc]
318318
simp
319319

320+
@[simp]
321+
lemma cancel_right_over_concat {w₁ w₂ : List α} (a : α) :
322+
(w₁ ++ w₂).cancel_right a
323+
= if (a ∈ w₂) then w₁ ++ (w₂.cancel_right a) else (w₁.cancel_right a) ++ w₂ := by
324+
induction w₂ using List.induction_right with
325+
| nil =>
326+
simp
327+
| snoc w₂' a' ih =>
328+
nth_rw 1 [← List.append_assoc]
329+
by_cases ha : a ∈ w₂'
330+
all_goals
331+
by_cases heq : a = a'
332+
· rw [List.cancel_right_snoc]
333+
simp [heq]
334+
· rw [List.cancel_right_snoc]
335+
simp [ha, heq, ih]
336+
320337
/--
321338
Projection commutes with right-cancellation: projecting then cancelling is the same as cancelling then projecting.
322339
-/

TraceTheory/TraceTheory/Trace.lean

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,6 @@ lemma mirror_rule {w₁ w₂ : List α} (h : TraceEquiv I w₁ w₂) : -- (1.6)
108108

109109
infixl:65 " ÷ " => List.cancel_right
110110

111-
@[simp]
112-
lemma cancel_right_over_concat {w₁ w₂ : List α} (a : α) :
113-
(w₁ ++ w₂) ÷ a = if (a ∈ w₂) then w₁ ++ (w₂ ÷ a) else (w₁ ÷ a) ++ w₂ := by
114-
induction w₂ using List.induction_right with
115-
| nil =>
116-
simp
117-
| snoc w₂' a' ih =>
118-
nth_rw 1 [← List.append_assoc]
119-
by_cases ha : a ∈ w₂'
120-
all_goals
121-
by_cases heq : a = a'
122-
· rw [List.cancel_right_snoc]
123-
simp [heq]
124-
· rw [List.cancel_right_snoc]
125-
simp [ha, heq, ih]
126-
127111
variable (I) in
128112
lemma cancellation_rule {w₁ w₂ : List α} (a : α) (h : TraceEquiv I w₁ w₂) : -- (1.7)
129113
TraceEquiv I (w₁ ÷ a) (w₂ ÷ a) := by

0 commit comments

Comments
 (0)