Skip to content

Instantly share code, notes, and snippets.

@steshaw
Created June 29, 2023 07:21
Show Gist options
  • Save steshaw/9cc99d3cbc16c9fbf61ac690798ac326 to your computer and use it in GitHub Desktop.
Save steshaw/9cc99d3cbc16c9fbf61ac690798ac326 to your computer and use it in GitHub Desktop.
/-
Following along with the Logical Foundations book, available at
https://softwarefoundations.cis.upenn.edu/lf-current/Basics.html
-/
inductive Day : Type :=
| monday
| tuesday
| wednesday
| thursday
| friday
| saturday
| sunday
deriving Repr
def Day.next_weekday (d : Day) : Day :=
match d with
| monday => tuesday
| tuesday => wednesday
| wednesday => thursday
| thursday => friday
| friday => monday
| saturday => monday
| sunday => monday
#eval Day.friday.next_weekday
-- Day.monday
#eval Day.saturday.next_weekday.next_weekday
-- Day.tuesday
/-
FIXME: Fails with the following message
failed to infer binder type
when the resulting type of a declaration is explicitly provided, all holes
(e.g., `_`) in the header are resolved before the declaration body is processed
-/
example test_next_weekday:
Day.saturday.next_weekday.next_weekday = Day.tuesday
:= rfl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment