## Update on immigrant visa spillover

I previously wrote a post about the prospect of spillover of unused FB immigrant visas due to Trump’s immigrant visa ban to the EB quota. A lot of the information in that post was not accurate but I now have a better understanding of the situation so I am writing this update.

In a recent webinar with IIUSA (read a summary here), Charlie Oppenheim estimated that in FY 2021 (starting Oct 1, 2020), there will be at least 200,000 EB green cards available. That is, at least 60,000 out of the 226,000 FB visas available in FY 2020 will not be issued before the end of FY 2020, therefore, they will be added to the FY 2021 EB quota. This is good news for backlogged EB applicants, although some users on Trackitt have been asserting that the spillover would be sufficient to move the EB2 India date ahead several years, and that doesn’t seem to be correct. (But I’ll address this issue later in this post.)

I previously wrote that I wasn’t sure whether any spillover was going to happen at all—aren’t there enough applicants already inside the US to consume the FB numbers that cannot be used by applicants abroad? There had been speculation that the State Department was cooking the books in order to avoid issuing visas that they are legally required to issue. However, in the IIUSA webinar, Charlie explained that even the EB numbers will likely not be used up this year because of limited USCIS processing capacity. This suggests to me that the State Department has not been cooking the books in order to favour EB applicants over FB applicants. It is just that there is not enough processing capacity to use up the visas in either category. (Some people still, after all this time, think that Trump likes skilled immigrants. At this point, I don’t think there’s anything I can say to convince them that they’re wrong.)

One might wonder whether the unused EB visas this fiscal year will spill over to FB. The answer is sort of, but no. I claimed in my previous post that any unused EB visas will spill over to FB, and if they are still not used in FB the next year then they will spill over to EB again, and so on until the visas are used. It was pointed out to me that this could not possibly be true, because if it were true then it would have been possible to issue many more EB visas than have been issued to date. I looked into the issue a bit more, and it turns out that Congress wrote the EB to FB spillover rule in a way that makes it nearly impossible for FB to actually get any extra visas. The reason for this is that the FB quota is calculated using the formula MAX(226000, 480000 – IR + SO). Here, SO stands for the number of unused EB visas from the previous fiscal year, and IR stands for the number of immediate relative visas used during the previous fiscal year. In recent years, IR has generally been approximately 500,000. Because of this, it’s unlikely for us to ever see a situation where 480,000 – IR + SO is greater than 226,000. So, if Trump finds some way to get away with wasting a large number of EB visas (up to ~200,000 or so), he can make those visas permanently disappear.

Will Trump waste lots of EB visas in FY 2021? Maybe, maybe not. If USCIS tries to do so without reasonable justification, then I believe they will be subject to a lawsuit (which they will lose). But if they are able to claim that they don’t have enough processing capacity to process the additional EB adjustments that people would like to file in FY 2021, then I guess they will be able to get away with not issuing the green cards. Whether they will have enough capacity depends on what they will do with FB applicants in FY 2021 (I will discuss this issue in the next paragraph).

The immigrant visa ban was extended last week, so that it will now continue through December. This again puts the FB applicants who are inside the US in a bad situation—for the same reason why DOS/DHS didn’t advance the FB cutoff dates rapidly in the June and July bulletins, I guess they still won’t do so in August, because again, allowing a flood of filings in August would result in most of those filings still being pending at the end of December. If the immigrant visa ban were not extended beyond December, the result would be that the visas would become available to applicants outside the US again, which would mean that the extra filings from people inside the US would again be subject to retrogression (possibly for many years). So I think that’s why it’s not going to happen. I suppose that if Trump gets re-elected and he continues extending the EO in 6-month increments, then DOS/DHS may have cover to indefinitely continue refusing to advance the dates more rapidly (based on the theoretical prospect of the ban ending in 6 months), drastically reducing the total number of FB visas that are issued in the next few years. This is another devious strategy that I imagine Miller may have devised. I think Congress should try to prevent this by changing the spillover rules. One attempt to do so is found in the HEROES Act, which is pending before the Senate, but I have no idea whether it’s likely to pass.

One other issue that I want to discuss is the allocation of the spilled-over visas in the EB categories. I discussed this issue a bit in my previous post, but I took some time to look into the issue more closely. There are some rules in INA 202 (8 USC §1152) that govern how the extra visas should be allocated to backlogged countries. First, (a)(3) says that if, after limiting each country to 7% of the total number of FB and EB visas, there is not enough demand to use up all the preference visas, then the remaining visas can be issued beyond the 7% limitation. In other words, DOS can advance the cutoff dates for that country. If there are multiple backlogged countries with demand for visas that were unused by the rest of the world, then DOS should attempt to allocate the extra visas to those countries according to the following rule: if natives of that country receive X% of the FB visas and Y% of the EB visas, then they should try to make X and Y as close as possible. In a typical year that means 1.61 FB visas should be issued for every one EB visa, to natives of any particular country. If a backlogged country is above that ratio, then it should get extra EB visas while the extra FB visas should be allocated to other backlogged countries; if it is below the ratio, then it should get extra FB visas while the extra EB visas should be allocated to other backlogged countries. Since preference immigrants from Mexico and the Philippines are overwhelmingly family-based while preference immigrants from India and China are overwhelmingly employment-based, it follows that, contrary to popular belief, Mexico and the Philippines should actually receive priority over India and China for EB visas that are not used by the rest of the world.

Then there is paragraph (a)(5)(A): If, after limiting each country to 7% of the total number of FB and EB visas, there is not enough demand to use up all the visas in any of the five EB preference categories, then the remaining visas in that preference category can be issued beyond the 7% limitation. This basically reiterates that there should not be wasted visas in any single preference category as long as there is sufficient demand for those visas. Thus, even though Mexico and the Philippines should receive priority over India and China for unused EB visas, because of the fact that Mexico and the Philippines have no EB-1 or EB-2 backlog anyway, it follows that all the extra EB-1 and EB-2 visas will be issued to Indians and Chinese.

The most confusing paragraphs are (e)(3) and (a)(5)(B). (e)(3) is another balancing rule similar to (e)(1), but here we are balancing across EB preference levels rather than between FB and EB. That is, if (a)(5)(A) allows extra EB visas to be issued to natives of a particular country, then DOS should attempt to make R_1 … R_5 as close to each other as possible, where R_i is the fraction of the EB-i visas that are issued to natives of that particular country. However, it’s not clear to me exactly what single metric is supposed to be optimized here by the allocation. (a)(5)(B) is some sort of limitation on (e)(3) that I am totally unable to understand.

So, after looking at these paragraphs, I’ve concluded that I have absolutely no idea how to answer the following questions: when Rest of World does not use up all the EB1 and EB2 visas, how many EB1 visas go to China and how many go to India, and how many EB2 visas go to China and how many go to India? People seem to assume that whatever EB2 visas are not used by Rest of World should just all go to Indians since they have the earliest priority dates, and that whatever EB1 visas are not used by Rest of World should similarly go to Indians until the Indian cutoff date catches up with the Chinese cutoff date at which point the two should be advanced in lockstep. However, I don’t think this is what INA 202 requires, but I have no idea what INA 202 does require.

All I know is that in FY 2021, backlogged EB applicants will receive a massive spillover; 2/7 of the the spilled-over visas will be distributed to EB1, 2/7 to EB2, and 2/7 to EB3; and Rest of World will almost certainly not use up all the EB1 and EB2 visas, just as they have not done so for the past few years, and that means extra visas for India and China, according to some distribution that I cannot predict. Maybe if I have time, I’ll try to file a Freedom of Information request with the State Department to get a hold of any internal documents they have that explain how this works. But if it’s all inside Charlie’s head, then there won’t be any documents to release.

[1] Well, I guess it was probably Miller who made the decision. Actually, I have to wonder whether Miller was responsible for the timing of the ban. If it had been announced later, there would not be as many visas left to waste in the year. If it had been announced earlier, there would be more time to process adjustments, so there would be less of an excuse to waste visas. Miller probably knows more about US immigration law as I do, so if I could see how the end of April was a particularly devious time to issue the ban, he probably could have seen that too. But I digress.

