Skip to content

Commit 7ce5f8c

Browse files
committed
Found some more edge cases in simplification operations, bugs fixed and tests corrected
1 parent 3faeb96 commit 7ce5f8c

3 files changed

Lines changed: 112 additions & 18 deletions

File tree

modules/AnSEL/Simplify.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,8 @@ Identification of specific diagrams (i.e. FTerms)
418418
{t1 = ReduceIndices[setup, it1], t2 = ReduceIndices[setup, it2], nt1, nt2, curIdx1, curIdx2, curIdxRepl, startPoints, doFields, allObjt1, allObjt2, cidxt1, cidxt2, oidxt1, oidxt2, startt1, startt1fields, cidxstartt1, startt2, nstartt2, startt2fields, cidxstartt2, branchAllObjt2, idx, jdx, equal = False, startsign, a, factor, removeOther, fac1, fac2, terms1, terms2, nallIdxReplNew, tmp}
419419
,
420420
(*Start off by default-ordering t1 and t2*)
421-
t1 = FOrderFields[setup, t1];
422-
t2 = FOrderFields[setup, t2];
421+
t1 = FixIndices[setup, FOrderFields[setup, t1]];
422+
t2 = FixIndices[setup, FOrderFields[setup, t2]];
423423
(*If[MemberQ[t1,AnyField,Infinity],Message[TermsEqualAndSum::undeterminedFields];Abort[]];*)
424424
(*Briefly check the trivial case*)
425425
FunKitDebug[4, " TermsEqualAndSum: Comparing \n ", t1, "\n &\n ", t2];

modules/FEDeriK/SuperIndexTransformations.m

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,24 @@
120120

121121
GetSuperIndexTermTransformations[setup_, term_FTerm] :=
122122
GetSuperIndexTermTransformations[setup, {term}];
123+
124+
NormalizeSuperIndices[setup_, expr_FTerm] :=
125+
Module[{cindices, orderingFunction},
126+
cindices = GetClosedSuperIndices[setup, expr];
127+
orderingFunction[e1_, e2_] :=
128+
Module[{p1, p2, idx},
129+
p1 = FirstPosition[expr, e1];
130+
p2 = FirstPosition[expr, e2];
131+
For[idx = 1, idx <= Min[Length[p1], Length[p2]], idx++,
132+
If[p1[[idx]] < p2[[idx]],
133+
Return[True]
134+
];
135+
If[p1[[idx]] > p2[[idx]],
136+
Return[False]
137+
];
138+
];
139+
Return[False];
140+
];
141+
cindices = Sort[cindices, orderingFunction];
142+
expr /. Thread[cindices -> Table[Symbol["sIdx" <> ToString[idx]], {idx, 1, Length[cindices]}]]
143+
];

tests/AnSEL/SimplifyTests.m

