論理

From Stdlib Require Import Logic.PropExtensionality.

P: Prop

P -> P = True
P: Prop

P -> P = True
P: Prop
H: P

P = True
P: Prop
H: P

P <-> True
P: Prop
H: P

P -> True
P: Prop
H: P
True -> P
P: Prop
H: P

P -> True
trivial.
P: Prop
H: P

True -> P
P: Prop
H: P
H0: True

P
assumption. Qed.
P: Prop

~ P -> P = False
P: Prop

~ P -> P = False
P: Prop
H: ~ P

P = False
P: Prop
H: ~ P

P <-> False
P: Prop
H: ~ P

P -> False
P: Prop
H: ~ P
False -> P
P: Prop
H: ~ P

P -> False
trivial.
P: Prop
H: ~ P

False -> P
P: Prop
H: ~ P
H0: False

P
contradiction. Qed.

~ False

~ False
H: False

False
assumption. Qed.
P, Q: Prop

~ (P \/ Q) -> ~ P /\ ~ Q
P, Q: Prop

~ (P \/ Q) -> ~ P /\ ~ Q
P, Q: Prop
H: ~ (P \/ Q)

~ P /\ ~ Q
P, Q: Prop
H: P \/ Q -> False

~ P /\ ~ Q
P, Q: Prop
H: P \/ Q -> False

~ P
P, Q: Prop
H: P \/ Q -> False
~ Q
P, Q: Prop
H: P \/ Q -> False

~ P
P, Q: Prop
H: P \/ Q -> False
H0: P

False
P, Q: Prop
H: P \/ Q -> False
H0: P

P \/ Q
P, Q: Prop
H: P \/ Q -> False
H0: P

P
assumption.
P, Q: Prop
H: P \/ Q -> False

~ Q
P, Q: Prop
H: P \/ Q -> False
H0: Q

False
P, Q: Prop
H: P \/ Q -> False
H0: Q

P \/ Q
P, Q: Prop
H: P \/ Q -> False
H0: Q

Q
assumption. Qed.
P, Q: Prop

~ False -> True
P, Q: Prop

~ False -> True
trivial. Qed.
P, Q: Prop

~ True -> False
P, Q: Prop

~ True -> False
P, Q: Prop
H: ~ True

False
P, Q: Prop
H: ~ True

True
trivial. Qed.
P, Q: Prop

(P -> Q) -> ~ Q -> ~ P
P, Q: Prop

(P -> Q) -> ~ Q -> ~ P
P, Q: Prop
H0: P -> Q
H1: ~ Q
H2: P

False
P, Q: Prop
H0: P -> Q
H1: ~ Q
H2: P

Q
P, Q: Prop
H0: P -> Q
H1: ~ Q
H2: P

P
assumption. Qed.
P: Prop

P -> ~ ~ P
P: Prop

P -> ~ ~ P
P: Prop

P -> (P -> False) -> False
P: Prop
H: P
H0: P -> False

False
apply H0, H. Qed.
A: Type
P: A -> Prop

~ (exists x : A, P x) -> forall x : A, ~ P x
A: Type
P: A -> Prop

~ (exists x : A, P x) -> forall x : A, ~ P x
A: Type
P: A -> Prop

((exists x : A, P x) -> False) -> forall x : A, P x -> False
A: Type
P: A -> Prop
H: (exists x : A, P x) -> False
x: A
H0: P x

False
A: Type
P: A -> Prop
H: (exists x : A, P x) -> False
x: A
H0: P x

exists x0 : A, P x0
A: Type
P: A -> Prop
H: (exists x : A, P x) -> False
x: A
H0: P x

P x
assumption. Qed.
P, Q: Prop

~ (P /\ Q) -> P -> ~ Q
P, Q: Prop

~ (P /\ Q) -> P -> ~ Q
P, Q: Prop

(P /\ Q -> False) -> P -> Q -> False
P, Q: Prop
H: P /\ Q -> False
H0: P
H1: Q

False
P, Q: Prop
H: P /\ Q -> False
H0: P
H1: Q

P /\ Q
auto. Qed.
P, Q: Prop

P \/ Q -> ~ Q -> P
P, Q: Prop

P \/ Q -> ~ Q -> P
P, Q: Prop
H: P \/ Q
H0: ~ Q

P
P, Q: Prop
H: P
H0: ~ Q

P
P, Q: Prop
H: Q
H0: ~ Q
P
P, Q: Prop
H: P
H0: ~ Q

P
assumption.
P, Q: Prop
H: Q
H0: ~ Q

P
contradiction. Qed. Definition andalso {A : Type} (P : A -> Prop) (Q : {a : A | P a} -> Prop) : A -> Prop := fun a => exists p : P a, Q (exist P a p).

TODO: 適切なファイルに移動する:

P: Prop

forall x y : P + (~ P), x = y
P: Prop

forall x y : P + (~ P), x = y
P: Prop
x, y: P + (~ P)

x = y
P: Prop
p, p0: P

inl p = inl p0
P: Prop
p: P
n: ~ P
inl p = inr n
P: Prop
n: ~ P
p: P
inr n = inl p
P: Prop
n, n0: ~ P
inr n = inr n0
P: Prop
p, p0: P

inl p = inl p0
P: Prop
p, p0: P

p = p0
apply proof_irrelevance.
P: Prop
p: P
n: ~ P

inl p = inr n
contradiction.
P: Prop
n: ~ P
p: P

inr n = inl p
contradiction.
P: Prop
n, n0: ~ P

inr n = inr n0
P: Prop
n, n0: ~ P

n = n0
apply proof_irrelevance. Qed.