aboutsummaryrefslogtreecommitdiff
path: root/Coprod.thy
blob: 75e621ad74392dcb773f278f79236ebc03c1fa30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
(*  Title:  HoTT/Coprod.thy
    Author: Josh Chen
    Date:   Aug 2018

Coproduct type.
*)

theory Coprod
  imports HoTT_Base
begin


section \<open>Constants and type rules\<close>

axiomatization
  Coprod :: "[Term, Term] \<Rightarrow> Term"  (infixr "+" 50) and
  inl :: "Term \<Rightarrow> Term"  ("(1inl'(_'))") and
  inr :: "Term \<Rightarrow> Term"  ("(1inr'(_'))") and
  indCoprod :: "[Term, Term, Typefam, Term \<Rightarrow> Term, Term \<Rightarrow> Term, Term] \<Rightarrow> Term"  ("(1ind\<^sub>+[_,/ _])")
where
  Coprod_form: "\<And>i A B. \<lbrakk>A : U(i); B : U(i)\<rbrakk> \<Longrightarrow> A + B : U(i)"
and
  Coprod_intro1: "\<And>A B a b. \<lbrakk>a : A; b : B\<rbrakk> \<Longrightarrow> inl(a) : A + B"
and
  Coprod_intro2: "\<And>A B a b. \<lbrakk>a : A; b : B\<rbrakk> \<Longrightarrow> inr(b) : A + B"
and
  Coprod_elim: "\<And>i A B C c d e. \<lbrakk>
    C: A + B \<longrightarrow> U(i);
    \<And>x. x : A \<Longrightarrow> c x : C inl(x);
    \<And>y. y : B \<Longrightarrow> d y : C inr(y);
    e : A + B
    \<rbrakk> \<Longrightarrow> ind\<^sub>+[A,B] C c d e : C e"
and
  Coprod_comp1: "\<And>i A B C c d a. \<lbrakk>
    C: A + B \<longrightarrow> U(i);
    \<And>x. x : A \<Longrightarrow> c x : C inl(x);
    \<And>y. y : B \<Longrightarrow> d y : C inr(y);
    a : A
    \<rbrakk> \<Longrightarrow> ind\<^sub>+[A,B] C c d inl(a) \<equiv> c a"
and
  Coprod_comp2: "\<And>i A B C c d b. \<lbrakk>
    C: A + B \<longrightarrow> U(i);
    \<And>x. x : A \<Longrightarrow> c x : C inl(x);
    \<And>y. y : B \<Longrightarrow> d y : C inr(y);
    b : B
    \<rbrakk> \<Longrightarrow> ind\<^sub>+[A,B] C c d inr(b) \<equiv> d b"

text "Admissible formation inference rules:"

axiomatization where
  Coprod_form_cond1: "\<And>i A B. A + B : U(i) \<Longrightarrow> A : U(i)"
and
  Coprod_form_cond2: "\<And>i A B. A + B : U(i) \<Longrightarrow> B : U(i)"

lemmas Coprod_rules [intro] = Coprod_form Coprod_intro1 Coprod_intro2
                              Coprod_elim Coprod_comp1 Coprod_comp2
lemmas Coprod_form_conds [intro] = Coprod_form_cond1 Coprod_form_cond2
lemmas Coprod_comps [comp] = Coprod_comp1 Coprod_comp2


end