Cognitive experience alters cortical involvement in navigation decisions

The neural correlates of decision-making have been investigated extensively, and recent work aims to identify under what conditions cortex is actually necessary for making accurate decisions. We discovered that mice with distinct cognitive experiences, beyond sensory and motor learning, use different cortical areas and neural activity patterns to solve the same task, revealing past learning as a critical determinant of whether cortex is necessary for decision-making. We used optogenetics and calcium imaging to study the necessity and neural activity of multiple cortical areas in mice with different training histories. Posterior parietal cortex and retrosplenial cortex were mostly dispensable for accurate decision-making in mice performing a simple navigation-based decision task. In contrast, these areas were essential for the same simple task when mice were previously trained on complex tasks with delay periods or association switches. Multi-area calcium imaging showed that, in mice with complex-task experience, single-neuron activity had higher selectivity and neuron-neuron correlations were weaker, leading to codes with higher task information. Therefore, past experience sets the landscape for how future tasks are solved by the brain and is a key factor in determining whether cortical areas have a causal role in decision-making.


20
Correlations between neural activity and decision-making have been studied extensively in the 21 mammalian cortex, but the factors that determine whether cortical areas are actually necessary for 22 decision tasks are not fully understood (Gold & Shadlen, 2007;Hanks et al., 2006;Katz et al., 2016;23 Salzman et al., 1990). Across studies, the necessity of cortical areas has been tested during a variety of 24 decision-making tasks that involve different sensory, behavioral, and cognitive features (Ceballo et al.,25 2019; Erlich et al., 2011;Fischer et al., 2020;Goard et al., 2016;Guo et al., 2014;Harvey et al., 2012;26 Inagaki et al., 2018;Licata et al., 2017;Raposo et al., 2014;Yang & Zador, 2012;Zhou & Freedman, 2019;27 Znamenskiy & Zador, 2013). Collectively, these studies have formed proposals on the types of decisions 28 for which specific cortical areas are essential. For example, in rodents, posterior parietal cortex (PPC) is 29 necessary for visual, but not auditory, discrimination tasks (Licata et al., 2017) and is considered to be 30 especially involved in tasks that have a short-term memory component, such as a delay period between 31 sensory cues and choice reports, or a requirement for evidence accumulation over time (Lyamzin & 32 Benucci, 2019). As another example, area LIP in monkeys is thought to be essential for sensory but not 33 motor aspects of visual motion discrimination tasks (Zhou & Freedman, 2019). Notably, these studies have 34 focused on how specific features of a task-of-interest determine which cortical areas are causally involved. 35 However, in addition to the task-of-interest in a study, individual animals have learned a variety of 36 associations throughout their lifetime and may have performed a diversity of tasks previously, often with 37 different experiences between individuals. Although it is intuitive that past learning, beyond the demands 38 of the task-of-interest, may impact how individuals make decisions, most studies of decision-making have 39 not investigated the effect of past learning on the involvement of cortex. It therefore is not well 40 understood how learning of previous tasks affects the necessity of cortical activity for decision-making. 41 Two previous studies investigated this topic in the sensory domain, comparing the involvement of visual 42 area MT in depth and motion perception in monkeys with different perceptual experience (Chowdhury & 43 DeAngelis, 2008;Liu & Pack, 2017). For coarse depth discrimination, MT was only necessary in monkeys 44 that had no prior experience in fine depth discrimination tasks (Chowdhury & DeAngelis, 2008), showing 45 a decrease in cortical involvement with additional experience. In contrast, for motion discrimination, 46 previous training on moving dot stimuli rendered MT necessary for discriminating the motion of gratings 47 (Liu & Pack, 2017), showing that sensory experience can also increase cortical involvement. Relatedly, 48 studies of motor learning have shown that cortex is essential during the learning process but becomes 49 dispensable after learning is completed (Hwang et al., 2019;Kawai et al., 2015). In these cases, the 50 animal's prior training was largely based on sensory or motor experience. However, studies have not 51 investigated the impact of "cognitive experience", which we broadly define as learning that extends 52 beyond sensory or motor learning and includes learning of task rules and associations. 53 Here, we developed a paradigm to study the effects of previous task learning on the necessity and activity 54 patterns of cortical areas. Mice performed a simple decision-making task in virtual reality, and we 55 compared different groups of mice that either had or had not been previously trained on complex 56 decision-making tasks. We used optogenetics and calcium imaging to measure the necessity and neural 57 activity patterns of cortical areas during this simple task. Critically, we kept the sensory and movement 58 aspects of the complex and simple tasks as identical as possible to test the effect of "cognitive experience" 59 instead of perceptual or motor learning. We focused on areas of cortex that are thought to be critical for 60 decision-making during navigation, including PPC, which converts sensory cues into motor plans 61 (Freedman & Ibos, 2018), and retrosplenial cortex (RSC), which is critical for planning navigation 62 trajectories (Alexander & Nitz, 2015). 63 We discovered that mice with different previous task experience used distinct sets of brain areas to solve 64 the same simple task. During the simple decision task, mice without prior training on complex decision 65 tasks performed well above chance levels when RSC or PPC was inhibited. In contrast, during the same 66 simple task, mice with prior complex task training performed close to chance levels when these areas 67 were inhibited. In addition, calcium imaging revealed that prior complex task experience resulted in 68 increased selectivity of neural activity patterns for task-relevant variables and decreased correlations in 69 neural activity during the simple task. Thus, individuals with distinct cognitive experience make outwardly 70 identical decisions using different combinations of brain areas and neural activity patterns. We suggest 71 that, because neural circuits are optimized for a wide range of computations beyond the ones required 72 by a current task-of-interest, a global set of constraints and optimizations can dramatically impact the 73 cortical areas that are necessary for decisions. 74

