Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate Option from total function result types #4756

Open
Tracked by #4743
tothtamas28 opened this issue Feb 12, 2025 · 0 comments
Open
Tracked by #4743

Eliminate Option from total function result types #4756

tothtamas28 opened this issue Feb 12, 2025 · 0 comments

Comments

@tothtamas28
Copy link
Contributor

Related

If a K function symbol production is marked total, the corresponding Lean definition should not have Option as its result type.

The key to this is generating theorem stubs that can be used to show absurdity of certain cases.

For the main def, it should be proved that alt least one of the rules apply. For a rule def, each application of a non-total function induces an obligation to prove definedness.

Motivating example:

def div (x y : Nat) : Option Nat := ...

theorem div_x_2_ne_none (x : Nat) : div x 2 ≠ none := sorry

def halve (x : Nat) : Nat :=
  match h0 : div x 2 with
  | some res => res
  | none => absurd h0 (div_x_2_ne_none x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant