Code Monkey home page Code Monkey logo

miu_language's Introduction

An MIU Decision Procedure in Lean

The MIU formal system was introduced by Douglas Hofstadter in the first chapter of his 1979 book, Gödel, Escher, Bach. The system is defined by four rules of inference, one axiom, and an alphabet of three symbols: M, I, and U.

Hofstadter's central question is: can the string "MU" be derived?

It transpires that there is a simple decision procedure for this system. A string is derivable if and only if it starts with M, contains no other Ms, and the number of Is in the string is congruent to 1 or 2 modulo 3.

The principal aim of this project is to give a Lean proof that the derivability of a string is a decidable predicate.

The MIU System

In Hofstadter's description, an atom is any one of M, I or U. A string is a finite sequence of zero or more symbols. To simplify notation, we write a sequence [I,U,U,M], for example, as IUUM.

The four rules of inference are:

  1. xI → xIU,
  2. Mx → Mxx,
  3. xIIIy → xUy,
  4. xUUy → xy,

where the notation α → β is to be interpreted as 'if α is derivable, then β is derivable'.

Additionally, he has an axiom:

  • MI is derivable.

In Lean, it is natural to treat the rules of inference and the axiom on an equal footing via an inductive data type derivable designed so that derviable x represents the notion that the string x can be derived from the axiom by the rules of inference. The axiom is represented as a nonrecursive constructor for derivable. This mirrors the translation of Peano's axiom '0 is a natural number' into the nonrecursive constructor zero of the inductive type nat.

inductive derivable : miustr → Prop
| mk : derivable "MI"
| r1 {x} : derivable (x ++ [I]) → derivable (x ++ [I, U])
| r2 {x} : derivable (M :: x) → derivable (M :: x ++ x)
| r3 {x y} : derivable (x ++ [I, I, I] ++ y) → derivable (x ++ U :: y)
| r4 {x y} : derivable (x ++ [U, U] ++ y) → derivable (x ++ y)

With the above definition, we can, for example, prove that "UMIU" is derivable, assuming "UMI" is derivable.

example (h : derivable "UMI") : derivable "UMIU" :=
begin
  change ("UMIU" : miustr) with [U,M] ++ [I,U],
  exact derivable.r1 h, -- Rule 1
end

References

  • Jeremy Avigad, Leonardo de Moura and Soonho Kong, Theorem Proving in Lean.
  • Douglas R Hofstadter (1979). Gödel, Escher, Bach: an eternal golden braid, New York, Basic Books.

miu_language's People

Contributors

gihanmarasingha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.