75
Increased necessity of cortical association areas in complex versus simple decision tasks 76 We developed a paradigm in which head-restrained mice running on a spherical treadmill were trained to 77 use visual cues to make navigation decisions in a virtual reality Y-maze ( Figure 1A-B). We used this 78 paradigm to create a "simple task" and two "complex tasks". In the simple task, mice learned to associate 79 visual cues -horizontal and vertical bars -with left and right turns, respectively, to obtain rewards. In this 80 task, the visual cue was present throughout the entire Y-maze, and the rewarded cue-choice associations 81 (e.g., horizontal bars-left choice) did not change ( Figure 1C). 82 The complex tasks were designed based on the same Y-maze concept and used the identical horizontal 83 and vertical bars as visual cues. In the "delay task", the visual cues were only present at the beginning of 84 the maze, followed by a neutral visual pattern on the walls for the remainder of the maze ( Figure 1E). This 85 neutral pattern was identical across trials and did not provide information about the reward location. This 86 design was based on the commonly used approach of inserting a delay period between the sensory cues 87 and choice reports and has been used previously in navigation decision tasks (Driscoll et al., 2017;Harvey 88 et al., 2012). In the "switching task", the rewarded relationships between the visual cues and left-right 89 choices were switched across blocks within a single session, resulting in two rules (Rules A and B) ( Figure  90 1G). The same visual cue was thus associated with left choices in one rule block and right choices in the 91 other rule block. The current rule and rule switch were not explicitly signaled, so the mouse learned rule 92 switches by trial and error and stored a belief of the current rule in memory. Therefore, after rule switches, 93 a mouse's performance dropped and then recovered to high and stable levels after tens of trials ( Figure  94 1G). For one of the two rules (Rule A), the trials were the same as in the simple task, including the same 95 cues and rewarded choices. In fact, the software code used to create the virtual environments was 96 identical between the simple task and Rule A of the switching task. Across both the simple and complex 97 tasks, the mice experienced the same choice-informative sensory cues and had to run through similar or 98  (S1), 18 ± 9 (RSC), 20 ± 9 (PPC), mean ± SD. (E) Similar to (C), but for the delay task. (F) Similar to (D), but for the delay task. 62 sessions from 7 mice. S1 p = 0.006; RSC p < 0.001; PPC p < 0.001.
Sessions per mouse: 9 ± 4. Trials per session: 60 ± 15 (control), 16 ± 6 (S1), 15 ± 4 (RSC), 17 ± 5 (PPC), mean ± SD. (G) Left: Schematic of the switching task, utilizing the identical mazes as the simple task. The cue-choice associations from the simple task (Rule A) were switched within a session (to Rule B). Right: Behavioral performance from an example session. Dotted orange lines indicate rule switches. (H) Similar to (D), but for the switching task, Rule A trials only. 89 sessions from 6 mice. S1 p = 0.036; RSC p < 0.001; PPC p < 0.001. Sessions per mouse: 15 ± 5. Trials per session: 26 ± 9 (control), 8 ± 3 (S1), 7 ± 4 (RSC), 8 ± 3 (PPC), mean ± SD. (I) Comparison of inhibition effects (ΔFraction Correct) in the simple and the delay tasks for each cortical inhibition location. Bars indicate mean ± sem of a bootstrap distribution of the mean; two-tailed comparisons of bootstrapped ΔFraction Correct distributions, α = 0.05. Same datasets as in (F, G). (J) Similar to (I), but for the simple vs. switching task (Rule A trials only). Same datasets as in (F, H). (K) Left: Comparison of performance on control trials across tasks, using only the first two laser-on blocks in each session. Bars indicate mean ± sem of a bootstrap distribution of the mean. Delay vs. simple p < 0.001; switching vs. simple p < 0.001; two-tailed comparisons of bootstrapped Fraction Correct distributions, α = 0.05. Right: Number of training sessions needed to reach performance criteria across tasks (Methods). Bars indicate mean ± sem across mice, n = 4 for simple task, n = 5 for delay task, n = 6 for switching task. Both delay and switching task data were compared to the simple task data using an unpaired two-sided t-test. Delay vs. simple p = 0.04; switching vs. simple p = 0.006.
identical mazes to report their choices. Thus, the key difference between the simple and complex tasks 99 was due to "cognitive" complexity through the addition of a delay period or frequent switches in the 100 associations, rather than differences in the sensory cues informing choices or differences in motor output. 101 We tested the necessity of various cortical areas during the simple and complex tasks using optogenetics 102 to activate GABAergic interneurons, which leads to silencing of nearby excitatory neurons (Guo et al., 103 2014;Li et al., 2019;Minderer et al., 2019). Channelrhodopsin-2 (ChR2) was expressed in inhibitory 104 interneurons in transgenic mice and photostimulated using a clear-skull preparation with a two-105 dimensional laser scanning system ( Figure 1B). We focused inhibition on two cortical association areas 106 previously linked to decision-making and navigation, PPC and RSC (Driscoll et al., 2017;Fischer et al., 2020;107 Harvey et al., 2012). To match each area's anatomical extent, we used three inhibition spots in each 108 hemisphere for RSC and one spot per hemisphere for PPC. As a control, we inhibited a spot in primary 109 somatosensory cortex (S1), an area not implicated in visual decision-making ( Figure 1B). Inhibition trials 110 were interleaved with control trials in which the laser spot was positioned outside the mouse's brain. On 111 inhibition trials, photostimulation was applied bilaterally and throughout the duration of the mouse's 112 maze traversal. 113 We first considered inhibition effects on performance of the simple task in mice that had only been trained 114 in the simple task ( Figure 1D). Silencing S1 did not affect performance, and inhibition of PPC resulted in a 115 very small performance decrease, with mean performance of 90 ± 2% correct (mean ± SEM). Inhibition of 116 RSC had the largest effect, resulting in intermediate performance levels of 77 ± 3% correct. However, mice 117 still performed well above chance (50% correct). To assess whether the effect of RSC inhibition was 118 specific to the cognitive requirements of the simple task or related to lower-level processes required for 119 task performance such as vision, movement, and basic navigation, we silenced the same areas in an even 120 simpler task in which mice ran towards a visual target present on either side of the maze end to obtain 121 rewards (Harvey et al., 2012). Effects on performance were similar in this run-to-target task, suggesting 122 that RSC inhibition in the simple task may impair lower-level processes such as basic navigation instead of 123 decision-making based on cue-choice associations (Figure 1-figure supplement 1). Together, these 124 results indicate that the cortical areas we silenced were only modestly involved in the decision in the 125 simple task. 126 We next considered the effects of inhibition on mice performing the delay task or the switching task 127 (Figure 1,E,F,G,H). In the switching task, we silenced cortical areas during the periods of high performance 128 after accuracy had recovered following a rule switch ( Figure 1G). S1 inhibition during the complex tasks 129 caused a modest decrease in performance, but mice still performed the tasks at high levels ( Figure 1F, H). 130 In contrast, inhibition of PPC or RSC greatly impaired performance in the delay and switching tasks and 131 resulted in performance of 55 ± 3% correct, which is close to chance levels. With PPC and RSC inhibition, 132 many mice exhibited biases in the choices they made, whereas others appeared to choose randomly 133 between left and right ( Figure 1 -figure supplement 2). The effects of inhibiting PPC and RSC were 134 markedly larger in the delay and switching tasks than in the simple task ( Figure 1I-J). Therefore, adding a 135 delay epoch to the trial or frequent association switches across trials increased the necessity of cortex 136 relative to the simple task. 137 We also asked whether the increased cortical necessity was especially apparent in the task period that 138 was changed compared to the simple task. In the delay task, we thus restricted photoinhibition to the cue 139 or the delay segment of the trial (Figure 1-figure supplement 3). Inhibition of PPC or RSC in both trial 140 segments decreased performance to a greater degree than in the simple task, indicating that PPC and RSC 141 are necessary for multiple epochs of the task. In the switching task, the main difference relative to the 142 simple task is the introduction of association switches, so activity in PPC and RSC may be necessary for 143 storing or updating the rule. Taking advantage of interleaved control and inhibition trials, we found that 144 the effects of inhibition were restricted to the current trial, as inhibition did not affect subsequent control 145 trials (Figure 1-figure supplement 4). We also looked for a role in updating the rule, which is likely critical 146 following the completion of a trial, in particular after a rule switch. We focused on PPC as a candidate for 147 updating the rule because PPC has sensory-and choice-related history signals (Akrami et al., 2018;Morcos 148 & Harvey, 2016). We silenced PPC during the inter-trial interval on every trial following a rule switch, for 149 50 consecutive trials. However, PPC inhibition did not affect the recovery of performance after a rule 150 switch ( Figure 1-figure supplement 4). Together, these results suggest that the large inhibition effects 151 during the switching task are not due to impaired storing or updating of the rule. Thus, the increased 152 necessity of PPC and RSC during the delay and switching tasks did not appear to be specific to the added 153 task components. 154 Overall, our results indicate that more complex tasks require cortical activity, specifically in PPC and RSC, 155 to a larger extent than a simple task. We verified that the complex tasks were indeed more challenging 156 for mice. Relative to the simple task, it took mice longer to become experts at the delay and switching 157 tasks (see Methods), and their performance on control trials was lower ( Figure 1K). These findings are 158 consistent with, and extend, previous work that concluded cortical necessity increases with task 159 complexity (Harvey et al., 2012;Pinto et al., 2019). 160 The necessity of PPC and RSC depends on a mouse's previous cognitive experience 161 This set of tasks provided a platform for testing the effects of prior learning on cortical necessity for 162 decision-making in the simple task, by comparing groups of mice with or without previous training on the 163 complex tasks. A first group of mice was only trained on the simple task. The second group was first trained 164 on one of the complex tasks and then transitioned to the simple task for 14 consecutive sessions (one 165 session per day), without experiencing the complex task again. Different cohorts of mice were transitioned 166 to the simple task from the switching task and delay task. This design allowed us to compare different 167 mice performing the same task (the simple task) but with distinct training histories. 168 We first considered the mice that were trained to be experts on the delay task and then transitioned to 169 the simple task ( Figure 2A). In these mice, inhibition of PPC and RSC during the simple task greatly 170 impaired behavioral performance to mean levels of 67 ± 3% and 62 ± 2% correct (mean ± SEM), 171 respectively ( Figure 2B-C). Thus, these mice needed PPC and RSC activity to perform at high levels on the 172 simple task. These results were strikingly different from the inhibition effects in mice trained only on the 173 simple task. Without complex-task experience, mice performed at 90 ± 2% and 77 ± 3% correct with PPC 174 or RSC inhibited ( Figure 2C), respectively, indicating they did not strongly rely on PPC or RSC activity for 175 task performance. The larger effect of PPC and RSC inhibition due to previous delay task experience was 176

