fun lambda_count (Abs (_, _, t)) = lambda_count t + 1
| lambda_count ((t as Abs _) $ _) = lambda_count t - 1
| lambda_count ((t as 🍋‹case_prod _ _ _› $ _) $ _) = lambda_count t - 1
| lambda_count 🍋‹case_prod _ _ _ for t› = lambda_count t - 1
| lambda_count _ = 0;
fun zoom apply = let fun zo 0 bound_Ts (Abs (r, T, t), Abs (s, U, u)) = let val (t', u') = zo 0 (T :: bound_Ts) (t, u) in
(lambda (Free (r, T)) t', lambda (Free (s, U)) u') end
| zo 0 bound_Ts ((t as Abs (_, T, _)) $ arg, u) = let val (t', u') = zo 1 (T :: bound_Ts) (t, u) in
(t' $ arg, u') end
| zo 0 bound_Ts ((t as 🍋‹case_prod _ _ _› $ _) $ arg, u) = let val (t', u') = zo 1 bound_Ts (t, u) in
(t' $ arg, u') end
| zo 0 bound_Ts tu = apply bound_Ts tu
| zo n bound_Ts (🍋‹case_prod A B _ for t›, u) = let
val (t', u') = zo (n + 1) bound_Ts (t, u);
val C = range_type (range_type (fastype_of t')); in (🍋‹case_prod A B C for t'\, u') end
| zo n bound_Ts (Abs (s, T, t), u) = let val (t', u') = zo (n - 1) (T :: bound_Ts) (t, u) in
(Abs (s, T, t'), u') end
| zo _ _ (t, u) = raise TERM ("zoom", [t, u]); in
zo 0 [] end;
fun apply_Trans_left t (lhs, _) = (lhs, t); fun apply_Trans_right t (_, rhs) = (t, rhs);
fun apply_Cong ary j (lhs, rhs) =
(case apply2 strip_comb (lhs, rhs) of
((c, ts), (d, us)) => if c aconv d andalso length ts = ary andalso length us = ary then (nth ts j, nth us j)
else raise TERM ("apply_Cong", [lhs, rhs]));
fun apply_Bind (lhs, rhs) =
(case (lhs, rhs) of
(🍋‹All _ for‹Abs (_, T, t)››, 🍋‹All _ for‹Abs (s, U, u)››) =>
(Abs (s, T, t), Abs (s, U, u))
| (🍋‹Ex _ for t›, 🍋‹Ex _ for u›) => (t, u)
| _ => raise TERM ("apply_Bind", [lhs, rhs]));
fun apply_Sko_Ex (lhs, rhs) =
(case lhs of 🍋‹Ex _ for‹t as Abs (_, T, _)›› =>
(t $ (HOLogic.choice_const T $ t), rhs)
| _ => raise TERM ("apply_Sko_Ex", [lhs]));
fun apply_Sko_All (lhs, rhs) =
(case lhs of 🍋‹All _ for‹t as Abs (s, T, body)›› =>
(t $ (HOLogic.choice_const T $ Abs (s, T, HOLogic.mk_not body)), rhs)
| _ => raise TERM ("apply_Sko_All", [lhs]));
fun apply_Let_left ts j (lhs, _) =
(case lhs of 🍋‹Let _ _ for t _› => let val ts0 = HOLogic.strip_tuple t in
(nth ts0 j, nth ts j) end
| _ => raise TERM ("apply_Let_left", [lhs]));
fun apply_Let_right ts bound_Ts (lhs, rhs) = let val t' = mk_tuple1 bound_Ts ts in
(case lhs of 🍋‹Let _ _ for _ u› => (u $ t', rhs)
| _ => raise TERM ("apply_Let_right", [lhs, rhs])) end;
fun reconstruct_proof ctxt (lrhs as (_, rhs), N (rule_name, prems)) = let
val goal = HOLogic.mk_Trueprop (HOLogic.mk_eq lrhs);
val ary = length prems;
val _ = warning (Syntax.string_of_term 🍋 goal);
val _ = warning (str_of_rule_name rule_name);
val num_lams = lambda_count rhs;
val conged_parents = map (funpow num_lams (fn th => th RS fun_cong)
#> Local_Defs.unfold0 ctxt @{thms prod.case}) parents; in
Goal.prove_sorry ctxt [] [] goal (fn {context = ctxt, ...} =>
Local_Defs.unfold0_tac ctxt @{thms prod.case} THEN
HEADGOAL (REPEAT_DETERM_N num_lams o resolve_tac ctxt [ext] THEN'
resolve_tac ctxt rule_thms THEN'
K (Local_Defs.unfold0_tac ctxt @{thms prod.case}) THEN'
EVERY' (map (resolve_tac ctxt o single) conged_parents))) end; ›
ML ‹
val proof0 =
((🍋‹∃x :: nat. p x›, 🍋‹p (SOME x :: nat. p x)›),
N (Sko_Ex, [N (Refl, [])]));
reconstruct_proof 🍋 proof0; ›
ML ‹
val proof1 =
((🍋‹¬ (∀x :: nat. ∃y :: nat. p x y)›, 🍋‹¬ (∃y :: nat. p (SOME x :: nat. ¬ (∃y :: nat. p x y)) y)›),
N (Cong, [N (Sko_All, [N (Bind, [N (Refl, [])])])]));
reconstruct_proof 🍋 proof1; ›
ML ‹
val proof2 =
((🍋‹∀x :: nat. ∃y :: nat. ∃z :: nat. p x y z›, 🍋‹∀x :: nat. p x (SOME y :: nat. ∃z :: nat. p x y z)
(SOME z :: nat. p x (SOME y :: nat. ∃z :: nat. p x y z) z)›),
N (Bind, [N (Sko_Ex, [N (Sko_Ex, [N (Refl, [])])])]));
reconstruct_proof 🍋 proof2 ›
ML ‹
val proof3 =
((🍋‹∀x :: nat. ∃x :: nat. ∃x :: nat. p x x x›, 🍋‹∀x :: nat. p (SOME x :: nat. p x x x) (SOME x. p x x x) (SOME x. p x x x)›),
N (Bind, [N (Sko_Ex, [N (Sko_Ex, [N (Refl, [])])])]));
reconstruct_proof 🍋 proof3 ›
ML ‹
val proof4 =
((🍋‹∀x :: nat. ∃x :: nat. ∃x :: nat. p x x x›, 🍋‹∀x :: nat. ∃x :: nat. p (SOME x :: nat. p x x x) (SOME x. p x x x) (SOME x. p x x x)›),
N (Bind, [N (Bind, [N (Sko_Ex, [N (Refl, [])])])]));
reconstruct_proof 🍋 proof4 ›
ML ‹
val proof5 =
((🍋‹∀x :: nat. q ∧ (∃x :: nat. ∃x :: nat. p x x x)›, 🍋‹∀x :: nat. q ∧
(∃x :: nat. p (SOME x :: nat. p x x x) (SOME x. p x x x) (SOME x. p x x x))›),
N (Bind, [N (Cong, [N (Refl, []), N (Bind, [N (Sko_Ex, [N (Refl, [])])])])]));
reconstruct_proof 🍋 proof5 ›
ML ‹
val proof6 =
((🍋‹¬ (∀x :: nat. p ∧ (∃x :: nat. ∀x :: nat. q x x))›, 🍋‹¬ (∀x :: nat. p ∧
(∃x :: nat. q (SOME x :: nat. ¬ q x x) (SOME x. ¬ q x x)))›),
N (Cong, [N (Bind, [N (Cong, [N (Refl, []), N (Bind, [N (Sko_All, [N (Refl, [])])])])])]));
reconstruct_proof 🍋 proof6 ›
ML ‹
val proof7 =
((🍋‹¬¬ (∃x. p x)›, 🍋‹¬¬ p (SOME x. p x)›),
N (Cong, [N (Cong, [N (Sko_Ex, [N (Refl, [])])])]));
reconstruct_proof 🍋 proof7 ›
ML ‹
val proof8 =
((🍋‹¬¬ (let x = Suc x in x = 0)›, 🍋‹¬¬ Suc x = 0›),
N (Cong, [N (Cong, [N (Let [🍋‹Suc x›], [N (Refl, []), N (Refl, [])])])]));
reconstruct_proof 🍋 proof8 ›
ML ‹
val proof9 =
((🍋‹¬ (let x = Suc x in x = 0)›, 🍋‹¬ Suc x = 0›),
N (Cong, [N (Let [🍋‹Suc x›], [N (Refl, []), N (Refl, [])])]));
reconstruct_proof 🍋 proof9 ›
ML ‹
val proof10 =
((🍋‹∃x :: nat. p (x + 0)›, 🍋‹∃x :: nat. p x›),
N (Bind, [N (Cong, [N (Taut @{thm add_0_right}, [])])]));
reconstruct_proof 🍋 proof10; ›
ML ‹
val proof11 =
((🍋‹¬ (let (x, y) = (Suc y, Suc x) in y = 0)›, 🍋‹¬ Suc x = 0›),
N (Cong, [N (Let [🍋‹Suc y›, 🍋‹Suc x›], [N (Refl, []), N (Refl, []),
N (Refl, [])])]));
reconstruct_proof 🍋 proof11 ›
ML ‹
val proof12 =
((🍋‹¬ (let (x, y) = (Suc y, Suc x); (u, v, w) = (y, x, y) in w = 0)›, 🍋‹¬ Suc x = 0›),
N (Cong, [N (Let [🍋‹Suc y›, 🍋‹Suc x›], [N (Refl, []), N (Refl, []),
N (Let [🍋‹Suc x›, 🍋‹Suc y›, 🍋‹Suc x›],
[N (Refl, []), N (Refl, []), N (Refl, []), N (Refl, [])])])]));
reconstruct_proof 🍋 proof12 ›
ML ‹
val proof13 =
((🍋‹¬¬ (let x = Suc x in x = 0)›, 🍋‹¬¬ Suc x = 0›),
N (Cong, [N (Cong, [N (Let [🍋‹Suc x›], [N (Refl, []), N (Refl, [])])])]));
reconstruct_proof 🍋 proof13 ›
ML ‹
val proof14 =
((🍋‹let (x, y) = (f (a :: nat), b :: nat) in x > a›, 🍋‹f (a :: nat) > a›),
N (Let [🍋‹f (a :: nat) :: nat›, 🍋‹b :: nat›],
[N (Cong, [N (Refl, [])]), N (Refl, []), N (Refl, [])]));
reconstruct_proof 🍋 proof14 ›
ML ‹
val proof15 =
((🍋‹let x = (let y = g (z :: nat) in f (y :: nat)) in x = Suc 0›, 🍋‹f (g (z :: nat) :: nat) = Suc 0›),
N (Let [🍋‹f (g (z :: nat) :: nat) :: nat›],
[N (Let [🍋‹g (z :: nat) :: nat›], [N (Refl, []), N (Refl, [])]), N (Refl, [])]));
reconstruct_proof 🍋 proof15 ›
ML ‹
val proof16 =
((🍋‹a > Suc b›, 🍋‹a > Suc b›),
N (Trans 🍋‹a > Suc b›, [N (Refl, []), N (Refl, [])]));
reconstruct_proof 🍋 proof16 ›
thm Suc_1 thm numeral_2_eq_2 thm One_nat_def
ML ‹
val proof17 =
((🍋‹2 :: nat›, 🍋‹Suc (Suc 0) :: nat›),
N (Trans 🍋‹Suc 1›, [N (Taut @{thm Suc_1[symmetric]}, []), N (Cong,
[N (Taut @{thm One_nat_def}, [])])]));
reconstruct_proof 🍋 proof17 ›
ML ‹
val proof18 =
((🍋‹let x = a inlet y = b in Suc x + y›, 🍋‹Suc a + b›),
N (Trans 🍋‹let y = b in Suc a + y›,
[N (Let [🍋‹a :: nat›], [N (Refl, []), N (Refl, [])]),
N (Let [🍋‹b :: nat›], [N (Refl, []), N (Refl, [])])]));
reconstruct_proof 🍋 proof18 ›
ML ‹
val proof19 =
((🍋‹∀x. let x = f (x :: nat) :: nat in g x›, 🍋‹∀x. g (f (x :: nat) :: nat)›),
N (Bind, [N (Let [🍋‹f :: nat ==> nat› $ Bound 0],
[N (Refl, []), N (Refl, [])])]));
reconstruct_proof 🍋 proof19 ›
ML ‹
val proof20 =
((🍋‹∀x. let y = Suc 0 inlet x = f (x :: nat) :: nat in g x›, 🍋‹∀x. g (f (x :: nat) :: nat)›),
N (Bind, [N (Let [🍋‹Suc 0›], [N (Refl, []), N (Let [🍋‹f (x :: nat) :: nat›],
[N (Refl, []), N (Refl, [])])])]));
reconstruct_proof 🍋 proof20 ›
ML ‹
val proof21 =
((🍋‹∀x :: nat. let x = f x :: nat inlet y = x in p y›, 🍋‹∀z :: nat. p (f z :: nat)›),
N (Bind, [N (Let [🍋‹f (z :: nat) :: nat›],
[N (Refl, []), N (Let [🍋‹f (z :: nat) :: nat›],
[N (Refl, []), N (Refl, [])])])]));
reconstruct_proof 🍋 proof21 ›
ML ‹
val proof22 =
((🍋‹∀x :: nat. let x = f x :: nat inlet y = x in p y›, 🍋‹∀x :: nat. p (f x :: nat)›),
N (Bind, [N (Let [🍋‹f (x :: nat) :: nat›],
[N (Refl, []), N (Let [🍋‹f (x :: nat) :: nat›],
[N (Refl, []), N (Refl, [])])])]));
reconstruct_proof 🍋 proof22 ›
ML ‹
val proof23 =
((🍋‹∀x :: nat. let (x, a) = (f x :: nat, 0 ::nat) inlet y = x in p y›, 🍋‹∀z :: nat. p (f z :: nat)›),
N (Bind, [N (Let [🍋‹f (z :: nat) :: nat›, 🍋‹0 :: nat›],
[N (Refl, []), N (Refl, []), N (Let [🍋‹f (z :: nat) :: nat›],
[N (Refl, []), N (Refl, [])])])]));
reconstruct_proof 🍋 proof23 ›
ML ‹
val proof24 =
((🍋‹∀x :: nat. let (x, a) = (f x :: nat, 0 ::nat) inlet y = x in p y›, 🍋‹∀x :: nat. p (f x :: nat)›),
N (Bind, [N (Let [🍋‹f (x :: nat) :: nat›, 🍋‹0 :: nat›],
[N (Refl, []), N (Refl, []), N (Let [🍋‹f (x :: nat) :: nat›],
[N (Refl, []), N (Refl, [])])])]));
reconstruct_proof 🍋 proof24 ›
ML ‹
val proof25 =
((🍋‹let vr0 = vr1 inlet vr1 = vr2 in vr0 + vr1 + vr2 :: nat›, 🍋‹vr1 + vr2 + vr2 :: nat›),
N (Trans 🍋‹let vr1a = vr2 in vr1 + vr1a + vr2 :: nat›,
[N (Let [🍋‹vr1 :: nat›], [N (Refl, []), N (Refl, [])]),
N (Let [🍋‹vr2 :: nat›], [N (Refl, []), N (Refl, [])])]));
reconstruct_proof 🍋 proof25 ›
end
Messung V0.5
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.