From 7a89ec1e72f61179767c6488177c6d12e69388c5 Mon Sep 17 00:00:00 2001 From: Josh Chen Date: Sun, 12 Aug 2018 13:04:16 +0200 Subject: Commit before testing polymorphic equality eliminator --- EqualProps.thy | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'EqualProps.thy') diff --git a/EqualProps.thy b/EqualProps.thy index 17c7fa6..9d23a99 100644 --- a/EqualProps.thy +++ b/EqualProps.thy @@ -15,20 +15,25 @@ begin section \Symmetry / Path inverse\ -definition inv :: "[Term, Term, Term] \ Term" ("(1inv[_,/ _,/ _])") - where "inv[A,x,y] \ \<^bold>\p:x =\<^sub>A y. indEqual[A] (\x y _. y =\<^sub>A x) (\x. refl(x)) x y p" +definition inv :: "[Term, Term] \ (Term \ Term)" ("(1inv[_,/ _])") + where "inv[x,y] \ \p. ind\<^sub>= (\x. refl(x)) x y p" lemma inv_type: - assumes "A : U(i)" and "x : A" and "y : A" shows "inv[A,x,y] : x =\<^sub>A y \ y =\<^sub>A x" - unfolding inv_def - by (derive lems: assms) + assumes "A : U(i)" and "x : A" and "y : A" and "p: x =\<^sub>A y" shows "inv[x,y](p): y =\<^sub>A x" +unfolding inv_def +proof + show "\x y. \x: A; y: A\ \ y =\<^sub>A x: U(i)" using assms(1) .. + show "\x. x: A \ refl x: x =\<^sub>A x" .. +qed (fact assms)+ -corollary assumes "x =\<^sub>A y : U(i)" and "p : x =\<^sub>A y" shows "inv[A,x,y]`p : y =\<^sub>A x" - by (derive lems: inv_type assms) -lemma inv_comp: assumes "A : U(i)" and "a : A" shows "inv[A,a,a]`refl(a) \ refl(a)" - unfolding inv_def by (simplify lems: assms) +lemma inv_comp: assumes "A : U(i)" and "a : A" shows "inv[a,a](refl(a)) \ refl(a)" +unfolding inv_def +proof + show "\x. x: A \ refl x: x =\<^sub>A x" .. + show "\x. x: A \ x =\<^sub>A x: U(i)" using assms(1) .. +qed (fact assms) section \Transitivity / Path composition\ @@ -42,10 +47,8 @@ definition rcompose :: "Term \ Term" ("(1rcompose[_])") x y p" -text "``Natural'' composition function, of type \\x,y,z:A. x =\<^sub>A y \ y =\<^sub>A z \ x =\<^sub>A z\." - -abbreviation compose :: "[Term, Term, Term, Term] \ Term" ("(1compose[_,/ _,/ _,/ _])") - where "compose[A,x,y,z] \ \<^bold>\p:(x =\<^sub>A y). \<^bold>\q:(y =\<^sub>A z). rcompose[A]`x`y`p`z`q" +definition compose :: "[Term, Term, Term] \ [Term, Term] \ Term" ("(1compose[ _,/ _,/ _])") + where "compose[x,y,z] \ \p." lemma compose_type: -- cgit v1.2.3