Posted in Uncategorized | 1 Comment

## Legal speculation about recent visa bans

I previously published an FAQ about President Trump’s immigrant visa ban and work visa ban. You can read it here. The detailed answers to the questions therein are given on my US immigration FAQ on GitHub and backed by authoritative sources and reasoning. But some people also have questions whose answers are of a more speculative nature. This blog post addresses those questions.

Q1: What does section 5(b) of the work visa ban mean?

A1: Section 5(b) refers to the requirements of the Immigration and Nationality Act that employers petitioning for a green card in the EB3 or EB2 categories (excepting National Interest Waiver applicants) must obtain a labor certification (LC/PERM) and employers petitioning for H-1B status must file an labor condition application (LCA).

For an LC to be approved, the employer must demonstrate that there are not sufficient workers who are able, willing, qualified, and available (thus necessitating the importation of a permanent foreign worker) and that the employment of the foreign worker will not adversely affect the wages and working conditions of similarly employed workers in the US. For an LCA to be approved, the employer must demonstrate that it is offering at least the prevailing wage and that the H-1B worker will be employed under working conditions that will not adversely affect the working conditions of other workers similarly employed. The Department of Labor shall determine, in both cases, whether the employer has met the burden of proof.

Thus, the meaning of section 5(b) of the proclamation is that Trump is not sure whether the existing LC/LCA process is sufficiently stringent to guarantee that the EB2/EB3/H-1B programs do not disadvantage US workers in violation of the INA and that he would like the Department of Labor and DHS to consider whether new, more stringent regulations should be promulgated governing the LC and LCA/I-129 processes.

Q2: If Trump does publish new LC/LCA regulations, can they be used to retroactively revoke green cards and H-1B status?

A2: Although the text does extend to aliens who have been admittedpursuant to an EB-2 or EB-3 immigrant visa, there is absolutely no chance that the courts will allow Trump to deport people who already have green cards just because he thinks that the previous regulations that allowed them to obtain a labor certification were not stringent enough, and I believe that Trump knows that, and he will not try to fight a battle that he cannot win.

In the case of H-1B workers, I think there is some legal argument that Trump could force some of them to leave if he believes that the LCA/I-129 process was not stringent enough, by ordering the Secretary of State to issue new regulations to revoke their visas under INA 221(i) and INA 237(a)(1)(B). I don’t expect him to actually do this, however, because it would be much easier to just deny extensions based on the new LCA/I-129 regulations. This would have a measurable effect of gradually reducing the number of H-1B workers in the US without going through protracted litigation related to the use of INA 221(i) and INA 237(a)(1)(B).

Q3: If Trump does publish new LC regulations, can he require I-485 applicants to undergo the new process prior to approval?

A3: If the regulation required aliens who had already submitted form I-485 (prior to the new regulations going into effect) to undergo recertification prior to I-485 approval, I think there’s about a 75% chance that such a provision would be illegal. Under AC21 106(c) (INA 204(j)/8 USC 1154(j)), an alien who has already filed an I-485 may, after 180 days have elapsed, switch to another job in the same occupation or a similar occupation without having to obtain a new labor certification. I think there’s a strong argument that if Congress has mandated that the alien can even take up a different job without a new labor market test, then the employer certainly cannot be required to perform a second labor market test for the same alien when it has already done so in the past. I don’t think such a requirement would be legal even if it contained an 180-day exemption. The reason for the 180-day waiting period is to merely ensure that the alien acted in good faith at the time of filing, and did not use that particular employer just so they could jump to another employer without redoing the green card process. If an alien whose I-485 had been pending for any length of time, whether greater or less than 180 days, were forced to undergo labor certification a second time prior to approval, I think that would violate the Congressional intent behind AC21.

Q4: If Trump does publish new LC regulations, can he use them to revoke I-140s that have already been approved, or require a new I-140 to be approved before proceeding to adjustment of status or immigrant visa processing?

A4: These questions seem to be closely related. I would guess that the courts would either allow both, or allow neither. I am not familiar enough with the Administrative Procedure Act, the applicable jurisprudence regarding retroactive application of regulations, and so on to even venture a vague guess as to whether the courts could strike down such regulations on those grounds. I did, however, find one news article in which an immigration lawyer argues that such regulations would violate INA 212(a)(5)(A) and AC21.

Q5: How is Trump’s proposal to allocate H-1B visas based on salary going to work?

A5: It has been reported that Trump wants to scrap the H-1B lottery and replace it with a system where the visas are allocated based on highest salary. No details of the plan have been released yet. The administration has not even said whether the system would attempt to normalize salary according to the geographical location and the occupation. (If such normalization is not done, then almost all of the visas would go to tech companies in Silicon Valley, Seattle, and NYC; other regions and industries, which also need H-1B workers, would not be able to compete.) In any case, regardless of how the system works, it is not clear whether it would be legal. The INA does not allow the limited pool of H-1B visas to be distributed based on salary; it simply specifies that once the quota runs out for a given fiscal year, no more aliens can be issued H-1B visas or H-1B status during that fiscal year. Thus, in the past, employers who did not file an H-1B petition early enough would not be able to import their desired candidate until the new quota became available for the following fiscal year, since all the visas would have been consumed already. Eventually, it got to the point where the number of petitions that were filed within the first week of the filing window was already enough to use up the entire quota for the year, so a random lottery system was introduced. One can justify the lottery as follows: It would be sort of silly if one petition that was delivered in the mail to USCIS on April 1st, 1 hour before another petition, received precedence on that basis. So instead, USCIS will take all petitions received in the first week of the filing window, and process them according to the legal fiction that some of them are randomly determined to have arrived earlier than others. If the Trump administration instead decided that the petitions with higher salary should be considered to have arrived earlier than others, he would be essentially introducing an adjudicative criterion that has no basis in the INA, so the courts probably would not allow this change, but I am not totally sure.

Q6: How likely is it that litigation against the immigrant visa ban and the work visa ban will succeed?

A6: In the immigrant visa ban case, the argument is essentially that Congress intended for a certain number of immigrant visas to be available per year in each category for family reunification, employment, and diversity, and that Trump should not be allowed to unilaterally reduce those numbers to zero using INA 212(f). My personal opinion is that the Supreme Court will let him get away with it based on the same reasoning as in the Trump v. Hawaii case, but that is just my personal speculation, and many actual lawyers disagree. In the work visa ban case, there are similar arguments, but there is also an additional argument that the ban violates the General Agreement on Trade in Services (GATS). The relationship between GATS and H-1B and L-1 visas is discussed here. However, it is not clear whether GATS is binding as a matter of domestic law. This issue is way beyond my depth, so I can’t really estimate the probability of this legal argument working, other than to say that it’s greater than zero.

Q7: What happened to Trump’s proposal to raise the fees for H-1B petitions to $20,000? A7: The existence of such a proposal is merely speculative. Trump has not indicated that he plans on taking such an action. If he did attempt to do so, it could be argued that it would violate GATS (see previous Q/A). It could also be argued to be subverting Congressional intent of allowing the visas to be issued. (For example, if Trump made the fee$10 million, then it would obviously be an attempt to indirectly ban the approval of H-1B petitions, so the courts would not allow that. Whether they would allow a \$20,000 fee is not totally clear, but I’m leaning toward no. On the other hand, a small fee increase would be completely legal, since Trump could argue that its purpose is to allow USCIS to recover the costs associated with whatever extreme vetting he wants them to do.)

Q8: What happened to Trump’s proposal to ban H-1B extensions for jobs that pay level 1 wages?

