
208 Cal.App.3d 132 (1989)
256 Cal. Rptr. 31
THE PEOPLE, Plaintiff and Respondent,
v.
JUAN CASTILLO JEREZ, Defendant and Appellant. In re JUAN CASTILLO JEREZ on Habeas Corpus.
Docket Nos. B032922, B037064.
Court of Appeals of California, Second District, Division Three.
February 28, 1989.
*134 COUNSEL
Harvey Zall, State Public Defender, under appointment by the Court of Appeal, and Billie Jan Goldstein, Deputy State Public Defender, for Defendant and Appellant.
John K. Van de Kamp, Attorney General, Steve White, Chief Assistant Attorney General, William T. Harter and Susan D. Martynec, Deputy Attorneys General, for Plaintiff and Respondent.
OPINION
CROSKEY, J.
Following a jury trial the defendant, Juan Castillo Jerez, was found guilty of second degree robbery (Pen. Code, § 211). In addition, it was found that defendant personally used a firearm (Pen. Code, §§ 12022.5, 1203.06, subd. (a)(1)). It was further found that defendant had suffered three prior serious felony convictions within the meaning of Penal Code section 667, subdivision (a) and that he had previously served a prior prison term within the meaning of Penal Code section 667.5, subdivision (b). He was sentenced to state prison for the high base term of five years plus a two-year enhancement for the use allegation. He was also sentenced to an additional five years on each of the three serious felony convictions (Pen. Code, § 667, subd. (a)) plus one year for the prior prison term (Pen. Code, § 667.5, subd. (b)).[1]


*135 ISSUE PRESENTED
The sole issue presented on this appeal, as framed by the defendant's brief, is whether the "imposition of two five-year enhancements for two [of the three] prior convictions, which could have been brought and tried together in a single proceeding, violated [his] right to equal protection." He also filed a petition for writ of habeas corpus, which was ordered to be considered concurrently with the present appeal. In his petition he raises the same issue as on the appeal.[2]

