# decompose(BettiTally) -- write a Betti diagram as a positive combination of pure integral diagrams

## Synopsis

• Usage:
decompose B
• Function: decompose
• Inputs:
• B, , not necessarily Cohen-Macaulay
• Outputs:
• , a positive combination of pure integral Betti diagrams

## Description

This applies the algorithm implied by the Boij-Soederberg conjecture, and also works even if the diagram does not corresponds to a Cohen-Macaulay module.
 ```i1 : R = ZZ/103[a,b,c] o1 = R o1 : PolynomialRing``` ```i2 : I = ideal"a3,abc,b4,c4,b2c2" 3 4 4 2 2 o2 = ideal (a , a*b*c, b , c , b c ) o2 : Ideal of R``` ```i3 : B = betti res I 0 1 2 3 o3 = total: 1 5 8 4 0: 1 . . . 1: . . . . 2: . 2 . . 3: . 3 2 . 4: . . 4 2 5: . . 2 2 o3 : BettiTally``` ```i4 : C = decompose B 1 / 0 1 2 3\ 1 / 0 1 2 3\ 3 / 0 1 2 3\ 11 / 0 1 2 3\ 1 / 0 1 2 3\ o4 = (--)|total: 8 35 42 15| + (--)|total: 2 7 14 9| + (--)|total: 1 7 14 8| + (--)|total: 1 6 8 3| + (--)|total: 3 14 32 21| 21 | 0: 8 . . .| 21 | 0: 2 . . .| 28 | 0: 1 . . .| 48 | 0: 1 . . .| 16 | 0: 3 . . .| | 1: . . . .| | 1: . . . .| | 1: . . . .| | 1: . . . .| | 1: . . . .| | 2: . 35 . .| | 2: . 7 . .| | 2: . . . .| | 2: . . . .| | 2: . . . .| | 3: . . 42 .| | 3: . . . .| | 3: . 7 . .| | 3: . 6 . .| | 3: . 14 . .| \ 4: . . . 15/ \ 4: . . 14 9/ \ 4: . . 14 8/ | 4: . . 8 .| | 4: . . . .| \ 5: . . . 3/ \ 5: . . 32 21/ o4 : Expression of class Sum```
Check that this really does sum to B:
 ```i5 : value C 0 1 2 3 o5 = total: 1 5 8 4 0: 1 . . . 1: . . . . 2: . 2 . . 3: . 3 2 . 4: . . 4 2 5: . . 2 2 o5 : BettiTally```
Note that the entries are displayed in a peculiar manner. Let's lift this to the integers.
 ```i6 : lift(value C, ZZ) 0 1 2 3 o6 = total: 1 5 8 4 0: 1 . . . 1: . . . . 2: . 2 . . 3: . 3 2 . 4: . . 4 2 5: . . 2 2 o6 : BettiTally``` ```i7 : B == oo o7 = true```
Let's display the list of Betti diagrams in the decomposition, and also the list of multipliers.
 ```i8 : netList pack(3, apply(toList C, x -> x#1)) +-----------------+-----------------+---------------+ | 0 1 2 3| 0 1 2 3 | 0 1 2 3| o8 = |total: 8 35 42 15|total: 2 7 14 9 |total: 1 7 14 8| | 0: 8 . . .| 0: 2 . . . | 0: 1 . . .| | 1: . . . .| 1: . . . . | 1: . . . .| | 2: . 35 . .| 2: . 7 . . | 2: . . . .| | 3: . . 42 .| 3: . . . . | 3: . 7 . .| | 4: . . . 15| 4: . . 14 9 | 4: . . 14 8| +-----------------+-----------------+---------------+ | 0 1 2 3 | 0 1 2 3| | |total: 1 6 8 3 |total: 3 14 32 21| | | 0: 1 . . . | 0: 3 . . .| | | 1: . . . . | 1: . . . .| | | 2: . . . . | 2: . . . .| | | 3: . 6 . . | 3: . 14 . .| | | 4: . . 8 . | 4: . . . .| | | 5: . . . 3 | 5: . . 32 21| | +-----------------+-----------------+---------------+``` ```i9 : apply(toList C, first) 1 1 3 11 1 o9 = {--, --, --, --, --} 21 21 28 48 16 o9 : List```
Here is an example where the Betti diagram is not Cohen-Macaulay.
 ```i10 : R = ZZ/103[a,b,c] o10 = R o10 : PolynomialRing``` ```i11 : I = ideal"a3,abc,b4,b2c2" 3 4 2 2 o11 = ideal (a , a*b*c, b , b c ) o11 : Ideal of R``` ```i12 : B = betti res I 0 1 2 3 o12 = total: 1 4 5 2 0: 1 . . . 1: . . . . 2: . 2 . . 3: . 2 2 . 4: . . 2 1 5: . . 1 1 o12 : BettiTally``` ```i13 : C = decompose B 1 / 0 1 2 3\ 2 / 0 1 2 3\ 1 / 0 1 2 3\ 17 / 0 1 2 3\ 13 / 0 1 2 3\ 2 / 0 1 2\ o13 = (--)|total: 8 35 42 15| + (--)|total: 2 7 14 9| + (---)|total: 5 16 20 9| + (--)|total: 1 6 8 3| + (---)|total: 3 14 32 21| + (--)|total: 3 7 4| 21 | 0: 8 . . .| 63 | 0: 2 . . .| 144 | 0: 5 . . .| 96 | 0: 1 . . .| 672 | 0: 3 . . .| 21 | 0: 3 . .| | 1: . . . .| | 1: . . . .| | 1: . . . .| | 1: . . . .| | 1: . . . .| | 1: . . .| | 2: . 35 . .| | 2: . 7 . .| | 2: . 16 . .| | 2: . . . .| | 2: . . . .| | 2: . . .| | 3: . . 42 .| | 3: . . . .| | 3: . . . .| | 3: . 6 . .| | 3: . 14 . .| | 3: . 7 .| \ 4: . . . 15/ \ 4: . . 14 9/ | 4: . . 20 .| | 4: . . 8 .| | 4: . . . .| | 4: . . .| \ 5: . . . 9/ \ 5: . . . 3/ \ 5: . . 32 21/ \ 5: . . 4/ o13 : Expression of class Sum```
The following example cannot be decomposed. This means that there is no module with this Betti diagram.
 ```i14 : M = matrix"1,0,0,0;0,0,0,0;0,3,0,0;0,0,5,3" o14 = | 1 0 0 0 | | 0 0 0 0 | | 0 3 0 0 | | 0 0 5 3 | 4 4 o14 : Matrix ZZ <--- ZZ``` ```i15 : B = mat2betti M 0 1 2 3 o15 = total: 1 3 5 3 0: 1 . . . 1: . . . . 2: . 3 . . 3: . . 5 3 o15 : BettiTally``` ```i16 : codim B o16 = 1``` ```i17 : degree B o17 = 2``` ```i18 : try decompose B else "Betti diagram cannot exist" NOT IN THIS SIMPLEX OF PURE BETTI DIAGRAMS o18 = Betti diagram cannot exist``` ```i19 : pureBettiDiagram lowestDegrees B 0 1 2 3 o19 = total: 1 5 9 5 0: 1 . . . 1: . . . . 2: . 5 . . 3: . . 9 5 o19 : BettiTally```