1513 |
1513 |
1514 definition curr where |
1514 definition curr where |
1515 "curr A f \<equiv> \<lambda> a. if a \<in> A then \<lambda>b. f (a,b) else undefined" |
1515 "curr A f \<equiv> \<lambda> a. if a \<in> A then \<lambda>b. f (a,b) else undefined" |
1516 |
1516 |
1517 lemma curr_in: |
1517 lemma curr_in: |
1518 assumes f: "f \<in> Func (A <*> B) C" |
1518 assumes f: "f \<in> Func (A \<times> B) C" |
1519 shows "curr A f \<in> Func A (Func B C)" |
1519 shows "curr A f \<in> Func A (Func B C)" |
1520 using assms unfolding curr_def Func_def by auto |
1520 using assms unfolding curr_def Func_def by auto |
1521 |
1521 |
1522 lemma curr_inj: |
1522 lemma curr_inj: |
1523 assumes "f1 \<in> Func (A <*> B) C" and "f2 \<in> Func (A <*> B) C" |
1523 assumes "f1 \<in> Func (A \<times> B) C" and "f2 \<in> Func (A \<times> B) C" |
1524 shows "curr A f1 = curr A f2 \<longleftrightarrow> f1 = f2" |
1524 shows "curr A f1 = curr A f2 \<longleftrightarrow> f1 = f2" |
1525 proof safe |
1525 proof safe |
1526 assume c: "curr A f1 = curr A f2" |
1526 assume c: "curr A f1 = curr A f2" |
1527 show "f1 = f2" |
1527 show "f1 = f2" |
1528 proof (rule ext, clarify) |
1528 proof (rule ext, clarify) |
1529 fix a b show "f1 (a, b) = f2 (a, b)" |
1529 fix a b show "f1 (a, b) = f2 (a, b)" |
1530 proof (cases "(a,b) \<in> A <*> B") |
1530 proof (cases "(a,b) \<in> A \<times> B") |
1531 case False |
1531 case False |
1532 thus ?thesis using assms unfolding Func_def by auto |
1532 thus ?thesis using assms unfolding Func_def by auto |
1533 next |
1533 next |
1534 case True hence a: "a \<in> A" and b: "b \<in> B" by auto |
1534 case True hence a: "a \<in> A" and b: "b \<in> B" by auto |
1535 thus ?thesis |
1535 thus ?thesis |
1538 qed |
1538 qed |
1539 qed |
1539 qed |
1540 |
1540 |
1541 lemma curr_surj: |
1541 lemma curr_surj: |
1542 assumes "g \<in> Func A (Func B C)" |
1542 assumes "g \<in> Func A (Func B C)" |
1543 shows "\<exists> f \<in> Func (A <*> B) C. curr A f = g" |
1543 shows "\<exists> f \<in> Func (A \<times> B) C. curr A f = g" |
1544 proof |
1544 proof |
1545 let ?f = "\<lambda> ab. if fst ab \<in> A \<and> snd ab \<in> B then g (fst ab) (snd ab) else undefined" |
1545 let ?f = "\<lambda> ab. if fst ab \<in> A \<and> snd ab \<in> B then g (fst ab) (snd ab) else undefined" |
1546 show "curr A ?f = g" |
1546 show "curr A ?f = g" |
1547 proof (rule ext) |
1547 proof (rule ext) |
1548 fix a show "curr A ?f a = g a" |
1548 fix a show "curr A ?f a = g a" |
1555 obtain g1 where "g1 \<in> Func B C" and "g a = g1" |
1555 obtain g1 where "g1 \<in> Func B C" and "g a = g1" |
1556 using assms using Func_elim[OF assms True] by blast |
1556 using assms using Func_elim[OF assms True] by blast |
1557 thus ?thesis using True unfolding Func_def curr_def by auto |
1557 thus ?thesis using True unfolding Func_def curr_def by auto |
1558 qed |
1558 qed |
1559 qed |
1559 qed |
1560 show "?f \<in> Func (A <*> B) C" using assms unfolding Func_def mem_Collect_eq by auto |
1560 show "?f \<in> Func (A \<times> B) C" using assms unfolding Func_def mem_Collect_eq by auto |
1561 qed |
1561 qed |
1562 |
1562 |
1563 lemma bij_betw_curr: |
1563 lemma bij_betw_curr: |
1564 "bij_betw (curr A) (Func (A <*> B) C) (Func A (Func B C))" |
1564 "bij_betw (curr A) (Func (A \<times> B) C) (Func A (Func B C))" |
1565 unfolding bij_betw_def inj_on_def image_def |
1565 unfolding bij_betw_def inj_on_def image_def |
1566 apply (intro impI conjI ballI) |
1566 apply (intro impI conjI ballI) |
1567 apply (erule curr_inj[THEN iffD1], assumption+) |
1567 apply (erule curr_inj[THEN iffD1], assumption+) |
1568 apply auto |
1568 apply auto |
1569 apply (erule curr_in) |
1569 apply (erule curr_in) |