diff -r ed54ec416bb3 -r 5c816239deaa Unification/Equ.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Unification/Equ.thy Sun Apr 29 11:29:56 2012 +0100 @@ -0,0 +1,156 @@ + + +theory Equ = Main + Terms + Fresh + PreEqu: + +lemma equ_refl: + "nabla\t\t" +apply(induct_tac t) +apply(auto simp add: ds_def) +done + + +lemma + equ_sym: "nabla\t1\t2 \ nabla\t2\t1" and + equ_trans: "\nabla\t1\t2;nabla\t2\t3\ \ nabla\t1\t3" and + equ_add_pi: "nabla\t1\t2 \ nabla\swap pi t1\swap pi t2" +apply(insert big) +apply(best)+ +done + + +lemma equ_dec_pi: + "nabla\swap pi t1\swap pi t2\nabla\t1\t2" +apply(drule_tac pi="(rev pi)" in equ_add_pi) +apply(subgoal_tac "nabla\swap (rev pi) (swap pi t2)\t2") +apply(drule_tac "t1.0"="swap (rev pi) (swap pi t1)" and + "t2.0"="swap (rev pi) (swap pi t2)" and + "t3.0"="t2" in equ_trans) +apply(assumption) +apply(subgoal_tac "nabla\t1\swap (rev pi) (swap pi t1)") +apply(drule_tac "t1.0"="t1" and + "t2.0"="swap (rev pi) (swap pi t1)" and + "t3.0"="t2" in equ_trans) +apply(assumption)+ +apply(rule equ_sym) +apply(rule rev_pi_pi_equ) +apply(rule rev_pi_pi_equ) +done + +lemma equ_involutive_left: + "nabla\swap (rev pi) (swap pi t1)\t2 = nabla\t1\t2" +apply(auto) +apply(subgoal_tac "nabla \ t1\ swap (rev pi) (swap pi t1)") +apply(drule_tac "t2.0"="swap (rev pi) (swap pi t1)" and + "t1.0"="t1" and "t3.0"="t2" in equ_trans) +apply(assumption)+ +apply(rule equ_sym) +apply(rule rev_pi_pi_equ) +apply(subgoal_tac "nabla \ swap (rev pi) (swap pi t1)\t1") +apply(drule_tac "t1.0"="swap (rev pi) (swap pi t1)" and + "t2.0"="t1" and "t3.0"="t2" in equ_trans) +apply(assumption)+ +apply(rule rev_pi_pi_equ) +done + +lemma equ_pi_to_left: + "nabla\swap (rev pi) t1\t2 = nabla\t1\ swap pi t2" +apply(auto) +apply(rule_tac pi="rev pi" in equ_dec_pi) +apply(rule equ_sym) +apply(simp only: equ_involutive_left) +apply(rule equ_sym) +apply(assumption) +apply(drule_tac pi="rev pi" in equ_add_pi) +apply(drule equ_sym) +apply(simp only: equ_involutive_left) +apply(drule equ_sym) +apply(assumption) +done + +lemma equ_pi_to_right: + "nabla\t1\swap (rev pi) t2 = nabla\swap pi t1\t2" +apply(auto) +apply(rule_tac pi="rev pi" in equ_dec_pi) +apply(simp only: equ_involutive_left) +apply(drule_tac pi="rev pi" in equ_add_pi) +apply(simp only: equ_involutive_left) +done + +lemma equ_involutive_right: + "nabla\t1\swap (rev pi) (swap pi t2) = nabla\t1\t2" +apply(simp only: swap_append[THEN sym]) +apply(simp only: equ_pi_to_left[THEN sym]) +apply(simp) +apply(simp only: swap_append) +apply(simp only: equ_involutive_left) +done + +lemma equ_pi1_pi2_add: + "(\a\ ds pi1 pi2. nabla\a\t)\(nabla\swap pi1 t \ swap pi2 t)" +apply(rule impI) +apply(simp only: equ_pi_to_right[THEN sym]) +apply(simp only: swap_append[THEN sym]) +apply(rule equ_pi_right[THEN spec, THEN mp]) +apply(auto) +apply(simp only: ds_rev) +done + +lemma pi_right_equ: "(nabla\t \ swap pi t)\(\a\ ds [] pi. nabla\a\t)" +apply(insert pi_right_equ_help) +apply(best) +done + +lemma equ_pi1_pi2_dec: + "(nabla\swap pi1 t \ swap pi2 t)\(\a\ ds pi1 pi2. nabla\a\t)" +apply(rule impI) +apply(simp only: equ_pi_to_right[THEN sym]) +apply(simp only: swap_append[THEN sym]) +apply(drule pi_right_equ[THEN mp]) +apply(simp only: ds_rev) +done + +lemma equ_weak: + "nabla1\t1\t2\(nabla1\nabla2)\t1\t2" +apply(rule impI) +apply(erule equ.induct) +apply(auto simp add: fresh_weak) +done + +(* no term can be equal to one of its proper subterm *) +lemma psub_trm_not_equ: + "\ t2\psub_trms t1. (\(\ pi. (nabla\t1\swap pi t2)))" +apply(induct t1) +apply(auto) +apply(simp add: equ_pi_to_left[THEN sym]) +apply(ind_cases "nabla \ Abst (swapas (rev pi) list) (swap (rev pi) trm) \ t2") +apply(simp_all) +apply(drule abst_psub_trms) +apply(drule_tac x="t2a" in bspec) +apply(simp) +apply(simp add: equ_pi_to_left[THEN sym] swap_append[THEN sym]) +apply(drule_tac x="rev (((swapas (rev pi) list, b) # rev pi))" in spec) +apply(simp) +apply(drule abst_psub_trms) +apply(drule_tac x="t2a" in bspec) +apply(simp) +apply(simp) +apply(simp add: equ_pi_to_left[THEN sym]) +apply(ind_cases "nabla \ Paar (swap (rev pi) trm1) (swap (rev pi) trm2) \ t2") +apply(simp) +apply(drule paar_psub_trms) +apply(best) +apply(simp add: equ_pi_to_left[THEN sym]) +apply(ind_cases "nabla \ Paar (swap (rev pi) trm1) (swap (rev pi) trm2) \ t2") +apply(simp) +apply(drule paar_psub_trms) +apply(best) +apply(simp add: equ_pi_to_left[THEN sym]) +apply(ind_cases "nabla \ Func list (swap (rev pi) trm) \ t2") +apply(simp_all) +apply(drule func_psub_trms) +apply(best) +done + + + +end