Fraction Correct
(Simple Task) S im p le E x p e r ie n c e W e e k 1 , D e la y E x p e r ie n c e W e e k 2 , D e la y E x p e r ie n c e   Figure 2. Delay task experience increases the necessity of RSC and PPC in a simple decision task (A) Schematic of the training history sequence. One group of mice was trained on the delay task and then permanently transitioned to the simple task. This group of mice was compared to another group trained only on the simple task. (B) Performance of an example mouse transitioned from the delay task to the simple task on control and inhibition trials. (C) Performance in the simple task for each inhibited location in mice with simple task experience only (gray, 45 sessions from 4 mice, same dataset as in Figure 1F), and in mice with previous delay task experience (blue, 70 sessions from 5 mice). Bars indicate mean ± sem of a bootstrap distribution of the mean. S1 p = 0.012; RSC p < 0.001; PPC p < 0.001; from bootstrapped distributions of ΔFraction Correct (difference from control performance) compared to 0, two-tailed test, α = 0.05 plus Bonferroni correction. Sessions per mouse: 14. Trials per session: 53 ± 7 (control), 13 ± 3 (S1), 13 ± 2 (RSC), 14 ± 2 (PPC), mean ± SD. (D) Inhibition effects (ΔFraction Correct) across sessions in the simple task in mice with only simple task experience (gray), and in mice with previous delay task experience (blue), for each cortical inhibition location. Thin lines show individual mice (n = 4 with simple task experience, n = 5 with delay task experience), thick lines show average across mice. ΔFraction Correct was smoothed with a moving average filter of 3 sessions. (E) Comparison of inhibition effects (ΔFraction Correct) in the simple task for mice with simple task experience only (45 sessions from 4 mice) versus delay task experience 1 or 2 weeks after transition from the delay task to the simple task (35 sessions per week from 5 mice). Bars indicate mean ± sem of a bootstrap distribution of the mean; two-tailed comparisons of bootstrapped ΔFraction Correct distributions, α = 0.05. Simple experience datasets are the same as in Figures 1F and Figure 2C. (F) Comparison of performance on control trials in the simple task with simple versus delay task experience, using only the first two laser-on blocks in each session. Bars indicate mean ± sem of a bootstrap distribution of the mean. Simple task data in week 1 (p = 0.59) and week 2 (p = 0.19) after transition from the delay task were compared to the simple task only experience data; two-tailed comparisons of bootstrapped Fraction Correct distributions, α = 0.05. Trials per session: 51 ± 23 (simple experience), 51 ± 6 (delay experience, week 1), 53 ± 3 (delay experience, week 2), mean ± SD.
not only apparent immediately after the transition to the simple task but persisted for the full two weeks 177 that we investigated ( Figure 2D-E). Therefore, the effect of PPC and RSC inhibition had markedly larger 178 effects in the simple task when mice had previous training in the delay task, both in the first and second 179 week after the task transition. This persistent difference is particularly surprising because the task 180 transition should be immediately apparent to mice due to the lack of a delay period in each trial. Indeed, 181 performance on control trials in the simple task was as high in mice with delay task experience as in mice 182 with simple task experience only, indicating that subjective task difficulty did not differ depending on 183 training history ( Figure 2F). Also, inhibition of S1 had little effect on performance in the simple task both 184 with and without previous delay task training. Therefore, mice with distinct previous task experience 185 require different cortical areas to perform the same task. 186 We reached a similar conclusion when we compared mice performing the simple task with and without 187 previous training on the switching task ( Figure 3A). In mice that had previously been experts on the 188 switching task, PPC and RSC inhibition resulted in performance of 67 ± 3% and 61 ± 3% correct (mean ± 189 SEM), respectively, on the simple task ( Figure 3B-C). As for previous training on the delay task, this effect 190 of PPC and RSC inhibition during the simple task was markedly larger than when these areas were inhibited 191 in mice without previous training on the switching task ( Figure 3D-E). PPC activity was necessary even two 192 weeks after the transition to the simple task. RSC's involvement was greatest in the first week after the 193 transition. Therefore, mice with previous experience in the switching task require PPC and RSC activity to 194 perform the simple task, whereas these areas are largely dispensable during performance of the same 195 simple task in mice without this previous training. 196 We wondered if the mice transitioned from the switching task to the simple task might continue to behave 197 as if they were in the dynamic context of the switching task. However, it appeared that mice adapted 198 behaviorally to the simple task quickly after the transition. First, performance on control trials improved 199 to levels observed in mice without previous training on the switching task ( Figure 3F). Also, in the 200 switching task, performance at the start of sessions was only at intermediate levels as mice determined 201 the current rule (Figure 3-figure supplement 1). In contrast, after a few days in the simple task, 202 performance was near perfect even in the first tens of trials within a session. Interestingly, when 203 presented with the opposite rule from the switching task again after two weeks on the simple task, mice 204 could still switch back to the long unseen rule within a single session (Figure 3-figure supplement 1). 205 Thus, although mice appeared to retain an understanding of potential association switches, their behavior 206 did not reflect such expectations soon after they were transitioned to the simple task. 207 We also assessed whether the persistent increase of cortical necessity due to complex-task experience 208 extended to the run-to-target task. Notably, inhibition of PPC and RSC during the run-to-target task 209 resulted in similarly minor performance drops in groups of mice with and without prior complex-task 210 experience (Figure 3-figure supplement 2). Thus, previous experience did not make cortex essential for 211 all tasks. 212 Collectively, these results highlight that the cortical areas used to perform a task can be profoundly shaped 213 by experience from weeks ago. Mice with different previous task experience use distinct sets of cortical 214

Figure 3. Switching task experience increases the necessity of RSC and PPC in a simple decision task (A)
Schematic of the training history sequence. One group of mice was trained on the switching task and then permanently transitioned to the simple task. This group of mice was compared to another group trained only on the simple task. (B) Performance of an example mouse transitioned from the switching task to the simple task on control and inhibition trials. (C) Performance in the simple task for each inhibited location in mice with simple task experience only (gray, 45 sessions from 4 mice, same dataset as in Figure 1F), and in mice with previous switching task experience (red, 69 sessions from 5 mice). Bars indicate mean ± sem of a bootstrap distribution of the mean. S1 p = 0.26; RSC p < 0.001; PPC p < 0.001; from bootstrapped distributions of ΔFraction Correct (difference from control performance) compared to 0, two-tailed test, α = 0.05 plus Bonferroni correction. Sessions per mouse: 13 ± 0.4. Trials per session: 55 ± 11 (control), 14 ± 4 (S1), 13 ± 4 (RSC), 15 ± 4 (PPC), mean ± SD. (D) Inhibition effects (ΔFraction Correct) across sessions in the simple task in mice with only simple task experience (grey), and in mice with previous switching task experience (red), for each cortical inhibition location. Thin lines show individual mice (n = 4 with simple task experience, n = 5 with switching task experience), thick lines show average across mice. ΔFraction Correct was smoothed with a moving average filter of 3 sessions. (E) Comparison of inhibition effects (ΔFraction Correct) in the simple task for mice with simple task experience only (45 sessions from 4 mice) versus switching task experience 1 (35 sessions from 5 mice) or 2 (34 sessions from 5 mice) weeks after transition from the switching task to the simple task. Bars indicate mean ± sem of a bootstrap distribution of the mean; two-tailed comparisons of bootstrapped ΔFraction Correct distributions, α = 0.05. Same datasets as in Figures 1F and Figure 3C. (F) Comparison of performance on control trials in the simple task with simple versus switching task experience using only the first two laser-on blocks in each session. Bars indicate mean ± sem of a bootstrap distribution of the mean. Simple task data in week 1 (p = 0.32) and week 2 (p = 0.81) after transition from the switching task were compared to the simple task only experience data; two-tailed comparisons of bootstrapped Fraction Correct distributions, α = 0.05. Trials per session: 51 ± 23 (simple experience), 51 ± 5 (switching experience, week 1), 50 ± 7 (switching experience, week 2), mean ± SD.
areas to solve the same task. Therefore, an understanding of which areas of cortex are necessary for 215 decision tasks requires considering both the demands of the task-of-interest and the previous experiences 216 of the individual. 217 PPC and RSC neurons have activity patterns with higher selectivity in the switching task 218 Given that the necessity of cortical areas was modulated by previous training, we next asked if the neural 219 activity patterns in these areas are also affected. One possibility is that the increased necessity of cortical 220 areas as a result of previous learning is due to changes in the neural activity patterns within the area. 221 Alternatively, previous learning might not affect a cortical area's activity, and instead the change in a 222 cortical area's necessity could be due solely to how its activity is read out by downstream areas 223 (Chowdhury & DeAngelis, 2008;Liu & Pack, 2017). 224 We simultaneously measured the activity of neurons in PPC, RSC, and V1 with two-photon calcium imaging 225 using a large field-of-view, random-access microscope (Sofroniew et al., 2016) ( Figure 4A-C). This 226 microscope allowed us to simultaneously image hundreds of neurons in each of these three cortical areas, 227 with single-cell resolution. We focused our imaging on PPC and RSC because these areas showed major 228 differences in necessity for decisions depending on previous experience. We also included V1 because it 229 is densely interconnected with PPC and RSC  and is likely necessary for visual navigation 230 tasks, at least for visual processing (Resulaj et al., 2018). We restricted our imaging experiments to the 231 simple task and the switching task, given that they contain the identical virtual environments. 232 We first imaged neural activity in separate sets of mice in the simple task and switching task ( Figure 4D). 233 To compare identical trial types across tasks, that is trials with the same cue-choice associations, we 234 compared neural activity in mice performing the simple task to activity specifically in Rule A of mice 235 performing the switching task. In the switching task, we only included trials once performance had 236 recovered to high levels after rule switches. We started by looking at a basic measure of neural activity, 237 the overall level of activity in individual neurons. Interestingly, this basic measure revealed differences 238 across tasks, as neurons in RSC and PPC had higher activity in the switching task than in the simple task 239 ( Figure 4D). 240 Next, we considered that a direct way a cortical area may contribute to a decision task is by having activity 241 that is different for the two trial types containing distinct cue-choice associations. Trial-type selectivity is 242 a common measure for neural correlates of decision-related functions because it would allow a 243 downstream area to read out the identity of the association and to execute the appropriate choice. We 244 measured this selectivity as our ability to identify the trial type based on a neuron's activity and quantified 245 it as the area under the receiver operating characteristics curve (auROC, Figure 4E). PPC and RSC neurons 246 showed higher average levels of trial-type selectivity in the switching task than in the simple task ( Figure  247 4F). At the level of populations of neurons, the trial-type selectivity was structured as sequences of neural 248 activity, in which individual neurons were transiently active and different neurons were active at different 249 locations along the maze (Figure 4-figure supplement 1). In addition, the fraction of RSC or PPC neurons 250 with significant trial-type selectivity was higher in the switching task than in the simple task ( Figure 4G). 251     (gray) was generated by randomly assigning left/right trial labels to each trial and recomputing auROC 100 times. Trial-type selectivity was defined as an absolute deviation of auROC from chance level (2*|auROC-0.5|).
To determine significance of trial-type selectivity, at each bin, this value was compared to the trial-type selectivity of the shuffle distribution (gray, significance threshold of p < 0.01). (F) Similar to (D), except for the metric of trial-type selectivity, i.e. 2*|auROC-0.5|. (G) Similar to (D), except for the fraction of trial-type selective cells as determined from comparing each cell's selectivity value to a distribution with shuffled trial labels (significance threshold of p < 0.01). (H) In each area, trial-type decoding accuracy using activity of subsampled neurons is compared in the simple versus the switching task (Rule A trials only). Shading indicates mean ± sem across sessions. p value is for the task factor from a two-way ANOVA (factors: task and neuron number).
We next assessed how well the current trial type could be decoded from the activity of neural populations 252 of varying sizes in each area. In the simple task, RSC and PPC populations contained task-relevant 253 information that led to above-chance decoding from a population of neurons. However, for the same size 254 population in the switching task, this decoding accuracy in RSC and PPC was even higher, in line with the 255 observed increased selectivity and larger fraction of selective neurons relative to the simple task ( Figure  256 4H). These differences in activity across tasks in RSC and PPC were especially striking because, in the 257 simple task and Rule A of the switching task, mice ran through a maze with identical visual cues and made 258 similar left-right behavioral choices in both tasks. Therefore, the activity levels and selectivity of single 259 neurons are higher in PPC and RSC when mice perform a more complex task, even when the sensory 260 stimuli and choice reports in the tasks are identical, leading to better ability to decode the trial type. 261 We verified that the differences in selectivity across tasks were not due to differences in running patterns. 262 When we selected sessions so that the time course and magnitude of decoding the mouse's reported 263 choice from its running were similar across tasks, we largely observed the same differences in neural trial-264 type selectivity as reported above (Figure 4-figure supplement 2). Thus, the differences in neural 265 selectivity cannot be trivially explained by differences in running patterns. 266 In contrast, V1 neurons had similar levels of activity, selectivity, and population-level trial-type decoding 267 in the simple and switching tasks ( Figure 4D-H). This finding is consistent with the identical visual scene in 268 these tasks but is perhaps surprising given that V1 neurons have been shown to contain many non-visual 269 signals (Koay et al., 2020). 270

