Frame agreement

Frame agreement is a conformability rule which describes the conditions that must be satisfied by the frames of arguments to dyadic functions with rank (either derived and/or, when supported, native). The frames must either be identical, or one must be empty, or, more generally, when supported, one frame must be a prefix of the other.

Empty frame agreement
In SHARP APL and Dyalog, frames agree only if they match, or if one frame is empty. The latter case corresponds to pairing one argument in its entirety with each of the cells of the other argument.

Frame prefix agreement
In A+, BQN, and J, frames agree if one is a prefix of the other. In J, because every function has associated ranks, frame agreement generalizes leading axis agreement.

Description
A dyadic function with left and right ranks l and r splits its left argument into l-cells, and splits its right argument into r-cells. Each argument's shape is thus split into a frame and a cell shape. Given that one frame must be a prefix of the other, the shorter frame is called the common frame, which may be empty. Here, the generic term "cells" will denote the l-cells (for the left argument) or r-cells (for the right argument). If the frames are identical, the cells are paired 1-to-1 between the arguments. If the frame lengths differ, each cell of the shorter-framed argument is paired with each among the corresponding group of cells of the longer-framed argument. This 1-to-n pairing can be viewed as extending the shorter frame to match the longer frame. The collective results of the individual applications of the function are framed by the longer frame.

Examples
The table below shows the pairing of cells from the above example. Here, the notation  denotes the cell shape, and   denotes the division between the common frame and the remaining trailing axes.

The same example, but without considering cell shape:

Based on the ranks  of the given function,  's frame is   and its cell shape is empty; y's frame is   and its cell shape is. The shorter of the frames, and thus the common frame, is. Relative to the common frame, each atom of  is paired with the corresponding 3 vectors of.

The expanded example below uses APL to model frame prefix agreement.

Model
In dialects that do not feature frame prefix agreement, it can nevertheless be utilised by the introduction of an explicit operator:

The  line of   addresses various asymmetries in computing cell rank. The table below shows the cell ranks corresponding to pairs of operand and argument ranks.

The next table demonstrates the relations (in tacit code) among the operand ranks and corresponding argument ranks, given what the cell rank should be.