Skip to content

Commit

Permalink
feat(logic): make some decidability proofs [inline] (leanprover-commu…
Browse files Browse the repository at this point in the history
…nity#1393)

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

* inline more decidability proofs

* test

* import logic.basic in test
  • Loading branch information
fpvandoorn authored and anrddh committed May 15, 2020
1 parent a2d7992 commit 16446b6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
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")

0 comments on commit 16446b6

Please sign in to comment.