Skip to content

Latest commit

 

History

History
32 lines (28 loc) · 1.62 KB

README.md

File metadata and controls

32 lines (28 loc) · 1.62 KB

Idris 2 project

CMSC 22500 Spring 2022

Proofs of correctness: Insertion sort and Bubble sort

This repo contains proof-carrying implementations of insertion sort (InsSort.idr) and bubble sort (BubbleSort.idr). The proof terms carried throughout the algorithms in dependent pairs prove the correctness of each sorting algorithm alongside giving the actual sort result. This includes

  • A proof that the output list is sorted
  • A proof that the output list is a permutation of the original input list.

The proofs are largely by induction, utilizing the invariants characteristic to each sorting algorithm. The details are hairy, but the comments in the code should have enough detail to walk one through the proof.

Written and working in Idris 2 (version 0.5.1); parts of the setup of the proofs, including the definitions of sortedness and permutations, are adapted from https://github.com/davidfstr/idris-insertion-sort; the rest of the proofs are original.