AL
boxp:=5;
LL:= llv(l,boxp);
k1:=hhv(h,boxp);
k2:=hhv(h,boxp-1);
k3:=hhv(h,boxp-2);
NH:= valuewhen(1.,h>ref(k1,-1),h);
box1:=k3<k2;
TopBox:= valuewhen(1.,barssince(h>ref(k1,-1))=boxp-2 and box1, NH);
BottomBox:= valuewhen(1.,barssince(h>ref(k1,-1))=boxp-2 and box1, LL);
CROSS(C,TopBox)
SAT
boxp:=5;
LL:= llv(l,boxp);
k1:=hhv(h,boxp);
k2:=hhv(h,boxp-1);
k3:=hhv(h,boxp-2);
NH:= valuewhen(1.,h>ref(k1,-1),h);
box1:=k3<k2;
TopBox:= valuewhen(1.,barssince(h>ref(k1,-1))=boxp-2 and box1, NH);
BottomBox:= valuewhen(1.,barssince(h>ref(k1,-1))=boxp-2 and box1, LL);
CROSS(C,TopBox)