aboutsummaryrefslogtreecommitdiff
path: root/Sum.thy
blob: 2646c972ea5cc2f61c7c4ed534fc0191a4e5e39d (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
(*
Title:  Sum.thy
Author: Joshua Chen
Date:   2018

Dependent sum type
*)

theory Sum
imports HoTT_Base

begin


axiomatization
  Sum    :: "[t, tf] ⇒ t" and
  pair   :: "[t, t] ⇒ t"  ("(1<_,/ _>)") and
  indSum :: "[[t, t] ⇒ t, t] ⇒ t"  ("(1ind⇩∑)")

syntax
  "_sum" :: "[idt, t, t] ⇒ t"        ("(3∑_:_./ _)" 20)
  "_sum_ascii" :: "[idt, t, t] ⇒ t"  ("(3SUM _:_./ _)" 20)

translations
  "∑x:A. B"  "CONST Sum A (λx. B)"
  "SUM x:A. B"  "CONST Sum A (λx. B)"

abbreviation Pair :: "[t, t] ⇒ t"  (infixr "×" 50)
  where "A × B ≡ ∑_:A. B"

axiomatization where
 ‹Type rules›

  Sum_form: "⟦A: U i; B: A ⟶ U i⟧ ⟹ ∑x:A. B x: U i" and

  Sum_intro: "⟦B: A ⟶ U i; a: A; b: B a⟧ ⟹ <a,b>: ∑x:A. B x" and

  Sum_elim: "⟦
    p: ∑x:A. B x;
    C: ∑x:A. B x ⟶ U i;
    ⋀x y. ⟦x: A; y: B x⟧ ⟹ f x y: C <x,y> ⟧ ⟹ ind⇩∑ f p: C p" and

  Sum_comp: "⟦
    a: A;
    b: B a;
    B: A ⟶ U i;
    C: ∑x:A. B x ⟶ U i;
    ⋀x y. ⟦x: A; y: B(x)⟧ ⟹ f x y: C <x,y> ⟧ ⟹ ind⇩∑ f <a,b> ≡ f a b" and

 ‹Congruence rules›

  Sum_form_eq: "⟦A: U i; B: A ⟶ U i; C: A ⟶ U i; ⋀x. x: A ⟹ B x ≡ C x⟧ ⟹ ∑x:A. B x ≡ ∑x:A. C x"

lemmas Sum_form [form]
lemmas Sum_routine [intro] = Sum_form Sum_intro Sum_elim
lemmas Sum_comp [comp]


end