@@ -580,11 +580,16 @@ InstallGlobalFunction( RecogniseGeneric,
580
580
fi ;
581
581
fi ;
582
582
583
- # TODO: store the mandarins and their SLPs?
583
+ # TODO: store the mandarin SLPs here. Make sure, to only write when succesful.
584
584
# check mandarins now
585
585
for x in mandarins do
586
586
s := SLPforElement(ri, x);
587
587
if s = fail then
588
+ # TODO: with the master branch rewriting the gens as slps never
589
+ # fails. at least we never enter a second iteration of the
590
+ # "recognise image" loop.
591
+ Info (InfoRecog, 2 ,
592
+ " Enter Mandarin crisis, backtrack to the last safe node." );
588
593
return MANDARIN_CRISIS;
589
594
fi ;
590
595
od ;
@@ -608,6 +613,9 @@ InstallGlobalFunction( RecogniseGeneric,
608
613
# fails, then somewhere higher up in the recognition tree, a kernel must
609
614
# have been too small.
610
615
if ForAny(mandarins, x->not ValidateHomomInput(ri, x)) then
616
+ Info (InfoRecog, 2 ,
617
+ " ValidateHomomInput for a mandarin failed," ,
618
+ " backtracking to the last safe node." );
611
619
return MANDARIN_CRISIS;
612
620
fi ;
613
621
# Compute the mandarins of the factor
@@ -655,6 +663,9 @@ InstallGlobalFunction( RecogniseGeneric,
655
663
factorMandarins,
656
664
IsSafeForMandarins(ri));
657
665
Remove(depthString);
666
+ PrintTreePos(" F" ,depthString,H);
667
+ SetImageRecogNode(ri,rifac);
668
+ SetParentRecogNode(rifac,ri);
658
669
if not IsReady(rifac) then
659
670
# IsReady was not set, thus abort the whole computation.
660
671
if InfoLevel(InfoRecog) = 1 and depth = 0 then Print(" \n " ); fi ;
@@ -665,9 +676,6 @@ InstallGlobalFunction( RecogniseGeneric,
665
676
# tree, a kernel must have been too small.
666
677
return MANDARIN_CRISIS;
667
678
fi ;
668
- PrintTreePos(" F" ,depthString,H);
669
- SetImageRecogNode(ri,rifac);
670
- SetParentRecogNode(rifac,ri);
671
679
672
680
if IsMatrixGroup(H) then
673
681
Info (InfoRecog,2 ," Back from image (depth=" ,depth,
@@ -723,11 +731,8 @@ InstallGlobalFunction( RecogniseGeneric,
723
731
x := mandarins[ i] ;
724
732
y := factorMandarins[ i] ;
725
733
s := SLPforElement(rifac, y);
726
- # TODO: these SLPs should be stored when they are computed for the
727
- # first time.
728
- if s = fail then
729
- Error(" TODO: no SLP for factor" );
730
- fi ;
734
+ # TODO: These SLPs should be stored when they are computed for the
735
+ # first time. In particular, they can't be fail.
731
736
z := ResultOfStraightLineProgram(s, pregensfac(ri));
732
737
if not ri!. isequal(x, z) then
733
738
Add( kernelMandarins, x / z );
@@ -740,12 +745,15 @@ InstallGlobalFunction( RecogniseGeneric,
740
745
RECOG_HandleSpecialCaseKernelTrivialAndMarkedForImmediateVerification(ri);
741
746
fi ;
742
747
if IsEmpty(gensN(ri)) and not IsEmpty(kernelMandarins) then
743
- # We found out that N is the trivial group, but the mandarins disagree!
748
+ Info (InfoRecog, 2 , " Kernel is trivial although mandarins disagree. " );
744
749
# We handle this in the same way as if recognition of the
745
750
# kernel returned a MANDARIN_CRISIS.
746
751
if not IsSafeForMandarins(ri) then
752
+ Info (InfoRecog, 2 , " Backtrack to the last safe node." );
747
753
return MANDARIN_CRISIS;
748
754
else
755
+ Info (InfoRecog, 2 ,
756
+ " Handle the mandarin crisis at depth=" , depth, " ." );
749
757
if not TryToEnlargeKernelGeneratingSetAndUpdateSLPsDuringMandarinCrisis(ri) then
750
758
# TODO: discard and re-recognise the image.
751
759
ErrorNoReturn(" TODO" );
@@ -784,35 +792,34 @@ InstallGlobalFunction( RecogniseGeneric,
784
792
kernelMandarins,
785
793
# TODO: extend this such that riker can also
786
794
# be IsSafeForMandarins, if the responsible
787
- # findgensNmeth is guaranteed to feed the
795
+ # findgensNmeth is guaranteed to find the
788
796
# generators for the whole kernel.
789
797
false );
790
798
Remove(depthString);
799
+ PrintTreePos(" K" ,depthString,H);
800
+ SetKernelRecogNode(ri,riker);
801
+ SetParentRecogNode(riker,ri);
802
+ Info (InfoRecog,2 ," Back from kernel (depth=" ,depth," )." );
791
803
if riker = MANDARIN_CRISIS then
792
804
# According to the mandarins, there was an error in the kernel
793
805
# generation of the current node or higher up in the recognition
794
806
# tree.
807
+ Info (InfoRecog, 2 , " Enter mandarin crisis." );
795
808
if not IsSafeForMandarins(ri) then
796
- # Backtrack to the first safe node on the way to the root.
809
+ Info (InfoRecog, 2 , " Backtrack to the last safe node. " );
797
810
return MANDARIN_CRISIS;
798
811
fi ;
812
+ Info (InfoRecog, 2 ,
813
+ " Handle the mandarin crisis at depth=" , depth, " ." );
799
814
# We are the first safe node on the way to the root and thus need to
800
815
# handle the crisis ourselves.
801
- enlargeKernelSuccess :=
802
- TryToEnlargeKernelGeneratingSetAndUpdateSLPsDuringMandarinCrisis(ri);
803
- if not enlargeKernelSuccess then
816
+ if not TryToEnlargeKernelGeneratingSetAndUpdateSLPsDuringMandarinCrisis(ri) then
804
817
# TODO: discard and re-recognise the image.
805
818
ErrorNoReturn(" TODO" );
806
819
fi ;
807
820
# This restarts the loop, since mandarinSuccess is false.
808
821
continue ;
809
- else
810
- mandarinSuccess := true ;
811
822
fi ;
812
- PrintTreePos(" K" ,depthString,H);
813
- SetKernelRecogNode(ri,riker);
814
- SetParentRecogNode(riker,ri);
815
- Info (InfoRecog,2 ," Back from kernel (depth=" ,depth," )." );
816
823
817
824
if not IsReady(riker) then
818
825
# IsReady is not set, thus the whole computation aborts.
@@ -830,12 +837,16 @@ InstallGlobalFunction( RecogniseGeneric,
830
837
fi ;
831
838
fi ;
832
839
for x in kernelMandarins do
833
- if SLPforElement(ri, x) = fail then
840
+ if SLPforElement(riker, x) = fail then
841
+ Info (InfoRecog, 2 , " Enter mandarin crisis." );
834
842
# We handle this in the same way as if recognition of the
835
843
# kernel returned a MANDARIN_CRISIS.
836
844
if not IsSafeForMandarins(ri) then
845
+ Info (InfoRecog, 2 , " Backtrack to the last safe node." );
837
846
return MANDARIN_CRISIS;
838
847
fi ;
848
+ Info (InfoRecog, 2 ,
849
+ " Handle the mandarin crisis at depth=" , depth, " ." );
839
850
if not TryToEnlargeKernelGeneratingSetAndUpdateSLPsDuringMandarinCrisis(ri) then
840
851
# TODO: discard and re-recognise the image.
841
852
ErrorNoReturn(" TODO" );
@@ -844,6 +855,7 @@ InstallGlobalFunction( RecogniseGeneric,
844
855
continue ;
845
856
fi ;
846
857
od ;
858
+ mandarinSuccess := true ;
847
859
until mandarinSuccess and immediateVerificationSuccess;
848
860
849
861
SetNiceGens(ri,Concatenation(pregensfac(ri), NiceGens(riker)));
0 commit comments