- var: Nat → Lean.Data.AC.Expr
- op: Lean.Data.AC.Expr → Lean.Data.AC.Expr → Lean.Data.AC.Expr
Instances For
Equations
- Lean.Data.AC.instInhabitedExpr = { default := Lean.Data.AC.Expr.var default }
Equations
- Lean.Data.AC.instReprExpr = { reprPrec := Lean.Data.AC.reprExpr✝ }
Equations
- Lean.Data.AC.instBEqExpr = { beq := Lean.Data.AC.beqExpr✝ }
- value : α
- neutral : Option (Lean.IsNeutral op s.value)
Instances For
- op : α → α → α
- assoc : Lean.IsAssociative s.op
- comm : Option (Lean.IsCommutative s.op)
- idem : Option (Lean.IsIdempotent s.op)
- vars : List (Lean.Data.AC.Variable s.op)
- arbitrary : α
Instances For
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 }
Instances For
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)
[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)
Instances For
Equations
Instances For
def
Lean.Data.AC.evalList
{α : Sort u_1}
(β : Sort u)
[Lean.Data.AC.EvalInformation α β]
(ctx : α)
:
Equations
- Lean.Data.AC.evalList β ctx [] = Lean.Data.AC.EvalInformation.arbitrary ctx
- Lean.Data.AC.evalList β ctx [x_1] = Lean.Data.AC.EvalInformation.evalVar ctx x_1
- Lean.Data.AC.evalList β ctx (x_1 :: xs) = Lean.Data.AC.EvalInformation.evalOp ctx (Lean.Data.AC.EvalInformation.evalVar ctx x_1) (Lean.Data.AC.evalList β ctx xs)
Instances For
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
Instances For
Equations
- Lean.Data.AC.sort xs = Lean.Data.AC.sort.loop [] xs
Instances For
Equations
- Lean.Data.AC.sort.loop x [] = x
- Lean.Data.AC.sort.loop x (x_2 :: xs) = Lean.Data.AC.sort.loop (Lean.Data.AC.insert x_2 x) xs
Instances For
Equations
- Lean.Data.AC.mergeIdem xs = match xs with | [] => [] | x :: xs => Lean.Data.AC.mergeIdem.loop x xs
Instances For
Equations
- Lean.Data.AC.mergeIdem.loop x (next :: rest) = if x = next then Lean.Data.AC.mergeIdem.loop x rest else x :: Lean.Data.AC.mergeIdem.loop next rest
- Lean.Data.AC.mergeIdem.loop x [] = [x]
Instances For
def
Lean.Data.AC.removeNeutrals
{α : Sort u_1}
[info : Lean.Data.AC.ContextInformation α]
(ctx : α)
:
Equations
- Lean.Data.AC.removeNeutrals ctx x = match x with | x :: xs => match Lean.Data.AC.removeNeutrals.loop ctx (x :: xs) with | [] => [x] | ys => ys | [] => []
Instances For
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 [] = []
Instances For
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.
Instances For
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