-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPerm.lean
More file actions
28 lines (22 loc) · 867 Bytes
/
Perm.lean
File metadata and controls
28 lines (22 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import Mathlib.Data.List.Perm
variable {α : Type u}
inductive Perm : List α → List α → Prop
| nil : Perm [] []
| cons x : Perm l (l₁ ++ l₂) → Perm (x :: l) (l₁ ++ x :: l₂)
theorem Perm.refl : (l : List α) → Perm l l
| [] => .nil
| x :: l => .cons (l₁ := []) x (refl l)
theorem Perm.trans {l₁ l₂ l₃ : List α} (h₁ : Perm l₁ l₂) (h₂ : Perm l₂ l₃) : Perm l₁ l₃ := by
induction h₁ with
| nil => exact h₂
| cons x h₁ ih₁ =>
sorry
example : Perm l l' → List.Perm l l'
| .nil => .nil
| .cons x h => .trans (.cons x <| _example h) List.perm_middle.symm
example (h : List.Perm l l') : Perm l l' := by
induction h with
| nil => exact .nil
| cons x _ h => exact .cons (l₁ := []) x h
| swap x y => exact .cons (l₁ := [x]) y <| .refl _
| trans _ _ h₁ h₂ => exact .trans h₁ h₂