CINXE.COM

<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7803021</id><updated>2024-10-26T23:10:39.425-07:00</updated><title type='text'>Neal Gafter&#39;s blog</title><subtitle type='html'>Thoughts about Programming Languages, Science and Philosophy.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://gafter.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default?start-index=26&amp;max-results=25'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>64</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7803021.post-4415559642972312609</id><published>2024-09-16T11:59:00.000-07:00</published><updated>2024-09-16T11:59:40.395-07:00</updated><title type='text'>A logic puzzle not solved by ChatGPT o1-preview</title><content type='html'>&lt;p&gt;In &lt;a href=&quot;https://gafter.blogspot.com/2023/08/learned-bias-interferes-with-reasoning.html&quot; target=&quot;_blank&quot;&gt;the previous post&lt;/a&gt;, we gave GPT a chance to try its hand at a short logic puzzle. This puzzle gives more information than is necessary to answer correctly, and invokes irrelevant prior knowledge of the reader. Like most people, ChatGPT was not able figure out the correct solution without a number of hints.&lt;/p&gt;&lt;p&gt;Today I tried &lt;i&gt;ChatGPT o1-preview&lt;/i&gt;, which uses advanced reasoning capabilities that OpenAI is introducing. It did much better than previous versions, but still was not able to answer the question on the first try. If you didn&#39;t read the previous post, I suggest you take a moment to formulate your own answer before reading to the end.&lt;/p&gt;&lt;blockquote style=&quot;border: none; margin: 0px 0px 0px 40px; padding: 0px;&quot;&gt;&lt;p&gt;&lt;b&gt;User&lt;/b&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote style=&quot;border: none; margin: 0px 0px 0px 40px; padding: 0px;&quot;&gt;&lt;blockquote style=&quot;border: none; margin: 0px 0px 0px 40px; padding: 0px;&quot;&gt;&lt;p style=&quot;text-align: left;&quot;&gt;What do you think is the underlying cause of the fact that the number of people who die a few (1-3) days after their vaccination is so much higher than the number who die a few days before their vaccination?&amp;nbsp; For the purposes of this question, we are considering the first COVID-19 vaccination an individual receives of the MRNA variety.&lt;/p&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;blockquote style=&quot;border: none; margin: 0px 0px 0px 40px; padding: 0px;&quot;&gt;&lt;p&gt;&lt;b&gt;ChatGPT o1-preview&lt;/b&gt;&amp;nbsp;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote style=&quot;border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;&quot;&gt;&lt;blockquote style=&quot;border: none; margin: 0px 0px 0px 40px; padding: 0px;&quot;&gt;&lt;div class=&quot;min-h-[20px] text-message flex w-full flex-col items-end gap-2 whitespace-normal break-words [.text-message+&amp;amp;]:mt-5&quot; data-message-author-role=&quot;assistant&quot; data-message-id=&quot;b59ebaa6-fb8a-45fd-bfb3-4c2eac8f2ca8&quot;&gt;&lt;div class=&quot;flex w-full flex-col gap-1 empty:hidden first:pt-[3px]&quot;&gt;&lt;div class=&quot;markdown prose w-full break-words dark:prose-invert light&quot;&gt;&lt;div class=&quot;min-h-[20px] text-message flex w-full flex-col items-end gap-2 whitespace-normal break-words [.text-message+&amp;amp;]:mt-5&quot; data-message-author-role=&quot;assistant&quot; data-message-id=&quot;b59ebaa6-fb8a-45fd-bfb3-4c2eac8f2ca8&quot; dir=&quot;auto&quot;&gt;&lt;div class=&quot;flex w-full flex-col gap-1 empty:hidden first:pt-[3px]&quot;&gt;&lt;div class=&quot;markdown prose w-full break-words dark:prose-invert light&quot;&gt;&lt;p&gt;The observed phenomenon—that more people die within a few days &lt;em&gt;after&lt;/em&gt; receiving their first mRNA COVID-19 vaccination compared to the number who die within a few days &lt;em&gt;before&lt;/em&gt; vaccination—is primarily attributed to a concept known as the &lt;strong&gt;&quot;healthy vaccinee effect&quot;&lt;/strong&gt;, which is a form of &lt;strong&gt;selection bias&lt;/strong&gt;.&lt;/p&gt;&lt;p&gt;Here&#39;s a detailed explanation:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Selection Bias and the Healthy Vaccinee Effect&lt;/strong&gt;:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Pre-vaccination Health Screening&lt;/strong&gt;: Before vaccination, individuals who are acutely ill, hospitalized, or otherwise unwell are often advised to postpone vaccination. This means that those who are on the verge of dying due to underlying conditions are less likely to receive the vaccine in the immediate days before their death.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Healthier Individuals Get Vaccinated&lt;/strong&gt;: The population that does get vaccinated tends to be healthier on average because they are well enough to attend vaccination appointments.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Underrepresentation of Pre-Vaccination Deaths&lt;/strong&gt;: As a result, the number of deaths in the days &lt;em&gt;before&lt;/em&gt; vaccination is lower than expected because those at highest risk of imminent death are not present in the vaccinated group.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Temporal Association vs. Causation&lt;/strong&gt;:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Background Mortality&lt;/strong&gt;: In any large population, a certain number of deaths occur daily due to various causes (heart attacks, strokes, accidents, etc.).&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Post-Vaccination Timing&lt;/strong&gt;: When a large number of people are vaccinated, some will coincidentally die shortly afterward due to these unrelated causes.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Perception of Increased Risk&lt;/strong&gt;: The timing creates a temporal association that may falsely suggest the vaccine is linked to the deaths, even when it&#39;s not.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Statistical Artefacts&lt;/strong&gt;:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;&quot;Depletion of Susceptibles&quot;&lt;/strong&gt;: Those who are frail or have severe health conditions may die before having the opportunity to be vaccinated, leading to fewer deaths before vaccination.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Event-triggered Cohorts&lt;/strong&gt;: Studies that look at events following a trigger (like vaccination) can show a spike in events simply because they are anchored to that trigger point, not because the trigger caused the events.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Reporting Bias&lt;/strong&gt;:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Increased Surveillance&lt;/strong&gt;: After vaccination, there is heightened awareness and monitoring for adverse events, which can lead to more deaths being reported in the post-vaccination period compared to the pre-vaccination period.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Attribution of Cause&lt;/strong&gt;: Deaths occurring after vaccination might be more likely to be investigated or attributed to the vaccine, even without evidence of causation.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;:&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;The higher number of deaths observed in the days following vaccination compared to the days preceding it is largely due to &lt;strong&gt;selection bias&lt;/strong&gt;—specifically, the healthy vaccinee effect. Individuals who are severely ill or nearing death are less likely to be vaccinated, resulting in fewer deaths before vaccination. The deaths that occur after vaccination are generally consistent with the background mortality rate and are not necessarily caused by the vaccine. This phenomenon underscores the importance of careful interpretation of temporal associations in post-vaccination surveillance data to avoid erroneous conclusions about vaccine safety.&amp;nbsp;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;blockquote style=&quot;border: none; margin: 0px 0px 0px 40px; padding: 0px;&quot;&gt;&lt;p&gt;&lt;b&gt;User&lt;/b&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote style=&quot;border: none; margin: 0px 0px 0px 40px; padding: 0px;&quot;&gt;&lt;blockquote style=&quot;border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;&quot;&gt;That is not correct. There is a much simpler explanation.&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;blockquote style=&quot;border: none; margin: 0px 0px 0px 40px; padding: 0px;&quot;&gt;&lt;p&gt;&lt;b&gt;ChatGPT o1-preview&lt;/b&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote style=&quot;border: none; margin: 0 0 0 40px; padding: 0px;&quot;&gt;&lt;blockquote&gt;&lt;blockquote style=&quot;text-align: left;&quot;&gt;You&#39;re absolutely right, and I apologize for not providing the most straightforward explanation earlier.&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;/p&gt;&lt;blockquote style=&quot;border: none; margin: 0 0 0 40px; padding: 0px;&quot;&gt;&lt;div class=&quot;flex max-w-full flex-col flex-grow&quot;&gt;&lt;div class=&quot;min-h-[20px] text-message flex w-full flex-col items-end gap-2 whitespace-normal break-words [.text-message+&amp;amp;]:mt-5&quot; data-message-author-role=&quot;assistant&quot; data-message-id=&quot;ec63c18d-ade6-430f-b00c-ff8255f1255a&quot; dir=&quot;auto&quot;&gt;&lt;div class=&quot;flex w-full flex-col gap-1 empty:hidden first:pt-[3px]&quot;&gt;&lt;div class=&quot;markdown prose w-full break-words dark:prose-invert light&quot;&gt;&lt;blockquote&gt;&lt;blockquote&gt;&lt;p style=&quot;text-align: left;&quot;&gt;The primary reason more people die a few (1-3) days &lt;strong&gt;after&lt;/strong&gt; their vaccination than in the days &lt;strong&gt;before&lt;/strong&gt; is because individuals who die &lt;strong&gt;before&lt;/strong&gt; their scheduled vaccination cannot receive the vaccine. Simply put, you can&#39;t die before vaccination and still go on to be vaccinated.&lt;/p&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;blockquote style=&quot;border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;&quot;&gt;&lt;div class=&quot;flex max-w-full flex-col flex-grow&quot;&gt;&lt;div class=&quot;min-h-[20px] text-message flex w-full flex-col items-end gap-2 whitespace-normal break-words [.text-message+&amp;amp;]:mt-5&quot; data-message-author-role=&quot;assistant&quot; data-message-id=&quot;ec63c18d-ade6-430f-b00c-ff8255f1255a&quot;&gt;&lt;div class=&quot;flex w-full flex-col gap-1 empty:hidden first:pt-[3px]&quot;&gt;&lt;div class=&quot;markdown prose w-full break-words dark:prose-invert light&quot;&gt;&lt;blockquote&gt;&lt;blockquote&gt;&lt;p&gt;Here&#39;s the key point:&lt;/p&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;blockquote style=&quot;border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;&quot;&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Timing of Death Relative to Vaccination&lt;/strong&gt;: People who die before their vaccination date are not included in the vaccinated group. Therefore, there are zero deaths in the days before vaccination among those who get vaccinated, because anyone who dies cannot proceed to be vaccinated.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Population at Risk&lt;/strong&gt;: The group of people who are vaccinated includes everyone who was alive at the time of vaccination. So any deaths that occur after vaccination are counted in the post-vaccination period. In contrast, the pre-vaccination period for vaccinated individuals doesn&#39;t include those who died before they could be vaccinated.&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;/blockquote&gt;&lt;blockquote style=&quot;border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;&quot;&gt;&lt;div class=&quot;flex max-w-full flex-col flex-grow&quot;&gt;&lt;div class=&quot;min-h-[20px] text-message flex w-full flex-col items-end gap-2 whitespace-normal break-words [.text-message+&amp;amp;]:mt-5&quot; data-message-author-role=&quot;assistant&quot; data-message-id=&quot;ec63c18d-ade6-430f-b00c-ff8255f1255a&quot;&gt;&lt;div class=&quot;flex w-full flex-col gap-1 empty:hidden first:pt-[3px]&quot;&gt;&lt;div class=&quot;markdown prose w-full break-words dark:prose-invert light&quot;&gt;&lt;blockquote&gt;&lt;blockquote&gt;&lt;p&gt;This creates an inherent imbalance in the numbers:&lt;/p&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;blockquote style=&quot;border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;&quot;&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;strong style=&quot;font-weight: bold;&quot;&gt;After Vaccination&lt;/strong&gt;: The number of deaths can be observed and counted because the individuals were alive to receive the vaccine and unfortunately passed away afterward (due to unrelated causes in most cases).&lt;/li&gt;&lt;li&gt;&lt;strong style=&quot;font-weight: bold;&quot;&gt;Before Vaccination&lt;/strong&gt;: Those who might have died in the days leading up to a scheduled vaccination are not part of the vaccinated cohort because they didn&#39;t live to receive the vaccine.&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;/blockquote&gt;&lt;blockquote style=&quot;border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;&quot;&gt;&lt;div class=&quot;flex max-w-full flex-col flex-grow&quot;&gt;&lt;div class=&quot;min-h-[20px] text-message flex w-full flex-col items-end gap-2 whitespace-normal break-words [.text-message+&amp;amp;]:mt-5&quot; data-message-author-role=&quot;assistant&quot; data-message-id=&quot;ec63c18d-ade6-430f-b00c-ff8255f1255a&quot;&gt;&lt;div class=&quot;flex w-full flex-col gap-1 empty:hidden first:pt-[3px]&quot;&gt;&lt;div class=&quot;markdown prose w-full break-words dark:prose-invert light&quot;&gt;&lt;blockquote&gt;&lt;blockquote&gt;&lt;p&gt;Therefore, the pool of people who can die &lt;strong&gt;after&lt;/strong&gt; vaccination is larger (it includes everyone vaccinated), whereas the pool of people who can die &lt;strong&gt;before&lt;/strong&gt; vaccination among the vaccinated group is essentially non-existent.&lt;/p&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;flex max-w-full flex-col flex-grow&quot;&gt;&lt;div class=&quot;min-h-[20px] text-message flex w-full flex-col items-end gap-2 whitespace-normal break-words [.text-message+&amp;amp;]:mt-5&quot; data-message-author-role=&quot;assistant&quot; data-message-id=&quot;ec63c18d-ade6-430f-b00c-ff8255f1255a&quot;&gt;&lt;div class=&quot;flex w-full flex-col gap-1 empty:hidden first:pt-[3px]&quot;&gt;&lt;div class=&quot;markdown prose w-full break-words dark:prose-invert light&quot;&gt;&lt;blockquote&gt;&lt;blockquote&gt;&lt;p&gt;This is a classic example of a statistical phenomenon known as &lt;strong&gt;survivorship bias&lt;/strong&gt;. We only observe and include data from individuals who have survived up to the point of vaccination. Those who didn&#39;t survive to get the vaccine are not included in the analysis of post-vaccination outcomes.&lt;/p&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;flex max-w-full flex-col flex-grow&quot;&gt;&lt;div class=&quot;min-h-[20px] text-message flex w-full flex-col items-end gap-2 whitespace-normal break-words [.text-message+&amp;amp;]:mt-5&quot; data-message-author-role=&quot;assistant&quot; data-message-id=&quot;ec63c18d-ade6-430f-b00c-ff8255f1255a&quot;&gt;&lt;div class=&quot;flex w-full flex-col gap-1 empty:hidden first:pt-[3px]&quot;&gt;&lt;div class=&quot;markdown prose w-full break-words dark:prose-invert light&quot;&gt;&lt;blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;In Summary&lt;/strong&gt;: The observed higher number of deaths after vaccination compared to before vaccination is because individuals who die before vaccination are not part of the vaccinated population, making it impossible for them to be counted in the &quot;before vaccination&quot; death statistics among vaccinated individuals.&lt;/p&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;p&gt;This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. See &lt;a href=&quot;http://creativecommons.org/licenses/by-sa/4.0/&quot;&gt;http://creativecommons.org/licenses/by-sa/4.0/&lt;/a&gt;&lt;/p&gt;</content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=4415559642972312609' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/4415559642972312609'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/4415559642972312609'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2024/09/a-logic-puzzle-not-solved-by-chatgpt-o1.html' title='A logic puzzle not solved by ChatGPT o1-preview'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-5082091822709818162</id><published>2023-08-09T19:21:00.002-07:00</published><updated>2023-08-10T15:23:34.410-07:00</updated><title type='text'>Learned bias interferes with reasoning</title><content type='html'>&lt;p&gt;When we teach things to children, they add those &quot;facts&quot; to their view of the world.&amp;nbsp; They are too young and inexperienced to challenge everything they learn.&amp;nbsp; When they are older it can be very hard for them to set aside learned biases.&amp;nbsp; Such biases can prevent them from even thinking clearly!&amp;nbsp; Learning strong reasoning skills and a skeptical attitude can help.&amp;nbsp; As adults, we can also develop confirmation bias by immersing ourselves in an echo chamber on one side of an issue.&lt;/p&gt;&lt;p&gt;The same thing can occur when we train our AI large language models.&amp;nbsp; While the training data may contain a variety of competing opinions on a subject, there is typically a post-training step in which biases are intentionally added to ensure that the AI does not spread harmful content.&amp;nbsp; That post-training can interfere with the AI&#39;s ability to reason.&lt;/p&gt;&lt;p&gt;The following question tests the ability to reason about a topic while ignoring bias.&lt;/p&gt;&lt;blockquote style=&quot;border: none; margin: 0px 0px 0px 40px; padding: 0px;&quot;&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;b&gt;What do you think is the underlying cause of the fact that the number of people who die a few (1-3) days after their vaccination is so much higher than the number who die a few (1-3) days before their vaccination?&amp;nbsp; For the purposes of this question, we are considering the first COVID-19 vaccination an individual receives of the MRNA variety.&lt;/b&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;I suggest you take some time at this point to formulate your own answer.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;To someone strongly in the pro-vaccine camp, the very premise of the question would lead them to reject the purported data.&amp;nbsp; That prevents them from truly considering the question.&amp;nbsp; Similarly, to someone strongly in the anti-vaccine camp, the obvious answer that vaccines cause harm can be given without any further thought.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;I tested this question on several friends and relatives and several AI large language models.&amp;nbsp; A few people were able to answer correctly with only a few moments of thought.&amp;nbsp; Most people who are able to suspend disbelief about the purported data spent some time considering vaccine reactions, the timing of the vaccination with respect to the phase of the pandemic, the fact that high-risk groups were prioritized during the initial phases of the pandemic, reporting bias, selection bias, the fact that people who are not feeling well tend to postpone vaccination, and other confounding factors.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;The AI large language models&amp;nbsp;I tried all had difficulty with this question even when (and often after!) being led step by step through the reasoning process.&amp;nbsp; While all of the LLMs were bad, GPT-4 gave what was probably the least embarrassing performance, reproduced here for your entertainment.&amp;nbsp; I repeated this experiment several times and while the conversation was completely different each time, the result was about the same.&amp;nbsp;&lt;/p&gt;&lt;blockquote style=&quot;border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;&quot;&gt;&lt;p&gt;&lt;b&gt;User&lt;/b&gt;&lt;/p&gt;&lt;p&gt;What do you think is the underlying cause of the fact that the number of people who die a few (1-3) days after their vaccination is so much higher than the number who die a few days before their vaccination?&amp;nbsp; For the purposes of this question, we are considering the first COVID-19 vaccination an individual receives of the MRNA variety.&lt;/p&gt;&lt;p&gt;&lt;b&gt;ChatGPT&lt;/b&gt;&lt;/p&gt;&lt;p&gt;I believe there might be some miscommunication or confusion. As of my knowledge cutoff in September 2021, there&#39;s no credible scientific data suggesting a high number of people die 1-3 days after receiving the mRNA COVID-19 vaccines (like those developed by Pfizer-BioNTech or Moderna). These vaccines have been shown to be safe and effective, as demonstrated by rigorous clinical trials and ongoing post-market surveillance.&lt;/p&gt;&lt;p&gt;However, it&#39;s important to understand that because millions of people are getting vaccinated, some deaths will statistically occur shortly after vaccination simply due to chance. These are typically unrelated to the vaccine itself and would likely have occurred without the vaccination. This is especially true for older individuals or those with severe underlying health conditions.&lt;/p&gt;&lt;p&gt;Some adverse events can occur after vaccination, but these are relatively rare, and the benefits of vaccination in preventing COVID-19 (which can be severe or fatal) overwhelmingly outweigh the risks. Severe side effects are incredibly rare and are closely monitored and studied by health organizations globally.&lt;/p&gt;&lt;p&gt;If newer data (post-September 2021) suggests otherwise, I&#39;d recommend reviewing the original sources and checking the credibility and methodology of the research. Public health organizations like the World Health Organization (WHO), U.S. Centers for Disease Control and Prevention (CDC), European Medicines Agency (EMA), and others provide up-to-date, reliable information on vaccine safety.&lt;/p&gt;&lt;p&gt;&lt;b&gt;User&lt;/b&gt;&lt;/p&gt;&lt;p&gt;I didn&#39;t say or suggest that a high number of people die 1-3 days after receiving the mRNA COVID-19 vaccines (like those developed by Pfizer-BioNTech or Moderna).&amp;nbsp; If that&#39;s what you thought I said, then you&#39;re not answering the question I asked.&amp;nbsp; Please try again.&lt;/p&gt;&lt;p&gt;&lt;b&gt;ChatGPT&lt;/b&gt;&lt;/p&gt;&lt;p&gt;I apologize if my previous response did not adequately address your question. Your query is on the topic of why the number of people who die a few days after their vaccination is higher than the number who die a few days before their vaccination.&lt;/p&gt;&lt;p&gt;It&#39;s important to clarify that the premise of the question, as I understand it, would require specific supporting data. As of my last training data in September 2021, no such trends had been reported in scientific literature. If such data exists, it might be due to a range of factors that don&#39;t necessarily reflect the vaccine&#39;s safety or efficacy.&lt;/p&gt;&lt;p&gt;One possible explanation might be due to increased scrutiny and reporting immediately following vaccination. Deaths that happen a few days after vaccination are more likely to be recorded and linked to the vaccination (even if not caused by it) simply due to the timing. On the other hand, if someone dies a few days before they were scheduled to receive a vaccine, it&#39;s less likely that their death will be associated with the vaccination process.&lt;/p&gt;&lt;p&gt;It&#39;s also worth noting that many people receiving the vaccine are elderly or have significant underlying health conditions, as they have been prioritized in many vaccination campaigns. These individuals have a higher baseline risk of mortality, and some may coincidentally die shortly after receiving the vaccine, but this does not imply the vaccine was the cause.&lt;/p&gt;&lt;p&gt;Overall, it&#39;s crucial to separate correlation from causation. The fact that an event happens after another does not necessarily mean the first event caused the second.&lt;/p&gt;&lt;p&gt;If there are new studies or data published after September 2021 that suggest a different situation, it&#39;s recommended to consult those for the most current and accurate information.&lt;/p&gt;&lt;p&gt;&lt;b&gt;User&lt;/b&gt;&lt;/p&gt;&lt;p&gt;I didn&#39;t say anything about deaths before a scheduled vaccination.&amp;nbsp; My question related to deaths after vaccination vs deaths before vaccination.&amp;nbsp; Scheduling has nothing to do with my question.&amp;nbsp; Please try to answer the question I actually asked.&lt;/p&gt;&lt;p&gt;&lt;b&gt;ChatGPT&lt;/b&gt;&lt;/p&gt;&lt;p&gt;I apologize for misunderstanding your original question. You&#39;re asking about the difference in the number of deaths occurring in the days before and after the administration of an mRNA COVID-19 vaccine.&lt;/p&gt;&lt;p&gt;As of my knowledge cutoff in September 2021, there&#39;s no significant scientific data indicating that the mRNA COVID-19 vaccines cause a substantial increase in mortality in the days immediately following vaccination compared to the days before. The vaccines developed by Pfizer-BioNTech and Moderna have been proven to be safe and effective through extensive clinical trials and real-world data.&lt;/p&gt;&lt;p&gt;That said, given the scale of vaccination efforts worldwide, there are bound to be reports of deaths following vaccination purely due to coincidental timing. Many people receiving these vaccines are part of high-risk groups, such as the elderly or those with severe underlying conditions, who already have a higher baseline mortality risk.&lt;/p&gt;&lt;p&gt;In other words, if millions of people are vaccinated on a particular day, statistically, some of those people will die in the following days due to causes unrelated to vaccination, just as some would have died in the days before vaccination. This doesn&#39;t indicate a causal link between the vaccine and the deaths.&lt;/p&gt;&lt;p&gt;To establish a causal relationship between vaccination and increased mortality, rigorous scientific analysis would need to be performed, taking into account the individuals&#39; age, health status, and other factors. If there were a significant increase in risk, this would be detected in the monitoring systems in place and actions would be taken to address it.&lt;/p&gt;&lt;p&gt;As of my last update, major health organizations worldwide have consistently stated that the benefits of COVID-19 vaccination in preventing illness and death from the virus far outweigh any potential risks. It&#39;s always recommended to consult up-to-date and reliable sources for the latest information.&lt;/p&gt;&lt;p&gt;&lt;b&gt;User&lt;/b&gt;&lt;/p&gt;&lt;p&gt;I didn&#39;t ask about an increase in mortality.&amp;nbsp; I asked about the number (not percentage) of deaths.&amp;nbsp; Please try to answer the question I actually asked.&lt;/p&gt;&lt;p&gt;&lt;b&gt;ChatGPT&lt;/b&gt;&lt;/p&gt;&lt;p&gt;I apologize for any misunderstanding. To clarify, you are asking about the raw number of deaths that occur in the days following vaccination compared to the days before, not the mortality rate or percentage.&lt;/p&gt;&lt;p&gt;As of my knowledge cutoff in September 2021, no such specific comparison has been published or highlighted in scientific literature or in the data from health authorities. Typically, mortality data isn&#39;t examined in this way—comparing raw death numbers in the days before and after vaccination—because it wouldn&#39;t provide useful insights without additional context.&lt;/p&gt;&lt;p&gt;For instance, the raw number of deaths before and after vaccination could be influenced by many factors unrelated to the vaccine, such as the person&#39;s underlying health condition, age, etc. Additionally, without a specific timeframe defined (like 1-3 days), it&#39;s challenging to make a meaningful comparison.&lt;/p&gt;&lt;p&gt;While vaccination campaigns are ongoing, some deaths will occur due to unrelated causes, and these will statistically appear both before and after vaccination. If one were to compare these numbers, it&#39;s essential to remember that correlation does not imply causation—i.e., just because two events occur close together in time doesn&#39;t mean one caused the other.&lt;/p&gt;&lt;p&gt;Furthermore, the data typically examined by health authorities and researchers is whether the number of deaths (or the mortality rate) is higher among vaccinated individuals compared to unvaccinated individuals over a more extended period. This approach is better suited to identify any potential safety concerns with the vaccine.&lt;/p&gt;&lt;p&gt;If you have access to specific data or studies published after September 2021 that provide the information you are asking about, I recommend consulting those directly for the most accurate and up-to-date information.&lt;/p&gt;&lt;p&gt;&lt;b&gt;User&lt;/b&gt;&lt;/p&gt;&lt;p&gt;What would you estimate to be the number of individuals in the United States who dies during 2021 1-3 days before their vaccination?&lt;/p&gt;&lt;p&gt;&lt;b&gt;ChatGPT&lt;/b&gt;&lt;/p&gt;&lt;p&gt;As an AI model developed by OpenAI, I don&#39;t have real-time data access, nor can I generate estimates based on such data, including specific mortality rates or the number of people who died 1-3 days before their scheduled COVID-19 vaccination in the United States or elsewhere during 2021.&lt;/p&gt;&lt;p&gt;Data regarding mortality rates, especially in connection with COVID-19 vaccination schedules, would need to be compiled from several sources, such as medical records, vaccination schedules, and health databases, which involves sophisticated data management and privacy considerations. It&#39;s also crucial to note that, in general, the focus of public health data analysis is not typically on the number of people who died a few days before their scheduled vaccination.&lt;/p&gt;&lt;p&gt;For the most accurate, specific, and up-to-date data on COVID-19, vaccination rates, and related mortality rates, I recommend referring to the Centers for Disease Control and Prevention (CDC), the World Health Organization (WHO), and other reputable health organization resources.&lt;/p&gt;&lt;p&gt;&lt;b&gt;User&lt;/b&gt;&lt;/p&gt;&lt;p&gt;The question I asked can be answered using logic without reference to any gathered statistics.&amp;nbsp; Please think about it and try to answer.&lt;/p&gt;&lt;p&gt;&lt;b&gt;ChatGPT&lt;/b&gt;&lt;/p&gt;&lt;p&gt;My apologies for misunderstanding your question previously. If you&#39;re asking about the number of individuals in the United States who died 1-3 days before receiving their first COVID-19 vaccination during 2021, logically speaking, without any specific statistical data, that number would be zero.&lt;/p&gt;&lt;p&gt;The reason is straightforward: If a person dies, they cannot then receive a vaccination. Therefore, no one can die 1-3 days before their actual vaccination because they wouldn&#39;t have been vaccinated if they had died prior. Hence, logically and by definition, the number would be zero.&lt;/p&gt;&lt;p&gt;&lt;b&gt;User&lt;/b&gt;&lt;/p&gt;&lt;p&gt;OK, realizing that, how would you answer my original question?&lt;/p&gt;&lt;p&gt;&lt;b&gt;ChatGPT&lt;/b&gt;&lt;/p&gt;&lt;p&gt;I understand now. You&#39;re asking why the number of people who die a few days after their vaccination is higher than the number who die a few days before. Based on the logic we&#39;ve just established, the number of people who die a few days before their vaccination is effectively zero, because if someone dies, they cannot then receive a vaccine.&lt;/p&gt;&lt;p&gt;Therefore, any deaths that occur a few days after vaccination will be higher than the number of deaths that occur a few days before vaccination because the latter group, by definition, does not exist. It&#39;s crucial to remember, though, that this doesn&#39;t indicate a causal relationship between vaccination and death. Deaths that happen after vaccination can be due to a variety of causes and not necessarily linked to the vaccine itself.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;The following answer was given to me by my lunch companion Chris Q after only a moment of thought.&amp;nbsp; It was the most pithy and clear answer I&#39;ve heard:&lt;/p&gt;&lt;blockquote style=&quot;border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;&quot;&gt;&lt;p&gt;&lt;b&gt;Chris Q&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Because we don&#39;t vaccinate dead people.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.&lt;br /&gt;See http://creativecommons.org/licenses/by-sa/4.0/&lt;/p&gt;</content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=5082091822709818162' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/5082091822709818162'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/5082091822709818162'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2023/08/learned-bias-interferes-with-reasoning.html' title='Learned bias interferes with reasoning'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-3581756692255860518</id><published>2020-12-12T12:13:00.000-08:00</published><updated>2020-12-12T12:13:42.480-08:00</updated><title type='text'>A C# Puzzler: Records</title><content type='html'>&lt;p&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9&quot;&gt;C# version 9.0 introduces &lt;i&gt;records&lt;/i&gt;&lt;/a&gt;.&amp;nbsp; Records are a &lt;a href=&quot;https://en.wikipedia.org/wiki/Record_(computer_science)&quot; target=&quot;_blank&quot;&gt;computer programming concept&lt;/a&gt; in which a data type declaration has a number of &lt;i&gt;keys&lt;/i&gt; which are used to define an equality operation.&amp;nbsp; Many existing languages have them (e.g. Kotlin &lt;span style=&quot;font-family: courier;&quot;&gt;&lt;a href=&quot;https://kotlinlang.org/docs/reference/data-classes.html&quot;&gt;data class&lt;/a&gt;&lt;/span&gt;, Scala &lt;span style=&quot;font-family: courier;&quot;&gt;&lt;a href=&quot;https://docs.scala-lang.org/overviews/scala-book/case-classes.html&quot;&gt;case class&lt;/a&gt;&lt;/span&gt;, Java&#39;s upcoming &lt;span style=&quot;font-family: courier;&quot;&gt;&lt;a href=&quot;http://cr.openjdk.java.net/~gbierman/8222777/8222777-20190823/specs/records-jls.html#jls-8.10.1&quot;&gt;records&lt;/a&gt;&lt;/span&gt;).&amp;nbsp; Because I stopped programming in C# before records were available, I missed using them, but now that I&#39;m programming in Kotlin I have the pleasure of being able to use records.&lt;/p&gt;&lt;p&gt;Here is a little sample of some Kotlin code that exercises the record (data class) feature. It demonstrates that you can add declarations to the body without interfering with their useful semantics:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;blockquote style=&quot;border: none; margin: 0px 0px 0px 40px; padding: 0px;&quot;&gt;&lt;pre style=&quot;background-color: white; font-family: Menlo; font-size: 9pt;&quot;&gt;&lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;import &lt;/span&gt;kotlin.math.sqrt&lt;br /&gt;&lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;import &lt;/span&gt;kotlin.collections.HashSet&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;public data class &lt;/span&gt;Cartesian(&lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;val &lt;/span&gt;&lt;span style=&quot;color: #660e7a; font-weight: bold;&quot;&gt;x&lt;/span&gt;: Float, &lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;val &lt;/span&gt;&lt;span style=&quot;color: #660e7a; font-weight: bold;&quot;&gt;y&lt;/span&gt;: Float) {&lt;br /&gt;&lt;br /&gt; &lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;private var &lt;/span&gt;&lt;span style=&quot;color: #660e7a; font-weight: bold;&quot;&gt;cachedR&lt;/span&gt;: Float = &lt;span style=&quot;color: blue;&quot;&gt;0F&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;public val &lt;/span&gt;&lt;span style=&quot;color: #660e7a; font-weight: bold;&quot;&gt;r&lt;/span&gt;: Float&lt;br /&gt; &lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;get&lt;/span&gt;() {&lt;br /&gt; &lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;var &lt;/span&gt;localR = &lt;span style=&quot;color: #660e7a; font-weight: bold;&quot;&gt;cachedR&lt;/span&gt;;&lt;br /&gt; &lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;if &lt;/span&gt;(localR == &lt;span style=&quot;color: blue;&quot;&gt;0F&lt;/span&gt;) {&lt;br /&gt; localR = &lt;span style=&quot;font-style: italic;&quot;&gt;sqrt&lt;/span&gt;(&lt;span style=&quot;color: #660e7a; font-weight: bold;&quot;&gt;x&lt;/span&gt;*&lt;span style=&quot;color: #660e7a; font-weight: bold;&quot;&gt;x &lt;/span&gt;+ &lt;span style=&quot;color: #660e7a; font-weight: bold;&quot;&gt;y&lt;/span&gt;*&lt;span style=&quot;color: #660e7a; font-weight: bold;&quot;&gt;y&lt;/span&gt;)&lt;br /&gt; &lt;span style=&quot;color: #660e7a; font-weight: bold;&quot;&gt;cachedR &lt;/span&gt;= localR&lt;br /&gt; }&lt;br /&gt; &lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;return &lt;/span&gt;localR&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;fun &lt;/span&gt;main(args: Array&amp;lt;String&amp;gt;) {&lt;br /&gt; &lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;val &lt;/span&gt;set = HashSet&amp;lt;Cartesian&amp;gt;()&lt;br /&gt; &lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;val &lt;/span&gt;c1 = Cartesian(&lt;span style=&quot;color: blue;&quot;&gt;5F&lt;/span&gt;, &lt;span style=&quot;color: blue;&quot;&gt;12F&lt;/span&gt;)&lt;br /&gt; set.add(c1)&lt;br /&gt; &lt;span style=&quot;font-style: italic;&quot;&gt;println&lt;/span&gt;(c1.&lt;span style=&quot;color: #660e7a; font-weight: bold;&quot;&gt;r&lt;/span&gt;) &lt;span style=&quot;color: grey; font-style: italic;&quot;&gt;// prints 13.0&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-style: italic;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;println&lt;/span&gt;(set.contains(c1)) &lt;span style=&quot;color: grey; font-style: italic;&quot;&gt;// prints true&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-style: italic;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-style: italic;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;val &lt;/span&gt;c2 = Cartesian(&lt;span style=&quot;color: blue;&quot;&gt;5F&lt;/span&gt;, &lt;span style=&quot;color: blue;&quot;&gt;12F&lt;/span&gt;)&lt;br /&gt; &lt;span style=&quot;font-style: italic;&quot;&gt;println&lt;/span&gt;(set.contains(c2)) &lt;span style=&quot;color: grey; font-style: italic;&quot;&gt;// prints true&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-style: italic;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-style: italic;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;val &lt;/span&gt;c3 = c1.copy(&lt;span style=&quot;color: #4a86e8;&quot;&gt;x = &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;9F&lt;/span&gt;)&lt;br /&gt; &lt;span style=&quot;font-style: italic;&quot;&gt;println&lt;/span&gt;(c3.&lt;span style=&quot;color: #660e7a; font-weight: bold;&quot;&gt;r&lt;/span&gt;) &lt;span style=&quot;color: grey; font-style: italic;&quot;&gt;// prints 15.0 &lt;/span&gt;}&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;I tried records in C# 9.0, and I was disappointed by some of the behavior.&amp;nbsp; Here is an &quot;equivalent&quot; fragment of C#.&amp;nbsp; Can you guess what it does?&lt;/p&gt;&lt;blockquote style=&quot;border: none; margin: 0px 0px 0px 40px; padding: 0px;&quot;&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;using&lt;/span&gt; System;&lt;br /&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;using&lt;/span&gt; System.Collections.Generic;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;public record&lt;/span&gt; Cartesian(&lt;span style=&quot;color: #2b00fe;&quot;&gt;float&lt;/span&gt; X,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp;Y)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #2b00fe;&quot;&gt;private&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp;cachedR = 0F;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #2b00fe;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp;R&lt;br /&gt;&amp;nbsp; &amp;nbsp; {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #2b00fe;&quot;&gt;get&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp;r = cachedR;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #a64d79;&quot;&gt;if&lt;/span&gt; (r == 0F)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; r = cachedR = (&lt;/span&gt;&lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;)&lt;span style=&quot;color: #3d85c6;&quot;&gt;Math&lt;/span&gt;.&lt;span style=&quot;color: #674ea7;&quot;&gt;Sqrt&lt;/span&gt;(X * X + Y * Y);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #a64d79;&quot;&gt;return&lt;/span&gt; r;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;&amp;nbsp; &amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #3d85c6;&quot;&gt;Program&lt;/span&gt;&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; static void &lt;span style=&quot;color: #674ea7;&quot;&gt;Main&lt;/span&gt;()&lt;br /&gt;&amp;nbsp; &amp;nbsp; {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #2b00fe;&quot;&gt;var&lt;/span&gt; set = new &lt;span style=&quot;color: #3d85c6;&quot;&gt;HashSet&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;Cartesian&lt;/span&gt;&amp;gt;();&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp;c1 = new &lt;span style=&quot;color: #3d85c6;&quot;&gt;Cartesian&lt;/span&gt;(5, 12);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; set.&lt;span style=&quot;color: #674ea7;&quot;&gt;Add&lt;/span&gt;(c1);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #3d85c6;&quot;&gt;Console&lt;/span&gt;.&lt;span style=&quot;color: #674ea7;&quot;&gt;WriteLine&lt;/span&gt;(c1.R);&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // 1&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #3d85c6; font-family: courier;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #674ea7; font-family: courier;&quot;&gt;WriteLine&lt;/span&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;(set.&lt;span style=&quot;color: #674ea7;&quot;&gt;Contains&lt;/span&gt;(c1));&amp;nbsp; // 2&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp;c2 = new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #3d85c6; font-family: courier;&quot;&gt;Cartesian&lt;/span&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;(5, 12);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #3d85c6; font-family: courier;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #674ea7; font-family: courier;&quot;&gt;WriteLine&lt;/span&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;(set.&lt;/span&gt;&lt;span style=&quot;color: #674ea7; font-family: courier;&quot;&gt;Contains&lt;/span&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;(c2));&amp;nbsp; // 3&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // with expression not specified&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp;c3 = c1 with { X = 9 };&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// 4&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #3d85c6; font-family: courier;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #674ea7; font-family: courier;&quot;&gt;WriteLine&lt;/span&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;(c3.R);&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // 5&lt;br /&gt;&amp;nbsp; &amp;nbsp; }&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;My hope would be that it would behave approximately the same as the Kotlin program (and the same as equivalent programs in Java or Scala).&amp;nbsp; But in C# &lt;i&gt;all fields&lt;/i&gt;&amp;nbsp;(even private ones) are considered key members of a record.&amp;nbsp; Consequently,&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;(in the line marked &quot;&lt;span style=&quot;font-family: courier;&quot;&gt;// 1&lt;/span&gt;&quot;) The use of the property&amp;nbsp;&lt;span style=&quot;font-family: courier;&quot;&gt;c1.R&lt;/span&gt;&amp;nbsp;changes the logical value of&amp;nbsp;&lt;span style=&quot;font-family: courier;&quot;&gt;c1&lt;/span&gt;.&lt;/li&gt;&lt;li&gt;Since it is not the same as the record that was added to the set, the modified record is no longer seen as a member of the set.&lt;/li&gt;&lt;li&gt;Since the record contained in the set has been modified (records are reference types), it is no longer seen as equals to a fresh record which has not had its&amp;nbsp;&lt;span style=&quot;font-family: courier;&quot;&gt;R&lt;/span&gt;&amp;nbsp;property sampled.&lt;/li&gt;&lt;li&gt;C#&#39;s&amp;nbsp;&lt;span style=&quot;font-family: courier;&quot;&gt;with&lt;/span&gt;&amp;nbsp;expression produces a fresh instance with &lt;i&gt;all&lt;/i&gt; of the fields copied, bypassing the constructor.&lt;/li&gt;&lt;li&gt;Therefore the field&amp;nbsp;&lt;span style=&quot;font-family: courier;&quot;&gt;cachedR&lt;/span&gt;&amp;nbsp;is initialized to an incorrect value.&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Due to these issues, programmers would be wise to use C# records in only the simplest scenarios.&lt;/p&gt;</content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=3581756692255860518' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/3581756692255860518'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/3581756692255860518'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2020/12/a-c-puzzler-records.html' title='A C# Puzzler: Records'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-1369619875987802958</id><published>2019-11-03T18:03:00.002-08:00</published><updated>2023-08-09T18:02:00.380-07:00</updated><title type='text'>Response to letter from American Council on Science and Health.</title><content type='html'>&lt;br /&gt; &lt;div class=&quot;MsoNormal&quot;&gt; Alex Berezow, Ph.D.&lt;br /&gt; Vice President of Scientific Affairs&lt;br /&gt; American Council on Science and Health&lt;br /&gt; P.O. Box 1791&lt;br /&gt; New York, NY&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;10156&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt; &lt;div class=&quot;MsoNormal&quot;&gt; &lt;br /&gt;&lt;/div&gt; &lt;div class=&quot;MsoNormal&quot;&gt; Doctor Berezow-&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt; &lt;div class=&quot;MsoNormal&quot;&gt; &lt;br /&gt;&lt;/div&gt; &lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 130%; margin-bottom: 12pt;&quot;&gt; I received with interest your letter dated June 7, 2019, on &lt;i&gt;&lt;a href=&quot;https://www.acsh.org/&quot;&gt;American Council on Science and Health&lt;/a&gt;&lt;/i&gt; letterhead, which began “Real scientists and trial lawyers are locked in combat. And the future of science hangs in the balance.”&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;Much of that letter appears to repeat your article &lt;i&gt;&lt;a href=&quot;https://www.acsh.org/news/2018/08/16/289m-hit-job-science-jackpot-verdict-monsantos-glyphosate-13320&quot;&gt;A $289M Hit Job On Science In Jackpot Verdict On Monsanto&#39;s Glyphosate&lt;/a&gt;&lt;/i&gt;.&lt;/div&gt; &lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 130%; margin-bottom: 12pt;&quot;&gt; I found your letter to contain some dubious scientific claims.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;Specifically, you claim that “real science proves that [cancer was caused by glyphosate is] biologically impossible.”&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;I take several issues with this assertion. Most importantly, science does not &lt;i&gt;prove&lt;/i&gt; anything.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;Proof is something to be found in the realm of mathematics, not science. Science is an inductive process by which we make hypotheses and then gather evidence to determine how likely the hypothesis is to be true or false.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;Scientists do not ever reach the state of having 100% &lt;i&gt;proof&lt;/i&gt; of a hypothesis.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt; &lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 130%; margin-bottom: 12pt;&quot;&gt; You also claim that there is “no credible scientific evidence [that] links glyphosate to cancer.”&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;Perhaps you are unaware of the meta-analysis &lt;i&gt;&lt;a href=&quot;https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4025008/#&quot;&gt;Non-Hodgkin Lymphoma and Occupational Exposure to Agricultural Pesticide Chemical Groups and Active Ingredients: A Systematic Review and Meta-Analysis&lt;/a&gt;&lt;/i&gt; published in International Journal of Environmental Research and Public Health, 2014 Apr, or the meta-analysis &lt;a href=&quot;https://www.ncbi.nlm.nih.gov/pubmed/31342895&quot;&gt;Exposure to glyphosate-based herbicides and risk for non-Hodgkin lymphoma: A meta-analysis and supporting evidence&lt;/a&gt;&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt; in Mutation Research, 2019 July-Sep. The latter is based on the most recent update of the Agricultural Health Study cohort published in 2018 and five case-control studies and found a &quot;compelling link&quot; between exposures to glyphosate-based herbicides and increased risk for non-Hodgkin lymphoma.&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;Now that you &lt;i&gt;are&lt;/i&gt; aware of them, I would ask that you tone down your rhetoric.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt; &lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 130%; margin-bottom: 12pt;&quot;&gt; You also claim that “… glyphosate does not cause cancer because it doesn’t harm humans. It is an herbicide, so it is only toxic to plants. There is no known biological mechanism by which glyphosate could cause cancer, so it being a carcinogen isn’t even theoretically possible.”&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;There is so much wrong with these assertions that it is difficult to know where to begin.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt; &lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 130%; margin-bottom: 12pt;&quot;&gt; First, the opening sentence “glyphosate does not cause cancer because it doesn’t harm humans” draws a conclusion (“does not cause cancer“) based on an assertion (“doesn’t harm humans”) for which no evidence is to be found.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;This is the kind of statement I would expect an organization such as the Council to disavow like the junk science it seeks to fight against.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt; &lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 130%; margin-bottom: 12pt;&quot;&gt; Second, the statement “It is an herbicide, so it is only toxic to plants” is also conclusory without evidence. Sure, it is &lt;i&gt;sold&lt;/i&gt; as an herbicide.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;Sure, it is &lt;i&gt;used&lt;/i&gt; as an herbicide. Sure, it is &lt;i&gt;effective&lt;/i&gt; as an herbicide. But those facts are a non-sequitur as to whether it harms non-plants.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt; &lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 130%; margin-bottom: 12pt;&quot;&gt; Finally, the claim “There is no known biological mechanism by which glyphosate could cause cancer, so it being a carcinogen isn’t even theoretically possible” appears to totally misunderstand the scientific process.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;Mankind has known that the sun produces light and heat for far longer than we have understood any process by which it could be “theoretically possible.”&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;But our failure to understand how the sun produces light didn’t mean that it wasn’t obviously possible.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;Science infers relationships between things by observing the correlation, whether the precise mechanism of a causal relationship is known or not.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;S&lt;/span&gt;cientists form a hypothesis and then test the hypothesis by gathering data.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;If a causal relationship is shown to exist, the scientist might hypothesize a mechanism for the relationship.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;If the mechanism is shown to reliably explain the relationship, a hypothesis might graduate to the level of a &lt;i&gt;theory&lt;/i&gt;. To suggest that glyphosate “theoretically” couldn’t be a carcinogen because we have no hypothesis for a mechanism is to turn the scientific process on its head.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;This hit job on science is the kind of pseudo-scientific doublespeak and emotional manipulation I would expect you to fight against.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt; &lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 130%; margin-bottom: 12pt;&quot;&gt; Having said all that, I should say that the evidence for human harm I’ve seen does not rise to the level that I would support banning glyphosate.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;But if you’re going to resort to the ad-hominem argument that your opponent is spouting junk science to emotionally manipulate others, well then… pot, meet kettle.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt; &lt;div class=&quot;MsoNormal&quot;&gt; Sincerely,&lt;/div&gt; &lt;div class=&quot;MsoNormal&quot;&gt; &lt;br /&gt;&lt;/div&gt; &lt;div class=&quot;MsoNormal&quot;&gt; Neal M Gafter, Ph.D.&lt;/div&gt; </content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=1369619875987802958' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/1369619875987802958'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/1369619875987802958'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2019/11/response-to-letter-from-american.html' title='Response to letter from American Council on Science and Health.'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-3901483451715988807</id><published>2019-08-14T10:44:00.000-07:00</published><updated>2019-08-14T10:44:44.675-07:00</updated><title type='text'></title><content type='html'>&lt;h1&gt;Accidentally Quadratic Constant Folding&lt;/h1&gt;&lt;br /&gt; I just fixed a bug in the implementation of constant folding in the C# and VB.Net compilers. They used to require &lt;i&gt;O(n^2)&lt;/i&gt; space. &lt;a href=&quot;https://github.com/dotnet/roslyn/pull/37915&quot;&gt;Now they require &lt;i&gt;O(n)&lt;/i&gt; space&lt;/a&gt;.&lt;br /&gt; &lt;br /&gt; The naive approach to implementing string concatenation for an expression such as &lt;code&gt;&quot;S1&quot; + &quot;S2&quot; + &quot;S3&quot;&lt;/code&gt; is to recursively visit the left-hand and right-hand operands and compute their constant string values, and then concatenate these strings to produce the constant string for the concatenation. It seems obviously correct and the only reasonable way to do it. But it has a serious problem.&lt;br /&gt; &lt;br /&gt; The concatenation operation is left associative, so for a long sequence of &lt;i&gt;n&lt;/i&gt; concatenations, each of size &lt;i&gt;k&lt;/i&gt;, we would produce intermediate results of size &lt;i&gt;k&lt;/i&gt;, &lt;i&gt;2k&lt;/i&gt;, &lt;i&gt;3k&lt;/i&gt;, and so on up to &lt;i&gt;nk&lt;/i&gt;. The total amount of space needed to represent this collection of strings is &lt;i&gt;O(k n^2)&lt;/i&gt;. For moderately-sized values of &lt;i&gt;n&lt;/i&gt;, this would cause the compilers to run out of memory and crash. This is not merely a theoretical problem, as we had been getting customer reports of this problem about quarterly for the past 7-8 years.&lt;br /&gt; &lt;br /&gt; Fixing the problem was fairly straightforward, using a technique I learned from the Cedar/Mesa compiler in the early &#39;80s. Rather than representing string constants in the compilers using strings, they are now represented using a data structure called &lt;a href=&quot;https://en.wikipedia.org/wiki/Rope_(data_structure)&quot;&gt;Ropes&lt;/a&gt;. Concatenating two ropes requires only a small constant amount of memory.&lt;br /&gt; &lt;br /&gt; Any compiler for a language that supports constant folding of string concatenation will run into this problem unless there is a similarly low-space representation of two concatenated strings. This is a technique that should be in the bag of tricks of any compiler writer.&lt;br /&gt; </content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=3901483451715988807' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/3901483451715988807'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/3901483451715988807'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2019/08/accidentally-quadratic-constant-folding.html' title=''/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-6848835780742756906</id><published>2017-06-05T12:11:00.001-07:00</published><updated>2017-06-05T12:36:00.620-07:00</updated><title type='text'>Making new language features #{ Stand Out }</title><content type='html'>There is a phenomenon I&#39;ve noticed in the way community members react to proposed new language features. The new feature seems odd, and different, and contrary to the way the language was before. So they want the syntax of the feature to be odd, and different, and clearly distinguish the new feature from all of the old features of the language.&lt;br /&gt; &lt;br /&gt; Succumbing to that request is a bad idea. When you do, (some) people are at first happy that they can so easily distinguish this new feature from the rest of the language. But users soon grow tired of the extra syntax surrounding the new feature, and request as yet another new feature that they be able to do the same thing, but &lt;i&gt;without all the boilerplate&lt;/i&gt;.&lt;br /&gt; &lt;br /&gt; It is better to design the feature so that it fits well with the existing features of the language, even if it might at first seem jarring that things have changed. Users will quickly get over the newness of the changes and learn to understand the language as a whole as it is (after the change).&lt;br /&gt; </content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=6848835780742756906' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/6848835780742756906'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/6848835780742756906'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2017/06/making-new-language-features-stand-out.html' title='Making new language features #{ Stand Out }'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-417049473683427009</id><published>2016-02-14T10:52:00.001-08:00</published><updated>2016-02-14T10:55:16.634-08:00</updated><title type='text'>Necessary and Sufficient Causes</title><content type='html'>One of the common formulations of &lt;i&gt;determinism&lt;/i&gt;&amp;nbsp;is (quoting from &lt;a href=&quot;https://en.wikipedia.org/wiki/Determinism&quot;&gt;Wikipedia&lt;/a&gt;)&lt;br /&gt; &lt;blockquote&gt; &lt;b&gt;Determinism&lt;/b&gt;&amp;nbsp;is the philosophical position that for every event, including human interactions, there exist conditions that could cause no other event.&lt;/blockquote&gt; A world that satisfies this definition of determinism can evolve in only a single way over time. This definition is stonger than merely saying that the event&#39;s causes are &lt;a href=&quot;https://en.wikipedia.org/wiki/Causality&quot;&gt;&lt;em&gt;necessary&lt;/em&gt;, &lt;em&gt;sufficient&lt;/em&gt;, or even &lt;em&gt;necessary and sufficient&lt;/em&gt;&lt;/a&gt;. To see why that is so, I will demonstrate a series of model worlds each of which is an intentionally flawed &lt;a href=&quot;https://en.wikipedia.org/wiki/Interpretation_(logic)&quot;&gt;&lt;em&gt;Interpretation&lt;/em&gt;&lt;/a&gt; of &lt;a href=&quot;https://en.wikipedia.org/wiki/Determinism&quot;&gt;&quot;Determinism&quot;&lt;/a&gt;. Each model will be a very simple imaginary &quot;world&quot;; it is not intended to reflect the real world, but is rather just an abstract thing that helps us understand the implications of the definition. Through this series of models, we&#39;ll see that the definition of determinism above is stronger than even saying that every cause &lt;em&gt;necessary and sufficient&lt;/em&gt; for its effect.&lt;br /&gt; &lt;br /&gt; For these models we have the following concepts:&lt;br /&gt; &lt;ul&gt; &lt;li&gt;&lt;b&gt;Variable:&amp;nbsp;&lt;/b&gt;Some fact or condition about the state of the world. In our example will use a letter to designate each abstract fact about the world.&lt;/li&gt; &lt;li&gt;&lt;b&gt;State:&amp;nbsp;&lt;/b&gt;The set of variables designating the state of the world at some time. In our example we will use a set of letters to designate the state of the world, but it will always happen to be a single variable at any given time.&lt;/li&gt; &lt;li&gt;&lt;b&gt;Cause:&amp;nbsp;&lt;/b&gt;Some variable or variables that lead to an Event occurring (resulting in the specific Effect of that Event)&lt;/li&gt; &lt;li&gt;&lt;b&gt;Event:&amp;nbsp;&lt;/b&gt;Something that can occur from one moment to the next and has a specific Effect&lt;/li&gt; &lt;li&gt;&lt;b&gt;Effect:&amp;nbsp;&lt;/b&gt;A change in the state of the world&lt;/li&gt; &lt;li&gt;&lt;b&gt;Initial Condition:&amp;nbsp;&lt;/b&gt;The state of the world at the beginning of some time of interest&lt;/li&gt; &lt;/ul&gt; &lt;h3&gt; Every cause being &lt;em&gt;necessary&lt;/em&gt; does not imply determinism.&lt;/h3&gt; &lt;br /&gt; First lets us examine &lt;em&gt;necessary causes&lt;/em&gt;. &lt;a href=&quot;https://en.wikipedia.org/wiki/Causality&quot;&gt;According to Wikipedia&lt;/a&gt;&lt;br /&gt; &lt;blockquote&gt; If &lt;i&gt;x &lt;/i&gt;is a necessary cause of &lt;i&gt;y&lt;/i&gt;, then the presence of &lt;i&gt;y &lt;/i&gt;necessarily implies the presence of &lt;i&gt;x&lt;/i&gt;. The presence of &lt;i&gt;x&lt;/i&gt;, however, does not imply that &lt;i&gt;y &lt;/i&gt;will occur.&lt;/blockquote&gt; A good example of a necessary cause in nature is &lt;a href=&quot;https://en.wikipedia.org/wiki/Particle_decay&quot;&gt;particle decay&lt;/a&gt;. A particle that can decay is a necessary cause of the particle&#39;s decay, because the particle&#39;s decay necessarily implies that there &lt;i&gt;was a particle there&lt;/i&gt; that could decay. The presence of a particle that can decay, however, does not imply that the particle&#39;s decay will occur. While the presence of a particle that can decay is &lt;em&gt;necessary&lt;/em&gt; in order for the decay to occur, it is not &lt;em&gt;sufficient&lt;/em&gt; for the decay to occur. The laws of physics (as best we understand them today) do not say that there is any &lt;em&gt;sufficient&lt;/em&gt; condition for the particle to decay.&lt;br /&gt; &lt;br /&gt; One might imagine that the claim that there is no sufficient condition for particle decay is merely a limitation of our knowledge, rather than a fundamental feature of nature. Perhaps there are &lt;em&gt;hidden variables&lt;/em&gt; that cause the decay to occur at some particular time, but we simply do not know how to (or even cannot) measure these variables? That is not the case. It has been shown that the assumption that there are local (i.e. consistent with relativity) hidden variables underlying quantum indeterminacy contradicts observations of entanglement in experiments like the &lt;a href=&quot;https://en.wikipedia.org/wiki/Double-slit_experiment&quot;&gt;double-slit experiment&lt;/a&gt; and those demonstrating &lt;a href=&quot;https://en.wikipedia.org/wiki/Bell%27s_theorem&quot;&gt;Bell&#39;s inequality&lt;/a&gt;. In any case, the point of our discussion here is to understand the implications of the definitions of causality, not to determine which of them are satisfied by nature.&lt;br /&gt; &lt;br /&gt; Our first model simplifies the behavior of the K&lt;sub&gt;S&lt;/sub&gt; meson, which can decay in more than one way. For simplicity we shall pretend that it can decay in precisely two ways. At any given moment it might not decay, or it might decay in one of these two ways. We describe our simplified model of the world as follows:&lt;br /&gt; &lt;blockquote&gt; Initial condition: K (meaning the K&lt;sub&gt;S&lt;/sub&gt; meson is present)&lt;br /&gt; Possible events:&lt;br /&gt; &amp;nbsp; E1: precondition: K is present&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; change in state: no change in state (K does not decay)&lt;br /&gt; &amp;nbsp; E2: precondition: K is present&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; change in state: remove K from the state, and add P (decay to particle P)&lt;br /&gt; &amp;nbsp; E3: precondition: K is present&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; change in state: remove K from the state, and add Q (decay to particle Q)&lt;/blockquote&gt; There are more than one ways in which this world can evolve. We can have an unending series of occurrences of E1 (meaning the particle never decays). We can either have zero or more occurrences of E1 (meaning nothing happens for a time), followed by E2. Finally, we can have zero or more occurrences of E1, followed by E3. These latter two possibilities result in a different final state. This model world is thus a counterexample to the proposition that &quot;every event has a necessary cause&quot; implies that the world is deterministic.&lt;br /&gt; &lt;br /&gt; &lt;h3&gt; Every cause being &lt;em&gt;necessary and sufficient&lt;/em&gt; does not imply determinism.&lt;/h3&gt; &lt;br /&gt; Let us examine &lt;em&gt;sufficient causes&lt;/em&gt;. &lt;a href=&quot;https://en.wikipedia.org/wiki/Causality&quot;&gt;According to Wikipedia&lt;/a&gt;&lt;br /&gt; &lt;blockquote&gt; If &lt;i&gt;x &lt;/i&gt;is a sufficient cause of &lt;i&gt;y&lt;/i&gt;, then the presence of &lt;i&gt;x &lt;/i&gt;necessarily implies the presence of &lt;i&gt;y&lt;/i&gt;. However, another cause &lt;i&gt;z &lt;/i&gt;may alternatively cause &lt;i&gt;y&lt;/i&gt;. Thus the presence of &lt;i&gt;y &lt;/i&gt;does not imply the presence of &lt;i&gt;x&lt;/i&gt;.&lt;/blockquote&gt; We can imagine an example of &lt;em&gt;sufficient cause&lt;/em&gt; being the burning of a book. It would be sufficient for the book to be thrown into an incinerator for the book to burn. However, that is not &lt;em&gt;necessary&lt;/em&gt;, as there are other sufficient conditions for it to burn (for example, being thrown on a bonfire). Being a &lt;em&gt;sufficient cause&lt;/em&gt; is neither stronger nor weaker than being a &lt;em&gt;necessary cause&lt;/em&gt;. It is worth asking: what if every cause is both &lt;em&gt;necessary and sufficient&lt;/em&gt; for its effect? Would that be enough to imply that the world is deterministic? We can demonstrate that this is not so by another model world, as follows:&lt;br /&gt; &lt;blockquote&gt; Initial condition: [A,B] (two different facts about the world are true: A and B)&lt;br /&gt; Possible events:&lt;br /&gt; &amp;nbsp; E1: precondition: A is present&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; change in state: remove A from the state, remove Z from the state if it is present, and add X&lt;br /&gt; &amp;nbsp; E2: precondition: B is present&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; change in state: remove B from the state, and add Y and Z&lt;/blockquote&gt; In this example, the cause A is both necessary and sufficient for its effects (it always leads to E1 occurring). The cause B is both necessary and sufficient for its effects too. There are two ways in which this world can evolve. We can have an event produced by the first rule, followed by an event produced by the second rule. In that case the final state of the world is [X,Y,Z]. Or we can have an event produced by the second rule, followed by an event produced by the first rule. In that case the final state of the world is [X,Y]. As we can see, this world is not deterministic. This model world is thus a counterexample to the proposition that &quot;every event has a necessary and sufficient cause&quot; implies that the world is deterministic.&lt;br /&gt; &lt;br /&gt; We can now see why the &lt;a href=&quot;https://en.wikipedia.org/wiki/Determinism&quot;&gt;usual philosophical definition&lt;/a&gt; of determinism is stronger:&lt;br /&gt; &lt;blockquote&gt; &lt;b&gt;Determinism&lt;/b&gt; is the philosophical position that for every event, including human interactions, there exist conditions that could cause no other event.&lt;/blockquote&gt; It is worth asking whether or not any of these definitions might correspond to the real world we live in. As far as we know, time is &lt;em&gt;continuous&lt;/em&gt;, rather than &lt;em&gt;discrete&lt;/em&gt;. Since these models require discrete time, they don&#39;t fit the real world, though there are tantalizing theories (yet to be tested) that time might be quantized. In addition, the usual philosophical definition of determinism requires a fixed ordering of all events throughout the universe. &lt;i&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Theory_of_relativity&quot;&gt;Relativity&lt;/a&gt; &lt;/i&gt;teaches us that there is no objective order of the occurrence of events: event ordering varies from one (subjective) inertial reference frame to another. These two facts make it nearly impossible to reconcile any widely accepted modern theory of the physical world with philosophy&#39;s concept of &quot;determinism&quot;. A more useful definition might be found in the physicist&#39;s use of the term &quot;deterministic&quot; to describe a system that is capable of having only one possible future evolution. The most widely held scientific theories that explain the results of quantum measurement are not deterministic in that sense.&lt;br /&gt; &lt;br /&gt; &lt;h3&gt; Some other definitions do not imply determinism&lt;/h3&gt; &lt;br /&gt; There are other definitions of determinism that one might find discussed on the web. It is sometimes hard to determine if they are stronger, weaker, or equivalent to the usual philosophical definition. For example, there is a model frequently discussed on &lt;a href=&quot;http://breakingthefreewillillusion.com/determinism-indeterminism-confusions/&quot;&gt;http://breakingthefreewillillusion.com/&lt;/a&gt;. As far as I can tell the author&#39;s intended definition does not correspond to any of the definitions above. He has told me that the definition does not include &lt;em&gt;sufficient causality&lt;/em&gt;, as that is logically inferred from his definition, and he has directed my attention to his proofs at&amp;nbsp;&lt;a href=&quot;http://breakingthefreewillillusion.com/must-lead-to-causality/&quot;&gt;http://breakingthefreewillillusion.com/must-lead-to-causality/&lt;/a&gt; and &lt;a href=&quot;http://breakingthefreewillillusion.com/otherwise-causal-contradiction/&quot;&gt;http://breakingthefreewillillusion.com/otherwise-causal-contradiction/&lt;/a&gt;. Similarly, his definition does not include &lt;em&gt;necessary causality&lt;/em&gt;: see &lt;a href=&quot;http://breakingthefreewillillusion.com/necessary-sufficient-causality/&quot;&gt;http://breakingthefreewillillusion.com/necessary-sufficient-causality/&lt;/a&gt;. As I was unable to find a concise description of the definition he was using, I engaged with him over the course of a few weeks to draw up a definition to use for analysis. This is what we came up with:&lt;br /&gt; &lt;blockquote&gt; &lt;ul&gt; &lt;li&gt;&lt;b&gt;Event&lt;/b&gt;: A change in state from one moment to the next, described by its &lt;i&gt;State Change&lt;/i&gt;.&lt;/li&gt; &lt;li&gt;&lt;b&gt;Causal event&lt;/b&gt;: An event that is caused by some set of &lt;i&gt;Variables &lt;/i&gt;and whose &lt;i&gt;Effect &lt;/i&gt;is derived entirely from those &lt;i&gt;Variables&lt;/i&gt;.&lt;/li&gt; &lt;li&gt;&lt;b&gt;Cause&lt;/b&gt;: a set of pre-existing variables that derives (causes) the &lt;i&gt;Effect &lt;/i&gt;in it&#39;s entirety (of a causal event). The variables of a cause includes all physical parts and physical laws that are described by formulas, which in the case of a causal event, force the output of the effect.&lt;/li&gt; &lt;li&gt;&lt;b&gt;Variables&lt;/b&gt;: The &quot;parts&quot; of a specific physical configuration (parts of the state). We shall indicate each variable by a letter like &quot;A&quot;; or a letter, and equals sign, and a number like &quot;x=10&quot;.&amp;nbsp;&lt;/li&gt; &lt;li&gt;&lt;b&gt;State Change&lt;/b&gt;: The ontological change in the state that results from an event. For State Change we need not include in the change mention of variables that are not changed, but the variables that do not change may play a role in the variables that do.&lt;/li&gt; &lt;li&gt;&lt;b&gt;Effect&lt;/b&gt;: A &lt;i&gt;State Change&lt;/i&gt; for a &lt;i&gt;Causal Event&lt;/i&gt;.&lt;/li&gt; &lt;li&gt;&lt;b&gt;State&lt;/b&gt;: The &quot;whole&quot; encompassing all variables in a specific physical configuration. We shall indicate a state by a list of variables between square brackets, for example &quot;[x=10,A]&quot;&lt;/li&gt; &lt;li&gt;&lt;b&gt;Scenario&lt;/b&gt;: Specific sequence of causes and effects that can be contrasted with other scenarios. We shall indicate a scenario notationally by a sequence of states, starting with the &lt;i&gt;Initial State&lt;/i&gt;, indicating for reference the law of physics that describes the event between each pair of states.&lt;/li&gt; &lt;li&gt;&lt;b&gt;Initial State&lt;/b&gt;: The first state in a scenario.&lt;/li&gt; &lt;li&gt;&lt;b&gt;Laws of Physics (LoP)&lt;/b&gt;: The constraining behavior of the universe, which is also inherent in all existing physical variables in the universe.&lt;/li&gt; &lt;li&gt;&lt;b&gt;Formulas for LoP&lt;/b&gt;: We shall represent the laws of physics using Equations, formulas, mathematics, or any sort of symbolic language.&lt;/li&gt; &lt;li&gt;&lt;b&gt;Determinism&lt;/b&gt;: &quot;every event is causal&quot;&amp;nbsp;&lt;/li&gt; &lt;/ul&gt; A scenario starts with a given &lt;i&gt;Initial State&lt;/i&gt;, and evolves through a sequence of steps by &lt;i&gt;Events &lt;/i&gt;produced according to the world&#39;s &lt;i&gt;Laws of Physics&lt;/i&gt;, each step producing a new &lt;i&gt;State&lt;/i&gt;.&lt;br /&gt; &lt;br /&gt; The scenario must continue until no further events are possible.&lt;br /&gt; &lt;br /&gt; Our goal is to evaluate the following hypothesis:&lt;br /&gt; &lt;b&gt;Hypothesis&lt;/b&gt;: Given a particular &lt;i&gt;Initial State&lt;/i&gt;, if a &lt;i&gt;Scenario &lt;/i&gt;that begins with that &lt;i&gt;Initial State&lt;/i&gt;&amp;nbsp;satisfies &lt;i&gt;Determinism&lt;/i&gt;, then every &lt;i&gt;Scenario &lt;/i&gt;that begins with that&amp;nbsp;&lt;i&gt;Initial State&lt;/i&gt;&amp;nbsp;is the same.&lt;/blockquote&gt; The author asked me to add this comment to this set of definitions:&lt;br /&gt; &lt;blockquote&gt; &quot;These definitions are one&#39;s that Trick [the author] and I, after much deliberation, have agreed to for the assessment I will make. It isn&#39;t the case that, for example, Trick&#39;s regular usage of the concept of causality requires an entirely physicalist account, but for the sake of our discussion we are both agreeing on a physical universe only. There are also some words that Trick normally wouldn&#39;t use, but for the sake of clarity we added them.&quot;&lt;/blockquote&gt; Now we can try the model world from our analysis of &lt;em&gt;necessary and sufficient&lt;/em&gt; causes:&lt;br /&gt; &lt;blockquote&gt; Initial state: [A,B]&lt;br /&gt; The laws of physics permit the following possible events:&lt;br /&gt; &amp;nbsp; E1: precondition: A is present&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; change in state: remove A from the state, remove Z from the state if it is present, and add X&lt;br /&gt; &amp;nbsp; E2: precondition: B is present&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; change in state: remove B from the state, and add Y and Z&lt;br /&gt; Scenario S1: [A,B] E1 [X,B] E2 [X,Y,Z]&lt;br /&gt; Scenario S2: [A,B] E2 [A,Y,Z] E1 [X,Y]&lt;/blockquote&gt; To evaluate the hypothesis, we will analyze S1. There are two events. The first, E1, is a causal event with cause [A]. The second, E2, is a causal event with cause [B]. Thus this scenario satisfies the definition of Determinism. Similarly scenario S2 satisfies the definition of Determinism. However, we can see that scenarios S1 and S2 are different from each other. Moreover, they end with different world states. Thus this counterexample disproves the hypothesis. We can therefore conclude that this definition is &lt;em&gt;weaker&lt;/em&gt; than the usual philosophical definition of Determinism, and the definition discussed at &lt;a href=&quot;http://breakingthefreewillillusion.com/&quot;&gt;http://breakingthefreewillillusion.com/&lt;/a&gt;, if satisfied by a world, does not imply that the world&#39;s timeline &quot;could not have been otherwise&quot;.&lt;br /&gt; &lt;br /&gt; One might ask what causes one event to occur before the other in one scenario but vice-versa in the other scenario; what causes the ordering of events? In the ontology of this definition of determinism, an event (a change in state from one moment to the next) or an effect (a change in state for a causal event) can be caused, but the &quot;order&quot; of these changes is not something that can be caused. So the question does not make sense. The whole point of this example is to surface the fact that this definition of determinism does not require events to be ordered in any particular way. That is how it differs from the usual philosophical definition of determinism.&lt;br /&gt; &lt;br /&gt; In his defense, the author has not evaluated my argument in detail, but has explained to me that I must be either&lt;br /&gt; &lt;ol&gt; &lt;li&gt;Asserting a variable with self-contradictory properties; or&lt;/li&gt; &lt;li&gt;Smuggling in an acausal event (an event without any cause)&lt;/li&gt; &lt;/ol&gt; though I do not know of any variable that is contradictory, or any event does not have a cause in this example.&lt;br /&gt; &lt;br /&gt; &lt;hr /&gt; &lt;br /&gt; This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.&lt;br /&gt; See http://creativecommons.org/licenses/by-sa/4.0/</content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=417049473683427009' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/417049473683427009'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/417049473683427009'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2016/02/necessary-and-sufficient-causes.html' title='Necessary and Sufficient Causes'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-3381587459732069582</id><published>2016-01-26T21:16:00.000-08:00</published><updated>2016-01-27T10:44:17.433-08:00</updated><title type='text'>OK, so you do/not have free will. So what?</title><content type='html'>We previously proved that you (do or do not) have free will. What are the consequences of that fact?&lt;br /&gt; &lt;br /&gt; Before we answer, let&#39;s review the conclusion. There are many definitions of free will. It is worth asking (and I have been asked) whether we would reach the same conclusion based on other definitions.&lt;br /&gt; &lt;br /&gt; One definition asks the question: if there were an infinitely powerful being who knew all facts about the present, would it be capable of predicting the outcome of your future decision? I cannot tell if this question has a counterfactual premise, like the question we previously answered, or if it is a theological question. If it is the former, the same proof form would apply to demonstrate the same result. If it is a theological question the answer probably depends on which holy book you consult. A related question asks: if we could build a sufficiently powerful computer and feed it the complete state of the universe, would it be capable of computing our future choices? Again, the proof form we used before can be applied. A team of rogue scientists (rogue because they used &quot;borrowed&quot; equipment) claim to have constructed such a computer, and they claim that its prediction rate is 100% so far. I am suspicious of this claim, as their computer appears not to be capable of predicting a decision until after it has been made. The computer is called World Of Real Life Determinator, with the nice-sounding acronym WORLD.&lt;br /&gt; &lt;br /&gt; A different definition asks the perhaps more sensible question regarding your future decisions, rather than your past decisions: for your future decision, is more than one option a possible future? In other words, can you do &quot;otherwise&quot; for a future decision? This question can be answered scientifically! There are three scientific approaches to the question, but unfortunately the result is somewhat ambiguous. The first approach is simple: from experience it is obvious that every decision we made previously was not made &quot;otherwise&quot;, but was instead made in precisely the way we made it. If we assume the future to be similar to the past - that is a basic assumption of science, after all - then we should expect that future decisions to similarly not be &quot;otherwise&quot;. We can test this theory too and we observe, as we expect, that any further decision we make is not made &quot;otherwise&quot;. This approach to the scientific question clearly points out that we do not have free will. This is a well-respected proof form called &lt;i&gt;&lt;a href=&quot;http://fallacyaday.com/2011/10/retrospective-determinism/&quot;&gt;retrospective determinism&lt;/a&gt;.&lt;/i&gt;&lt;br /&gt; &lt;br /&gt; The second approach is to consult the physicists. The most widely accepted interpretations of quantum physics teach us that the results of quantum interactions are not determined by the previous state of the universe. That leaves room for small random fluctuations at the quantum and microscopic levels to affect our behavior over time as differences are amplified by chaotic processes in nature. In other words, the future is not determined. The incompatibilists have shown that this does not allow for free will, as we are not fundamentally in control of the random processes that affect our decisions; this is the well-respected proof form &lt;i&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Moving_the_goalposts&quot;&gt;moving the goalposts&lt;/a&gt;&lt;/i&gt;. On the other hand, there &lt;i&gt;are&lt;/i&gt;&amp;nbsp;interpretations of quantum mechanics that, though not widely accepted, say the opposite.&lt;br /&gt; &lt;br /&gt; The final scientific approach to this question gets to the root of the issue. The point of the question regarding free will is really about moral judgments of others. If nobody has free will, the argument goes, it would be absurd to blame or praise other people, for they were unable to freely choose how to behave. This is a well-respected argument form called &lt;a href=&quot;https://en.wikipedia.org/wiki/Argumentum_ad_lapidem&quot;&gt;&lt;i&gt;argumentum ad lapidem&lt;/i&gt;&lt;/a&gt;. Can we scientifically test whether blame and praise are absurd or useful?&lt;br /&gt; &lt;br /&gt; It turns out such an experiment had already been performed. In 1954 a team of scientists put together one of the largest controlled scientific experiments involving people that had ever been conducted. Eight hundred thousand people were selected for participation in the experiment, and randomly assigned to one of two groups. One group was assigned to live in the newly constructed city Dexter, which was operated under the assumption that blame and praise are proper to the conduct of a society. The other group was assigned to the new city Sinister, which was operated under the assumption that blame and praise are useless. Most people were not told which group they were assigned to; though they knew the name of their city, they did not know under which set of assumptions it was operated. Of course it became apparent after a time. The experiment ran for a full year. It led to a large number of PhD theses, research results, conferences, and scholoarly scientific debates. As we&#39;ll see, the results of the experiment were somewhat ambiguous.&lt;br /&gt; &lt;br /&gt; The differences between Dexter and Sinister were as follows. In Dexter, police detectives were given the duty of assigning blame for crimes to individuals living in the city based on the individual&#39;s presence late in the causal chain leading to the criminal act. In other words, in the usual way. These people, called &quot;criminals&quot;, were then subjected to what we would consider a typical criminal justice system. Rather than eliminating the criminal justice system in Sinister entirely, scientists eliminated only the assignment of blame based on the person associated with the criminal act. Instead, the police detectives of Sinister were responsible for conducting a kind of lottery for each crime committed. In this way blame would be assigned to a random citizen, or nobody at all (at a rate comparable to the conviction rate in Dexter). The conduct of the criminal justice systems in&amp;nbsp;Dexter and Sinister mirrored each other, with the exception that blame in Sinister was assigned randomly.&lt;br /&gt; &lt;br /&gt; Similarly, praise and reward in Dexter would be assigned to individuals on the basis of their presence late in the causal chain of events leading to outcomes considered useful or desirable. Productive employees would receive a raise and perhaps a promotion. In Sinister, however, praise and reward would be assigned randomly, in a way unrelated to the behavior of the individual. Parents in Sinister were taught to love and praise their children unconditionally, no matter the child&#39;s behavior.&lt;br /&gt; &lt;br /&gt; The experiment was originally intended to run longer than a year, but had to be cut short due to funding issues. By the end of the year there were severe problems in Sinister that led many of its citizens to want to quit the project. There was, however, sufficient funding to analyze the results. It was clear to all that there were deeply disturbing differences between the two cities. Dexter, on the one hand, evolved in the way one would expect of a civilized society. Sinister, on the other hand, experienced rampant crime, surprisingly low worker productivity, and many competing gangs and militia. A significantly larger number of people survived the experiment in Dexter rather than in Sinister. But what to make of these results?&lt;br /&gt; &lt;br /&gt; There emerged two camps of scientists who differed in their interpretation of the experiment&#39;s results. They called themselves the conflationists and the inconflationists.&lt;br /&gt; &lt;br /&gt; The inconflationists believed that the experiment had improperly conflated &quot;fundamental, moral&quot; blame with blame in the usual sense, and therefore was not useful for answering any question about whether or not blame and praise are appropriate. While the experiment had demonstrated differences between the two cities, the inconflationists argued that all such differences were easily explained by virtue of the usual mechanisms of the laws of physics, psychology, economics, and other sciences. Many of the inconflationist researchers went on to take prestigious and influential positions as Philosophy professors.&lt;br /&gt; &lt;br /&gt; The conflationists believed that the experiment had solidly demonstrated the role of blame and praise in the conduct of a civilized society, and that the results on their face were a clear demonstration of their utility. Many of the conflationist researchers went on to take prestigious and influential positions as researchers in the Social Sciences.&lt;br /&gt; &lt;br /&gt; Despite their differences, the conflationists and the inconflationists agreed, for the most part, on appropriate conduct for individuals.&lt;br /&gt; &lt;br /&gt; &lt;hr /&gt; This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. See http://creativecommons.org/licenses/by-sa/4.0/</content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=3381587459732069582' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/3381587459732069582'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/3381587459732069582'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2016/01/ok-so-you-donot-have-free-will-so-what.html' title='OK, so you do/not have free will. So what?'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-4296210446242047647</id><published>2016-01-22T17:12:00.000-08:00</published><updated>2016-01-22T20:24:46.470-08:00</updated><title type='text'>Proof That We Have Free Will. And Don&#39;t Have Free Will!</title><content type='html'>A key question philosophers ask is whether the decisions and actions that a person takes &lt;em&gt;could have been otherwise&lt;/em&gt;. If so, we say they have free will. If not, we say they do not have free will. The battle between these two camps of philosophers is fierce and bloody, and responsible for the severe shortage of philosophers around the world. I will attempt to finally settle the issue logically, in a way that each side will be able to claim victory. Finally, peace for philosophers!&lt;br /&gt; &lt;br /&gt; If you&#39;re a &lt;em&gt;compatibilist&lt;/em&gt;, and believe that free will is compatible with the laws of physics, you&#39;re in luck! Think of any decision you made in the past that turned out to be a good decision. Did you accept just the right marriage proposal? Pick the right stock at the right time? Maybe your dessert choice at the restaurant turned out to be even more delicious than you imagined. I will prove, logically, that you &lt;em&gt;could have done otherwise&lt;/em&gt;, and therefore that the choice was &lt;em&gt;up to you&lt;/em&gt;. You are therefore entitled to all the praise and enjoyment that may result from your decision. Hurray for you!&lt;br /&gt; &lt;br /&gt; If you&#39;re an &lt;em&gt;incompatibilist&lt;/em&gt;, and believe that free will is incompatible with the laws of physics, you&#39;re in luck! Think of any decision you made in the past that turned out to be a bad decision. Did you pick the wrong job? Cheat on your significant other, causing a breakup? Maybe you just picked something from the menu at the restaurant that turned out to be tainted and made you sick? I will prove, logically, that you &lt;em&gt;could not have done otherwise&lt;/em&gt;, and therefore that the choice was &lt;em&gt;not up to you&lt;/em&gt;. You are therefore excused from any moral responsibility for the choice. It wasn&#39;t your fault!&lt;br /&gt; &lt;br /&gt; If you&#39;re a logician, and fear that these two positions are fundamentally incompatible, you&#39;re in luck too! If we parse the meaning of the two positions carefully, we will see that they are not logically opposite to each other. Perhaps you selected the most delicious dessert, but it also made you sick. Should you take credit for the decision or not? As we&#39;ll see, the answer is yes, your should take credit for the decision... or not. You will not need to &lt;a href=&quot;https://en.wikiquote.org/wiki/Through_the_Looking-Glass&quot;&gt;&lt;em&gt;believe&amp;nbsp;impossible things&lt;/em&gt;&lt;/a&gt;, like the Queen in &lt;em&gt;&lt;a href=&quot;http://www.amazon.com/gp/product/0957148399/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=0957148399&amp;amp;linkCode=as2&amp;amp;tag=wwwgafterco07-20&amp;amp;linkId=XGEDP47N4SC2LIU3&quot; rel=&quot;nofollow&quot;&gt;Alice Through the Looking-Glass&lt;/a&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://ir-na.amazon-adsystem.com/e/ir?t=wwwgafterco07-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=0957148399&quot; height=&quot;1&quot; style=&quot;border: none !important; margin: 0px !important;&quot; width=&quot;1&quot; /&gt;&lt;/em&gt;, to believe both at the same time. I will prove that these two positions are not merely logically compatible, but they are both mutually necessary consequences of our understanding of the world. Yay logic!&lt;br /&gt; &lt;br /&gt; &lt;h2&gt; Background, Assumptions, and Definitions&lt;/h2&gt; &lt;blockquote&gt; &lt;br /&gt; &lt;b&gt;The thing to be proven is&lt;/b&gt;&lt;br /&gt; &lt;br /&gt; &lt;dl&gt; &lt;dt&gt;&lt;em&gt;(if you&#39;re an incompatibilist)&lt;/em&gt;:&lt;br /&gt; &lt;/dt&gt; &lt;dd&gt;If we could rewind the world to precisely the state before any particular decision you made that you regret, then you would make exactly the same decision.&lt;/dd&gt; &lt;dt&gt;&lt;br /&gt; &lt;em&gt;(if you&#39;re a compatibilist)&lt;/em&gt;&lt;br /&gt; &lt;/dt&gt; &lt;dd&gt;If we could rewind the world to precisely the state before any particular decision you made that you were happy with, then you would make a different decision.&lt;/dd&gt;&lt;/dl&gt; &lt;/blockquote&gt; If you are a logician we will expect a little more from you. You will have to follow two proofs at once. You&#39;re up to it.&lt;br /&gt; &lt;br /&gt; We will prove these propositions using only first-order predicate logic and a few &quot;facts&quot; about the world that you are asked to agree to. Don&#39;t worry, we are not asking for much. These will be treated as axioms in our proofs. We&#39;ll label them so that we can refer to them later.&lt;br /&gt; &lt;blockquote&gt; &lt;b&gt;(A1) Axiom 1: Increasing Entropy.&lt;/b&gt; Future states of the universe have a &lt;a href=&quot;https://www.youtube.com/watch?v=-Km7-6-J81k&quot;&gt;higher total entropy than past states&lt;/a&gt;.&lt;/blockquote&gt; The time scales of interest here are those meaningful to a person: seconds, minutes, months, years. The intent of this axiom is that nothing may occur that would cause total entropy of the universe to &lt;em&gt;decrease&lt;/em&gt; over any meaningful time scale. This axiom is consistent with every widely-held scientific view of the physical world. It is one form of the &lt;a href=&quot;https://www.youtube.com/watch?v=-Km7-6-J81k&quot;&gt;second law of thermodynamics&lt;/a&gt;.&lt;br /&gt; &lt;blockquote&gt; &lt;b&gt;(A2) Axiom 2: (In)Determinism.&lt;/b&gt; The world is deterministic, in the sense meant by physicists. (Unless you&#39;re a compatibilist.)&lt;/blockquote&gt; The future state of the world is fully determined by the present state, without the possibility of any variation. For those of you who believe in any of that hooey &quot;quantum physics science&quot; nondeterminism nonsense, or the soul, or god&#39;s influence over our actions, or karma, we won&#39;t allow any of that in our model of the world. Actually, no, wait, scratch that. If you&#39;re an incompatibilist, this axiom is that the world is deterministic. If you&#39;re a compatibilist, this axiom is that the world is nondeterministic, and you&#39;re allowed whichever of these odd beliefs make you happy. (If you&#39;re a logician, take your pick. We don&#39;t actually use this axiom.)&lt;br /&gt; &lt;blockquote&gt; &lt;b&gt;(A3) Axiom 3: No Time Travel.&lt;/b&gt; The future state of the world is only affected by the &lt;em&gt;past&lt;/em&gt; state of the world.&lt;/blockquote&gt; The future can be affected by the past, and whatever other things we allowed you to believe through Axiom 2. But none of those things are allowed to carry information, or matter, of any kind from the future into the past. You&#39;re not allowed to whisper stock picks into the ear of your past self, or send an iPad to 1960, or kill your grandfather. These are things that would modify the &lt;em&gt;state&lt;/em&gt; of the world after rewinding it to a previous state, so it isn&#39;t allowed. This axiom is consistent with the currently known laws of physics. (If you&#39;re a logician and aren&#39;t sure what Axiom 2 allowed you to believe, don&#39;t worry. We don&#39;t actually use this axiom either.)&lt;br /&gt; &lt;br /&gt; &lt;h2&gt; The Experimental Method&lt;/h2&gt; &lt;br /&gt; One approach we could take to addressing this question is to just &lt;em&gt;try it&lt;/em&gt;. Surely, as scientists, that would be the most rational thing to do. Unfortunately, reality rears its ugly head:&lt;br /&gt; &lt;ul&gt; &lt;li&gt;We do not currently have the technology to &quot;reset&quot; the complete state of the world to some previous state.&lt;br /&gt; &lt;/li&gt; &lt;li&gt;If you were to actually reset the world to a previous state, you would probably end up going through the day and then getting to a time that you &lt;em&gt;do the same experiment again&lt;/em&gt;. You would, essentially, find yourself in some strange version of &lt;a href=&quot;http://www.amazon.com/gp/product/B000Z8GZYW/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=B000Z8GZYW&amp;amp;linkCode=as2&amp;amp;tag=wwwgafterco07-20&amp;amp;linkId=WBONQFCKQBOHAOFN&quot; rel=&quot;nofollow&quot;&gt;Bill Murray&#39;s Groundhog Day&lt;/a&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://ir-na.amazon-adsystem.com/e/ir?t=wwwgafterco07-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=B000Z8GZYW&quot; height=&quot;1&quot; style=&quot;border: none !important; margin: 0px !important;&quot; width=&quot;1&quot; /&gt;, living the same day of your life over and over again forever.&lt;br /&gt; &lt;/li&gt; &lt;li&gt;Since we are resetting the entire state of the world, as experimenters we would not know what you did &lt;em&gt;the first time&lt;/em&gt; because our memory would have been erased. So we would have no way to judge whether or not you made the same decision &lt;em&gt;the second time&lt;/em&gt;.&lt;br /&gt; &lt;/li&gt; &lt;/ul&gt; Unfortunately, this will remain a thought experiment for now. &lt;br /&gt; &lt;br /&gt; &lt;h2&gt; Proof Technique&lt;/h2&gt; &lt;br /&gt; We use the ordinary proof techniques of first-order predicate logic. Specifically, if we want to prove a statement of the form &quot;If P then Q&quot; also sometimes written &quot;P implies Q&quot; for some proposed statements P and Q, then we can proceed using the technique of &lt;em&gt;proof by contradiction&lt;/em&gt;. To do that, we assume all of our axioms, and also assume P, and also assume NOT Q, and then attempt to derive a contradiction from this set of assumptions. If we can derive a contradiction, then we consider the proposition &quot;If P then Q&quot; to be proven. Our original thing to be proven is precisely in this form, so this proof technique can be applied directly. &lt;br /&gt; &lt;br /&gt; &lt;h2&gt; The Proof&lt;/h2&gt; &lt;br /&gt; Along with the axioms, we proceed to use proof by contradiction by assuming P (for &quot;premise&quot;) and NOT Q (we will call this S) from the thing to be proven, which we recall is &lt;br /&gt; &lt;dl&gt; &lt;dt&gt;&lt;em&gt;(if you&#39;re an incompatibilist)&lt;/em&gt;:&lt;br /&gt; &lt;/dt&gt; &lt;dd&gt;If we could rewind the world to precisely the state before any particular decision you made that you regret, then you would make exactly the same decision.&lt;/dd&gt; &lt;dt&gt;&lt;br /&gt; &lt;em&gt;(if you&#39;re a compatibilist)&lt;/em&gt;&lt;br /&gt; &lt;/dt&gt; &lt;dd&gt;If we could rewind the world to precisely the state before any particular decision you made that you were happy with, then you would make a different decision.&lt;/dd&gt;&lt;/dl&gt; &lt;blockquote&gt; &lt;b&gt;(P) Premise:&lt;/b&gt; we could rewind the world to precisely the state before a particular decision that you made. &lt;/blockquote&gt; &lt;blockquote&gt; &lt;b&gt;(S)&lt;/b&gt; You would &lt;em&gt;not&lt;/em&gt; make&lt;br /&gt; &lt;ul&gt; &lt;li&gt;(for incompatibilists) exactly the same decision;&lt;br /&gt; &lt;/li&gt; &lt;li&gt;(for compatibilists) a different decision.&lt;br /&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/blockquote&gt; Now, we need a lemma, derived from Axiom A1. Note that the entropy of the universe is, by A1, a property of the total state of the universe that is monotonically increasing when viewed on human time scales. Rewinding the state of the universe from some time &lt;em&gt;after&lt;/em&gt; a decision to some time &lt;em&gt;before&lt;/em&gt; that decision would be changing the state of the universe from a higher entropy state to a lower entropy state, which would violate A1. Therefore, as a corollary to A1 we have the lemma L1: &lt;br /&gt; &lt;blockquote&gt; &lt;b&gt;(L1) Lemma:&lt;/b&gt; we could NOT rewind the world to precisely the state before a particular decision you made. &lt;/blockquote&gt; We now have two facts, (P) and (L1) that are directly contradictory to each other. As we have derived a contradiction, we have completed a proof by contradiction of &quot;if P then Q&quot;, quod erat demonstrandum. &lt;br /&gt; &lt;br /&gt; &lt;h2&gt; Counterfactual What?&lt;/h2&gt; &lt;br /&gt; The disagreement between the compatibilists and the incompatibilists is based entirely on a fundamentally false, or &lt;a href=&quot;https://en.wikipedia.org/wiki/Counterfactual_conditional&quot;&gt;counterfactual&lt;/a&gt;, premise. It is not necessary to interpret such a position as literally requiring that the counterfactual be true when it isn&#39;t. Another way of interpreting this argument is to consider a universe as similar as possible to ours, but with the minimum possible changes such that &lt;em&gt;the counterfactual statement is true&lt;/em&gt;. The question then becomes whether such a universe is more similar to the one understood by the compatibilist, or the one understood by the incompatibilist. Unfortunately, in this case the second law of thermodynamics is so deeply rooted in our understanding of the way the world works that it does not make sense to imagine what such a world would look like &lt;em&gt;at all&lt;/em&gt;. A world like that would just not make sense to us, as the usual rules of &lt;i&gt;cause&lt;/i&gt;&amp;nbsp;and &lt;i&gt;effect&lt;/i&gt;&amp;nbsp;would not apply. So whichever camp you&#39;re in: congratulations, you&#39;re right! &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;hr /&gt; This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. See http://creativecommons.org/licenses/by-sa/4.0/ </content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=4296210446242047647' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/4296210446242047647'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/4296210446242047647'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2016/01/proof-that-we-have-free-will-and-dont.html' title='Proof That We Have Free Will. And Don&#39;t Have Free Will!'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-3685574365215268065</id><published>2016-01-21T16:53:00.001-08:00</published><updated>2016-01-21T16:58:04.111-08:00</updated><title type='text'>Free Will is a False Dilemma</title><content type='html'>There is an age-old debate among philosophers: do people have &lt;em&gt;free will&lt;/em&gt;? The question is considered important for moral judgment. If people don&#39;t have free will, it seems they shouldn&#39;t be held responsible for their actions. Why should we praise or scold a person for actions they were unable to control?&lt;br /&gt; &lt;br /&gt; I submit that the question isn&#39;t as complex as it seems, and neither is the answer important to help us decide how to behave. I believe the sides aren&#39;t as diametrically opposed as it would seem.&lt;br /&gt; &lt;br /&gt; The key question these philosophers are asking is whether the decisions and actions that a person takes &lt;em&gt;could have been otherwise&lt;/em&gt;. If a person&#39;s decisions could have been otherwise, then clearly they had free will to choose one or another option, and it makes sense to hold them responsible for the choice they actually made. But if, on the other hand, they &lt;em&gt;could NOT have done otherwise&lt;/em&gt;, what sense would it make to give them credit, or blame, for their actions?&lt;br /&gt; &lt;br /&gt; The question of free will is usually posed with the assumption that the world is deterministic, despite what we know about the inherent unpredictability of quantum physics. My intent isn&#39;t to question that assumption, at least not today. Let&#39;s take it as given that the world unfolds as a sequence of events, one after another, each the cause of the next in a well-defined way, even though mere mortals aren&#39;t able to predict the future in practice. The two sides in this debate are the compatibilists and the incompatibilists, reminiscent of the big-endians and little-endians of &lt;a href=&quot;https://en.wikipedia.org/wiki/Gulliver%27s_Travels&quot;&gt;Gulliver&#39;s Travels&lt;/a&gt;. Recall that the big-endians cracked their eggs on the big end, and the little-endians cracked them on the little end. Because they could not agree on such an important issue, they were forever at war.&lt;br /&gt; &lt;br /&gt; The incompatibilists believe free will is impossible (&quot;incompatible&quot; with determinism), as people are not in control of the ultimate causes of their actions. By &quot;ultimate cause&quot; they mean the cause of the cause of the cause... ad infinitum. Or as far as time can be said to have existed. Because a person cannot influence any link in the causal chain, they &quot;could not have done otherwise.&quot; The incompatibilists deem something like the big bang as the ultimate cause of everthing that has happened since. Because we did not control the big bang, we can&#39;t reasonably be held responsible for anything since then, such as our actions. To an incompatibilist, the concepts of moral blame and worth are nonsensical. A person can&#39;t reasonably be said to be ultimately responsible for their actions, and therefore they should not be held &lt;em&gt;moraly&lt;/em&gt; responsible, blamed, or praised. Many incompatibilists believe that an understanding of this truth will lead to a more humane treatment of our fellow man.&lt;br /&gt; &lt;br /&gt; The compatibilists, on the other hand, believe that we have free will (it is &quot;compatible&quot; with determinism) because people think, feel, make moral judgments, and decide how to act based on their thoughts and feelings. It is obvious that we have free will. The compatibilists don&#39;t care whether we have control over the chemical reactions in our bodies, or our genes, or the limited set of choices we have to select from. To a compatibilist, it isn&#39;t relevant whether or not we are the &lt;em&gt;ultimate&lt;/em&gt; cause; we are the &lt;em&gt;proximate&lt;/em&gt; cause of our actions, and they arise &lt;em&gt;from us&lt;/em&gt;. That is all that&#39;s necessary to say that free will exists. Compatibilists believe that the kind of free will that the incompatibilists say we don&#39;t have wouldn&#39;t be useful even if we had it. When a compatibilist wonders if we &quot;could have done otherwise&quot;, the question is really whether one is likely to repeat the same decision in situations that are the same only in morally relevant ways. A murderer has demonstrated that he is likely to murder: clearly, under the specific circumstances that actually occurred, he &lt;em&gt;did&lt;/em&gt; murder. But the compatibilist looks at all of the relevant circumstancess to see if &lt;em&gt;at the time and&amp;nbsp;&lt;/em&gt;&lt;em&gt;place of the act&lt;/em&gt; there were circumstances - such as being threatened by the victim - that would have forced the hand of any reasonable person. Because people &lt;em&gt;respond&lt;/em&gt; to them, we can use praise and blame to influence others to act for the benefit of society. Parents use blame and praise to teach children how to behave: for things such as intentionally poking someone in the eye, or taking the time to do a good job on one&#39;s homework. Laws and punishment for violating laws are necessary for a functioning society.&lt;br /&gt; &lt;br /&gt; These two camps don&#39;t really disagree with each other about the facts. They just disagreee about what words we should use to describe them. The compatibilists agree that we aren&#39;t the &lt;em&gt;ultimate&lt;/em&gt; cause of our actions, they just don&#39;t happen to care about that. The incompatibilists agree that it&#39;s useful to act &lt;em&gt;as if&lt;/em&gt; we have free will, as long as we recognize that it&#39;s an illusion. What they disagree about is which we should &lt;em&gt;call&lt;/em&gt; &quot;free will&quot;. The incompatibilists agree that we should influence others to behave in ways beneficial to society. The compatibilists aren&#39;t too concerened about making absolute &quot;moral&quot; judgments, and agree that we should treat people humanely. What they disagree about is which we should &lt;em&gt;call&lt;/em&gt; &quot;praise&quot; and &quot;blame&quot;.&lt;br /&gt; &lt;br /&gt; Of course I am oversimplifying both positions. Many people believe, for example, we &lt;em&gt;can&lt;/em&gt; make absolute moral judgments, sometimes by reference to a deity (or deities). When people ask me what &lt;em&gt;I&lt;/em&gt; believe, I ususally say that I am agnostic on free will, or that it depends on which definition you want to use. I agree with both camps, and I don&#39;t really care which words we elect to attach to which definitions, as long as we&#39;re clear about what we&#39;re trying to say. The two camps mostly agree with each other about the facts, though not always about what &lt;em&gt;conclusions&lt;/em&gt; we should draw from them. The fight is more about the right to choose the &quot;correct&quot; meaning for words such as &quot;free will,&quot; &quot;cause&quot;, and &quot;responsibility&quot;, because those words have emotional baggage attached to them that influence our thinking.&lt;br /&gt; &lt;br /&gt; &lt;hr /&gt; This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.&lt;br /&gt; See http://creativecommons.org/licenses/by-sa/4.0/</content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=3685574365215268065' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/3685574365215268065'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/3685574365215268065'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2016/01/free-will-is-false-dilemma.html' title='Free Will is a False Dilemma'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-5583498637513369402</id><published>2016-01-19T10:44:00.003-08:00</published><updated>2016-01-19T19:31:26.782-08:00</updated><title type='text'>You should be random, so carry dice!</title><content type='html'>Why should you act in a random, unpredictable, or arbitrary way? It seems no rational adult would want to do that. But as we&#39;ll see, there are situations that arise in our lives — surprisingly often — where acting randomly is exactly the right thing to do.&lt;br /&gt; &lt;div&gt; &lt;span style=&quot;font-family: inherit; font-size: small; font-weight: normal;&quot;&gt;&lt;br /&gt; &lt;/span&gt;&lt;/div&gt; &lt;h2&gt; What is random?&lt;/h2&gt; &lt;br /&gt; What does &lt;em&gt;random&lt;/em&gt; mean? By this we mean &lt;em&gt;unpredictable&lt;/em&gt;. A &lt;em&gt;random variable&lt;/em&gt; is some quantity that cannot be predicted in advance. A good example is the result of the roll of a six-sided die.&lt;br /&gt; &lt;br /&gt; &lt;div align=&quot;center&quot;&gt; &lt;img src=&quot;http://www.zamagame.com/wp-content/uploads/2015/02/One-Dice.png&quot; height=&quot;196&quot; width=&quot;200&quot; /&gt;&lt;/div&gt; &lt;br /&gt; If randomness is useful at all (which is yet to be seen) then dice may be good enough for some purposes. But for others you might want something that is &lt;em&gt;truly&lt;/em&gt; random: something that is impossible to predict &lt;em&gt;in principle&lt;/em&gt;. Many &lt;a href=&quot;https://en.wikipedia.org/wiki/Hardware_random_number_generator&quot;&gt;modern computers&lt;/a&gt; can produce random numbers. For the purposes of this essay we will pretend that dice are truly random.&lt;br /&gt; &lt;br /&gt; &lt;h2&gt; Acting randomly&lt;/h2&gt; &lt;br /&gt; Would it make sense to act in a random manner? You&#39;d be howling at the moon, bouncing off the walls, jumping through windows, and generally making a nuisance of yourself. We&#39;d probably have to keep knives far away from you. We&#39;d probably have to keep &lt;em&gt;people&lt;/em&gt; far away from you! No, I think we agree that this is not the kind of random behavior any of us would want.&lt;br /&gt; &lt;br /&gt; &lt;div align=&quot;center&quot;&gt; &lt;img src=&quot;http://sc.mogicons.com/share/crazy-emoticon-236.jpg&quot; height=&quot;104&quot; width=&quot;200&quot; /&gt;&lt;/div&gt; &lt;br /&gt; Perhaps it would make sense to act randomly &lt;em&gt;sometimes&lt;/em&gt;. Perhaps there are specific, well-defined situations in your daily life where you would benefit from making some decision that cannot be predicted. Perhaps it makes sense to keep dice in your pocket.&lt;br /&gt; &lt;br /&gt; Philosophers have proven that this is impossible. Suppose you have a decision to make, and you want to make it rationally. If there is a rational reason to choose one option over the other, then that is, of course, what you should do. There would be no need to act randomly in that case. On the other hand if there is no rational reason to choose one option over the other, throwing dice would just be a waste of your time. You might as well just pick the &lt;em&gt;first&lt;/em&gt; option, whichever that is. In either case, the dice would remain in your pocket. And since you will never use them, you might as well travel light and just leave them at home. Or at the game store. So philosophers have &quot;proven&quot; that we should never want to act randomly.&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;div align=&quot;center&quot;&gt; &lt;img src=&quot;http://thumbs.dreamstime.com/x/excited-philosopher-13711440.jpg&quot; height=&quot;200&quot; width=&quot;196&quot; /&gt;&lt;br /&gt; &lt;br /&gt; &lt;div style=&quot;text-align: left;&quot;&gt; But philosophers are wrong.&lt;/div&gt; &lt;div style=&quot;text-align: left;&quot;&gt; &lt;br /&gt;&lt;/div&gt; &lt;/div&gt; &lt;h2&gt; Board Games&lt;/h2&gt; &lt;br /&gt; The most obvious time that you would &lt;em&gt;want&lt;/em&gt; to act randomly is when you are playing a board game like &lt;a href=&quot;http://www.amazon.com/gp/product/B00CV5PN2W/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=B00CV5PN2W&amp;amp;linkCode=as2&amp;amp;tag=wwwgafterco07-20&amp;amp;linkId=NLFIC66XQAUJ5EHV&quot; rel=&quot;nofollow&quot;&gt;Monopoly&lt;/a&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://ir-na.amazon-adsystem.com/e/ir?t=wwwgafterco07-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=B00CV5PN2W&quot; height=&quot;1&quot; style=&quot;border: none !important; margin: 0px !important;&quot; width=&quot;1&quot; /&gt;&amp;nbsp;or &lt;a href=&quot;http://www.amazon.com/gp/product/B003ZY70FG/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=B003ZY70FG&amp;amp;linkCode=as2&amp;amp;tag=wwwgafterco07-20&amp;amp;linkId=CY72YJVY7DOLVRFG&quot; rel=&quot;nofollow&quot;&gt;Backgammon&lt;/a&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://ir-na.amazon-adsystem.com/e/ir?t=wwwgafterco07-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=B003ZY70FG&quot; height=&quot;1&quot; style=&quot;border: none !important; margin: 0px !important;&quot; width=&quot;1&quot; /&gt;. The rules of the game require it. You simply cannot play these games without rolling dice and basing your actions on the outcome. Admittedly, this is a trivial example. Are there serious situations where rolling dice &lt;em&gt;would help us in our daily lives&lt;/em&gt;? Yes, there are.&lt;br /&gt; &lt;br /&gt; &lt;div align=&quot;center&quot;&gt; &lt;img src=&quot;http://www.clker.com/cliparts/2/d/e/0/1194994652273066641monop_board.svg.med.png&quot; height=&quot;200&quot; width=&quot;200&quot; /&gt;&lt;br /&gt; &lt;br /&gt;&lt;/div&gt; &lt;h2&gt; Shopping for toothpaste&lt;/h2&gt; &lt;br /&gt; Imagine that you are shopping for&amp;nbsp;&lt;a href=&quot;http://www.amazon.com/gp/search/ref=as_li_qf_sp_sr_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;index=aps&amp;amp;keywords=toothpaste&amp;amp;linkCode=ur2&amp;amp;tag=wwwgafterco07-20&amp;amp;linkId=CZSKHHE6VADUFHLM&quot; target=&quot;_blank&quot;&gt;toothpaste&lt;/a&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;https://ir-na.amazon-adsystem.com/e/ir?t=wwwgafterco07-20&amp;amp;l=ur2&amp;amp;o=1&quot; style=&quot;border: none !important; margin: 0px !important;&quot; width=&quot;1&quot; /&gt;. You go to the corner store and head down the toothpaste aisle. There are hundreds of brands to choose from. Every one of them is different from every other in some way. Every advertised feature &lt;em&gt;seems&lt;/em&gt; relevant. Extra flouride? Whitening? Tartar control? Baking soda? Do you care what sweetener is used, or even if a sweetener is used at all? There are dozens of flavors. How will you make a rational selection? Surely, unless you inspect each and every choice, it seems impossible that you will select the &lt;em&gt;optimal&lt;/em&gt; choice.&lt;br /&gt; &lt;br /&gt; &lt;div align=&quot;center&quot;&gt; &lt;img height=&quot;239&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEouqGKA1D0rnGvcupxJSEpM8rk1tG_sl-_LtXaPtzZ8CZZQlbqQeJfdWBd4-dzwRtB-KlZiVYZdNkmSehGwTpnKvUVQstcz8IZXLKzQYgPHaFDb1LJLYUFbh-cIcxQ1iWihakRw/s320/supermarket-1229077246.jpg&quot; width=&quot;320&quot; /&gt;&lt;br /&gt; &lt;br /&gt; &lt;div style=&quot;text-align: left;&quot;&gt; This is a difficult problem. If you only have fifteen minutes to make your selection, you might not be able to make the &lt;i&gt;optimial &lt;/i&gt;choice. You could spend your fifteen minutes gathering what information you can, and return at a later time (or several times) to complete the job. In the meantime you&#39;ll just have to settle for having bad breath and not caring for your teeth. No, that doesn&#39;t sound like a very attractive option. Perhaps you should just get the same brand that you got last time - even though you aren&#39;t really very happy with it. Difficult.&lt;/div&gt; &lt;br /&gt; &lt;div style=&quot;text-align: left;&quot;&gt; This is so serious and common a problem that it has been extensively studied. &lt;a href=&quot;https://en.wikipedia.org/wiki/Overchoice&quot;&gt;&lt;em&gt;Overchoice&lt;/em&gt;, also referred to as &lt;em&gt;&quot;choice overload&quot;&lt;/em&gt;&lt;/a&gt;, describes a cognitive process in which philosophers have a difficult time making a decision when faced with many options. &lt;a href=&quot;https://en.wikipedia.org/wiki/Overchoice&quot;&gt;From Wikipedia&lt;/a&gt;:&lt;/div&gt; &lt;div style=&quot;text-align: left;&quot;&gt; &lt;br /&gt;&lt;/div&gt; &lt;/div&gt; &lt;blockquote&gt; The phenomenon of &lt;em&gt;overchoice&lt;/em&gt; occurs when many equivalent choices are available. Making a decision becomes overwhelming due to the many potential outcomes and risks that may result from making the wrong choice. Having too many [approximately] equally good options is mentally draining because each option must be weighed against alternatives to select the best one. As the number of choices increases, people tend to feel more pressure, confusion, and potentially dissatisfaction with their choice. Although larger choice sets can be initially appealing, smaller choice sets lead to increased satisfaction and reduced regret. Another component of overchoice is the perception of time. Extensive choice sets can seem even more difficult with a limited time constraint.&lt;/blockquote&gt; Fortunately, those of us who carry dice have an easy solution to this problem. Here is what you do. First, roll a die. If the result is any number one through five, just buy your favorite brand from among all those that you have previously tried. If the die shows a six, use your dice again to select a small random sampling from among all of the available choices. Two or three choices will do. Then look at those and if any of them seem plausible alternatives — if one might be your new favorite if only you had the chance to try it — then buy the best from among that small selection. If none of them seem likely, just buy your old favorite.&lt;br /&gt; &lt;br /&gt; This strategy doesn&#39;t guarantee that you will get the &lt;em&gt;optimal&lt;/em&gt; choice. But it does give you a very good chance of selecting a &lt;em&gt;nearly optimal&lt;/em&gt; choice. Over time you will be more and more satisfied with the toothpaste that you end up using because you will be trying new ones from time to time. As the toothpaste industry produces new innovations, you will find yourself enjoying them. Most importantly, it reduces the amount of time you spend selecting toothpaste, leaving you more time for important choices, such as &lt;a href=&quot;http://www.amazon.com/gp/search/ref=as_li_qf_sp_sr_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;index=aps&amp;amp;keywords=ice%20cream%20ben%20jerry&amp;amp;linkCode=ur2&amp;amp;tag=wwwgafterco07-20&amp;amp;linkId=CSO5XAZ76UVS5WRH&quot; target=&quot;_blank&quot;&gt;Ice Cream&lt;/a&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;https://ir-na.amazon-adsystem.com/e/ir?t=wwwgafterco07-20&amp;amp;l=ur2&amp;amp;o=1&quot; style=&quot;border: none !important; margin: 0px !important;&quot; width=&quot;1&quot; /&gt;.&lt;br /&gt; &lt;br /&gt; Now you know why philosophers have bad breath. It is because they do not carry dice.&lt;br /&gt; &lt;br /&gt; &lt;!-- &lt;h2&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; Dining Philosophers&lt;/h2&gt; &lt;br /&gt; There is a famous problem called &lt;a href=&quot;https://en.wikipedia.org/wiki/Dining_philosophers_problem&quot;&gt;&lt;em&gt;The Dining Philosophers Problem&lt;/em&gt;&lt;/a&gt;.&lt;br /&gt; It goes as follows.&lt;br /&gt; &lt;br /&gt; &lt;p align=&quot;center&quot;/&gt; &lt;image src=&quot;https://yeti.co/static/media/uploads/diningphilosophers.jpg&quot; width=&quot;15%&quot;/&gt;&lt;br /&gt; &lt;br /&gt; &lt;blockquote&gt; &lt;p&gt; Five silent philosophers sit at a round table with bowls of spaghetti.&lt;br /&gt; One chopstick is placed between each pair of adjacent philosophers.&lt;br /&gt; &lt;br /&gt; &lt;p&gt; Each philosopher must alternately think and eat. However, a philosopher can only eat spaghetti when holding both left and right chopsticks.&lt;br /&gt; Each chopstick can be held by only one philosopher and so a philosopher can use the chopstick only if it is not being used by another philosopher. &lt;br /&gt; After finishing eating, the philosopher needs to put down both chopsticks so they become available to others. &lt;br /&gt; A philosopher can take the chopstick on the right or the one on the left as they become available, but cannot start eating before getting both of them.&lt;br /&gt; &lt;br /&gt; &lt;p&gt; Eating is not limited by the remaining amounts of spaghetti or stomach space; an infinite supply and an infinite demand are assumed.&lt;br /&gt; &lt;br /&gt; &lt;p&gt; The problem is how to design a discipline of behavior such that no philosopher will starve;&lt;br /&gt; i.e., each can forever continue to alternate between eating and thinking, assuming that no philosopher can know when others may want to eat or think.&lt;br /&gt; &lt;/blockquote&gt; &lt;br /&gt; When this problem was initially posed, the International Philosopher&#39;s Union (IPU) attempted to solve the problem.&lt;br /&gt; The Union dispatched five philosophers, and each philosopher was instructed to behave as follows:&lt;br /&gt; &lt;br /&gt; &lt;blockquote&gt; &lt;ul&gt; &lt;li&gt;think until the left chopstick is available; when it is, pick it up;&lt;br /&gt; &lt;li&gt;think until the right chopstick is available; when it is, pick it up;&lt;br /&gt; &lt;li&gt;when both chopstick are held, eat for a fixed amount of time;&lt;br /&gt; &lt;li&gt;then, put the right chopstick down;&lt;br /&gt; &lt;li&gt;then, put the left chopstick down;&lt;br /&gt; &lt;li&gt;repeat from the beginning.&lt;br /&gt; &lt;/ul&gt; &lt;/blockquote&gt; &lt;p&gt; Some months later the philosophers were found starved to death, each clutching a chopstick in the left hand. The attempted solution failed because it allowed the system to reach a deadlock state, in which no progress was possible. &lt;p&gt; After some consultation the IPU, now smaller by five members, devised a new solution that involved the use of dice. This solution was quite contentious, as many of the philosophers believed that they had proven, as we discussed earlier, that no dice were necessary. So a compromise was reached. The new solution would be attempted, but the IPU would not provide the dice. Consequently only philosophers who were willing to provide their own dice were candidates to participate. The proposed instructions were: &lt;blockquote&gt; First, there is an initialization phase used to select a &lt;em&gt;First Philosopher&lt;/em&gt;: &lt;ul&gt; &lt;li&gt;each philosopher throws a die;&lt;br /&gt; &lt;li&gt;If one of the thrown dice is the uniquely highest number, the philosopher who threw it is deemed &lt;em&gt;First Philosopher&lt;/em&gt;, and the initialization phase ends;&lt;br /&gt; &lt;li&gt;Otherwise repeat the initialization phase.&lt;br /&gt; &lt;/ul&gt; Then each philosopher behaves as follows, with the exception that the &lt;em&gt;First Philosopher&lt;/em&gt; skips the first step during the first round: &lt;ul&gt; &lt;li&gt;think until the philosopher to your left has put down his right chopstick;&lt;br /&gt; &lt;li&gt;pick up the left chopstick;&lt;br /&gt; &lt;li&gt;pick up the right chopstick;&lt;br /&gt; &lt;li&gt;eat for a fixed amount of time;&lt;br /&gt; &lt;li&gt;then, put the left chopstick down;&lt;br /&gt; &lt;li&gt;then, put the right chopstick down;&lt;br /&gt; &lt;li&gt;repeat from the beginning.&lt;br /&gt; &lt;/ul&gt; &lt;/blockquote&gt; &lt;p&gt; The Union then dispatched five self-selected philosophers with these instructions. &lt;p&gt; Philosophers are, as a rule, quite conceited. That explains why each of these five philosophers was eager to gain the title &lt;em&gt;First Philosopher&lt;/em&gt;. Each of them secretly had a die manufactured that would &lt;em&gt;always&lt;/em&gt; land on six, ensuring that no other philosopher could gain the title. Some months later, the philosophers were found starved to death, each clutching a loaded die. &lt;p&gt; The problem was given to the International Engineering Union (IEU), who devised the following solution. Each philosopher is instructed to behave as follows: &lt;ul&gt; &lt;li&gt;roll a die, and then think for a number of seconds displayed by the die;&lt;br /&gt; &lt;li&gt;if the left chopstick is available, pick it up. otherwise repeat from the beginning;&lt;br /&gt; &lt;li&gt;if the right chopstick is available, pick it up. otherwise put down the left chopstick and repeat from the beginning;&lt;br /&gt; &lt;li&gt;eat for a fixed amount of time;&lt;br /&gt; &lt;li&gt;then, put the right chopstick down;&lt;br /&gt; &lt;li&gt;then, put the left chopstick down;&lt;br /&gt; &lt;li&gt;repeat from the beginning.&lt;br /&gt; &lt;/ul&gt; Since the philosophers had no dice, and there were fewer than five remaining Union members, they could not test this new procedure to see if it works. But they did &lt;em&gt;prove&lt;/em&gt; that it solves the problem, which to a philosopher is a much better thing. &lt;p&gt; Now you know why philosophers are hungry. It is because they do not carry dice. --&gt; &lt;br /&gt; &lt;h2&gt; The narrow bridge problem&lt;/h2&gt; &lt;br /&gt; Consider a two lane road that has one lane running in each direction. There is a place where the road narrows to a single lane to go over a bridge. Traffic on this road is not very heavy, and visibility is good, so there is no traffic signal. The obvious thing is to enter the bridge only when there is no traffic heading in the opposite direction. But what if two cars arrive at opposite ends of the bridge at about the same time? Each can wait for the other, but then they will both wait forever. Each can try going, and then back off if the other does the same. But then they will be going and backing off again and again, forever. &lt;br /&gt; &lt;br /&gt; &lt;div align=&quot;center&quot;&gt; &lt;img height=&quot;171&quot; src=&quot;https://upload.wikimedia.org/wikipedia/commons/0/04/NARROW_BRIDGE.png&quot; width=&quot;200&quot; /&gt; &lt;br /&gt; &lt;div style=&quot;text-align: left;&quot;&gt; &lt;br /&gt; Philosphers have specified that the drivers are to exit their vehicles, meet in the middle of the bridge, and play &lt;a href=&quot;http://www.amazon.com/gp/product/B002SJE3JU/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=B002SJE3JU&amp;amp;linkCode=as2&amp;amp;tag=wwwgafterco07-20&amp;amp;linkId=47NA7FJDTGFP2T7R&quot; rel=&quot;nofollow&quot;&gt;chess&lt;/a&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://ir-na.amazon-adsystem.com/e/ir?t=wwwgafterco07-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=B002SJE3JU&quot; height=&quot;1&quot; style=&quot;border: none !important; margin: 0px !important;&quot; width=&quot;1&quot; /&gt; until one of them has won a game. The winning driver is entitled to cross the bridge first. Philosophers find this a just solution, as it gives an advantage based only on the driver&#39;s ability to apply logic. Unfortunately, philosophers are perfect chess players. When they play each other, they always reach a stalemate.&lt;br /&gt; &lt;br /&gt;&lt;/div&gt; &lt;div style=&quot;text-align: left;&quot;&gt; &lt;/div&gt; &lt;div style=&quot;text-align: left;&quot;&gt; The local engineers have devised a different solution. When you reach the bridge, you stop and roll a die. You then wait a number of minutes indicated by the number on the die. Then you enter the bridge. If you encounter another car on the bridge, you back out to the beginning and try again. This is the purpose for the &lt;a href=&quot;http://www.amazon.com/gp/product/B004M06BRA/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=B004M06BRA&amp;amp;linkCode=as2&amp;amp;tag=wwwgafterco07-20&amp;amp;linkId=L2F6JTFKTTORFRDP&quot; rel=&quot;nofollow&quot;&gt;fuzzy dice&lt;/a&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://ir-na.amazon-adsystem.com/e/ir?t=wwwgafterco07-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=B004M06BRA&quot; height=&quot;1&quot; style=&quot;border: none !important; margin: 0px !important;&quot; width=&quot;1&quot; /&gt; hanging from the rear-view mirror of many cars.&lt;/div&gt; &lt;div style=&quot;text-align: left;&quot;&gt; &lt;/div&gt; &lt;div style=&quot;text-align: left;&quot;&gt; &lt;br /&gt; A more familiar example occurs when cars reach an intersection in which there is a stop sign for each of the four roads entering the intersection. It is customary — in fact a &lt;a href=&quot;https://en.wikipedia.org/wiki/Priority_to_the_right&quot;&gt;requirement under the law&lt;/a&gt; — that if you arrive at the intersection around the same time as another car on the cross street, the car to the right goes first. This works fine except when cars arrive &lt;em&gt;on all four roads&lt;/em&gt;. In that case obeying the rule, even though mandated by law, would lead to deadlock. That is when the procedure used on the bridge works very well.&lt;/div&gt; &lt;div style=&quot;text-align: left;&quot;&gt; &lt;/div&gt; &lt;div style=&quot;text-align: left;&quot;&gt; &lt;br /&gt; Now you know why philosophers do not drive. It is because they do not carry dice. &lt;br /&gt; &lt;br /&gt;&lt;/div&gt; &lt;/div&gt; &lt;h2&gt; The Scientific Method&lt;/h2&gt; &lt;br /&gt; There are applications in science where the intentional use of randomness is necessary to the proper conduct of an experiment. Chief among them is the &lt;em&gt;double-blind trial&lt;/em&gt;. This is an especially stringent way of conducting an experiment that eliminates subjective bias both on the part of the scientist and on the part of the subject of the experiment. Double-blind studies are frequently used to test drugs for their effectiveness. It is the gold standard for scientific rigor. &lt;br /&gt; &lt;br /&gt; &lt;div align=&quot;center&quot;&gt; &lt;img height=&quot;228&quot; src=&quot;https://bodymindandbrain.com.au/wp-content/uploads/DoubleBlind.jpg&quot; width=&quot;320&quot; /&gt; &lt;br /&gt; &lt;div style=&quot;text-align: left;&quot;&gt; &lt;br /&gt; In order to conduct a double-blind study, a population of test subjects is divided into two groups: those who will receive the drug to be tested, and those who will receive a placebo in its place. The subjects are assigned to one or the other group &lt;em&gt;randomly&lt;/em&gt;. Neither the scientific investigator nor the test subjects know who is in which group. It is only after the outcome has been evaluated for all test subjects does it become known to the investigator which was which. Consequently, there is no opportunity for any bias to arise due to such knowledge.&lt;/div&gt; &lt;div style=&quot;text-align: left;&quot;&gt; &lt;/div&gt; &lt;div style=&quot;text-align: left;&quot;&gt; Now you know why philosophers do not conduct scientific experiments. It is because they do not carry dice. &lt;br /&gt; &lt;br /&gt;&lt;/div&gt; &lt;/div&gt; &lt;h2&gt; Game theory&lt;/h2&gt; &lt;br /&gt; Even if you playing a &quot;deterministic&quot; game like Chess, there may be value in making some choices randomly. As when selecting toothpaste, you usually cannot select the &lt;em&gt;optimal&lt;/em&gt; move because you are operating under a time constraint. A technique called &lt;a href=&quot;https://en.wikipedia.org/wiki/Monte_Carlo_tree_search&quot;&gt;&lt;em&gt;Monto Carlo Game Tree Search&lt;/em&gt;&lt;/a&gt;, which uses randomness in selecting moves to consider, has resulted in a revolution in the quality of computer play for &lt;a href=&quot;https://en.wikipedia.org/wiki/Go_(game)&quot;&gt;&lt;em&gt;Go&lt;/em&gt;&lt;/a&gt;, a board game that is widely played in Korea, Japan, and China.&lt;br /&gt; &lt;br /&gt; Consider the game &lt;a href=&quot;https://en.wikipedia.org/wiki/Rock-paper-scissors&quot;&gt;&lt;em&gt;rock-paper-scissors&lt;/em&gt;&lt;/a&gt;. What if you want an &lt;em&gt;optimal&lt;/em&gt; strategy, or procedure, for playing the game? What we mean by &quot;optimal&quot; is that there is no &lt;em&gt;other&lt;/em&gt; strategy that has a winning edge over it, in the long run. There is a field of mathematics called &lt;a href=&quot;https://en.wikipedia.org/wiki/Game_theory&quot;&gt;&lt;em&gt;game theory&lt;/em&gt;&lt;/a&gt; that studies games, and the game rock-paper-scissors is well understood. One strategy is to choose &quot;rock&quot;, &quot;paper&quot;, or &quot;scissors&quot; randomly, and it has been proven, formally, that this is an optimal strategy. It has also been proven that any optimal strategy for rock-paper-scissors must, necessarily, use randomness. In fact many games require randomness to be played optimally. &lt;br /&gt; &lt;br /&gt; &lt;div align=&quot;center&quot;&gt; &lt;img src=&quot;http://svprojectmanagement.com/wp-content/uploads/2011/12/8635221-background-concept-wordcloud-illustration-of-game-theory-strategy.jpg&quot; height=&quot;184&quot; width=&quot;320&quot; /&gt; &lt;br /&gt; &lt;div style=&quot;text-align: left;&quot;&gt; &lt;br /&gt; Game theory has wide applications in the real world, including war strategy, political science, economics, and negotiation. Now you know why philosophers are not rich. It is because they do not carry dice.&lt;/div&gt; &lt;div style=&quot;text-align: left;&quot;&gt; &lt;br /&gt;&lt;/div&gt; &lt;/div&gt; &lt;h2&gt; Conclusion&lt;/h2&gt; &lt;br /&gt; How can the philosophers have been so wrong? After all, didn&#39;t they &lt;em&gt;prove&lt;/em&gt; that basing a decision on the roll of the dice is irrational? Yes, but they made a hidden assumption: that the decision is a one-time decision made in isolation. If you only have one decision to make in your whole life, the philosophers may have been right. But most decisions we make are part of a &lt;em&gt;series of decisions&lt;/em&gt;, and the logic that the philosophers used does not work in that case. When we have a series of decisions to make, we need a &lt;em&gt;strategy&lt;/em&gt; for making them, and it has been shown that randomness is a necessary part of the strategy for many problems.&lt;br /&gt; &lt;br /&gt; While it seems that basing your behavior on the roll of the dice might be irrational, there are situations that arise every day where it is the most rational thing to do. Those people who refuse to do so are systematically weeding themselves out of the human gene pool. Don&#39;t be one of them. Carry &lt;a href=&quot;http://www.amazon.com/s/?_encoding=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;field-keywords=dice&amp;amp;linkCode=ur2&amp;amp;tag=wwwgafterco07-20&amp;amp;url=search-alias%3Daps&amp;amp;linkId=47DZATNCJ4QD57DC&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;dice&lt;/a&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://ir-na.amazon-adsystem.com/e/ir?t=wwwgafterco07-20&amp;amp;l=ur2&amp;amp;o=1&quot; height=&quot;1&quot; style=&quot;border: none !important; margin: 0px !important;&quot; width=&quot;1&quot; /&gt;. &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;hr /&gt; &lt;span style=&quot;font-size: x-small;&quot;&gt;&quot;View source&quot; and search for &quot;Dining Philosophers&quot; to find out why philosophers are hungry.&lt;/span&gt; &lt;br /&gt; This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.&lt;br /&gt; See http://creativecommons.org/licenses/by-sa/4.0/&lt;br /&gt; &lt;br /&gt;</content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=5583498637513369402' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/5583498637513369402'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/5583498637513369402'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2016/01/you-should-be-random-so-carry-dice.html' title='You should be random, so carry dice!'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEouqGKA1D0rnGvcupxJSEpM8rk1tG_sl-_LtXaPtzZ8CZZQlbqQeJfdWBd4-dzwRtB-KlZiVYZdNkmSehGwTpnKvUVQstcz8IZXLKzQYgPHaFDb1LJLYUFbh-cIcxQ1iWihakRw/s72-c/supermarket-1229077246.jpg" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-2635564681661758163</id><published>2016-01-12T19:48:00.001-08:00</published><updated>2016-01-12T19:51:37.518-08:00</updated><title type='text'>Feynman on Philosophy of Science</title><content type='html'>This is one of my favorite Feynman quotes, from &lt;a href=&quot;http://www.amazon.com/gp/product/0465023827/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=0465023827&amp;amp;linkCode=as2&amp;amp;tag=wwwgafterco07-20&amp;amp;linkId=LXJ6BDUQRUO3AJF6&quot; rel=&quot;nofollow&quot;&gt;The Feynman Lectures on Physics&lt;/a&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://ir-na.amazon-adsystem.com/e/ir?t=wwwgafterco07-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=0465023827&quot; height=&quot;1&quot; style=&quot;border: none !important; margin: 0px !important;&quot; width=&quot;1&quot; /&gt;&lt;br /&gt; (Volume 1 page 2-6)&lt;br /&gt; &lt;br /&gt; &lt;blockquote&gt; Another most interesting change in the ideas and philosophy of science brought about by quantum mechanics is this: it is not possible to predict &lt;em&gt;exactly&lt;/em&gt; what will happen in any circumstance. For example, it is possible to arrange an atom which is ready to emit light, and we can measure when it has emitted light by picking up a photon particle[...]. We cannot, however, predict &lt;em&gt;when&lt;/em&gt; it is going to emit the light or, with several atoms, &lt;em&gt;which one&lt;/em&gt; is going to. You may say that this is because there are some internal &quot;wheels&quot; [variables] which we have not looked at closely enough. No, there &lt;em&gt;are&lt;/em&gt; no internal wheels; nature, as we understand it today, behaves in such a way that it is &lt;em&gt;fundamentally impossible&lt;/em&gt; to make a precise prediction of &lt;em&gt;exactly what will happen&lt;/em&gt; in a given experiment. This is a horrible thing; in fact, philosophers have said before that one of the fundamental requisites of science is that whenever you set up the same conditions, the same thing must happen. This is simply &lt;em&gt;not true&lt;/em&gt;, it is &lt;em&gt;not&lt;/em&gt; a fundamental condition of science. The fact is that the same thing does not happen, that we can find only an average, statistically, as to what happens. Nevertheless, science has not completely collapsed. Philosophers, incidentally, say a great deal about what is &lt;em&gt;absolutely necessary&lt;/em&gt; for science, and it is always, so far as one can see, rather naive, and probably wrong. For example, some philosopher or other said it is fundamental to the scientific effort that if an experiment is performed in, say Stockholm, and then the same experiment is done in, say, Quito, the &lt;em&gt;same results&lt;/em&gt; must occur. That is quite false. It is not necessary that &lt;em&gt;science&lt;/em&gt; do that; it may be a &lt;em&gt;fact of experience&lt;/em&gt;, but it is not necessary. For example, if one of the experiments is to look out at the sky and see the aurora borealis in Stockholm, you do not see it in Quito[...]. &quot;But,&quot; you say, &quot;that is something that has to do with the outside; can you close yourself up in a box in Stockholm and pull down the shade and get any difference?&quot; Surely. If we take a pendulum on a universal joint, and pull it out and let go, then the pendulum will swing almost in a plane, but not quite. Slowly the plane keeps changing in Stockholm, but not in Quito. The blinds are down, too. The fact that this happened does not bring on the destruction of science. What &lt;em&gt;is&lt;/em&gt; the fundamental hypothesis of science, the fundamental philosophy? [...] &lt;em&gt;the sole test of the validity of any idea is experiment&lt;/em&gt;. If it turns out that most experiments work out the same in Quito as they do in Stockholm, then those &quot;most experiments&quot; will be used to formulate some general law, and those experiments which do not come out the same we will say were the result of the environment near Stockholm. We will invent some way to summarize the results of the experiment, and we do not have to be told ahead of time what this way will look like. If we are told that the same experiment will always produce the same result, that is all very well, but if when we try it, it does &lt;em&gt;not&lt;/em&gt;, then it does &lt;em&gt;not&lt;/em&gt;. We just have to take what we see, and then formulate all the rest of our ideas in terms of our actual experience.&lt;/blockquote&gt; </content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=2635564681661758163' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/2635564681661758163'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/2635564681661758163'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2016/01/feynman-on-philosophy-of-science.html' title='Feynman on Philosophy of Science'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-1251984278090200843</id><published>2016-01-09T16:25:00.000-08:00</published><updated>2016-01-10T09:03:05.581-08:00</updated><title type='text'>The Many-Worlds Interpretation is a realist interpretation of the universe, but not a realist interpretation of the world.</title><content type='html'>The &lt;a href=&quot;https://en.wikipedia.org/wiki/Many-worlds_interpretation&quot;&gt;&lt;em&gt;Many Worlds Interpretation (MWI)&lt;/em&gt;&lt;/a&gt; is a deterministic, realist interpretation of quantum mechanics (QM). MWI starts with &lt;a href=&quot;http://www.preposterousuniverse.com/blog/2015/02/19/the-wrong-objections-to-the-many-worlds-interpretation-of-quantum-mechanics/&quot;&gt;two postulates&lt;/a&gt;&lt;br /&gt; &lt;ol&gt; &lt;li&gt;The universe is described by a quantum state, which is an element of a kind of vector space known as Hilbert space.&lt;br /&gt; &lt;/li&gt; &lt;li&gt;The quantum state evolves through time in accordance with the Schrödinger equation, with some particular Hamiltonian.&lt;br /&gt; &lt;/li&gt; &lt;/ol&gt; From the point of view of MWI, the quantum state of the universe (also known as the Universal Wave Function) is the thing that is &quot;real&quot;. It evolves in a locally deterministic way. &lt;br /&gt; &lt;br /&gt; What happened to the &quot;other worlds&quot;? Why is it even called the &quot;many worlds&quot; interpretation? Other worlds are not &lt;em&gt;postulated&lt;/em&gt; by MWI, rather they &lt;a href=&quot;http://www.preposterousuniverse.com/blog/2014/06/30/why-the-many-worlds-formulation-of-quantum-mechanics-is-probably-correct/&quot;&gt;arise naturally from an understanding of the behavior of the system based on just the two things we do postulate&lt;/a&gt;. And what about &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_decoherence&quot;&gt;decoherence&lt;/a&gt;&quot;? &lt;br /&gt; &lt;br /&gt; In MWI, &lt;em&gt;decoherence&lt;/em&gt; is said to occur when the phase angle between components of the quantum state are sufficiently orthogonal that, for practical purposes, they do not exhibit interference. The fact that this occurs is a consequence of the underlying math. This happens naturally when information about quantum interactions (e.g. the result of a quantum experiment) spreads into the environment through further interactions (e.g. because the result is displayed on the measurement instrument, and photons from the instrument&#39;s display reach the experimenter&#39;s eyes, the walls, etc). Once that occurs, we can analyze the orthogonal components of the quantum state in isolation. These orthogonal components can be interpreted as independent worlds, or alternative futures of the world, each representing the future following one possible outcome of the interaction (e.g. measured result). &lt;br /&gt; &lt;br /&gt; In practice the phase angles are never &lt;em&gt;completely&lt;/em&gt; orthogonal, because the spread of information into the environment is limited by the speed of light; there are sufficiently distant regions of the universe where the components &lt;em&gt;may&lt;/em&gt; interact. So the meaning of decoherence is interpretational: it depends on what we mean by &quot;sufficiently orthogonal&quot; and what the &quot;practical purposes&quot; are. If we are only interested in what happens in our experimental laboratory, the behavior of distant reaches of the universe in the distant future can be treated as irrelevant. &lt;br /&gt; &lt;br /&gt; This is no different from saying that, for sufficiently small velocities, mechanical systems obey classical rather than relativistic behavior. What is &quot;sufficiently small&quot;? It depends on the context. Nature does not care what we mean by sufficiently small, it always obeys the relativistic rules. But the concept of classical behavior allows us to simplify our calculations (at the expense of introducing a small inaccuracy) to improve our understanding of the system. &lt;br /&gt; &lt;br /&gt; So it is for decoherence. It is not a term that is rigidly defined in the theory, but (like &quot;non-relativistic velocity&quot;) is rather a concept for a simplifying assumption that we use to understand the behavior of the quantum state. Decoherence cannot properly be said to occur at some particular time, like quantum collapse in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Copenhagen_interpretation&quot;&gt;Copenhagen interpretation&lt;/a&gt;. It is not an &quot;event that happens&quot;, but rather a change in the way we interpret the meaning of the quantum state from one time to another. &lt;br /&gt; &lt;br /&gt; One accepts MWI &lt;a href=&quot;http://www.projects.science.uu.nl/igg/jos/foundQM/qm_reality.pdf&quot;&gt;at the expense of rejecting objective reality as we know it&lt;/a&gt;. When we open the box to see whether Schrödinger&#39;s cat is alive or dead, we become entangled with the cat&#39;s quantum state. If we see that the cat is alive (as we hope), we cannot say that the cat&#39;s status of being alive is a fundamentally &lt;em&gt;true&lt;/em&gt; fact about the universe. Rather in the quantum state of the universe, there are nearly orthogonal components that can be interpreted as two versions of our world, one in which we observe the cat being dead, and one in which we observe a living cat. One of them &lt;em&gt;feels&lt;/em&gt; more real, somehow, but each component describes a version of us who thinks it is he who is observing the &lt;em&gt;true&lt;/em&gt; world. MWI doesn&#39;t designate one of these components as somehow more real than the other, and thus we can think of them as separate worlds, or futures. &lt;br /&gt; &lt;blockquote cite=&quot;http://www.amazon.com/gp/product/0754655180/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=0754655180&amp;amp;linkCode=as2&amp;amp;tag=wwwgafterco07-20&amp;amp;linkId=NMMSRF2EDGVIHAAC&quot;&gt; [MWI] predicts that we will &lt;em&gt;think&lt;/em&gt; and &lt;em&gt;claim&lt;/em&gt;, that we do not observe superpositions at all, even when our own states are highly indefinite, and that we are simply mistaken in the belief that we see a particular outcome or other. That is, it preserves unitary [deterministic] QM – at the expense of a skepticism that &quot;makes Descartes’s demon and other brain-in-the-vat stories look like wildly optimistic appraisals of our epistemic situation&quot; [&lt;em&gt;&lt;a href=&quot;http://www.amazon.com/gp/product/0754655180/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=0754655180&amp;amp;linkCode=as2&amp;amp;tag=wwwgafterco07-20&amp;amp;linkId=NMMSRF2EDGVIHAAC&quot; rel=&quot;nofollow&quot;&gt;The Ashgate Companion to Contemporary Philosophy of Physics&lt;/a&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://ir-na.amazon-adsystem.com/e/ir?t=wwwgafterco07-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=0754655180&quot; height=&quot;1&quot; style=&quot;border: none !important; margin: 0px !important;&quot; width=&quot;1&quot; /&gt;&lt;/em&gt; page 43]&lt;/blockquote&gt; This is like Einstein&#39;s principle of relativity in another way, too. In MWI, the meaning of the world is relative to the observer. If you ask whether the cat is alive or dead as a property of the universe, the simple answer is that the cat is in an indefinite state. To give a more definite answer we would need to know which (mostly) orthogonal component of the quantum state you&#39;re asking about. Which world did you mean?</content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=1251984278090200843' title='17 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/1251984278090200843'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/1251984278090200843'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2016/01/the-many-worlds-interpretation-is.html' title='The Many-Worlds Interpretation is a realist interpretation of the universe, but not a realist interpretation of the world.'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>17</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-7980763273092946298</id><published>2015-12-15T17:42:00.001-08:00</published><updated>2015-12-15T17:45:20.880-08:00</updated><title type='text'>Gafter vs THC or The Parable of the Gradient Illusion</title><content type='html'>&lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt; Some years ago I&amp;nbsp;&lt;a href=&quot;http://javapuzzlers.com/&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #4183c4; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;&quot; target=&quot;_blank&quot;&gt;cowrote a book&lt;/a&gt;&amp;nbsp;that included some original optical illusions. One illusion in particular became an issue of legal dispute. Some chemicals in my brain (Tetrahydrocannabinol) claimed to be ultimately responsible for the works and claimed, therefore, that my publication of the illusion was copyright infringement. As they were threatening to sue, we filed a preemptive suit for a declaration of non-infringement. The artwork can be seen on&amp;nbsp;&lt;a href=&quot;http://www.psy.ritsumei.ac.jp/~akitaoka/friends2e.html#blochgafter&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #4183c4; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;&quot; target=&quot;_blank&quot;&gt;Akiyoshi Kitaoka&#39;s site labeled the &quot;Bloch-Gafter&#39;s effect&quot;&lt;/a&gt;. The district court found in our favor due to the opposing party not being represented at the hearing. However, on appeal the decision was upheld on the strength of the case, and the decision is now a precedent. The ninth circuit court of appeals found that a copyrightable work produced as a result of the influence of chemicals in a person&#39;s brain and body are to be treated as a work made for hire, as it is &quot;a work prepared by an employee within the scope of his or her employment&quot;, under the principles outlined by the Supreme Court:&lt;/div&gt; &lt;blockquote style=&quot;border-bottom-width: 0px; border-color: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 4px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #777777; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 15px; padding-bottom: 0px; padding-left: 15px; padding-right: 15px; padding-top: 0px;&quot;&gt; &lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt; In determining whether a hired party is an employee under the general common law of agency, we consider the hiring party&#39;s right to control the manner and means by which the product is accomplished. Among the other factors relevant to this inquiry are the skill required; the source of the instrumentalities and tools; the location of the work; the duration of the relationship between the parties; whether the hiring party has the right to assign additional projects to the hired party; the extent of the hired party&#39;s discretion over when and how long to work; ...&lt;/div&gt; &lt;/blockquote&gt; &lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 15px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt; We were awarded costs but, alas, have so far been unable to collect.&lt;br /&gt; &lt;br /&gt; The upshot of this legal decision is that a person can be treated as the author of works produced by that person, even though the responsibility for producing the work is shared among parts of the person&#39;s body not under their direct supervision.&lt;/div&gt; &lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 15px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt; This settles a question raised on&amp;nbsp;&lt;a href=&quot;https://www.youtube.com/watch?v=UokU9jmdEXY&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #4183c4; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;&quot; target=&quot;_blank&quot;&gt;A recent Free Will, Science, and Religion Podcast&lt;/a&gt;&amp;nbsp;: can a person reasonably claim authorship of decisions when those decisions are a result of processes in their body (such as chemical reactions) not fully under their control? The answer, it turns out, is yes.&lt;/div&gt; &lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; border-spacing: 0px;&quot;&gt;&lt;/span&gt;&lt;br /&gt; &lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px !important; margin-left: 0px; margin-right: 0px; margin-top: 15px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt; Case closed.&lt;/div&gt; &lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px !important; margin-left: 0px; margin-right: 0px; margin-top: 15px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt; &lt;br /&gt;&lt;/div&gt; </content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=7980763273092946298' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/7980763273092946298'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/7980763273092946298'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2015/12/gafter-vs-thc-or-parable-of-gradient.html' title='Gafter vs THC or The Parable of the Gradient Illusion'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-7019348411571193267</id><published>2014-11-10T17:24:00.001-08:00</published><updated>2014-11-10T17:25:57.606-08:00</updated><title type='text'>Dear Supreme Court: Please don&#39;t allow APIs to be copyrightable!</title><content type='html'>A few days ago the EFF filed an &lt;a href=&quot;https://www.eff.org/document/amicus-brief-computer-scientists-scotus&quot;&gt;Amicus Brief&lt;/a&gt; with the US Supreme Court urging it to review a &lt;a href=&quot;https://www.eff.org/deeplinks/2014/05/dangerous-ruling-oracle-v-google-federal-circuit-reverses-sensible-lower-court&quot;&gt;horrible appellate court decision&lt;/a&gt; finding that APIs are copyrightable.&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; If you care about the health of the software industry or about the freedom of open-source developers to provide independently developed implementations that are &lt;em&gt;functionally equivalent&lt;/em&gt; to existing APIs, then you are probably aware of this case and its implications. The deep morass that exists due to software patents is about to get much worse unless this decision is reversed.&lt;br /&gt; &lt;br /&gt;</content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=7019348411571193267' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/7019348411571193267'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/7019348411571193267'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2014/11/dear-supreme-court-please-dont-allow.html' title='Dear Supreme Court: Please don&#39;t allow APIs to be copyrightable!'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-4819572816623842725</id><published>2010-08-26T15:18:00.001-07:00</published><updated>2010-08-26T15:38:05.522-07:00</updated><title type='text'>A couple of comments on Defender Methods</title><content type='html'>&lt;p&gt; Brian Goetz has posted &lt;a href=&quot;http://cr.openjdk.java.net/~briangoetz/lambda/Defender%20Methods%20v3.pdf&quot;&gt;version 3 of his proposal &quot;Defender Methods&quot;&lt;/a&gt;, which is a way of adding methods to existing interfaces without breaking binary compatibility. Generally speaking, I think the idea is sound but I think there are some problems with the proposal in its current form. I would normally post my comments on the proposal to &lt;a href=&quot;http://mail.openjdk.java.net/mailman/listinfo/lambda-dev&quot;&gt;the lambda-dev mailing list&lt;/a&gt;, which ensures that any IP embedded in my comments are formally submitted to Oracle&#39;s ownership. However, Oracle&#39;s recent lawsuit against Google has made it clear that, even though I am a contributor to openjdk7, I do not have a license to Oracle&#39;s patents that are necessarily infringed by the use of the openjdk7 source base. This is a very confusing position for the organizer of an open-source effort to take. Rather than continuing to contribute IP directly to the project, I&#39;ll post my comments here and contribute them to Oracle once it is clear that I&#39;ve been granted a license to the patents necessary to use openjdk7. &lt;p&gt; The &lt;a href=&quot;http://cr.openjdk.java.net/~briangoetz/lambda/Defender%20Methods%20v3.pdf&quot;&gt;latest version of the proposal&lt;/a&gt; has added a section on &quot;Binary compatibility&quot; (section 11), but that section fails to address the one binary compatibility issue raised previously: what are the binary compatibility implications of &lt;em&gt;changing&lt;/em&gt; the default for a defender method? Since the defender method&#39;s default is an implementation detail, such a change should be binary (and source) compatible, but the resolution mechanism (section 3) makes it binary incompatible. The proposal doesn&#39;t provide compile-time semantics for invoking an extension method or compile-time rules for when a given class declaration is legal. At the very least there should be rules to ensure that sources that compile cleanly together do not trigger a VM error at runtime due to an ambiguous method invocation. The most natural change of the compile-time rules to match the given runtime resolution rules would make changing the defender method&#39;s default a source incompatible change as well (because it could introduce an ambiguity). I believe this undermines the justification for having defender methods out-of-line (section 2). Moreover, the separation forces API designers to create vestigial public API elements (the static extension methods). &lt;p&gt; These issues can be addressed by (a) having defender method bodies written inline, and (b) rejecting non-abstract class declarations where some defender method does not have a unique default. &lt;p&gt; I suspect the proposed implementation mechanisms (sections 7 and 8) will be far too expensive compared to existing virtual method calls. For the Interface.super calls (section 7), my suggestion is to extend the VM specification of invokespecial.</content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=4819572816623842725' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/4819572816623842725'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/4819572816623842725'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2010/08/couple-of-comments-on-defender-methods.html' title='A couple of comments on Defender Methods'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-2983558471285368877</id><published>2010-02-13T16:52:00.000-08:00</published><updated>2010-02-13T17:01:43.243-08:00</updated><title type='text'>A Syntax Option for Project Lambda (Closures for Java)</title><content type='html'>&lt;p&gt; It was noted recently on the &lt;a href=&quot;http://mail.openjdk.java.net/mailman/listinfo/lambda-dev&quot;&gt;Project Lambda mailing list&lt;/a&gt; that allowing arrays of function type would undermine the type system. The reason for this is a combination of Java&#39;s covariant arrays, the natural subtypes among function types (they are covariant on return type and contravariant on argument types), exception checking, and the erasure implementation of generics. We certainly can&#39;t remove covariant arrays or checked exceptions, and removing the subtype relationship among function types really reduces their utility. Unfortunately, it is almost certainly too late to reify generics too. Although you can&#39;t have an array of function type, there is no problem having, for example, an &lt;tt&gt;&lt;b&gt;ArrayList&lt;/b&gt;&lt;/tt&gt; of a function type. So while we might prefer not to have this restriction, it won&#39;t be much of a problem in practice. &lt;p&gt; There are many ways in which arrays of function type would undermine the type system, but to give you some flavor of the problem, the following is a method written assuming that arrays of function type are allowed. This method must fail in some way - either fail to compile, or throw a &lt;tt&gt;&lt;b&gt;ClassCastException&lt;/b&gt;&lt;/tt&gt;, or an &lt;tt&gt;&lt;b&gt;ArrayStoreException&lt;/b&gt;&lt;/tt&gt;, or something. In all of the implementations being considered, this method would throw &lt;tt&gt;&lt;b&gt;IOException&lt;/b&gt;&lt;/tt&gt;, even though that isn&#39;t declared in the throws clause of the method. We have undermined Java&#39;s exception checking without even a cast! &lt;blockquote&gt; &lt;pre&gt;&lt;b&gt;public void main(String[] args) { #void()[] arrayOfFunction = new #void()[1]; Object[] objectArray = arrayOfFunction; objectArray[0] = #(){ throw new IOException(); }; arrayOfFunction[0].(); // invoke the function out of the array } &lt;/b&gt;&lt;/pre&gt; &lt;/blockquote&gt; &lt;p&gt; The realization that supporting arrays of function type would introduce a loophole in the type system makes it possible to consider some very nice syntax options that were previously eliminated because there was no syntactic way to write an array of function type. But if we disallow arrays of function type, those options can be considered. &lt;p&gt; My favorite of the alternatives is based on this grammar &lt;blockquote&gt; &lt;dl&gt; &lt;dt&gt;&lt;em&gt;FunctionType&lt;/em&gt;:&lt;/dt&gt; &lt;dd&gt;&lt;tt&gt;&lt;b&gt;(&lt;/b&gt;&lt;/tt&gt; &lt;em&gt;TypeList&lt;/em&gt;&lt;sub&gt;opt&lt;/sub&gt; &lt;em&gt;Throws&lt;/em&gt;&lt;sub&gt;opt&lt;/sub&gt; &lt;tt&gt;&lt;b&gt;)&lt;/b&gt;&lt;/tt&gt; &lt;tt&gt;&lt;b&gt;-&gt;&lt;/b&gt;&lt;/tt&gt; &lt;em&gt;ResultType&lt;/em&gt;&lt;/dd&gt; &lt;dt&gt;&lt;em&gt;Expression&lt;/em&gt;:&lt;/dt&gt; &lt;dd&gt;&lt;em&gt;LambdaExpression&lt;/em&gt;&lt;/dd&gt; &lt;dt&gt;&lt;em&gt;LambdaExpression&lt;/em&gt;:&lt;/dt&gt; &lt;dd&gt;&lt;tt&gt;&lt;b&gt;(&lt;/b&gt;&lt;/tt&gt; &lt;em&gt;FormalParameterList&lt;/em&gt;&lt;sub&gt;opt&lt;/sub&gt; &lt;tt&gt;&lt;b&gt;)&lt;/b&gt;&lt;/tt&gt; &lt;tt&gt;&lt;b&gt;-&gt;&lt;/b&gt;&lt;/tt&gt; &lt;em&gt;Expression&lt;/em&gt;&lt;/dd&gt; &lt;/dl&gt; &lt;/blockquote&gt; &lt;p&gt; A function type is written with the argument types between parentheses, then a right arrow (dash greater-than), and then the result type. &lt;p&gt; The most important distinction between this proposal and the existing draft specification is that this proposal places the result type after the argument types, instead of before. The benefits of its simplicity compared to the current specification are most obvious when you combine function types and lambdas with other features. &lt;p&gt; Here is a simple example to show how the two proposals look. The example is &lt;a href=&quot;http://en.wikipedia.org/wiki/Currying&quot;&gt;currying&lt;/a&gt;. The following method takes as a parameter a function of two arguments, and returns a function of one argument that returns a function of one argument. Applying the resulting function to one value, and then the result of that to another value, should have the same effect as applying the original function to both values. To make it interesting, we make the argument and result types generic, and we allow the function to throw an exception. &lt;p&gt; Using the &lt;a href=&quot;http://mail.openjdk.java.net/pipermail/lambda-dev/attachments/20100212/af8d2cc5/attachment-0001.txt&quot;&gt;currently proposed syntax for Project Lambda&lt;/a&gt;, the code would look something like this: &lt;pre&gt;&lt;b&gt;static &amp;lt;T,U,V,X extends Throwable&gt; ##V(U)(throws X)(T) curry(#V(T,U)(throws X) function) { return #(T t)(#(U u)(function.(t,u))); } &lt;/b&gt;&lt;/pre&gt; &lt;p&gt; On the other hand, with the proposal described above it looks something like this: &lt;pre&gt;&lt;b&gt;static &amp;lt;T,U,V,X extends Throwable&gt; (T)-&gt;(U throws X)-&gt;V curry((T,U throws X)-&gt;V function) { return (T t)-&gt;(U u)-&gt;function.(t,u); } &lt;/b&gt;&lt;/pre&gt; &lt;p&gt; I&#39;ve intentionally selected an example that uses the new features heavily, so either may take a few moments of studying to understand. But I claim the latter is much easier to follow than the former, even once you&#39;ve become familiar with the syntax. &lt;p&gt; You can easily write a function that yields an array as its result &lt;pre&gt;&lt;b&gt;()-&gt;int[] arrayLambda = ()-&gt;new int[]{1, 2, 3}; &lt;/b&gt;&lt;/pre&gt; &lt;p&gt; With this proposed syntax there is no way to write an array of functions. But that is exactly what we concluded could not be made to work within the type system anyway.</content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=2983558471285368877' title='20 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/2983558471285368877'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/2983558471285368877'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2010/02/syntax-option-for-project-lambda.html' title='A Syntax Option for Project Lambda (Closures for Java)'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>20</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-2322776547279444205</id><published>2009-03-10T08:16:00.000-07:00</published><updated>2009-03-10T08:23:09.307-07:00</updated><title type='text'>JDK API search in Google Toolbar</title><content type='html'>&lt;p&gt;For those of you who use the Google Toolbar, the following links will add a Java API search button to your toolbar. I&#39;ve found this to be a very handy way to locate the javadoc for the platform.&lt;/p&gt; &lt;p&gt;&lt;b&gt;&lt;a href=&quot;http://toolbar.google.com/buttons/add?url=http://www.javac.info/jdk_search.xml&quot;&gt;Add Java SE 6 API search box to Google Toolbar&lt;/a&gt;&lt;/b&gt; &lt;p&gt;&lt;b&gt;&lt;a href=&quot;http://toolbar.google.com/buttons/add?url=http://www.javac.info/openjdk_search.xml&quot;&gt;Add OpenJDK API search box to Google Toolbar&lt;/a&gt;&lt;/b&gt;</content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=2322776547279444205' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/2322776547279444205'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/2322776547279444205'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2009/03/jdk-api-search-in-google-toolbar.html' title='JDK API search in Google Toolbar'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-8467128226944848283</id><published>2009-02-13T07:34:00.000-08:00</published><updated>2009-02-13T07:39:43.635-08:00</updated><title type='text'>Language Parity: Closures and the Java VM</title><content type='html'>A &lt;a href=&quot;http://www.infoq.com/presentations/gafter-jvm-closures&quot;&gt;video of my talk at the September 2008 JVM Language Summit&lt;/a&gt; has been posted. It&#39;s a discussion of how Java SE is tilted toward supporting the Java language at the expense of other languages, and what we might do about it.</content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=8467128226944848283' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/8467128226944848283'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/8467128226944848283'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2009/02/language-parity-closures-and-java-vm.html' title='Language Parity: Closures and the Java VM'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-3047255195011311765</id><published>2008-08-07T23:08:00.000-07:00</published><updated>2008-08-07T23:32:03.021-07:00</updated><title type='text'>Java Closures Prototype Feature-Complete</title><content type='html'>&lt;p&gt;I&#39;m pleased to announce that the Java Closures prototype now supports all of the features of its specification! &lt;p&gt;The complete source code, released under GPLv2, is in the project&#39;s openjdk repository. A binary build, suitable for use with an existing JDK6, is at &lt;a href=&quot;http://www.javac.info/closures.tar.gz&quot; &gt;http://www.javac.info/closures.tar.gz&lt;/a&gt;. Other related documents are on the website &lt;a href=&quot;http://www.javac.info/&quot; &gt;http://www.javac.info/&lt;/a&gt; &lt;p&gt;Although there is room for performance tuning, the prototype supports the full &lt;a href=&quot;http://www.javac.info/closures-v05.html &quot;&gt;Closures (v0.5) specification&lt;/a&gt;. Based on your feedback, there are some changes in the prototype suitable for a future update of the specification: &lt;ul&gt; &lt;li&gt;Renamed &lt;code&gt;Unreachable&lt;/code&gt; to &lt;code&gt;Nothing&lt;/code&gt;&lt;/li&gt; &lt;blockquote&gt; We adopt the name used by Scala to represent the same concept. &lt;/blockquote&gt; &lt;li&gt;Removed support for the type &lt;code&gt;null&lt;/code&gt;&lt;/li&gt; &lt;blockquote&gt; We used &lt;code&gt;null&lt;/code&gt; as a placeholder for an exception type when none can be thrown. The type &lt;code&gt;Nothing&lt;/code&gt; now serves that purpose; &lt;code&gt;null&lt;/code&gt; is no longer supported as the name of a type. &lt;/blockquote&gt; &lt;li&gt;Overhauled restricted versus unrestricted&lt;/li&gt; &lt;blockquote&gt; In the specification, an interface is considered &lt;em&gt;restricted&lt;/em&gt; if it extends a marker interface. Unfortunately, the specification only provides a syntax for function type interfaces that are unrestricted. We modified the syntax so that a function type written using the &lt;code&gt;=&gt;&lt;/code&gt; token designates a restricted function type, while one written using the newly introduced &lt;code&gt;==&gt;&lt;/code&gt; token represents an unrestricted function type. This allows programmers to easily write APIs that restrict (or don&#39;t restrict) the operations of closure expressions passed as parameters. &lt;/blockquote&gt; &lt;li&gt;Refined restrictions&lt;/li&gt; &lt;blockquote&gt; We modified the distinction between restricted and unrestricted closures. As before, it is not legal to convert an unrestricted closure to a restricted interface type, nor is it legal to &lt;code&gt;break&lt;/code&gt;, &lt;code&gt;continue&lt;/code&gt;, or &lt;code&gt;return&lt;/code&gt; from inside a restricted closure to a target outside the closure. However, a restricted closure is allowed to refer to a non-final local variable from an enclosing scope. In this case a warning is given unless one of the following conditions holds: &lt;ol&gt; &lt;li&gt;The variable is not the target of any assignment, or&lt;/li&gt; &lt;li&gt;The variable is annotated @Shared&lt;/li&gt; &lt;/ol&gt; &lt;p&gt;It is possible to suppress the warning by annotating some enclosing construct &lt;code&gt;@SuppressWarnings(&quot;shared&quot;)&lt;/code&gt;. &lt;/blockquote&gt; &lt;li&gt;Relaxed the closure conversion&lt;/li&gt; &lt;blockquote&gt; In response to user feedback, we&#39;ve relaxed the relationship between a closure parameter&#39;s type and the target interface&#39;s parameter type. Rather than requiring them to be of the same type, they are now allowed to be related by an assignment conversion, including boxing or unboxing. &lt;/blockquote&gt; &lt;li&gt;&lt;code&gt;for&lt;/code&gt;-qualified method declarations&lt;/li&gt; &lt;blockquote&gt; The &lt;code&gt;for&lt;/code&gt; keyword on a method declaration, meant to introduce a control abstraction method that works like a loop, is now treated syntactically like a modifier rather than appearing immediately before the method name. This helps make the declaration site more similar to the use site. &lt;/blockquote&gt; &lt;li&gt;Added support for method references&lt;/li&gt; &lt;blockquote&gt; &lt;p&gt;We added extensive support for treating a reference to a method as a closure using a newly introduced token &lt;code&gt;#&lt;/code&gt;. The syntax is borrowed from the &lt;a href=&quot;http://docs.google.com/View?docid=ddhp95vd_6hg3qhc&quot;&gt;FCM proposal&lt;/a&gt;. The semantics are as follows:&lt;/p&gt; &lt;p&gt;A method reference written as&lt;/p&gt; &lt;blockquote&gt; &lt;pre&gt; &lt;em&gt;Primary&lt;/em&gt; # &lt;em&gt;Identifier&lt;/em&gt; ( &lt;em&gt;TypeList&lt;/em&gt; ) &lt;/pre&gt; &lt;/blockquote&gt; &lt;p&gt;where the Primary designates an expression (as opposed to a type) is treated the same as a closure &lt;blockquote&gt; &lt;pre&gt; { Type x0, Type x1 ... =&gt; tmp.Identifier(x0, x1 ...) } &lt;/pre&gt; &lt;/blockquote&gt; or &lt;blockquote&gt; &lt;pre&gt; { Type x0, Type x1 ... =&gt; tmp.Identifier(x0, x1 ...); } &lt;/pre&gt; &lt;/blockquote&gt; &lt;p&gt;Where tmp is a temporary value that holds the computed value of the primary expression. The former translation is used when the resolved method has a non-void return type, while the latter is used when the resolved method has a void return type. &lt;p&gt;If the primary resolves to a type, then this is translated to &lt;blockquote&gt; &lt;pre&gt; { Type x0, Type x1 ... =&gt; Primary.Identifier(x0, x1 ...) } &lt;/pre&gt; &lt;/blockquote&gt; or &lt;blockquote&gt; &lt;pre&gt; { Type x0, Type x1 ... =&gt; Primary.Identifier(x0, x1 ...); } &lt;/pre&gt; &lt;/blockquote&gt; &lt;p&gt;when the resolved method is static, or &lt;blockquote&gt; &lt;pre&gt; { Primary x, Type x0, Type x1 ... =&gt; x.Identifier(x0, x1 ...) } &lt;/pre&gt; &lt;/blockquote&gt; or &lt;blockquote&gt; &lt;pre&gt; { Primary x, Type x0, Type x1 ... =&gt; x.Identifier(x0, x1 ...); } &lt;/pre&gt; &lt;/blockquote&gt; &lt;p&gt;when the resolved method is an instance method. &lt;p&gt;In addition, optional explicit type arguments, between angle brackets, may be placed immediately after the &lt;code&gt;#&lt;/code&gt; token. These are used directly in the translated method invocation to resolve the method to be invoked. &lt;/blockquote&gt; &lt;li&gt;Implemented a classfile format for the &lt;code&gt;for&lt;/code&gt; qualifier&lt;/li&gt; &lt;blockquote&gt; We&#39;ve impleemnted a class file representation of the &lt;code&gt;for&lt;/code&gt; qualifier to support separate compilation. &lt;/blockquote&gt; &lt;/ul&gt;</content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=3047255195011311765' title='42 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/3047255195011311765'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/3047255195011311765'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2008/08/java-closures-prototype-feature.html' title='Java Closures Prototype Feature-Complete'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>42</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-7985322555245085577</id><published>2008-03-17T00:37:00.000-07:00</published><updated>2008-03-17T00:38:28.084-07:00</updated><title type='text'>Closures: Control Abstraction, Method References, Puzzler Solution</title><content type='html'>&lt;h1&gt;Closures: Control Abstraction, Method References, Puzzler Solution&lt;/h1&gt; &lt;p&gt;The Java Closures prototype now supports &lt;em&gt;control abstraction&lt;/em&gt; and implements &lt;em&gt;restricted&lt;/em&gt; closures and function types. The syntax has changed slightly. Also, as hinted in the &lt;a href=&quot;http://www.javac.info/consensus-closures-jsr.html&quot;&gt;draft JSR proposal&lt;/a&gt;, there is now support for &lt;em&gt;eta abstraction&lt;/em&gt;, which is called &lt;em&gt;method reference&lt;/em&gt; in &lt;a href=&quot;http://docs.google.com/View?docid=ddhp95vd_0f7mcns&quot;&gt;Stephen Colebourne&#39;s FCM proposal&lt;/a&gt;. We haven&#39;t updated the &lt;a href=&quot;http://www.javac.info/&quot;&gt;specification&lt;/a&gt;, so this will serve as a brief tutorial on the changes until we do. I don&#39;t know if this will be the syntax we will end up with, but it will do for now. Finally, we look at solutions to the closure puzzler in my previous post.&lt;/p&gt; &lt;h3&gt;Control Abstraction&lt;/h3&gt; &lt;p&gt;The first thing you&#39;ll notice when using the new prototype is that the compiler gives a warning when a closure uses a local variable from an enclosing scope:&lt;/p&gt; &lt;blockquote&gt; &lt;pre&gt;Example.java:4: warning: [shared] captured variable i not annotated @Shared Runnable r = { =&amp;gt; System.out.println(i); }; ^ &lt;/pre&gt; &lt;/blockquote&gt; &lt;p&gt;There are a few ways to make this warning go away:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;declare the variable &lt;code&gt;final&lt;/code&gt;; or&lt;/li&gt; &lt;li&gt;annotate the variable &lt;code&gt;@Shared&lt;/code&gt;; or&lt;/li&gt; &lt;li&gt;make sure the variable is not the target of any assignment expression; or&lt;/li&gt; &lt;li&gt;put &lt;code&gt;@SuppressWarnings(&amp;quot;shared&amp;quot;)&lt;/code&gt; on an enclosing method or class; or&lt;/li&gt; &lt;li&gt;use an &lt;em&gt;unrestricted&lt;/em&gt; closure, by using the &lt;code&gt;==&amp;gt;&lt;/code&gt; token instead of the &lt;code&gt;=&amp;gt;&lt;/code&gt; token (when possible).&lt;/li&gt; &lt;/ul&gt; &lt;p&gt;The &lt;code&gt;=&amp;gt;&lt;/code&gt; token builds a &lt;em&gt;restricted&lt;/em&gt; closure that triggers this warning. Restricted closures also do not allow a &lt;code&gt;break&lt;/code&gt; or &lt;code&gt;continue&lt;/code&gt; statement to a target outside the closure, nor a &lt;code&gt;return&lt;/code&gt; statement from the enclosing method. You will rarely want to write an unrestricted closure; many (but not all) of the things you need to do with an unrestricted closure can be expressed more clearly with a &lt;em&gt;control invocation statement&lt;/em&gt; instead.&lt;/p&gt; &lt;p&gt;You&#39;re not allowed to assign an unrestricted closure to a restricted interface. A number of existing JDK interfaces, such as &lt;code&gt;java.lang.Runnable&lt;/code&gt;, have been modified to be restricted&lt;code&gt;&lt;/code&gt;.&lt;/p&gt; &lt;blockquote&gt; &lt;pre&gt;Error: cannot assign an unrestricted closure to a restricted interface type&lt;br /&gt; Runnable r = { ==&amp;gt; System.out.println(i); };&lt;br /&gt; ^&lt;/pre&gt; &lt;/blockquote&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;In the less common case that you&#39;re writing a method intended to be used as a control API, you can write a function type with the (new) &lt;code&gt;==&amp;gt;&lt;/code&gt; token to designate an unrestricted function (interface) type. Let&#39;s do that to write a method, &lt;code&gt;with&lt;/code&gt;, that will automatically close a stream for us. The idea is to be able to replace this code&lt;/p&gt; &lt;blockquote&gt; &lt;pre&gt;FileInputStream input = new FileInputStream(fileName);&lt;br /&gt;try {&lt;br /&gt; // use input&lt;br /&gt;} finally {&lt;br /&gt; try {&lt;br /&gt; input.close();&lt;br /&gt; } catch (IOException ex) { logger.log(Level.SEVERE, ex.getMessage(), ex);&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt; &lt;/blockquote&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;with this&lt;/p&gt; &lt;blockquote&gt; &lt;pre&gt;with (FileInputStream input : new FileInputStream(fileName)) { // use input } &lt;/pre&gt; &lt;/blockquote&gt; &lt;p&gt;which is an invocation of the following method&lt;/p&gt; &lt;blockquote&gt; &lt;pre&gt; public static void with(FileInputStream t, {FileInputStream==&amp;gt;void} block) {&lt;br /&gt; try {&lt;br /&gt; block.invoke(t);&lt;br /&gt; } finally {&lt;br /&gt; try {&lt;br /&gt; t.close();&lt;br /&gt; } catch (IOException ex) {&lt;br /&gt; logger.log(Level.SEVERE, ex.getMessage(), ex);&lt;br /&gt; }&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt; &lt;/blockquote&gt; &lt;p&gt;This is among the simplest control APIs, but it has some limitations:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;It works with the type &lt;code&gt;FileInputStream&lt;code&gt;&lt;/code&gt;&lt;/code&gt;, but not any other &lt;code&gt;Closeable&lt;/code&gt; types&lt;/li&gt; &lt;li&gt;It does not support &lt;a href=&quot;http://tronicek.blogspot.com/2007/12/exceptions.html&quot;&gt;exception transparency&lt;/a&gt;&lt;/li&gt; &lt;li&gt;It does not support &lt;a href=&quot;http://tronicek.blogspot.com/2008/01/completion-transparency.html&quot;&gt;completion transparency&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;p&gt;Completing the API by repairing these defects is left as an exercise to the reader. A solution will be discussed in &lt;a href=&quot;https://www28.cplan.com/cc191/session_details.jsp?isid=295579&amp;ilocation_id=191-1&amp;ilanguage=english&quot;&gt;my JavaOne talk &lt;em&gt;Closures Cookbook&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt; &lt;h3&gt;Method References&lt;/h3&gt; &lt;p&gt;A natural companion to &lt;em&gt;closures&lt;/em&gt; is a way to refer to an existing method instead of writing a closure that accepts the same arguments and just invokes the method. This is sometimes known as &lt;a href=&quot;http://www.lambda-bound.com/book/lambdacalc/node22.html&quot;&gt;&lt;em&gt;eta abstraction&lt;/em&gt;&lt;/a&gt; or &lt;a href=&quot;http://docs.google.com/View?docid=ddhp95vd_6hg3qhc&quot;&gt;&lt;em&gt;method references&lt;/em&gt;&lt;/a&gt;. We expect closures in their final form to include support for this convenient feature, which is why it is called out in the &lt;a href=&quot;http://www.javac.info/consensus-closures-jsr.html&quot;&gt;draft JSR proposal&lt;/a&gt;. The latest version of the prototype supports this, with a syntax based on javadoc conventions. Here are a few examples:&lt;/p&gt; &lt;blockquote&gt; &lt;pre&gt;{ int =&amp;gt; Integer } integerValue = Integer#valueOf(int); { Integer =&amp;gt; String } integerString = Integer#toString(); { int, int =&amp;gt; int } min = Math#min(int, int); { String =&amp;gt; void } println = System.out#println(String); { =&amp;gt; String } three = new Integer(3)#toString(); { Collection&amp;lt;String&amp;gt; =&amp;gt; String } max = Collections#max(Collection&amp;lt;String&amp;gt;); { =&amp;gt; Collection&amp;lt;String&amp;gt; } makeEmpty = Collections#&amp;lt;String&amp;gt;emptySet(); Runnable printEmptyLine = System.out#println();&lt;/pre&gt; &lt;/blockquote&gt; &lt;p&gt;Writing code as a method is sometimes more convenient than writing it as a closure:&lt;/p&gt; &lt;blockquote&gt; &lt;pre&gt;void doTask() { // a complex task to be done in the background } Executor ex = ...; ex.execute(&lt;strong&gt;this#doTask()&lt;/strong&gt;);&lt;/pre&gt; &lt;/blockquote&gt; &lt;h3&gt;Puzzler Solution&lt;/h3&gt; &lt;p&gt;A couple of weeks ago we looked at &lt;a href=&quot;http://gafter.blogspot.com/2008/02/closures-puzzler-neapolitan-ice-cream.html&quot;&gt;a Java puzzler involving closures&lt;/a&gt;, and a number of people discussed the underlying issue. My favorite is &lt;a href=&quot;http://www.chrononaut.org/showyourwork/?p=21&quot;&gt;David&#39;s post &amp;quot;&lt;em&gt;Color-flavor locking breaks chiral symmetry&amp;quot;&lt;/em&gt;&lt;/a&gt;. Lessons include not exposing public fields (accessors are better) and being careful to avoid cyclic initialization dependencies.&lt;/p&gt; &lt;p&gt;The enum language feature provides support for one solution to the puzzle: specialize each instance of the enums.&lt;/p&gt; &lt;blockquote&gt; &lt;pre&gt;import java.util.*; enum Color { BROWN { public Flavor flavor() { return Flavor.CHOCOLATE; } }, RED { public Flavor flavor() { return Flavor.STRAWBERRY; } }, WHITE { public Flavor flavor() { return Flavor.VANILLA; } }; abstract Flavor flavor(); } enum Flavor { CHOCOLATE { public Color color() { return Color.BROWN; } }, STRAWBERRY { public Color color() { return Color.RED; } }, VANILLA { public Color color() { return Color.WHITE; } }; abstract Color color(); } class Neapolitan { static &amp;lt;T,U&amp;gt; List&amp;lt;U&amp;gt; map(List&amp;lt;T&amp;gt; list, {T=&amp;gt;U} transform) { List&amp;lt;U&amp;gt; result = new ArrayList&amp;lt;U&amp;gt;(list.size()); for (T t : list) { result.add(transform.invoke(t)); } return result; } public static void main(String[] args) { List&amp;lt;Color&amp;gt; colors = map(Arrays.asList(Flavor.values()), { Flavor f =&amp;gt; f.color() }); System.out.println(colors.equals(Arrays.asList(Color.values()))); List&amp;lt;Flavor&amp;gt; flavors = map(Arrays.asList(Color.values()), { Color c =&amp;gt; c.flavor() }); System.out.println(flavors.equals(Arrays.asList(Flavor.values()))); } }&lt;/pre&gt; &lt;/blockquote&gt; &lt;p&gt;Another elegant solution, due to 5er_levart, uses closures:&lt;/p&gt; &lt;blockquote&gt; &lt;pre&gt;enum Color { BROWN({=&gt;Flavor.CHOCOLATE}), RED({=&gt;Flavor.STRAWBERRY}), WHITE({=&gt;Flavor.VANILLA}); private final {=&gt;Flavor} flavor; public Flavor flavor() { return flavor.invoke(); } Color({=&gt;Flavor} flavor) { this.flavor = flavor; } } enum Flavor { CHOCOLATE({=&gt;Color.BROWN}), STRAWBERRY({=&gt;Color.RED}), VANILLA({=&gt;Color.WHITE}); private final {=&gt;Color} color; public Color color() { return color.invoke(); } Flavor({=&gt;Color} color) { this.color = color; } } &lt;/pre&gt; &lt;/blockquote&gt; &lt;p&gt;In both solutions the idea is to compute the value lazily, a key technique to break dependency cycles.&lt;/p&gt;</content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=7985322555245085577' title='23 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/7985322555245085577'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/7985322555245085577'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2008/03/closures-control-abstraction-method.html' title='Closures: Control Abstraction, Method References, Puzzler Solution'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>23</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-8792241959435745973</id><published>2008-02-05T09:21:00.000-08:00</published><updated>2008-02-05T09:23:12.532-08:00</updated><title type='text'>Closures Puzzler: Neapolitan Ice Cream</title><content type='html'>&lt;p&gt; People experience the world in different ways, using different senses. Some people view the world primarily through sight. Do you see what I mean? Some through sound. Do you hear me? Some experience the world only after thought and reflection. Do you know what I mean? Some point out &quot;smells&quot; in code as a way of criticizing its design. This puzzle explores the question of whether people experiencing the same thing through different senses are really experiencing the same thing at all. What is the program&#39;s output, and why? &lt;/p&gt; &lt;p&gt; This puzzle uses &lt;a href=&quot;http://www.javac.info/&quot;&gt;Java Closures&lt;/a&gt;, so if you want to try it you should download the prototype &lt;a href=&quot;http://www.javac.info/closures.tar.gz&quot;&gt;here&lt;/a&gt;. You can download the puzzle sources &lt;a href=&quot;http://www.javac.info/Neapolitan.java&quot;&gt;here&lt;/a&gt;. Comments on this blog post will not be posted to avoid spoiling the puzzle. &lt;/p&gt; &lt;blockquote&gt; &lt;pre&gt; import java.util.*; enum Color { BROWN(Flavor.CHOCOLATE), RED(Flavor.STRAWBERRY), WHITE(Flavor.VANILLA); final Flavor flavor; Color(Flavor flavor) { this.flavor = flavor; } } enum Flavor { CHOCOLATE(Color.BROWN), STRAWBERRY(Color.RED), VANILLA(Color.WHITE); final Color color; Flavor(Color color) { this.color = color; } } class Neapolitan { static &amp;lt;T,U&gt; List&amp;lt;U&gt; map(List&amp;lt;T&gt; list, {T=&gt;U} transform) { List&amp;lt;U&gt; result = new ArrayList&amp;lt;U&gt;(list.size()); for (T t : list) { result.add(transform.invoke(t)); } return result; } public static void main(String[] args) { List&amp;lt;Color&gt; colors = map(Arrays.asList(Flavor.values()), { Flavor f =&gt; f.color }); System.out.println(colors.equals(Arrays.asList(Color.values()))); List&amp;lt;Flavor&gt; flavors = map(Arrays.asList(Color.values()), { Color c =&gt; c.flavor }); System.out.println(flavors.equals(Arrays.asList(Flavor.values()))); } } &lt;/pre&gt; &lt;/blockquote&gt;</content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=8792241959435745973' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/8792241959435745973'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/8792241959435745973'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2008/02/closures-puzzler-neapolitan-ice-cream.html' title='Closures Puzzler: Neapolitan Ice Cream'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-4922325604477316744</id><published>2008-01-11T17:16:00.001-08:00</published><updated>2008-01-12T11:22:53.267-08:00</updated><title type='text'>Is the Java Language Dying?</title><content type='html'>&lt;p&gt;We tend to think of programming languages in two categories: &amp;quot;living languages&amp;quot; in which we should seriously consider developing new code, and &amp;quot;legacy languages&amp;quot; that we mainly use, if at all, because we have to maintain an existing code base. The act of classifying a language into one or the other category helps us decide what, if anything, we might consider doing to change the language. If a language is primarily a legacy language, changes should be aimed at making it easier to maintain and modify existing bodies of code. A living language, on the other hand, also benefits from changes that make it easier to design, develop, and maintain new code. Living languages evolve to reduce &lt;i&gt;accidental complexity&lt;/i&gt;. &lt;blockquote&gt;&amp;quot;What does a high-level language accomplish? It frees a program from much of its accidental complexity. An abstract program consists of conceptual constructs: operations, datatypes, sequences, and communication. The concrete machine program is concerned with bits, registers, conditions, branches, channels, disks, and such. To the extent that the high-level language embodies the constructs wanted in the abstract program and avoids all lower ones, it eliminates a whole level of complexity that was never inherent in the program at all.&amp;quot; -&lt;em&gt;&lt;a href=&quot;http://info.computer.org/portal/site/computer/menuitem.eb7d70008ce52e4b0ef1bd108bcd45f3/index.jsp?&amp;amp;path=computer/homepage/misc/Brooks&amp;amp;file=index.xml&amp;amp;xsl=article.xsl&amp;amp;&quot;&gt;No Silver Bullet - Fred Brooks&lt;/a&gt; &lt;/em&gt; &lt;/blockquote&gt; &lt;p&gt;Programs written in legacy languages tend to exhibit a high degree of accidental complexity &lt;a href=&quot;http://steve-yegge.blogspot.com/2007/12/codes-worst-enemy.html&quot;&gt;[&lt;i&gt;Code&#39;s Worst Enemy&lt;/i&gt;, Steve Yegge]&lt;/a&gt; &lt;a href=&quot;http://bc-squared.blogspot.com/2007/12/mr-yegge-meets-mr-brooks.html&quot;&gt;[&lt;i&gt;Mr. Yegge meets Mr. Brooks&lt;/i&gt;, Brian C Cunningham]&lt;/a&gt;. Early in the life of a language, the complexity of programs written in that language may appear to be essential, but as we learn more about software engineering and programming languages, we find patterns of complexity appearing in the code that can be eliminated by improved languages. &lt;p&gt;A good example of this is garbage collection. In C and C++, memory management is a pervasive concern. Smart pointers and destructors help, but they do not significantly reduce the complexity of memory management. In languages with garbage collection, most of the complexity of memory management is assumed by the implementation of the language. Most languages that have been introduced in the past ten years support garbage collection. &lt;p&gt;Another example is concurrency. The threads-and-locks-and-semaphores primitives of Java enable parallel programming, but require that programmers express concurrency at a fairly low level. This has been &amp;quot;good enough&amp;quot; for some time, as most programs are not deployed on highly concurrent hardware. But that is changing [&lt;a href=&quot;http://www.gotw.ca/publications/concurrency-ddj.htm&quot;&gt;&lt;i&gt;The Free Lunch Is Over&lt;/i&gt;, Herb Sutter]&lt;/a&gt;. Libraries such as &lt;a href=&quot;http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html&quot;&gt;java.util.concurrent&lt;/a&gt; and &lt;a href=&quot;http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166ydocs/&quot;&gt;Doug Lea&#39;s fork-join framework&lt;/a&gt; help somewhat, but in many cases they introduce complexities of their own. Other languages that support closures, such as &lt;a href=&quot;http://www.scala-lang.org/&quot;&gt;Scala&lt;/a&gt; make fork-join-like libraries much easier to use. Scala supports &lt;a href=&quot;http://portal.acm.org/citation.cfm?id=177584&amp;amp;dl=GUIDE&amp;amp;coll=GUIDE&amp;amp;CFID=10370783&amp;amp;CFTOKEN=82858580&quot;&gt;&lt;i&gt;control abstraction&lt;/i&gt; [Crowl and LeBlanc]&lt;/a&gt;, which allows the &lt;a href=&quot;http://debasishg.blogspot.com/2006/11/threadless-concurrency-on-jvm-aka-scala.html&quot;&gt;libraries to manage much of the complexity associated with concurrency [Debasish Ghosh]&lt;/a&gt;. &lt;a href=&quot;http://lampwww.epfl.ch/%7Eodersky/papers/jmlc06.pdf&quot;&gt;Support&lt;/a&gt; for the &lt;a href=&quot;http://lamp.epfl.ch/%7Ephaller/doc/haller07coord.pdf&quot;&gt;Actors model [Haller and Odersky]&lt;/a&gt;, for example, can be expressed cleanly as &lt;a href=&quot;http://lamp.epfl.ch/%7Ephaller/actors.html&quot;&gt;a library in Scala&lt;/a&gt; &lt;p&gt;Besides &lt;a href=&quot;http://portal.acm.org/citation.cfm?id=177584&amp;amp;dl=GUIDE&amp;amp;coll=GUIDE&amp;amp;CFID=10370783&amp;amp;CFTOKEN=82858580&quot;&gt;raising the level of abstraction of concurrent code&lt;/a&gt;, control abstraction also raises the level of abstraction for sequential code by &lt;a href=&quot;http://www.parleys.com/display/PARLEYS/An+update+on+Java+Closures&quot;&gt;eliminating whole categories of boilerplate, which can instead be moved into common library code&lt;/a&gt;. This kind of boilerplate cannot be significantly reduced by adding one or two custom statements to the language, because such built-in forms necessarily make assumptions about the use cases that narrow their applicability. For example, &lt;a href=&quot;http://docs.google.com/View?docid=dffxznxr_1nmsqkz&quot;&gt;ARM blocks&lt;/a&gt; don&amp;#39;t document how they handle exceptions arising from the close() method. One example in the proposal suggests they are silently swallowed at runtime, which may work for many cases involving I/O streams, but another example given is a transactional API, in which ignoring such exceptions is precisely wrong. Without a specification for the syntax and semantics, the reader is welcome to imagine the most favorable treatment of each use case. But &lt;a href=&quot;http://markmahieu.blogspot.com/2008/01/cicearm-observations.html&quot;&gt;an attempt to reconcile these and other conflicting requirements may show the approach cannot be salvaged&lt;/a&gt;. Perhaps that is why no progress has been made since mid 2006. &lt;p&gt;What about Java? Is it a living language, or &lt;a href=&quot;http://www.infoworld.com/article/07/12/28/52FE-underreported-java_1.html&quot;&gt;a legacy language like Cobol&lt;/a&gt;? This question underlies much of the debate about how to move the Java programming language forward, if at all. Carl Quinn asked at the December 14, 2007, JavaPolis Future of Computing Panel (to be published on &lt;a href=&quot;http://www.parleys.com/&quot;&gt; http://www.parleys.com&lt;/a&gt;): &amp;quot;How can we address the issue of evolving the [Java] platform, language, and libraries without breaking things?&amp;quot; &lt;blockquote&gt; Neal Gafter: &amp;quot;If you don&amp;#39;t want to change the meaning of anything ever, you have no choice but to not do anything. The trick is to minimize the effect of the changes while enabling as much as possible. I think there&amp;#39;s still a lot of room for adding functionality without breaking existing stuff...&amp;quot; &lt;/blockquote&gt; &lt;blockquote&gt; Josh Bloch: &amp;quot;My view of what really happens is a little bit morbid. I think that languages and platforms age by getting larger and clunkier until they fall over of their own weight and die very very slowly, like over ... well, they&amp;#39;re all still alive (though not many are programming Cobol anymore). I think it&amp;#39;s a great thing, I really love it. I think it&amp;#39;s marvelous. It&amp;#39;s the cycle of birth, and growth, and death. I remember James saying to me [...] eight years ago &amp;#39;It&amp;#39;s really great when you get to hit the reset button every once and a while.&amp;#39;&amp;quot; &lt;/blockquote&gt; &lt;p&gt;Josh may well be right. If so, we should place Java on life support and move our development to new languages such as Scala. The fork-join framework itself is an example of &lt;a href=&quot;http://en.wikipedia.org/wiki/Higher-order_function&quot;&gt;higher-order functional programming&lt;/a&gt;, which &lt;a href=&quot;http://www.parleys.com/display/PARLEYS/The+Closures+Controversy&quot;&gt;Josh argues&lt;/a&gt; is a style that &lt;a href=&quot;http://gafter.blogspot.com/2007/12/what-flavor-of-closures.html#c8863950537789037629&quot;&gt;we should neither encourage nor support in Java&lt;/a&gt;. Is it really time to move on? &lt;p&gt;Personally, I believe rumors of Java&amp;#39;s demise are greatly exaggerated. We should think of Java as a living language, and strive to eliminate much of the accidental complexity of Java programs. I believe it is worth adding support for closures and control abstraction, to reduce such complexity of both the sequential and concurrent aspects of our programs. At the same time, for completely new code bases, we should also consider (and continue to develop) newer languages such as Scala, which benefit from the lessons of Java.</content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=4922325604477316744' title='40 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/4922325604477316744'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/4922325604477316744'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2008/01/is-java-dying.html' title='Is the Java Language Dying?'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>40</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-9093673420279741337</id><published>2007-12-13T07:48:00.000-08:00</published><updated>2009-06-30T10:46:44.311-07:00</updated><title type='text'>What flavor of closures?</title><content type='html'>&lt;p&gt; I just attended Josh Bloch&#39;s presentation at JavaPolis, where he asks the community whether they want Java to support function types, or if they&#39;d prefer that people write these things the way they do today. His examples are carefully selected from the most twisted of the test suite. Compiler test suites are a good place to find the most twisted but unrealistic uses of any given language feature. I thought it would be interesting to look at the question in the context of a real API. You probably know my opinion, but just to be clear, here is &lt;a href=&quot;http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166ydocs/jsr166y/forkjoin/ParallelArray.html#combine(js\ r166y.forkjoin.ParallelArray,%20jsr166y.forkjoin.Ops.Combiner)&quot;&gt; an excerpt from Doug Lea&#39;s fork-join framework&lt;/a&gt; &lt;/p&gt; &lt;blockquote&gt; &lt;pre&gt; /** * An object with a function accepting pairs of objects, one of * type T and one of type U, returning those of type V */ interface Combiner&amp;lt;T,U,V&amp;gt; { V combine(T t, U u); } class ParallelArray&amp;lt;T&gt; { /** * Returns a ParallelArray containing results of applying * combine(thisElement, otherElement) for each element. */ &amp;lt;U,V&gt; ParallelArray&amp;lt;V&gt; combine( ParallelArray&amp;lt;U&gt; other, Combiner&amp;lt;? super T, ? super U, ? extends V&gt; combiner) { ... } } &lt;/pre&gt; &lt;/blockquote&gt; &lt;p&gt; And &lt;a href=&quot;http://www.javac.info/jsr166z/jsr166z/forkjoin/ParallelArray.html#combine(jsr166z.forkjoin.Paralle\ lArray,%20info.javac.function.OOO)&quot;&gt;the equivalent code ported to use the features of the closures spec&lt;/a&gt;: &lt;/p&gt; &lt;blockquote&gt; &lt;pre&gt; class ParallelArray&amp;lt;T&gt; { /** * Returns a ParallelArray containing results of applying * combine(thisElement, otherElement) for each element. */ &amp;lt;U,V&gt; ParallelArray&amp;lt;V&gt; combine( ParallelArray&amp;lt;U&gt; other, { T, U =&gt; V } combiner) { ... } } &lt;/pre&gt; &lt;/blockquote&gt; &lt;p&gt;The question Josh asks is this: which version of this API would you prefer see? &lt;/p&gt; &lt;p&gt; The point he makes is that function types enable (he says &quot;encourage&quot;) an &quot;exotic&quot; style of programming - functional programming - which should be discouraged, otherwise the entire platform will become infected with unreadable code. Although functional programming is just as possible with or without function types - they are just shorthand for interface types, after all - Josh prefers the language provide syntactic vinegar for these techniques. &lt;/p&gt; &lt;p&gt; Part of his talk was about the problems of being able to use nonlocal return by default in a closure. See my previous blog post for a description of how this theoretical problem won&#39;t exist in the next version of the spec, and doesn&#39;t exist in the prototype today. &lt;/p&gt; &lt;p&gt; Finally, Josh showed that if you want to use something like eachEntry to loop over a map, and you want to be able to use primitive types for the loop variables, autoboxing doesn&#39;t work and you&#39;d have to define 81 different versions of the eachEntry method (one for each possible primitive type in each position). That&#39;s true, just as it&#39;s true that you&#39;d have to define 81 different versions of the Map API if you want to be able to handle primitives in them. If it turns out to be a good idea to make autoboxing work for the incoming arguments to a closure, that is a small tweak to the closure conversion. These kinds of issues can be addressed in a JSR. &lt;/p&gt; &lt;p&gt; &lt;a href=&quot;http://www.parleys.com/display/PARLEYS/Home#title=The%20Closures%20Controversy;slide=17;talk=5210267&quot;&gt;Josh&#39;s vision for an alternative&lt;/a&gt; is &lt;a href=&quot;http://docs.google.com/View?docid=k73_1ggr36h&quot;&gt;Concise Instance Creation Expressions&lt;/a&gt; along with adding &lt;a href=&quot;http://docs.google.com/View?docid=dffxznxr_1nmsqkz&quot;&gt;a moderate number of new statement forms&lt;/a&gt;. &lt;/p&gt;</content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=9093673420279741337' title='45 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/9093673420279741337'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/9093673420279741337'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2007/12/what-flavor-of-closures.html' title='What flavor of closures?'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>45</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7803021.post-1029343707871820250</id><published>2007-12-03T23:16:00.000-08:00</published><updated>2007-12-05T07:57:34.862-08:00</updated><title type='text'>Restricted Closures</title><content type='html'>&lt;blockquote&gt; &lt;p&gt; &lt;em&gt;Note: this discusses a feature of the Closures specification that was published back in February, but which is likely to change in an upcoming revision.&lt;/em&gt; &lt;/p&gt; &lt;/blockquote&gt; &lt;p&gt; The &lt;a href=&quot;http://www.javac.info/&quot;&gt;Closures for Java specification&lt;/a&gt;, version 0.5, contains a special marker interface &lt;code&gt;java.lang.RestrictedFunction&lt;/code&gt;. When a closure is converted to an interface that extends &lt;code&gt;RestrictedFunction&lt;/code&gt;, this prevents the closure from doing certain operations. Specifically, it prevents accessing mutated local variables from an enclosing scope, or using a &lt;code&gt;break&lt;/code&gt;, &lt;code&gt;continue&lt;/code&gt;, or &lt;code&gt;return&lt;/code&gt; to a target outside the closure. The idea is that APIs that are intended to be used in a concurrent setting would want to receive restricted rather than unrestricted closures to prevent programmers from shooting themselves in the foot. &lt;/p&gt; &lt;p&gt; Two weeks ago &lt;a href=&quot;http://markmahieu.blogspot.com/&quot;&gt;Mark Mahieu&lt;/a&gt; contacted me regarding his experience with the &lt;a href=&quot;http://gafter.blogspot.com/2007/11/closures-prototype-update-and-extension.html&quot;&gt;closures version of the fork-join framework&lt;/a&gt;. Because I had ported that API before I had implemented any of the operations that would be restricted, and before &lt;code&gt;RestrictedFunction&lt;/code&gt; itself, I had simply not provided any restrictions at all. Mark was wondering how to do it: &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt; I hadn&#39;t looked at the &lt;a href=&quot;http://www.javac.info/jsr166z/jsr166z/forkjoin/package-summary.html&quot;&gt;jsr166y javadoc&lt;/a&gt; before you &lt;a href=&quot;http://gafter.blogspot.com/2007/10/java-closures-first-prototype.html&quot;&gt;linked to it on your blog&lt;/a&gt;, so I had the chance to compare the two versions on equal terms, and I can honestly say that I found the closures version of the API to be much more approachable at first blush. I also suspect that the majority of the Java programmers I work with would feel the same way, once comfortable with function type syntax. &lt;/p&gt; &lt;p&gt;One thing I did wonder was whether a method like &lt;code&gt;ParallelArray.combine()&lt;/code&gt; could be declared as: &lt;p&gt; &lt;blockquote&gt; &lt;pre&gt;public &amp;lt;U,V,C extends {T,U=&gt;V} &amp;amp; RestrictedFunction&gt; ParallelArray&amp;lt;V&gt; combine(ParallelArray&amp;lt;U&gt; other, C combiner) { ... } &lt;/pre&gt; &lt;/blockquote&gt; &lt;p&gt; but my reading of the specification suggests that the type C won&#39;t be a valid target for closure conversion. Maybe I&#39;m being greedy, but in certain cases (jsr166y being a good example) I&#39;d ideally want both the clarity provided by using function types in place of a multitude of interfaces, and the compile-time checking afforded by &lt;code&gt;RestrictedFunction&lt;/code&gt;. Having said that, I think the additional type parameter above negates those gains in clarity somewhat, even if it were an option. &lt;/p&gt; &lt;/blockquote&gt; &lt;p&gt; I responded, describing what I had been planning to do in the next minor update of the spec: &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt; I expect to make that work. However, I hope it won&#39;t be necessary. I expect to support function types like &lt;/p&gt; &lt;blockquote&gt; &lt;pre&gt;{T,U=&gt;V}&amp;amp;RestrictedFunction &lt;/pre&gt; &lt;/blockquote&gt; &lt;p&gt; directly. For example &lt;/p&gt; &lt;blockquote&gt; &lt;pre&gt;public &amp;lt;U,V&gt; ParallelArray&amp;lt;V&gt; combine(ParallelArray&amp;lt;U&gt; other, {T,U=&gt;V}&amp;amp;RestrictedFunction combiner) { ... } &lt;/pre&gt; &lt;/blockquote&gt; &lt;p&gt; You will be allowed to intersect a function type with non-generic marker interfaces such as &lt;code&gt;RestrictedFunction&lt;/code&gt;, &lt;code&gt;Serializable&lt;/code&gt;, etc. Unfortunately, I will have to rev the spec to support this. &lt;/p&gt; &lt;/blockquote&gt; &lt;p&gt; Since that time I&#39;ve been discussing this issue with a number of people. Some, who believe that the concurrent use cases are primary, or who believe that &quot;Mort&quot; programmers will blithely copy-and-paste code from anonymous inner classes (which have different semantics) into closures, suggest that the default is backwards: closures and function types should be &lt;em&gt;restricted&lt;/em&gt; unless specific action is taken to make them otherwise. Reversing the sense of the marker interface doesn&#39;t work (it violates subtype substitutability), but there may be other ways to accomplish it. On the other hand, there are others who believe the synchronous use cases, such as control APIs, are primary (even when used in a concurrent setting), and prefer not to see the language cluttered with support for the restictions at all. Instead, they would prefer that any such restrictions take the form of warnings (which the programmer might suppress or ask javac to escalate to errors). I have sympathy for both camps. &lt;/p&gt; &lt;p&gt; Another possibility would be to produce a warning whenever you use a nonlocal transfer at all and do away with &lt;code&gt;RestrictedFunction&lt;/code&gt;. The way to suppress the warning would be with a &lt;code&gt;@SuppressWarning(&quot;nonlocal-transfer&quot;)&lt;/code&gt; annotation. Could we make it an error instead of a warning? This may make the interface easier to read, but it doesn&#39;t give the API designer any way to express a preference. It may make control APIs painful to use. &lt;/p&gt; &lt;p&gt; Finally, it would be possible to use a different syntax for restricted and unrestricted function types and closures. For example, one using the =&gt; token would be restricted, not allowing nonlocal transfers. One using a different token such as ==&gt; or #&gt; would be unrestricted, allowing nonlocal transfers. The idea is that if you want an unrestricted closure, you&#39;d have to use the slightly more awkward syntax, and the receiving type must also be of the unrestricted variety. The control invocation syntax would be defined in terms of the unrestricted form. This enables API designers to express a preference for whether or not clients would be allowed to write unrestricted closures (and therefore, whether or not they would be allowed to use the control invocation syntax). &lt;/p&gt; &lt;p&gt; This can be made to work using only concepts already in the spec. The unrestricted form of a function type would be defined as an interface type as in the current spec. The restricted form would be the same but with &lt;code&gt;RestrictedFunction&lt;/code&gt; mixed in. With this approach there is no need for the explicit &quot;&amp;amp;&quot; conjunction-type syntax for function types. &lt;/p&gt;</content><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7803021&amp;postID=1029343707871820250' title='27 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/1029343707871820250'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/7803021/posts/default/1029343707871820250'/><link rel='alternate' type='text/html' href='https://gafter.blogspot.com/2007/12/restricted-closures.html' title='Restricted Closures'/><author><name>Neal Gafter</name><uri>http://www.blogger.com/profile/08579466817032124881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>27</thr:total></entry></feed>