- var: Nat → Lean.Data.AC.Expr
- op: Lean.Data.AC.Expr → Lean.Data.AC.Expr → Lean.Data.AC.Expr
Equations
- Lean.Data.AC.instInhabitedExpr = { default := Lean.Data.AC.Expr.var default }
Equations
- Lean.Data.AC.instReprExpr = { reprPrec := [anonymous] }
Equations
- Lean.Data.AC.instBEqExpr = { beq := [anonymous] }
- value : α
- neutral : Option (Lean.IsNeutral op value)
- op : α → α → α
- assoc : Lean.IsAssociative op
- comm : Option (Lean.IsCommutative op)
- idem : Option (Lean.IsIdempotent op)
- vars : List (Lean.Data.AC.Variable op)
- arbitrary : α
- arbitrary : α → β
- evalOp : α → β → β → β
- evalVar : α → Nat → β
def
Lean.Data.AC.Context.var
{α : Sort u_1}
(ctx : Lean.Data.AC.Context α)
(idx : Nat)
:
Lean.Data.AC.Variable ctx.op
Equations
- Lean.Data.AC.Context.var ctx idx = List.getD ctx.vars idx { value := ctx.arbitrary, neutral := none }
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.Data.AC.instEvalInformationContext = { arbitrary := fun ctx => ctx.arbitrary, evalOp := fun ctx => ctx.op, evalVar := fun ctx idx => (Lean.Data.AC.Context.var ctx idx).value }
def
Lean.Data.AC.eval
{α : Sort u_1}
(β : Sort u)
[inst : Lean.Data.AC.EvalInformation α β]
(ctx : α)
(ex : Lean.Data.AC.Expr)
:
β
Equations
- Lean.Data.AC.eval β ctx (Lean.Data.AC.Expr.var a) = Lean.Data.AC.EvalInformation.evalVar ctx a
- Lean.Data.AC.eval β ctx (Lean.Data.AC.Expr.op a a_1) = Lean.Data.AC.EvalInformation.evalOp ctx (Lean.Data.AC.eval β ctx a) (Lean.Data.AC.eval β ctx a_1)
Equations
def
Lean.Data.AC.evalList
{α : Sort u_1}
(β : Sort u)
[inst : Lean.Data.AC.EvalInformation α β]
(ctx : α)
:
Equations
- Lean.Data.AC.evalList β ctx [] = Lean.Data.AC.EvalInformation.arbitrary ctx
- Lean.Data.AC.evalList β ctx [x] = Lean.Data.AC.EvalInformation.evalVar ctx x
- Lean.Data.AC.evalList β ctx (x :: xs) = Lean.Data.AC.EvalInformation.evalOp ctx (Lean.Data.AC.EvalInformation.evalVar ctx x) (Lean.Data.AC.evalList β ctx xs)
Equations
- Lean.Data.AC.insert x [] = [x]
- Lean.Data.AC.insert x (a :: as) = if x < a then x :: a :: as else a :: Lean.Data.AC.insert x as
Equations
- Lean.Data.AC.sort xs = Lean.Data.AC.sort.loop [] xs
Equations
- Lean.Data.AC.sort.loop _fun_discr [] = _fun_discr
- Lean.Data.AC.sort.loop _fun_discr (x :: xs) = Lean.Data.AC.sort.loop (Lean.Data.AC.insert x _fun_discr) xs
Equations
- Lean.Data.AC.mergeIdem xs = match xs with | [] => [] | x :: xs => Lean.Data.AC.mergeIdem.loop x xs
Equations
- Lean.Data.AC.mergeIdem.loop _fun_discr (next :: rest) = if _fun_discr = next then Lean.Data.AC.mergeIdem.loop _fun_discr rest else _fun_discr :: Lean.Data.AC.mergeIdem.loop next rest
- Lean.Data.AC.mergeIdem.loop _fun_discr [] = [_fun_discr]
def
Lean.Data.AC.removeNeutrals
{α : Sort u_1}
[info : Lean.Data.AC.ContextInformation α]
(ctx : α)
:
Equations
- Lean.Data.AC.removeNeutrals ctx _fun_discr = match _fun_discr with | x :: xs => match Lean.Data.AC.removeNeutrals.loop ctx (x :: xs) with | [] => [x] | ys => ys | [] => []
def
Lean.Data.AC.removeNeutrals.loop
{α : Sort u_1}
[info : Lean.Data.AC.ContextInformation α]
(ctx : α)
:
Equations
- One or more equations did not get rendered due to their size.
- Lean.Data.AC.removeNeutrals.loop ctx [] = []
def
Lean.Data.AC.norm
{α : Sort u_1}
[info : Lean.Data.AC.ContextInformation α]
(ctx : α)
(e : Lean.Data.AC.Expr)
:
Equations
- One or more equations did not get rendered due to their size.
theorem
Lean.Data.AC.Context.mergeIdem_nonEmpty
(e : List Nat)
(h : e ≠ [])
:
Lean.Data.AC.mergeIdem e ≠ []
theorem
Lean.Data.AC.Context.mergeIdem_head
{x : Nat}
{xs : List Nat}
:
Lean.Data.AC.mergeIdem (x :: x :: xs) = Lean.Data.AC.mergeIdem (x :: xs)
theorem
Lean.Data.AC.Context.mergeIdem_head2
{x : Nat}
{y : Nat}
{ys : List Nat}
(h : x ≠ y)
:
Lean.Data.AC.mergeIdem (x :: y :: ys) = x :: Lean.Data.AC.mergeIdem (y :: ys)
theorem
Lean.Data.AC.Context.evalList_mergeIdem
{α : Sort u_1}
(ctx : Lean.Data.AC.Context α)
(h : Lean.Data.AC.ContextInformation.isIdem ctx = true)
(e : List Nat)
:
Lean.Data.AC.evalList α ctx (Lean.Data.AC.mergeIdem e) = Lean.Data.AC.evalList α ctx e
theorem
Lean.Data.AC.Context.sort_loop_nonEmpty
{ys : List Nat}
(xs : List Nat)
(h : xs ≠ [])
:
Lean.Data.AC.sort.loop xs ys ≠ []
theorem
Lean.Data.AC.Context.evalList_insert
{α : Sort u_1}
(ctx : Lean.Data.AC.Context α)
(h : Lean.IsCommutative ctx.op)
(x : Nat)
(xs : List Nat)
:
Lean.Data.AC.evalList α ctx (Lean.Data.AC.insert x xs) = Lean.Data.AC.evalList α ctx (x :: xs)
theorem
Lean.Data.AC.Context.evalList_sort_congr
{α : Sort u_1}
{a : List Nat}
{b : List Nat}
{c : List Nat}
(ctx : Lean.Data.AC.Context α)
(h : Lean.IsCommutative ctx.op)
(h₂ : Lean.Data.AC.evalList α ctx a = Lean.Data.AC.evalList α ctx b)
(h₃ : a ≠ [])
(h₄ : b ≠ [])
:
Lean.Data.AC.evalList α ctx (Lean.Data.AC.sort.loop a c) = Lean.Data.AC.evalList α ctx (Lean.Data.AC.sort.loop b c)
theorem
Lean.Data.AC.Context.evalList_sort_loop_swap
{α : Sort u_1}
{y : Nat}
(ctx : Lean.Data.AC.Context α)
(h : Lean.IsCommutative ctx.op)
(xs : List Nat)
(ys : List Nat)
:
Lean.Data.AC.evalList α ctx (Lean.Data.AC.sort.loop xs (y :: ys)) = Lean.Data.AC.evalList α ctx (Lean.Data.AC.sort.loop (y :: xs) ys)
theorem
Lean.Data.AC.Context.evalList_sort_cons
{α : Sort u_1}
(ctx : Lean.Data.AC.Context α)
(h : Lean.IsCommutative ctx.op)
(x : Nat)
(xs : List Nat)
:
Lean.Data.AC.evalList α ctx (Lean.Data.AC.sort (x :: xs)) = Lean.Data.AC.evalList α ctx (x :: Lean.Data.AC.sort xs)
theorem
Lean.Data.AC.Context.evalList_sort
{α : Sort u_1}
(ctx : Lean.Data.AC.Context α)
(h : Lean.Data.AC.ContextInformation.isComm ctx = true)
(e : List Nat)
:
Lean.Data.AC.evalList α ctx (Lean.Data.AC.sort e) = Lean.Data.AC.evalList α ctx e
theorem
Lean.Data.AC.Context.unwrap_isNeutral
{α : Sort u_1}
{ctx : Lean.Data.AC.Context α}
{x : Nat}
:
theorem
Lean.Data.AC.Context.evalList_removeNeutrals
{α : Sort u_1}
(ctx : Lean.Data.AC.Context α)
(e : List Nat)
:
Lean.Data.AC.evalList α ctx (Lean.Data.AC.removeNeutrals ctx e) = Lean.Data.AC.evalList α ctx e
theorem
Lean.Data.AC.Context.evalList_append
{α : Sort u_1}
(ctx : Lean.Data.AC.Context α)
(l : List Nat)
(r : List Nat)
(h₁ : l ≠ [])
(h₂ : r ≠ [])
:
Lean.Data.AC.evalList α ctx (List.append l r) = Lean.Data.AC.Context.op ctx (Lean.Data.AC.evalList α ctx l) (Lean.Data.AC.evalList α ctx r)
theorem
Lean.Data.AC.Context.eval_toList
{α : Sort u_1}
(ctx : Lean.Data.AC.Context α)
(e : Lean.Data.AC.Expr)
:
Lean.Data.AC.evalList α ctx (Lean.Data.AC.Expr.toList e) = Lean.Data.AC.eval α ctx e
theorem
Lean.Data.AC.Context.eval_norm
{α : Sort u_1}
(ctx : Lean.Data.AC.Context α)
(e : Lean.Data.AC.Expr)
:
Lean.Data.AC.evalList α ctx (Lean.Data.AC.norm ctx e) = Lean.Data.AC.eval α ctx e
theorem
Lean.Data.AC.Context.eq_of_norm
{α : Sort u_1}
(ctx : Lean.Data.AC.Context α)
(a : Lean.Data.AC.Expr)
(b : Lean.Data.AC.Expr)
(h : (Lean.Data.AC.norm ctx a == Lean.Data.AC.norm ctx b) = true)
:
Lean.Data.AC.eval α ctx a = Lean.Data.AC.eval α ctx b