a, Schematic of the visual only task (vis-only) in which the associations between cue identity and rewarded cue position were the same as in the instrumental (loc + vis task, Fig. 1), but the mouse angular velocity was decoupled from movement of the visual cue. Cue direction and velocity on each trial were yoked to congruent and incongruent trials performed by separate mice (see Methods). b, Average lick indices on rewarded (blue) and unrewarded (red) trials for each training day for one example mouse showing successful discrimination of cue-direction associations after learning (n = 88, 92, 91, 69, 89, 91, 92, 89, 95 rewarded trials on days 1-9, respectively; n = 38, 39, 35, 26, 39, 39, 40, 38, 38 unrewarded trials on days 1-9, respectively.) c, Average lick indices across trials and days for rewarded (blue) and unrewarded (red) trials across mice. t 3 = 72.50, p = 5.78 × 10−6, n = 4 mice, two-sided paired t-test on the effect of trial type on lick index. d, Top, average congruence-signed cue angular velocity (+congruent, −incongruent) aligned to cue onset on congruent (green) and incongruent (purple) trials, split into thirds by cue velocity magnitude for one example mouse. Bottom, same as top but with congruence signed relative to the angular mouse locomotion velocity at cue onset based on cue-direction contingencies in the loc + vis instrumental task. e, Same as d but for mouse angular velocity. Note the decoupling of cue and mouse velocity. f, Average cue aligned ΔF/F for an example recording site on congruent (green) and incongruent (purple) trials based on the cue (top) or mouse (bottom) congruence-signed angular velocity, split into thirds by magnitude, as in d and e respectively. g, Top, Trajectory error coefficients aligned to cue onset based on the congruence-signed angular cue (blue) and locomotion (green) velocity averaged across sites and mice with a linear mixed effects model. Bottom, Violin plot of the maximum visual and locomotion based TE coefficients (t-stats) for all fibers and mice t 230 = −8.93, p = 1.4 × 10−16, n = 116 sites, 4 mice, two-sided t-test on main effect of TE type in a linear mixed effects model. h, Top, trajectory error coefficients aligned to cue onset based on congruence-signed angular velocity of the cue in the vis-only task (blue) and the loc + vis task (orange) averaged across sites and mice with a linear mixed effects model. Bottom, violin plot of the maximum TE coefficients (t-stats) for all sites and mice. t 230 = −0.001, p = 0.999, two-sided t-test on main effect of task type in a linear mixed effects model, n = 116 sites, 4 mice. i, Schematic of the locomotion only task (loc-only) in which task rules were the same as loc+vis but the visual cue remained stationary at the centre of the screens. j, Average reward rates in the loc-only (pink) and loc + vis tasks (orange), for sessions above criterion. Mouse 1: X2 = 1.36, p = 0.49, n = 762 and 535 trials for loc+vis and loc-only, respectively; mouse 2: X2 = 2.64, p = 0.21, n = 792 and 786 trials for loc+vis and loc-only, respectively; Chi-squared test for comparing two proportions, p-values bonferroni corrected for 2 mice. k, Histogram of times to reward for each task. l, Average congruence-signed mouse angular velocity (left) and ΔF/F for a representative fiber (right) aligned to cue onset for congruent (green) and incongruent (purple) trials, split into thirds by magnitude, during the loc-only task. m, Trajectory error coefficients for the loc-only (pink) and loc + vis tasks (orange) averaged across fibers and mice (n = 79 sites, 2 mice). n, Violin plot of the max loc-only (pink) and loc + vis (orange) TE coefficients for all fibers and mice. t 156 = 1.70, p = 0.093, two-sided t-test on main effect of task type in a linear mixed-effects model, n = 79 sites, 2 mice. Shaded regions and error bars in all plots are 95% confidence intervals. Thin lines in all plots are averages for individual mice. For the boxplots in g,h,n, the centre point is the median, the lower and upper bounds are the first and third quartiles, and the whiskers extend from the box bounds to the most extreme value no further than 1.5 x interquartile range from the bounds.