diff -r b9a16d627bfd -r b58073719b06 Attic/Unused.thy --- a/Attic/Unused.thy Sun Jun 19 13:14:37 2011 +0900 +++ b/Attic/Unused.thy Mon Jun 20 08:50:13 2011 +0900 @@ -1,164 +1,11 @@ (*notation ( output) "prop" ("#_" [1000] 1000) *) notation ( output) "Trueprop" ("#_" [1000] 1000) -function(sequential) - akind :: "kind \ kind \ bool" ("_ \ki _" [100, 100] 100) -and aty :: "ty \ ty \ bool" ("_ \ty _" [100, 100] 100) -and atrm :: "trm \ trm \ bool" ("_ \tr _" [100, 100] 100) -where - a1: "(Type) \ki (Type) = True" -| a2: "(KPi A x K) \ki (KPi A' x' K') = (A \ty A' \ (\pi. (rfv_kind K - {atom x} = rfv_kind K' - {atom x'} \ (rfv_kind K - {atom x})\* pi \ (pi \ K) \ki K' \ (pi \ x) = x')))" -| "_ \ki _ = False" -| a3: "(TConst i) \ty (TConst j) = (i = j)" -| a4: "(TApp A M) \ty (TApp A' M') = (A \ty A' \ M \tr M')" -| a5: "(TPi A x B) \ty (TPi A' x' B') = ((A \ty A') \ (\pi. rfv_ty B - {atom x} = rfv_ty B' - {atom x'} \ (rfv_ty B - {atom x})\* pi \ (pi \ B) \ty B' \ (pi \ x) = x'))" -| "_ \ty _ = False" -| a6: "(Const i) \tr (Const j) = (i = j)" -| a7: "(Var x) \tr (Var y) = (x = y)" -| a8: "(App M N) \tr (App M' N') = (M \tr M' \ N \tr N')" -| a9: "(Lam A x M) \tr (Lam A' x' M') = (A \ty A' \ (\pi. rfv_trm M - {atom x} = rfv_trm M' - {atom x'} \ (rfv_trm M - {atom x})\* pi \ (pi \ M) \tr M' \ (pi \ x) = x'))" -| "_ \tr _ = False" -apply (pat_completeness) -apply simp_all -done -termination -by (size_change) - - - -lemma regularize_to_injection: - shows "(QUOT_TRUE l \ y) \ (l = r) \ y" - by(auto simp add: QUOT_TRUE_def) - syntax "Bex1_rel" :: "id \ ('a \ 'a \ bool) \ ('a \ bool) \ bool" ("(3\!!_\_./ _)" [0, 0, 10] 10) translations "\!!x\A. P" == "Bex1_rel A (%x. P)" - -(* Atomize infrastructure *) -(* FIXME/TODO: is this really needed? *) -(* -lemma atomize_eqv: - shows "(Trueprop A \ Trueprop B) \ (A \ B)" -proof - assume "A \ B" - then show "Trueprop A \ Trueprop B" by unfold -next - assume *: "Trueprop A \ Trueprop B" - have "A = B" - proof (cases A) - case True - have "A" by fact - then show "A = B" using * by simp - next - case False - have "\A" by fact - then show "A = B" using * by auto - qed - then show "A \ B" by (rule eq_reflection) -qed -*) - - -ML {* - fun dest_cbinop t = - let - val (t2, rhs) = Thm.dest_comb t; - val (bop, lhs) = Thm.dest_comb t2; - in - (bop, (lhs, rhs)) - end -*} - -ML {* - fun dest_ceq t = - let - val (bop, pair) = dest_cbinop t; - val (bop_s, _) = Term.dest_Const (Thm.term_of bop); - in - if bop_s = "op =" then pair else (raise CTERM ("Not an equality", [t])) - end -*} - -ML {* - fun split_binop_conv t = - let - val (lhs, rhs) = dest_ceq t; - val (bop, _) = dest_cbinop lhs; - val [clT, cr2] = bop |> Thm.ctyp_of_term |> Thm.dest_ctyp; - val [cmT, crT] = Thm.dest_ctyp cr2; - in - Drule.instantiate' [SOME clT, SOME cmT, SOME crT] [NONE, NONE, NONE, NONE, SOME bop] @{thm arg_cong2} - end -*} - - -ML {* - fun split_arg_conv t = - let - val (lhs, rhs) = dest_ceq t; - val (lop, larg) = Thm.dest_comb lhs; - val [caT, crT] = lop |> Thm.ctyp_of_term |> Thm.dest_ctyp; - in - Drule.instantiate' [SOME caT, SOME crT] [NONE, NONE, SOME lop] @{thm arg_cong} - end -*} - -ML {* - fun split_binop_tac n thm = - let - val concl = Thm.cprem_of thm n; - val (_, cconcl) = Thm.dest_comb concl; - val rewr = split_binop_conv cconcl; - in - rtac rewr n thm - end - handle CTERM _ => Seq.empty -*} - - -ML {* - fun split_arg_tac n thm = - let - val concl = Thm.cprem_of thm n; - val (_, cconcl) = Thm.dest_comb concl; - val rewr = split_arg_conv cconcl; - in - rtac rewr n thm - end - handle CTERM _ => Seq.empty -*} - - -lemma trueprop_cong: - shows "(a \ b) \ (Trueprop a \ Trueprop b)" - by auto - -lemma list_induct_hol4: - fixes P :: "'a list \ bool" - assumes a: "((P []) \ (\t. (P t) \ (\h. (P (h # t)))))" - shows "\l. (P l)" - using a - apply (rule_tac allI) - apply (induct_tac "l") - apply (simp) - apply (metis) - done - -ML {* -val no_vars = Thm.rule_attribute (fn context => fn th => - let - val ctxt = Variable.set_body false (Context.proof_of context); - val ((_, [th']), _) = Variable.import true [th] ctxt; - in th' end); -*} - -(*lemma equality_twice: - "a = c \ b = d \ (a = b \ c = d)" -by auto*) - - (*interpretation code *) (*val bindd = ((Binding.make ("", Position.none)), ([]: Attrib.src list)) val ((_, [eqn1pre]), lthy5) = Variable.import true [ABS_def] lthy4;