aboutsummaryrefslogtreecommitdiff
path: root/Equal.thy
blob: 7254104bcec06bc0e7e5100204c6d7f55f6c2af3 (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
62
63
64
65
66
(*  Title:  HoTT/Equal.thy
    Author: Josh Chen

Equality type
*)

theory Equal
  imports HoTT_Base
begin


section ‹Constants and syntax›

axiomatization
  Equal :: "[Term, Term, Term] ⇒ Term" and
  refl :: "Term ⇒ Term" and
  indEqual :: "[Term ⇒ Term, Term] ⇒ Term"  ("(1ind⇩=)")

syntax
  "_EQUAL" :: "[Term, Term, Term] ⇒ Term"        ("(3_ =⇩_/ _)" [101, 0, 101] 100)
  "_EQUAL_ASCII" :: "[Term, Term, Term] ⇒ Term"  ("(3_ =[_]/ _)" [101, 0, 101] 100)
translations
  "a =[A] b"  "CONST Equal A a b"
  "a =⇩A b"  "CONST Equal A a b"


section ‹Type rules›

axiomatization where
  Equal_form: "⟦A: U i; a: A; b: A⟧ ⟹ a =⇩A b : U i"
and
  Equal_intro: "a : A ⟹ (refl a): a =⇩A a"
and
  Equal_elim: "⟦
    x: A;
    y: A;
    p: x =⇩A y;
    ⋀x. x: A ⟹ f x: C x x (refl x);
    ⋀x y. ⟦x: A; y: A⟧ ⟹ C x y: x =⇩A y ⟶ U i
    ⟧ ⟹ ind⇩= f p : C x y p"
and
  Equal_comp: "⟦
    a: A;
    ⋀x. x: A ⟹ f x: C x x (refl x);
    ⋀x y. ⟦x: A; y: A⟧ ⟹ C x y: x =⇩A y ⟶ U i
    ⟧ ⟹ ind⇩= f (refl a) ≡ f a"


text "Admissible inference rules for equality type formation:"

axiomatization where
  Equal_wellform1: "a =⇩A b: U i ⟹ A: U i"
and
  Equal_wellform2: "a =⇩A b: U i ⟹ a: A"
and
  Equal_wellform3: "a =⇩A b: U i ⟹ b: A"


text "Rule attribute declarations:"

lemmas Equal_comp [comp]
lemmas Equal_wellform [wellform] = Equal_wellform1 Equal_wellform2 Equal_wellform3
lemmas Equal_routine [intro] = Equal_form Equal_intro Equal_elim


end