A8: Again, the existence of such a proposal, to not grant H-1B extensions for workers being paid level 1 wages unless their employer offered at least level 2 wages in the extension petition, is merely speculative. I think there’s about a 90% chance that such a regulation would be illegal, if it were to be published. Congress has set the criteria for aliens to obtain H-1B status, and the executive branch is responsible for devising a process, and promulgating regulations, to determine whether aliens seeking H-1B status meet those criteria. The executive has wide latitude in doing so, but may not invent new regulatory criteria out of thin air that are unrelated to the statutory criteria set by Congress. If Trump finds that allowing H-1B workers to remain at level 1 wages in a particular area, for a particular occupation, adversely affects US workers in that occupation in that area, then perhaps it would be within his authority to order the Department of Labor to not approve such extensions for that particular occupation, in that particular geographical area, pursuant to INA 212(n)(1)(A). But I think the statute requires such a determination to be made individually with respect to each occupation and each geographical area; Trump cannot thus issue a blanket finding with respect to level 1 wages across all areas and occupations.

Q9: Is Trump still planning to rescind the H-4 EAD rule?

A9: No word on that, but probably.

Q10: What about the proposed changes to the OPT program?

A10: There has been speculation that Trump is planning to eliminate or shorten the STEM OPT extension, or to limit it to particular sectors, or to limit it to students who graduate at the top of their class. Since the STEM OPT extension was created purely by regulation, and not statute, these changes would be fully within Trump’s authority to enact. However, until he actually publishes the regulations, we won’t know whether he is going to do it at all, and if so, what the provisions are.

Q11: Could Trump stop issuing EADs to individuals with pending Adjustment of Status applications, thus eliminating the employment authorization of tens of thousands of aliens who are in the backlog waiting for a green card?

A11: Yes, that’s a regulatory change that would be within his authority to enact, since the AOS EAD was created by regulation in 1981 and not by statute. The notice in the Federal Register explained that these individuals will receive unrestricted employment authorization soon anyway (since they will have a green card), so that it made sense for INS to grant some such individuals (who might not otherwise have a means of obtaining employment authorization for supporting themselves in the US) an EAD at its own discretion. But Trump could very well argue that such discretion should generally not be exercised favourably due to the current unemployment crisis, and use that as a justification for eliminating the AOS EAD at least temporarily (though, as the Supreme Court’s recent DACA decision indicated, he would at least need to consider reliance interests as part of the rulemaking process). Despite the fact that Trump could very well do this, I currently don’t expect him to. Even the speculations based on supposed leaks of would be in the work visa ban did not suggest that Trump was considering such an action.

Today, the Supreme Court issued a 5–4 ruling that the Trump administration’s rescission of the DACA program was unlawful. The opinion of the Court was delivered by Roberts, with Ginsburg, Breyer, and Kagan joining in full, and Sotomayor concurring as to the result. You can read the ruling here.

Last year, I correctly predicted how the justices would vote. Now it’s time to give some further comments about the ruling.

First, the Court did not rule on whether DACA is actually legal. In fact, the Court held that Attorney General’s finding that DACA is illegal provides a justification for rescinding the associated benefits such as work authorization (but not the grant of deferred action itself). However, DHS still must consider reliance interests before promulgating the rescission of benefits. DHS also did not provide adequate justification for the rescission of the entire program, as there had not been a finding of illegality of the deferred action itself.

Second, the Court did not rule that DACA rescission needs to go through the notice-and-comment rulemaking procedure. In fact, it noted that such claims were already raised in the lower courts and rejected there. For example, the 9th circuit concluded in DHS v. Regents of UC that both the creation of DACA, and its rescission, are general statements of policy and are thus exempt from notice-and-comment. This fact is very important, because notice-and-comment requires at least a 30 day period for the public to submit comments, and the agency is required to review every single comment and address the substantive subject matter of those comments in its rulemaking. In practice, this is usually done by categorizing the comments according to their key points and responding to each point identified, as obviously, it would not be practical to provide a response to each comment separately. Still, given that a hypothetical notice of proposed rulemaking regarding DACA would likely attract hundreds of thousands of public comments, it would take DHS several months to review and categorize all the comments. Because the Court ruled that this procedure is not required, DHS could potentially move much faster.

Third, the Court also did not specify the detailed requirements that a rescission would need to satisfy in order to be lawful. It notes that DHS should consider reliance interests in determining how the wind-down should be performed—for example, in considering the reliance interests, DHS could have decided on a longer transition period or provided for case-by-case discretion. But after balancing all relevant considerations, DHS is not required to arrive at any particular conclusion.

Fourth, as the Court did not rule today on whether DACA is legal or not, I believe that if an entity had standing to challenge DACA itself, arguing that it’s unconstitutional for the executive branch to grant deferred action in such a form and that the plaintiff were injured by this action, then there’s still some possibility that the Court could make such a ruling in the future. The kind of entity with the strongest claim to standing would be a State, as in the United States v. Texas case regarding DAPA and the DACA expansion. I don’t think it’s likely that a State will actually mount such a challenge against DACA, because even a majority of Republicans support DACA now. But there could potentially be other entities with standing, such as workers alleging that DACA unlawfully increases competition for jobs (cf. the Save Jobs USA lawsuit regarding the H-4 EAD program).

Where does this leave us? Basically, it means DHS could issue a new memo rescinding DACA, but they must provide sufficient justifications for both the rescission of the deferred action itself and the associated benefits. DHS could potentially act quickly to issue a new memo, in which it makes a finding, based on law, that it lacks the authority to grant deferred action, and, after considering reliance interests and other relevant considerations, determines that DHS will end DACA. But what form would that take?

DHS could move to immediately end the DACA program and revoke all existing EADs granted under it, rendering all current DACA beneficiaries potentially subject to immediate deportation and making it illegal for their current employers to keep them on the payroll.

Or, DHS could announce that they will stop accepting new applications and renewals after some transition period (maybe 6 months, maybe more, maybe less). In that case, some grants of deferred action would begin to expire within 6 months (as one can renew up to 6 months in advance of expiration), which gets us almost to the end of Trump’s term. In that case, if Biden wins the election in November, the damage done to DACA will have been minimal.

Between the two options, I think the latter is much more likely. This is for two reasons. First, the former option would make the administration more vulnerable to further legal challenges based on allegations that the rationale provided was not sufficient to justify such extreme action (notwithstanding the fact that the administration might ultimately prevail in that case). Second, by taking the latter option, Trump can emphasize that he’s doing as much as he can to fulfill his promise of enforcing the immigration laws, but his efforts will prove futile unless he is elected to a second term. This would be a smart political strategy for him.

In conclusion, if you support DACA, then be sure to do your part in getting Biden elected in November and flipping the Senate. (While non-citizens cannot vote and cannot legally spend money on or donate for the purpose of electioneering communications, we can still do our part in raising awareness and advocating for what we believe in.) If Trump is re-elected, then not only does he have more than enough time to end DACA legally, but he could also potentially replace Justice Ginsburg, without whom today’s ruling would not have been possible. If Trump loses but the GOP manages to keep 51 seats in the Senate, then Mitch McConnell will block any efforts at immigration reform and the future of DACA recipients will remain uncertain. There would also be a small risk that SCOTUS would revisit DACA and end it for good, over the objections of the Biden administration. In that case, the administration could still do a lot to delay deportations, but would be enjoined from issuing work permits, which would severely limit the options for DACA people to support themselves.

## How does immigrant visa spillover work?

Update (June 27, 2020): Some of the information in this post is inaccurate. See this newer post for corrections and clarifications.

There has been some recent speculation that 52,000 visas could spill over from the family-based quota to the employment-based quota due to Trump’s recent executive order to ban immigrants from entering the US for 60 days (which many people believe will be extended, perhaps until the election or even longer). There have been many arguments about the mechanics of spillover on Trackitt, an immigration forum largely populated by Indian people, who face very long backlogs for employment-based immigrant visas. However, the law is quite clear, so much of the controversy seems unnecessary.

### Where did the 52,000 figure come from?

The figure of 52,000 comes from a tweet by the Migration Policy Institute that 26,000 green cards would be blocked by the EO during each month it remains in effect, which means 52,000 over a period of 60 days. The MPI doesn’t explain their methodology, but I think we can draw some inferences.

