perga/examples/classical.pg

28 lines
859 B
Text
Raw Permalink Normal View History

2024-11-22 11:52:30 -08:00
@include logic.pg
-- excluded middle!
-- P ~P
2024-12-10 20:31:53 -08:00
axiom em (P : ★) : P not P;
2024-11-22 11:52:30 -08:00
-- ~~P => P
2024-12-10 20:31:53 -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-10 23:36:34 -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-10 20:31:53 -08:00
def de_morgan4 (A B : ★) (h : not (A ∧ B)) : not A not B :=
or_elim A (not A) (not A not B) (em A)
2024-11-22 11:52:30 -08:00
(fun (a : A) =>
2024-12-10 20:31:53 -08:00
or_elim B (not B) (not A not B) (em B)
(fun (b : B) => h (and_intro A B a b) (not A not B))
2024-11-22 11:52:30 -08:00
(fun (nb : not B) => or_intro_r (not A) (not B) nb))
(fun (na : not A) => or_intro_l (not A) (not B) na);