refactor(library/logic/choice): move prop_decidable instance into namespace 'classical'
This commit is contained in:
parent
b4024982a2
commit
cb9830beaf
11 changed files with 15 additions and 13 deletions
|
@ -6,7 +6,7 @@ Author: Jeremy Avigad
|
||||||
Set-based version of group_bigops.
|
Set-based version of group_bigops.
|
||||||
-/
|
-/
|
||||||
import .group_bigops data.set.finite
|
import .group_bigops data.set.finite
|
||||||
open set
|
open set classical
|
||||||
|
|
||||||
namespace algebra
|
namespace algebra
|
||||||
namespace set
|
namespace set
|
||||||
|
|
|
@ -65,6 +65,10 @@ definition not_mem (a : hf) (s : hf) : Prop := ¬ a ∈ s
|
||||||
|
|
||||||
infix `∉` := not_mem
|
infix `∉` := not_mem
|
||||||
|
|
||||||
|
open decidable
|
||||||
|
protected definition decidable_mem [instance] : ∀ a s, decidable (a ∈ s) :=
|
||||||
|
λ a s, finset.decidable_mem a (to_finset s)
|
||||||
|
|
||||||
lemma not_mem_empty (a : hf) : a ∉ ∅ :=
|
lemma not_mem_empty (a : hf) : a ∉ ∅ :=
|
||||||
begin unfold [not_mem, mem, empty], rewrite to_finset_of_finset, apply finset.not_mem_empty end
|
begin unfold [not_mem, mem, empty], rewrite to_finset_of_finset, apply finset.not_mem_empty end
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,7 @@ open -[coercions] rat
|
||||||
local notation 0 := rat.of_num 0
|
local notation 0 := rat.of_num 0
|
||||||
local notation 1 := rat.of_num 1
|
local notation 1 := rat.of_num 1
|
||||||
open -[coercions] nat
|
open -[coercions] nat
|
||||||
open eq.ops
|
open eq.ops pnat classical
|
||||||
open pnat
|
|
||||||
|
|
||||||
local notation 2 := subtype.tag (nat.of_num 2) dec_trivial
|
local notation 2 := subtype.tag (nat.of_num 2) dec_trivial
|
||||||
local notation 3 := subtype.tag (nat.of_num 3) dec_trivial
|
local notation 3 := subtype.tag (nat.of_num 3) dec_trivial
|
||||||
|
|
|
@ -12,7 +12,7 @@ and excluded middle.
|
||||||
import data.real.basic data.real.order data.rat data.nat logic.choice
|
import data.real.basic data.real.order data.rat data.nat logic.choice
|
||||||
open -[coercions] rat
|
open -[coercions] rat
|
||||||
open -[coercions] nat
|
open -[coercions] nat
|
||||||
open eq.ops pnat
|
open eq.ops pnat classical
|
||||||
|
|
||||||
local notation 0 := rat.of_num 0
|
local notation 0 := rat.of_num 0
|
||||||
local notation 1 := rat.of_num 1
|
local notation 1 := rat.of_num 1
|
||||||
|
|
|
@ -6,7 +6,7 @@ Author: Jeremy Avigad
|
||||||
Cardinality of finite sets.
|
Cardinality of finite sets.
|
||||||
-/
|
-/
|
||||||
import .finite data.finset.card
|
import .finite data.finset.card
|
||||||
open nat
|
open nat classical
|
||||||
|
|
||||||
namespace set
|
namespace set
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ Using classical logic, defines an inverse function.
|
||||||
-/
|
-/
|
||||||
import .function .map
|
import .function .map
|
||||||
import logic.choice
|
import logic.choice
|
||||||
open eq.ops
|
open eq.ops classical
|
||||||
|
|
||||||
namespace set
|
namespace set
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ Filters, following Hölzl, Immler, and Huffman, "Type classes and filters for ma
|
||||||
analysis in Isabelle/HOL".
|
analysis in Isabelle/HOL".
|
||||||
-/
|
-/
|
||||||
import data.set.function logic.identities logic.choice algebra.complete_lattice
|
import data.set.function logic.identities logic.choice algebra.complete_lattice
|
||||||
|
|
||||||
namespace set
|
namespace set
|
||||||
|
open classical
|
||||||
|
|
||||||
structure filter (A : Type) :=
|
structure filter (A : Type) :=
|
||||||
(sets : set (set A))
|
(sets : set (set A))
|
||||||
|
|
|
@ -8,7 +8,7 @@ an element s : set A satsifies finite s doesn't mean that we can compute the
|
||||||
a computational representation, use the finset type.
|
a computational representation, use the finset type.
|
||||||
-/
|
-/
|
||||||
import data.set.function data.finset.to_set logic.choice
|
import data.set.function data.finset.to_set logic.choice
|
||||||
open nat
|
open nat classical
|
||||||
|
|
||||||
variable {A : Type}
|
variable {A : Type}
|
||||||
|
|
||||||
|
|
|
@ -161,9 +161,8 @@ propext (iff.intro
|
||||||
end aux
|
end aux
|
||||||
|
|
||||||
/- All propositions are decidable -/
|
/- All propositions are decidable -/
|
||||||
section all_decidable
|
namespace classical
|
||||||
open decidable sum
|
open decidable sum
|
||||||
|
|
||||||
noncomputable definition decidable_inhabited [instance] [priority 0] (a : Prop) : inhabited (decidable a) :=
|
noncomputable definition decidable_inhabited [instance] [priority 0] (a : Prop) : inhabited (decidable a) :=
|
||||||
inhabited_of_nonempty
|
inhabited_of_nonempty
|
||||||
(or.elim (em a)
|
(or.elim (em a)
|
||||||
|
@ -178,4 +177,4 @@ match prop_decidable (nonempty A) with
|
||||||
| inl Hp := sum.inl (inhabited.value (inhabited_of_nonempty Hp))
|
| inl Hp := sum.inl (inhabited.value (inhabited_of_nonempty Hp))
|
||||||
| inr Hn := sum.inr (λ a, absurd (nonempty.intro a) Hn)
|
| inr Hn := sum.inr (λ a, absurd (nonempty.intro a) Hn)
|
||||||
end
|
end
|
||||||
end all_decidable
|
end classical
|
||||||
|
|
|
@ -10,7 +10,7 @@ The excluded middle is being used "behind the scenes" to allow us to write the i
|
||||||
with (∃ a : A, f a = b).
|
with (∃ a : A, f a = b).
|
||||||
-/
|
-/
|
||||||
import logic.choice
|
import logic.choice
|
||||||
open function
|
open function classical
|
||||||
|
|
||||||
noncomputable definition mk_left_inv {A B : Type} [h : nonempty A] (f : A → B) : B → A :=
|
noncomputable definition mk_left_inv {A B : Type} [h : nonempty A] (f : A → B) : B → A :=
|
||||||
λ b : B, if ex : (∃ a : A, f a = b) then some ex else inhabited.value (inhabited_of_nonempty h)
|
λ b : B, if ex : (∃ a : A, f a = b) then some ex else inhabited.value (inhabited_of_nonempty h)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import classical
|
import classical open classical
|
||||||
eval if true then 1 else 0
|
eval if true then 1 else 0
|
||||||
attribute prop_decidable [priority 0]
|
attribute prop_decidable [priority 0]
|
||||||
eval if true then 1 else 0
|
eval if true then 1 else 0
|
||||||
|
|
Loading…
Reference in a new issue