The MPI seems to have gotten the 26,000 figure by taking the total of 315,403 and dividing by 12. This total includes family-based, employment-based, and diversity visas. So we can immediately conclude that MPI did not estimate 52,000 family-based immigrants would be blocked. That was, rather, their total estimate across all three categories. Rather, their estimate is that 5,565 immediate relative immigrants and 15,409 family-based preference immigrants would be blocked per month.

Second, the MPI’s figures look very similar to the official State Department figures for immigrant visas issued abroad in 2019. For example, the MPI’s estimate of 3,432 for EB-2 is very close to the State Department figure of 3,497 EB-2 immigrant visas issued in 2019, which is substantially less than the actual annual EB-2 quota of roughly 40,000. From this we can infer that the MPI numbers mean something like we estimate that 52,000 people who would have received immigrant visas over the next 60 days, now will not as a result of the EO.

This does not mean that 52,000 visas will go unused! Since the EO does not block green cards for applicants who are already in the US, there is a possibility that some or all of those 52,000 visas can be issued to applicants in the US, instead of the people outside the US who would have received them if not for the EO. (Note: An applicant in the US who receives a green card consumes an immigrant visa, but is not actually physically issued a visa.) The MPI figures simply do not answer the question of whether any immigrant visas will be unused this year.

### Will any family-based visas actually go unused this year?

The May 2020 visa bulletin was released on April 24, several days later than expected, since it could not be cleared for release until Trump’s executive order had been finalized. However, astute readers noticed that the date April 6, 2020 was printed at the bottom of the bulletin, suggesting that the cutoff dates had already been calculated by then. Indeed, the movement in cutoff dates was, perhaps, no more than would have been expected without the EO. For example, the F3 and F4 Mexico cutoff dates, which advanced 1 month in the April bulletin, again advanced 1 month in the May bulletin.

Now, in order to use up all the family-based visas for this fiscal year, the State Department must move the cutoff dates far enough ahead so that enough people are able to apply for their visas. Since most family-based applicants live outside the US, and many of them can no longer receive a visa due to the EO, it is necessary to move the cutoff dates more quickly so the visas can instead be used by applicants inside the US. The fact that this does not seem to have happened has made some immigration lawyers concerned. However, until the June 2020 visa bulletin is released, it’s too early to panic—again, the May 2020 cutoff dates may simply not have taken into account the EO yet. (Update (June 27, 2020): It looks like they decided not to move the dates rapidly. See the newer post linked at the top of this post for a possible explanation of why.)

Most family-based immigrants on the waiting list are outside the US. This is because most of them cannot easily obtain a long-term visa, such as a student visa or work visa, that would enable them to live in the US while they wait for an immigrant visa to become available. This fact has led some to speculate whether there are just not enough of them inside the US to use up the rest of the family-based immigration quota for the current fiscal year. For example, if, hypothetically speaking (I am just pulling numbers out of thin air here), 120,000 of the 226,000 family-based immigrant visas this year had already been issued, and there were 85,000 remaining applicants waiting inside the US, then at least 21,000 visas would go unused. However, I don’t think that this is the case. (Update (June 27, 2020): Since they decided not to move the dates rapidly, this paragraph is moot. Most of the applicants inside the US will not receive a green card this year even though green cards should be available to them. See the newer post linked at the top of this post.)

Greg Siskind, an immigration lawyer, has made the following comment that most casual readers won’t understand: They could have moved all the Mexican categories to May 2001 (they’re backed up to the 90s except F2A) so that the 245i folks in the US could file adjustments to fill in the gap from IV processing abroad. Siskind is referring to INA 245(i), which, in short, allows certain people with priority dates earlier than May 2001 to obtain a green card even if they are currently residing in the US without authorization. In other words, if the State Department is having a hard time issuing all the remaining family-based visas this year, they should advance the Mexico cutoff dates, possibly all the way up to May 2001, to give more people a chance to apply, as there is probably a substantial population of Mexicans inside the US who may be eligible for green cards under INA 245(i). The number of such individuals is impossible to determine accurately, so the State Department cannot in good faith say well, we tried to issue all the visas available, but we couldn’t do so because of the EO unless they’ve given all the 245(i) folks an opportunity to apply. (Update (June 27, 2020): Looks like this paragraph is wrong—they are not allowing these people to apply, most likely because any application filed in May or later could not be approved by the end of September anyway. See the newer post linked at the top of this post.)

Some immigration lawyers think that the administration is going to try to waste family-based visas on purpose as part of their agenda to curtail immigration. If the June 2020 visa bulletin rolls around and it really does seem that they are not making an effort to advance the dates, then it is likely that immigrant advocate groups will have some members of Congress ask the State Department why they are not on track to issue all the visas to eligible applicants—and there may be legal challenges if the answer is not satisfactory. So I believe that while some family-based visas may go unused this year, the chances of the number being significantly affected by the EO are slim (i.e., there is a slim chance that any judicial relief gets held up until after the end of the fiscal year). (We should note that there was already some spillover into the employment-based quota this year, indicating that not all of last year’s family-based visas were used. Nobody seems to know exactly why, so the same might happen this year, EO or no EO.) (Update (June 27, 2020): Looks like I was wrong; a massive number of FB green cards will go unused this year. See the newer post linked at the top of this post.)

### If some visas are unused, would they actually spill over?

According to INA 201(d)(1)(B), if the full quota of family-based visas is not used up in this fiscal year, then the unused numbers are added to next year’s employment-based immigration quota. While Trump can suspend issuance of visas pursuant to INA 212(f), he is without power to block the spillover provisions. Even if Trump takes further actions to block issuance of employment-based green cards next year, in an effort to prevent immigrants from benefitting from the spillover, he cannot actually waste any green cards. If the spilled-over numbers, added to the employment-based quota next year, are not used, they will just spill over as family-based quota the following year, and so on indefinitely back and forth between the two categories until either Trump is out of office, or Congress changes the law. (Update (June 27, 2020): This is wrong. If the visas spill over from FB to EB, but then they are not used in EB, then they will actually be lost. See the newer post linked at the top of this post.)

Unused diversity visa numbers, however, do not spill over. They are neither added to next year’s diversity visa quota, or to any other category.

### If visas spill over to employment-based immigrants, how will they be allocated?

INA 201(d)(1)(B) prescribes the worldwide level of employment-based immigrants. INA 203(b) prescribes that the worldwide level shall be allocated as follows: 2/7 to EB-1, 2/7 to EB-2, 2/7 to EB-3, 1/14 to EB-4, and 1/14 to EB-5. Some people have speculated that the spillover visas will all go to the most backlogged people, namely Indian-born EB-2 applicants; this is false. Some have speculated that the spillover visas will all go to EB-1; this is also false. The EB-2 and EB-3 quotas will increase proportionally. This is very clear from the statute; there is no ambiguity. Some have speculated that none of the spillover numbers can be allocated to Indians because the number of available visas for natives of any single country is fixed. This is also false, since the 7% limitation applies to the total worldwide level of preference-based immigrants according to INA 202(a)(2), which, as previously mentioned, is not a fixed number but, according to INA 201, depends on how many visas spilled over from the previous year.

Thus, if any numbers spill over, then the State Department will allocate them the same way they would have allocated the usual quota—just with all the numbers scaled up proportionally. Because EB-1 Rest of World is unlikely to use up all the numbers (whether there is spillover or no spillover), that means that the spilled-over visas allocated to EB-1 (namely 2/7 of the total) will mostly go to the most backlogged (i.e., Indian-born applicants) due to INA 202(a)(5). Another 2/7 would spill over to EB-2, which would also be allocated in the usual way, but if Rest of World does not use up all the EB-2 numbers, then any additional numbers would again be allocated to India. In EB-3, demand from Rest of World exceeds supply, so if current patterns continue, then EB-3 China and EB-3 India would likely only receive 7% of any spilled-over numbers. (Update (June 27, 2020): I’m not sure whether the most backlogged rule is correct. So I don’t know how the extra EB-1 and EB-2 visas will be divided between China and India. See the newer post linked at the top of this post.)

### Conclusion