Lines changed: 89 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,15 @@
8989
tests
9090
,
9191
TestCreate[
92-
Module[{setup, t1, t2},
92+
Module[{setup, t1, t2, res},
9393
setup = GetFunKitSetupScalar[];
9494
t1 = FTerm[1, Propagator[{Phi, Phi}, {i1, i2}], Propagator[{Phi, Phi}, {i2, i3}]];
9595
t2 = FTerm[1, Propagator[{Phi, Phi}, {i1, i2}], Propagator[{Phi, Phi}, {i2, i3}]];
96-
FunKit`Private`TermsEqualAndSum[setup, t1, t2]
96+
res = FunKit`Private`TermsEqualAndSum[setup, t1, t2];
97+
FunKit`Private`NormalizeSuperIndices[setup, res]
9798
]
9899
,
99-
FTerm[2, Propagator[{Phi, Phi}, {i2, i1}], Propagator[{Phi, Phi}, {i3, i2}]]
100+
FTerm[2, Propagator[{Phi, Phi}, {sIdx1, i1}], Propagator[{Phi, Phi}, {i3, sIdx1}]]
100101
,
101102
TestID -> "TermsEqualAndSum: identical bosonic terms"
102103
]
@@ -106,14 +107,15 @@
106107
tests
107108
,
108109
TestCreate[
109-
Module[{setup, t1, t2},
110+
Module[{setup, t1, t2, res},
110111
setup = GetFunKitSetupScalar[];
111112
t1 = FTerm[1, Propagator[{Phi, Phi}, {i1, i2}], Propagator[{Phi, Phi}, {i2, i3}]];
112113
t2 = FTerm[1, Propagator[{Phi, Phi}, {i1, b}], Propagator[{Phi, Phi}, {b, i3}]];
113-
FunKit`Private`TermsEqualAndSum[setup, t1, t2]
114+
res = FunKit`Private`TermsEqualAndSum[setup, t1, t2];
115+
FunKit`Private`NormalizeSuperIndices[setup, res]
114116
]
115117
,
116-
FTerm[2, Propagator[{Phi, Phi}, {i2, i1}], Propagator[{Phi, Phi}, {i3, i2}]]
118+
FTerm[2, Propagator[{Phi, Phi}, {sIdx1, i1}], Propagator[{Phi, Phi}, {i3, sIdx1}]]
117119
,
118120
TestID -> "TermsEqualAndSum: different index names"
119121
]
@@ -195,14 +197,15 @@
195197
tests
196198
,
197199
TestCreate[
198-
Module[{setup, t1, t2},
200+
Module[{setup, t1, t2, res},
199201
setup = GetFunKitSetupYukawa[];
200202
t1 = FTerm[1, Propagator[{Psi, Psibar}, {i1, i2}], GammaN[{Psi, Psibar, Phi}, {-i1, -i3, -i4}], GammaN[{Psi, Psibar, Phi}, {-i5, -i2, -i6}], Propagator[{Psi, Psibar}, {i3, i5}], Propagator[{Phi, Phi}, {i4, i6}]];
201203
t2 = FTerm[1, Propagator[{Psi, Psibar}, {a, b}], GammaN[{Psi, Psibar, Phi}, {-a, -c, -d}], GammaN[{Psi, Psibar, Phi}, {-e, -b, -f}], Propagator[{Psi, Psibar}, {c, e}], Propagator[{Phi, Phi}, {d, f}]];
202-
FunKit`Private`TermsEqualAndSum[setup, t1, t2]
204+
res = FunKit`Private`TermsEqualAndSum[setup, t1, t2];
205+
FunKit`Private`NormalizeSuperIndices[setup, res]
203206
]
204207
,
205-
FTerm[2, Propagator[{Psi, Psibar}, {i1, i2}], GammaN[{Phi, Psibar, Psi}, {-i4, -i3, -i1}], GammaN[{Phi, Psibar, Psi}, {-i6, -i2, -i5}], Propagator[{Psi, Psibar}, {i3, i5}], Propagator[{Phi, Phi}, {i6, i4}]]
208+
FTerm[2, Propagator[{Psi, Psibar}, {sIdx1, sIdx2}], GammaN[{Phi, Psibar, Psi}, {-sIdx3, -sIdx4, -sIdx1}], GammaN[{Phi, Psibar, Psi}, {-sIdx5, -sIdx2, -sIdx6}], Propagator[{Psi, Psibar}, {sIdx4, sIdx6}], Propagator[{Phi, Phi}, {sIdx5, sIdx3}]]
206209
,
207210
TestID -> "TermsEqualAndSum: identical fermionic diagrams"
208211
]
@@ -212,19 +215,55 @@
212215
tests
213216
,
214217
TestCreate[
215-
Module[{setup, t1, t2},
218+
Module[{setup, t1, t2, res},
216219
setup = GetFunKitSetupYukawa[];
217220
t1 = FTerm[1, Propagator[{Psi, Psibar}, {i1, i2}], GammaN[{Psi, Psibar, Phi}, {-i1, -i3, -i4}], GammaN[{Psi, Psibar, Phi}, {-i5, -i2, -i6}], Propagator[{Psi, Psibar}, {i3, i5}], Propagator[{Phi, Phi}, {i4, i6}]];
218221
t2 = FTerm[-1, Propagator[{Psibar, Psi}, {b, a}], GammaN[{Psibar, Phi, Psi}, {-c, -d, -a}], GammaN[{Phi, Psi, Psibar}, {-f, -e, -b}], Propagator[{Psibar, Psi}, {e, c}], Propagator[{Phi, Phi}, {d, f}]];
219-
FunKit`Private`TermsEqualAndSum[setup, t1, t2]
222+
res = FunKit`Private`TermsEqualAndSum[setup, t1, t2];
223+
FunKit`Private`NormalizeSuperIndices[setup, res]
220224
]
221225
,
222-
FTerm[2, Propagator[{Psi, Psibar}, {i1, i2}], GammaN[{Phi, Psibar, Psi}, {-i4, -i3, -i1}], GammaN[{Phi, Psibar, Psi}, {-i6, -i2, -i5}], Propagator[{Psi, Psibar}, {i3, i5}], Propagator[{Phi, Phi}, {i6, i4}]]
226+
FTerm[2, Propagator[{Psi, Psibar}, {sIdx1, sIdx2}], GammaN[{Phi, Psibar, Psi}, {-sIdx3, -sIdx4, -sIdx1}], GammaN[{Phi, Psibar, Psi}, {-sIdx5, -sIdx2, -sIdx6}], Propagator[{Psi, Psibar}, {sIdx4, sIdx6}], Propagator[{Phi, Phi}, {sIdx5, sIdx3}]]
223227
,
224228
TestID -> "TermsEqualAndSum: reordered fermionic fields"
225229
]
226230
];
227231

232+
AppendTo[
233+
tests
234+
,
235+
TestCreate[
236+
Module[{setup, t1, t2},
237+
setup = GetFunKitSetupFourFermion[];
238+
t1 = FTerm[GammaN[{Psibar, Psibar, Psi, Psi}, {-i1, -i2, -i3, -i4}], Propagator[{Psi, Psibar}, {i1, i3}], Propagator[{Psi, Psibar}, {i2, i4}]];
239+
t2 = FTerm[GammaN[{Psibar, Psibar, Psi, Psi}, {-i1, -i2, -i3, -i4}], Propagator[{Psi, Psibar}, {i1, i4}], Propagator[{Psi, Psibar}, {i2, i3}]];
240+
FunKit`Private`TermsEqualAndSum[setup, t1, t2]
241+
]
242+
,
243+
FTerm[0]
244+
,
245+
TestID -> "FSimplify 4F: Identify two tadpoles with switched legs correctly (expect FEx[] after simplification)"
246+
]
247+
];
248+
249+
AppendTo[
250+
tests
251+
,
252+
TestCreate[
253+
Module[{setup, t1, t2, res},
254+
setup = GetFunKitSetupFourFermion[];
255+
t1 = FTerm[GammaN[{Psibar, Psibar, Psi, Psi}, {-i1, -i2, -i3, -i4}], Propagator[{Psi, Psibar}, {i1, i3}], Propagator[{Psi, Psibar}, {i2, i4}]];
256+
t2 = FTerm[-1, GammaN[{Psibar, Psibar, Psi, Psi}, {-i1, -i2, -i3, -i4}], Propagator[{Psi, Psibar}, {i1, i4}], Propagator[{Psi, Psibar}, {i2, i3}]];
257+
res = FunKit`Private`TermsEqualAndSum[setup, t1, t2];
258+
FunKit`Private`NormalizeSuperIndices[setup, res]
259+
]
260+
,
261+
FTerm[2, GammaN[{Psibar, Psibar, Psi, Psi}, {-sIdx1, -sIdx2, -sIdx3, -sIdx4}], Propagator[{Psi, Psibar}, {sIdx2, sIdx4}], Propagator[{Psi, Psibar}, {sIdx1, sIdx3}]]
262+
,
263+
TestID -> "FSimplify 4F: Identify two tadpoles with switched legs correctly (expect NOT FEx[] after simplification)"
264+
]
265+
];
266+
228267
(**********************************************************************************
229268
Section 4: FSimplify — bosonic simplification — 5 tests
230269
**********************************************************************************)
@@ -240,12 +279,12 @@
240279
FTakeDerivatives[setup, WetterichEquation, {Phi[i1], Phi[i2]}] //
241280
FTruncate //
242281
FSimplify;
243-
Length[result] - 1 === 2
282+
Length[result] - 1
244283
]
245284
,
246-
True
285+
2
247286
,
248-
TestID -> "FSimplify: scalar 2-point flow"
287+
TestID -> "FSimplify: scalar 2-point flow has 2 terms (tadpole and polarization)"
249288
]
250289
];
251290

