perga/examples/classical.pg

28 lines
862 B
Text
Raw Normal View History

2024-11-22 11:52:30 -08:00
@include logic.pg
-- excluded middle!
-- P ~P
2024-12-01 18:06:03 -08:00
axiom em (P : *) : or P (not P);
2024-11-22 11:52:30 -08:00
-- ~~P => P
2024-12-01 15:29:05 -08:00
def dne (P : *) (nnp : not (not P)) : P :=
2024-11-22 11:52:30 -08:00
or_elim P (not P) P (em P)
(fun (p : P) => p)
(fun (np : not P) => nnp np P);
-- ((P => Q) => P) => P
2024-12-01 15:29:05 -08:00
def peirce (P Q : *) (h : (P -> Q) -> P) : P :=
2024-11-22 11:52:30 -08:00
or_elim P (not P) P (em P)
(fun (p : P) => p)
(fun (np : not P) => h (fun (p : P) => np p Q));
-- ~(A ∧ B) => ~A ~B
2024-12-01 15:29:05 -08:00
def de_morgan4 (A B : *) (h : not (and A B)) : or (not A) (not B) :=
2024-11-22 11:52:30 -08:00
or_elim A (not A) (or (not A) (not B)) (em A)
(fun (a : A) =>
or_elim B (not B) (or (not A) (not B)) (em B)
(fun (b : B) => h (and_intro A B a b) (or (not A) (not B)))
(fun (nb : not B) => or_intro_r (not A) (not B) nb))
(fun (na : not A) => or_intro_l (not A) (not B) na);