Theorem: List.permutationsAux_append
File: Mathlib/Data/List/Permutation.lean

tactic: induction' is with t is ih generalizing is'
state_before: α : Type u_1
β : Type u_2
is is' ts : List α
⊢ (is ++ ts).permutationsAux is' =
    map (fun x => x ++ ts) (is.permutationsAux is') ++ ts.permutationsAux (is.reverse ++ is')
state_after: case nil
α : Type u_1
β : Type u_2
ts is' : List α
⊢ ([] ++ ts).permutationsAux is' =
    map (fun x => x ++ ts) ([].permutationsAux is') ++ ts.permutationsAux ([].reverse ++ is')

case cons
α : Type u_1
β : Type u_2
ts : List α
t : α
is : List α
ih :
  ∀ (is' : List α),
    (is ++ ts).permutationsAux is' =
      map (fun x => x ++ ts) (is.permutationsAux is') ++ ts.permutationsAux (is.reverse ++ is')
is' : List α
⊢ (t :: is ++ ts).permutationsAux is' =
    map (fun x => x ++ ts) ((t :: is).permutationsAux is') ++ ts.permutationsAux ((t :: is).reverse ++ is')

tactic: simp only [foldr_permutationsAux2, ih, map_bind, cons_append, permutationsAux_cons, map_append,
  reverse_cons, append_assoc, singleton_append]
state_before: case cons
α : Type u_1
β : Type u_2
ts : List α
t : α
is : List α
ih :
  ∀ (is' : List α),
    (is ++ ts).permutationsAux is' =
      map (fun x => x ++ ts) (is.permutationsAux is') ++ ts.permutationsAux (is.reverse ++ is')
is' : List α
⊢ (t :: is ++ ts).permutationsAux is' =
    map (fun x => x ++ ts) ((t :: is).permutationsAux is') ++ ts.permutationsAux ((t :: is).reverse ++ is')
state_after: case cons
α : Type u_1
β : Type u_2
ts : List α
t : α
is : List α
ih :
  ∀ (is' : List α),
    (is ++ ts).permutationsAux is' =
      map (fun x => x ++ ts) (is.permutationsAux is') ++ ts.permutationsAux (is.reverse ++ is')
is' : List α
⊢ (is'.permutations.bind fun y => (permutationsAux2 t (is ++ ts) [] y id).2) ++
      (map (fun x => x ++ ts) (is.permutationsAux (t :: is')) ++ ts.permutationsAux (is.reverse ++ t :: is')) =
    (is'.permutations.bind fun a => map (fun x => x ++ ts) (permutationsAux2 t is [] a id).2) ++
      (map (fun x => x ++ ts) (is.permutationsAux (t :: is')) ++ ts.permutationsAux (is.reverse ++ t :: ([] ++ is')))

tactic: congr 2
state_before: case cons
α : Type u_1
β : Type u_2
ts : List α
t : α
is : List α
ih :
  ∀ (is' : List α),
    (is ++ ts).permutationsAux is' =
      map (fun x => x ++ ts) (is.permutationsAux is') ++ ts.permutationsAux (is.reverse ++ is')
is' : List α
⊢ (is'.permutations.bind fun y => (permutationsAux2 t (is ++ ts) [] y id).2) ++
      (map (fun x => x ++ ts) (is.permutationsAux (t :: is')) ++ ts.permutationsAux (is.reverse ++ t :: is')) =
    (is'.permutations.bind fun a => map (fun x => x ++ ts) (permutationsAux2 t is [] a id).2) ++
      (map (fun x => x ++ ts) (is.permutationsAux (t :: is')) ++ ts.permutationsAux (is.reverse ++ t :: ([] ++ is')))
state_after: case cons.e_a.e_b
α : Type u_1
β : Type u_2
ts : List α
t : α
is : List α
ih :
  ∀ (is' : List α),
    (is ++ ts).permutationsAux is' =
      map (fun x => x ++ ts) (is.permutationsAux is') ++ ts.permutationsAux (is.reverse ++ is')
is' : List α
⊢ (fun y => (permutationsAux2 t (is ++ ts) [] y id).2) = fun a =>
    map (fun x => x ++ ts) (permutationsAux2 t is [] a id).2

tactic: funext _
state_before: case cons.e_a.e_b
α : Type u_1
β : Type u_2
ts : List α
t : α
is : List α
ih :
  ∀ (is' : List α),
    (is ++ ts).permutationsAux is' =
      map (fun x => x ++ ts) (is.permutationsAux is') ++ ts.permutationsAux (is.reverse ++ is')
is' : List α
⊢ (fun y => (permutationsAux2 t (is ++ ts) [] y id).2) = fun a =>
    map (fun x => x ++ ts) (permutationsAux2 t is [] a id).2
state_after: case cons.e_a.e_b.h
α : Type u_1
β : Type u_2
ts : List α
t : α
is : List α
ih :
  ∀ (is' : List α),
    (is ++ ts).permutationsAux is' =
      map (fun x => x ++ ts) (is.permutationsAux is') ++ ts.permutationsAux (is.reverse ++ is')
is' x✝ : List α
⊢ (permutationsAux2 t (is ++ ts) [] x✝ id).2 = map (fun x => x ++ ts) (permutationsAux2 t is [] x✝ id).2

tactic: rw [map_permutationsAux2]
state_before: case cons.e_a.e_b.h
α : Type u_1
β : Type u_2
ts : List α
t : α
is : List α
ih :
  ∀ (is' : List α),
    (is ++ ts).permutationsAux is' =
      map (fun x => x ++ ts) (is.permutationsAux is') ++ ts.permutationsAux (is.reverse ++ is')
is' x✝ : List α
⊢ (permutationsAux2 t (is ++ ts) [] x✝ id).2 = map (fun x => x ++ ts) (permutationsAux2 t is [] x✝ id).2
state_after: case cons.e_a.e_b.h
α : Type u_1
β : Type u_2
ts : List α
t : α
is : List α
ih :
  ∀ (is' : List α),
    (is ++ ts).permutationsAux is' =
      map (fun x => x ++ ts) (is.permutationsAux is') ++ ts.permutationsAux (is.reverse ++ is')
is' x✝ : List α
⊢ (permutationsAux2 t (is ++ ts) [] x✝ id).2 = (permutationsAux2 t is [] x✝ fun x => x ++ ts).2

tactic: simp (config := { singlePass := true }) only [← permutationsAux2_comp_append]
state_before: case cons.e_a.e_b.h
α : Type u_1
β : Type u_2
ts : List α
t : α
is : List α
ih :
  ∀ (is' : List α),
    (is ++ ts).permutationsAux is' =
      map (fun x => x ++ ts) (is.permutationsAux is') ++ ts.permutationsAux (is.reverse ++ is')
is' x✝ : List α
⊢ (permutationsAux2 t (is ++ ts) [] x✝ id).2 = (permutationsAux2 t is [] x✝ fun x => x ++ ts).2
state_after: case cons.e_a.e_b.h
α : Type u_1
β : Type u_2
ts : List α
t : α
is : List α
ih :
  ∀ (is' : List α),
    (is ++ ts).permutationsAux is' =
      map (fun x => x ++ ts) (is.permutationsAux is') ++ ts.permutationsAux (is.reverse ++ is')
is' x✝ : List α
⊢ (permutationsAux2 t [] [] x✝ fun x => id (x ++ (is ++ ts))).2 = (permutationsAux2 t [] [] x✝ fun x => x ++ is ++ ts).2

tactic: simp only [id, append_assoc]
state_before: case cons.e_a.e_b.h
α : Type u_1
β : Type u_2
ts : List α
t : α
is : List α
ih :
  ∀ (is' : List α),
    (is ++ ts).permutationsAux is' =
      map (fun x => x ++ ts) (is.permutationsAux is') ++ ts.permutationsAux (is.reverse ++ is')
is' x✝ : List α
⊢ (permutationsAux2 t [] [] x✝ fun x => id (x ++ (is ++ ts))).2 = (permutationsAux2 t [] [] x✝ fun x => x ++ is ++ ts).2
state_after: no goals

tactic: simp
state_before: case nil
α : Type u_1
β : Type u_2
ts is' : List α
⊢ ([] ++ ts).permutationsAux is' =
    map (fun x => x ++ ts) ([].permutationsAux is') ++ ts.permutationsAux ([].reverse ++ is')
state_after: no goals