@@ -265,7 +304,7 @@
265304
,
266305
4
267306
,
268-
TestID -> "FSimplify: scalar 4-point flow"
307+
TestID -> "FSimplify: scalar 4-point flow has 4 terms (1 diagram with two 4-point vertices, 2 diagrams with one 4-point vertex, 1 diagram with no 4-point vertices)"
269308
]
270309
];
271310

@@ -390,6 +429,40 @@
390429
Section 6: FSimplify — four-fermion interactions — 5 tests
391430
**********************************************************************************)
392431

432+
AppendTo[
433+
tests
434+
,
435+
TestCreate[
436+
Module[{setup, eq1, eq2},
437+
setup = GetFunKitSetupFourFermion[];
438+
eq1 = FTerm[GammaN[{Psibar, Psibar, Psi, Psi}, {-i1, -i2, -i3, -i4}], Propagator[{Psi, Psibar}, {i1, i3}], Propagator[{Psi, Psibar}, {i2, i4}]];
439+
eq2 = FTerm[GammaN[{Psibar, Psibar, Psi, Psi}, {-i1, -i2, -i3, -i4}], Propagator[{Psi, Psibar}, {i1, i4}], Propagator[{Psi, Psibar}, {i2, i3}]];
440+
FSimplify[setup, FEx[eq1, eq2]]
441+
]
442+
,
443+
FEx[]
444+
,
445+
TestID -> "FSimplify 4F: Identify two tadpoles with switched legs correctly (expect FEx[] after simplification)"
446+
]
447+
];
448+
449+
AppendTo[
450+
tests
451+
,
452+
TestCreate[
453+
Module[{setup, eq1, eq2},
454+
setup = GetFunKitSetupFourFermion[];
455+
eq1 = FTerm[GammaN[{Psibar, Psibar, Psi, Psi}, {-i1, -i2, -i3, -i4}], Propagator[{Psi, Psibar}, {i1, i3}], Propagator[{Psi, Psibar}, {i2, i4}]];
456+
eq2 = FTerm[-1, GammaN[{Psibar, Psibar, Psi, Psi}, {-i1, -i2, -i3, -i4}], Propagator[{Psi, Psibar}, {i1, i4}], Propagator[{Psi, Psibar}, {i2, i3}]];
457+
FSimplify[setup, FEx[eq1, eq2]] =!= FEx[]
458+
]
459+
,
460+
True
461+
,
462+
TestID -> "FSimplify 4F: Identify two tadpoles with switched legs correctly (expect NOT FEx[] after simplification)"
463+
]
464+
];
465+
393466
AppendTo[
394467
tests
395468
,

0 commit comments

Comments
 (0)