(* ::Package:: *)

(************************************************************************)
(* This file was generated automatically by the Mathematica front end.  *)
(* It contains Initialization cells from a Notebook file, which         *)
(* typically will have the same name as this file except ending in      *)
(* ".nb" instead of ".m".                                               *)
(*                                                                      *)
(* This file is intended to be loaded into the Mathematica kernel using *)
(* the package loading commands Get or Needs.  Doing so is equivalent   *)
(* to using the Evaluate Initialization Cells menu command in the front *)
(* end.                                                                 *)
(*                                                                      *)
(* DO NOT EDIT THIS FILE.  This entire file is regenerated              *)
(* automatically each time the parent Notebook file is saved in the     *)
(* Mathematica front end.  Any changes you make to this file will be    *)
(* overwritten.                                                         *)
(************************************************************************)



BeginPackage["QuantumGroups`AlgebraRelations`",{"QuantumGroups`","QuantumGroups`RootSystems`","QuantumGroups`Utilities`Debugging`","QuantumGroups`Utilities`MatrixWrapper`","QuantumGroups`MatrixPresentations`","QuantumGroups`Algebra`","QuantumGroups`Representations`"}];


Relations::usage="";


CheckRelations::usage="";


Begin["`Private`"];


q=Global`q



qBinomial[n_,k_][q_]:=qFactorial[n][q]/(qFactorial[n-k][q]qFactorial[k][q])


BasicRelations[\[CapitalGamma]_]:=With[{cm=CartanMatrix[\[CapitalGamma]],cf=CartanFactors[\[CapitalGamma]],n=Rank[\[CapitalGamma]]},
DeleteCases[Flatten[Join[
Table[Subscript[K, i]**Subscript[K, j]==Subscript[K, j]**Subscript[K, i],{i,1,n},{j,i+1,n}],
Table[Subscript[K, i]**Subscript[K, i]^-1==\[ScriptOne],{i,1,n}],
Table[Subscript[K, i]^-1**Subscript[K, i]==\[ScriptOne],{i,1,n}],
Table[Subscript[K, i]**SuperPlus[Subscript[X, j]]**Subscript[K, i]^-1==q^(cf[[i]]cm[[i,j]]) SuperPlus[Subscript[X, j]],{i,1,n},{j,1,n}],
Table[Subscript[K, i]**SuperMinus[Subscript[X, j]]**Subscript[K, i]^-1==q^(-cf[[i]]cm[[i,j]]) SuperMinus[Subscript[X, j]],{i,1,n},{j,1,n}],
Table[SuperPlus[Subscript[X, i]]**SuperMinus[Subscript[X, j]]-SuperMinus[Subscript[X, j]]**SuperPlus[Subscript[X, i]]==DiscreteDelta[i-j] (Subscript[K, i]-Subscript[K, i]^-1)/(q^cf[[i]]-q^-cf[[i]]),{i,1,n},{j,1,n}]

]]/.{0->\[ScriptZero]},True]
]


(*SerreRelations[\[CapitalGamma]_]:=With[{cm=CartanMatrix[\[CapitalGamma]],cf=CartanFactors[\[CapitalGamma]],n=Rank[\[CapitalGamma]]},
DeleteCases[Flatten[Join[
Table[\!\(
\*UnderoverscriptBox[\(\[Sum]\), \(r = 0\), \(1 - cm\[LeftDoubleBracket]i, j\[RightDoubleBracket]\)]\(
\*SuperscriptBox[\((\(-1\))\), \(r\)]\(qBinomial[1 - cm\[LeftDoubleBracket]i, j\[RightDoubleBracket], r]\)[
\*SuperscriptBox[\(q\), \(cf\[LeftDoubleBracket]i\[RightDoubleBracket]\)]]NonCommutativePower[SuperPlus[
\*SubscriptBox[\(X\), \(i\)]], 1 - cm\[LeftDoubleBracket]i, j\[RightDoubleBracket] - r] ** SuperPlus[
\*SubscriptBox[\(X\), \(j\)]] ** NonCommutativePower[SuperPlus[
\*SubscriptBox[\(X\), \(i\)]], r]\)\)\[Equal]\[ScriptZero],{i,1,n},{j,1,n}],
Table[\!\(
\*UnderoverscriptBox[\(\[Sum]\), \(r = 0\), \(1 - cm\[LeftDoubleBracket]i, j\[RightDoubleBracket]\)]\(
\*SuperscriptBox[\((\(-1\))\), \(r\)]\(qBinomial[1 - cm\[LeftDoubleBracket]i, j\[RightDoubleBracket], r]\)[
\*SuperscriptBox[\(q\), \(cf\[LeftDoubleBracket]i\[RightDoubleBracket]\)]]NonCommutativePower[SuperMinus[
\*SubscriptBox[\(X\), \(i\)]], 1 - cm\[LeftDoubleBracket]i, j\[RightDoubleBracket] - r] ** SuperMinus[
\*SubscriptBox[\(X\), \(j\)]] ** NonCommutativePower[SuperMinus[
\*SubscriptBox[\(X\), \(i\)]], r]\)\)\[Equal]\[ScriptZero],{i,1,n},{j,1,n}]
]]/.{0\[Rule]\[ScriptZero]},True]
]*)


Relations[\[CapitalGamma]_]:=BasicRelations[\[CapitalGamma]]~Join~SerreRelations[\[CapitalGamma]]


CheckRelationsInternal[\[CapitalGamma]_][V_,\[Beta]_,\[Lambda]_]:=(Simplify[Relations[\[CapitalGamma]]/.{a_==\[ScriptZero]:>ZeroMatrixQ[Simplify[MatrixPresentation[\[CapitalGamma]][a][V,\[Beta],\[Lambda]]]],a_==b_:>ZeroMatrixQ[Simplify[MatrixPresentation[\[CapitalGamma]][a-b][V,\[Beta],\[Lambda]]]]}])


CheckBasicRelations[\[CapitalGamma]_][V_,\[Beta]_,\[Lambda]_]:=(Simplify[BasicRelations[\[CapitalGamma]]/.{a_==\[ScriptZero]:>ZeroMatrixQ[Simplify[MatrixPresentation[\[CapitalGamma]][a][V,\[Beta],\[Lambda]]]],a_==b_:>ZeroMatrixQ[Simplify[MatrixPresentation[\[CapitalGamma]][a-b][V,\[Beta],\[Lambda]]]]}])


CheckRelations[\[CapitalGamma]_][V_,\[Beta]_,\[Lambda]_]:=And@@(Simplify[Relations[\[CapitalGamma]]/.{a_==\[ScriptZero]:>ZeroMatrixQ[Simplify[MatrixPresentation[\[CapitalGamma]][a][V,\[Beta],\[Lambda]]]],a_==b_:>ZeroMatrixQ[Simplify[MatrixPresentation[\[CapitalGamma]][a-b][V,\[Beta],\[Lambda]]]]}])


CheckRelations[\[CapitalGamma]_][V_,\[Beta]_]:=And@@(CheckRelations[\[CapitalGamma]][V,\[Beta],#]&/@Weights[\[CapitalGamma],V])


End[];


EndPackage[];