DISCUSSION
Of the two prior serious felonies at issue here, the first was a robbery, with a gun, of a supermarket in Torrance on August 16, 1983. A complaint was issued on August 18, 1983. On September 30, 1983, he pleaded guilty and was sentenced to state prison for six years. The second was a robbery, with a gun, of a supermarket in Van Nuys on August 14, 1983. A complaint was issued on October 25, 1983,[3] and on November 7, 1983, he pleaded guilty and was sentenced to state prison for five years.
At sentencing in the present case, the court imposed an additional five-year term for each of these two prior convictions pursuant to Penal Code section 667, subdivision (a).[4] That section mandates that any person convicted of a "serious felony" must receive a consecutive five-year enhancement "for each such prior conviction on charges brought and tried separately."
(1a) Defendant contends that section 667, subdivision (a) violates the equal protection clauses of the federal and state Constitutions because it punishes for prior serious felony convictions differently depending upon *136 whether the priors were consolidated into one proceeding or were "brought and tried separately." He argues that two defendants with identical prior felony convictions can receive different punishments under section 667, subdivision (a), not because of any difference in culpability, but simply because "the prosecutor in one case has chosen to try the defendant's priors separately while the prosecutor in the other has chosen to try them together" in one information. Defendant asserts that he is in that class of serious felony recidivists whose prior convictions could have been, but were not, brought and tried together in a single proceeding; that both of his 1983 prior convictions were for the same offense and both occurred in Los Angeles County only two days apart. Consequently, he argues, they "could have been" brought and tried together in a single proceeding under the permissive joinder statute, Penal Code section 954.[5]
We initially note that it is only by resort to gross speculation that it can be concluded that defendant's 1983 charges "could have been" consolidated for trial had the prosecutor so elected. Defendant's crimes were committed in different jurisdictions in Los Angeles County and the cases were filed in two different Los Angeles County Judicial Districts, South Bay and Los Angeles (Van Nuys Branch Court). The complaint for the August 16, 1983, robbery was issued on August 18, 1983. The complaint for the August 14, 1983, robbery was not issued until October 25, 1983, almost one month after defendant was sentenced for the August 16th robbery.
There is nothing in the record that shows the filing deputy in the South Bay Judicial District was aware that defendant had committed another robbery in another judicial district two days before the August 16th robbery. Moreover, the second complaint (for the Van Nuys robbery) was not issued until after the defendant had already been sentenced on the first complaint, and there is no showing as to why the second complaint was filed a month after the victim identified the defendant in a photo lineup. In addition, and most importantly, it does not appear that a motion to consolidate the two cases was made by the defendant's attorney at any time.[6] Thus, *137 we cannot determine that a decision was ever made, or even considered, on the question of the consolidation of these two crimes for trial.
It is true that future punishments may differ as to two defendants depending on whether earlier offenses had been consolidated or tried separately. However, whether such crimes are consolidated for trial is not totally dependent upon prosecutorial discretion. Defendant may, if he so desires, make a motion for consolidation and, under Penal Code section 954, it is in the court's discretion as to whether to order the different offenses be tried together.
(2) Unless joinder is prohibited or severance is permitted for good cause, joinder of two or more offenses is required if they are related and the prosecution is or should be aware of such fact. Offenses are related where the same act or course of conduct plays a significant part in each. (Pen. Code, §§ 654, 954; Kellett v. Superior Court (1966) 63 Cal.2d 822, 827 [48 Cal. Rptr. 366, 409 P.2d 206]; People v. Tirado (1984) 151 Cal. App.3d 341, 354 [198 Cal. Rptr. 682].)
(3) Where the offenses are not related, then the question of joinder becomes a matter of judicial discretion. However, as to the timing of the filing of unrelated charges, prosecutorial discretion is basic to the framework of the California criminal justice system. (People v. Tirado, supra, 151 Cal. App.3d at pp. 352-353; see also People v. Garcia (1986) 183 Cal. App.3d 335, 344-345 [228 Cal. Rptr. 87].) This discretion, though recognized by statute in California, is founded upon constitutional principles of separation of powers and due process of law.
In People v. Wallace (1985) 169 Cal. App.3d 406, 408-411 [215 Cal. Rptr. 203],[7] the court held there was no equal protection violation by vesting in *138 the prosecution the discretionary authority to charge a prior serious felony under either Penal Code section 667.5, subdivision (b) (one-year enhancement) or Penal Code section 667 (five-year enhancement). The court stated: "The crime-charging power is vested in the public prosecutor by Government Code section 26501. `Prosecutors have a great deal of discretion in this crime-charging function. Charging discretion takes three basic forms: (1) evidentiary sufficiency  a determination of whether the evidence warrants prosecution; (2) charge selection  a determination of the appropriate charge or charges; and (3) discretion not to prosecute  a determination of whether there is an alternative to formal criminal prosecution.' (Knapp, Prosecutorial Discretion (Cont.Ed.Bar 1979) § 11, p. 5.)" An unbroken line of cases in California has recognized the district attorney's discretionary power in the crime-charging function and its insulation from control by the courts. (People v. Garcia, supra, 183 Cal. App.3d at p. 344.) Consequently, as a matter of pleading, the district attorney can allege what he chooses at the time he chooses, subject only to the compulsory joinder rules under Kellett v. Superior Court, supra, 63 Cal.2d 822, 826-827.[8]
In United States v. Batchelder (1979) 442 U.S. 114, 125 [60 L.Ed.2d 755, 766, 99 S.Ct. 2198], the court held that when a prosecutor makes a charging determination, which determination may have been influenced by the penalties available upon conviction, that fact alone does not give rise to a violation of the equal protection clause. "Just as a defendant has no constitutional right to elect which of two applicable federal statutes shall be the basis of his indictment and prosecution, neither is he entitled to choose the penalty scheme under which he will be sentenced. [Citations.]"
(1b) Nor does Penal Code section 667, subdivision (a), by restricting a five-year enhancement to only those charges "brought and tried separately," deny equal protection to defendant. (4) "The first prerequisite to a meritorious claim under the equal protection clause is a showing that the state has adopted a classification that affects two or more similarly situated groups in an unequal manner. [Citation.]" (In re Eric J. (1979) 25 Cal.3d 522, 530 [159 Cal. Rptr. 317, 601 P.2d 549]; accord People v. Jacobs (1984) 157 Cal. App.3d 797, 801 [204 Cal. Rptr. 234].) "The equal protection clause does not assure defendant of the same treatment as all other felons; it assures him only ... that he will receive like treatment with all other persons similarly situated. [Citations.]" (People v. Enriquez (1977) 19 Cal.3d 221, 229 [137 Cal. Rptr. 171, 561 P.2d 261, 3 A.L.R.4th 73].)
*139 (5) "Neither the Fourteenth Amendment of the Constitution of the United States nor the California Constitution (art. I, § 7; art. IV, § 16) precludes legislative classification with respect to persons who are different. [Citation]" (People v. Jacobs, supra, 157 Cal. App.3d at p. 802.) What is required is that similarly situated persons with respect to the legitimate purpose of the law, receive like treatment. (Ibid.)
(1c) Penal Code section 667, subdivision (a) creates two separate classes of serious felony recidivists: those whose prior serious felonies were brought and tried separately and those whose prior serious felonies were consolidated into one proceeding. In each group all persons are treated equally. Defendant, however, argues that a third class of offenders should be created, namely, "that class of serious felony recidivists whose prior convictions could have been, but were not, brought and tried together in a single proceeding." He asserts that the statute discriminates between his group of "could-have-beens" and the group that did in fact have their prior serious felonies consolidated.
However, defendant has chosen a class that is incapable of being determined with any accuracy.[9] In order for a trial court to find that a defendant would fall into the class of "could-have-beens," the court must first determine how the trial court in the prior cases (cases concluded years before) would have exercised its discretion. As noted above, consolidation is not automatic and the court has wide discretion in making this determination. (People v. Balderas (1985) 41 Cal.3d 144, 170-171 [222 Cal. Rptr. 184, 711 P.2d 480].) Furthermore, in most instances, as in the present case, there would be no factual basis in the record on which to speculate that defendant would have been successful had he moved to consolidate.
Clearly, Penal Code section 667 does not establish classifications which treat similarly situated groups in disparate ways. Defendant is in one of the *140 classes of felons  recidivist serious offenders whose prior felonies were brought and tried separately  and he is treated the same as all others in that class.
Contrary to defendant's argument, the statute satisfies a strict scrutiny standard of equal protection review. The state has a compelling interest in the protection of public safety and in preventing and punishing recidivism. Its focus on "serious" felonies furthers that interest, and the limitation of Penal Code section 667 to only those cases which were brought and tried separately does not result in a denial of equal protection. As noted in Dandridge v. Williams (1970) 397 U.S. 471, 486-487 [25 L.Ed.2d 491, 503, 90 S.Ct. 1153], "the Equal Protection Clause does not require that a State must choose between attacking every aspect of a problem or not attacking the problem at all. [Citation.]" (Accord People v. Gutierrez (1985) 171 Cal. App.3d 944, 950 [217 Cal. Rptr. 616].) (6) "The Legislature is not bound, in order to adopt a constitutionally valid statute, to extend it to all cases which might possibly be reached, but is free to recognize degrees of harm and to confine its regulation to those classes of cases in which the need is deemed to be the most evident." (Board of Education v. Watson (1966) 63 Cal.2d 829, 833 [48 Cal. Rptr. 481, 409 P.2d 481]; accord People v. Gutierrez, supra, at p. 950.)
(1d) Since there is no equal protection violation, the court properly imposed the enhancements under Penal Code section 667, subdivision (a).