It’s not likely that there will be any unused family-based visas to spill over. But if there are any unused family-based visas, they will spill over to employment-based immigrants and Trump cannot prevent that. If such spillover does occur, then it will be distributed evenly to EB-1, EB-2, and EB-3, and within each preference level, Rest of World will still be entitled to 86% of the spilled-over visas, which will only go to India if there are not enough Rest of World applicants. Thus, spillover could significantly benefit EB-1 India and EB- 3 Rest of World, whereas EB-3 India and all three Chinese categories would likely receive little benefit (though EB-5 is another story). The EB-2 Rest of World and EB-2 India situations are harder to predict (although EB-2 India is so backlogged that even if it does end up receiving additional unused numbers from EB-2 Rest of World, the movement will still not be that much). (Update (June 27, 2020): I’m not sure whether this is correct anymore; EB1 and EB2 China may receive more visas than I expected, but the truth is that I just don’t know. See the newer post linked at the top of this post.)

Posted in Uncategorized | 2 Comments

## Armchair lawyering about the recent EO

The Attorney General of New York is making preparations to challenge Trump’s executive order banning most immigrants from entering the US “temporarily” under INA 212(f) (8 USC §1182(f)). I am sure there are various other groups also interested in filing legal challenges.

The order can be found here.

### Can the President ban all immigration?

Some commentators suggest that INA 212(f) doesn’t give the President authority to end all immigration. Here, all has been placed in quotation marks since the EO does not ban all immigration anyway; certain categories such as spouses of US citizens are exempted. The idea is that bans based on 212(f) that are too broad may not be allowable.

Yet, the text clearly says the President may suspend the entry of all aliens or any class of aliens.

Some argue that, while the Trump v. Hawaii case established that the President may ban all aliens from particular countries, that it would be contrary to the INA for the President to indefinitely end the issuance of visas in entire preference categories – for example, as Trump is banning all F4 immigrants (brothers and sisters of US citizens) from entering the US (unless they qualify for an exemption based on being in the US already) this could be argued to contravene an imagined intent of Congress in enacting INA 201 and INA 203 of making at least 65,000 F4 immigrant visas available each fiscal year.

This argument is essentially about timing: it is clear from the statute that the President may ban all aliens, but the argument is that this power could not be used to establish a ban of such duration that it would result in the visas allocated by Congress going wasted. I don’t think this argument is convincing. The statute does say the President can suspend entry for such period as he shall deem necessary, which is pretty close to explicitly saying there’s no limit on the President’s discretion to set the duration of the suspension.

### Is Trump’s use of INA 212(f) an unconstitutional delegation?

Congress is not constitutionally permitted to delegate its legislative power to the executive branch or any other entity, but may enact statutes that enable the executive branch to exercise discretion over policy, if it provides an intelligible principle. For example, in INA 212(a)(9)(B), Congress banned aliens from entering the United States if they were unlawfully present for more than 180 days, but granted the Attorney General discretion to waive this inadmissibility in certain cases if it would cause extreme hardship to a US citizen or LPR relative. In this case, the executive is permitted to set policy regarding which aliens can receive waivers, but Congress provided the guiding principle that the standard of eligibility for such waiver must be based on a level of extreme hardship.

A recent case in the United States District Court for the District of Oregon concerned whether Trump’s use of INA 212(f) to bar the entry of aliens who could not demonstrate that they would be able to obtain certain types of health insurance coverage (Case No. 3:19-cv-1743-SI). The plaintiffs in this case argued that this use of INA 212(f) involved an unconstitutional delegation. The court agreed and granted a preliminary injunction.

The court’s opinion stated that INA 212(f) is overbroad in delegation, providing no intelligible principle for the Presidents exercise of discretion, since the only condition is that the President must find that the entry of aliens would be detrimental to the interests of the United States. The court thus found that Congress cannot delegate power to the President in this manner. The defendants pointed out that Supreme Court precedent (Knauff v. Shaughnessy, 338 US 537 (1950)) established that the President’s inherent constitutional power over foreign affairs includes the power to restrict the entry of aliens (so that INA 212(f) confers little or no additional power upon the President but merely reaffirms power that the President already possesses). The district court’s opinion, however, was that such inherent power of the President over immigration does not extend to restricting immigration for domestic policy purposes (in contrast to e.g. national security or foreign relations concerns).

In my opinion, this type of argument, if it is raised in the cases concerning the present executive order, would not be likely to persuade the Supreme Court. I believe the Supreme Court would almost certainly find that the President’s inherent authority to restrict the entry of aliens is not limited only to situations implicate national security or foreign relations concerns.

### Conclusion

Based on what we know about the current Supreme Court, I think it’s overwhelmingly unlikely that they would strike down the recent EO. In fact, I think it’s very likely that they would quickly reverse any stay of the EO issued by a lower court. I think it’s almost irresponsible for the mainstream media to give false hope to immigrants that a court challenge would be likely to succeed. Then again, there are actual legal experts who disagree with me, so take this with a grain of salt.

## Why Chinese people should support HR1044/S386

In discourse about HR1044/S386, there is a myth that Chinese people don’t support removing the per-country caps. I can tell you that this is false. I’m Chinese and I support it.

Not only is it the right thing to do, but even for purely selfish reasons, I should still support it. Imagine if the per-country caps had never existed in the first place. There are two possible scenarios. One is that the waiting time for Chinese would be shorter than it is now, and I would already have a green card. That’s obviously a win. What about the other scenario? What if there were more applicants in the alternate universe, so waiting times were 5+ years for everyone, rather than 3–4 years for Chinese?

Well, I would rather live in that world—where everyone waits 5+ years—than in this one, where I’m disadvantaged by longer waiting times. Any factor that puts me at a disadvantage relative to other people threatens my well-being in a competitive globalized economy.

Right now, I have the opportunity to work for many of the top companies in the United States because they can sponsor me for H-1B status. However, there is no guarantee that this will continue to be the case. My bachelor’s degree is not in computer science, and I’ve already received two RFEs (in which USCIS asked my company’s lawyers to provide more evidence that I’m actually eligible for TN and H-1B status). The Trump administration has increased scrutiny on H-1B applications, and determined that junior software engineering positions should not be presumed to be eligible for the H-1B classification. The word on the streets is that scrutiny has increased for H-1B applicants who don’t have CS degrees, so I can expect this situation to persist in the near future. No one can predict the Trump administration’s next moves, and the probability that they will change the regulations so that I’m simply not eligible to be an H-1B software engineer anymore—either because I don’t have a CS degree, or because we just can’t prove that my job is complex enough to merit an H-1B—is non-negligible. Of course, if I already had a green card, then any such future changes wouldn’t affect me.

I live in constant fear that I am going to have to leave the United States while others (including hundreds of thousands of my fellow Canadian citizens) continue to work for top US companies, getting the best possible experience, and I fall behind. As I said: this disadvantage would threaten my well-being in a competitive globalized economy. As long as the opportunities available in tech continue to expand, everything will be fine and dandy; but if a recession were to occur, limiting the availability of decent software engineering jobs, I would be in the unenviable position of having to compete with people with much better résumés for that limited set of openings. Chances are that I’d be forced to accept some demoralizing, low-paid position in a company that treats its software engineers like cogs and has frequent layoffs. (Never forget that Dilbert is a minor exaggeration of the reality of working as a software engineer in a company where software engineers can’t command respect.)

Some people think I’m overly anxious. I would say that we software engineers should remember how lucky we are right now. Do you see how other people our age, who are just as intelligent and hard-working as we are, struggle for economic security? One might say, there but for the grace of God go we.

I have often expressed my desire for a world with open borders, but we all know that’s not happening any time soon. For the time being, people who were born in United States, or otherwise acquired US citizenship at birth or through the naturalization of a parent, have an advantage over me in terms of access to the best software engineering opportunities, which handicaps me in the competition for the sharply limited availability of economic security in a neoliberal globalized economy. The effect of the per-country cap system is to also put me at a disadvantage relative to equally qualified individuals born in Canada or, say, Australia, Hong Kong, Taiwan, or South Korea. For this reason, I must support HR1044/S386, and that would remain true even if I had the animosity against Indian software engineers that many anti-HR1044/S386 people seem to have.

