src/HOL/Limits.thy
changeset 50347 77e3effa50b6
parent 50346 a75c6429c3c3
child 50419 3177d0374701
equal deleted inserted replaced
50346:a75c6429c3c3 50347:77e3effa50b6
   410 lemma within_UNIV [simp]: "F within UNIV = F"
   410 lemma within_UNIV [simp]: "F within UNIV = F"
   411   unfolding filter_eq_iff eventually_within by simp
   411   unfolding filter_eq_iff eventually_within by simp
   412 
   412 
   413 lemma within_empty [simp]: "F within {} = bot"
   413 lemma within_empty [simp]: "F within {} = bot"
   414   unfolding filter_eq_iff eventually_within by simp
   414   unfolding filter_eq_iff eventually_within by simp
       
   415 
       
   416 lemma within_within_eq: "(F within S) within T = F within (S \<inter> T)"
       
   417   by (auto simp: filter_eq_iff eventually_within elim: eventually_elim1)
       
   418 
       
   419 lemma at_within_eq: "at x within T = nhds x within (T - {x})"
       
   420   unfolding at_def within_within_eq by (simp add: ac_simps Diff_eq)
   415 
   421 
   416 lemma within_le: "F within S \<le> F"
   422 lemma within_le: "F within S \<le> F"
   417   unfolding le_filter_def eventually_within by (auto elim: eventually_elim1)
   423   unfolding le_filter_def eventually_within by (auto elim: eventually_elim1)
   418 
   424 
   419 lemma le_withinI: "F \<le> F' \<Longrightarrow> eventually (\<lambda>x. x \<in> S) F \<Longrightarrow> F \<le> F' within S"
   425 lemma le_withinI: "F \<le> F' \<Longrightarrow> eventually (\<lambda>x. x \<in> S) F \<Longrightarrow> F \<le> F' within S"
  1343   apply (intro allI)
  1349   apply (intro allI)
  1344   apply (rule_tac c="natceiling (Z + 1)" in eventually_sequentiallyI)
  1350   apply (rule_tac c="natceiling (Z + 1)" in eventually_sequentiallyI)
  1345   apply (auto simp: natceiling_le_eq)
  1351   apply (auto simp: natceiling_le_eq)
  1346   done
  1352   done
  1347 
  1353 
  1348 lemma filterlim_inverse_at_top_pos:
  1354 subsection {* Relate @{const at}, @{const at_left} and @{const at_right} *}
  1349   "LIM x (nhds 0 within {0::real <..}). inverse x :> at_top"
  1355 
  1350   unfolding filterlim_at_top_gt[where c=0] eventually_within
  1356 text {*
       
  1357 
       
  1358 This lemmas are useful for conversion between @{term "at x"} to @{term "at_left x"} and
       
  1359 @{term "at_right x"} and also @{term "at_right 0"}.
       
  1360 
       
  1361 *}
       
  1362 
       
  1363 lemma at_eq_sup_left_right: "at (x::real) = sup (at_left x) (at_right x)"
       
  1364   by (auto simp: eventually_within at_def filter_eq_iff eventually_sup 
       
  1365            elim: eventually_elim2 eventually_elim1)
       
  1366 
       
  1367 lemma filterlim_split_at_real:
       
  1368   "filterlim f F (at_left x) \<Longrightarrow> filterlim f F (at_right x) \<Longrightarrow> filterlim f F (at (x::real))"
       
  1369   by (subst at_eq_sup_left_right) (rule filterlim_sup)
       
  1370 
       
  1371 lemma filtermap_nhds_shift: "filtermap (\<lambda>x. x - d) (nhds a) = nhds (a - d::real)"
       
  1372   unfolding filter_eq_iff eventually_filtermap eventually_nhds_metric
       
  1373   by (intro allI ex_cong) (auto simp: dist_real_def field_simps)
       
  1374 
       
  1375 lemma filtermap_nhds_minus: "filtermap (\<lambda>x. - x) (nhds a) = nhds (- a::real)"
       
  1376   unfolding filter_eq_iff eventually_filtermap eventually_nhds_metric
       
  1377   apply (intro allI ex_cong)
       
  1378   apply (auto simp: dist_real_def field_simps)
       
  1379   apply (erule_tac x="-x" in allE)
       
  1380   apply simp
       
  1381   done
       
  1382 
       
  1383 lemma filtermap_at_shift: "filtermap (\<lambda>x. x - d) (at a) = at (a - d::real)"
       
  1384   unfolding at_def filtermap_nhds_shift[symmetric]
       
  1385   by (simp add: filter_eq_iff eventually_filtermap eventually_within)
       
  1386 
       
  1387 lemma filtermap_at_right_shift: "filtermap (\<lambda>x. x - d) (at_right a) = at_right (a - d::real)"
       
  1388   unfolding filtermap_at_shift[symmetric]
       
  1389   by (simp add: filter_eq_iff eventually_filtermap eventually_within)
       
  1390 
       
  1391 lemma at_right_to_0: "at_right (a::real) = filtermap (\<lambda>x. x + a) (at_right 0)"
       
  1392   using filtermap_at_right_shift[of "-a" 0] by simp
       
  1393 
       
  1394 lemma filterlim_at_right_to_0:
       
  1395   "filterlim f F (at_right (a::real)) \<longleftrightarrow> filterlim (\<lambda>x. f (x + a)) F (at_right 0)"
       
  1396   unfolding filterlim_def filtermap_filtermap at_right_to_0[of a] ..
       
  1397 
       
  1398 lemma eventually_at_right_to_0:
       
  1399   "eventually P (at_right (a::real)) \<longleftrightarrow> eventually (\<lambda>x. P (x + a)) (at_right 0)"
       
  1400   unfolding at_right_to_0[of a] by (simp add: eventually_filtermap)
       
  1401 
       
  1402 lemma filtermap_at_minus: "filtermap (\<lambda>x. - x) (at a) = at (- a::real)"
       
  1403   unfolding at_def filtermap_nhds_minus[symmetric]
       
  1404   by (simp add: filter_eq_iff eventually_filtermap eventually_within)
       
  1405 
       
  1406 lemma at_left_minus: "at_left (a::real) = filtermap (\<lambda>x. - x) (at_right (- a))"
       
  1407   by (simp add: filter_eq_iff eventually_filtermap eventually_within filtermap_at_minus[symmetric])
       
  1408 
       
  1409 lemma at_right_minus: "at_right (a::real) = filtermap (\<lambda>x. - x) (at_left (- a))"
       
  1410   by (simp add: filter_eq_iff eventually_filtermap eventually_within filtermap_at_minus[symmetric])
       
  1411 
       
  1412 lemma filterlim_at_left_to_right:
       
  1413   "filterlim f F (at_left (a::real)) \<longleftrightarrow> filterlim (\<lambda>x. f (- x)) F (at_right (-a))"
       
  1414   unfolding filterlim_def filtermap_filtermap at_left_minus[of a] ..
       
  1415 
       
  1416 lemma eventually_at_left_to_right:
       
  1417   "eventually P (at_left (a::real)) \<longleftrightarrow> eventually (\<lambda>x. P (- x)) (at_right (-a))"
       
  1418   unfolding at_left_minus[of a] by (simp add: eventually_filtermap)
       
  1419 
       
  1420 lemma filterlim_at_split:
       
  1421   "filterlim f F (at (x::real)) \<longleftrightarrow> filterlim f F (at_left x) \<and> filterlim f F (at_right x)"
       
  1422   by (subst at_eq_sup_left_right) (simp add: filterlim_def filtermap_sup)
       
  1423 
       
  1424 lemma eventually_at_split:
       
  1425   "eventually P (at (x::real)) \<longleftrightarrow> eventually P (at_left x) \<and> eventually P (at_right x)"
       
  1426   by (subst at_eq_sup_left_right) (simp add: eventually_sup)
       
  1427 
       
  1428 lemma at_top_mirror: "at_top = filtermap uminus (at_bot :: real filter)"
       
  1429   unfolding filter_eq_iff eventually_filtermap eventually_at_top_linorder eventually_at_bot_linorder
       
  1430   by (metis le_minus_iff minus_minus)
       
  1431 
       
  1432 lemma at_bot_mirror: "at_bot = filtermap uminus (at_top :: real filter)"
       
  1433   unfolding at_top_mirror filtermap_filtermap by (simp add: filtermap_ident)
       
  1434 
       
  1435 lemma filterlim_at_top_mirror: "(LIM x at_top. f x :> F) \<longleftrightarrow> (LIM x at_bot. f (-x::real) :> F)"
       
  1436   unfolding filterlim_def at_top_mirror filtermap_filtermap ..
       
  1437 
       
  1438 lemma filterlim_at_bot_mirror: "(LIM x at_bot. f x :> F) \<longleftrightarrow> (LIM x at_top. f (-x::real) :> F)"
       
  1439   unfolding filterlim_def at_bot_mirror filtermap_filtermap ..
       
  1440 
       
  1441 lemma filterlim_uminus_at_top_at_bot: "LIM x at_bot. - x :: real :> at_top"
       
  1442   unfolding filterlim_at_top eventually_at_bot_dense
       
  1443   by (metis leI minus_less_iff order_less_asym)
       
  1444 
       
  1445 lemma filterlim_uminus_at_bot_at_top: "LIM x at_top. - x :: real :> at_bot"
       
  1446   unfolding filterlim_at_bot eventually_at_top_dense
       
  1447   by (metis leI less_minus_iff order_less_asym)
       
  1448 
       
  1449 lemma filterlim_uminus_at_top: "(LIM x F. f x :> at_top) \<longleftrightarrow> (LIM x F. - (f x) :: real :> at_bot)"
       
  1450   using filterlim_compose[OF filterlim_uminus_at_bot_at_top, of f F]
       
  1451   using filterlim_compose[OF filterlim_uminus_at_top_at_bot, of "\<lambda>x. - f x" F]
       
  1452   by auto
       
  1453 
       
  1454 lemma filterlim_uminus_at_bot: "(LIM x F. f x :> at_bot) \<longleftrightarrow> (LIM x F. - (f x) :: real :> at_top)"
       
  1455   unfolding filterlim_uminus_at_top by simp
       
  1456 
       
  1457 lemma filterlim_inverse_at_top_right: "LIM x at_right (0::real). inverse x :> at_top"
       
  1458   unfolding filterlim_at_top_gt[where c=0] eventually_within at_def
  1351 proof safe
  1459 proof safe
  1352   fix Z :: real assume [arith]: "0 < Z"
  1460   fix Z :: real assume [arith]: "0 < Z"
  1353   then have "eventually (\<lambda>x. x < inverse Z) (nhds 0)"
  1461   then have "eventually (\<lambda>x. x < inverse Z) (nhds 0)"
  1354     by (auto simp add: eventually_nhds_metric dist_real_def intro!: exI[of _ "\<bar>inverse Z\<bar>"])
  1462     by (auto simp add: eventually_nhds_metric dist_real_def intro!: exI[of _ "\<bar>inverse Z\<bar>"])
  1355   then show "eventually (\<lambda>x. x \<in> {0<..} \<longrightarrow> Z \<le> inverse x) (nhds 0)"
  1463   then show "eventually (\<lambda>x. x \<in> - {0} \<longrightarrow> x \<in> {0<..} \<longrightarrow> Z \<le> inverse x) (nhds 0)"
  1356     by (auto elim!: eventually_elim1 simp: inverse_eq_divide field_simps)
  1464     by (auto elim!: eventually_elim1 simp: inverse_eq_divide field_simps)
  1357 qed
  1465 qed
  1358 
  1466 
  1359 lemma filterlim_inverse_at_top:
  1467 lemma filterlim_inverse_at_top:
  1360   "(f ---> (0 :: real)) F \<Longrightarrow> eventually (\<lambda>x. 0 < f x) F \<Longrightarrow> LIM x F. inverse (f x) :> at_top"
  1468   "(f ---> (0 :: real)) F \<Longrightarrow> eventually (\<lambda>x. 0 < f x) F \<Longrightarrow> LIM x F. inverse (f x) :> at_top"
  1361   by (intro filterlim_compose[OF filterlim_inverse_at_top_pos])
  1469   by (intro filterlim_compose[OF filterlim_inverse_at_top_right])
  1362      (simp add: filterlim_def eventually_filtermap le_within_iff)
  1470      (simp add: filterlim_def eventually_filtermap le_within_iff at_def eventually_elim1)
  1363 
  1471 
  1364 lemma filterlim_inverse_at_bot_neg:
  1472 lemma filterlim_inverse_at_bot_neg:
  1365   "LIM x (nhds 0 within {..< 0::real}). inverse x :> at_bot"
  1473   "LIM x (at_left (0::real)). inverse x :> at_bot"
  1366   unfolding filterlim_at_bot_lt[where c=0] eventually_within
  1474   by (simp add: filterlim_inverse_at_top_right filterlim_uminus_at_bot filterlim_at_left_to_right)
  1367 proof safe
       
  1368   fix Z :: real assume [arith]: "Z < 0"
       
  1369   have "eventually (\<lambda>x. inverse Z < x) (nhds 0)"
       
  1370     by (auto simp add: eventually_nhds_metric dist_real_def intro!: exI[of _ "\<bar>inverse Z\<bar>"])
       
  1371   then show "eventually (\<lambda>x. x \<in> {..< 0} \<longrightarrow> inverse x \<le> Z) (nhds 0)"
       
  1372     by (auto elim!: eventually_elim1 simp: inverse_eq_divide field_simps)
       
  1373 qed
       
  1374 
  1475 
  1375 lemma filterlim_inverse_at_bot:
  1476 lemma filterlim_inverse_at_bot:
  1376   "(f ---> (0 :: real)) F \<Longrightarrow> eventually (\<lambda>x. f x < 0) F \<Longrightarrow> LIM x F. inverse (f x) :> at_bot"
  1477   "(f ---> (0 :: real)) F \<Longrightarrow> eventually (\<lambda>x. f x < 0) F \<Longrightarrow> LIM x F. inverse (f x) :> at_bot"
  1377   by (intro filterlim_compose[OF filterlim_inverse_at_bot_neg])
  1478   unfolding filterlim_uminus_at_bot inverse_minus_eq[symmetric]
  1378      (simp add: filterlim_def eventually_filtermap le_within_iff)
  1479   by (rule filterlim_inverse_at_top) (simp_all add: tendsto_minus_cancel_left[symmetric])
  1379 
       
  1380 lemma at_top_mirror: "at_top = filtermap uminus (at_bot :: real filter)"
       
  1381   unfolding filter_eq_iff eventually_filtermap eventually_at_top_linorder eventually_at_bot_linorder
       
  1382   by (metis le_minus_iff minus_minus)
       
  1383 
       
  1384 lemma at_bot_mirror: "at_bot = filtermap uminus (at_top :: real filter)"
       
  1385   unfolding at_top_mirror filtermap_filtermap by (simp add: filtermap_ident)
       
  1386 
       
  1387 lemma filterlim_at_top_mirror: "(LIM x at_top. f x :> F) \<longleftrightarrow> (LIM x at_bot. f (-x::real) :> F)"
       
  1388   unfolding filterlim_def at_top_mirror filtermap_filtermap ..
       
  1389 
       
  1390 lemma filterlim_at_bot_mirror: "(LIM x at_bot. f x :> F) \<longleftrightarrow> (LIM x at_top. f (-x::real) :> F)"
       
  1391   unfolding filterlim_def at_bot_mirror filtermap_filtermap ..
       
  1392 
       
  1393 lemma filterlim_uminus_at_top_at_bot: "LIM x at_bot. - x :: real :> at_top"
       
  1394   unfolding filterlim_at_top eventually_at_bot_dense
       
  1395   by (metis leI minus_less_iff order_less_asym)
       
  1396 
       
  1397 lemma filterlim_uminus_at_bot_at_top: "LIM x at_top. - x :: real :> at_bot"
       
  1398   unfolding filterlim_at_bot eventually_at_top_dense
       
  1399   by (metis leI less_minus_iff order_less_asym)
       
  1400 
       
  1401 lemma filterlim_uminus_at_top: "(LIM x F. f x :> at_top) \<longleftrightarrow> (LIM x F. - (f x) :: real :> at_bot)"
       
  1402   using filterlim_compose[OF filterlim_uminus_at_bot_at_top, of f F]
       
  1403   using filterlim_compose[OF filterlim_uminus_at_top_at_bot, of "\<lambda>x. - f x" F]
       
  1404   by auto
       
  1405 
       
  1406 lemma filterlim_uminus_at_bot: "(LIM x F. f x :> at_bot) \<longleftrightarrow> (LIM x F. - (f x) :: real :> at_top)"
       
  1407   unfolding filterlim_uminus_at_top by simp
       
  1408 
  1480 
  1409 lemma tendsto_inverse_0:
  1481 lemma tendsto_inverse_0:
  1410   fixes x :: "_ \<Rightarrow> 'a\<Colon>real_normed_div_algebra"
  1482   fixes x :: "_ \<Rightarrow> 'a\<Colon>real_normed_div_algebra"
  1411   shows "(inverse ---> (0::'a)) at_infinity"
  1483   shows "(inverse ---> (0::'a)) at_infinity"
  1412   unfolding tendsto_Zfun_iff diff_0_right Zfun_def eventually_at_infinity
  1484   unfolding tendsto_Zfun_iff diff_0_right Zfun_def eventually_at_infinity
  1419     also assume *: "inverse (r / 2) \<le> norm x"
  1491     also assume *: "inverse (r / 2) \<le> norm x"
  1420     finally show "norm (inverse x) < r"
  1492     finally show "norm (inverse x) < r"
  1421       using * `0 < r` by (subst nonzero_norm_inverse) (simp_all add: inverse_eq_divide field_simps)
  1493       using * `0 < r` by (subst nonzero_norm_inverse) (simp_all add: inverse_eq_divide field_simps)
  1422   qed
  1494   qed
  1423 qed
  1495 qed
       
  1496 
       
  1497 lemma at_right_to_top: "(at_right (0::real)) = filtermap inverse at_top"
       
  1498 proof (rule antisym)
       
  1499   have "(inverse ---> (0::real)) at_top"
       
  1500     by (metis tendsto_inverse_0 filterlim_mono at_top_le_at_infinity order_refl)
       
  1501   then show "filtermap inverse at_top \<le> at_right (0::real)"
       
  1502     unfolding at_within_eq
       
  1503     by (intro le_withinI) (simp_all add: eventually_filtermap eventually_gt_at_top filterlim_def)
       
  1504 next
       
  1505   have "filtermap inverse (filtermap inverse (at_right (0::real))) \<le> filtermap inverse at_top"
       
  1506     using filterlim_inverse_at_top_right unfolding filterlim_def by (rule filtermap_mono)
       
  1507   then show "at_right (0::real) \<le> filtermap inverse at_top"
       
  1508     by (simp add: filtermap_ident filtermap_filtermap)
       
  1509 qed
       
  1510 
       
  1511 lemma eventually_at_right_to_top:
       
  1512   "eventually P (at_right (0::real)) \<longleftrightarrow> eventually (\<lambda>x. P (inverse x)) at_top"
       
  1513   unfolding at_right_to_top eventually_filtermap ..
       
  1514 
       
  1515 lemma filterlim_at_right_to_top:
       
  1516   "filterlim f F (at_right (0::real)) \<longleftrightarrow> (LIM x at_top. f (inverse x) :> F)"
       
  1517   unfolding filterlim_def at_right_to_top filtermap_filtermap ..
       
  1518 
       
  1519 lemma at_top_to_right: "at_top = filtermap inverse (at_right (0::real))"
       
  1520   unfolding at_right_to_top filtermap_filtermap inverse_inverse_eq filtermap_ident ..
       
  1521 
       
  1522 lemma eventually_at_top_to_right:
       
  1523   "eventually P at_top \<longleftrightarrow> eventually (\<lambda>x. P (inverse x)) (at_right (0::real))"
       
  1524   unfolding at_top_to_right eventually_filtermap ..
       
  1525 
       
  1526 lemma filterlim_at_top_to_right:
       
  1527   "filterlim f F at_top \<longleftrightarrow> (LIM x (at_right (0::real)). f (inverse x) :> F)"
       
  1528   unfolding filterlim_def at_top_to_right filtermap_filtermap ..
  1424 
  1529 
  1425 lemma filterlim_inverse_at_infinity:
  1530 lemma filterlim_inverse_at_infinity:
  1426   fixes x :: "_ \<Rightarrow> 'a\<Colon>{real_normed_div_algebra, division_ring_inverse_zero}"
  1531   fixes x :: "_ \<Rightarrow> 'a\<Colon>{real_normed_div_algebra, division_ring_inverse_zero}"
  1427   shows "filterlim inverse at_infinity (at (0::'a))"
  1532   shows "filterlim inverse at_infinity (at (0::'a))"
  1428   unfolding filterlim_at_infinity[OF order_refl]
  1533   unfolding filterlim_at_infinity[OF order_refl]
  1518     unfolding filterlim_at_top by auto
  1623     unfolding filterlim_at_top by auto
  1519   ultimately show "eventually (\<lambda>x. Z \<le> f x + g x) F"
  1624   ultimately show "eventually (\<lambda>x. Z \<le> f x + g x) F"
  1520     by eventually_elim simp
  1625     by eventually_elim simp
  1521 qed
  1626 qed
  1522 
  1627 
       
  1628 lemma LIM_at_top_divide:
       
  1629   fixes f g :: "'a \<Rightarrow> real"
       
  1630   assumes f: "(f ---> a) F" "0 < a"
       
  1631   assumes g: "(g ---> 0) F" "eventually (\<lambda>x. 0 < g x) F"
       
  1632   shows "LIM x F. f x / g x :> at_top"
       
  1633   unfolding divide_inverse
       
  1634   by (rule filterlim_tendsto_pos_mult_at_top[OF f]) (rule filterlim_inverse_at_top[OF g])
       
  1635 
  1523 lemma filterlim_at_top_add_at_top: 
  1636 lemma filterlim_at_top_add_at_top: 
  1524   assumes f: "LIM x F. f x :> at_top"
  1637   assumes f: "LIM x F. f x :> at_top"
  1525   assumes g: "LIM x F. g x :> at_top"
  1638   assumes g: "LIM x F. g x :> at_top"
  1526   shows "LIM x F. (f x + g x :: real) :> at_top"
  1639   shows "LIM x F. (f x + g x :: real) :> at_top"
  1527   unfolding filterlim_at_top_gt[where c=0]
  1640   unfolding filterlim_at_top_gt[where c=0]
  1571   then show "eventually (\<lambda>n. y \<le> norm (x ^ n)) sequentially"
  1684   then show "eventually (\<lambda>n. y \<le> norm (x ^ n)) sequentially"
  1572     unfolding eventually_sequentially
  1685     unfolding eventually_sequentially
  1573     by (auto simp: norm_power)
  1686     by (auto simp: norm_power)
  1574 qed simp
  1687 qed simp
  1575 
  1688 
  1576 subsection {* Relate @{const at}, @{const at_left} and @{const at_right} *}
       
  1577 
       
  1578 text {*
       
  1579 
       
  1580 This lemmas are useful for conversion between @{term "at x"} to @{term "at_left x"} and
       
  1581 @{term "at_right x"} and also @{term "at_right 0"}.
       
  1582 
       
  1583 *}
       
  1584 
       
  1585 lemma at_eq_sup_left_right: "at (x::real) = sup (at_left x) (at_right x)"
       
  1586   by (auto simp: eventually_within at_def filter_eq_iff eventually_sup 
       
  1587            elim: eventually_elim2 eventually_elim1)
       
  1588 
       
  1589 lemma filterlim_split_at_real:
       
  1590   "filterlim f F (at_left x) \<Longrightarrow> filterlim f F (at_right x) \<Longrightarrow> filterlim f F (at (x::real))"
       
  1591   by (subst at_eq_sup_left_right) (rule filterlim_sup)
       
  1592 
       
  1593 lemma filtermap_nhds_shift: "filtermap (\<lambda>x. x - d) (nhds a) = nhds (a - d::real)"
       
  1594   unfolding filter_eq_iff eventually_filtermap eventually_nhds_metric
       
  1595   by (intro allI ex_cong) (auto simp: dist_real_def field_simps)
       
  1596 
       
  1597 lemma filtermap_nhds_minus: "filtermap (\<lambda>x. - x) (nhds a) = nhds (- a::real)"
       
  1598   unfolding filter_eq_iff eventually_filtermap eventually_nhds_metric
       
  1599   apply (intro allI ex_cong)
       
  1600   apply (auto simp: dist_real_def field_simps)
       
  1601   apply (erule_tac x="-x" in allE)
       
  1602   apply simp
       
  1603   done
       
  1604 
       
  1605 lemma filtermap_at_shift: "filtermap (\<lambda>x. x - d) (at a) = at (a - d::real)"
       
  1606   unfolding at_def filtermap_nhds_shift[symmetric]
       
  1607   by (simp add: filter_eq_iff eventually_filtermap eventually_within)
       
  1608 
       
  1609 lemma filtermap_at_right_shift: "filtermap (\<lambda>x. x - d) (at_right a) = at_right (a - d::real)"
       
  1610   unfolding filtermap_at_shift[symmetric]
       
  1611   by (simp add: filter_eq_iff eventually_filtermap eventually_within)
       
  1612 
       
  1613 lemma at_right_to_0: "at_right (a::real) = filtermap (\<lambda>x. x + a) (at_right 0)"
       
  1614   using filtermap_at_right_shift[of "-a" 0] by simp
       
  1615 
       
  1616 lemma filterlim_at_right_to_0:
       
  1617   "filterlim f F (at_right (a::real)) \<longleftrightarrow> filterlim (\<lambda>x. f (x + a)) F (at_right 0)"
       
  1618   unfolding filterlim_def filtermap_filtermap at_right_to_0[of a] ..
       
  1619 
       
  1620 lemma eventually_at_right_to_0:
       
  1621   "eventually P (at_right (a::real)) \<longleftrightarrow> eventually (\<lambda>x. P (x + a)) (at_right 0)"
       
  1622   unfolding at_right_to_0[of a] by (simp add: eventually_filtermap)
       
  1623 
       
  1624 lemma filtermap_at_minus: "filtermap (\<lambda>x. - x) (at a) = at (- a::real)"
       
  1625   unfolding at_def filtermap_nhds_minus[symmetric]
       
  1626   by (simp add: filter_eq_iff eventually_filtermap eventually_within)
       
  1627 
       
  1628 lemma at_left_minus: "at_left (a::real) = filtermap (\<lambda>x. - x) (at_right (- a))"
       
  1629   by (simp add: filter_eq_iff eventually_filtermap eventually_within filtermap_at_minus[symmetric])
       
  1630 
       
  1631 lemma at_right_minus: "at_right (a::real) = filtermap (\<lambda>x. - x) (at_left (- a))"
       
  1632   by (simp add: filter_eq_iff eventually_filtermap eventually_within filtermap_at_minus[symmetric])
       
  1633 
       
  1634 lemma filterlim_at_left_to_right:
       
  1635   "filterlim f F (at_left (a::real)) \<longleftrightarrow> filterlim (\<lambda>x. f (- x)) F (at_right (-a))"
       
  1636   unfolding filterlim_def filtermap_filtermap at_left_minus[of a] ..
       
  1637 
       
  1638 lemma eventually_at_left_to_right:
       
  1639   "eventually P (at_left (a::real)) \<longleftrightarrow> eventually (\<lambda>x. P (- x)) (at_right (-a))"
       
  1640   unfolding at_left_minus[of a] by (simp add: eventually_filtermap)
       
  1641 
       
  1642 lemma filterlim_at_split:
       
  1643   "filterlim f F (at (x::real)) \<longleftrightarrow> filterlim f F (at_left x) \<and> filterlim f F (at_right x)"
       
  1644   by (subst at_eq_sup_left_right) (simp add: filterlim_def filtermap_sup)
       
  1645 
       
  1646 lemma eventually_at_split:
       
  1647   "eventually P (at (x::real)) \<longleftrightarrow> eventually P (at_left x) \<and> eventually P (at_right x)"
       
  1648   by (subst at_eq_sup_left_right) (simp add: eventually_sup)
       
  1649 
       
  1650 end
  1689 end
  1651 
  1690