aboutsummaryrefslogtreecommitdiff
path: root/Projections.thy
diff options
context:
space:
mode:
authorJosh Chen2019-03-06 11:42:19 +0100
committerJosh Chen2019-03-06 11:42:19 +0100
commit8f7164976d08446e77a0e1eceaaa01f0ed363e5b (patch)
tree6cbf9e5963e0273e75b12436cf5b3adc2c30b05c /Projections.thy
parentfa4c19c5ddce4d1f2d5ad58170e89cb74cb7f7e1 (diff)
Make functions object-level
Diffstat (limited to 'Projections.thy')
-rw-r--r--Projections.thy40
1 files changed, 19 insertions, 21 deletions
diff --git a/Projections.thy b/Projections.thy
index 1473e08..9eeb57f 100644
--- a/Projections.thy
+++ b/Projections.thy
@@ -11,35 +11,33 @@ imports HoTT_Methods Prod Sum
begin
-definition fst :: "[t, t] \<Rightarrow> t" where "fst A p \<equiv> indSum (\<lambda>_. A) (\<lambda>x y. x) p"
+definition fst ("(2fst[_, _])")
+where "fst[A, B] \<equiv> \<lambda>(p: \<Sum>x: A. B x). indSum (\<lambda>_. A) (\<lambda>x y. x) p"
-lemma fst_type:
- assumes "A: U i" and "p: \<Sum>x: A. B x" shows "fst A p: A"
-unfolding fst_def by (derive lems: assms)
+definition snd ("(2snd[_, _])")
+where "snd[A, B] \<equiv> \<lambda>(p: \<Sum>x: A. B x). indSum (\<lambda>p. B (fst[A, B]`p)) (\<lambda>x y. y) p"
-declare fst_type [intro]
+lemma fst_type:
+ assumes [intro]: "A: U i" "B: A \<leadsto> U i"
+ shows "fst[A, B]: (\<Sum>x: A. B x) \<rightarrow> A"
+unfolding fst_def by derive
lemma fst_cmp:
- assumes "A: U i" and "B: A \<leadsto> U i" and "a: A" and "b: B a" shows "fst A <a, b> \<equiv> a"
-unfolding fst_def by (subst comp) (derive lems: assms)
-
-declare fst_cmp [comp]
-
-definition snd :: "[t, t \<Rightarrow> t, t] \<Rightarrow> t" where "snd A B p \<equiv> indSum (\<lambda>p. B (fst A p)) (\<lambda>x y. y) p"
+ assumes [intro]: "A: U i" "B: A \<leadsto> U i" "a: A" "b: B a"
+ shows "fst[A, B]`<a, b> \<equiv> a"
+unfolding fst_def by derive
lemma snd_type:
- assumes "A: U i" and "B: A \<leadsto> U i" and "p: \<Sum>x: A. B x" shows "snd A B p: B (fst A p)"
-unfolding snd_def proof (routine add: assms)
- fix x y assume "x: A" and "y: B x"
- with assms have [comp]: "fst A <x, y> \<equiv> x" by derive
- note \<open>y: B x\<close> then show "y: B (fst A <x, y>)" by compute
-qed
+ assumes [intro]: "A: U i" "B: A \<leadsto> U i"
+ shows "snd[A, B]: \<Prod>(p: \<Sum>x: A. B x). B (fst[A,B]`p)"
+unfolding snd_def by (derive lems: fst_type comp: fst_cmp)
lemma snd_cmp:
- assumes "A: U i" and "B: A \<leadsto> U i" and "a: A" and "b: B a" shows "snd A B <a,b> \<equiv> b"
-unfolding snd_def by (derive lems: assms)
+ assumes [intro]: "A: U i" "B: A \<leadsto> U i" "a: A" "b: B a"
+ shows "snd[A, B]`<a, b> \<equiv> b"
+unfolding snd_def proof derive qed (derive lems: assms fst_type comp: fst_cmp)
-lemmas Proj_type [intro] = fst_type snd_type
-lemmas Proj_comp [comp] = fst_cmp snd_cmp
+lemmas proj_type [intro] = fst_type snd_type
+lemmas proj_comp [comp] = fst_cmp snd_cmp
end