https://github.com/bor0/hoare-hask
Paper: Tutorial implementation of Hoare logic in Haskell
https://github.com/bor0/hoare-hask
haskell hoare-logic latex
Last synced: about 1 month ago
JSON representation
Paper: Tutorial implementation of Hoare logic in Haskell
- Host: GitHub
- URL: https://github.com/bor0/hoare-hask
- Owner: bor0
- Created: 2021-01-23T18:05:49.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-12-28T06:52:19.000Z (over 4 years ago)
- Last Synced: 2025-05-16T05:38:32.761Z (about 1 year ago)
- Topics: haskell, hoare-logic, latex
- Language: TeX
- Homepage: https://arxiv.org/abs/2101.11320
- Size: 871 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Tutorial implementation of Hoare logic in Haskell
This is the source code repository for my paper `Tutorial implementation of Hoare logic in Haskell`. In the `src` folder you will find:
- `Common.hs`, `PrettyPrinter.hs` - Various utility functions
- `Gentzen.hs` - Implementation of Propositional calculus
- `TNT.hs` - Implementation of Typographical Number Theory
- `Hoare.hs` - Implementation of Hoare logic (on top of Propositional calculus + Number theory)
- `Imp.hs` - Implementation of a simple imperative programming language (the commands correspond to the rules of Hoare logic)
The folder `paper` contains the source code of the paper. The built paper can be downloaded from https://arxiv.org/abs/2101.11320.
See it in action on my mobile phone on [this Tweet](https://twitter.com/BSitnikovski/status/1386738126677291012)
## Prerequisites
Make sure you have the [Haskell Tool Stack](https://haskellstack.org/) installed, or Hugs.
## Running the examples
Check the files in the `examples` folder - each implementation of the system has a corresponding example file.
For instance, to run the proof for the `countToB` program defined in the paper, execute the following commands:
- `stack repl examples/ExampleHoare.hs --ghci-options -iexamples --ghci-options -isrc`
- Once in the REPL mode, evaluate `putStrLn $ pr proof`
For hugs, while in the `src` folder, run `hugs -F"cpphs-hugs --noline -D__HUGS__" ../examples/ExampleHoare.hs`
Copyright 2021, Boro Sitnikovski. All rights reserved.