Posted in Uncategorized | 2 Comments

## INA 203(g) cancellation and DoL processing times

The Department of Labor is currently taking 4–5 months to process prevailing wage determination requests and 3–4 months to process permanent labor certifications. See here.

A few years ago, prevailing wage determinations only used to take about 6 weeks.

This increase in processing times has created an obscure possibility for me and other employment-based green card applicants to lose their place in line.

Because of my position in the queue, I’ll become eligible to apply for a green card in about 1.5 to 2 years from now. Once I become eligible, I have a 12 month deadline to file the final form (Form I-485) to apply for a green card. Due to INA 203(g) (8 USC §1153(g)), if I fail to file within this deadline, then I go to the back of the line and will probably have to wait another 3 years or so before I can file again.

Those of you who have gone through, or are going through the employment-based immigration process have probably already figured out why this is dangerous. For others, read on.

At the time of filing Form I-485, I have to have the intent to work for my sponsoring employer—the one that filed all the paperwork with the Department of Labor. Technically, I don’t have to be working for them when the form is filed, but they must be offering me either new or continuing employment in order for the I-485 to be approvable. So what happens if I’ve filed my I-485, it sits in a queue with USCIS for a few months, and then I get fired? The I-485 is effectively abandoned, and I have to find a new employer who has to file the same forms with the Department of Labor as the old employer did. And that’ll take another 7–9 months.

During that 7–9 month period, I won’t be able to file Form I-485. It will only be possible to file it after the DoL has approved all of the new employer’s paperwork. What this means is that while all this is happening, my 12 month clock may run out. Example: if Form I-485 has been pending for 5 months and my current employer fires me, then I have about 7 months left on the clock before USCIS says: hey, it’s been an entire year since the last time you applied for a green card even though you’ve been at the front of the line the whole time. So we’re sending you to the back of the line. See ya!

This analysis depends on a rather pessimistic interpretation of INA 203(g). In particular, you might wonder whether the 12 month clock should start over at the point at which I get fired, causing my I-485 to be abandoned. Let’s say this is the case. Then the 7–9 month processing time doesn’t seem as dangerous. But 3–5 months is not a lot of slack. It takes time to find a new job, to gather experience letters from previous co-workers, and for attorneys to draft the required forms. Furthermore, the Department of Labor sometimes randomly decides to audit permanent labor certification applications, adding an extra 3 months, in which case the total processing time becomes 10–12 months. In that case, it’s almost certain that the 12 month clock would run out during the time when paperwork is pending with DoL.

There is one safeguard against this possibility. If my I-485 has been pending for at least 180 days before I leave my employer, then the new employer doesn’t need to file any paperwork, so it’s all good. However, if I get fired within the first 180 days, then I’m possibly screwed. In the past, there would probably have been enough time to go through all the paperwork with the new employer. But given current processing times, there may not be.

Processing times are not likely to decrease in the next few years (particularly as I don’t especially trust the Democrats to nominate someone who can actually beat Trump in 2020), and the chances of Congress passing a fix to this situation—say, by extending the deadline in INA 203(g) from 12 months to 24 months—are virtually zero, because this issue is simply too obscure. If there is any legislative fix, it will have to come as part of a comprehensive immigration reform package—and don’t hold your breath for that either.

But hey, it’s not the end of the world. If it takes an extra 3 years to get my green card, at least I’m still working and getting paid during that time. Unless, of course, the Trump administration has made it virtually impossible to get H-1Bs by then. If that’s the case, I’d better hope to be married to an American by then…

## On solving problems for a living

Back when I was just an intern, spending my summers chilling out in the bay area (and doing work sometimes), I started reading Quora and noticed people debating whether the compensation for software engineering was disproportionate to the difficulty of the job. (I have no idea how long this debate has been going on.) It seemed pretty obvious to me back then the answer was yes, or, at least, that the actual difficulty of software engineering is much less than people think when they haven’t been exposed to the right opportunities to learn programming. It seemed inevitable that salaries would eventually fall as a result of more people being trained to enter the field.

But I saw a contrary point of view being expressed in the answers sometimes, namely that software engineering is stressful. Some of that, of course, is due to factors that are not universal, such as long hours and on-call rotations. But it was argued that the job is also demanding in other ways, such as the need to constantly learn new technologies and new developments in existing technologies. At the time, I don’t think I had the perspective to be able to understand this.

Now that I’ve been a full-time software engineer for almost three years, I think I’m starting to understand. I’m lucky to be on a team where I’m nearly free from certain stressors that my software engineer friends have to deal with, such as pager duty, daily scrums, and frequent meetings in general. But I also experience job-related stress of a particular kind, and I suspect this experience may be close to universal: it’s that I don’t know what the next problem is that needs to be solved, but I know I’ll have to do everything I can to solve it.

Almost all jobs involve problem-solving to some extent, but occupy different positions on a spectrum. On one end of the spectrum are jobs that involve performing a bounded set of responsibilities in some fixed way, such as working in a call centre where you just follow a script and transfer the caller to a specialist whenever that fails. Those jobs can often be extremely stressful due to the long hours, low pay, and general working conditions, but not due to the nature of the problems to be solved. Many jobs fall somewhere near the middle of the spectrum, consisting mostly of fixed responsibilities with some variability in challenges and some room to invent ideas for how to better perform those responsibilities. I would argue that software engineering stands at the far end of the spectrum, together with other traditionally highly compensated jobs such as that of the doctor or lawyer. For while a lecturer can present the same lecture twice to different audiences and a bus driver can drive along the same route twice on different days, a software engineer should not even write the same ten lines of code twice, or perform the same operations twice—they should be factoring out the code into reusable components and automating the operations.

It follows that if you still have a job as a software engineer, it is only because you are needed in order to deal with a never-ending stream of new problems that are qualitatively different from the ones you have solved before. And that means you have to constantly search for solutions to those problems. You cannot follow a fixed set of steps to try to solve the problems you are faced with, and claim that your responsibilities have been fulfilled. You have to apply your technical and creative skills to their fullest extent.

As I said, this makes software engineering comparable to practising medicine or law. Your job is not to apply some fixed set of techniques but to treat the patient or to win the case (or perhaps settle it favourably, yeah, yeah, I know) and you go to school for a long time so you can learn the knowledge needed to prepare a solution to the problem from first principles as it may be different in significant ways from cases that you have dealt with in the past. Being constantly challenged in this way is very likely to be stressful, particularly when you aren’t sure whether the problem even has a solution, or how you should feel about your own personal inability to solve it.

So I think when people argue that software engineers are disproportionately compensated, they should consider that people whose jobs consist of this kind of generalized problem solving within a broad domain do tend to be well-compensated and that this should not be unexpected when you consider the demands of those jobs (and I hardly hear anyone saying doctors are overpaid).

I wonder whether there are highly compensated jobs that are much closer to the other end of the spectrum, where you do more or less the same thing every day but you get paid a lot of money to do it. I suspect that a job of that type would be very desirable and that it could only continue to be well-compensated if it either had artificial barriers to entry or required skills that are difficult to acquire. If jobs in the former category existed in the past, they have probably mostly disappeared due to globalization and other forces eliminating such barriers. But perhaps there are jobs that fall into the second category.

Posted in Uncategorized | 2 Comments

## The inverse-square law of magnetism

The observation that opposite charges attract while like charges repel, with a force proportional to the inverse square of distance, motivates the study of electrostatics. Although we often don’t solve problems in electrostatics using Coulomb’s law directly, relying instead on Gauss’s law or on techniques for solving Poisson’s equation for the electric scalar potential, there is no physical information contained in those techniques that isn’t already in Coulomb’s law. Therefore, the entire field of electrostatics, including the introduction of the electric field $E$ itself, may be viewed as an exploration of the consequences of this basic fact about stationary electric charges (and continuous distributions thereof).

