α : Sort u_1
ctx : Context α
h✝ : ContextInformation.isComm ctx = true
e : List Nat
h : IsCommutative ctx.op
⊢ evalList α ctx (sort e) = evalList α ctx e
α : Sort u_1
ctx : Context α
h : ContextInformation.isComm ctx = true
e : List Nat
⊢ evalList α ctx (sort e) = evalList α ctx e
have h : IsCommutative ctx.op := by simp [ContextInformation.isComm, Option.isSome] at h; cases h₂ : ctx.comm <;> simp [h₂] at h; assumption
no goals
α : Sort u_1
ctx : Context α
h✝ : ContextInformation.isComm ctx = true
e : List Nat
h : IsCommutative ctx.op
⊢ evalList α ctx (sort e) = evalList α ctx e
induction e using List.two_step_induction with
| empty => rfl
| single => rfl
| step x y ys ih =>
  simp [evalList_sort_cons ctx h]
  cases h₂ : sort (y :: ys) with
  | nil => simp [sort, sort.loop] at *; apply absurd h₂; apply sort_loop_nonEmpty; apply insert_nonEmpty
  | cons z zs => simp [evalList, ←h₂, ih]
α : Sort u_1
ctx : Context α
h :
  (match ctx.comm with
    | some val => true
    | none => false) =
    true
e : List Nat
⊢ IsCommutative ctx.op
α : Sort u_1
ctx : Context α
h : ContextInformation.isComm ctx = true
e : List Nat
⊢ IsCommutative ctx.op
simp [ContextInformation.isComm, Option.isSome] at h
case some
α : Sort u_1
ctx : Context α
e : List Nat
val✝ : IsCommutative ctx.op
h₂ : ctx.comm = some val✝
h : True
⊢ IsCommutative ctx.op
α : Sort u_1
ctx : Context α
h :
  (match ctx.comm with
    | some val => true
    | none => false) =
    true
e : List Nat
⊢ IsCommutative ctx.op
cases h₂ : ctx.comm <;> simp [h₂] at h
no goals
case some
α : Sort u_1
ctx : Context α
e : List Nat
val✝ : IsCommutative ctx.op
h₂ : ctx.comm = some val✝
h : True
⊢ IsCommutative ctx.op
assumption
no goals
case empty
α : Sort u_1
ctx : Context α
h✝ : ContextInformation.isComm ctx = true
h : IsCommutative ctx.op
⊢ evalList α ctx (sort []) = evalList α ctx []
rfl
no goals
case single
α : Sort u_1
ctx : Context α
h✝ : ContextInformation.isComm ctx = true
h : IsCommutative ctx.op
a✝ : Nat
⊢ evalList α ctx (sort [a✝]) = evalList α ctx [a✝]
rfl
case step
α : Sort u_1
ctx : Context α
h✝ : ContextInformation.isComm ctx = true
h : IsCommutative ctx.op
x y : Nat
ys : List Nat
ih : evalList α ctx (sort (y :: ys)) = evalList α ctx (y :: ys)
⊢ evalList α ctx (x :: sort (y :: ys)) = evalList α ctx (x :: y :: ys)
case step
α : Sort u_1
ctx : Context α
h✝ : ContextInformation.isComm ctx = true
h : IsCommutative ctx.op
x y : Nat
ys : List Nat
ih : evalList α ctx (sort (y :: ys)) = evalList α ctx (y :: ys)
⊢ evalList α ctx (sort (x :: y :: ys)) = evalList α ctx (x :: y :: ys)
simp [evalList_sort_cons ctx h]
no goals
case step
α : Sort u_1
ctx : Context α
h✝ : ContextInformation.isComm ctx = true
h : IsCommutative ctx.op
x y : Nat
ys : List Nat
ih : evalList α ctx (sort (y :: ys)) = evalList α ctx (y :: ys)
⊢ evalList α ctx (x :: sort (y :: ys)) = evalList α ctx (x :: y :: ys)
cases h₂ : sort (y :: ys) with
| nil => simp [sort, sort.loop] at *; apply absurd h₂; apply sort_loop_nonEmpty; apply insert_nonEmpty
| cons z zs => simp [evalList, ←h₂, ih]
case step.nil
α : Sort u_1
ctx : Context α
h✝ : ContextInformation.isComm ctx = true
h : IsCommutative ctx.op
x y : Nat
ys : List Nat
ih : evalList α ctx (sort.loop (insert y []) ys) = evalList α ctx (y :: ys)
h₂ : sort.loop (insert y []) ys = []
⊢ evalList α ctx [x] = evalList α ctx (x :: y :: ys)
case step.nil
α : Sort u_1
ctx : Context α
h✝ : ContextInformation.isComm ctx = true
h : IsCommutative ctx.op
x y : Nat
ys : List Nat
ih : evalList α ctx (sort (y :: ys)) = evalList α ctx (y :: ys)
h₂ : sort (y :: ys) = []
⊢ evalList α ctx [x] = evalList α ctx (x :: y :: ys)
simp [sort, sort.loop] at *
case step.nil
α : Sort u_1
ctx : Context α
h✝ : ContextInformation.isComm ctx = true
h : IsCommutative ctx.op
x y : Nat
ys : List Nat
ih : evalList α ctx (sort.loop (insert y []) ys) = evalList α ctx (y :: ys)
h₂ : sort.loop (insert y []) ys = []
⊢ ¬sort.loop (insert y []) ys = []
case step.nil
α : Sort u_1
ctx : Context α
h✝ : ContextInformation.isComm ctx = true
h : IsCommutative ctx.op
x y : Nat
ys : List Nat
ih : evalList α ctx (sort.loop (insert y []) ys) = evalList α ctx (y :: ys)
h₂ : sort.loop (insert y []) ys = []
⊢ evalList α ctx [x] = evalList α ctx (x :: y :: ys)
apply absurd h₂
case step.nil.h
α : Sort u_1
ctx : Context α
h✝ : ContextInformation.isComm ctx = true
h : IsCommutative ctx.op
x y : Nat
ys : List Nat
ih : evalList α ctx (sort.loop (insert y []) ys) = evalList α ctx (y :: ys)
h₂ : sort.loop (insert y []) ys = []
⊢ insert y [] ≠ []
case step.nil
α : Sort u_1
ctx : Context α
h✝ : ContextInformation.isComm ctx = true
h : IsCommutative ctx.op
x y : Nat
ys : List Nat
ih : evalList α ctx (sort.loop (insert y []) ys) = evalList α ctx (y :: ys)
h₂ : sort.loop (insert y []) ys = []
⊢ ¬sort.loop (insert y []) ys = []
apply sort_loop_nonEmpty
no goals
case step.nil.h
α : Sort u_1
ctx : Context α
h✝ : ContextInformation.isComm ctx = true
h : IsCommutative ctx.op
x y : Nat
ys : List Nat
ih : evalList α ctx (sort.loop (insert y []) ys) = evalList α ctx (y :: ys)
h₂ : sort.loop (insert y []) ys = []
⊢ insert y [] ≠ []
apply insert_nonEmpty
no goals
case step.cons
α : Sort u_1
ctx : Context α
h✝ : ContextInformation.isComm ctx = true
h : IsCommutative ctx.op
x y : Nat
ys : List Nat
ih : evalList α ctx (sort (y :: ys)) = evalList α ctx (y :: ys)
z : Nat
zs : List Nat
h₂ : sort (y :: ys) = z :: zs
⊢ evalList α ctx (x :: z :: zs) = evalList α ctx (x :: y :: ys)
simp [evalList, ←h₂, ih]