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

feat(logic): make some decidability proofs [inline] #1393

Merged
merged 5 commits into from
Sep 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/logic/basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ maybe it is useful for writing automation.

section miscellany

/- We add the `inline` attribute to optimize VM computation using these declarations. For example,
`if p ∧ q then ... else ...` will not evaluate the decidability of `q` if `p` is false. -/
attribute [inline] and.decidable or.decidable decidable.false xor.decidable iff.decidable
decidable.true implies.decidable not.decidable ne.decidable

variables {α : Type*} {β : Type*}

@[reducible] def hidden {a : α} := a
Expand Down
13 changes: 13 additions & 0 deletions test/logic_inline.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/-
Copyright (c) 2019 Keeley Hoek. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Keeley Hoek, Floris van Doorn
-/

import logic.basic
meta def error_msg (s : string) : bool := @undefined_core bool $ s ++ ".decidable not inlined"

meta def examine (b : Prop) [decidable b] : bool := b

#eval examine $ ff ∧ (error_msg "and")
#eval examine $ tt ∨ (error_msg "or")