Previous switching task experience increases neural trial-type selectivity in PPC and RSC 271
We then examined if previous experience in the switching task affected the neural activity patterns in the 272 simple task. Similar to our tests of cortical necessity, we compared neural activity during the simple task 273 in mice that either had or had not been trained previously in the switching task ( Figure 5A). We trained 274 one group of mice on the switching task and then permanently transitioned these mice to the simple task. 275 A separate set of mice was trained only on the simple task. We thus compared the activity patterns in 276 PPC, RSC, and V1 in mice performing decisions in the same task except with distinct experience. 277 Strikingly, during the simple task, neurons in RSC and PPC had higher activity in mice with experience in 278 the switching task than in mice trained only in the simple task ( Figure 5B). Furthermore, in mice with 279 switching task experience, RSC and PPC neurons had higher average selectivity for the trial type and higher 280 fractions of neurons with significant trial-type selectivity ( Figure 5C-D). As a result, the decoding of the 281 trial type from population activity was more accurate in these areas in mice with the complex task 282 experience ( Figure 5E). Notably, selectivity in V1 neurons was similar between mice with and without 283 complex task experience. Therefore, the activity patterns of single neurons in PPC and RSC, including mean 284 activity levels and selectivity, are strongly influenced by previous task experience. 285

Switching task experience decreases noise correlations 286
A

Figure 5. Previous switching task experience increases trial-type selectivity in RSC and PPC (A)
Schematic of the training history sequence. One group of mice was trained on the switching task and then permanently transitioned to the simple task. This group of mice was compared to another group trained only on the simple task. (B) In each area, mean activity levels across cells by maze segment are compared in the simple task in mice with (red) and without (gray) previous experience in the switching task. Shading indicates mean ± sem of bootstrapped distributions of the mean. P (segment) shows p values of two-tailed comparisons of bootstrapped distributions per maze segment. P (overall) shows the p value for the previous task experience factor from a two-way ANOVA (factors: previous task experience and maze segment). Simple task: n = 3 mice, 4 sessions per mouse, cells per session by area: RSC: 1438 ± 217, PPC: 456 ± 172, V1: 498 ± 170 (same dataset as in Figure 4D-H). Simple task after switching task experience: n = 2 mice, 3 and 5 sessions per mouse, neurons per session by area: RSC: 1407 ± 327, PPC: 744 ± 219, V1: 351 ± 90 (mean ± SD). (C) Similar to (B), except for the metric of trial-type selectivity, i.e. 2*|auROC-0.5|. (D) Similar to (B), except for the fraction of trial-type selective cells as determined from comparing each cell's selectivity value to a distribution with shuffled trial labels. (E) In each area, trial-type decoding accuracy using activity of subsampled neurons is compared in the simple task in mice with and without previous experience in the switching task. Shading indicates mean ± sem across sessions. p value is for the previous task experience factor from a two-way ANOVA (factors: previous task experience and neuron number).
have been shown to depend on behavioral context, task learning, and other factors (Cohen & Kohn, 2011). 289 We thus examined if features of the neural population code are also affected by task complexity and past 290 experience. We took advantage of the simultaneous recording of hundreds of neurons per area and 291 analyzed the correlation in activity for pairs of neurons on a given trial type, a measure commonly referred 292 to as noise correlation, that quantifies trial-to-trial co-fluctuations in neurons (Cohen & Kohn, 2011). As 293 for analyses of trial-type selectivity, we restricted analyses to the maze traversal period and only included 294 correct trials from high performance periods (see Methods). The noise correlations within individual areas 295 and across pairs of areas were lower on average in mice performing the switching task than in mice 296 performing the simple task ( Figure 6A-C). Strikingly, when we compared mice with different experience 297 as they performed the same simple task, we also observed a difference in noise correlations both within 298 and across cortical areas, with lower correlations in mice with switching task experience compared to 299 mice trained only in the simple task ( Figure 6A-C). Therefore, mice with different task experience have 300 significant differences in their population codes as they perform the same task. 301 Noise correlations can in some cases have detrimental effects on population codes by limiting the 302 information capacity because these correlations are co-fluctuations in activity that cannot be removed by 303 averaging across neurons (Averbeck et al., 2006;Kafashan et al., 2021;Panzeri et al., 1999;Zohary et al., 304 1994). To reveal the impact of correlations on coding in our experiments, we disrupted noise correlations 305 by shuffling trials of a given trial type separately for each neuron and repeated the trial-type decoding. 306 The accuracy of decoding the trial type was slightly higher with correlations disrupted ( Figure 6D). 307 Therefore, the lower correlations in mice performing the switching task or the simple task with switching 308 task experience boosts information encoding along with higher trial-type selectivity levels. 309 Thus, these results reveal that the activity patterns in single neurons and neural populations are shaped 310 by previous experience. Together, our findings demonstrate that different sets of cortical areas and 311 distinct neural activity patterns are utilized for the same task depending on an individual's training history. 312

313
We have shown that the same task, with the same visual cues and behavioral choice reports, is solved 314 using distinct cortical areas and activity patterns depending on the past experience of the individual. Thus, 315 the necessity of cortical areas for a decision task depends on factors separate from the task itself. Here, 316 we aimed to vary the "cognitive experience" of the mouse, which we define as the features of the task 317 other than the choice-informative sensory stimuli and the behavioral outputs. We varied the cognitive 318 experience by adding delay periods or frequent switches of associations within a session, but the maze 319 shape, and thus behavioral outputs needed, and choice-informative cues were identical between the 320 complex and simple tasks. Thus, the differences between mice with and without training on the complex 321 tasks is likely due to cognitive experience instead of sensory or motor learning. Our results reveal that 322 mice with enhanced cognitive experience due to previous training on complex tasks require PPC and RSC 323 to perform simple decision tasks. In contrast, in mice without this previous training, PPC and RSC are 324 largely dispensable for performing the same, simple task. This difference in cortical necessity was 325 accompanied by differences in the activity patterns of single neurons and neural populations. During the 326 same task, mice with complex training experience had higher selectivity in single neurons and weakened 327   Figure 6. Switching task experience decreases noise correlations (A) Schematic of the training history sequence. One group of mice was first trained on the switching task and then permanently transitioned to the simple task. Another group was trained only on the simple task. (B) Mean pairwise noise correlations within and across areas from bootstrapped distributions of the mean in the switching task (left), the simple task with previous switching task experience (middle), and the simple task with only simple task experience (right). Noise correlations were calculated on spatially binned data in correct trials during high performance periods (Methods). (C) Left: Comparison of mean noise correlations in the switching task versus the simple task, p value is for the task factor from a two-way ANOVA (factors: task and area-combination). Error bars indicate mean ± sem across sessions per area combination (n = 6 area combinations, n sessions: 12 (simple task), 12 (switching task)). Right: Similar to left, except for the comparison of simple task noise correlations with and without previous switching task experience. n sessions: 12 (simple experience), 8 (switching experience). (D) For each area and task or previous task experience, the difference in trial-type decoding accuracy between neural populations (200 subsampled neurons) with intact and disrupted noise correlations. Noise correlations were disrupted by shuffling trials independently for each cell within a given trial type. Error bars show mean ± sem across sessions.
neuron-neuron correlations, compared to mice without this history, which together allowed for easier 328 decoding of the relevant information from a population of neurons. Together, these results show that 329 distinct sets of cortical areas can be used to solve the same task. 330 We specifically varied the cognitive experience of mice while keeping the sensory cues and behavioral 331 choice reports the same across decisions, with a focus on cortical association areas. Previous studies of 332 perceptual experience and motor learning have emphasized that cortical necessity decreases with 333 experience (Chowdhury & DeAngelis, 2008;Hwang et al., 2019;Kawai et al., 2015) (but see (Liu & Pack,334 2017)). Instead, we found an increased necessity of cortical association areas for simple decisions due to 335 cognitive experience in two distinct, complex tasks (delay and switching tasks). Future work should aim to 336 understand how differences in the type of experience (cognitive versus perceptual), types of tasks, and 337 areas studied (association versus sensory or motor cortices) influence whether experience increases or 338 decreases cortical necessity. 339 In addition, these earlier works did not identify differences in neural tuning in MT with perceptual 340 experience despite differences in necessity, leading to the proposal that differences in cortical necessity 341 with experience arise from whether an area's activity is read out by a downstream network. Here, we did 342 find differences in neural selectivity specifically in association areas. However, these areas already 343 contained task-relevant information in the simple task without complex task experience. It appears 344 unlikely that the observed boost in neural selectivity with complex task experience is the sole reason for 345 the large increase in cortical necessity for task performance. Increased cortical necessity may rather result 346 from a combination of increases in task information, reshaped representations of information, and/or 347 modifications to information readouts (Ruff & Cohen, 2019). Further work will be needed to test directly 348 the relationship between specific features of the neural code and the causal roles of PPC and RSC in 349 decision tasks. 350 We found that cortical association areas had higher selectivity in their neural activity and were more 351 strongly required for the complex tasks than the simple task. This finding supports the notion that cortex 352 is needed for cognitively more challenging tasks. Previous work presented a similar finding but focused 353 on tasks with a wide gap in their demands, such as comparing running toward a visual target versus using 354 learned cue-choice associations to make navigation decisions (Buschman et al., 2011;Ceballo et al., 2019;355 Fuster, 1997;Harvey et al., 2012;Lashley, 1931;Pinto et al., 2019;Sarma et al., 2015). In our work, we 356 extended this concept by keeping the visual and behavioral aspects of the complex and simple tasks as 357 similar as possible and adding specific cognitive challenges. Our goal here was not to compare the specific 358 features of the different tasks, and instead we used the complex tasks to establish different previous 359 experiences. Future work will be needed to compare in more depth the neural activity in the different 360 tasks and to understand how PPC and RSC might contribute to the switching and delay tasks. 361 Our results have crucial implications for the experimental study of cortical involvement in decision-362 making. Many studies, including our previous work, test an area's involvement or activity patterns in a 363 single task and develop interpretations of an area's functions by extrapolating across studies (Lyamzin & 364 Benucci, 2019). However, given that factors beyond the task-of-interest contribute to an area's necessity 365 and activity in a task, we encourage consideration of a variety of factors that have often been ignored and 366 not reported. Because prior task expertise can have a large effect on the involvement of cortical areas, it 367 seems critical to report the full details of how animals were trained on a task and what previous 368 experiences they encountered, both of which are commonly omitted from publications. 369 Together, our results indicate that the cortical implementation of a decision task flexibly depends on initial 370 conditions, as defined by past experience, and the overall optimization goal for the animal, which in many 371 cases is not just a single task but also previous tasks or other tasks occurring in parallel (Golub et al., 2018;372 Sadtler et al., 2014). These results highlight the tremendous flexibility of the brain to perform outwardly 373 identical tasks using distinct sets of brain areas and neural activity patterns and raise exciting challenges 374 for understanding neural computation in the framework of dynamic and distinct neural solutions for a 375 given cognitive problem. We propose that understanding cognitive processes will require considering the 376 wider set of functions an animal is trying to optimize, beyond the decision or computation of interest in a 377 particular study. To understand how long-ago cognitive experience and current cognitive demands set up 378 these different neural circuit landscapes for outwardly identical decisions, we suggest to carefully control 379 for and to intentionally vary cognitive experience in laboratory settings (Plitt & Giocomo, 2021 Authors declare no competing interests. 401

Data and Materials Availability 402
Data and custom code will be made available upon publication. 403

METHODS 404
Mice 405 All experimental procedures were approved by the Harvard Medical School Institutional Animal Care and 406 Use Committee and were performed in compliance with the Guide for the Care and Use of Laboratory 407 Animals. All optogenetic inhibition data were acquired from 19 male VGAT-ChR2-YFP mice (The Jackson 408 Laboratory, stock 014548). All calcium imaging data were acquired from six C57BL/6J-Tg(Thy1-GCaMP6s) 409 GP4.3Dkim/J mice (stock 024275) of both sexes (5 female, 1 male). Mice were 11-32 weeks old at the start 410 of behavioral training. Age at training start did not vary systematically across tasks (simple task: 21 ± 7 411 weeks (n = 7), switching task: 17 ± 5 weeks (n = 13), delay task: 21 ± 11 weeks (n = 5), mean ± SD, including 412 photoinhibition and calcium imaging mice

Y-Maze training, general procedures 443
After training on the linear maze, mice were transitioned to a Y-shaped maze (180 cm long) in which they 444 had to run towards one of two possible Y-arms to get rewarded. In all tasks, visual cues presented on 445 maze walls were associated with rewarded choice arms at the end of the maze. Initially, in all tasks, the 446 correct choice was signaled with a checkerboard at the end of the correct Y-arm (100% "visually guided 447 trials"). Throughout training, the fraction of "visually guided trials" was gradually reduced on a session-448 by-session basis by the experimenter, based on the mouse's previous performance. For the simple and 449 delay task, average performance in the preceding session had to exceed 80%. For the switching task, 450 overall performance including periods after rule switches had to exceed 70% correct, performance after 451 rule switches was inspected for drops followed by recovery over tens of trials, and mice had to obtain at 452 least two rule switches per session. Across all tasks, after extensive training, a minority of trials were still 453 "visually guided trials" (10-15% In the simple task, mice encountered one of two possible cues in a given trial, with a fixed association 464 between cue identity and rewarded Y-arm. Horizontal gratings were associated with a left rewarded 465 choice and vertical gratings were associated with a right rewarded choice. This pair of associations 466 constitutes what we call 'Rule A' in the switching task. Visual cues were present along the entire extent of 467 the maze, including the stem and the Y-arms. 468

Delay task 469
Mice trained in the delay task were first trained in the simple task. After reaching high performance levels 470 in the simple task (at least 90% correct), a delay was introduced, i.e. a neutral visual texture present in all 471 trial types that was uninformative about the choice to make on a given trial. In the first sessions of delay 472 task training, the delay texture was only present in the Y-arms of the maze. Then the delay onset (i.e. cue 473 offset) was gradually shifted earlier in the trial by 10 cm increments on a session-by-session basis if 474 performance in the preceding session exceeded 80% correct, until only the first half of the Y-maze stem 475 contained the visual cue (50 cm). Thus, mice had to traverse the rest of the maze without the informative 476 cue on the walls. A subset of mice (2 out of 7: Mouse IDs 38, 41) were used for photoinhibition 477 experiments both during the simple task before delay task training, and later during the delay task after 478 delay task training. 479

Switching task 480
In the switching task, mice encountered the trial types that were visually identical to those in the simple 481 task, but now the associations between visual cue and rewarded choice were switched in blocks (Rule A  482 and Rule B). In 'Rule B', mice had to make the opposite choices given the same cue identities as in Rule A 483 to get rewarded, i.e. horizontal / vertical gratings were associated with a rightward / leftward choice, 484 respectively. Rule switches were not explicitly signaled to the mice, so they had to integrate information 485 of past cues, choices, and rewards to inform their belief about the current rule. Rule switches were present 486 from the first day of the Y-maze training period. Given the increased cognitive demand of the switching 487 task, the fraction of visually guided trials was reduced more slowly in the switching task than in the simple 488 task. The initial rule in a given session was alternated on a daily basis, starting out with Rule A on the first 489 day of training. Within a training session, a rule switch occurred if several criteria were met: a minimum 490 of 75 trials from the previous rule switch or the session start, a minimum average performance in the last 491 30 trials of 85% correct, and a correct choice on the immediately preceding trial. Mice encountered 2-3 492 rule switches per session, indicating they could repeatedly switch associations successfully. 493

Run-to-visual-target task 494
To establish a baseline for cortical involvement in a simple navigation task in which mice did not use visual 495 cues on the maze walls to guide their choices, we employed a run-to-visual target task. The maze had the 496 standard Y-shape architecture, but no informative visual cues on the maze walls. Instead, mice simply had 497 to run towards the checkerboard present at one of the two Y-arm ends in each trial. The checkerboard 498 location (left or right) was randomly chosen on each trial. We used mice previously trained in either the 499 simple task only (Figure 1-figure supplement 1) or trained on a complex task (switching or delay) before 500 simple-task-only exposure (Figure 3-figure supplement 2), so the mice already knew that the 501 checkerboard signified a reward location and required minimal training on this task (1-2 days prior to 502 photoinhibition). 503

Photoinhibition experiments 504
Clear skull cap surgery 505 We followed procedures described previously (Guo et al., 2014;Minderer et al., 2019). In brief, the scalp 506 and the periosteum were removed from the dorsal skull surface. The skull surface was covered with a thin 507 layer of cyanoacrylate glue (Insta-Cure, Bob Smith Industries). A bar-shaped titanium headplate was 508 attached to the interparietal bone using dental cement (Metabond, Parkell). Several layers of transparent 509 dental acrylic (Jet Repair Acrylic, Lang Dental, P/N 1223-clear) were applied to the parietal and frontal 510 bones to create a transparent skull cap. In a subsequent procedure preceding photoinhibition 511 experiments, the acrylic was polished with a polishing drill (Model 6100, Vogue Professional) with denture 512 polishing bits (HP0412, AZDENT). Clear nail polish was applied on top of the polished acrylic (Electron 513 Microscopy Sciences, 72180). An aluminum ring was attached to the skull using dental cement mixed with 514 carbon powder (Sigma-Aldrich) for light-shielding. 515

Experimental setup and logic 516
Light from a 470 nm collimated laser (LRD-0470-PFFD-00200, Laserglow Technologies) was focused onto 517 the skull using an achromatic doublet lens (f = 300 mm, AC508-300-A-ML, Thorlabs). We coupled the laser 518 to a pair of galvanometric scan mirrors (6210H, Cambridge Technology) in combination with rapid analog 519 laser power modulation to allow fast movement of the focused beam between cortical target sites. At the 520 focus, the laser beam had a diameter of approximately 200 µm. 521 We started photoinhibition only after mice reached expert performance in a given task (criterion for the 522 simple or delay task: performance of approximately 85% correct or higher, criteria in the switching task: 523 at least two rule switches with only 15% visually-guided trials per session). We thus started inhibition after 524 shorter training times in the simple task group of mice, compared to the complex task (delay or switching) 525 groups that required longer training times to reach expert performance (see Figure 1). In each session, we 526 bilaterally targeted PPC, RSC, S1, and a control site outside of the brain (on the dental cement) on 527 separate, interleaved trials. For PPC, S1, and control targets, we used single bilateral laser spots, with laser 528 power sinusoidally modulated at 40 Hz and a time-average power of approximately 6.5 mW/spot. For RSC, 529 we used three spots on each hemisphere to match the region's anatomical extent, with laser power 530 sinusoidally modulated at 20 Hz and a mean power of approximately 5 mW/spot. The target coordinates 531 in mm from bregma were: RSC (-3.5, -2.5, -1.5 anterior-posterior (AP); 0.5 medial-laterial (ML)); PPC (-2 532 AP, 1.75 ML); S1 (-0.5 AP, 2.5 ML); control (2 AP, 5 ML). Based on previous calibration studies (Guo et al., 533 2014;Pinto et al., 2019), we estimate that the laser powers employed here inhibited a cortical area with 534 a radius of 1-2 mm per inhibition spot. 535 In each experimental session, blocks of at least 50 trials without laser light were alternated with laser-on 536 blocks of 50 trials. Laser-on blocks only started if the mouse's average performance in the preceding 30 537 trials was at least 85% correct. Thus, in the switching task, laser-on blocks occurred once the mouse had 538 reached stable performance in the current rule block. In the switching task, rule switches happened after 539 the end of each laser-on block. Within laser-on blocks, approximately 50% of trials were control trials, and 540 the laser target location was randomly chosen for each trial. Within a trial, the laser was on from 0.5 s 541 before visual cue onset at the trial beginning until the mouse reached the end of the maze, excluding the 542 visual feedback and reward / ITI periods of the trial. In the run-to-visual-target task and a subset of 543 sessions in the simple task, a single long block of 200 laser-on trials was delivered after the mouse reached 544 high performance levels, again with approximately 50% control trials randomly interleaved with cortical 545 inhibition trials. In the simple task, inhibition effects did not vary between sessions with laser-on blocks 546 of 50 or 200 trials. 547 For experiments with maze segment-specific inhibition in the delay task (Figure 1-figure supplement 3), 548 the stem of the Y-maze was doubled in length to 200 cm, and the laser-on period per session was 549 restricted to either only the cue period (maze beginning until delay onset) or the delay period (delay onset 550 until the end of the maze, excluding visual feedback and reward / ITI periods). Cue only and delay only 551 inhibition sessions were generally alternated from day to day. 552 For experiments with ITI inhibition in the switching task (Figure 1-figure supplement 4), PPC was the only 553 cortical inhibition target. PPC was inhibited during the ITI for 50 consecutive trials following either the first 554 or the second rule switch per session. In all other trials, the laser was steered to the control location during 555 the ITI so that rule switches could not be inferred simply from the presence of laser light. Inhibition started 556 upon the mouse reaching one of the two possible Y-arm maze ends and lasted throughout checkerboard 557 feedback presentation and the ITI / reward delivery. 558

Long-term experimental stability and order of experiments across tasks 559
To ensure stability of experimental conditions across long times, we maintained constant laser power by 560 measuring maximum power daily and cleaning optics if necessary. To ensure stability of inhibition 561 conditions per mouse, we verified the alignment of the laser beam orientation to the mouse's skull by 562 creating a laser cross pattern to be centered on Bregma and to be aligned with the mouse's AP-ML skull 563 axes. To aid in the latter, we added marks on the mouse's dental cement in AP and ML that the laser cross 564 had to intersect. To change alignment horizontally or vertically, we moved an X-Y stage that the laser 565 apparatus was mounted on. We controlled for rotation by slight adjustments to the posts holding the 566 mouse's headplate. Experiments in different cohorts across tasks were not systematically interleaved but 567 were clustered in time as we iterated through hypotheses throughout the project. We have several 568 indicators that experimental conditions remained stable and that differences across tasks were not the 569 result of experimental drift. First, data for the switching task were collected in several groups of mice 570 spanning the full range of data collection times, yet the average inhibition effects on performance were 571 similar (group 1 (early) (mouse IDs 24, 27, 42) versus group 2 (late) (mouse IDs 72, 73, 74): ΔFraction 572 correct for Rule A: S1: -9 ± 2 % vs -7 ± 2%, RSC: -31 ± 1% vs -38 ± 4%, PPC: -34 ± 3% vs -30 ± 3 %, mean ± 573 sem). Second, data from the simple task with notably smaller inhibition effects were collected in between 574 these two groups and were partly on overlapping days as the first group. Third, in some mice (Mouse IDs  575 38, 41), we tested the effect of inhibition in the identical mice in the simple task first, as well as after they 576 learned the delay task, observing large differences in cortical inhibition effects in the same mice within 577 weeks (ΔFraction correct in simple versus delay task: S1: -1 ± 2 % vs -18 ± 18%, RSC: -16 ± 6% vs -36 ± 3%, 578 PPC: -5 ± 2% vs -37 ± 8 %, mean ± sem). 579

Calcium imaging experiments 580
Large chronic cranial window surgery 581 We slightly modified procedures described previously (Kim et al., 2016;Kılıç et al., 2021). Mice were 582 injected with Dexamethasone (3 µg per g body weight) 4-8 h prior to surgery and anesthetized with 583 isoflurane (1-2% in air). A cranial window surgery was performed to either fit a 'crystal skull' curved 584 window (LabMaker UG) exposing the dorsal surface of both hemispheres (Kim et al., 2016) or the left 585 hemisphere only (Kılıç et al., 2021), or to fit a stack of custom laser-cut quartz glass coverslips (three 586 coverslips with #1 thickness each (Electron Microscopy Sciences), cut to a 'D'-shape with maximum 587 dimensions of 5.5 mm medial-lateral and 7.7 mm anterior-posterior, and glued together with UV-curable 588 optical adhesive (Norland Optics NOA65)), exposing the left cortical hemisphere. The skull was kept moist 589 using saline throughout the drilling procedure and soaked in saline for one to two minutes before being 590 lifted. The dura was removed before sealing the window using dental cement (Parkell). A custom titanium 591 headplate was affixed to the skull using dental cement mixed with carbon powder (Sigma-Aldrich) to 592 prevent light contamination. A custom aluminum ring was affixed on top of the headplate using dental 593 cement. During imaging, this ring interfaced with a black rubber balloon enclosing the microscope 594 objective for light-shielding. 595 Calcium imaging setup and data acquisition 596 Data were collected using a large field of view two-photon microscope assembled as described previously 597 (Sofroniew et al., 2016). In brief, the system consisted of a combination of a fast resonant scan mirror and 598 two large galvanometric scan mirrors allowing for large scan angles. Together with a remote focusing unit 599 to rapidly move the focus depth, this setup enabled random access imaging in a field of view of 5 mm 600 diameter with 1 mm depth. The setup was assembled on a vertically mounted breadboard whose XYZ 601 positions and rotation were controlled electronically via a gantry system (Thorlabs). Thus, to position the 602 imaging objective with respect to the mouse, the position and rotation of the entire microscope were 603 adjusted while the position of the mouse remained fixed. The excitation wavelength was 920 nm, and the 604 average power at the sample was 60-70 mW. The microscope was controlled by ScanImage 2016 (Vidrio 605 Technologies). We imaged in three distinct regions in the left cortical hemisphere: V1, PPC, and RSC. These 606 regions were identified based on retinotopic mapping (see below). In each region, we acquired images in 607 layer 2/3 from two planes spaced 50 µm in depth, at 5.36 Hz per plane at a resolution of 512 x 512 pixels 608 (600 µm x 600 µm). Imaging was performed in expert mice in the simple task, switching task, and simple 609 task after switching task experience (criterion for the simple task: performance of approximately 85% 610 correct or higher, criteria in the switching task: at least two rule switches with only 15% visually-guided 611 trials per session). The stem of the Y-maze was extended by 50% (50 cm) compared to the maze 612 architecture in photoinhibition sessions, resulting in a maze length of 230 cm. Each imaging session lasted 613 45-80 minutes. During imaging, slow drift of the image was occasionally corrected manually by moving 614 the gantry to align the current image with an image from the beginning of the session. For synchronization 615 of imaging and behavior data, both the imaging and the behavior frame clock were recorded on another 616 computer using Wavesurfer (https://wavesurfer.janelia.org/). 617 Retinotopic mapping for selecting calcium imaging locations 618 We performed retinotopic mapping in mice used for calcium imaging experiments as previously described 619 (Driscoll et al., 2017;Minderer et al., 2019). Mice were lightly anesthetized with isoflurane (0.7 -1.2% in 620 air). A tandem-lens macroscope was used in combination with a CMOS camera to image GCaMP 621 fluorescence at 60 Hz (455 nm excitation, 469 nm emission). A periodic spherically corrected black and 622 white checkered moving bar (Marshel et al., 2011) was presented in four movement directions on a 623 gamma-corrected 27 inch IPS LCD monitor (MG279Q, Asus). The monitor was centered in front of the 624 mouse's right eye at an angle of 30 degrees from the mouse's midline. To produce retinotopic maps, we 625 calculated the temporal Fourier transform at each pixel of the imaging data and extracted the phase at 626 the stimulus frequency (Kalatsky & Stryker, 2003). These phase images were smoothed with a Gaussian 627 filter (25 μm s.d.). Field sign maps were generated by computing the sine of the angle between the 628 gradients of the average horizontal and vertical retinotopic maps. 629 For each retinotopic mapping session, we acquired an image of the superficial brain vasculature pattern 630 under the same field of view. We acquired a similar brain vasculature image under the large field of view 631 two-photon microscope. These two reference images were manually aligned and used to directly locate 632 V1 and PPC locations for two-photon imaging. The location for RSC imaging was positioned adjacent to 633 the midline and about 300 μm anterior of the PPC location. 634

General analyses 635
Statistical estimates and significance were generally generated with hierarchical bootstrapping 636 (Saravanan et al., 2020), and data are reported as mean ± sem of hierarchical bootstrap distributions, 637 unless noted otherwise. Standard error of the mean was calculated as the standard deviation of the means 638 from a bootstrap distribution (n = 10000 resampled datasets). For analyses of optogenetic inhibition 639 effects, resampled datasets were generated by sampling with replacement first at the level of sessions 640 pooled across mice and then at the level of trials. For analyses of calcium imaging data, resampled datasets 641 were generated by resampling at the level of sessions then neurons. For significance testing of differences 642 between bootstrap distributions, the probability that one was greater or less than the other, whichever 643 was smaller, was computed. To obtain a p-value for a two-tailed test with α = 0.05, this probability was 644 doubled. Analyses were performed with custom code in MATLAB. No statistical methods were used to 645 predetermine sample sizes, but our sample sizes were similar to ones in previous publications in the field. 646 Allocation of individual mice into experimental groups, i.e. behavioral tasks, was not randomized, and co-647 housed mice were trained on the same behavioral task and task sequence. Data collection was not 648 performed blind to the experimental groups. Blinding experimenters would have been challenging as 649 experimenters remained present throughout behavioral sessions to ensure the sessions were running 650 smoothly, and many experimental groups were inferable by observing the virtual reality display and 651 rewarded choices over time. Data collection was performed by four different experimentalists. Analyses 652 were also non-blinded but performed by two different experimentalists. A small number of behavioral 653 sessions were excluded from analysis due to low performance of the mouse on control trials. Imaging 654 sessions were excluded in case of noticeable drift after motion correction. 655

Analysis of photoinhibition experiments 656
Effects of photoinhibition on performance 657 Performance was quantified as 'fraction correct', the fraction of trials in which the mouse made the 658 correct choice. Chance performance was 50% correct. Effects of cortical inhibition were measured as 659 ΔFraction Correct, the fraction correct with inhibition minus the fraction correct with the laser steered to 660 the control (off-cortex) spot. Fraction correct and ΔFraction Correct were calculated on a session-basis. 661 For comparisons of control performance and performance with various cortical inhibition targets within 662 a task, significance levels were adjusted with the Bonferroni method. 663

Quantification of learning times 664
To compare the number of training sessions necessary to achieve expert performance across tasks ( Figure  665 1), training sessions were counted from the first day on the Y-maze, after training on the linear maze, until 666 both of the following performance criteria were reached per session: maximum of 20% "visually guided 667 trials" and average fraction correct of at least 70% correct (switching task) or 85% (simple task and delay 668 task). Note that in the switching task, these performance criteria included all trials per session, including 669 trials following rule switches. For the delay task, an additional performance criterion was a delay length 670 of 50 cm, and only mice without prior photoinhibition sessions in the simple task were included (5 out of 671 7 delay task mice). 672

Photoinhibition effects on biases and running parameters 673
Choice biases were calculated per mouse and task (Figure 1-figure supplement 2). For each session, a 674 signed choice bias value for each inhibition target was calculated as: (Frac Corr left -Frac Corr right ) / (Frac 675 Corr left + Frac Corr right ). Thus, a signed choice bias of 1 or -1 indicates that the mouse only made left or 676 right choices, respectively. Inhibition effects on running parameters for each inhibition target were 677 calculated by averaging the treadmill velocity for forward running (pitch axis) per trial during inhibition 678 and normalizing each value by the average treadmill pitch velocity in control trials of the same session. 679 The resulting values were averaged within each mouse before averaging across mice. 680

Analysis of calcium imaging experiments 681
Pre-processing of imaging data 682 To correct for motion artifacts, custom code was used as described in detail previously (Chettih & Harvey,683 2019): https://github.com/HarveyLab/Acquisition2P_class/tree/motionCorrection. In brief, motion 684 correction was implemented as a sum of shifts on three distinct temporal scales: sub-frame, full-frame, 685 and minutes-to-hour-long warping. After motion correction, regions of interest (ROIs) were extracted with 686 Suite2P (Pachitariu et al., 2016). Afterwards, somatic sources were identified with a custom two-layer 687 convolutional network in MATLAB trained on manually annotated labels to classify ROIs as neural somata, 688 processes, or other (Chettih & Harvey, 2019). Only somatic sources were used. After identifying individual 689 neurons, average fluorescence in each ROI was computed and converted into a normalized change in 690 fluorescence (ΔF/F). We corrected the numerator of the ΔF/F calculation for neuropil by subtracting a 691 scaled version of the neuropil signal estimated per neuron during source extraction: 692 F neuropilCorrected = F -0.7*F neuropil . 693 The baseline fluorescence of this trace was estimated as the 8th percentile of fluorescence within a 60 s 694 window (baseline neuropilCorrected ), and subtracted to get the numerator: 695 We divided this by the baseline (again 8th percentile of 60 s window) of the raw fluorescence signal to get 697 ΔF/F. The ΔF/F trace per neuron was deconvolved using the constrained AR-1 OASIS method (Friedrich et 698 al., 2017). Decay constants were initialized at two seconds and optimized separately for each neuron. 699 All analyses were performed on deconvolved activity that was spatially binned along the long axis of the 700 maze (5 cm bins). To be able to compare neural activity across tasks, only correct trials from high 701 performance periods were included (minimum of 80% correct in a window of 10 trials, which excludes 702 periods after rule switches in the switching task). In the switching task, only trials from a single rule (Rule 703 A, i.e. the vertical grating cue/horizontal grating cue requires a right/left choice) were included. 704 Furthermore, for comparisons of trial-type selectivity, noise correlations, or trial-type decoding across 705 tasks, trials were subsampled to the low number of trials per trial type (i.e. horizontal cue / left trial versus 706 vertical cue / right trial) per session in the switching task when considering only high performance trials 707 for Rule A (n = 30 trials per trial type). 708 Trial-type selectivity 709 To quantify if activity of single neurons was informative about the current trial type, the area under the 710 receiver operating characteristics curve (auROC) was calculated for each bin and averaged per maze 711 segment (first half of stem, second half of stem, Y-arms). Trial-type selectivity was defined as the unsigned 712 version of the auROC: 2*|auROC -0.5| (Najafi et al., 2020). To identify neurons with significant trial-type 713 selectivity, for each neuron, unsigned auROC values were recomputed 100 times with shuffled trial labels, 714 and the original value was compared to the resulting distribution. Trial-type selectivity was considered 715 significant if the probability of drawing this value from the shuffled distribution was less than 0.01. The 716 fraction of trial-type selective neurons was calculated for each spatial bin and subsequently averaged per 717 maze segment. 718 Trial-type decoding 719 For each session and area, at each spatial bin, a linear SVM was trained to predict the current trial type 720 (i.e. horizontal cue / left trial versus vertical cue / right trial) using the activity of a subsample of neurons 721 (n = 5, 10, 25, 50, 75, 150 or 200 neurons, activity of each neuron z-scored), with 10-fold cross-validation. 722 This procedure was repeated 40 times for populations of 5 or 10 neurons, and 20 times for populations 723 of 25-200 neurons. For each repetition, the decoding accuracy per bin was calculated as the fraction of 724 test trials in which the trial type was predicted correctly. Decoding accuracy was averaged across spatial 725 bins and repetitions per subsampled population per session. To compare trial-type decoding across tasks, 726 a two-way ANOVA with factors for task and population size was used. 727

Noise correlations 728
To measure pairwise noise correlations, we calculated the Pearson correlation coefficient for pairs of 729 neurons separately for each trial type, and then averaged the coefficients across trial types. To compare 730 noise correlations across tasks, a two-way ANOVA with factors for task and brain area combination was 731 used. To assess the effect of noise correlations on population information, we disrupted noise correlations 732 by shuffling the order of trials for each neuron independently for each trial type and repeated the trial-733 type decoding analysis above. We then calculated the difference in decoding accuracy, subtracting the 734 mean accuracy with disrupted noise correlations from the mean accuracy with intact noise correlations, 735 for a given population size and task. 736 Choice decoding based on running parameters 737 To quantify how well a mouse's reported choice could be decoded from its running parameters in a given 738 task, a generalized linear model was fit using as predictors the instantaneous treadmill velocities for all 739 axes (pitch, roll, yaw), and the lateral maze position. Running parameters were spatially binned along the 740 maze's long axis (5 cm bins), and a different model was trained for each bin with 10-fold cross-validation. 741 In photoinhibition experiments, only control trials were used. Only correct trials from high performance 742 periods were used (minimum of 80% correct in a window of 10 trials, which excludes periods after rule 743 switches in the switching task), and in each session, trials were subsampled to the low number of trials 744 per trial type in the switching task when considering only high-performance trials for a single rule per 745 session (n = 30 trials per trial-type). To sub-select calcium imaging sessions with similar running patterns 746 to control for differences in running patterns across tasks (  Fraction Correct S im p le T a s k R u n -to -T a r g e t T a s k S im p le T a s k R u n -to -T a r g e t T a s k S im p le T a s k R u n -to -T a r g e t T a s k S im p le T a s k R u n -to -T a r g e t T a s k (B) Performance in the run-to-target task for each inhibited location across 15 sessions from 3 mice. Bars indicate mean ± sem of a bootstrap distribution of the mean. S1 p = 0.85; RSC p < 0.001; PPC p = 0.16; from bootstrapped distributions of ΔFraction Correct (difference from control performance) compared to 0, two-tailed test, α = 0.05 plus Bonferroni correction. Sessions per mouse: 5 ± 2. Trials per session: 93 ± 11 (control), 26 ± 5 (S1), 24 ± 5 (RSC), 28 ± 6 (PPC), mean ± SD. (C) Comparison of performance on control trials in the simple task (same dataset as in Figure 1K) versus the run-to-target task using only the first two laser-on blocks in each session. Bars indicate mean ± sem of a bootstrap distribution of the mean; p < 0.001, two-tailed comparison of bootstrapped Fraction Correct distributions, α = 0.05. Trials per session: 51 ± 23 (simple task), 93 ± 11 (run-to-target task), mean ± SD. (D) Comparison of inhibition effects (ΔFraction Correct) in the simple task (same dataset as in Figure 1F) and the run-to-target task for each cortical inhibition location. Bars indicate mean ± sem of a bootstrap distribution of the mean; two-tailed comparisons of bootstrapped ΔFraction Correct distributions, α = 0.05. S im p le T a s k S im p le T a s k S im p le T a s k D e la y T a s k ( D e la y o n ly ) D e la y T a s k ( D e la y o n ly ) D e la y T a s k ( D e la y o n ly ) S im p le T a s k S im p le T a s k S im p le T a s k Figure 1-figure supplement 3. Cue only or delay only inhibition in the delay task (A) Left: schematic of the delay task. Right: Inhibition was restricted to either the cue period only or the delay period only in a given session. (B) Performance in the delay task with cue only (blue, 48 sessions from 5 mice) or delay only (green, 45 sessions from 5 mice) inhibition for each inhibited location. Bars indicate mean ± sem of a bootstrap distribution of the mean. For cue only or delay only inhibition individually, inhibition performance was compared to control performance, two-tailed test, α = 0.05 plus Bonferroni correction. Cue only: S1 p = 0.09; RSC p < 0.001; PPC p < 0.001. Sessions per mouse: 10 ± 2. Trials per session: 59 ± 16 (control), 14 ± 6 (S1), 14 ± 5 (RSC), 15 ± 5 (PPC), mean ± SD. Delay only: S1 p = 0.27; RSC p < 0.001; PPC p < 0.001. Sessions per mouse: 9 ± 2. Trials per session: 61 ± 15 (control), 14 ± 5 (S1), 15 ± 4 (RSC), 15 ± 5 (PPC), mean ± SD. (C) Comparison of inhibition effects (ΔFraction Correct) in the simple task (same dataset as in Figure 1F) and the delay task with cue inhibition only for each cortical location. Bars indicate mean ± sem of a bootstrap distribution of the mean; two-tailed comparisons of bootstrapped ΔFraction Correct distributions, α = 0.05. (D) Similar to (C), but for delay inhibition only in the delay task.    a ft e r c o n tr o l tr ia l a ft e r S 1 tr ia l a ft e r R S C tr ia l a ft e r P P C tr ia l a ft e r c o n tr o l tr ia l a ft e r S 1 tr ia l a ft e r R S C tr ia l a ft e r P P C tr ia l  Figure 1). Middle: inhibition lasted from trial onset throughout maze traversal. Right: As in Figure 1, inhibition target locations per trial were randomly interleaved. Analysis here used performance on control trials that directly followed inhibition of the labeled location on the preceding trial. (B) Performance on control trials immediately following an inhibition trial, for the simple task, for each inhibited location across 45 sessions from 4 mice. Bars indicate mean ± sem of a bootstrap distribution of the mean. S1 p = 1; RSC p = 1; PPC p = 1; from bootstrapped distributions of ΔFraction Correct (difference from control performance) compared to 0, two-tailed test, α = 0.05 plus Bonferroni correction. Sessions per mouse: 11 ± 2. Trials per session: 22 ± 12 (control), 8 ± 3 (S1), 8 ± 4 (RSC), 9 ± 4 (PPC), mean ± SD. (C) Similar to (B), except for the delay task. 62 sessions from 7 mice. S1 p = 1; RSC p = 0.12; PPC p = 0.50.
Sessions per mouse: 9 ± 4. Trials per session: 29 ± 8 (control), 8 ± 3 (S1), 9 ± 4 (RSC), 7 ± 3 (PPC). (D) Similar to (B), except for the switching task (Rule A trials only). 89 sessions from 6 mice. S1 p = 0.66; RSC p = 0.27; PPC p = 0.19. Sessions per mouse: 15 ± 5. Trials per session: 13 ± 6 (control), 4 ± 2 (S1), 5 ± 2 (RSC), 4 ± 2 (PPC). (E) Top: Schematic of the switching task. Bottom: schematic of a single trial with inhibition during the feedback and ITI period. (F) Left: Schematic of PPC and control targets. Right top: Example behavioral performance in one session in the switching task. Right bottom: inhibition blocks of 50 trials started after a rule switch, with inhibition during the feedback/ITI period. The same area was targeted on every trial. (G) Average performance after a rule switch with PPC (blue) or control (black) inhibition on every trial during the feedback/ITI. 33 sessions from 4 mice (8 ± 2 sessions per mouse, mean ± SD). Shading indicates mean ± sem across sessions. Thin lines indicate single sessions. Fraction Correct was Gaussian-filtered (window of 7 trials, sigma of 3 trials) and smoothed again with a moving average filter of 3 trials for plotting.  Mice with experience in the switching task perform at high levels on nolaser trials in the simple task and can still switch rules (A) Schematic of the training history sequence. One group of mice was trained on the switching task and then permanently transitioned to the simple task. This group of mice was compared to another group trained only on the simple task. (B) Left: Performance for an example mouse with switching task experience across the first 30 trials per session for sessions 1, 2, and 14 in the simple task. Each session started with a block of no-laser trials (minimum of 50 trials) before the first laser-on block. Fraction Correct was Gaussian-smoothed with a window size of 7 trials, sigma of 3 trials. Middle: Average performance in the first 30 no-laser trials of a session in the simple task. Gray lines: individual mice. Bars indicate mean ± sem across mice (n = 5). Right: Average initial performance in the switching task (orange, 90 sessions from 6 mice), in each week in the simple task of mice with previous switching task experience (red, 35 and 34 sessions from 5 mice in week 1 and 2, respectively), and in the simple task in mice with simple-task-only experience (gray, 45 sessions from 4 mice). Bars indicate mean ± sem across sessions. Unpaired two-sided t-tests comparing performance in the simple task with and without switching task experience. Week 1: p = 0.00096, week 2: p = 0.43. (C) Schematic of task sequence: After training in the switching task, mice were transitioned to the simple task without any rule switches for 14 days. Then for a single session, mice were exposed to the rule they had not been exposed to for 14 days. Increased cortical involvement in the simple task after complex task experience does not generalize to the run-to-target task (A) Schematic of task training sequence. One group of mice was trained in the simple task and then transitioned to the run-to-target task. Another group of mice was first trained in a complex task (switching or delay task), then transitioned to the simple task for 14 days, and then tested on the runto-target task. (B) Comparison of inhibition effects (ΔFraction Correct) in the run-to-target task in mice with simple taskonly versus complex and simple task experience, for each cortical inhibition location. Bars indicate mean ± sem of a bootstrap distribution of the mean; two-tailed comparisons of bootstrapped ΔFraction Correct distributions, α = 0.05. Simple task-only experience (same dataset as in Figure 1figure supplement 1): 15 sessions from 3 mice, 5 ± 2 sessions per mouse. Trials per session: 93 ± 11 (control), 26 ± 5 (S1), 24 ± 5 (RSC), 28 ± 6 (PPC), mean ± SD. Complex task and simple task experience: 11 sessions from 3 mice, 4 ± 2 sessions per mouse. Trials per session: 94 ± 4 (control), 28 ± 2 (S1), 23 ± 2 (RSC), 28 ± 4 (PPC), mean ± SD.

Figure 4-figure supplement 1. Neuronal trial-type selectivity is sequentially organized (A)
Trial-type selectivity (absolute deviation of auROC from chance level, 2*|auROC-0.5|) was calculated per neuron and spatial maze bin (5 cm bin size) and is shown for all neurons pooled across mice and sessions in each cortical area and task. Neurons were sorted by the maze position of their selectivity peak. Mice per task: simple (3), switching (3), simple after switching (2).   Shading indicates mean ± sem across all sessions per task. Sessions per task: 12 (simple), 12 (switching), 8 (simple after switching). Right: Decoding accuracy using a subset of sessions with similar running patterns, i.e. with average choice decoding accuracy in the maze stem ranging from 85-95%. Sessions per task: 4 (simple), 5 (switching), 5 (simple after switching). (B) For sessions with similar running patterns, in each area, mean trial-type selectivity levels across cells by maze segment are compared in the simple versus the switching task (Rule A trials only). Shading indicates mean ± sem of bootstrapped distributions. p (segment) shows p values of two-tailed comparisons of bootstrapped distributions per maze segment. p (overall) shows the p value for the task factor from a two-way ANOVA (factors: task and maze segment). (C) For sessions with similar running patterns, similar to (B), except for the fraction of trial-type selective cells as determined from comparing each cell's selectivity value to a distribution with shuffled trial labels (significance threshold of p < 0.01). (D) For sessions with similar running patterns, similar to (B), but for the simple task after switching task experience. (E) For sessions with similar running patterns, similar to (C), but for the simple task after switching task experience.