aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Chen2018-09-11 08:59:16 +0200
committerJosh Chen2018-09-11 08:59:16 +0200
commit9b17aac85aa650a7a9d6463d3d01f1eb228d4572 (patch)
tree48fd7cf1d921067e276f2d981ec20f133693baaa
parentbed5d559b62cf3f3acb75b28c2e192e274f46cc1 (diff)
Go back to higher-order application notation
-rw-r--r--Coprod.thy34
-rw-r--r--Empty.thy4
-rw-r--r--Equal.thy22
-rw-r--r--EqualProps.thy85
-rw-r--r--HoTT_Base.thy14
-rw-r--r--Nat.thy28
-rw-r--r--Prod.thy22
-rw-r--r--ProdProps.thy12
-rw-r--r--Proj.thy28
-rw-r--r--Sum.thy24
-rw-r--r--Unit.thy4
11 files changed, 138 insertions, 139 deletions
diff --git a/Coprod.thy b/Coprod.thy
index 4607d1d..b87958a 100644
--- a/Coprod.thy
+++ b/Coprod.thy
@@ -17,40 +17,40 @@ axiomatization
inr :: "Term \<Rightarrow> Term" and
indCoprod :: "[Term \<Rightarrow> Term, Term \<Rightarrow> Term, Term] \<Rightarrow> Term" ("(1ind\<^sub>+)")
where
- Coprod_form: "\<lbrakk>A: U(i); B: U(i)\<rbrakk> \<Longrightarrow> A + B: U(i)"
+ Coprod_form: "\<lbrakk>A: U i; B: U i\<rbrakk> \<Longrightarrow> A + B: U i"
and
- Coprod_intro_inl: "\<lbrakk>a: A; B: U(i)\<rbrakk> \<Longrightarrow> inl(a): A + B"
+ Coprod_intro_inl: "\<lbrakk>a: A; B: U i\<rbrakk> \<Longrightarrow> inl a: A + B"
and
- Coprod_intro_inr: "\<lbrakk>b: B; A: U(i)\<rbrakk> \<Longrightarrow> inr(b): A + B"
+ Coprod_intro_inr: "\<lbrakk>b: B; A: U i\<rbrakk> \<Longrightarrow> inr b: A + B"
and
Coprod_elim: "\<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));
+ 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);
u: A + B
- \<rbrakk> \<Longrightarrow> ind\<^sub>+(c)(d)(u) : C(u)"
+ \<rbrakk> \<Longrightarrow> ind\<^sub>+ c d u : C u"
and
Coprod_comp_inl: "\<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));
+ 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>+(c)(d)(inl(a)) \<equiv> c(a)"
+ \<rbrakk> \<Longrightarrow> ind\<^sub>+ c d (inl a) \<equiv> c a"
and
Coprod_comp_inr: "\<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));
+ 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>+(c)(d)(inr(b)) \<equiv> d(b)"
+ \<rbrakk> \<Longrightarrow> ind\<^sub>+ c d (inr b) \<equiv> d b"
text "Admissible formation inference rules:"
axiomatization where
- Coprod_wellform1: "A + B: U(i) \<Longrightarrow> A: U(i)"
+ Coprod_wellform1: "A + B: U i \<Longrightarrow> A: U i"
and
- Coprod_wellform2: "A + B: U(i) \<Longrightarrow> B: U(i)"
+ Coprod_wellform2: "A + B: U i \<Longrightarrow> B: U i"
text "Rule attribute declarations:"
diff --git a/Empty.thy b/Empty.thy
index 8f5cc8c..a42f7ff 100644
--- a/Empty.thy
+++ b/Empty.thy
@@ -17,9 +17,9 @@ axiomatization
Empty :: Term ("\<zero>") and
indEmpty :: "Term \<Rightarrow> Term" ("(1ind\<^sub>\<zero>)")
where
- Empty_form: "\<zero>: U(O)"
+ Empty_form: "\<zero>: U O"
and
- Empty_elim: "\<lbrakk>C: \<zero> \<longrightarrow> U(i); z: \<zero>\<rbrakk> \<Longrightarrow> ind\<^sub>\<zero>(z): C(z)"
+ Empty_elim: "\<lbrakk>C: \<zero> \<longrightarrow> U i; z: \<zero>\<rbrakk> \<Longrightarrow> ind\<^sub>\<zero> z: C z"
text "Rule attribute declarations:"
diff --git a/Equal.thy b/Equal.thy
index 772072a..7254104 100644
--- a/Equal.thy
+++ b/Equal.thy
@@ -27,33 +27,33 @@ translations
section \<open>Type rules\<close>
axiomatization where
- Equal_form: "\<lbrakk>A: U(i); a: A; b: A\<rbrakk> \<Longrightarrow> a =\<^sub>A b : U(i)"
+ Equal_form: "\<lbrakk>A: U i; a: A; b: A\<rbrakk> \<Longrightarrow> a =\<^sub>A b : U i"
and
- Equal_intro: "a : A \<Longrightarrow> refl(a): a =\<^sub>A a"
+ Equal_intro: "a : A \<Longrightarrow> (refl a): a =\<^sub>A a"
and
Equal_elim: "\<lbrakk>
x: A;
y: A;
p: x =\<^sub>A y;
- \<And>x. x: A \<Longrightarrow> f(x) : C(x)(x)(refl x);
- \<And>x y. \<lbrakk>x: A; y: A\<rbrakk> \<Longrightarrow> C(x)(y): x =\<^sub>A y \<longrightarrow> U(i)
- \<rbrakk> \<Longrightarrow> ind\<^sub>=(f)(p) : C(x)(y)(p)"
+ \<And>x. x: A \<Longrightarrow> f x: C x x (refl x);
+ \<And>x y. \<lbrakk>x: A; y: A\<rbrakk> \<Longrightarrow> C x y: x =\<^sub>A y \<longrightarrow> U i
+ \<rbrakk> \<Longrightarrow> ind\<^sub>= f p : C x y p"
and
Equal_comp: "\<lbrakk>
a: A;
- \<And>x. x: A \<Longrightarrow> f(x) : C(x)(x)(refl x);
- \<And>x y. \<lbrakk>x: A; y: A\<rbrakk> \<Longrightarrow> C(x)(y): x =\<^sub>A y \<longrightarrow> U(i)
- \<rbrakk> \<Longrightarrow> ind\<^sub>=(f)(refl(a)) \<equiv> f(a)"
+ \<And>x. x: A \<Longrightarrow> f x: C x x (refl x);
+ \<And>x y. \<lbrakk>x: A; y: A\<rbrakk> \<Longrightarrow> C x y: x =\<^sub>A y \<longrightarrow> U i
+ \<rbrakk> \<Longrightarrow> ind\<^sub>= f (refl a) \<equiv> f a"
text "Admissible inference rules for equality type formation:"
axiomatization where
- Equal_wellform1: "a =\<^sub>A b: U(i) \<Longrightarrow> A: U(i)"
+ Equal_wellform1: "a =\<^sub>A b: U i \<Longrightarrow> A: U i"
and
- Equal_wellform2: "a =\<^sub>A b: U(i) \<Longrightarrow> a: A"
+ Equal_wellform2: "a =\<^sub>A b: U i \<Longrightarrow> a: A"
and
- Equal_wellform3: "a =\<^sub>A b: U(i) \<Longrightarrow> b: A"
+ Equal_wellform3: "a =\<^sub>A b: U i \<Longrightarrow> b: A"
text "Rule attribute declarations:"
diff --git a/EqualProps.thy b/EqualProps.thy
index c114d37..708eb33 100644
--- a/EqualProps.thy
+++ b/EqualProps.thy
@@ -14,7 +14,7 @@ begin
section \<open>Symmetry / Path inverse\<close>
-definition inv :: "Term \<Rightarrow> Term" ("_\<inverse>" [1000] 1000) where "p\<inverse> \<equiv> ind\<^sub>= (\<lambda>x. refl(x)) p"
+definition inv :: "Term \<Rightarrow> Term" ("_\<inverse>" [1000] 1000) where "p\<inverse> \<equiv> ind\<^sub>= (\<lambda>x. (refl x)) p"
text "
In the proof below we begin by using path induction on \<open>p\<close> with the application of \<open>rule Equal_elim\<close>, telling Isabelle the specific substitutions to use.
@@ -22,7 +22,7 @@ text "
"
lemma inv_type:
- assumes "A : U(i)" and "x : A" and "y : A" and "p: x =\<^sub>A y" shows "p\<inverse>: y =\<^sub>A x"
+ assumes "A : U i" and "x : A" and "y : A" and "p: x =\<^sub>A y" shows "p\<inverse>: y =\<^sub>A x"
unfolding inv_def
by (rule Equal_elim[where ?x=x and ?y=y]) (routine lems: assms)
\<comment> \<open>The type doesn't depend on \<open>p\<close> so we don't need to specify \<open>?p\<close> in the \<open>where\<close> clause above.\<close>
@@ -33,7 +33,7 @@ text "
"
lemma inv_comp:
- assumes "A : U(i)" and "a : A" shows "(refl a)\<inverse> \<equiv> refl(a)"
+ assumes "A : U i " and "a : A" shows "(refl a)\<inverse> \<equiv> refl a"
unfolding inv_def
proof compute
show "\<And>x. x: A \<Longrightarrow> refl x: x =\<^sub>A x" ..
@@ -46,14 +46,14 @@ text "
Raw composition function, of type \<open>\<Prod>x:A. \<Prod>y:A. x =\<^sub>A y \<rightarrow> (\<Prod>z:A. y =\<^sub>A z \<rightarrow> x =\<^sub>A z)\<close> polymorphic over the type \<open>A\<close>.
"
-definition rpathcomp :: Term where "rpathcomp \<equiv> \<^bold>\<lambda>_ _ p. ind\<^sub>= (\<lambda>_. \<^bold>\<lambda>_ q. ind\<^sub>= (\<lambda>x. refl(x)) q) p"
+definition rpathcomp :: Term where "rpathcomp \<equiv> \<^bold>\<lambda>_ _ p. ind\<^sub>= (\<lambda>_. \<^bold>\<lambda>_ q. ind\<^sub>= (\<lambda>x. (refl x)) q) p"
text "
More complicated proofs---the nested path inductions require more explicit step-by-step rule applications:
"
lemma rpathcomp_type:
- assumes "A: U(i)"
+ assumes "A: U i"
shows "rpathcomp: \<Prod>x:A. \<Prod>y:A. x =\<^sub>A y \<rightarrow> (\<Prod>z:A. y =\<^sub>A z \<rightarrow> x =\<^sub>A z)"
unfolding rpathcomp_def
proof
@@ -81,7 +81,7 @@ proof
qed fact
corollary
- assumes "A: U(i)" "x: A" "y: A" "z: A" "p: x =\<^sub>A y" "q: y =\<^sub>A z"
+ assumes "A: U i" "x: A" "y: A" "z: A" "p: x =\<^sub>A y" "q: y =\<^sub>A z"
shows "rpathcomp`x`y`p`z`q: x =\<^sub>A z"
by (routine lems: assms rpathcomp_type)
@@ -90,11 +90,11 @@ text "
"
lemma rpathcomp_comp:
- assumes "A: U(i)" and "a: A"
- shows "rpathcomp`a`a`refl(a)`a`refl(a) \<equiv> refl(a)"
+ assumes "A: U i" and "a: A"
+ shows "rpathcomp`a`a`(refl a)`a`(refl a) \<equiv> refl a"
unfolding rpathcomp_def
proof compute
- { fix x assume 1: "x: A"
+ fix x assume 1: "x: A"
show "\<^bold>\<lambda>y p. ind\<^sub>= (\<lambda>_. \<^bold>\<lambda>z q. ind\<^sub>= refl q) p: \<Prod>y:A. x =\<^sub>A y \<rightarrow> (\<Prod>z:A. y =\<^sub>A z \<rightarrow> x =\<^sub>A z)"
proof
fix y assume 2: "y: A"
@@ -114,11 +114,11 @@ proof compute
qed (rule assms)
qed (routine lems: assms 1 2 3)
qed (routine lems: assms 1 2)
- qed (rule assms) }
+ qed (rule assms)
- show "(\<^bold>\<lambda>y p. ind\<^sub>= (\<lambda>_. \<^bold>\<lambda>z q. ind\<^sub>= refl q) p)`a`refl(a)`a`refl(a) \<equiv> refl(a)"
+ next show "(\<^bold>\<lambda>y p. ind\<^sub>= (\<lambda>_. \<^bold>\<lambda>z q. ind\<^sub>= refl q) p)`a`(refl a)`a`(refl a) \<equiv> refl a"
proof compute
- { fix y assume 1: "y: A"
+ fix y assume 1: "y: A"
show "\<^bold>\<lambda>p. ind\<^sub>= (\<lambda>_. \<^bold>\<lambda>z q. ind\<^sub>= refl q) p: a =\<^sub>A y \<rightarrow> (\<Prod>z:A. y =\<^sub>A z \<rightarrow> a =\<^sub>A z)"
proof
fix p assume 2: "p: a =\<^sub>A y"
@@ -135,11 +135,11 @@ proof compute
qed (routine lems: assms 3 4)
qed fact
qed (routine lems: assms 1 2)
- qed (routine lems: assms 1) }
+ qed (routine lems: assms 1)
- show "(\<^bold>\<lambda>p. ind\<^sub>= (\<lambda>_. \<^bold>\<lambda>z. \<^bold>\<lambda>q. ind\<^sub>= refl q) p)`refl(a)`a`refl(a) \<equiv> refl(a)"
+ next show "(\<^bold>\<lambda>p. ind\<^sub>= (\<lambda>_. \<^bold>\<lambda>z. \<^bold>\<lambda>q. ind\<^sub>= refl q) p)`(refl a)`a`(refl a) \<equiv> refl a"
proof compute
- { fix p assume 1: "p: a =\<^sub>A a"
+ fix p assume 1: "p: a =\<^sub>A a"
show "ind\<^sub>= (\<lambda>_. \<^bold>\<lambda>z q. ind\<^sub>= refl q) p: \<Prod>z:A. a =\<^sub>A z \<rightarrow> a =\<^sub>A z"
proof (rule Equal_elim[where ?x=a and ?y=a])
fix u assume 2: "u: A"
@@ -152,11 +152,11 @@ proof compute
by (rule Equal_elim[where ?x=u and ?y=z]) (routine lems: assms 2 3)
qed (routine lems: assms 2 3)
qed fact
- qed (routine lems: assms 1) }
+ qed (routine lems: assms 1)
- show "(ind\<^sub>=(\<lambda>_. \<^bold>\<lambda>z q. ind\<^sub>= refl q)(refl(a)))`a`refl(a) \<equiv> refl(a)"
+ next show "(ind\<^sub>=(\<lambda>_. \<^bold>\<lambda>z q. ind\<^sub>= refl q)(refl a))`a`(refl a) \<equiv> refl a"
proof compute
- { fix u assume 1: "u: A"
+ fix u assume 1: "u: A"
show "\<^bold>\<lambda>z q. ind\<^sub>= refl q: \<Prod>z:A. u =\<^sub>A z \<rightarrow> u =\<^sub>A z"
proof
fix z assume 2: "z: A"
@@ -165,22 +165,22 @@ proof compute
show "\<And>q. q: u =\<^sub>A z \<Longrightarrow> ind\<^sub>= refl q: u =\<^sub>A z"
by (rule Equal_elim[where ?x=u and ?y=z]) (routine lems: assms 1 2)
qed (routine lems: assms 1 2)
- qed fact }
+ qed fact
- show "(\<^bold>\<lambda>z q. ind\<^sub>= refl q)`a`refl(a) \<equiv> refl(a)"
+ next show "(\<^bold>\<lambda>z q. ind\<^sub>= refl q)`a`(refl a) \<equiv> refl a"
proof compute
- { fix a assume 1: "a: A"
+ fix a assume 1: "a: A"
show "\<^bold>\<lambda>q. ind\<^sub>= refl q: a =\<^sub>A a \<rightarrow> a =\<^sub>A a"
proof
show "\<And>q. q: a =\<^sub>A a \<Longrightarrow> ind\<^sub>= refl q: a =\<^sub>A a"
by (rule Equal_elim[where ?x=a and ?y=a]) (routine lems: assms 1)
- qed (routine lems: assms 1) }
+ qed (routine lems: assms 1)
- show "(\<^bold>\<lambda>q. ind\<^sub>= refl q)`refl(a) \<equiv> refl(a)"
+ next show "(\<^bold>\<lambda>q. ind\<^sub>= refl q)`(refl a) \<equiv> refl a"
proof compute
show "\<And>p. p: a =\<^sub>A a \<Longrightarrow> ind\<^sub>= refl p: a =\<^sub>A a"
by (rule Equal_elim[where ?x=a and ?y=a]) (routine lems: assms)
- show "ind\<^sub>= refl (refl(a)) \<equiv> refl(a)"
+ show "ind\<^sub>= refl (refl a) \<equiv> refl a"
proof compute
show "\<And>x. x: A \<Longrightarrow> refl(x): x =\<^sub>A x" ..
qed (routine lems: assms)
@@ -196,23 +196,23 @@ text "The raw object lambda term is cumbersome to use, so we define a simpler co
axiomatization pathcomp :: "[Term, Term] \<Rightarrow> Term" (infixl "\<bullet>" 120) where
pathcomp_def: "\<lbrakk>
- A: U(i);
+ A: U i;
x: A; y: A; z: A;
p: x =\<^sub>A y; q: y =\<^sub>A z
\<rbrakk> \<Longrightarrow> p \<bullet> q \<equiv> rpathcomp`x`y`p`z`q"
lemma pathcomp_type:
- assumes "A: U(i)" "x: A" "y: A" "z: A" "p: x =\<^sub>A y" "q: y =\<^sub>A z"
+ assumes "A: U i" "x: A" "y: A" "z: A" "p: x =\<^sub>A y" "q: y =\<^sub>A z"
shows "p \<bullet> q: x =\<^sub>A z"
proof (subst pathcomp_def)
- show "A: U(i)" "x: A" "y: A" "z: A" "p: x =\<^sub>A y" "q: y =\<^sub>A z" by fact+
+ show "A: U i" "x: A" "y: A" "z: A" "p: x =\<^sub>A y" "q: y =\<^sub>A z" by fact+
qed (routine lems: assms rpathcomp_type)
lemma pathcomp_comp:
- assumes "A : U(i)" and "a : A" shows "refl(a) \<bullet> refl(a) \<equiv> refl(a)"
+ assumes "A : U i" and "a : A" shows "(refl a) \<bullet> (refl a) \<equiv> refl a"
by (subst pathcomp_def) (routine lems: assms rpathcomp_comp)
@@ -223,44 +223,45 @@ lemmas EqualProps_comp [comp] = inv_comp pathcomp_comp
section \<open>Higher groupoid structure of types\<close>
lemma
- assumes "A: U(i)" "x: A" "y: A" "p: x =\<^sub>A y"
+ assumes "A: U i" "x: A" "y: A" "p: x =\<^sub>A y"
shows
- "ind\<^sub>= (\<lambda>u. refl (refl u)) p: p =[x =\<^sub>A y] p \<bullet> refl(y)" and
- "ind\<^sub>= (\<lambda>u. refl (refl u)) p: p =[x =\<^sub>A y] refl(x) \<bullet> p"
+ "ind\<^sub>= (\<lambda>u. refl (refl u)) p: p =[x =\<^sub>A y] p \<bullet> (refl y)" and
+ "ind\<^sub>= (\<lambda>u. refl (refl u)) p: p =[x =\<^sub>A y] (refl x) \<bullet> p"
proof -
- show "ind\<^sub>= (\<lambda>u. refl (refl u)) p: p =[x =[A] y] p \<bullet> refl(y)"
+ show "ind\<^sub>= (\<lambda>u. refl (refl u)) p: p =[x =[A] y] p \<bullet> (refl y)"
by (rule Equal_elim[where ?p=p and ?x=x and ?y=y]) (derive lems: assms)+
- show "ind\<^sub>= (\<lambda>u. refl (refl u)) p: p =[x =[A] y] refl x \<bullet> p"
+ show "ind\<^sub>= (\<lambda>u. refl (refl u)) p: p =[x =[A] y] (refl x) \<bullet> p"
by (rule Equal_elim[where ?p=p and ?x=x and ?y=y]) (derive lems: assms)+
qed
lemma
- assumes "A: U(i)" "x: A" "y: A" "p: x =\<^sub>A y"
+ assumes "A: U i" "x: A" "y: A" "p: x =\<^sub>A y"
shows
- "ind\<^sub>= (\<lambda>u. refl (refl u)) p: p\<inverse> \<bullet> p =[y =\<^sub>A y] refl(y)" and
- "ind\<^sub>= (\<lambda>u. refl (refl u)) p: p \<bullet> p\<inverse> =[x =\<^sub>A x] refl(x)"
+ "ind\<^sub>= (\<lambda>u. refl (refl u)) p: p\<inverse> \<bullet> p =[y =\<^sub>A y] (refl y)" and
+ "ind\<^sub>= (\<lambda>u. refl (refl u)) p: p \<bullet> p\<inverse> =[x =\<^sub>A x] (refl x)"
proof -
- show "ind\<^sub>= (\<lambda>u. refl (refl u)) p: p\<inverse> \<bullet> p =[y =\<^sub>A y] refl(y)"
+ show "ind\<^sub>= (\<lambda>u. refl (refl u)) p: p\<inverse> \<bullet> p =[y =\<^sub>A y] (refl y)"
by (rule Equal_elim[where ?p=p and ?x=x and ?y=y]) (derive lems: assms)+
- show "ind\<^sub>= (\<lambda>u. refl (refl u)) p: p \<bullet> p\<inverse> =[x =\<^sub>A x] refl(x)"
+ show "ind\<^sub>= (\<lambda>u. refl (refl u)) p: p \<bullet> p\<inverse> =[x =\<^sub>A x] (refl x)"
by (rule Equal_elim[where ?p=p and ?x=x and ?y=y]) (derive lems: assms)+
qed
lemma
- assumes "A: U(i)" "x: A" "y: A" "p: x =\<^sub>A y"
+ assumes "A: U i" "x: A" "y: A" "p: x =\<^sub>A y"
shows "ind\<^sub>= (\<lambda>u. refl (refl u)) p: p\<inverse>\<inverse> =[x =\<^sub>A y] p"
by (rule Equal_elim[where ?p=p and ?x=x and ?y=y]) (derive lems: assms)
+text "Next we construct a proof term of associativity of path composition."
schematic_goal
assumes
- "A: U(i)"
+ "A: U i"
"x: A" "y: A" "z: A" "w: A"
"p: x =\<^sub>A y" "q: y =\<^sub>A z" "r: z =\<^sub>A w"
shows
@@ -268,8 +269,8 @@ schematic_goal
apply (rule Equal_elim[where ?p=p and ?x=x and ?y=y])
apply (rule assms)+
-apply (subst pathcomp_comp)
-
+\<comment> \<open>Continue by substituting \<open>refl x \<bullet> q = q\<close> etc.\<close>
+sorry
end
diff --git a/HoTT_Base.thy b/HoTT_Base.thy
index 4e1a9be..a5b88fd 100644
--- a/HoTT_Base.thy
+++ b/HoTT_Base.thy
@@ -16,8 +16,6 @@ text "Meta syntactic type for object-logic types and terms."
typedecl Term
-section \<open>Judgments\<close>
-
text "
Formalize the typing judgment \<open>a: A\<close>.
For judgmental/definitional equality we use the existing Pure equality \<open>\<equiv>\<close> and hence do not need to define a separate judgment for it.
@@ -38,13 +36,13 @@ axiomatization
lt :: "[Ord, Ord] \<Rightarrow> prop" (infix "<" 999) and
leq :: "[Ord, Ord] \<Rightarrow> prop" (infix "\<le>" 999)
where
- Ord_lt_min: "\<And>n. O < S(n)"
+ Ord_lt_min: "\<And>n. O < S n"
and
- Ord_lt_monotone: "\<And>m n. m < n \<Longrightarrow> S(m) < S(n)"
+ Ord_lt_monotone: "\<And>m n. m < n \<Longrightarrow> S m < S n"
and
Ord_leq_min: "\<And>n. O \<le> n"
and
- Ord_leq_monotone: "\<And>m n. m \<le> n \<Longrightarrow> S(m) \<le> S(n)"
+ Ord_leq_monotone: "\<And>m n. m \<le> n \<Longrightarrow> S m \<le> S n"
lemmas Ord_rules [intro] = Ord_lt_min Ord_lt_monotone Ord_leq_min Ord_leq_monotone
\<comment> \<open>Enables \<open>standard\<close> to automatically solve inequalities.\<close>
@@ -54,9 +52,9 @@ text "Define the universe types."
axiomatization
U :: "Ord \<Rightarrow> Term"
where
- U_hierarchy: "\<And>i j. i < j \<Longrightarrow> U(i): U(j)"
+ U_hierarchy: "\<And>i j. i < j \<Longrightarrow> U i: U j"
and
- U_cumulative: "\<And>A i j. \<lbrakk>A: U(i); i \<le> j\<rbrakk> \<Longrightarrow> A: U(j)"
+ U_cumulative: "\<And>A i j. \<lbrakk>A: U i; i \<le> j\<rbrakk> \<Longrightarrow> A: U j"
text "
The rule \<open>U_cumulative\<close> is very unsafe: if used as-is it will usually lead to an infinite rewrite loop!
@@ -71,7 +69,7 @@ text "
"
abbreviation (input) constrained :: "[Term \<Rightarrow> Term, Term, Term] \<Rightarrow> prop" ("(1_: _ \<longrightarrow> _)")
- where "f: A \<longrightarrow> B \<equiv> (\<And>x. x : A \<Longrightarrow> f(x): B)"
+ where "f: A \<longrightarrow> B \<equiv> (\<And>x. x : A \<Longrightarrow> f x: B)"
text "
The above is used to define type families, which are constrained meta-lambdas \<open>P: A \<longrightarrow> B\<close> where \<open>A\<close> and \<open>B\<close> are small types.
diff --git a/Nat.thy b/Nat.thy
index 45c3a2e..e879c92 100644
--- a/Nat.thy
+++ b/Nat.thy
@@ -17,31 +17,31 @@ axiomatization
succ :: "Term \<Rightarrow> Term" and
indNat :: "[[Term, Term] \<Rightarrow> Term, Term, Term] \<Rightarrow> Term" ("(1ind\<^sub>\<nat>)")
where
- Nat_form: "\<nat>: U(O)"
+ Nat_form: "\<nat>: U O"
and
Nat_intro_0: "0: \<nat>"
and
- Nat_intro_succ: "n: \<nat> \<Longrightarrow> succ(n): \<nat>"
+ Nat_intro_succ: "n: \<nat> \<Longrightarrow> succ n: \<nat>"
and
Nat_elim: "\<lbrakk>
- C: \<nat> \<longrightarrow> U(i);
- \<And>n c. \<lbrakk>n: \<nat>; c: C(n)\<rbrakk> \<Longrightarrow> f(n)(c): C(succ n);
- a: C(0);
+ C: \<nat> \<longrightarrow> U i;
+ \<And>n c. \<lbrakk>n: \<nat>; c: C n\<rbrakk> \<Longrightarrow> f n c: C (succ n);
+ a: C 0;
n: \<nat>
- \<rbrakk> \<Longrightarrow> ind\<^sub>\<nat>(f)(a)(n): C(n)"
+ \<rbrakk> \<Longrightarrow> ind\<^sub>\<nat> f a n: C n"
and
Nat_comp_0: "\<lbrakk>
- C: \<nat> \<longrightarrow> U(i);
- \<And>n c. \<lbrakk>n: \<nat>; c: C(n)\<rbrakk> \<Longrightarrow> f(n)(c): C(succ n);
- a: C(0)
- \<rbrakk> \<Longrightarrow> ind\<^sub>\<nat>(f)(a)(0) \<equiv> a"
+ C: \<nat> \<longrightarrow> U i;
+ \<And>n c. \<lbrakk>n: \<nat>; c: C(n)\<rbrakk> \<Longrightarrow> f n c: C (succ n);
+ a: C 0
+ \<rbrakk> \<Longrightarrow> ind\<^sub>\<nat> f a 0 \<equiv> a"
and
Nat_comp_succ: "\<lbrakk>
- C: \<nat> \<longrightarrow> U(i);
- \<And>n c. \<lbrakk>n: \<nat>; c: C(n)\<rbrakk> \<Longrightarrow> f(n)(c): C(succ n);
- a: C(0);
+ C: \<nat> \<longrightarrow> U i;
+ \<And>n c. \<lbrakk>n: \<nat>; c: C n\<rbrakk> \<Longrightarrow> f n c: C (succ n);
+ a: C 0;
n: \<nat>
- \<rbrakk> \<Longrightarrow> ind\<^sub>\<nat>(f)(a)(succ n) \<equiv> f(n)(ind\<^sub>\<nat> f a n)"
+ \<rbrakk> \<Longrightarrow> ind\<^sub>\<nat> f a (succ n) \<equiv> f n (ind\<^sub>\<nat> f a n)"
text "Rule attribute declarations:"
diff --git a/Prod.thy b/Prod.thy
index b0408b9..35d6b07 100644
--- a/Prod.thy
+++ b/Prod.thy
@@ -36,17 +36,17 @@ abbreviation Function :: "[Term, Term] \<Rightarrow> Term" (infixr "\<rightarro
section \<open>Type rules\<close>
axiomatization where
- Prod_form: "\<lbrakk>A: U(i); B: A \<longrightarrow> U(i)\<rbrakk> \<Longrightarrow> \<Prod>x:A. B(x): U(i)"
+ Prod_form: "\<lbrakk>A: U i; B: A \<longrightarrow> U i\<rbrakk> \<Longrightarrow> \<Prod>x:A. B x: U i"
and
- Prod_intro: "\<lbrakk>\<And>x. x: A \<Longrightarrow> b(x): B(x); A: U(i)\<rbrakk> \<Longrightarrow> \<^bold>\<lambda>x. b(x): \<Prod>x:A. B(x)"
+ Prod_intro: "\<lbrakk>\<And>x. x: A \<Longrightarrow> b x: B x; A: U i\<rbrakk> \<Longrightarrow> \<^bold>\<lambda>x. b x: \<Prod>x:A. B x"
and
- Prod_elim: "\<lbrakk>f: \<Prod>x:A. B(x); a: A\<rbrakk> \<Longrightarrow> f`a: B(a)"
+ Prod_elim: "\<lbrakk>f: \<Prod>x:A. B x; a: A\<rbrakk> \<Longrightarrow> f`a: B a"
and
- Prod_appl: "\<lbrakk>\<And>x. x: A \<Longrightarrow> b(x): B(x); a: A\<rbrakk> \<Longrightarrow> (\<^bold>\<lambda>x. b(x))`a \<equiv> b(a)"
+ Prod_appl: "\<lbrakk>\<And>x. x: A \<Longrightarrow> b x: B x; a: A\<rbrakk> \<Longrightarrow> (\<^bold>\<lambda>x. b x)`a \<equiv> b a"
and
- Prod_uniq: "f : \<Prod>x:A. B(x) \<Longrightarrow> \<^bold>\<lambda>x. (f`x) \<equiv> f"
+ Prod_uniq: "f : \<Prod>x:A. B x \<Longrightarrow> \<^bold>\<lambda>x. (f`x) \<equiv> f"
and
- Prod_eq: "\<lbrakk>\<And>x. x: A \<Longrightarrow> b(x) \<equiv> b'(x); A: U(i)\<rbrakk> \<Longrightarrow> \<^bold>\<lambda>x. b(x) \<equiv> \<^bold>\<lambda>x. b'(x)"
+ Prod_eq: "\<lbrakk>\<And>x. x: A \<Longrightarrow> b x \<equiv> c x; A: U i\<rbrakk> \<Longrightarrow> \<^bold>\<lambda>x. b x \<equiv> \<^bold>\<lambda>x. c x"
text "
The Pure rules for \<open>\<equiv>\<close> only let us judge strict syntactic equality of object lambda expressions; Prod_eq is the actual definitional equality rule.
@@ -55,15 +55,15 @@ text "
"
text "
- In addition to the usual type rules, it is a meta-theorem that whenever \<open>\<Prod>x:A. B x: U(i)\<close> is derivable from some set of premises \<Gamma>, then so are \<open>A: U(i)\<close> and \<open>B: A \<longrightarrow> U(i)\<close>.
+ In addition to the usual type rules, it is a meta-theorem that whenever \<open>\<Prod>x:A. B x: U i\<close> is derivable from some set of premises \<Gamma>, then so are \<open>A: U i\<close> and \<open>B: A \<longrightarrow> U i\<close>.
That is to say, the following inference rules are admissible, and it simplifies proofs greatly to axiomatize them directly.
"
axiomatization where
- Prod_wellform1: "(\<Prod>x:A. B(x): U(i)) \<Longrightarrow> A: U(i)"
+ Prod_wellform1: "(\<Prod>x:A. B x: U i) \<Longrightarrow> A: U i"
and
- Prod_wellform2: "(\<Prod>x:A. B(x): U(i)) \<Longrightarrow> B: A \<longrightarrow> U(i)"
+ Prod_wellform2: "(\<Prod>x:A. B x: U i) \<Longrightarrow> B: A \<longrightarrow> U i"
text "Rule attribute declarations---set up various methods to use the type rules."
@@ -75,9 +75,9 @@ lemmas Prod_routine [intro] = Prod_form Prod_intro Prod_elim
section \<open>Function composition\<close>
-definition compose :: "[Term, Term] \<Rightarrow> Term" (infixr "o" 70) where "g o f \<equiv> \<^bold>\<lambda>x. g`(f`x)"
+definition compose :: "[Term, Term] \<Rightarrow> Term" (infixr "o" 110) where "g o f \<equiv> \<^bold>\<lambda>x. g`(f`x)"
-syntax "_COMPOSE" :: "[Term, Term] \<Rightarrow> Term" (infixr "\<circ>" 70)
+syntax "_COMPOSE" :: "[Term, Term] \<Rightarrow> Term" (infixr "\<circ>" 110)
translations "g \<circ> f" \<rightleftharpoons> "g o f"
diff --git a/ProdProps.thy b/ProdProps.thy
index 1af6ad3..14556af 100644
--- a/ProdProps.thy
+++ b/ProdProps.thy
@@ -18,7 +18,7 @@ text "
"
lemma compose_assoc:
- assumes "A: U(i)" and "f: A \<rightarrow> B" "g: B \<rightarrow> C" "h: \<Prod>x:C. D(x)"
+ assumes "A: U i" and "f: A \<rightarrow> B" "g: B \<rightarrow> C" "h: \<Prod>x:C. D x"
shows "(h \<circ> g) \<circ> f \<equiv> h \<circ> (g \<circ> f)"
proof (subst (0 1 2 3) compose_def)
show "\<^bold>\<lambda>x. (\<^bold>\<lambda>y. h`(g`y))`(f`x) \<equiv> \<^bold>\<lambda>x. h`((\<^bold>\<lambda>y. g`(f`y))`x)"
@@ -31,19 +31,19 @@ proof (subst (0 1 2 3) compose_def)
proof compute
show "\<And>x. x: A \<Longrightarrow> g`(f`x): C" by (routine lems: assms)
qed
- show "\<And>x. x: B \<Longrightarrow> h`(g`x): D(g`x)" by (routine lems: assms)
+ show "\<And>x. x: B \<Longrightarrow> h`(g`x): D (g`x)" by (routine lems: assms)
qed (routine lems: assms)
qed fact
qed
lemma compose_comp:
- assumes "A: U(i)" and "\<And>x. x: A \<Longrightarrow> b(x): B" and "\<And>x. x: B \<Longrightarrow> c(x): C(x)"
- shows "(\<^bold>\<lambda>x. c(x)) \<circ> (\<^bold>\<lambda>x. b(x)) \<equiv> \<^bold>\<lambda>x. c(b(x))"
+ assumes "A: U i" and "\<And>x. x: A \<Longrightarrow> b x: B" and "\<And>x. x: B \<Longrightarrow> c x: C x"
+ shows "(\<^bold>\<lambda>x. c x) \<circ> (\<^bold>\<lambda>x. b x) \<equiv> \<^bold>\<lambda>x. c (b x)"
proof (subst compose_def, subst Prod_eq)
- show "\<And>a. a: A \<Longrightarrow> (\<^bold>\<lambda>x. c(x))`((\<^bold>\<lambda>x. b(x))`a) \<equiv> (\<^bold>\<lambda>x. c (b x))`a"
+ show "\<And>a. a: A \<Longrightarrow> (\<^bold>\<lambda>x. c x)`((\<^bold>\<lambda>x. b x)`a) \<equiv> (\<^bold>\<lambda>x. c (b x))`a"
proof compute
- show "\<And>a. a: A \<Longrightarrow> c((\<^bold>\<lambda>x. b(x))`a) \<equiv> (\<^bold>\<lambda>x. c(b(x)))`a"
+ show "\<And>a. a: A \<Longrightarrow> c ((\<^bold>\<lambda>x. b x)`a) \<equiv> (\<^bold>\<lambda>x. c (b x))`a"
by (derive lems: assms)
qed (routine lems: assms)
qed (derive lems: assms)
diff --git a/Proj.thy b/Proj.thy
index a1c4c8f..74c561c 100644
--- a/Proj.thy
+++ b/Proj.thy
@@ -12,44 +12,44 @@ theory Proj
begin
-definition fst :: "Term \<Rightarrow> Term" where "fst(p) \<equiv> ind\<^sub>\<Sum> (\<lambda>x y. x) p"
-definition snd :: "Term \<Rightarrow> Term" where "snd(p) \<equiv> ind\<^sub>\<Sum> (\<lambda>x y. y) p"
+definition fst :: "Term \<Rightarrow> Term" where "fst p \<equiv> ind\<^sub>\<Sum> (\<lambda>x y. x) p"
+definition snd :: "Term \<Rightarrow> Term" where "snd p \<equiv> ind\<^sub>\<Sum> (\<lambda>x y. y) p"
text "Typing judgments and computation rules for the dependent and non-dependent projection functions."
lemma fst_type:
- assumes "\<Sum>x:A. B(x): U(i)" and "p: \<Sum>x:A. B(x)" shows "fst(p): A"
+ assumes "\<Sum>x:A. B x: U i" and "p: \<Sum>x:A. B x" shows "fst p: A"
unfolding fst_def by (derive lems: assms)
lemma fst_comp:
- assumes "A: U(i)" and "B: A \<longrightarrow> U(i)" and "a: A" and "b: B(a)" shows "fst(<a,b>) \<equiv> a"
+ assumes "A: U i" and "B: A \<longrightarrow> U i" and "a: A" and "b: B a" shows "fst <a,b> \<equiv> a"
unfolding fst_def
proof compute
- show "a: A" and "b: B(a)" by fact+
+ show "a: A" and "b: B a" by fact+
qed (routine lems: assms)+
lemma snd_type:
- assumes "\<Sum>x:A. B(x): U(i)" and "p: \<Sum>x:A. B(x)" shows "snd(p): B(fst p)"
+ assumes "\<Sum>x:A. B x: U i" and "p: \<Sum>x:A. B x" shows "snd p: B (fst p)"
unfolding snd_def
proof
- show "\<And>p. p: \<Sum>x:A. B(x) \<Longrightarrow> B(fst p): U(i)" by (derive lems: assms fst_type)
+ show "\<And>p. p: \<Sum>x:A. B x \<Longrightarrow> B (fst p): U i" by (derive lems: assms fst_type)
fix x y
- assume asm: "x: A" "y: B(x)"
- show "y: B(fst <x,y>)"
+ assume asm: "x: A" "y: B x"
+ show "y: B (fst <x,y>)"
proof (subst fst_comp)
- show "A: U(i)" by (wellformed lems: assms(1))
- show "\<And>x. x: A \<Longrightarrow> B(x): U(i)" by (wellformed lems: assms(1))
+ show "A: U i" by (wellformed lems: assms(1))
+ show "\<And>x. x: A \<Longrightarrow> B x: U i" by (wellformed lems: assms(1))
qed fact+
qed fact
lemma snd_comp:
- assumes "A: U(i)" and "B: A \<longrightarrow> U(i)" and "a: A" and "b: B(a)" shows "snd(<a,b>) \<equiv> b"
+ assumes "A: U i" and "B: A \<longrightarrow> U i" and "a: A" and "b: B a" shows "snd <a,b> \<equiv> b"
unfolding snd_def
proof compute
- show "\<And>x y. y: B(x) \<Longrightarrow> y: B(x)" .
+ show "\<And>x y. y: B x \<Longrightarrow> y: B x" .
show "a: A" by fact
- show "b: B(a)" by fact
+ show "b: B a" by fact
qed (routine lems: assms)
diff --git a/Sum.thy b/Sum.thy
index 8d0b0e6..6de20fd 100644
--- a/Sum.thy
+++ b/Sum.thy
@@ -33,30 +33,30 @@ abbreviation Pair :: "[Term, Term] \<Rightarrow> Term" (infixr "\<times>" 50)
section \<open>Type rules\<close>
axiomatization where
- Sum_form: "\<lbrakk>A: U(i); B: A \<longrightarrow> U(i)\<rbrakk> \<Longrightarrow> \<Sum>x:A. B(x): U(i)"
+ Sum_form: "\<lbrakk>A: U i; B: A \<longrightarrow> U i\<rbrakk> \<Longrightarrow> \<Sum>x:A. B x: U i"
and
- Sum_intro: "\<lbrakk>B: A \<longrightarrow> U(i); a: A; b: B(a)\<rbrakk> \<Longrightarrow> <a,b>: \<Sum>x:A. B(x)"
+ Sum_intro: "\<lbrakk>B: A \<longrightarrow> U i; a: A; b: B a\<rbrakk> \<Longrightarrow> <a,b>: \<Sum>x:A. B x"
and
Sum_elim: "\<lbrakk>
- p: \<Sum>x:A. B(x);
- \<And>x y. \<lbrakk>x: A; y: B(x)\<rbrakk> \<Longrightarrow> f(x)(y): C(<x,y>);
- C: \<Sum>x:A. B(x) \<longrightarrow> U(i)
- \<rbrakk> \<Longrightarrow> ind\<^sub>\<Sum>(f)(p): C(p)" (* What does writing \<lambda>x y. f(x, y) change? *)
+ p: \<Sum>x:A. B x;
+ \<And>x y. \<lbrakk>x: A; y: B x\<rbrakk> \<Longrightarrow> f x y: C <x,y>;
+ C: \<Sum>x:A. B x \<longrightarrow> U i
+ \<rbrakk> \<Longrightarrow> ind\<^sub>\<Sum> f p: C p" (* What does writing \<lambda>x y. f(x, y) change? *)
and
Sum_comp: "\<lbrakk>
a: A;
- b: B(a);
- \<And>x y. \<lbrakk>x: A; y: B(x)\<rbrakk> \<Longrightarrow> f(x)(y): C(<x,y>);
+ b: B a;
+ \<And>x y. \<lbrakk>x: A; y: B(x)\<rbrakk> \<Longrightarrow> f x y: C <x,y>;
B: A \<longrightarrow> U(i);
- C: \<Sum>x:A. B(x) \<longrightarrow> U(i)
- \<rbrakk> \<Longrightarrow> ind\<^sub>\<Sum>(f)(<a,b>) \<equiv> f(a)(b)"
+ C: \<Sum>x:A. B x \<longrightarrow> U i
+ \<rbrakk> \<Longrightarrow> ind\<^sub>\<Sum> f <a,b> \<equiv> f a b"
text "Admissible inference rules for sum formation:"
axiomatization where
- Sum_wellform1: "(\<Sum>x:A. B(x): U(i)) \<Longrightarrow> A: U(i)"
+ Sum_wellform1: "(\<Sum>x:A. B x: U i) \<Longrightarrow> A: U i"
and
- Sum_wellform2: "(\<Sum>x:A. B(x): U(i)) \<Longrightarrow> B: A \<longrightarrow> U(i)"
+ Sum_wellform2: "(\<Sum>x:A. B x: U i) \<Longrightarrow> B: A \<longrightarrow> U i"
text "Rule attribute declarations:"
diff --git a/Unit.thy b/Unit.thy
index 6adfb02..9b86739 100644
--- a/Unit.thy
+++ b/Unit.thy
@@ -20,9 +20,9 @@ where
and
Unit_intro: "\<star>: \<one>"
and
- Unit_elim: "\<lbrakk>C: \<one> \<longrightarrow> U(i); c: C(\<star>); a: \<one>\<rbrakk> \<Longrightarrow> ind\<^sub>\<one>(c)(a) : C(a)"
+ Unit_elim: "\<lbrakk>C: \<one> \<longrightarrow> U i; c: C \<star>; a: \<one>\<rbrakk> \<Longrightarrow> ind\<^sub>\<one> c a: C a"
and
- Unit_comp: "\<lbrakk>C: \<one> \<longrightarrow> U(i); c: C(\<star>)\<rbrakk> \<Longrightarrow> ind\<^sub>\<one>(c)(\<star>) \<equiv> c"
+ Unit_comp: "\<lbrakk>C: \<one> \<longrightarrow> U i; c: C \<star>\<rbrakk> \<Longrightarrow> ind\<^sub>\<one> c \<star> \<equiv> c"
text "Rule attribute declarations:"