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

chore(*): fix errors in library and sanity_check #1499

Merged
merged 10 commits into from
Oct 3, 2019
23 changes: 17 additions & 6 deletions src/logic/basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -591,12 +591,23 @@ begin
simp only [imp_iff_not_or, or.comm]
end

/- use shortened names to avoid conflict when classical namespace is open.
These are marked as lemmas, to avoid "failed to generate bytecode" errors -/
noncomputable lemma dec (p : Prop) : decidable p := by apply_instance
noncomputable lemma dec_pred (p : α → Prop) : decidable_pred p := by apply_instance
noncomputable lemma dec_rel (p : α → α → Prop) : decidable_rel p := by apply_instance
noncomputable lemma dec_eq (α : Sort*) : decidable_eq α := by apply_instance
/- use shortened names to avoid conflict when classical namespace is open. -/
noncomputable lemma dec (p : Prop) : decidable p := -- see Note [classical lemma]
by apply_instance
noncomputable lemma dec_pred (p : α → Prop) : decidable_pred p := -- see Note [classical lemma]
by apply_instance
noncomputable lemma dec_rel (p : α → α → Prop) : decidable_rel p := -- see Note [classical lemma]
by apply_instance
noncomputable lemma dec_eq (α : Sort*) : decidable_eq α := -- see Note [classical lemma]
by apply_instance

/- Note [classical lemma]:
We make decidability results that depends on `classical.choice` noncomputable lemmas.
* We have to mark them as noncomputable, because otherwise Lean will try to generate bytecode
for them, and fail because it depends on `classical.choice`.
* We make them lemmas, and not definitions, because otherwise later declarations will raise
"failed to generate bytecode" errors.
Cf. https://leanprover-community.github.io/archive/113488general/08268noncomputabletheorem.html -/

@[elab_as_eliminator]
noncomputable def {u} exists_cases {C : Sort u} (H0 : C) (H : ∀ a, p a → C) : C :=
Expand Down