Spectral/logic.hlean

63 lines
1.5 KiB
Text
Raw Normal View History

2017-03-31 20:36:35 +00:00
/-
Copyright (c) 2017 Jeremy Avigad. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad
-/
import types.trunc
open funext eq trunc is_trunc prod sum
--reserve prefix `¬`:40
--reserve prefix `~`:40
--reserve infixr ` ∧ `:35
--reserve infixr ` /\ `:35
--reserve infixr ` \/ `:30
--reserve infixr ` `:30
--reserve infix ` <-> `:20
--reserve infix ` ↔ `:20
namespace logic
section
open trunc_index
definition propext {p q : Prop} (h : p ↔ q) : p = q :=
2018-09-11 15:06:46 +00:00
tua (equiv_of_iff_of_is_prop h _ _)
2017-03-31 20:36:35 +00:00
end
2017-04-07 19:12:31 +00:00
definition false : Prop := trunctype.mk (lift empty) _
2017-03-31 20:36:35 +00:00
2017-04-07 19:12:31 +00:00
definition false.elim {A : Type} (h : false) : A := lift.rec empty.elim h
2017-03-31 20:36:35 +00:00
2017-04-07 19:12:31 +00:00
definition true : Prop := trunctype.mk (lift unit) _
2017-03-31 20:36:35 +00:00
2017-04-07 19:12:31 +00:00
definition true.intro : true := lift.up unit.star
2017-03-31 20:36:35 +00:00
2017-04-07 19:12:31 +00:00
definition trivial : true := lift.up unit.star
2017-03-31 20:36:35 +00:00
definition and (p q : Prop) : Prop := tprod p q
infixr ` ∧ ` := and
infixr ` /\ ` := and
definition and.intro {p q : Prop} (h₁ : p) (h₂ : q) : and p q := prod.mk h₁ h₂
definition and.left {p q : Prop} (h : p ∧ q) : p := prod.pr1 h
definition and.right {p q : Prop} (h : p ∧ q) : q := prod.pr2 h
definition not (p : Prop) : Prop := trunctype.mk (p → empty) _
definition or.inl := @or.intro_left
definition or.inr := @or.intro_right
2017-04-07 19:12:31 +00:00
definition or.elim {A B C : Type} [is_prop C] (h₀ : A B) (h₁ : (A → C)) (h₂ : B → C) : C :=
begin
apply trunc.elim_on h₀,
2018-09-11 15:06:46 +00:00
intro h₃,
apply sum.elim h₃ h₁ h₂
2017-04-07 19:12:31 +00:00
end
2017-03-31 20:36:35 +00:00
end logic