<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Formal-Verification on Karpoke - Just Another Blog</title><link>http://karpoke.ignaciocano.com/tags/formal-verification/</link><description>Recent content in Formal-Verification on Karpoke - Just Another Blog</description><generator>Hugo -- 0.167.0</generator><language>es</language><lastBuildDate>Sat, 28 Feb 2015 14:31:00 +0100</lastBuildDate><atom:link href="http://karpoke.ignaciocano.com/tags/formal-verification/index.xml" rel="self" type="application/rss+xml"/><item><title>Proving that Android’s, Java’s and Python’s sorting algorithm is broken (and showing how to fix it)</title><link>http://karpoke.ignaciocano.com/2015/02/28/proving-that-androids-javas-and-pythons-sorting-algorithm-is-broken-and-showing-how-to-fix-it/</link><pubDate>Sat, 28 Feb 2015 14:31:00 +0100</pubDate><guid>http://karpoke.ignaciocano.com/2015/02/28/proving-that-androids-javas-and-pythons-sorting-algorithm-is-broken-and-showing-how-to-fix-it/</guid><description>&lt;blockquote&gt;
&lt;p&gt;Tim Peters developed the Timsort hybrid sorting algorithm in 2002. It
is a clever combination of ideas from merge sort and insertion sort,
and designed to perform well on real world data. TimSort was first
developed for Python, but later ported to Java (where it appears as
java.util.Collections.sort and java.util.Arrays.sort) by Joshua Bloch
(the designer of Java Collections who also pointed out that most
binary search algorithms were broken). TimSort is today used as the
default sorting algorithm for Android SDK, Sun’s JDK and OpenJDK.
Given the popularity of these platforms this means that the number of
computers, cloud services and mobile phones that use TimSort for
sorting is well into the billions. Fast forward to 2015. After we had
successfully verified Counting and Radix sort implementations in Java
(J. Autom. Reasoning 53(2), 129-139) with a formal verification tool
called KeY, we were looking for a new challenge. TimSort seemed to fit
the bill, as it is rather complex and widely used. Unfortunately, we
weren’t able to prove its correctness. A closer analysis showed that
this was, quite simply, because TimSort was broken and our theoretical
considerations finally led us to a path towards finding the bug
(interestingly, that bug appears already in the Python
implementation). This blog post shows how we did it.&lt;/p&gt;
&lt;/blockquote&gt;</description></item></channel></rss>