At the beginning of the chapter on magnetostatics in Introduction to Electrodynamics, Griffiths notes that parallel currents attract while antiparallel currents repel. You might think that he would go on to write down a law similar to Coulomb’s law that described this force between currents directly. However, this approach is not pursued. Instead, the magnetic field $B$ and the Lorentz force law are introduced right away. In a subsequent section, the Biot–Savart law is used to compute the magnetic field of a long straight wire, which is then immediately used to find the force between two wires.

There is a good reason for this, which I’ll get to at the end. There’s just one small problem, which is that it’s not clear that magnetism actually obeys an inverse-square law and that the force that wire 1 exerts on wire 2 is equal and opposite to the force that wire 2 exerts on wire 1. Students are also confused by being asked to use the right-hand rule to assign an apparently arbitrary direction to the magnetic field. It may appear that the universe prefers one handedness over the other for some strange reason (which, for what it’s worth, is true for the weak interactions, but not the electromagnetic).

If there were an analogue to Coulomb’s law for magnetostatics, it would become clear that the magnetic force obeys an inverse-square law, obeys Newton’s third law, and does not involve an arbitrary choice of handedness. Obviously I don’t mean the Biot–Savart law; I mean a law that gives the force between currents directly. In fact, we can derive such a law using basic knowledge of vector calculus. Recall that the Biot–Savart law gives the magnetic field at a point due to some given source distribution:
$\displaystyle B(x) = \frac{\mu_0}{4\pi} \int \frac{J(x') \times (x - x')}{\|x - x'\|^3} \, \mathrm{d}^3x'$
The force this exerts on some other current distribution $J(x)$ is given by applying the Lorentz force law and integrating again over $x$:
$\displaystyle F = \frac{\mu_0}{4\pi} \iint J(x) \times \frac{J(x') \times (x - x')}{\|x - x'\|^3} \, \mathrm{d}^3x' \, \mathrm{d}^3 x$
We can simplify this using the vector identity $A \times (B \times C) = B(A \cdot C) - C(A \cdot B)$:
$\displaystyle F = \frac{\mu_0}{4\pi} \iint J(x') \left(J(x) \cdot \frac{x - x'}{\|x - x'\|^3}\right) - (J(x) \cdot J(x')) \frac{x - x'}{\|x - x'\|^3} \, \mathrm{d}^3x' \, \mathrm{d}^3 x$
To see that the integral over the first term vanishes, we can first exchange the order of integration and pull $J(x')$ out of the inner integral, then observe that $(x - x')/\|x - x'\|^3$ is the gradient of $-1/\|x - x'\|$:
$\displaystyle \iint J(x') \left(J(x) \cdot \frac{x - x'}{\|x - x'\|^3}\right) \, \mathrm{d}^3 x' \, \mathrm{d}^3 x = \int J(x') \int J(x) \cdot \nabla(-\|x - x'\|^{-1}) \, \mathrm{d}^3 x \, \mathrm{d}^3 x'$
This allows us to perform integration by parts on the inner integral:
$\displaystyle \int J(x) \cdot \nabla(-\|x - x'\|^{-1}) \, \mathrm{d}^3 x = \\ -\int \|x - x'\|^{-1} J(x) \cdot \mathrm{d}a + \int (\nabla \cdot J(x))\|x - x'\|^{-1} \, \mathrm{d}^3 x$
where the surface integral is taken over some sufficiently large surface that completely encloses the current distribution $J(x)$ acted on and therefore vanishes, and the volume integral vanishes because the divergence is zero for a steady current. We conclude that:
$\displaystyle F = -\frac{\mu_0}{4\pi} \iint (J(x) \cdot J(x')) \frac{x - x'}{\|x - x'\|^3} \, \mathrm{d}^3x' \, \mathrm{d}^3 x$
This now reads very much like Coulomb’s law:
$\displaystyle F = \frac{1}{4\pi\epsilon_0} \iint \rho(x) \rho(x') \frac{x - x'}{\|x - x'\|^3} \, \mathrm{d}^3x' \, \mathrm{d}^3 x$
Both laws describe inverse-square forces that act along the line joining the two elements; the difference in signs is because like charges repel while like (parallel) currents attract. It is now easy to see that the force exerted on $J(x)$ by $J(x')$ is equal and opposite to the force exerted on $J(x')$ by $J(x)$. The right-hand rule does not appear anywhere. Parallel currents attract and antiparallel currents repel, period.

We can directly use this law to compute the force between two long, straight, parallel current-carrying wires. For such a problem we would use the version of the law expressed in terms of currents, $I$, rather than current densities, $J$. (I derived the law using current densities because it’s more general that way, and we can easily argue that we can go from $J$ to $I$ but it’s less obvious why the form involving $J$‘s should be true given the form involving $I$‘s.)
$\displaystyle F = -\frac{\mu_0 I_1 I_2 }{4\pi} \iint \frac{x - x'}{\|x - x'\|^3} \, \mathrm{d}\ell \cdot \mathrm{d}\ell'$
To get the force per unit length, we just compute the inner integral at $x = 0$. We know by symmetry that the force will be perpendicular to the wires, so we can just throw away the longitudinal component. And the two wires are everywhere parallel so $\mathrm{d}\ell \cdot \mathrm{d}\ell' = 1$. It’s then clear that
$\displaystyle \|F\|/L = \frac{\mu_0 I_1 I_2 }{4\pi} \int_{-\infty}^\infty \frac{d}{(d + x)^{3/2}} \, \mathrm{d}x = \frac{\mu_0 I_1 I_2 }{2\pi d}$
This is basically the same calculation that we would do with the Biot–Savart law and the Lorentz force law; it’s simply a bit more direct this way.

Still, if magnetism were introduced in this way, it would be necessary to get from the inverse square law to the field abstraction somehow. With electrostatics this is easy: we just pull out $\rho(x)$ and call everything else $E(x)$. With the inverse-square law for the magnetic force, we can try to do something like this. It’s a little bit trickier because the force also depends on the direction of the current element $J(x)$ (while charge density, of course, doesn’t have a direction). To represent an arbitrary linear function of $J(x)$ that gives the force density $f$ on the current element, we need to use a matrix field rather than a vector field:
$\displaystyle F = -\frac{\mu_0}{4\pi} \iint \left[\frac{x - x'}{\|x - x'\|^3} J^t(x')\right] J(x) \, \mathrm{d}^3x' \, \mathrm{d}^3 x = \int B(x)J(x) \, \mathrm{d}^3 x$
where the matrix field $B$ evidently satisfies
$\displaystyle B(x) = -\frac{\mu_0}{4\pi} \int \frac{x - x'}{\|x - x'\|^3} J^t(x') \, \mathrm{d}^3x'$
The problem is that what we’ve done here is, in some sense, misleading. The local law $f = BJ$ we may be tempted to conclude is not really true, in that $B(x)J(x)\, \mathrm{d}^3 x$ is not the real force density on the infinitesimal current element $J(x)$. In performing an integration by parts earlier, we essentially averaged out the term we wanted to get rid of over the entire target distribution. But this destroyed the information about what the true distribution of force is over the target current loop, with observable consequences unless the loop is rigid. In other words, we can only compute the total force on the loop, but not the stress tending to deform the loop. The true Lorentz force law that has the correct local information also has the form $f = BJ$, but the matrix $B$ is antisymmetric; we also need an antisymmetrization (wedge product) in the equation for $B$. It’s not clear to me whether it’s possible to get from the inverse-square law to the true Lorentz force law and the true Biot–Savart law, or whether the loss of local information was irreversible. So, as I said, there is a very good reason why we don’t just postulate the inverse-square law and take that as the basis for magnetostatics: it is (probably) actually incomplete in a way that Coulomb’s law is not. Still, I feel that it contains some useful intuition.

Posted in Uncategorized | 1 Comment

## K&R C

I was recently reading the C99 rationale (because why the fuck not) and I was intrigued by some comments that certain features were retired in C89, so I started wondering what other weird features existed in pre-standard C. Naturally, I decided to buy a copy of the first edition of The C Programming Language, which was published in 1978.

Here are the most interesting things I found in the book:

• The original hello, world program appears in this book on page 6.

In C, the program to print “hello, world” is

main()
{
printf("hello, world\n");
}

Note that return 0; was not necessary.

Write a program to replace each tab by the three-column sequence >, backspace, -, which prints as ᗒ, and each backspace by the similar sequence ᗕ. This makes tabs and backspaces visible.

… Wait, what? This made no sense to me at first glance. I guess the output device is assumed to literally be a teletypewriter, and backspace moves the carriage to the left and then the next character just gets overlaid on top of the one already printed there. Unbelievable!

• Function definitions looked like this:
power(x, n)
int x, n;
{
...
return(p);
}

The modern style, in which the argument types are given within the parentheses, didn’t exist in K&R C. The K&R style is still permitted even as of C11, but has been obsolete for many years. (N.B.: It has never been valid in C++, as far as I know.) Also note that the return value has been enclosed in parentheses. This was not required so the authors must have preferred this style for some reason (which is not given in the text). Nowadays it’s rare for experienced C programs to use parentheses when returning a simple expression.

• Because of the absence of function prototypes, if, say, you wanted to take the square root of an int, you had to explicitly cast to double, as in: sqrt((double) n) (p. 42). There were no implicit conversions to initialize function parameters; they were just passed as-is. Failing to cast would result in nonsense. (In modern C, of course, it’s undefined behaviour.)
• void didn’t exist in the book (although it did exist at some point before C89; see here, section 2.1). If a function had no useful value to return, you just left off the return type (so it would default to int). return;, with no value, was allowed in any function. The general rule is that it’s okay for a function not to return anything, as long as the calling function doesn’t try to use the return value. A special case of this was main, which is never shown returning a value; instead, section 7.7 (page 154) introduces the exit function and states that its argument’s value is made available to the calling process. So in K&R C it appears you had to call exit to do what is now usually accomplished by returning a value from main (though of course exit is useful for terminating the program when you’re not inside main).
• Naturally, since there was no void, void* didn’t exist, either. Stroustrup’s account (section 2.2) appears to leave it unclear whether C or C++ introduced void* first, although he does say it appeared in both languages at approximately the same time. The original implementation of the C memory allocator, given in section 8.7, returns char*. On page 133 there is a comment:

The question of the type declaration for alloc is a vexing one for any language that takes its type-checking seriously. In C, the best procedure is to declare that alloc returns a pointer to char, then explicitly coerce the pointer into the desired type with a cast.

(N.B.: void* behaves differently in ANSI C and C++. In C it may be implicitly converted to any other pointer type, so you can directly do int* p = malloc(sizeof(int)). In C++ an explicit cast is required.)

• It appears that stdio.h was the only header that existed. For example, strcpy and strcmp are said to be part of the standard I/O library (section 5.5). Likewise, on page 154 exit is called in a program that only includes stdio.h.
• Although printf existed, the variable arguments library (varargs.h, later stdarg.h) didn’t exist yet. K&R says that printf is … non-portable and must be modified for different environments. (Presumably it peeked directly at the stack to retrieve arguments.)
• The authors seemed to prefer separate declaration and initialization. I quote from page 83:

In effect, initializations of automatic variables are just shorthand for assignment statements. Which form to prefer is largely a matter of taste. We have generally used explicit assignments, because initializers in declarations are harder to see.

These days, I’ve always been told it’s good practice to initialize the variable in the declaration, so that there’s no chance you’ll ever forget to initialize it.

• Automatic arrays could not be initialized (p. 83)
• The address-of operator could not be applied to arrays. In fact, when you really think about it, it’s a bit odd that ANSI C allows it. This reflects a deeper underlying difference: arrays are not lvalues in K&R C. I believe in K&R C lvalues were still thought of as expressions that can occur on the left side of an assignment, and of course arrays do not fall into this category. And of course the address-of operator can only be applied to lvalues (although not to bit fields or register variables). In ANSI C, arrays are lvalues so it is legal to take their addresses; the result is of type pointer to array. The address-of operator also doesn’t seem to be allowed before a function in K&R C, and the decay to function pointer occurs automatically when necessary. This makes sense because functions aren’t lvalues in either K&R C or ANSI C. (They are, however, lvalues in C++.) ANSI C, though, specifically allows functions to occur as the operand of the address-of operator.
• The standard memory allocator was called alloc, not malloc.
• It appears that it was necessary to dereference function pointers before calling them; this is not required in ANSI C.
• Structure assignment wasn’t yet possible, but the text says [these] restrictions will be removed in forthcoming versions. (Section 6.2) (Likewise, you couldn’t pass structures by value.) Indeed, structure assignment is one of the features Stroustrup says existed in pre-standard C despite not appearing in K&R (see here, section 2.1).
• In PDP-11 UNIX, you had to explicitly link in the standard library: cc ... -lS (section 7.1)
• Memory allocated with calloc had to be freed with a function called cfree (p. 157). I guess this is because calloc might have allocated memory from a different pool than alloc, one which is pre-zeroed or something. I don’t know whether such facilities exist on modern systems.
• Amusingly, creat is followed by [sic] (p. 162)
• In those days, a directory in UNIX was a file that contains a list of file names and some indication of where they are located (p. 169). There was no opendir or readdir; you just opened the directory as a file and read a sequence of struct direct objects directly. Example is given on page 172. You can’t do this in modern Unix-like systems, in case you were wondering.
• There was an unused keyword, entry, said to be reserved for future use. No indication is given as to what use that might be. (Appendix A, section 2.3)
• Octal literals were allowed to contain the digits 8 and 9, which had the octal values 10 and 11, respectively, as you might expect. (Appendix A, section 2.4.1)
• All string literals were distinct, even those with exactly the same contents (Appendix A, section 2.5). Note that this guarantee does not exist in ANSI C, nor C++. Also, it seems that modifying string literals was well-defined in K&R C; I didn’t see anything in the book to suggest otherwise. (In both ANSI C and C++ modifying string literals is undefined behaviour, and in C++11 it is not possible without casting away constness anyway.)
• There was no unary + operator (Appendix A, section 7.2). (Note: ANSI C only allows the unary + and - operators to be applied to arithmetic types. In C++, unary + can also be applied to pointers.)
• It appears that unsigned could only be applied to int; there were no unsigned chars, shorts, or longs. Curiously, you could declare a long float; this was equivalent to double. (Appendix A, section 8.2)
• There is no mention of const or volatile; those features did not exist in K&R C. In fact, const was originally introduced in C++ (then known as C With Classes); this C++ feature was the inspiration for const in C, which appeared in C89. (More info here, section 2.3.) volatile, on the other hand, originated in C89. Stroustrup says it was introduced in C++ [to] match ANSI C (The Design and Evolution of C++, p. 128)
• The preprocessing operators # and ## appear to be absent.
• The text notes (Appendix A, section 17) that earlier versions of C had compound assignment operators with the equal sign at the beginning, e.g., x=-1 to decrement x. (Supposedly you had to insert a space between = and - if you wanted to assign -1 to x instead.) It also notes that the equal sign before the initializer in a declaration was not present, so int x 1; would define x and initialize it with the value 1. Thank goodness that even in 1978 the authors had had the good sense to eliminate these constructs… :P
• A reading of the grammar on page 217 suggests that trailing commas in initializers were allowed only at the top level. I have no idea why. Maybe it was just a typo.
• I saved the biggest WTF of all for the end: the compilers of the day apparently allowed you to write something like foo.bar even when foo does not have the type of a structure that contains a member named bar. Likewise the left operand of -> could be any pointer or integer. In both cases, the compiler supposedly looks up the name on the right to figure out which struct type you intended. So foo->bar if foo is an integer would do something like ((Foo*)foo)->bar where Foo is a struct that contains a member named bar, and foo.bar would be like ((Foo*)&foo)->bar. The text doesn’t say how ambiguity is resolved (i.e., if there are multiple structs that have a member with the given name).
Posted in Uncategorized | 14 Comments