DISPOSITION
The judgment is affirmed; the petition for writ of habeas corpus is denied.
Klein, P.J., and Danielson, J., concurred.
Appellant's petition for review by the Supreme Court was denied May 18, 1989. Mosk, J., was of the opinion that the petition should be granted.
NOTES
[1]  Thus, his total term was for 23 years.
[2]  In view of the narrow procedural issue raised, it is not necessary to present a statement of facts describing the commission of the crime with which the defendant was charged.
[3]  A victim of this robbery identified defendant from a photo line-up card on September 20, 1983.
[4]  Penal Code section 667, subdivision (a) provides: "In compliance with subdivision (b) of Section 1385 [prohibiting sentencing judges from striking serious felony priors], any person convicted of a serious felony who previously has been convicted of a serious felony in this state or of any offense committed in another jurisdiction which includes all of the elements of any serious felony, shall receive, in addition to the sentence imposed by the court for the present offense, a five-year enhancement for each such prior conviction on charges brought and tried separately. The terms of the present offense and each enhancement shall run consecutively." (Italics added.)

Penal Code section 667, subdivision (d) states: "As used in [section 667] `serious felony' means a serious felony listed in subdivision (c) of Section 1192.7."
Defendant's prior convictions were for robbery, which is listed in Penal Code section 1192.7, subdivision (c)(19).
[5]  Penal Code section 954 provides: "An accusatory pleading may charge two or more different offenses connected together in their commission, or different statements of the same offense or two or more different offenses of the same class of crimes or offenses, under separate counts, and if two or more accusatory pleadings are filed in such cases in the same court, the court may order them to be consolidated. The prosecution is not required to elect between the different offenses or counts set forth in the accusatory pleading, but the defendant may be convicted of any number of the offenses charged, and each offense of which the defendant is convicted must be stated in the verdict or the finding of the court; provided, that the court in which a case is triable, in the interests of justice and for good cause shown, may in its discretion order that the different offenses or counts set forth in the accusatory pleading be tried separately or divided into two or more groups and each of said groups tried separately. An acquittal of one or more counts shall not be deemed an acquittal of any other count."
[6]  It should be emphasized that a defendant is always the person in the best position to call this particular problem to the attention of his attorney and the court since he is obviously the one with full knowledge of all of the crimes with which he was or could be charged. However, we are also aware that it is the accused who usually resists consolidation of multiple criminal charges in order to avoid any potential prejudicial connection between crimes and to negate the possibility that in a consolidated trial the spillover effect from one charge might alter the outcome on some other charge. Thus, the defendant in the present case may have consciously chosen not to bring the August 14th crime to anyone's attention. This is particularly likely here since the record shows the complaint for the August 14th robbery had not yet been issued at the time he pleaded guilty to the August 16th robbery.
[7]  In Wallace, pursuant to a negotiated plea bargain, defendant entered a plea of guilty to voluntary manslaughter, and as part of his sentence, received a five-year enhancement under Penal Code section 667 for a previous conviction of a serious felony. Defendant appealed, contending that section 667 violated his right to equal protection. He argued that because of the overlap between section 667.5, subdivision (b) and section 667, different punishment can result for persons similarly situated in that a person in defendant's situation would receive an enhancement of only one year if the prior robbery conviction is charged under section 667.5, subdivision (b), but would receive an enhancement of five years if the same prior is charged under section 667.
[8]  In Wallace, the court observed that the equal protection clauses in the federal and state Constitutions preclude "intentional and purposeful" invidious discrimination in the enforcement of penal laws. However, no such claim is made in the present case and there is nothing in this record that would support such a claim. (People v. Wallace, supra, 169 Cal. App.3d at p. 411.)
[9]  Although not argued in his briefs, the following assertions were made at oral argument: (1) that the purpose of section 667 was to impose harsher sentences on "recidivists"; (2) that defendant was not truly a "recidivist" at the time of his second prior since there was not an intervening punishment between his first prior and his second prior; and (3) that although the language "brought and tried separately" seems to be clear, there must have been a "draftsman's oversight" because this language results in unequal treatment of defendants identically situated in terms of the number of priors. However, as discussed ante, section 667 does not treat similarly situated groups in disparate ways. The language of the statute is quite clear: A five-year enhancement will be imposed "for each such prior conviction on charges brought and tried separately." It does not require intervening punishment between the commitments of the priors, and it specifically states in subdivision (b): "There is no requirement of prior incarceration or commitment for this section to apply." Contrary to defendant's assertions, the result of this language is not absurd. If the enhancement were only to be imposed if there had been an intervening prison term, it would have been so worded. (See, e.g., Pen. Code, § 667.5 wherein the punishment for prison terms for new offenses is enhanced because of prior prison terms.)
