Datasets:
AI4M
/

text
stringlengths
0
3.34M
f (1)
#include <boost/function.hpp> #include <iostream> struct world { void hello(std::ostream &os) { os << "Hello, world!" << std::endl; } }; int main() { boost::function<void (world*, std::ostream&)> f = &world::hello; world w; f(&w, boost::ref(std::cout)); }
State Before: ι : Type u_1 I J J₁ J₂ : Box ι π π₁ π₂ : Prepartition I x : ι → ℝ h : J ≤ I ⊢ Prepartition.iUnion (single I J h) = ↑J State After: no goals Tactic: simp [iUnion_def]
function vl_test_print(varargin) addpath(fullfile(vl_rootnn(), 'examples', 'mnist')); net = cnn_mnist_init('networkType', 'dagnn'); net.print(varargin{:}); end
State Before: C : Type u₁ inst✝² : Category C D : Type u₂ inst✝¹ : Category D E : Type u₃ inst✝ : Category E F G : C ⥤ D X Y Z : C f : X ⟶ Y g : Y ⟶ Z H : D ⥤ E hobj : ∀ (X : C), F.obj X = G.obj X hmap : ∀ {X Y : C} (f : X ⟶ Y), HEq (F.map f) (G.map f) ⊢ HEq ((F ⋙ H).map f) ((G ⋙ H).map f) State After: no goals Tactic: rw [Functor.hext hobj fun _ _ => hmap]
[STATEMENT] lemma logic_actual_nec_1[axiom]: "[[\<^bold>\<A>\<^bold>\<not>\<phi> \<^bold>\<equiv> \<^bold>\<not>\<^bold>\<A>\<phi>]]" [PROOF STATE] proof (prove) goal (1 subgoal): 1. [[\<^bold>\<A>\<^bold>\<not>\<phi> \<^bold>\<equiv> \<^bold>\<not>\<^bold>\<A>\<phi>]] [PROOF STEP] by axiom_meta_solver
!> This module contains global parameters used by other modules !! Parameters that go into this module should be general enough to apply to any module !! Example taken from https://github.com/wawiesel/Testing123 !! Include files in fortran should have suffix *.in INTEGER, PARAMETER :: I_Kind=8 INTEGER, PARAMETER :: R_Kind=8
import LMT variable {I} [Nonempty I] {E} [Nonempty E] [Nonempty (A I E)] example {a1 a2 a3 : A I E} : (((((a3).write i3 ((a2).read i1)).write i1 (v2)).write i3 (v2)).read i1) ≠ (v2) → False := by arr
lemma iff_trans (P Q R : Prop) : (P ↔ Q) → (Q ↔ R) → (P ↔ R) := begin intro h1, cases h1, intro h2, cases h2, split, intro p, exact h2_mp(h1_mp(p)), intro r, exact h1_mpr(h2_mpr(r)), end
%% Copyright (C) 2014, 2016, 2018-2019 Colin B. Macdonald %% Copyright (C) 2016 Lagu %% %% This file is part of OctSymPy. %% %% OctSymPy is free software; you can redistribute it and/or modify %% it under the terms of the GNU General Public License as published %% by the Free Software Foundation; either version 3 of the License, %% or (at your option) any later version. %% %% This software is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied warranty %% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See %% the GNU General Public License for more details. %% %% You should have received a copy of the GNU General Public %% License along with this software; see the file COPYING. %% If not, see <http://www.gnu.org/licenses/>. %% -*- texinfo -*- %% @documentencoding UTF-8 %% @defmethod @@sym real (@var{z}) %% Real part of a symbolic expression. %% %% Examples: %% @example %% @group %% syms z %% real(z) %% @result{} ans = (sym) re(z) %% @end group %% %% @group %% syms x real %% real(x) %% @result{} ans = (sym) x %% %% real([x sym(pi) + 6i 7 3i]) %% @result{} ans = (sym) [x π 7 0] (1×4 matrix) %% @end group %% @end example %% %% @seealso{@@sym/imag, @@sym/conj, @@sym/ctranspose} %% @end defmethod function y = real(z) if (nargin ~= 1) print_usage (); end y = elementwise_op ('re', z); end %!assert (isequal (real (sym (4) + 3i),4)) %!test %! syms x y real %! z = x + 1i*y; %! assert (isequal (real (z),x)) %!test %! syms x y real %! Z = [4 x + 1i*y; x 4 + 3i]; %! assert (isequal (real (Z),[4 x; x 4])) %!test %! syms x real %! d = exp (x*i); %! assert (isequal (real (d), cos (x))) %!test %! % round trip %! syms x %! d = 3 - 5i; %! f = real (x); %! A = real (d); %! h = function_handle (f); %! B = h (d); %! assert (A, B)
I know I've been absent lately, but tonight I need to ask a favor of you. Please, if you're the praying kind, say a prayer for my family tonight - especially my brother, Ian. And if praying isn't your cup of tea, I'd greatly appreciate good vibes and peace as well. We're all a little shaken. We're all hurting tonight. I'll share details later this week. Done! I hope everything is OK. Hugs to you and your family. I saw your tweets this afternoon. Thinking about you!
lemmas scaleR_cancel_left = real_vector.scale_cancel_left
The ultimate aim is peace and there is a serious chance of success .
-- Hartogs's theorem for two variables: separately analytic functions are jointly analytic -- https://en.wikipedia.org/wiki/Hartogs's_theorem_on_separate_holomorphicity -- https://www-users.cse.umn.edu/~garrett/m/complex/hartogs.pdf import analysis.calculus.parametric_interval_integral import analysis.complex.schwarz import analysis.normed.group.basic import analysis.normed_space.multilinear import data.real.pi.bounds import data.set.function import measure_theory.measure.measure_space_def import topology.algebra.module.multilinear import topology.metric_space.baire import analytic import bounds import max_log import multilinear import osgood import prod import simple import subharmonic import tactics import topology open complex (abs exp I log) open filter (at_top) open function (curry uncurry) open linear_order (min) open measure_theory.measure_space (volume) open metric (ball closed_ball sphere bounded is_open_ball) open prod (swap) open topological_space (second_countable_topology) open_locale real nnreal ennreal topological_space noncomputable theory section hartogs variables {E : Type} [normed_add_comm_group E] [normed_space ℂ E] [complete_space E] [second_countable_topology E] variable {f : ℂ × ℂ → E} variable {s : set (ℂ × ℂ)} variables {c0 c0' c1 z0 z1 w0 w1 : ℂ} variables {r r0 r1 b e : ℝ} structure har (f : ℂ × ℂ → E) (s : set (ℂ × ℂ)) : Prop := (fa0 : ∀ (c0 c1), (c0,c1) ∈ s → analytic_at ℂ (λ z0, f (z0,c1)) c0) (fa1 : ∀ (c0 c1), (c0,c1) ∈ s → analytic_at ℂ (λ z1, f (c0,z1)) c1) def har.flip (h : har f s) : har (f ∘ swap) (swap '' s) := { fa0 := begin intros c0 c1 cs, simp, rw swap_mem at cs, exact h.fa1 c1 c0 cs end, fa1 := begin intros c0 c1 cs, simp, rw swap_mem at cs, exact h.fa0 c1 c0 cs end, } lemma har.mono {s t : set (ℂ × ℂ)} (ts : t ⊆ s) (h : har f s) : har f t := { fa0 := λ c0 c1 m, h.fa0 _ _ (ts m), fa1 := λ c0 c1 m, h.fa1 _ _ (ts m), } lemma har.on0 (h : har f (closed_ball (c0,c1) r)) (rp : r > 0) (z1r : z1 ∈ closed_ball c1 r) : analytic_on ℂ (λ z0, f (z0,z1)) (closed_ball c0 r) := begin intros z0 z0s, apply h.fa0 z0 z1, rw ←closed_ball_prod_same, simp at ⊢ z0s, exact ⟨z0s,z1r⟩ end lemma har.on1 (h : har f (closed_ball (c0,c1) r)) (rp : r > 0) (z0r : z0 ∈ closed_ball c0 r) : analytic_on ℂ (λ z1, f (z0,z1)) (closed_ball c1 r) := begin intros z1 z1s, apply h.fa1 z0 z1, rw ←closed_ball_prod_same, simp at ⊢ z1s, exact ⟨z0r,z1s⟩ end lemma bounded.dist0 (h : har f s) {z w : ℂ × ℂ} {b e r : ℝ} (bp : b > 0) (ep : e > 0) (rp : r > 0) (rs : ball z (r/2) ⊆ s) (zs : z ∈ s) (wz : dist w z < min (r/2) (e*r/b/24)) (fb : ∀ z, z ∈ s → ∥f z∥ ≤ b) : dist (f w) (f (z.fst,w.snd)) ≤ e/4 := begin generalize hu : min (r/2) (e*r/b/24) = u, rw hu at wz, have up : u > 0, { rw ←hu, simp, exact ⟨by bound [h.rp], by bound [h.rp]⟩ }, have ur : u ≤ r/2, { rw ←hu, exact min_le_left _ _ }, have ue : 6 * b / r * u ≤ e/4, { rw ←hu, calc 6*b/r * min (r/2) (e*r/b/24) ≤ 6*b/r * (e*r/b/24) : by bound [bp, rp, min_le_right] ... = (b/b) * (r/r) * (e/4) : by ring ... = e/4 : by field_simp [ne_of_gt bp, ne_of_gt rp] }, rw ball_prod_same' at rs, rw [←metric.mem_ball, ball_prod_same', set.mem_prod] at wz, have d : differentiable_on ℂ (λ t, f (t,w.snd)) (ball z.fst (r/2)), { intros t ts, refine (h.fa0 t w.snd _).differentiable_within_at, exact rs (set.mk_mem_prod ts (metric.ball_subset_ball ur wz.right)) }, have wf : w.fst ∈ ball z.fst (r/2) := metric.ball_subset_ball ur wz.left, have m : set.maps_to (λ t, f (t,w.snd)) (ball z.fst (r/2)) (ball (f (z.fst,w.snd)) (3*b)), { intros t ts, simp [dist_eq_norm], apply lt_of_le_of_lt (norm_sub_le _ _), have f0 : ∥f (t, w.snd)∥ ≤ b := by apply_rules [rs, set.mk_mem_prod, metric.ball_subset_ball ur, fb, wz.right], have f1 : ∥f (z.fst, w.snd)∥ ≤ b := by apply_rules [rs, set.mk_mem_prod, metric.ball_subset_ball ur, fb, metric.mem_ball_self up, wz.right], calc ∥f (t, w.snd)∥ + ∥f (z.fst, w.snd)∥ ≤ b + b : by bound ... = 2*b : by ring ... < 3*b : mul_lt_mul_of_pos_right (by norm_num) bp }, have L := complex.dist_le_div_mul_dist_of_maps_to_ball d m wf, simp at L, refine trans L (trans _ ue), simp at wz, rw [div_eq_mul_inv _ (2 : ℝ), div_mul_eq_div_div], ring_nf, bound [h.rp, wz.left] end lemma bounded.dist1 (h : har f s) {z w : ℂ × ℂ} {b e r : ℝ} (bp : b > 0) (ep : e > 0) (rp : r > 0) (rs : ball z r ⊆ s) (zs : z ∈ s) (wz : dist w z < min (r/2) (e*r/b/24)) (fb : ∀ z, z ∈ s → ∥f z∥ ≤ b) : dist (f (z.fst,w.snd)) (f z) ≤ e/4 := begin have wrs : ball w (r/2) ⊆ s, { refine trans _ rs, apply metric.ball_subset_ball', have rr := trans (le_of_lt wz) (min_le_left _ _), transitivity (r/2)+(r/2), bound, ring_nf }, have ws : w ∈ s := wrs (metric.mem_ball_self (by bound)), have rs' : ball (swap w) (r/2) ⊆ swap '' s, { rw ball_swap, exact set.image_subset _ wrs }, have zs' : swap w ∈ swap '' s, { rw swap_mem', simpa }, have wz' : dist (swap z) (swap w) < min (r/2) (e*r/b/24) := by rwa [dist_swap, dist_comm], have fb' : ∀ z, z ∈ swap '' s → ∥(f ∘ swap) z∥ ≤ b := λ z zs, fb z.swap (swap_mem'.mp zs), have d' := bounded.dist0 h.flip bp ep rp rs' zs' wz' fb', simp at d', rwa dist_comm end -- f is analytic if it's bounded lemma of_bounded (h : har f s) (o : is_open s) {b : ℝ} (fb : ∀ z, z ∈ s → ∥f z∥ ≤ b) : analytic_on ℂ f s := begin suffices c : continuous_on f s, exact osgood o c h.fa0 h.fa1, by_cases bp : b ≤ 0, { have fz : ∀ z, z ∈ s → f z = 0 := λ z zs, norm_eq_zero.mp (le_antisymm (trans (fb z zs) bp) (norm_nonneg (f z))), rw continuous_on_congr fz, exact continuous_on_const, }, simp at bp, intros z zs, rcases metric.is_open_iff.mp o z zs with ⟨r,rp,rs⟩, rw metric.continuous_within_at_iff, intros e ep, have up : min (r/2) (e*r/b/24) > 0 := by bound [lt_min, h.rp], existsi (min (r/2) (e*r/b/24)), existsi up, intros w ws wz, have s0 : dist (f w) (f (z.fst,w.snd)) ≤ e/4 := bounded.dist0 h bp ep rp (trans (metric.ball_subset_ball (by bound)) rs) zs wz fb, have s1 : dist (f (z.fst,w.snd)) (f z) ≤ e/4 := bounded.dist1 h bp ep rp rs zs wz fb, calc dist (f w) (f z) ≤ dist (f w) (f (z.fst,w.snd)) + dist (f (z.fst,w.snd)) (f z) : dist_triangle _ _ _ ... ≤ e/4 + e/4 : by bound ... = e/2 : by ring ... < e : by bound end -- I'm finding it very difficult to work with subtypes (sets coerced to Sort), so I'm going to instead -- prove one of the variants of Baire's theorem for an open set lemma nonempty_interior.nonempty_interior_of_Union_of_closed {A B : Type} [topological_space A] [baire_space A] [nonempty A] [encodable B] {f : B → set A} (hc : ∀ k, is_closed (f k)) (hU : (interior ⋃ k, f k).nonempty) : ∃ k, (interior (f k)).nonempty := begin set s := interior ⋃ k, f k, set f' : option B → set A := λ k, match k with none := sᶜ | some k := f k end, have hc' : ∀ k, is_closed (f' k), { rw option.forall, exact ⟨is_open_interior.is_closed_compl, λ k, hc k⟩ }, have hU' : (⋃ k, f' k) = set.univ, { apply set.ext, intro x, refine ⟨(λ _, set.mem_univ _), _⟩, intro xu, rw set.mem_Union, by_cases m : x ∈ s, { rcases set.mem_Union.mp (interior_subset m) with ⟨k,mk⟩, existsi some k, simpa }, { existsi none, simpa } }, have d := dense_Union_interior_of_closed hc' hU', rcases dense.exists_mem_open d is_open_interior hU with ⟨x,xi,xs⟩, rcases set.mem_Union.mp xi with ⟨k,xk⟩, induction k with k, { have xc := subset_closure xs, finish }, { exact ⟨k,set.nonempty_of_mem xk⟩ } end -- Special case of forall_and_distrib lemma forall_const_and_distrib {A : Type} [nonempty A] {p : Prop} {q : A → Prop} : (∀ x, p ∧ q x) ↔ p ∧ ∀ x, q x := begin have d := @forall_and_distrib A (λ _, p) q, simp at d, exact d end -- Version of is_closed_le for continuous_on lemma continuous_on.is_closed_le {A B : Type} [topological_space A] [topological_space B] [preorder B] [order_closed_topology B] {s : set A} {f g : A → B} (sc : is_closed s) (fc : continuous_on f s) (gc : continuous_on g s) : is_closed {x | x ∈ s ∧ f x ≤ g x} := begin rw set.set_of_and, simp, set t := {p : B × B | p.fst ≤ p.snd}, set fg := λ x, (f x, g x), have e : {x | f x ≤ g x} = fg⁻¹' t, { apply set.ext, intro x, simp }, rw e, exact continuous_on.preimage_closed_of_closed (continuous_on.prod fc gc) sc order_closed_topology.is_closed_le', end -- If f is separately analytic on a polydisk, it is analytic on a subpolydisk that is full in one dimension lemma on_subdisk (h : har f (closed_ball (c0,c1) r)) (rp : r > 0) (ep : e > 0) : ∃ c0' t, t > 0 ∧ c0' ∈ closed_ball c0 e ∧ analytic_on ℂ f (ball c0' t ×ˢ ball c1 r) := begin set re := min r e, have esub : closed_ball c0 re ⊆ closed_ball c0 r := metric.closed_ball_subset_closed_ball (by bound), generalize hS : (λ b : ℕ, {z0 | z0 ∈ closed_ball c0 re ∧ ∀ z1, z1 ∈ closed_ball c1 r → ∥f (z0,z1)∥ ≤ b}) = S, have hc : ∀ b, is_closed (S b), { intro b, rw ←hS, simp only [←forall_const_and_distrib], rw set.set_of_forall, apply is_closed_Inter, intro z1, by_cases z1r : z1 ∉ closed_ball c1 r, { simp only [z1r, false_implies_iff, and_true, set.set_of_mem_eq, metric.is_closed_ball] }, { rw set.not_not_mem at z1r, simp only [z1r, true_implies_iff], refine continuous_on.is_closed_le metric.is_closed_ball _ continuous_on_const, apply continuous_on.norm, exact continuous_on.mono (h.on0 rp z1r).continuous_on esub } }, have hU : (interior ⋃ b, S b).nonempty, { refine set.nonempty_of_mem (mem_interior.mpr ⟨ball c0 re, _, metric.is_open_ball, metric.mem_ball_self (by bound)⟩), rw set.subset_def, intros z0 z0s, rw set.mem_Union, have z0s' := esub (mem_open_closed z0s), rcases (h.on1 rp z0s').continuous_on.bounded_norm (is_compact_closed_ball _ _) with ⟨b,bp,fb⟩, existsi nat.ceil b, rw ←hS, simp only [set.mem_set_of], refine ⟨mem_open_closed z0s, _⟩, simp at ⊢ fb, intros z1 z1r, exact trans (fb z1 z1r) (nat.le_ceil _), }, rcases nonempty_interior.nonempty_interior_of_Union_of_closed hc hU with ⟨b,bi⟩, simp at bi, rcases bi with ⟨c0',c0's⟩, existsi c0', rcases mem_interior.mp c0's with ⟨s',s's,so,c0s'⟩, rcases metric.is_open_iff.mp so c0' c0s' with ⟨t,tp,ts⟩, have tr : ball c0' t ⊆ closed_ball c0 re, { rw set.subset_def, intros z0 z0t, have z0b := trans ts s's z0t, rw ←hS at z0b, simp only [set.set_of_and, set.set_of_mem_eq, set.mem_inter_iff] at z0b, exact z0b.left, }, have c0e : c0' ∈ closed_ball c0 e := trans tr (metric.closed_ball_subset_closed_ball (by bound)) (metric.mem_ball_self tp), have fb : ∀ z, z ∈ ball c0' t ×ˢ ball c1 r → ∥f z∥ ≤ b, { intros z zs, rw set.mem_prod at zs, have zb := trans ts s's zs.left, rw ←hS at zb, simp at zb zs, have zb' := zb.right z.snd (le_of_lt zs.right), simp at zb', assumption, }, existsi t, refine ⟨tp,c0e,_⟩, refine of_bounded (h.mono _) (is_open.prod is_open_ball is_open_ball) fb, rw ←closed_ball_prod_same, exact set.prod_mono (trans tr esub) metric.ball_subset_closed_ball end -- Separate analyticity on a polydisk, full analyticity on a polydisk smaller in one direction structure uneven (f : ℂ × ℂ → E) (c0 c1 : ℂ) (r0 r1 : ℝ) : Prop := (r0p : r0 > 0) (r1p : r1 > 0) (r01 : r0 ≤ r1) (h : har f (closed_ball (c0,c1) r1)) (a : analytic_on ℂ f (ball c0 r0 ×ˢ ball c1 r1)) -- Exact diameter of complex ball lemma diam_ball_eq {c : ℂ} {r : ℝ} (rp : r ≥ 0) : metric.diam (ball c r) = 2*r := begin by_cases r0 : 0 = r, { rw ←r0, simp }, have rp' := ne.lt_of_le r0 rp, clear r0, apply le_antisymm (metric.diam_ball rp), apply le_of_forall_small_le_add rp', intros e ep er, have m : ∀ t : ℝ, |t| ≤ 1 → c + t*(r - e/2) ∈ ball c r, { intros t t1, simp [complex.dist_eq], have re : r - e/2 ≥ 0 := by bound [trans (half_lt_self ep) er], calc |t| * abs (↑r - ↑e/2 : ℂ) = |t| * abs (↑(r - e/2) : ℂ) : by simp ... = |t| * (r - e/2) : by rw [complex.abs_of_real, abs_of_nonneg re] ... ≤ 1 * (r - e/2) : by bound ... = r - e/2 : by ring ... < r - 0 : sub_lt_sub_left (by bound) r ... = r : by ring }, have lo := metric.dist_le_diam_of_mem metric.bounded_ball (m 1 (by norm_num)) (m (-1) (by norm_num)), have e : abs (2*↑r - ↑e : ℂ) = 2*r - e, { have re : 2*r - e ≥ 0, { transitivity r - e, bound, transitivity 1 * r, simp, bound, bound }, calc abs (2*↑r - ↑e : ℂ) = abs (↑(2*r - e) : ℂ) : by simp ... = 2*r - e : by rw [complex.abs_of_real, abs_of_nonneg re] }, simp [complex.dist_eq] at lo, ring_nf at lo, rw e at lo, linarith end -- Exact diameter of complex closed ball lemma diam_closed_ball_eq {c : ℂ} {r : ℝ} (rp : r ≥ 0) : metric.diam (closed_ball c r) = 2*r := begin apply le_antisymm (metric.diam_closed_ball rp), transitivity metric.diam (ball c r), rw diam_ball_eq rp, exact metric.diam_mono metric.ball_subset_closed_ball metric.bounded_closed_ball end lemma le_of_ball_subset_closed_ball {z0 z1 : ℂ} {r0 r1 : ℝ} (r0p : r0 ≥ 0) (r1p : r1 ≥ 0) : ball z0 r0 ⊆ closed_ball z1 r1 → r0 ≤ r1 := begin intro s, have m := metric.diam_mono s metric.bounded_closed_ball, rw [diam_ball_eq r0p, diam_closed_ball_eq r1p] at m, linarith, end -- Given separate analyticity on a polydisk, find an uneven subpolydisk s.t. fixing the unevenness covers the center lemma to_uneven (h : har f (closed_ball (c0,c1) r)) (rp : r > 0) : ∃ c0' r0 r1, ball c0' r1 ⊆ closed_ball c0 r ∧ c0 ∈ ball c0' r1 ∧ uneven f c0' c1 r0 r1 := begin have r4p : r/4 > 0 := by bound, rcases on_subdisk h rp r4p with ⟨c0',r0,r0p,m,a⟩, simp at m, have sub : closed_ball c0' (r/2) ⊆ closed_ball c0 r, { apply metric.closed_ball_subset_closed_ball', calc r/2 + dist c0' c0 ≤ r/2 + r/4 : by bound ... = (3/4)*r : by ring ... ≤ 1*r : by bound ... = r : by ring }, have r01 : min r0 (r/2) ≤ r/2 := by bound, have c0m : c0 ∈ ball c0' (r/2), { simp, rw dist_comm, apply lt_of_le_of_lt m, bound [div_lt_div_of_lt_left] }, have h' : har f (closed_ball (c0',c1) (r/2)), { refine har.mono _ h, simp only [←closed_ball_prod_same], apply set.prod_mono, assumption, apply metric.closed_ball_subset_closed_ball, bound }, have a' : analytic_on ℂ f (ball c0' (min r0 (r/2)) ×ˢ ball c1 (r/2)), { apply a.mono, apply set.prod_mono, apply metric.ball_subset_ball', simp, apply metric.ball_subset_ball, bound, }, use [c0', min r0 (r/2), r/2, trans (metric.ball_subset_closed_ball) sub, c0m], exact { r0p := by bound, r1p := by bound, r01 := r01, h := h', a := a', }, end def uneven_term' (u : uneven f c0 c1 r0 r1) (r : ℝ) (z1 : ℂ) (n : ℕ) : E := (2*π*I : ℂ)⁻¹ • ∮ z0 in C(c0, r), (z0 - c0)⁻¹^n • (z0 - c0)⁻¹ • f (z0,z1) def uneven_term (u : uneven f c0 c1 r0 r1) := uneven_term' u r1 def uneven_series' (u : uneven f c0 c1 r0 r1) (r : ℝ) (z1 : ℂ) : formal_multilinear_series ℂ ℂ E := λ n, continuous_multilinear_map.mk_pi_field ℂ _ (uneven_term' u r z1 n) def uneven_series (u : uneven f c0 c1 r0 r1) := uneven_series' u r1 lemma uneven_series_apply (u : uneven f c0 c1 r0 r1) (r : ℝ) (z1 : ℂ) (n : ℕ) : uneven_series' u r z1 n (λ _, 1) = uneven_term' u r z1 n := begin rw [uneven_series', continuous_multilinear_map.mk_pi_field_apply], simp end lemma uneven_is_cauchy {u : uneven f c0 c1 r0 r1} {r : ℝ} : uneven_series' u r z1 = cauchy_power_series (λ z0, f (z0,z1)) c0 r := begin funext, rw [uneven_series', cauchy_power_series], refl, end lemma uneven.has_series (u : uneven f c0 c1 r0 r1) {s : ℝ} (sp : s > 0) (sr1 : s ≤ r1) (z1s : z1 ∈ closed_ball c1 r1) : has_fpower_series_on_ball (λ z0, f (z0,z1)) (uneven_series' u s z1) c0 (ennreal.of_real s) := begin set sn := s.to_nnreal, have sns : s = sn, { rw real.coe_to_nnreal', simp [le_of_lt sp] }, have snp : sn > 0 := real.to_nnreal_pos.mpr sp, rw uneven_is_cauchy, rw [sns, ←ennreal.coe_nnreal_eq], refine differentiable_on.has_fpower_series_on_ball _ snp, rw ←sns, refine differentiable_on.mono _ (metric.closed_ball_subset_closed_ball sr1), exact analytic_on.differentiable_on (u.h.on0 u.r1p z1s), end lemma uneven_term_eq (u : uneven f c0 c1 r0 r1) {r : ℝ} (rp : r > 0) (rr1 : r ≤ r1) {z1 : ℂ} : z1 ∈ closed_ball c1 r1 → uneven_term' u r z1 = uneven_term u z1 := begin intro z1s, funext, have p0 := u.has_series rp rr1 z1s, have p1 := u.has_series u.r1p (by refl) z1s, have h := has_fpower_series_at.eq_formal_multilinear_series p0.has_fpower_series_at p1.has_fpower_series_at, clear p0 p1, simp only [uneven_term, ←uneven_series_apply], rwa h, end lemma uneven_series_eq (u : uneven f c0 c1 r0 r1) {r : ℝ} (rp : r > 0) (rr1 : r ≤ r1) {z1 : ℂ} : z1 ∈ closed_ball c1 r1 → uneven_series' u r z1 = uneven_series u z1 := begin intro z1s, funext, simp_rw [uneven_series, uneven_series', uneven_term_eq u rp rr1 z1s, uneven_term_eq u u.r1p (le_refl _) z1s], end lemma uneven_series_norm (u : uneven f c0 c1 r0 r1) {n : ℕ} : ∥uneven_series u z1 n∥ = ∥uneven_term u z1 n∥ := by rw [uneven_series, uneven_series', uneven_term, continuous_multilinear_map.norm_mk_pi_field] -- Our power series terms are uniformly bounded (away from the edges) lemma uneven_series_uniform_bound (u : uneven f c0 c1 r0 r1) {s : ℝ} (sp : s > 0) (sr : s < r1) : ∃ c a : ℝ, c > 0 ∧ a > 0 ∧ ∀ n z1, z1 ∈ closed_ball c1 s → ∥uneven_series u z1 n∥ ≤ c * a^n := begin have fc : continuous_on f (sphere c0 (r0/2) ×ˢ closed_ball c1 s), { suffices fa' : analytic_on ℂ f (sphere c0 (r0/2) ×ˢ closed_ball c1 s), exact fa'.continuous_on, refine u.a.mono (set.prod_mono _ _), have rh : r0/2 < r0 := by bound [u.r0p], exact trans metric.sphere_subset_closed_ball (metric.closed_ball_subset_ball rh), exact metric.closed_ball_subset_ball (by bound [u.r1p]), }, rcases fc.bounded_norm (is_compact.prod (is_compact_sphere _ _) (is_compact_closed_ball _ _)) with ⟨b,bp,fb⟩, use [b + 1, (r0/2)⁻¹, lt_of_le_of_lt bp (lt_add_one _), by bound [u.r0p]], intros n z1 z1s, have r0hp : r0 / 2 > 0 := by bound [u.r0p], have r0hr1 : r0 / 2 ≤ r1 := trans (by bound [u.r0p]) u.r01, set g := λ z0, f (z0,z1), have gc : continuous_on g (sphere c0 (r0/2)) := continuous_on.comp fc (continuous_on.prod continuous_on_id continuous_on_const) (λ z0 z0s, set.mk_mem_prod z0s z1s), have gb : ∀ z0, z0 ∈ sphere c0 (r0/2) → ∥g z0∥ ≤ b := λ z0 z0s, fb (z0,z1) (set.mk_mem_prod z0s z1s), have cb := cauchy1_bound' r0hp bp gc gb n, clear bp gc gb, have e : (2*π*I : ℂ)⁻¹ • ∮ z0 in C(c0, r0/2), (z0 - c0)⁻¹^n • (z0 - c0)⁻¹ • g z0 = uneven_term' u (r0/2) z1 n := rfl, rw e at cb, clear e g, rw uneven_term_eq u r0hp r0hr1 (metric.closed_ball_subset_closed_ball (le_of_lt sr) z1s) at cb, rwa uneven_series_norm u, apply trans cb, bound [le_of_lt (lt_add_one b)], end -- Our power series terms are nonuniformly bounded as O(s⁻¹^n) for any s < r1 lemma uneven_series_nonuniform_bound (u : uneven f c0 c1 r0 r1) {s : ℝ} (sp : s > 0) (sr1 : s < r1) (z1s : z1 ∈ closed_ball c1 r1) : ∃ c : ℝ, c > 0 ∧ ∀ n, ∥uneven_series u z1 n∥ ≤ c * s⁻¹^n := begin have h := (uneven.has_series u u.r1p (le_refl _) z1s).r_le, rw [formal_multilinear_series.radius, le_supr_iff] at h, have sr := not_le_of_lt ((ennreal.of_real_lt_of_real_iff_of_nonneg (le_of_lt sp)).mpr sr1), specialize h (ennreal.of_real s), rw imp_iff_not sr at h, simp only [not_forall, not_le, lt_supr_iff] at h, rcases h with ⟨t,c,th,st⟩, have st' : s < ↑t, { rw [←ennreal.of_real_coe_nnreal, ennreal.of_real_lt_of_real_iff_of_nonneg (le_of_lt sp)] at st, exact st, }, have cp : c ≥ 0 := trans (th 0) (by bound), use [max 1 c, lt_of_lt_of_le (by norm_num) (le_max_left 1 c)], intro n, specialize th n, rw uneven_series_eq u u.r1p (le_refl _) z1s at th, generalize hy : ∥uneven_series u z1 n∥ = y, rw hy at th, have yp : y ≥ 0, { rw ←hy, bound }, have tnz : (t : ℝ)^n ≠ 0 := pow_ne_zero _ (ne_of_gt (trans sp st')), calc y = y * (↑t^n * (↑t^n)⁻¹) : by simp [mul_inv_cancel tnz] ... = y * ↑t^n * (↑t^n)⁻¹ : by ring ... ≤ c * (↑t^n)⁻¹ : by bound ... ≤ c * (s^n)⁻¹ : by bound ... = c * s⁻¹^n : by simp ... ≤ (max 1 c) * s⁻¹^n : by bound, end -- λ z0, (z0, 0) def id_zero_lm : ℂ →L[ℂ] (ℂ × ℂ) := continuous_linear_map.prod (continuous_linear_map.id ℂ ℂ) (0 : ℂ →L[ℂ] ℂ) -- Given a continuous multilinear map on two complex numbers, restrict to the slice along just the first def continuous_multilinear_map.along0 {n : ℕ} (p : continuous_multilinear_map ℂ (λ _ : fin n, ℂ × ℂ) E) : continuous_multilinear_map ℂ (λ _: fin n, ℂ) E := p.comp_continuous_linear_map (λ _, id_zero_lm) -- along0 reduces norms lemma along0.norm {n : ℕ} (p : continuous_multilinear_map ℂ (λ _ : fin n, ℂ × ℂ) E) : ∥p.along0∥ ≤ ∥p∥ := begin have pp : 0 ≤ ∥p∥ := by bound, apply @continuous_multilinear_map.op_norm_le_bound ℂ (fin n) (λ _, ℂ) E _ _ _ _ _ _ _ p.along0 _ pp, intro m, rw continuous_multilinear_map.along0, simp, have e : ∀ i : fin n, abs (m i) = ∥id_zero_lm (m i)∥, { intro i, rw id_zero_lm, simp [prod.norm_def], rw max_eq_left (complex.abs_nonneg _) }, simp_rw e, exact @continuous_multilinear_map.le_op_norm ℂ (fin n) (λ _, ℂ × ℂ) E _ _ _ _ _ _ _ p _, end -- along0 is linear def along0.linear_map (n : ℕ) : continuous_multilinear_map ℂ (λ _ : fin n, ℂ × ℂ) E →ₗ[ℂ] continuous_multilinear_map ℂ (λ _: fin n, ℂ) E := { to_fun := λ p, p.along0, map_add' := begin intros p q, simp_rw continuous_multilinear_map.along0, apply continuous_multilinear_map.ext, intro m, simp end, map_smul' := begin intros s p, simp_rw continuous_multilinear_map.along0, apply continuous_multilinear_map.ext, intro m, simp end } -- along0 is continuous linear def along0.continuous_linear_map (n : ℕ) : continuous_multilinear_map ℂ (λ _ : fin n, ℂ × ℂ) E →L[ℂ] continuous_multilinear_map ℂ (λ _: fin n, ℂ) E := begin refine linear_map.mk_continuous (along0.linear_map n) 1 _, intro p, simp, rw along0.linear_map, exact along0.norm p, end -- along0 for a whole power series def formal_multilinear_series.along0 (p : formal_multilinear_series ℂ (ℂ × ℂ) E) : formal_multilinear_series ℂ ℂ E := λ n, (p n).along0 -- along0 increases radius of convergence lemma along0.radius (p : formal_multilinear_series ℂ (ℂ × ℂ) E) : p.radius ≤ p.along0.radius := begin simp_rw formal_multilinear_series.radius, refine supr_mono _, intro r, refine supr_mono _, intro C, refine supr_mono' _, intro h, have h' : ∀ n, ∥p.along0 n∥ * ↑r ^ n ≤ C := λ n, trans (by bound [along0.norm (p n)]) (h n), existsi h', simp, end -- If f : ℂ × ℂ → E is analytic with series p, (λ z0, f (z0,z1)) is analytic with series p.along0 lemma has_fpower_series_at.along0 {f : ℂ × ℂ → E} {c0 c1 : ℂ} {p : formal_multilinear_series ℂ (ℂ × ℂ) E} (fp : has_fpower_series_at f p (c0,c1)) : has_fpower_series_at (λ z0, f (z0,c1)) p.along0 c0 := begin rcases fp with ⟨r,fpr⟩, suffices h : has_fpower_series_on_ball (λ z0, f (z0,c1)) p.along0 c0 r, exact h.has_fpower_series_at, refine { r_le := trans fpr.r_le (along0.radius p), r_pos := fpr.r_pos, has_sum := _, }, { intros w0 w0r, simp_rw [formal_multilinear_series.along0, continuous_multilinear_map.along0, id_zero_lm], simp, have w01r : (w0, (0 : ℂ)) ∈ emetric.ball (0 : ℂ × ℂ) r, { simp [prod.edist_eq] at ⊢ w0r, assumption }, have hs := fpr.has_sum w01r, simp at ⊢ hs, exact hs, } end -- The map p → p.along0 is analytic lemma along0.entire (n : ℕ) : entire ℂ (λ p : continuous_multilinear_map ℂ (λ _ : fin n, ℂ × ℂ) E, p.along0) := λ p, (@along0.continuous_linear_map E _ _ _ _ n).analytic_at p -- uneven_series u r1 z1 is analytic as a function of z1 lemma uneven_series_analytic (u : uneven f c0 c1 r0 r1) (n : ℕ) : analytic_on ℂ (λ z1, uneven_series u z1 n) (ball c1 r1) := begin intros z1 z1s, rcases u.a (c0,z1) (set.mk_mem_prod (metric.mem_ball_self u.r0p) z1s) with ⟨p,r,hp⟩, have pa := (p.has_fpower_series_on_ball_change_origin n (lt_of_lt_of_le hp.r_pos hp.r_le)).analytic_at, set g := λ w1, ((0 : ℂ), w1-z1), have ga : entire ℂ g, { rw ←differentiable.entire, apply differentiable.prod (differentiable_const _), apply differentiable.sub differentiable_id (differentiable_const _), }, have g0 : 0 = g z1, { rw prod.ext_iff, simp }, rw g0 at pa, have ta := pa.comp (ga z1), simp_rw function.comp at ta, clear pa ga g0, have pu : ∀ᶠ w1 in nhds z1, uneven_series u w1 n = (p.change_origin (g w1)).along0 n, { rw eventually_nhds_iff, set s' := r1 - dist z1 c1, set s := min r (ennreal.of_real s'), have s'p : s' > 0, { simp at z1s, bound }, have s'r1 : s' ≤ r1 := sub_le_self r1 (by bound), have sp : s > 0 := by bound [hp.r_pos, ennreal.of_real_pos.mpr s'p], have sr : s ≤ r := min_le_left _ _, have sr1 : s ≤ ennreal.of_real r1 := trans (min_le_right _ _) (ennreal.of_real_le_of_real s'r1), have sb : emetric.ball z1 s ⊆ ball c1 r1, { rw set.subset_def, intros x xs, simp at ⊢ xs z1s, calc dist x c1 ≤ dist x z1 + dist z1 c1 : by bound ... < s' + dist z1 c1 : add_lt_add_right xs.right _ ... = r1 - dist z1 c1 + dist z1 c1 : rfl ... = r1 : by ring_nf }, existsi emetric.ball z1 s, refine ⟨_, emetric.is_open_ball, emetric.mem_ball_self sp⟩, intros w1 w1s, have p0 : has_fpower_series_at (λ z0, f (z0,w1)) (uneven_series u w1) c0, { have w1c : w1 ∈ closed_ball c1 r1 := mem_open_closed (sb w1s), refine (uneven.has_series u u.r1p (le_refl _) w1c).has_fpower_series_at, }, have p1 : has_fpower_series_at (λ z0, f (z0,w1)) (p.change_origin (g w1)).along0 c0, { have wz : ↑∥((0 : ℂ), w1 - z1)∥₊ < r, { rw prod.nnnorm_def, simp, rw [←edist_eq_coe_nnnorm, edist_dist, complex.dist_eq], simp at ⊢ w1s, rw [edist_dist, complex.dist_eq] at w1s, exact w1s.left, }, have co := (hp.change_origin wz).has_fpower_series_at, simp at co, exact co.along0, }, rw has_fpower_series_at.eq_formal_multilinear_series p0 p1, }, have clm := @continuous_multilinear_map.complete_space ℂ (fin n) (λ _, ℂ) E _ _ _ _ _ _ _ _, rw @analytic_at_congr ℂ _ _ _ _ _ (continuous_multilinear_map ℂ (λ _ : fin n, ℂ) E) _ _ clm _ _ _ pu, clear pu clm, exact analytic_at.comp (along0.entire _ _) ta, end -- uneven_term u z1 n is analytic as a function of z1 lemma uneven_term.analytic (u : uneven f c0 c1 r0 r1) (n : ℕ) : analytic_on ℂ (λ z1, uneven_term u z1 n) (ball c1 r1) := begin have e : ∀ z1, uneven_term u z1 n = (cmmap_apply_cmap ℂ (λ _ : fin n, ℂ) E (λ _, 1)) (uneven_series u z1 n), { intro z1, simp [uneven_term, ←uneven_series_apply, cmmap_apply_cmap, uneven_series], }, simp_rw e, exact continuous_linear_map.comp_analytic_on _ (uneven_series_analytic u n), end -- The subharmonic functions we'll apply Hartogs's lemma to def uneven_log (u : uneven f c0 c1 r0 r1) (n : ℕ) (z1 : ℂ) : ℝ := (↑n)⁻¹ * max_log (-1) (∥r1^n • uneven_term u z1 n∥) -- Uniform bound on uneven_term in terms of uneven_log lemma uneven_log_uniform_bound (u : uneven f c0 c1 r0 r1) {s : ℝ} (sp : s > 0) (sr : s < r1) : ∃ b : ℝ, ∀ n z1, z1 ∈ closed_ball c1 s → uneven_log u n z1 ≤ b := begin rcases uneven_series_uniform_bound u sp sr with ⟨c,a,cp,ap,h⟩, use max_log 0 (r1 * (max 1 c * a)), intros n z zs, specialize h n z zs, simp_rw uneven_series_norm at h, rw uneven_log, by_cases n0 : n = 0, { simp [n0] }, have np : n ≥ 1 := nat.one_le_of_lt (nat.pos_of_ne_zero n0), rw inv_mul_le_iff (nat.cast_pos.mpr (nat.pos_of_ne_zero n0)), apply max_log_le, transitivity (0 : ℝ), norm_num, simp, bound [le_max_log], simp [norm_smul, abs_of_pos u.r1p], transitivity r1^n * (c * a^n), bound [u.r1p], rw real.exp_nat_mul, transitivity (r1 * (max 1 c * a))^n, simp [mul_pow], bound [u.r1p], transitivity (max 1 c)^1, simp, exact pow_le_pow (le_max_left 1 c) np, bound [le_exp_max_log, u.r1p, le_max_of_le_right (le_of_lt cp)], apply_instance, end -- Nonuniform bound on uneven_term in terms of uneven_log lemma uneven_log_nonuniform_bound (u : uneven f c0 c1 r0 r1) (z1s : z1 ∈ closed_ball c1 r1) : ∀ d, d > 0 → ∀ᶠ n in at_top, uneven_log u n z1 ≤ d := begin intros d dp, rcases exists_between dp with ⟨e,ep,ed⟩, set s := r1 / e.exp, have sp : s > 0 := by bound [u.r1p, real.exp_pos], have sr : s < r1 := by bound [u.r1p, real.exp_pos, div_lt_self, real.one_lt_exp_iff.mpr], rcases uneven_series_nonuniform_bound u sp sr z1s with ⟨c,cp,us⟩, -- Choose m large enough to make c negligible rcases exists_nat_gt (max 1 (c.log / (d-e))) with ⟨m,mb⟩, have mp : 0 < (m : ℝ) := lt_of_lt_of_le zero_lt_one (trans (by bound) (le_of_lt mb)), rw filter.eventually_at_top, use m, intros n mn, specialize us n, generalize ht : ∥uneven_term u z1 n∥ = t, have tp : t ≥ 0, { rw ←ht, bound }, rw [uneven_series_norm, ht] at us, clear z1s, -- Prove the desired bound rw [uneven_log, inv_mul_le_iff (lt_of_lt_of_le mp (nat.cast_le.mpr mn))], apply max_log_le, transitivity (0 : ℝ), norm_num, bound, have nb : c.log / (d-e) ≤ n := trans (trans (by bound) (le_of_lt mb)) (nat.cast_le.mpr mn), calc ∥r1^n • uneven_term u z1 n∥ = r1^n * t : by { rw ←ht, simp [norm_smul, abs_of_pos u.r1p], } ... ≤ r1^n * (c * s⁻¹^n) : by bound [u.r1p] ... = r1^n * (c * (e.exp^n / r1^n)) : by rw [inv_div, div_pow] ... = r1^n / r1^n * c * e.exp^n : by ring ... = c * e.exp^n : by field_simp [ne_of_gt (pow_pos u.r1p _)] ... = c * (↑n*e).exp : by rw real.exp_nat_mul ... = c * (↑n*d - ↑n*(d-e)).exp : by ring_nf ... = c.log.exp * ((↑n*d).exp / (↑n*(d-e)).exp) : by rw [real.exp_sub, real.exp_log cp] ... = c.log.exp / (↑n*(d-e)).exp * (↑n*d).exp : by ring_nf ... = (c.log - ↑n*(d-e)).exp * (↑n*d).exp : by rw real.exp_sub ... ≤ (c.log - c.log/(d-e)*(d-e)).exp * (↑n*d).exp : by bound [real.exp_le_exp.mpr, le_of_lt (real.exp_pos _)] ... ≤ (↑n*d).exp : by field_simp [ne_of_gt (sub_pos.mpr ed)], end -- Our max_log function is subharmonic lemma uneven_nonuniform_subharmonic (u : uneven f c0 c1 r0 r1) (n : ℕ) : subharmonic_on (uneven_log u n) (ball c1 r1) := begin refine subharmonic_on.const_mul _ (by bound), apply analytic_on.max_log_norm_subharmonic_on _ (-1), apply_instance, apply_instance, apply_instance, rw ←differentiable_iff_analytic metric.is_open_ball, apply differentiable_on.const_smul, rw differentiable_iff_analytic metric.is_open_ball, apply uneven_term.analytic u, apply_instance, apply_instance, end -- The nonuniform bound holds uniformly lemma uneven_series_strong_bound (u : uneven f c0 c1 r0 r1) {s : ℝ} (sp : s > 0) (sr : s < r1) : ∀ᶠ n in at_top, ∀ z1, z1 ∈ closed_ball c1 s → ∥uneven_series u z1 n∥ ≤ s⁻¹^n := begin rcases exists_between sr with ⟨t,ts,tr⟩, have tp : t > 0 := trans ts sp, have trs : closed_ball c1 t ⊆ ball c1 r1 := metric.closed_ball_subset_ball tr, have cs : closed_ball c1 t ⊆ closed_ball c1 r1 := metric.closed_ball_subset_closed_ball (le_of_lt tr), have ks : closed_ball c1 s ⊆ interior (closed_ball c1 t), { rw interior_closed_ball _ (ne_of_gt tp), exact metric.closed_ball_subset_ball ts, apply_instance, }, rcases uneven_log_uniform_bound u tp tr with ⟨b,fb⟩, have H := subharmonic_on.hartogs (λ n, (uneven_nonuniform_subharmonic u n).mono trs) fb (λ z zs, uneven_log_nonuniform_bound u (cs zs)) (is_compact_closed_ball _ _) ks, specialize H (r1/s).log (by bound [real.log_pos, (one_lt_div _).mpr]), refine H.mp ((filter.eventually_gt_at_top 0).mp (filter.eventually_of_forall _)), intros n np h z zs, specialize h z zs, simp at h, rw uneven_series_norm, rw [uneven_log, inv_mul_le_iff (nat.cast_pos.mpr np)] at h, simp [norm_smul, abs_of_pos u.r1p] at h, have a := le_of_max_log_le h, rw [real.exp_nat_mul, real.exp_log (div_pos u.r1p sp), div_eq_mul_inv, mul_pow] at a, exact (mul_le_mul_left (by bound [u.r1p])).mp a, apply_instance, end -- The nonuniform bound holds uniformly, without ∀ᶠ lemma uneven_series_strong_bound' (u : uneven f c0 c1 r0 r1) {s : ℝ} (sp : s > 0) (sr : s < r1) : ∃ c, c ≥ 0 ∧ ∀ n, ∀ z1, z1 ∈ closed_ball c1 s → ∥uneven_series u z1 n∥ ≤ c * s⁻¹^n := begin rcases filter.eventually_at_top.mp (uneven_series_strong_bound u sp sr) with ⟨n,h⟩, set g := λ z1, range_max (λ k, s^k * ∥uneven_series u z1 k∥) n, have gc : continuous_on g (closed_ball c1 s), { apply continuous_on.range_max, intro n, apply continuous_on.mul continuous_on_const, apply continuous_on.norm, exact (uneven_series_analytic u n).continuous_on.mono (metric.closed_ball_subset_ball sr), apply_instance, }, rcases gc.bounded (is_compact_closed_ball _ _) with ⟨b,bp,gb⟩, simp_rw range_max_le_iff at gb, use [max 1 b, le_max_of_le_right bp], intros k z zs, by_cases kn : k ≤ n, { specialize gb z zs k kn, calc ∥uneven_series u z k∥ = s⁻¹^k * (s^k * ∥uneven_series u z k∥) : by { ring_nf, field_simp [ne_of_gt (pow_pos sp _)] } ... ≤ s⁻¹^k * b : by bound ... = b * s⁻¹^k : by ring_nf ... ≤ max 1 b * s⁻¹^k : by bound, }, { simp at kn, apply trans (h k (le_of_lt kn) z zs), calc s⁻¹^k = 1 * s⁻¹^k : by simp ... ≤ max 1 b * s⁻¹^k : by bound, }, end -- This should go somewhere else lemma fst_snd_eq {A B : Type} (p : A × B) : (p.fst,p.snd) = p := by simp -- f is bounded away from the (now even!) edges lemma uneven_bounded (u : uneven f c0 c1 r0 r1) {s : ℝ} (sp : s > 0) (sr : s < r1) : ∃ b, b ≥ 0 ∧ ∀ z, z ∈ ball (c0,c1) s → ∥f z∥ ≤ b := begin rcases exists_between sr with ⟨t,ts,tr⟩, have tp : t > 0 := trans ts sp, rcases uneven_series_strong_bound' u tp tr with ⟨c,cp,ch⟩, use [c * (1 - s/t)⁻¹, by bound], intros z zs, simp [prod.dist_eq] at zs, have z1t : z.2 ∈ closed_ball c1 t, { simp, exact trans (le_of_lt zs.2) (le_of_lt ts) }, have z1r : z.2 ∈ closed_ball c1 r1 := metric.closed_ball_subset_closed_ball (le_of_lt tr) z1t, have ds : z.1-c0 ∈ metric.ball (0 : ℂ) s, { simp [complex.dist_eq] at zs, simp [zs.1] }, have ds' : z.1-c0 ∈ emetric.ball (0 : ℂ) (ennreal.of_real s) := by rwa metric.emetric_ball, have hs := (u.has_series sp (le_of_lt sr) z1r).has_sum ds', simp [uneven_series_eq u sp (le_of_lt sr) z1r] at hs, set g := λ n : ℕ, c * (s/t)^n, have gs : has_sum g (c * (1 - s/t)⁻¹) := has_sum.mul_left _ (has_sum_geometric_of_lt_1 (by bound) (by bound [(div_lt_one _).mpr])), apply has_sum.norm_le_of_bounded hs gs, intro n, simp [norm_smul] at ⊢ ds, simp_rw ←formal_multilinear_series.norm_apply_eq_norm_coef, calc abs (z.1-c0)^n * ∥uneven_series u z.2 n∥ ≤ s^n * (c * t⁻¹^n) : by bound [ch n _ z1t] ... = c * (s^n * t⁻¹^n) : by ring_nf ... = c * (s / t)^n : by rw [←mul_pow, ←div_eq_mul_inv], end end hartogs -- Hartogs's theorem on ℂ × ℂ: separately analytic functions are jointly analytic theorem pair.hartogs {E : Type} [normed_add_comm_group E] [normed_space ℂ E] [complete_space E] [second_countable_topology E] {f : ℂ × ℂ → E} {s : set (ℂ × ℂ)} (so : is_open s) (fa0 : ∀ (c0 c1), (c0,c1) ∈ s → analytic_at ℂ (λ z0, f (z0,c1)) c0) (fa1 : ∀ (c0 c1), (c0,c1) ∈ s → analytic_at ℂ (λ z1, f (c0,z1)) c1) : analytic_on ℂ f s := begin have h : har f s := ⟨fa0,fa1⟩, intros c cs, rcases metric.is_open_iff.mp so c cs with ⟨r,rp,rs⟩, rcases exists_between rp with ⟨t,tp,tr⟩, have bs : closed_ball (c.1,c.2) t ⊆ s, { refine trans _ rs, simp [fst_snd_eq], exact metric.closed_ball_subset_ball tr }, rcases to_uneven (h.mono bs) tp with ⟨c0',r0,r1,us,c0s,u⟩, have cr : abs (c.1 - c0') < r1, { simp [complex.dist_eq] at c0s, exact c0s }, rcases exists_between cr with ⟨v,vc,vr⟩, rcases uneven_bounded u (lt_of_le_of_lt (complex.abs_nonneg _) vc) vr with ⟨b,bp,fb⟩, have fa := of_bounded (h.mono _) metric.is_open_ball fb, { apply fa, simp [prod.dist_eq, complex.dist_eq], use [vc, lt_of_le_of_lt (complex.abs_nonneg _) vc], }, { refine trans _ bs, simp_rw [←ball_prod_same, ←closed_ball_prod_same, set.prod_subset_prod_iff], apply or.inl, use [trans (metric.ball_subset_ball (le_of_lt vr)) us], have r1t := le_of_ball_subset_closed_ball (le_of_lt u.r1p) (le_of_lt tp) us, exact trans metric.ball_subset_closed_ball (metric.closed_ball_subset_closed_ball (trans (le_of_lt vr) r1t)), }, end
# This file is a part of Julia. License is MIT: https://julialang.org/license const DOWNLOAD_HOOKS = Callable[] function download_url(url::AbstractString) for hook in DOWNLOAD_HOOKS url = String(hook(url)::AbstractString) end return url end Downloads() = require(PkgId( UUID((0xf43a241f_c20a_4ad4, 0x852c_f6b1247861c6)), "Downloads", )) """ download(url::AbstractString, [path::AbstractString = tempname()]) -> path Download a file from the given url, saving it to the location `path`, or if not specified, a temporary path. Returns the path of the downloaded file. !!! note Since Julia 1.6, this function is deprecated and is just a thin wrapper around `Downloads.download`. In new code, you should use that function directly instead of calling this. """ function download(url::AbstractString, path::AbstractString) depwarn("Base.download is deprecated; use Downloads.download instead", :download) invokelatest(Downloads().download, download_url(url), path) end function download(url::AbstractString) depwarn("Base.download is deprecated; use Downloads.download instead", :download) invokelatest(Downloads().download, download_url(url)) end
{-# LANGUAGE RankNTypes #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE BangPatterns #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE ParallelListComp #-} ----------------------------------------------------------------------------- -- | -- Copyright : (c) Edward Kmett 2010-2021 -- License : BSD3 -- Maintainer : [email protected] -- Stability : experimental -- Portability : GHC only -- ----------------------------------------------------------------------------- module Numeric.AD.Newton ( -- * Newton's Method (Forward AD) findZero , findZeroNoEq , inverse , inverseNoEq , fixedPoint , fixedPointNoEq , extremum , extremumNoEq -- * Gradient Ascent/Descent (Reverse AD) , gradientDescent, constrainedDescent, CC(..), eval , gradientAscent , conjugateGradientDescent , conjugateGradientAscent , stochasticGradientDescent ) where import Data.Foldable (all, sum) import Data.Reflection (Reifies) import Data.Traversable import Numeric.AD.Internal.Combinators import Numeric.AD.Internal.Forward (Forward) import Numeric.AD.Internal.On import Numeric.AD.Internal.Or import Numeric.AD.Internal.Reverse (Reverse, Tape) import Numeric.AD.Internal.Type (AD(..)) import Numeric.AD.Mode import Numeric.AD.Mode.Reverse as Reverse (gradWith, gradWith', grad') import Numeric.AD.Rank1.Kahn as Kahn (Kahn, grad) import qualified Numeric.AD.Rank1.Newton as Rank1 import Prelude hiding (all, mapM, sum) -- $setup -- >>> import Data.Complex -- | The 'findZero' function finds a zero of a scalar function using -- Newton's method; its output is a stream of increasingly accurate -- results. (Modulo the usual caveats.) If the stream becomes constant -- ("it converges"), no further elements are returned. -- -- Examples: -- -- >>> take 10 $ findZero (\x->x^2-4) 1 -- [1.0,2.5,2.05,2.000609756097561,2.0000000929222947,2.000000000000002,2.0] -- -- >>> last $ take 10 $ findZero ((+1).(^2)) (1 :+ 1) -- 0.0 :+ 1.0 findZero :: (Fractional a, Eq a) => (forall s. AD s (Forward a) -> AD s (Forward a)) -> a -> [a] findZero f = Rank1.findZero (runAD.f.AD) {-# INLINE findZero #-} -- | The 'findZeroNoEq' function behaves the same as 'findZero' except that it -- doesn't truncate the list once the results become constant. This means it -- can be used with types without an 'Eq' instance. findZeroNoEq :: Fractional a => (forall s. AD s (Forward a) -> AD s (Forward a)) -> a -> [a] findZeroNoEq f = Rank1.findZeroNoEq (runAD.f.AD) {-# INLINE findZeroNoEq #-} -- | The 'inverse' function inverts a scalar function using -- Newton's method; its output is a stream of increasingly accurate -- results. (Modulo the usual caveats.) If the stream becomes -- constant ("it converges"), no further elements are returned. -- -- Example: -- -- >>> last $ take 10 $ inverse sqrt 1 (sqrt 10) -- 10.0 inverse :: (Fractional a, Eq a) => (forall s. AD s (Forward a) -> AD s (Forward a)) -> a -> a -> [a] inverse f = Rank1.inverse (runAD.f.AD) {-# INLINE inverse #-} -- | The 'inverseNoEq' function behaves the same as 'inverse' except that it -- doesn't truncate the list once the results become constant. This means it -- can be used with types without an 'Eq' instance. inverseNoEq :: Fractional a => (forall s. AD s (Forward a) -> AD s (Forward a)) -> a -> a -> [a] inverseNoEq f = Rank1.inverseNoEq (runAD.f.AD) {-# INLINE inverseNoEq #-} -- | The 'fixedPoint' function find a fixedpoint of a scalar -- function using Newton's method; its output is a stream of -- increasingly accurate results. (Modulo the usual caveats.) -- -- If the stream becomes constant ("it converges"), no further -- elements are returned. -- -- >>> last $ take 10 $ fixedPoint cos 1 -- 0.7390851332151607 fixedPoint :: (Fractional a, Eq a) => (forall s. AD s (Forward a) -> AD s (Forward a)) -> a -> [a] fixedPoint f = Rank1.fixedPoint (runAD.f.AD) {-# INLINE fixedPoint #-} -- | The 'fixedPointNoEq' function behaves the same as 'fixedPoint' except that -- it doesn't truncate the list once the results become constant. This means it -- can be used with types without an 'Eq' instance. fixedPointNoEq :: Fractional a => (forall s. AD s (Forward a) -> AD s (Forward a)) -> a -> [a] fixedPointNoEq f = Rank1.fixedPointNoEq (runAD.f.AD) {-# INLINE fixedPointNoEq #-} -- | The 'extremum' function finds an extremum of a scalar -- function using Newton's method; produces a stream of increasingly -- accurate results. (Modulo the usual caveats.) If the stream -- becomes constant ("it converges"), no further elements are returned. -- -- >>> last $ take 10 $ extremum cos 1 -- 0.0 extremum :: (Fractional a, Eq a) => (forall s. AD s (On (Forward (Forward a))) -> AD s (On (Forward (Forward a)))) -> a -> [a] extremum f = Rank1.extremum (runAD.f.AD) {-# INLINE extremum #-} -- | The 'extremumNoEq' function behaves the same as 'extremum' except that it -- doesn't truncate the list once the results become constant. This means it -- can be used with types without an 'Eq' instance. extremumNoEq :: Fractional a => (forall s. AD s (On (Forward (Forward a))) -> AD s (On (Forward (Forward a)))) -> a -> [a] extremumNoEq f = Rank1.extremumNoEq (runAD.f.AD) {-# INLINE extremumNoEq #-} -- | The 'gradientDescent' function performs a multivariate -- optimization, based on the naive-gradient-descent in the file -- @stalingrad\/examples\/flow-tests\/pre-saddle-1a.vlad@ from the -- VLAD compiler Stalingrad sources. Its output is a stream of -- increasingly accurate results. (Modulo the usual caveats.) -- -- It uses reverse mode automatic differentiation to compute the gradient. gradientDescent :: (Traversable f, Fractional a, Ord a) => (forall s. Reifies s Tape => f (Reverse s a) -> Reverse s a) -> f a -> [f a] gradientDescent f x0 = go x0 fx0 xgx0 0.1 (0 :: Int) where (fx0, xgx0) = Reverse.gradWith' (,) f x0 go x fx xgx !eta !i | eta == 0 = [] -- step size is 0 | fx1 > fx = go x fx xgx (eta/2) 0 -- we stepped too far | zeroGrad xgx = [] -- gradient is 0 | otherwise = x1 : if i == 10 then go x1 fx1 xgx1 (eta*2) 0 else go x1 fx1 xgx1 eta (i+1) where zeroGrad = all (\(_,g) -> g == 0) x1 = fmap (\(xi,gxi) -> xi - eta * gxi) xgx (fx1, xgx1) = Reverse.gradWith' (,) f x1 {-# INLINE gradientDescent #-} data SEnv (f :: * -> *) a = SEnv { sValue :: a, origEnv :: f a } deriving (Functor, Foldable, Traversable) -- | Convex constraint, CC, is a GADT wrapper that hides the existential -- ('s') which is so prevalent in the rest of the API. This is an -- engineering convenience for managing the skolems. data CC f a where CC :: forall f a. (forall s. Reifies s Tape => f (Reverse s a) -> Reverse s a) -> CC f a -- |@constrainedDescent obj fs env@ optimizes the convex function @obj@ -- subject to the convex constraints @f <= 0@ where @f `elem` fs@. This is -- done using a log barrier to model constraints (i.e. Boyd, Chapter 11.3). -- The returned optimal point for the objective function must satisfy @fs@, -- but the initial environment, @env@, needn't be feasible. constrainedDescent :: forall f a. (Traversable f, RealFloat a, Floating a, Ord a) => (forall s. Reifies s Tape => f (Reverse s a) -> Reverse s a) -> [CC f a] -> f a -> [(a,f a)] constrainedDescent objF [] env = map (\x -> (eval objF x, x)) (gradientDescent objF env) constrainedDescent objF cs env = let s0 = 1 + maximum [eval c env | CC c <- cs] -- ^ s0 = max ( f_i(0) ) cs' = [CC (\(SEnv sVal rest) -> c rest - sVal) | CC c <- cs] -- ^ f_i' = f_i - s0 and thus f_i' <= 0 envS = SEnv s0 env -- feasible point for f_i', use gd to find feasiblity for f_i cc = constrainedConvex' (CC sValue) cs' envS ((<=0) . sValue) in case dropWhile ((0 <) . fst) (take (2^(20::Int)) cc) of [] -> [] (_,envFeasible) : _ -> constrainedConvex' (CC objF) cs (origEnv envFeasible) (const True) {-# INLINE constrainedDescent #-} eval :: (Traversable f, Fractional a, Ord a) => (forall s. Reifies s Tape => f (Reverse s a) -> Reverse s a) -> f a -> a eval f e = fst (grad' f e) {-# INLINE eval #-} -- | Like 'constrainedDescent' except the initial point must be feasible. constrainedConvex' :: forall f a. (Traversable f, RealFloat a, Floating a, Ord a) => CC f a -> [CC f a] -> f a -> (f a -> Bool) -> [(a,f a)] constrainedConvex' objF cs env term = -- 1. Transform cs using a log barrier with increasing t values. let os = map (mkOpt objF cs) tValues -- 2. Iteratively run gradientDescent on each os. envs = [(undefined,env)] : [gD (snd $ last e) o | o <- os | e <- limEnvs ] -- Obtain a finite number of elements from the initial len tValues - 1 lists. limEnvs = zipWith id nrSteps envs in dropWhile (not . term . snd) (concat $ drop 1 limEnvs) where tValues = map realToFrac $ take 64 $ iterate (*2) (2 :: a) nrSteps = [take 20 | _ <- [1..length tValues]] ++ [id] -- | `gD f e` is gradient descent with the evaulated result gD e (CC f) = (eval f e, e) : map (\x -> (eval f x, x)) (gradientDescent f e) {-# INLINE constrainedConvex' #-} -- @mkOpt u fs t@ converts an inequality convex problem (@u,fs@) into an -- unconstrained convex problem using log barrier @u + -(1/t)log(-f_i)@. -- As @t@ increases the approximation is more accurate but the gradient -- decreases, making the gradient descent more expensive. mkOpt :: forall f a. (Traversable f, RealFloat a, Floating a, Ord a) => CC f a -> [CC f a] -> a -> CC f a mkOpt (CC o) xs t = CC (\e -> o e + sum (map (\(CC c) -> iHat t c e) xs)) {-# INLINE mkOpt #-} iHat :: forall a f. (Traversable f, RealFloat a, Floating a, Ord a) => a -> (forall s. Reifies s Tape => f (Reverse s a) -> Reverse s a) -> (forall s. Reifies s Tape => f (Reverse s a) -> Reverse s a) iHat t c e = let r = c e in if r >= 0 || isNaN r then 1 / 0 else (-1 / auto t) * log( - (c e)) {-# INLINE iHat #-} -- | The 'stochasticGradientDescent' function approximates -- the true gradient of the constFunction by a gradient at -- a single example. As the algorithm sweeps through the training -- set, it performs the update for each training example. -- -- It uses reverse mode automatic differentiation to compute the gradient -- The learning rate is constant through out, and is set to 0.001 stochasticGradientDescent :: (Traversable f, Fractional a, Ord a) => (forall s. Reifies s Tape => e -> f (Reverse s a) -> Reverse s a) -> [e] -> f a -> [f a] stochasticGradientDescent errorSingle d0 x0 = go xgx0 0.001 dLeft where dLeft = tail $ cycle d0 xgx0 = Reverse.gradWith (,) (errorSingle (head d0)) x0 go xgx !eta d | eta ==0 = [] | otherwise = x1 : go xgx1 eta (tail d) where x1 = fmap (\(xi, gxi) -> xi - eta * gxi) xgx (_, xgx1) = Reverse.gradWith' (,) (errorSingle (head d)) x1 {-# INLINE stochasticGradientDescent #-} -- | Perform a gradient descent using reverse mode automatic differentiation to compute the gradient. gradientAscent :: (Traversable f, Fractional a, Ord a) => (forall s. Reifies s Tape => f (Reverse s a) -> Reverse s a) -> f a -> [f a] gradientAscent f = gradientDescent (negate . f) {-# INLINE gradientAscent #-} -- | Perform a conjugate gradient descent using reverse mode automatic differentiation to compute the gradient, and using forward-on-forward mode for computing extrema. -- -- >>> let sq x = x * x -- >>> let rosenbrock [x,y] = sq (1 - x) + 100 * sq (y - sq x) -- >>> rosenbrock [0,0] -- 1 -- >>> rosenbrock (conjugateGradientDescent rosenbrock [0, 0] !! 5) < 0.1 -- True conjugateGradientDescent :: (Traversable f, Ord a, Fractional a) => (forall s. Chosen s => f (Or s (On (Forward (Forward a))) (Kahn a)) -> Or s (On (Forward (Forward a))) (Kahn a)) -> f a -> [f a] conjugateGradientDescent f = conjugateGradientAscent (negate . f) {-# INLINE conjugateGradientDescent #-} lfu :: Functor f => (f (Or F a b) -> Or F a b) -> f a -> a lfu f = runL . f . fmap L rfu :: Functor f => (f (Or T a b) -> Or T a b) -> f b -> b rfu f = runR . f . fmap R -- | Perform a conjugate gradient ascent using reverse mode automatic differentiation to compute the gradient. conjugateGradientAscent :: (Traversable f, Ord a, Fractional a) => (forall s. Chosen s => f (Or s (On (Forward (Forward a))) (Kahn a)) -> Or s (On (Forward (Forward a))) (Kahn a)) -> f a -> [f a] conjugateGradientAscent f x0 = takeWhile (all (\a -> a == a)) (go x0 d0 d0 delta0) where dot x y = sum $ zipWithT (*) x y d0 = Kahn.grad (rfu f) x0 delta0 = dot d0 d0 go xi _ri di deltai = xi : go xi1 ri1 di1 deltai1 where ai = last $ take 20 $ Rank1.extremum (\a -> lfu f $ zipWithT (\x d -> auto x + a * auto d) xi di) 0 xi1 = zipWithT (\x d -> x + ai*d) xi di ri1 = Kahn.grad (rfu f) xi1 deltai1 = dot ri1 ri1 bi1 = deltai1 / deltai di1 = zipWithT (\r d -> r + bi1 * d) ri1 di {-# INLINE conjugateGradientAscent #-}
/- Copyright (c) 2021 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov ! This file was ported from Lean 3 source module geometry.manifold.bump_function ! leanprover-community/mathlib commit b018406ad2f2a73223a3a9e198ccae61e6f05318 ! Please do not edit these lines, except to modify the commit id ! if you have ported upstream changes. -/ import Mathbin.Analysis.Calculus.BumpFunctionFindim import Mathbin.Geometry.Manifold.ContMdiff /-! # Smooth bump functions on a smooth manifold In this file we define `smooth_bump_function I c` to be a bundled smooth "bump" function centered at `c`. It is a structure that consists of two real numbers `0 < r < R` with small enough `R`. We define a coercion to function for this type, and for `f : smooth_bump_function I c`, the function `⇑f` written in the extended chart at `c` has the following properties: * `f x = 1` in the closed ball of radius `f.r` centered at `c`; * `f x = 0` outside of the ball of radius `f.R` centered at `c`; * `0 ≤ f x ≤ 1` for all `x`. The actual statements involve (pre)images under `ext_chart_at I f` and are given as lemmas in the `smooth_bump_function` namespace. ## Tags manifold, smooth bump function -/ universe uE uF uH uM variable {E : Type uE} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] {H : Type uH} [TopologicalSpace H] (I : ModelWithCorners ℝ E H) {M : Type uM} [TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] open Function Filter FiniteDimensional Set Metric open Topology Manifold Classical Filter BigOperators noncomputable section /-! ### Smooth bump function In this section we define a structure for a bundled smooth bump function and prove its properties. -/ /-- Given a smooth manifold modelled on a finite dimensional space `E`, `f : smooth_bump_function I M` is a smooth function on `M` such that in the extended chart `e` at `f.c`: * `f x = 1` in the closed ball of radius `f.r` centered at `f.c`; * `f x = 0` outside of the ball of radius `f.R` centered at `f.c`; * `0 ≤ f x ≤ 1` for all `x`. The structure contains data required to construct a function with these properties. The function is available as `⇑f` or `f x`. Formal statements of the properties listed above involve some (pre)images under `ext_chart_at I f.c` and are given as lemmas in the `smooth_bump_function` namespace. -/ structure SmoothBumpFunction (c : M) extends ContDiffBump (extChartAt I c c) where closedBall_subset : closedBall (extChartAt I c c) R ∩ range I ⊆ (extChartAt I c).target #align smooth_bump_function SmoothBumpFunction variable {M} namespace SmoothBumpFunction variable {c : M} (f : SmoothBumpFunction I c) {x : M} {I} /-- The function defined by `f : smooth_bump_function c`. Use automatic coercion to function instead. -/ def toFun : M → ℝ := indicator (chartAt H c).source (f.toContDiffBump ∘ extChartAt I c) #align smooth_bump_function.to_fun SmoothBumpFunction.toFun instance : CoeFun (SmoothBumpFunction I c) fun _ => M → ℝ := ⟨toFun⟩ theorem coe_def : ⇑f = indicator (chartAt H c).source (f.toContDiffBump ∘ extChartAt I c) := rfl #align smooth_bump_function.coe_def SmoothBumpFunction.coe_def theorem r_pos : 0 < f.r := f.toContDiffBump.r_pos #align smooth_bump_function.R_pos SmoothBumpFunction.r_pos theorem ball_subset : ball (extChartAt I c c) f.r ∩ range I ⊆ (extChartAt I c).target := Subset.trans (inter_subset_inter_left _ ball_subset_closedBall) f.closedBall_subset #align smooth_bump_function.ball_subset SmoothBumpFunction.ball_subset theorem eqOn_source : EqOn f (f.toContDiffBump ∘ extChartAt I c) (chartAt H c).source := eqOn_indicator #align smooth_bump_function.eq_on_source SmoothBumpFunction.eqOn_source theorem eventuallyEq_of_mem_source (hx : x ∈ (chartAt H c).source) : f =ᶠ[𝓝 x] f.toContDiffBump ∘ extChartAt I c := f.EqOnSource.eventuallyEq_of_mem <| IsOpen.mem_nhds (chartAt H c).open_source hx #align smooth_bump_function.eventually_eq_of_mem_source SmoothBumpFunction.eventuallyEq_of_mem_source theorem one_of_dist_le (hs : x ∈ (chartAt H c).source) (hd : dist (extChartAt I c x) (extChartAt I c c) ≤ f.R) : f x = 1 := by simp only [f.eq_on_source hs, (· ∘ ·), f.to_cont_diff_bump.one_of_mem_closed_ball hd] #align smooth_bump_function.one_of_dist_le SmoothBumpFunction.one_of_dist_le theorem support_eq_inter_preimage : support f = (chartAt H c).source ∩ extChartAt I c ⁻¹' ball (extChartAt I c c) f.r := by rw [coe_def, support_indicator, (· ∘ ·), support_comp_eq_preimage, ← extChartAt_source I, ← (extChartAt I c).symm_image_target_inter_eq', ← (extChartAt I c).symm_image_target_inter_eq', f.to_cont_diff_bump.support_eq] #align smooth_bump_function.support_eq_inter_preimage SmoothBumpFunction.support_eq_inter_preimage theorem isOpen_support : IsOpen (support f) := by rw [support_eq_inter_preimage] exact isOpen_extChartAt_preimage I c is_open_ball #align smooth_bump_function.is_open_support SmoothBumpFunction.isOpen_support theorem support_eq_symm_image : support f = (extChartAt I c).symm '' (ball (extChartAt I c c) f.r ∩ range I) := by rw [f.support_eq_inter_preimage, ← extChartAt_source I, ← (extChartAt I c).symm_image_target_inter_eq', inter_comm] congr 1 with y exact and_congr_right_iff.2 fun hy => ⟨fun h => extChartAt_target_subset_range _ _ h, fun h => f.ball_subset ⟨hy, h⟩⟩ #align smooth_bump_function.support_eq_symm_image SmoothBumpFunction.support_eq_symm_image theorem support_subset_source : support f ⊆ (chartAt H c).source := by rw [f.support_eq_inter_preimage, ← extChartAt_source I] exact inter_subset_left _ _ #align smooth_bump_function.support_subset_source SmoothBumpFunction.support_subset_source theorem image_eq_inter_preimage_of_subset_support {s : Set M} (hs : s ⊆ support f) : extChartAt I c '' s = closedBall (extChartAt I c c) f.r ∩ range I ∩ (extChartAt I c).symm ⁻¹' s := by rw [support_eq_inter_preimage, subset_inter_iff, ← extChartAt_source I, ← image_subset_iff] at hs cases' hs with hse hsf apply subset.antisymm · refine' subset_inter (subset_inter (subset.trans hsf ball_subset_closed_ball) _) _ · rintro _ ⟨x, -, rfl⟩ exact mem_range_self _ · rw [(extChartAt I c).image_eq_target_inter_inv_preimage hse] exact inter_subset_right _ _ · refine' subset.trans (inter_subset_inter_left _ f.closed_ball_subset) _ rw [(extChartAt I c).image_eq_target_inter_inv_preimage hse] #align smooth_bump_function.image_eq_inter_preimage_of_subset_support SmoothBumpFunction.image_eq_inter_preimage_of_subset_support theorem mem_Icc : f x ∈ Icc (0 : ℝ) 1 := by have : f x = 0 ∨ f x = _ := indicator_eq_zero_or_self _ _ _ cases this <;> rw [this] exacts[left_mem_Icc.2 zero_le_one, ⟨f.to_cont_diff_bump.nonneg, f.to_cont_diff_bump.le_one⟩] #align smooth_bump_function.mem_Icc SmoothBumpFunction.mem_Icc theorem nonneg : 0 ≤ f x := f.mem_Icc.1 #align smooth_bump_function.nonneg SmoothBumpFunction.nonneg theorem le_one : f x ≤ 1 := f.mem_Icc.2 #align smooth_bump_function.le_one SmoothBumpFunction.le_one theorem eventuallyEq_one_of_dist_lt (hs : x ∈ (chartAt H c).source) (hd : dist (extChartAt I c x) (extChartAt I c c) < f.R) : f =ᶠ[𝓝 x] 1 := by filter_upwards [IsOpen.mem_nhds (isOpen_extChartAt_preimage I c is_open_ball) ⟨hs, hd⟩] rintro z ⟨hzs, hzd : _ < _⟩ exact f.one_of_dist_le hzs hzd.le #align smooth_bump_function.eventually_eq_one_of_dist_lt SmoothBumpFunction.eventuallyEq_one_of_dist_lt theorem eventuallyEq_one : f =ᶠ[𝓝 c] 1 := f.eventuallyEq_one_of_dist_lt (mem_chart_source _ _) <| by rw [dist_self] exact f.r_pos #align smooth_bump_function.eventually_eq_one SmoothBumpFunction.eventuallyEq_one @[simp] theorem eq_one : f c = 1 := f.eventuallyEq_one.eq_of_nhds #align smooth_bump_function.eq_one SmoothBumpFunction.eq_one theorem support_mem_nhds : support f ∈ 𝓝 c := f.eventuallyEq_one.mono fun x hx => by rw [hx] exact one_ne_zero #align smooth_bump_function.support_mem_nhds SmoothBumpFunction.support_mem_nhds theorem tsupport_mem_nhds : tsupport f ∈ 𝓝 c := mem_of_superset f.support_mem_nhds subset_closure #align smooth_bump_function.tsupport_mem_nhds SmoothBumpFunction.tsupport_mem_nhds theorem c_mem_support : c ∈ support f := mem_of_mem_nhds f.support_mem_nhds #align smooth_bump_function.c_mem_support SmoothBumpFunction.c_mem_support theorem nonempty_support : (support f).Nonempty := ⟨c, f.c_mem_support⟩ #align smooth_bump_function.nonempty_support SmoothBumpFunction.nonempty_support theorem isCompact_symm_image_closedBall : IsCompact ((extChartAt I c).symm '' (closedBall (extChartAt I c c) f.r ∩ range I)) := ((isCompact_closedBall _ _).inter_right I.closed_range).image_of_continuousOn <| (continuousOn_extChartAt_symm _ _).mono f.closedBall_subset #align smooth_bump_function.is_compact_symm_image_closed_ball SmoothBumpFunction.isCompact_symm_image_closedBall /-- Given a smooth bump function `f : smooth_bump_function I c`, the closed ball of radius `f.R` is known to include the support of `f`. These closed balls (in the model normed space `E`) intersected with `set.range I` form a basis of `𝓝[range I] (ext_chart_at I c c)`. -/ theorem nhdsWithin_range_basis : (𝓝[range I] extChartAt I c c).HasBasis (fun f : SmoothBumpFunction I c => True) fun f => closedBall (extChartAt I c c) f.r ∩ range I := by refine' ((nhdsWithin_hasBasis nhds_basis_closed_ball _).restrict_subset (extChartAt_target_mem_nhdsWithin _ _)).to_has_basis' _ _ · rintro R ⟨hR0, hsub⟩ exact ⟨⟨⟨R / 2, R, half_pos hR0, half_lt_self hR0⟩, hsub⟩, trivial, subset.rfl⟩ · exact fun f _ => inter_mem (mem_nhdsWithin_of_mem_nhds <| closed_ball_mem_nhds _ f.r_pos) self_mem_nhdsWithin #align smooth_bump_function.nhds_within_range_basis SmoothBumpFunction.nhdsWithin_range_basis theorem isClosed_image_of_isClosed {s : Set M} (hsc : IsClosed s) (hs : s ⊆ support f) : IsClosed (extChartAt I c '' s) := by rw [f.image_eq_inter_preimage_of_subset_support hs] refine' ContinuousOn.preimage_closed_of_closed ((continuousOn_extChartAt_symm _ _).mono f.closed_ball_subset) _ hsc exact IsClosed.inter is_closed_ball I.closed_range #align smooth_bump_function.is_closed_image_of_is_closed SmoothBumpFunction.isClosed_image_of_isClosed /-- If `f` is a smooth bump function and `s` closed subset of the support of `f` (i.e., of the open ball of radius `f.R`), then there exists `0 < r < f.R` such that `s` is a subset of the open ball of radius `r`. Formally, `s ⊆ e.source ∩ e ⁻¹' (ball (e c) r)`, where `e = ext_chart_at I c`. -/ theorem exists_r_pos_lt_subset_ball {s : Set M} (hsc : IsClosed s) (hs : s ⊆ support f) : ∃ (r : _)(hr : r ∈ Ioo 0 f.r), s ⊆ (chartAt H c).source ∩ extChartAt I c ⁻¹' ball (extChartAt I c c) r := by set e := extChartAt I c have : IsClosed (e '' s) := f.is_closed_image_of_is_closed hsc hs rw [support_eq_inter_preimage, subset_inter_iff, ← image_subset_iff] at hs rcases exists_pos_lt_subset_ball f.R_pos this hs.2 with ⟨r, hrR, hr⟩ exact ⟨r, hrR, subset_inter hs.1 (image_subset_iff.1 hr)⟩ #align smooth_bump_function.exists_r_pos_lt_subset_ball SmoothBumpFunction.exists_r_pos_lt_subset_ball /-- Replace `r` with another value in the interval `(0, f.R)`. -/ def updateR (r : ℝ) (hr : r ∈ Ioo 0 f.r) : SmoothBumpFunction I c := ⟨⟨r, f.r, hr.1, hr.2⟩, f.closedBall_subset⟩ #align smooth_bump_function.update_r SmoothBumpFunction.updateR @[simp] theorem updateR_r {r : ℝ} (hr : r ∈ Ioo 0 f.r) : (f.updateR r hr).r = f.r := rfl #align smooth_bump_function.update_r_R SmoothBumpFunction.updateR_r /- warning: smooth_bump_function.update_r_r clashes with smooth_bump_function.update_r_R -> SmoothBumpFunction.updateR_r warning: smooth_bump_function.update_r_r -> SmoothBumpFunction.updateR_r is a dubious translation: lean 3 declaration is forall {E : Type.{u1}} [_inst_1 : NormedAddCommGroup.{u1} E] [_inst_2 : NormedSpace.{0, u1} Real E Real.normedField (NormedAddCommGroup.toSeminormedAddCommGroup.{u1} E _inst_1)] [_inst_3 : FiniteDimensional.{0, u1} Real E Real.divisionRing (NormedAddCommGroup.toAddCommGroup.{u1} E _inst_1) (NormedSpace.toModule.{0, u1} Real E Real.normedField (NormedAddCommGroup.toSeminormedAddCommGroup.{u1} E _inst_1) _inst_2)] {H : Type.{u2}} [_inst_4 : TopologicalSpace.{u2} H] {I : ModelWithCorners.{0, u1, u2} Real (DenselyNormedField.toNontriviallyNormedField.{0} Real Real.denselyNormedField) E _inst_1 _inst_2 H _inst_4} {M : Type.{u3}} [_inst_5 : TopologicalSpace.{u3} M] [_inst_6 : ChartedSpace.{u2, u3} H _inst_4 M _inst_5] [_inst_7 : SmoothManifoldWithCorners.{0, u1, u2, u3} Real (DenselyNormedField.toNontriviallyNormedField.{0} Real Real.denselyNormedField) E _inst_1 _inst_2 H _inst_4 I M _inst_5 _inst_6] {c : M} (f : SmoothBumpFunction.{u1, u2, u3} E _inst_1 _inst_2 _inst_3 H _inst_4 I M _inst_5 _inst_6 _inst_7 c) {r : Real} (hr : Membership.Mem.{0, 0} Real (Set.{0} Real) (Set.hasMem.{0} Real) r (Set.Ioo.{0} Real Real.preorder (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero))) (ContDiffBump.r.{u1} E (coeFn.{max (succ u3) (succ u1), max (succ u3) (succ u1)} (LocalEquiv.{u3, u1} M E) (fun (_x : LocalEquiv.{u3, u1} M E) => M -> E) (LocalEquiv.hasCoeToFun.{u3, u1} M E) (extChartAt.{0, u1, u3, u2} Real E M H (DenselyNormedField.toNontriviallyNormedField.{0} Real Real.denselyNormedField) _inst_1 _inst_2 _inst_4 _inst_5 I _inst_6 c) c) (SmoothBumpFunction.toContDiffBump.{u1, u2, u3} E _inst_1 _inst_2 _inst_3 H _inst_4 I M _inst_5 _inst_6 _inst_7 c f)))), Eq.{1} Real (ContDiffBump.r.{u1} E (coeFn.{max (succ u3) (succ u1), max (succ u3) (succ u1)} (LocalEquiv.{u3, u1} M E) (fun (_x : LocalEquiv.{u3, u1} M E) => M -> E) (LocalEquiv.hasCoeToFun.{u3, u1} M E) (extChartAt.{0, u1, u3, u2} Real E M H (DenselyNormedField.toNontriviallyNormedField.{0} Real Real.denselyNormedField) _inst_1 _inst_2 _inst_4 _inst_5 I _inst_6 c) c) (SmoothBumpFunction.toContDiffBump.{u1, u2, u3} E _inst_1 _inst_2 _inst_3 H _inst_4 I M _inst_5 _inst_6 _inst_7 c (SmoothBumpFunction.updateR.{u1, u2, u3} E _inst_1 _inst_2 _inst_3 H _inst_4 I M _inst_5 _inst_6 _inst_7 c f r hr))) r but is expected to have type forall {E : Type.{u1}} [_inst_1 : NormedAddCommGroup.{u1} E] [_inst_2 : NormedSpace.{0, u1} Real E Real.normedField (NormedAddCommGroup.toSeminormedAddCommGroup.{u1} E _inst_1)] [_inst_3 : FiniteDimensional.{0, u1} Real E Real.divisionRing (NormedAddCommGroup.toAddCommGroup.{u1} E _inst_1) (NormedSpace.toModule.{0, u1} Real E Real.normedField (NormedAddCommGroup.toSeminormedAddCommGroup.{u1} E _inst_1) _inst_2)] {H : Type.{u2}} [_inst_4 : TopologicalSpace.{u2} H] {I : ModelWithCorners.{0, u1, u2} Real (DenselyNormedField.toNontriviallyNormedField.{0} Real Real.denselyNormedField) E _inst_1 _inst_2 H _inst_4} {M : Type.{u3}} [_inst_5 : TopologicalSpace.{u3} M] [_inst_6 : ChartedSpace.{u2, u3} H _inst_4 M _inst_5] [_inst_7 : SmoothManifoldWithCorners.{0, u1, u2, u3} Real (DenselyNormedField.toNontriviallyNormedField.{0} Real Real.denselyNormedField) E _inst_1 _inst_2 H _inst_4 I M _inst_5 _inst_6] {c : M} (f : SmoothBumpFunction.{u1, u2, u3} E _inst_1 _inst_2 _inst_3 H _inst_4 I M _inst_5 _inst_6 _inst_7 c) {r : Real} (hr : Membership.Mem.{0, 0} Real (Set.{0} Real) (Set.hasMem.{0} Real) r (Set.Ioo.{0} Real Real.preorder (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero))) (ContDiffBump.r.{u1} E (coeFn.{max (succ u3) (succ u1), max (succ u3) (succ u1)} (LocalEquiv.{u3, u1} M E) (fun (_x : LocalEquiv.{u3, u1} M E) => M -> E) (LocalEquiv.hasCoeToFun.{u3, u1} M E) (extChartAt.{0, u1, u3, u2} Real E M H (DenselyNormedField.toNontriviallyNormedField.{0} Real Real.denselyNormedField) _inst_1 _inst_2 _inst_4 _inst_5 I _inst_6 c) c) (SmoothBumpFunction.toContDiffBump.{u1, u2, u3} E _inst_1 _inst_2 _inst_3 H _inst_4 I M _inst_5 _inst_6 _inst_7 c f)))), Eq.{1} Real (ContDiffBump.r.{u1} E (coeFn.{max (succ u3) (succ u1), max (succ u3) (succ u1)} (LocalEquiv.{u3, u1} M E) (fun (_x : LocalEquiv.{u3, u1} M E) => M -> E) (LocalEquiv.hasCoeToFun.{u3, u1} M E) (extChartAt.{0, u1, u3, u2} Real E M H (DenselyNormedField.toNontriviallyNormedField.{0} Real Real.denselyNormedField) _inst_1 _inst_2 _inst_4 _inst_5 I _inst_6 c) c) (SmoothBumpFunction.toContDiffBump.{u1, u2, u3} E _inst_1 _inst_2 _inst_3 H _inst_4 I M _inst_5 _inst_6 _inst_7 c (SmoothBumpFunction.updateR.{u1, u2, u3} E _inst_1 _inst_2 _inst_3 H _inst_4 I M _inst_5 _inst_6 _inst_7 c f r hr))) (ContDiffBump.r.{u1} E (coeFn.{max (succ u3) (succ u1), max (succ u3) (succ u1)} (LocalEquiv.{u3, u1} M E) (fun (_x : LocalEquiv.{u3, u1} M E) => M -> E) (LocalEquiv.hasCoeToFun.{u3, u1} M E) (extChartAt.{0, u1, u3, u2} Real E M H (DenselyNormedField.toNontriviallyNormedField.{0} Real Real.denselyNormedField) _inst_1 _inst_2 _inst_4 _inst_5 I _inst_6 c) c) (SmoothBumpFunction.toContDiffBump.{u1, u2, u3} E _inst_1 _inst_2 _inst_3 H _inst_4 I M _inst_5 _inst_6 _inst_7 c f)) Case conversion may be inaccurate. Consider using '#align smooth_bump_function.update_r_r SmoothBumpFunction.updateR_rₓ'. -/ @[simp] theorem updateR_r {r : ℝ} (hr : r ∈ Ioo 0 f.r) : (f.updateR r hr).R = r := rfl #align smooth_bump_function.update_r_r SmoothBumpFunction.updateR_r @[simp] theorem support_updateR {r : ℝ} (hr : r ∈ Ioo 0 f.r) : support (f.updateR r hr) = support f := by simp only [support_eq_inter_preimage, update_r_R] #align smooth_bump_function.support_update_r SmoothBumpFunction.support_updateR instance : Inhabited (SmoothBumpFunction I c) := Classical.inhabited_of_nonempty nhdsWithin_range_basis.Nonempty variable [T2Space M] theorem isClosed_symm_image_closedBall : IsClosed ((extChartAt I c).symm '' (closedBall (extChartAt I c c) f.r ∩ range I)) := f.isCompact_symm_image_closedBall.IsClosed #align smooth_bump_function.is_closed_symm_image_closed_ball SmoothBumpFunction.isClosed_symm_image_closedBall theorem tsupport_subset_symm_image_closedBall : tsupport f ⊆ (extChartAt I c).symm '' (closedBall (extChartAt I c c) f.r ∩ range I) := by rw [tsupport, support_eq_symm_image] exact closure_minimal (image_subset _ <| inter_subset_inter_left _ ball_subset_closed_ball) f.is_closed_symm_image_closed_ball #align smooth_bump_function.tsupport_subset_symm_image_closed_ball SmoothBumpFunction.tsupport_subset_symm_image_closedBall theorem tsupport_subset_extChartAt_source : tsupport f ⊆ (extChartAt I c).source := calc tsupport f ⊆ (extChartAt I c).symm '' (closedBall (extChartAt I c c) f.r ∩ range I) := f.tsupport_subset_symm_image_closedBall _ ⊆ (extChartAt I c).symm '' (extChartAt I c).target := (image_subset _ f.closedBall_subset) _ = (extChartAt I c).source := (extChartAt I c).symm_image_target_eq_source #align smooth_bump_function.tsupport_subset_ext_chart_at_source SmoothBumpFunction.tsupport_subset_extChartAt_source theorem tsupport_subset_chartAt_source : tsupport f ⊆ (chartAt H c).source := by simpa only [extChartAt_source] using f.tsupport_subset_ext_chart_at_source #align smooth_bump_function.tsupport_subset_chart_at_source SmoothBumpFunction.tsupport_subset_chartAt_source protected theorem hasCompactSupport : HasCompactSupport f := isCompact_of_isClosed_subset f.isCompact_symm_image_closedBall isClosed_closure f.tsupport_subset_symm_image_closedBall #align smooth_bump_function.has_compact_support SmoothBumpFunction.hasCompactSupport variable (I c) /-- The closures of supports of smooth bump functions centered at `c` form a basis of `𝓝 c`. In other words, each of these closures is a neighborhood of `c` and each neighborhood of `c` includes `tsupport f` for some `f : smooth_bump_function I c`. -/ theorem nhds_basis_tsupport : (𝓝 c).HasBasis (fun f : SmoothBumpFunction I c => True) fun f => tsupport f := by have : (𝓝 c).HasBasis (fun f : SmoothBumpFunction I c => True) fun f => (extChartAt I c).symm '' (closed_ball (extChartAt I c c) f.r ∩ range I) := by rw [← map_extChartAt_symm_nhdsWithin_range I c] exact nhds_within_range_basis.map _ refine' this.to_has_basis' (fun f hf => ⟨f, trivial, f.tsupport_subset_symm_image_closedBall⟩) fun f _ => f.tsupport_mem_nhds #align smooth_bump_function.nhds_basis_tsupport SmoothBumpFunction.nhds_basis_tsupport variable {c} /-- Given `s ∈ 𝓝 c`, the supports of smooth bump functions `f : smooth_bump_function I c` such that `tsupport f ⊆ s` form a basis of `𝓝 c`. In other words, each of these supports is a neighborhood of `c` and each neighborhood of `c` includes `support f` for some `f : smooth_bump_function I c` such that `tsupport f ⊆ s`. -/ theorem nhds_basis_support {s : Set M} (hs : s ∈ 𝓝 c) : (𝓝 c).HasBasis (fun f : SmoothBumpFunction I c => tsupport f ⊆ s) fun f => support f := ((nhds_basis_tsupport I c).restrict_subset hs).to_has_basis' (fun f hf => ⟨f, hf.2, subset_closure⟩) fun f hf => f.support_mem_nhds #align smooth_bump_function.nhds_basis_support SmoothBumpFunction.nhds_basis_support variable [SmoothManifoldWithCorners I M] {I} /-- A smooth bump function is infinitely smooth. -/ protected theorem smooth : Smooth I 𝓘(ℝ) f := by refine' contMdiff_of_support fun x hx => _ have : x ∈ (chart_at H c).source := f.tsupport_subset_chart_at_source hx refine' ContMdiffAt.congr_of_eventuallyEq _ (f.eq_on_source.eventually_eq_of_mem <| IsOpen.mem_nhds (chart_at _ _).open_source this) exact f.to_cont_diff_bump.cont_diff_at.cont_mdiff_at.comp _ (contMdiffAt_ext_chart_at' this) #align smooth_bump_function.smooth SmoothBumpFunction.smooth protected theorem smoothAt {x} : SmoothAt I 𝓘(ℝ) f x := f.smooth.SmoothAt #align smooth_bump_function.smooth_at SmoothBumpFunction.smoothAt protected theorem continuous : Continuous f := f.smooth.Continuous #align smooth_bump_function.continuous SmoothBumpFunction.continuous /-- If `f : smooth_bump_function I c` is a smooth bump function and `g : M → G` is a function smooth on the source of the chart at `c`, then `f • g` is smooth on the whole manifold. -/ theorem smooth_smul {G} [NormedAddCommGroup G] [NormedSpace ℝ G] {g : M → G} (hg : SmoothOn I 𝓘(ℝ, G) g (chartAt H c).source) : Smooth I 𝓘(ℝ, G) fun x => f x • g x := by apply contMdiff_of_support fun x hx => _ have : x ∈ (chart_at H c).source calc x ∈ tsupport fun x => f x • g x := hx _ ⊆ tsupport f := (tsupport_smul_subset_left _ _) _ ⊆ (chart_at _ c).source := f.tsupport_subset_chart_at_source exact f.smooth_at.smul ((hg _ this).ContMdiffAt <| IsOpen.mem_nhds (chart_at _ _).open_source this) #align smooth_bump_function.smooth_smul SmoothBumpFunction.smooth_smul end SmoothBumpFunction
Virginia Beach, Va. – Torrential rain and strong winds suspended the first round of stroke-play qualifying at the 2011 U.S. Women’s Mid-Amateur Championship, being conducted at 6,187-yard, par-72 Bayville Golf Club in Virginia Beach, Va. Round one will resume at 8 a.m. on Sunday, with play proceeding in 10-minute intervals. The second round of stroke-play qualifying is scheduled to begin at 1:30 p.m. Bayville G.C. received approximately 1 inch of rain on Saturday, which fell on ground that was already saturated from the more than 8 inches that had fallen in the past two weeks. Following an initial suspension due to unplayable conditions at 12:45 p.m., the announcement that play had been suspended for the day came at 4:15 p.m. from Championship Director Donna Mummert. Puddling and casual-water accumulations in the fairways, as well as the forecast for constant afternoon rain, were the key factors that led to Mummert’s decision. We had instances where players were having to take relief from casual water a significant distance from where their balls had come to rest, said Mummert, in some cases actually going from the fairway to the rough. That’s when we know that we’re not playing the game properly. The ground was just so saturated that if we were able to get out there and put the squeegees to the fairways, we weren’t buying enough of a break for when the rain would come back. While all 66 players with morning tee times started their rounds, only nine players were able to finish before play was suspended. Marilyn Hardy, 50, of Houston, Texas, is the clubhouse leader with a score of 10-over 82. Seven players from the afternoon wave had begun their rounds before the suspension of play, including 2010 runner-up and Virginia Beach resident Carol Robertson, 28. Defending champion Meghan Stasi, 33, of Oakland Park, Fla., was among the 59 players who did not tee off.
State Before: n : ℕ P : MvPFunctor (n + 1) α : TypeVec n β : Type u g : β → Obj P (α ::: β) x : β ⊢ dest P (corec P g x) = (TypeVec.id ::: corec P g) <$$> g x State After: n : ℕ P : MvPFunctor (n + 1) α : TypeVec n β : Type u g : β → Obj P (α ::: β) x : β ⊢ dest P (corec P g x) = ?m.38931 n : ℕ P : MvPFunctor (n + 1) α : TypeVec n β : Type u g : β → Obj P (α ::: β) x : β ⊢ ?m.38931 = (TypeVec.id ::: corec P g) <$$> g x n : ℕ P : MvPFunctor (n + 1) α : TypeVec n β : Type u g : β → Obj P (α ::: β) x : β ⊢ Obj P (α ::: M P α) Tactic: trans State Before: n : ℕ P : MvPFunctor (n + 1) α : TypeVec n β : Type u g : β → Obj P (α ::: β) x : β ⊢ dest P (corec P g x) = ?m.38931 n : ℕ P : MvPFunctor (n + 1) α : TypeVec n β : Type u g : β → Obj P (α ::: β) x : β ⊢ ?m.38931 = (TypeVec.id ::: corec P g) <$$> g x n : ℕ P : MvPFunctor (n + 1) α : TypeVec n β : Type u g : β → Obj P (α ::: β) x : β ⊢ Obj P (α ::: M P α) State After: n : ℕ P : MvPFunctor (n + 1) α : TypeVec n β : Type u g : β → Obj P (α ::: β) x : β ⊢ { fst := (g x).fst, snd := splitFun (dropFun (g x).snd) ((corec' P (fun b => (g b).fst) (fun b => dropFun (g b).snd) fun b => lastFun (g b).snd) ∘ lastFun (g x).snd) } = (TypeVec.id ::: corec P g) <$$> g x Tactic: apply M.dest_corec' State Before: n : ℕ P : MvPFunctor (n + 1) α : TypeVec n β : Type u g : β → Obj P (α ::: β) x : β ⊢ { fst := (g x).fst, snd := splitFun (dropFun (g x).snd) ((corec' P (fun b => (g b).fst) (fun b => dropFun (g b).snd) fun b => lastFun (g b).snd) ∘ lastFun (g x).snd) } = (TypeVec.id ::: corec P g) <$$> g x State After: case mk n : ℕ P : MvPFunctor (n + 1) α : TypeVec n β : Type u g : β → Obj P (α ::: β) x : β a : P.A f : B P a ⟹ α ::: β ⊢ { fst := { fst := a, snd := f }.fst, snd := splitFun (dropFun { fst := a, snd := f }.snd) ((corec' P (fun b => (g b).fst) (fun b => dropFun (g b).snd) fun b => lastFun (g b).snd) ∘ lastFun { fst := a, snd := f }.snd) } = (TypeVec.id ::: corec P g) <$$> { fst := a, snd := f } Tactic: cases' g x with a f State Before: case mk n : ℕ P : MvPFunctor (n + 1) α : TypeVec n β : Type u g : β → Obj P (α ::: β) x : β a : P.A f : B P a ⟹ α ::: β ⊢ { fst := { fst := a, snd := f }.fst, snd := splitFun (dropFun { fst := a, snd := f }.snd) ((corec' P (fun b => (g b).fst) (fun b => dropFun (g b).snd) fun b => lastFun (g b).snd) ∘ lastFun { fst := a, snd := f }.snd) } = (TypeVec.id ::: corec P g) <$$> { fst := a, snd := f } State After: case mk n : ℕ P : MvPFunctor (n + 1) α : TypeVec n β : Type u g : β → Obj P (α ::: β) x : β a : P.A f : B P a ⟹ α ::: β ⊢ { fst := a, snd := splitFun (dropFun f) ((corec' P (fun b => (g b).fst) (fun b => dropFun (g b).snd) fun b => lastFun (g b).snd) ∘ lastFun f) } = (TypeVec.id ::: corec P g) <$$> { fst := a, snd := f } Tactic: dsimp State Before: case mk n : ℕ P : MvPFunctor (n + 1) α : TypeVec n β : Type u g : β → Obj P (α ::: β) x : β a : P.A f : B P a ⟹ α ::: β ⊢ { fst := a, snd := splitFun (dropFun f) ((corec' P (fun b => (g b).fst) (fun b => dropFun (g b).snd) fun b => lastFun (g b).snd) ∘ lastFun f) } = (TypeVec.id ::: corec P g) <$$> { fst := a, snd := f } State After: case mk n : ℕ P : MvPFunctor (n + 1) α : TypeVec n β : Type u g : β → Obj P (α ::: β) x : β a : P.A f : B P a ⟹ α ::: β ⊢ { fst := a, snd := splitFun (dropFun f) ((corec' P (fun b => (g b).fst) (fun b => dropFun (g b).snd) fun b => lastFun (g b).snd) ∘ lastFun f) } = { fst := a, snd := (TypeVec.id ::: corec P g) ⊚ f } Tactic: rw [MvPFunctor.map_eq] State Before: case mk n : ℕ P : MvPFunctor (n + 1) α : TypeVec n β : Type u g : β → Obj P (α ::: β) x : β a : P.A f : B P a ⟹ α ::: β ⊢ { fst := a, snd := splitFun (dropFun f) ((corec' P (fun b => (g b).fst) (fun b => dropFun (g b).snd) fun b => lastFun (g b).snd) ∘ lastFun f) } = { fst := a, snd := (TypeVec.id ::: corec P g) ⊚ f } State After: case mk.e_snd n : ℕ P : MvPFunctor (n + 1) α : TypeVec n β : Type u g : β → Obj P (α ::: β) x : β a : P.A f : B P a ⟹ α ::: β ⊢ splitFun (dropFun f) ((corec' P (fun b => (g b).fst) (fun b => dropFun (g b).snd) fun b => lastFun (g b).snd) ∘ lastFun f) = (TypeVec.id ::: corec P g) ⊚ f Tactic: congr State Before: case mk.e_snd n : ℕ P : MvPFunctor (n + 1) α : TypeVec n β : Type u g : β → Obj P (α ::: β) x : β a : P.A f : B P a ⟹ α ::: β ⊢ splitFun (dropFun f) ((corec' P (fun b => (g b).fst) (fun b => dropFun (g b).snd) fun b => lastFun (g b).snd) ∘ lastFun f) = (TypeVec.id ::: corec P g) ⊚ f State After: no goals Tactic: conv => rhs rw [← split_dropFun_lastFun f, appendFun_comp_splitFun]
import Mathlib.Data.Nat.Basic import Mathlib.Algebra.Ring.Basic import Mathlib.Data.Nat.Parity import Mathlib.Data.Nat.Pow import Mathlib.Tactic.Ring def f (n : Nat) : Nat := if n = 0 then 0 else if Odd n then f (n - 1) + 1 else f (n / 2) termination_by f n => n decreasing_by simp_wf have h : n ≠ 0 := by assumption first | apply Nat.pred_lt h | apply Nat.div_lt_self (Nat.zero_lt_of_ne_zero h) simp def g (n : Nat) : Nat := if n = 0 then 0 else g (n - 2 ^ (Nat.log2 n)) + 1 termination_by g n => n decreasing_by simp_wf have h : n ≠ 0 := by assumption apply Nat.sub_lt (Nat.zero_lt_of_ne_zero h) apply Nat.pos_pow_of_pos simp lemma log2_of_2kj (k : ℕ) (j : ℕ) (h : j<2^k): Nat.log2 (2 ^ k+j) = k := by revert j induction k with | zero => intros j h simp at h rw [h] simp | succ k ih => intros j h unfold Nat.log2 split_ifs simp [Nat.pow_succ] have _ : Even (2^k*2) := by simp [Nat.even_pow] have twopos : 2>0 := by simp have h2 : (2^k*2+j)/2=(2^k+(j/2)) := by match (Nat.even_or_odd j) with | Or.inl a => have _ : Even (2^k*2+j) := by rw [Nat.even_add] tauto rw [← mul_right_cancel_iff_of_pos twopos,Nat.div_two_mul_two_of_even, add_mul, Nat.div_two_mul_two_of_even] assumption assumption | Or.inr a => have _ : Odd (2^k*2+j) := by rw [add_comm, Nat.odd_add] tauto rw [← mul_right_cancel_iff_of_pos twopos, ← add_left_inj 1, Nat.div_two_mul_two_add_one_of_odd, add_mul, add_assoc, Nat.div_two_mul_two_add_one_of_odd] assumption assumption rw [h2] apply ih rw [Nat.pow_succ] at h apply by_contradiction simp intro h3 have h4: j/2*2≥2^k*2 := by simp assumption have h5: j/2*2≤ j := by match (Nat.even_or_odd j) with | Or.inl a => rw [Nat.div_two_mul_two_of_even] simp apply a | Or.inr a => have b := Nat.div_two_mul_two_add_one_of_odd a have c := Nat.le_succ j conv at c => lhs rw [← b] rw [Nat.succ_eq_add_one] at c simp at c apply c have _ := Nat.lt_of_le_of_lt (Nat.le_trans h4 h5) h have _ := Nat.lt_irrefl (2^k*2) contradiction have h2: 2≤2^Nat.succ k := by rw [Nat.pow_succ] simp apply Nat.pos_pow_of_pos simp have _ := Nat.le_trans h2 (Nat.le_add_right (2^Nat.succ k) j) contradiction theorem can_split (n:ℕ): (∃ k:ℕ, ∃j:ℕ, j<2^k∧ Nat.succ n=2^k+j):= by induction n with | zero => apply Exists.intro 0 apply Exists.intro 0 simp | succ n ih => match ih with | ⟨k,j,lhs,rhs⟩ => have j1leq2k : j+1≤2^k := by apply Nat.le_of_lt_succ rw [Nat.succ_eq_add_one] simp apply lhs have mycases : j+1<2^k ∨ j+1=2^k := by rw [← le_iff_lt_or_eq] apply j1leq2k match mycases with | Or.inl lt => apply Exists.intro k apply Exists.intro (j+1) apply And.intro lt rw [rhs] rw [Nat.succ_eq_add_one] rw [add_assoc] | Or.inr eq => apply Exists.intro (Nat.succ k) apply Exists.intro 0 apply And.intro simp rw [Nat.pow_succ, Nat.add_zero] have two_eq_one_plus_one : 2=1+1 := by simp conv => rhs congr rfl rw [two_eq_one_plus_one] rw [Nat.mul_add, Nat.mul_one] conv => rhs congr rfl rw [← eq] rw [rhs] rw [Nat.succ_eq_add_one] rw [add_assoc] lemma pow2_inc (n m : ℕ) (h : 2 ^ n < 2^m) : n < m := by apply by_contradiction simp intro h2 have h3:2^n≥2^m := by match (Nat.le.dest h2) with | Exists.intro k hk => rw [← hk] rw [pow_add] simp apply Nat.pos_pow_of_pos simp have _:= Nat.lt_irrefl (2^m) have _:= Nat.lt_of_le_of_lt h3 h contradiction lemma pow2_nz (n : ℕ) : 2^n ≠ 0 := by apply Nat.ne_of_gt apply Nat.pos_pow_of_pos n simp lemma pow2p_nz (n j : ℕ) : 2^n+j ≠ 0 := by apply Nat.ne_of_gt apply Nat.lt_of_lt_of_le _ (Nat.le_add_right (2^n) j) apply Nat.pos_pow_of_pos n simp theorem q6 (n : ℕ) : f n = g n := by apply Nat.strong_rec_on n intro n ih cases n with | zero => simp | succ n => have x := can_split n match x with | ⟨k, j, lhs, rhs⟩ => rw [rhs] match k with | Nat.zero => simp at lhs rw [lhs] rw [f, g] simp | Nat.succ k => match (Nat.even_or_odd j) with | Or.inl je => have x : Even (2^Nat.succ k) := by simp [Nat.even_pow] have ne : Even (2^Nat.succ k+j) := by rw [Nat.even_add] tauto rw [f] simp split_ifs . rw [ih ((2 ^ Nat.succ k + j) / 2)] have twopos : 2>0:=by simp have div: (2 ^ Nat.succ k + j) / 2 = (2 ^ Nat.succ k/2 + j/2) := by rw [← mul_right_cancel_iff_of_pos twopos] rw [Nat.div_two_mul_two_of_even, add_mul, Nat.div_two_mul_two_of_even, Nat.div_two_mul_two_of_even] assumption assumption assumption conv at div => rhs rw [Nat.pow_succ] rw [div] rw [g] have _ := pow2_nz (k) simp split_ifs tauto have lt: j/2*2<2^k*2:= by rw [Nat.div_two_mul_two_of_even] rw [← Nat.pow_succ] assumption assumption simp at lt have reduce := log2_of_2kj k (j / 2) lt rw [reduce] simp apply Eq.symm rw [g] simp have reduce := log2_of_2kj (Nat.succ k) (j) lhs rw [reduce] simp rw [← ih j] rw [f] split_ifs have j0 :j=0:= by assumption rw [j0] simp have jo :Odd j:= by assumption rw [Nat.even_iff_not_odd] at je contradiction have lt1:2^k<2^Nat.succ k + j:= by rw [Nat.pow_succ] have x:2 ^ k < 2 ^ k * 2:= by simp apply Nat.lt_of_lt_of_le x (Nat.le_add_right (2^k*2) j) rw [← rhs] at lt1 rw [ih (j/2) (Nat.lt_trans lt lt1)] rw [rhs] simp rw [← rhs] apply Nat.div_lt_self simp simp . contradiction | Or.inr jo => rw [f] simp have k2 :(2^Nat.succ k)>1:= by simp have ke: Even (2^Nat.succ k) := by simp [Nat.even_pow] have kjo : Odd (2^Nat.succ k+j):= by rw [add_comm] rw [Nat.odd_add] tauto split_ifs rw [Nat.odd_iff_not_even] at kjo contradiction rw [f] have jg0:j>0:= by apply by_contradiction simp intro jz rw [jz] at jo contradiction have oo : Odd 1:= by simp have jm1e : Even (j-1) := by rw [Nat.even_sub'] tauto have x := Nat.succ_lt_succ jg0 rw [Nat.succ_eq_add_one] at x simp at x apply Nat.le_of_lt_succ x split_ifs have wrong:2 ^ Nat.succ k + j - 1 = 0:=by assumption simp at wrong have right:=Nat.lt_of_lt_of_le k2 (Nat.le_add_right (2^Nat.succ k) j) have _ := Nat.not_le_of_gt right contradiction have kj1e : Even (2^Nat.succ k+j-1):= by rw [Nat.even_sub'] tauto apply Nat.le_trans (Nat.le_of_lt k2) (Nat.le_add_right (2^Nat.succ k) j) rw [Nat.even_iff_not_odd] at kj1e contradiction have reduce : (2 ^ Nat.succ k + j - 1) / 2*2 = (2 ^ Nat.succ k / 2 + (j-1)/2)*2:=by rw [Nat.div_two_mul_two_of_even, add_mul, Nat.div_two_mul_two_of_even, Nat.div_two_mul_two_of_even] have jsp:j-1+1=j:= by apply Nat.succ_pred simp apply Nat.ne_of_gt apply jg0 have t : 2 ^ Nat.succ k + j - 1+1 = 2 ^ Nat.succ k + (j - 1)+1:= by rw [add_assoc] rw [jsp] apply Nat.succ_pred simp simp at t apply t rw [Nat.even_sub'] tauto apply (Nat.succ_le_of_lt jg0) assumption have x : ¬Odd (2 ^ Nat.succ k + j - 1):= by assumption rw [← Nat.even_iff_not_odd] at x apply x simp at reduce conv at reduce => rhs rw [Nat.pow_succ] simp rw [reduce] rw [ih (2^k+(j-1)/2)] rw [g] split_ifs have _:= pow2p_nz k ((j-1)/2) contradiction have j1lt2k : (j-1)/2*2<2^k*2:= by rw [Nat.div_two_mul_two_of_even] rw [← Nat.pow_succ] have x:j-1≤ j:= by simp apply Nat.lt_of_le_of_lt x lhs assumption simp at j1lt2k have l2 := log2_of_2kj k ((j-1)/2) j1lt2k rw [l2] simp apply Eq.symm rw [g] simp have l2 := log2_of_2kj (Nat.succ k) (j) lhs rw [l2] simp rw [← ih j] rw [f] split_ifs have jn0 :¬ j=0:= Nat.ne_of_gt jg0 contradiction rw [f] split_ifs have j1e0: j-1=0:= by assumption rw [j1e0] simp rw [Nat.even_iff_not_odd] at jm1e contradiction rw [ih ((j-1)/2)] have x:2^k<Nat.succ n:= by have x:2^k<2^Nat.succ k:= by rw [Nat.pow_succ] simp apply Nat.lt_of_lt_of_le x (Nat.le.intro (Eq.symm rhs)) apply Nat.lt_trans j1lt2k x apply Nat.lt_of_lt_of_le lhs (Nat.le.intro (Eq.symm rhs)) have p1: 2 ^ k + (j - 1) / 2< 2 ^ Nat.succ k + j:= by rw [Nat.pow_succ] simp have x:2 ^ k < 2 ^ k * 2:= by simp have y:(j-1)/2*2 < j*2 := by rw [Nat.div_two_mul_two_of_even] have tg0: 2>1:= by simp have jj2:= lt_mul_right jg0 tg0 apply Nat.lt_of_le_of_lt (Nat.pred_le j) jj2 assumption simp at y apply Nat.add_lt_add x y rw [← rhs] at p1 apply p1
(* @hatsugai さんの等式論理の証明チェッカ http://www.principia-m.com/ts/0072/index-jp.html を自分でもやりたくて、Coq/SSReflect で「==」を「=」にReflectすることまでは考えついた。 でも、実際には、move=>とcaseで、trueとfalseの場合分けを尽すだけで解けてしまう。 曰く、 Goal forall p q, p && q == p == q == p || q. Proof. move=> p q. by case p; case q. Qed. Goal forall p q r, p || (q == r) == p || q == p || r. Proof. move=> p q r. by case p; case q; case r. Qed. ProofとQedを含めても、5語でできる証明チェッカですね。 ここで、「==」はbool->bool->bool 、「=」はbool->bool->Propです。 これでは、おもしろくないので、caseを使わない証明を考えよう。 *) Require Import ssreflect ssrbool eqtype ssrnat. Require Import seq ssrfun. Section Equational_logic. Check eq_op. (* == *) Check eqP. (* reflect (?2 = ?3) (?2 == ?3) *) Check _ =P _. (* reflect (?2 = ?3) (?2 == ?3) *) Check eqb. (* bool -> bool -> bool *) (* Lemma predU1P : reflect (p = q \/ b) ((p == q) || b). Lemma pred2P : reflect (p = q \/ z = u) ((p == q) || (z == u)). *) Theorem eq_refl : forall (p : bool), p == p. Proof. move=> p. by apply/eqP. Qed. Lemma eq_assoc : forall p q r, (p == q == r) = (p == (q == r)). Proof. move=> p q r. by case: p; case: q; case r. Qed. Lemma eq_sym' : forall (p q : bool), (p == q) = (q == p). Proof. move=> p q. by case p; case q. Qed. Theorem eq_sym : forall (p q : bool), p == q == q == p. Proof. move=> p q. rewrite eq_assoc. apply/eqP. apply eq_sym'. Qed. Lemma ne_sym' : forall (p q : bool), (p != q) = (q != p). Proof. move=> p q. by case p; case q. Qed. Theorem ne_sym : forall (p q : bool), (p != q) == (q != p). move=> p q. apply/eqP. apply ne_sym'. Qed. Lemma eq_del_true' : forall (p : bool), (true == p) = p. Proof. done. Qed. Theorem eq_del_true : forall (p : bool), true == p == p. Proof. move=> p. apply/eqP. apply eq_del_true'. Qed. (* move=> p. split. (* -> *) move=> H. case H. done. (* <- *) move/eqP=> H. bq rewrite -H. *) Lemma eq_del_false' : forall (p : bool), false == p = ~~p. Proof. done. Qed. Theorem eq_del_false : forall (p : bool), false == p = ~~p. Proof. done. Qed. Theorem eq_del_true'' : forall (p : bool), reflect p (true == p). Proof. move=> p. case: p. by apply ReflectT. by apply ReflectF. Qed. Lemma eq_neg' : forall (p q : bool), ~~(p == q) = (~~p == q). Proof. move=> p q. by case p; case q. Qed. Theorem eq_nag : forall (p q : bool), ~~(p == q) == ~~p == q. Proof. move=> p q. by case p; case q. (* rewrite eq_assoc. apply/eqP. apply eq_neg'. *) Qed. Theorem eq_false : false == ~~true. Proof. done. Qed. Lemma eq_notp_q' : forall p q, (~~p == q) = (p == ~~q). Proof. move=> p q. rewrite [_ == ~~_]eq_sym'. rewrite -[~~_ == _]eq_neg'. rewrite -[~~_ == _]eq_neg'. rewrite -ne_sym'. done. Qed. Theorem eq_notp_q : forall p q, ~~p == q == p == ~~q. Proof. move=> p q. by case p; case q. (* rewrite eq_assoc. apply/eqP. apply eq_notp_q'. *) Qed. Lemma eq_dbl_neg' : forall p, ~~ ~~p = p. Proof. move=> p. case p; rewrite //. Qed. Theorem eq_dbl_neg : forall p, ~~ ~~p == p. Proof. move=> p. by case p. (* apply/eqP. apply eq_dbl_neg'. *) Qed. Theorem eq_or : forall p q r, p || (q == r) == p || q == p || r. Proof. move=> p q r. by case p; case q; case r. Qed. Theorem eq_imp : forall p q, p ==> q == p || q == q. Proof. move=> p q. by case p; case q. Qed. Theorem eq_gold_law : forall p q, p && q == p == q == p || q. Proof. move=> p q. by case p; case q. Qed. End Equational_logic.
[STATEMENT] lemma valid_true[simp]: "(\<sigma> \<Turnstile> (s \<leftarrow> return x ; return (P s))) = P x" [PROOF STATE] proof (prove) goal (1 subgoal): 1. (\<sigma> \<Turnstile> ( s \<leftarrow> unit\<^sub>S\<^sub>E x; unit\<^sub>S\<^sub>E (P s))) = P x [PROOF STEP] by(simp add: valid_SE_def unit_SE_def bind_SE_def)
Jonathon Leathers attended UC Davis from 2003 until graduating in 2007. He became President of the Davis College Green Party in his first year at UC Davis and remained President until he graduated. Off campus he served as the Chair of the County Council of the Green Party of Yolo County while living in Davis. Jonathon Leathers unsuccessfully ran for ASUCD ASUCD Senate Senate twice. His first campaign was in the Fall 2004 ASUCD Election on the SOSSS slate where he fell 42 votes short of being elected. He ran again, this time as an Independent independent, in the Winter 2005 ASUCD Election. Following the Winter election he was appointed as the Chair of the ASUCD Elections Committee and held that position for two consecutive years: 20052006 and 20062007. Jonathon was a supporter of Choice Voting in ASUCD elections and even wrote the Countback Amendment to utilize election data for filing Senate vacancies. During his time in ASUCD, Jonathon was involved in a number of controversial situations. These are just a few: Fall 2005 ASUCD Election/Unqualified Candidates Scandal Fall 2005 ASUCD Election/Turnout Controversy Election Statement Controversy In 2007, Jonathon Leathers left Davis and moved to Portland, Oregon. He currently lives in Vancouver, B.C. More information Users/JonathonLeathers Jons personal page http://www.jtleathers.com/asucd/elections.html Jons ASUCD Election History Website
import data.padics imo2019_4 instance two_prime : nat.prime 2 := by norm_num lemma aux1 (n : ℕ) : padic_val_rat 2 (n + 1).fact = padic_val_rat 2 (n + 1) + padic_val_rat 2 n.fact := begin rw (show (n + 1).fact = (n + 1) * n.fact, from rfl), rw nat.cast_mul, rw padic_val_rat.mul 2, refl, -- side conditions norm_cast, exact dec_trivial, norm_cast, have := nat.fact_pos n, linarith, -- I have no shame end lemma aux2 (d : ℕ) : padic_val_rat 2 (2 * d + 1 : ℕ) = 0 := begin show padic_val_rat 2 ((2 * d + 1) : ℤ) = 0, rw padic_val_rat.padic_val_rat_of_int, norm_cast, convert enat.get_zero _, apply multiplicity.multiplicity_eq_zero_of_not_dvd, rintro ⟨c, hc⟩, apply @zero_ne_one ℕ, calc 0 = (2 * c) % 2 : (nat.mul_mod_right _ _).symm ... = (2 * d + 1) % 2 : by rw hc ... = _ : nat.mod_two_of_bodd (2 * d + 1) ... = 1 : by simp, -- now pick up the pieces all_goals {exact dec_trivial}, end lemma two_adic_val_fact_even (n : ℕ) : padic_val_rat 2 ((2 * n).fact) = n + padic_val_rat 2 n.fact := begin induction n with d hd, show padic_val_rat 2 1 = 0 + padic_val_rat 2 1, rw zero_add, rw (show 2 * nat.succ d = 2 * d + 1 + 1, by ring), rw [aux1, aux1, hd], norm_cast, rw (show 2 * d + 1 + 1 = 2 * (d + 1), by ring), rw nat.cast_mul, rw padic_val_rat.mul 2, rw padic_val_rat.padic_val_rat_self, rw (show nat.succ d = d + 1, from rfl), rw aux1, rw aux2, simp, all_goals {try {norm_cast}, exact dec_trivial}, end lemma two_adic_val_fact_odd (n : ℕ) : padic_val_rat 2 ((2 * n + 1).fact) = n + padic_val_rat 2 n.fact := begin rw aux1, convert two_adic_val_fact_even n, convert zero_add _, convert aux2 n, end lemma even_or_odd (n : ℕ) : ∃ c, n = 2 * c ∨ n = 2 * c + 1 := begin induction n with d hd, use 0, left, refl, cases hd with e he, cases he, use e, right, rw he, use (e + 1), left, rw he, ring, end lemma two_adic_val_fact (d : ℕ) : padic_val_rat 2 d.fact = d / 2 + padic_val_rat 2 (d / 2).fact := begin cases (even_or_odd d) with n hn, cases hn, { rw hn, convert two_adic_val_fact_even n, norm_cast, all_goals {rw [mul_comm, nat.mul_div_cancel], exact dec_trivial}, }, { rw hn, convert two_adic_val_fact_odd n, norm_cast, all_goals {rw [add_comm, nat.add_mul_div_left], convert zero_add _, exact dec_trivial}, } end lemma easy (n : ℕ) : n / 2 + n / 2 ≤ n := begin cases even_or_odd n, cases h, rw [h, nat.mul_div_right], linarith, exact dec_trivial, rw add_comm at h, rw h, rw nat.add_mul_div_left, rw (show 1 / 2 = 0, from dec_trivial), linarith, -- finally! exact dec_trivial, end lemma two_adic_val_fact_lt (n : ℕ) (h : n ≠ 0) : padic_val_rat 2 n.fact < n := begin revert h, apply nat.strong_induction_on n, clear n, intros m hm, by_cases h1 : m = 1, intro h0, rw h1, show padic_val_rat 2 1 < 1, rw padic_val_rat.one, exact dec_trivial, intro h, rw two_adic_val_fact m, have := hm (m / 2) _ _, refine lt_of_lt_of_le (add_lt_add_left this _) _, norm_cast, exact easy m, rw nat.div_lt_iff_lt_mul', rw mul_two, apply nat.lt_add_of_zero_lt_left, exact nat.pos_of_ne_zero h, -- now pick up the pieces exact dec_trivial, intro h2, rw nat.div_eq_zero_iff at h2, cases h2 with c hc, apply h1, refl, cases hc with d hd, apply h, refl, cases hd, exact dec_trivial, end lemma aux_53 : ∀ (m : enat) (n : ℕ) (h : m.dom), m.get h < n → m < (n : enat) := begin intros, rw (show m = m.get h, by simp), norm_cast, assumption, end lemma multiplicity_two_fact_lt (n : ℕ) (h : n ≠ 0) : multiplicity 2 n.fact < n := begin have h1 : padic_val_rat 2 (nat.fact n : ℤ) < ↑n := two_adic_val_fact_lt n h, rw padic_val_rat.padic_val_rat_of_int at h1, have h2 := (@int.coe_nat_lt ((multiplicity ↑2 ↑(nat.fact n)).get _) n).1 h1, -- ?? swap, rw ←multiplicity.finite_iff_dom, rw multiplicity.finite_int_iff, split, exact dec_trivial, norm_cast, exact nat.fact_ne_zero n, rw multiplicity.int.coe_nat_multiplicity 2 n.fact, apply aux_53, exact h2, -- tidying up exact dec_trivial, norm_cast, exact nat.fact_ne_zero n, end
PI and our global partners have been at the forefront of challenging communications data retention for over a decade. Communications data, also known as metadata, tells the story about your data and answers the who, when, what, and how of a specific communication and activity. Companies are supposed to delete this data when it is no longer necessary, because it can be highly revelatory about people, their habits, thoughts, health and personal relationships. Governments worldwide seek to oblige companies to retain this communications data so that they can get access at some point in the future. In a context where the gathering and exploitation of data by private companies becomes increasingly privacy intrusive and widespread, data retention poses risks to individual privacy and data security. The data opens the door for governments and third parties to make intimate inferences about individuals, and to engage in profiling. Many of the laws introduced by governments demand indiscriminate and mass retention of data, beyond what is admissible under applicable international human rights standards. In turn, these laws result in the indiscriminate creation of vast dossiers of information on everyone’s activities, including location data and communications with friends, families and work colleagues. There are alternative methods of surveillance that are less disproportionate, for example, requiring a court order to allow operators to retain data related to a specific individual suspected of criminal activity. Privacy International has been at the forefront of challenging data retention. We have been tracking the spread of these laws, raising awareness about the risks of metadata surveillance, and campaigning against their adoption. Given its international influence, and the fact that the US has to date refrained from placing data retention obligations on communications service providers, much of the battleground on data retention has been in Europe. By the early 2000s, some EU member states had enacted national data retention laws, and were pushing for mandatory data retention regulations across the entirety of the EU. In 2003, a draft Framework Decision on data retention under discussion by EU Justice and Home Affairs Ministers sought to oblige Member States to require communications providers to retain for up to two years. In response, PI published a legal memorandum reviewing the proposal, critically analysing existing retention laws in Member States, and argued that these retention policies were not in accordance with law, were not necessary in a democratic society, and therefore violated the right to privacy as protected by the European Convention on Human Rights. We built coalitions, drafted joint letters, and repeatedly gave evidence at various Parliaments. For a while we were successful in pushing back against repeated attempts to create a legal regime across Europe. Following the terrorist attacks in London in July 2005, the European Parliament, under the UK Presidency of the EC, decided to approve the Data Retention Directive. Despite the decision however, some EU member states continued to mandate data retention provisions, with the UK parliament rushing through the Data Retention and Investigatory Powers Act (DRIPA), to intense criticism from legal and technical experts. As a result, DRIPA was challenged in court through judicial review by two Members of the UK Parliament, Tom Watson and David Davis. Intervening in the UK High Court, we argued that data retention was in itself unlawful, and reform couldn't be limited to just creating a system of safeguards required around government access to retained data. The case was referred all the way up to the Courts of Justice of the EU (CJEU), whose job it is to rule on the application of EU law across the Union. Courts have recognised that blanket data retention obligations represent a violation of the right to privacy and data protection law. In December 2016, the European Court of Justice reaffirmed the 2014 ruling against data retention and expanded upon it, ruling that “general and indiscriminate retention” of data was in fact prohibited, that retention and any access to the data must be strictly necessary for the purpose of fighting serious crime, and that access to the retained data by the Government must be subject to prior review by a court or independent authority. The decision has far-reaching implications. While the judgment was not specific about other surveillance powers, it also implicated other surveillance laws, such as those contained within the UK’s Investigatory Powers Act. The judgment raised significant questions about whether vast swathes of the new laws should now be repealed. Governments play a long game. This was a 17 year battle. We thought we had achieved victory after victory only to for our victories to be undermined by governments. If we were winning at the national level, governments would seize on terrorist attacks. If we pushed back successfully, they would move forums. Even if you win in court, governments may choose to ignore the decision. While European telecommunications companies such as Telia announced that they stopped retaining specific data, it remained unclear how different EU member states interpreted or acted upon the Court's decisions. In 2017 we ran a survey of 21 EU member states data retention practices in consultation with industry and other NGOs, assessing their legislation and jurisprudence with regard to data retention. We found that while some countries, such as the Netherlands and Slovakia, had repealed national legislation on retention, no country surveyed was in compliance with the 2016 European Court ruling, and in many states their legislation is not even in compliance with the 2014 ruling in favour of Digital Rights Ireland against the Data Retention Directive. The fight against unlawful data retention is one of the most long-running and important privacy issues in the modern era, involving stakeholders from across government, the courts, industry, and civil society. Above all, it shows how collaborative and coordinated campaigning can achieve results for the protection of privacy on a highly contentious and murky issue. Now the challenge becomes about ensuring respect for the rule of law in an era when human rights legislation is coming under increasing attack. To challenge this, it is essential to continue to research and expose data retention practices, to raise awareness about the fundamental threat they pose for everyone’s freedom and security, and to challenge them through the courts and in parliaments. Ultimately, it is only through public attention and pressure that this crucial right will be protected and respected. As we move into a world where our data affects every aspect of our lives and will increasingly do so in ways we don’t yet know, this fight is more crucial than ever. We are now working to ensure that countries reform their legislation and come into compliance with Court rulings. We are pushing for states to review and amend their legislation to comply with European standards, including the CJEU jurisprudence, for telecommunications and other companies subject to data retention obligations to challenge existing data retention legislation which are not compliant with European standards, and for the European Commission to provide guidance on reviewing national data retention laws to ensure its conformity with fundamental rights. In the UK, following the 2016 judgement, the case has been remitted back to the UK Court of Appeal. A hearing has not yet taken place. The government stated that “...in light of the CJEU judgment, and in order to bring an end to the litigation, the Government have accepted to the Court of Appeal that the (DRIPA) was inconsistent with EU law in two areas.” However, until a hearing takes place, the details of what the Government is prepared to accept, the response to this from the Claimants’ and ultimately what results from the CJEU’s ruling is unknown. We will be working hard to ensure that the rule of law is respected, and that the Government act upon the Court’s judgements.
import .form namespace nat @[omega] def push_neg : form → form | (p ∨* q) := (push_neg p) ∧* (push_neg q) | (p ∧* q) := (push_neg p) ∨* (push_neg q) | (¬*p) := p | p := ¬* p lemma push_neg_equiv : ∀ {p}, form.equiv (push_neg p) (¬* p) := begin form.induce `[intros v; try {refl}], { simp_omega [classical.not_not] }, { simp only [form.holds, push_neg, not_or_distrib, ihp v, ihq v] }, { simp only [form.holds, push_neg, classical.not_and_distrib, ihp v, ihq v] } end def nnf : form → form | (¬* p) := push_neg (nnf p) | (p ∨* q) := (nnf p) ∨* (nnf q) | (p ∧* q) := (nnf p) ∧* (nnf q) | a := a def is_nnf : form → Prop | (t =* s) := true | (t ≤* s) := true | ¬*(t =* s) := true | ¬*(t ≤* s) := true | (p ∨* q) := is_nnf p ∧ is_nnf q | (p ∧* q) := is_nnf p ∧ is_nnf q | _ := false lemma is_nnf_push_neg : ∀ p, is_nnf p → is_nnf (push_neg p) := begin form.induce `[intro h1; try {trivial}], { cases p; try {cases h1}; trivial }, { cases h1, constructor; [{apply ihp}, {apply ihq}]; assumption }, { cases h1, constructor; [{apply ihp}, {apply ihq}]; assumption } end lemma is_nnf_nnf : ∀ p, is_nnf (nnf p) := begin form.induce `[try {trivial}], { apply is_nnf_push_neg _ ih }, { constructor; assumption }, { constructor; assumption } end lemma nnf_equiv : ∀ {p : form}, form.equiv (nnf p) p := begin form.induce `[intros v; try {refl}; simp only [nnf]], { rw push_neg_equiv, apply not_iff_not_of_iff, apply ih }, { apply or_iff_or (ihp v) (ihq v) }, { apply and_iff_and (ihp v) (ihq v) } end @[omega] def neg_elim_core : form → form | (¬* (t =* s)) := (t.succ ≤* s) ∨* (s.succ ≤* t) | (¬* (t ≤* s)) := s.succ ≤* t | (p ∨* q) := (neg_elim_core p) ∨* (neg_elim_core q) | (p ∧* q) := (neg_elim_core p) ∧* (neg_elim_core q) | p := p lemma neg_free_neg_elim_core : ∀ p, is_nnf p → (neg_elim_core p).neg_free := begin form.induce `[intro h1, try {simp only [neg_free, neg_elim_core]}, try {trivial}], { cases p; try {cases h1}; try {trivial}, constructor; trivial }, { cases h1, constructor; [{apply ihp}, {apply ihq}]; assumption }, { cases h1, constructor; [{apply ihp}, {apply ihq}]; assumption } end lemma le_and_le_iff_eq {α : Type} [partial_order α] {a b : α} : (a ≤ b ∧ b ≤ a) ↔ a = b := begin constructor; intro h1, { cases h1, apply le_antisymm; assumption }, { constructor; apply le_of_eq; rw h1 } end lemma implies_neg_elim_core : ∀ {p : form}, form.implies p (neg_elim_core p) := begin form.induce `[intros v h, try {apply h}], { cases p with t s t s; try {apply h}, { simp_omega [le_and_le_iff_eq.symm, classical.not_and_distrib, not_le] at h, simp_omega [int.add_one_le_iff], rw or.comm, assumption }, { simp_omega [not_le, int.add_one_le_iff] at *, assumption} }, { simp only [neg_elim_core], cases h; [{left, apply ihp}, {right, apply ihq}]; assumption }, { apply and_of_and (ihp _) (ihq _) h } end def neg_elim : form → form := neg_elim_core ∘ nnf lemma neg_free_neg_elim {p} : (neg_elim p).neg_free := neg_free_neg_elim_core _ (is_nnf_nnf _) lemma implies_neg_elim {p : form} : form.implies p (neg_elim p) := begin intros v h1, apply implies_neg_elim_core, apply (nnf_equiv v).elim_right h1 end end nat
------------------------------------------------------------------------ -- An alternative definition of the partiality monad: a variant of the -- delay monad quotiented by a notion of weak bisimilarity ------------------------------------------------------------------------ {-# OPTIONS --erased-cubical --sized-types #-} module Partiality-monad.Coinductive.Alternative where open import Equality.Propositional.Cubical open import Logical-equivalence using (_⇔_) open import Prelude hiding (⊥) open import Bijection equality-with-J using (_↔_) open import Function-universe equality-with-J hiding (⊥↔⊥) open import H-level equality-with-J open import H-level.Truncation.Propositional equality-with-paths open import Quotient equality-with-paths import Delay-monad.Alternative as A import Delay-monad.Alternative.Equivalence as A import Delay-monad.Alternative.Weak-bisimilarity as A import Delay-monad.Bisimilarity as B import Partiality-monad.Coinductive as C -- The partiality monad, defined as the alternative definition of the -- delay monad quotiented by weak bisimilarity. _⊥ : ∀ {a} → Type a → Type a A ⊥ = A.Delay A / A._≈_ -- The partiality monad is a set. ⊥-is-set : ∀ {a} {A : Type a} → Is-set (A ⊥) ⊥-is-set = /-is-set -- This definition of the partiality monad is isomorphic to the one in -- Partiality-monad.Coinductive, for sets, assuming extensionality. ⊥↔⊥ : ∀ {a} {A : Type a} → Is-set A → B.Extensionality a → A ⊥ ↔ A C.⊥ ⊥↔⊥ {A = A} A-set delay-ext = D↔D /-cong lemma where D↔D = A.Delay↔Delay delay-ext lemma : (x y : A.Delay A) → x A.≈ y ⇔ ∥ _↔_.to D↔D x B.≈ _↔_.to D↔D y ∥ lemma x y = x A.≈ y ↔⟨ inverse $ ∥∥↔ (A.≈-propositional x y) ⟩ ∥ x A.≈ y ∥ ↝⟨ ∥∥-cong-⇔ (A.≈⇔≈ A-set x y) ⟩□ ∥ _↔_.to D↔D x B.≈ _↔_.to D↔D y ∥ □
{-# OPTIONS --without-K --safe #-} module Categories.Category.Instance.Properties.Setoids where open import Categories.Category.Instance.Properties.Setoids.Complete using (Setoids-Complete) public open import Categories.Category.Instance.Properties.Setoids.Cocomplete using (Setoids-Cocomplete) public open import Categories.Category.Instance.Properties.Setoids.LCCC using (Setoids-LCCC) public
lemma (in linorder_topology) at_right_eq: "x < y \<Longrightarrow> at_right x = (INF a\<in>{x <..}. principal {x <..< a})"
(* Title: HOL/Groups.thy Author: Gertrud Bauer Author: Steven Obua Author: Lawrence C Paulson Author: Markus Wenzel Author: Jeremy Avigad *) section \<open>Groups, also combined with orderings\<close> theory Groups imports Orderings begin subsection \<open>Dynamic facts\<close> named_theorems ac_simps "associativity and commutativity simplification rules" and algebra_simps "algebra simplification rules" and field_simps "algebra simplification rules for fields" text \<open> The rewrites accumulated in \<open>algebra_simps\<close> deal with the classical algebraic structures of groups, rings and family. They simplify terms by multiplying everything out (in case of a ring) and bringing sums and products into a canonical form (by ordered rewriting). As a result it decides group and ring equalities but also helps with inequalities. Of course it also works for fields, but it knows nothing about multiplicative inverses or division. This is catered for by \<open>field_simps\<close>. Facts in \<open>field_simps\<close> multiply with denominators in (in)equations if they can be proved to be non-zero (for equations) or positive/negative (for inequalities). Can be too aggressive and is therefore separate from the more benign \<open>algebra_simps\<close>. \<close> subsection \<open>Abstract structures\<close> text \<open> These locales provide basic structures for interpretation into bigger structures; extensions require careful thinking, otherwise undesired effects may occur due to interpretation. \<close> locale semigroup = fixes f :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "\<^bold>*" 70) assumes assoc [ac_simps]: "a \<^bold>* b \<^bold>* c = a \<^bold>* (b \<^bold>* c)" locale abel_semigroup = semigroup + assumes commute [ac_simps]: "a \<^bold>* b = b \<^bold>* a" begin lemma left_commute [ac_simps]: "b \<^bold>* (a \<^bold>* c) = a \<^bold>* (b \<^bold>* c)" proof - have "(b \<^bold>* a) \<^bold>* c = (a \<^bold>* b) \<^bold>* c" by (simp only: commute) then show ?thesis by (simp only: assoc) qed end locale monoid = semigroup + fixes z :: 'a ("\<^bold>1") assumes left_neutral [simp]: "\<^bold>1 \<^bold>* a = a" assumes right_neutral [simp]: "a \<^bold>* \<^bold>1 = a" locale comm_monoid = abel_semigroup + fixes z :: 'a ("\<^bold>1") assumes comm_neutral: "a \<^bold>* \<^bold>1 = a" begin sublocale monoid by standard (simp_all add: commute comm_neutral) end locale group = semigroup + fixes z :: 'a ("\<^bold>1") fixes inverse :: "'a \<Rightarrow> 'a" assumes group_left_neutral: "\<^bold>1 \<^bold>* a = a" assumes left_inverse [simp]: "inverse a \<^bold>* a = \<^bold>1" begin lemma left_cancel: "a \<^bold>* b = a \<^bold>* c \<longleftrightarrow> b = c" proof assume "a \<^bold>* b = a \<^bold>* c" then have "inverse a \<^bold>* (a \<^bold>* b) = inverse a \<^bold>* (a \<^bold>* c)" by simp then have "(inverse a \<^bold>* a) \<^bold>* b = (inverse a \<^bold>* a) \<^bold>* c" by (simp only: assoc) then show "b = c" by (simp add: group_left_neutral) qed simp sublocale monoid proof fix a have "inverse a \<^bold>* a = \<^bold>1" by simp then have "inverse a \<^bold>* (a \<^bold>* \<^bold>1) = inverse a \<^bold>* a" by (simp add: group_left_neutral assoc [symmetric]) with left_cancel show "a \<^bold>* \<^bold>1 = a" by (simp only: left_cancel) qed (fact group_left_neutral) lemma inverse_unique: assumes "a \<^bold>* b = \<^bold>1" shows "inverse a = b" proof - from assms have "inverse a \<^bold>* (a \<^bold>* b) = inverse a" by simp then show ?thesis by (simp add: assoc [symmetric]) qed lemma inverse_neutral [simp]: "inverse \<^bold>1 = \<^bold>1" by (rule inverse_unique) simp lemma inverse_inverse [simp]: "inverse (inverse a) = a" by (rule inverse_unique) simp lemma right_inverse [simp]: "a \<^bold>* inverse a = \<^bold>1" proof - have "a \<^bold>* inverse a = inverse (inverse a) \<^bold>* inverse a" by simp also have "\<dots> = \<^bold>1" by (rule left_inverse) then show ?thesis by simp qed lemma inverse_distrib_swap: "inverse (a \<^bold>* b) = inverse b \<^bold>* inverse a" proof (rule inverse_unique) have "a \<^bold>* b \<^bold>* (inverse b \<^bold>* inverse a) = a \<^bold>* (b \<^bold>* inverse b) \<^bold>* inverse a" by (simp only: assoc) also have "\<dots> = \<^bold>1" by simp finally show "a \<^bold>* b \<^bold>* (inverse b \<^bold>* inverse a) = \<^bold>1" . qed lemma right_cancel: "b \<^bold>* a = c \<^bold>* a \<longleftrightarrow> b = c" proof assume "b \<^bold>* a = c \<^bold>* a" then have "b \<^bold>* a \<^bold>* inverse a= c \<^bold>* a \<^bold>* inverse a" by simp then show "b = c" by (simp add: assoc) qed simp end subsection \<open>Generic operations\<close> class zero = fixes zero :: 'a ("0") class one = fixes one :: 'a ("1") hide_const (open) zero one lemma Let_0 [simp]: "Let 0 f = f 0" unfolding Let_def .. lemma Let_1 [simp]: "Let 1 f = f 1" unfolding Let_def .. setup \<open> Reorient_Proc.add (fn Const(@{const_name Groups.zero}, _) => true | Const(@{const_name Groups.one}, _) => true | _ => false) \<close> simproc_setup reorient_zero ("0 = x") = Reorient_Proc.proc simproc_setup reorient_one ("1 = x") = Reorient_Proc.proc typed_print_translation \<open> let fun tr' c = (c, fn ctxt => fn T => fn ts => if null ts andalso Printer.type_emphasis ctxt T then Syntax.const @{syntax_const "_constrain"} $ Syntax.const c $ Syntax_Phases.term_of_typ ctxt T else raise Match); in map tr' [@{const_syntax Groups.one}, @{const_syntax Groups.zero}] end; \<close> \<comment> \<open>show types that are presumably too general\<close> class plus = fixes plus :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "+" 65) class minus = fixes minus :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "-" 65) class uminus = fixes uminus :: "'a \<Rightarrow> 'a" ("- _" [81] 80) class times = fixes times :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "*" 70) subsection \<open>Semigroups and Monoids\<close> class semigroup_add = plus + assumes add_assoc [algebra_simps, field_simps]: "(a + b) + c = a + (b + c)" begin sublocale add: semigroup plus by standard (fact add_assoc) end hide_fact add_assoc class ab_semigroup_add = semigroup_add + assumes add_commute [algebra_simps, field_simps]: "a + b = b + a" begin sublocale add: abel_semigroup plus by standard (fact add_commute) declare add.left_commute [algebra_simps, field_simps] lemmas add_ac = add.assoc add.commute add.left_commute end hide_fact add_commute lemmas add_ac = add.assoc add.commute add.left_commute class semigroup_mult = times + assumes mult_assoc [algebra_simps, field_simps]: "(a * b) * c = a * (b * c)" begin sublocale mult: semigroup times by standard (fact mult_assoc) end hide_fact mult_assoc class ab_semigroup_mult = semigroup_mult + assumes mult_commute [algebra_simps, field_simps]: "a * b = b * a" begin sublocale mult: abel_semigroup times by standard (fact mult_commute) declare mult.left_commute [algebra_simps, field_simps] lemmas mult_ac = mult.assoc mult.commute mult.left_commute end hide_fact mult_commute lemmas mult_ac = mult.assoc mult.commute mult.left_commute class monoid_add = zero + semigroup_add + assumes add_0_left: "0 + a = a" and add_0_right: "a + 0 = a" begin sublocale add: monoid plus 0 by standard (fact add_0_left add_0_right)+ end lemma zero_reorient: "0 = x \<longleftrightarrow> x = 0" by (fact eq_commute) class comm_monoid_add = zero + ab_semigroup_add + assumes add_0: "0 + a = a" begin subclass monoid_add by standard (simp_all add: add_0 add.commute [of _ 0]) sublocale add: comm_monoid plus 0 by standard (simp add: ac_simps) end class monoid_mult = one + semigroup_mult + assumes mult_1_left: "1 * a = a" and mult_1_right: "a * 1 = a" begin sublocale mult: monoid times 1 by standard (fact mult_1_left mult_1_right)+ end lemma one_reorient: "1 = x \<longleftrightarrow> x = 1" by (fact eq_commute) class comm_monoid_mult = one + ab_semigroup_mult + assumes mult_1: "1 * a = a" begin subclass monoid_mult by standard (simp_all add: mult_1 mult.commute [of _ 1]) sublocale mult: comm_monoid times 1 by standard (simp add: ac_simps) end class cancel_semigroup_add = semigroup_add + assumes add_left_imp_eq: "a + b = a + c \<Longrightarrow> b = c" assumes add_right_imp_eq: "b + a = c + a \<Longrightarrow> b = c" begin lemma add_left_cancel [simp]: "a + b = a + c \<longleftrightarrow> b = c" by (blast dest: add_left_imp_eq) lemma add_right_cancel [simp]: "b + a = c + a \<longleftrightarrow> b = c" by (blast dest: add_right_imp_eq) end class cancel_ab_semigroup_add = ab_semigroup_add + minus + assumes add_diff_cancel_left' [simp]: "(a + b) - a = b" assumes diff_diff_add [algebra_simps, field_simps]: "a - b - c = a - (b + c)" begin lemma add_diff_cancel_right' [simp]: "(a + b) - b = a" using add_diff_cancel_left' [of b a] by (simp add: ac_simps) subclass cancel_semigroup_add proof fix a b c :: 'a assume "a + b = a + c" then have "a + b - a = a + c - a" by simp then show "b = c" by simp next fix a b c :: 'a assume "b + a = c + a" then have "b + a - a = c + a - a" by simp then show "b = c" by simp qed lemma add_diff_cancel_left [simp]: "(c + a) - (c + b) = a - b" unfolding diff_diff_add [symmetric] by simp lemma add_diff_cancel_right [simp]: "(a + c) - (b + c) = a - b" using add_diff_cancel_left [symmetric] by (simp add: ac_simps) lemma diff_right_commute: "a - c - b = a - b - c" by (simp add: diff_diff_add add.commute) end class cancel_comm_monoid_add = cancel_ab_semigroup_add + comm_monoid_add begin lemma diff_zero [simp]: "a - 0 = a" using add_diff_cancel_right' [of a 0] by simp lemma diff_cancel [simp]: "a - a = 0" proof - have "(a + 0) - (a + 0) = 0" by (simp only: add_diff_cancel_left diff_zero) then show ?thesis by simp qed lemma add_implies_diff: assumes "c + b = a" shows "c = a - b" proof - from assms have "(b + c) - (b + 0) = a - b" by (simp add: add.commute) then show "c = a - b" by simp qed lemma add_cancel_right_right [simp]: "a = a + b \<longleftrightarrow> b = 0" (is "?P \<longleftrightarrow> ?Q") proof assume ?Q then show ?P by simp next assume ?P then have "a - a = a + b - a" by simp then show ?Q by simp qed lemma add_cancel_right_left [simp]: "a = b + a \<longleftrightarrow> b = 0" using add_cancel_right_right [of a b] by (simp add: ac_simps) lemma add_cancel_left_right [simp]: "a + b = a \<longleftrightarrow> b = 0" by (auto dest: sym) lemma add_cancel_left_left [simp]: "b + a = a \<longleftrightarrow> b = 0" by (auto dest: sym) end class comm_monoid_diff = cancel_comm_monoid_add + assumes zero_diff [simp]: "0 - a = 0" begin lemma diff_add_zero [simp]: "a - (a + b) = 0" proof - have "a - (a + b) = (a + 0) - (a + b)" by simp also have "\<dots> = 0" by (simp only: add_diff_cancel_left zero_diff) finally show ?thesis . qed end subsection \<open>Groups\<close> class group_add = minus + uminus + monoid_add + assumes left_minus: "- a + a = 0" assumes add_uminus_conv_diff [simp]: "a + (- b) = a - b" begin lemma diff_conv_add_uminus: "a - b = a + (- b)" by simp sublocale add: group plus 0 uminus by standard (simp_all add: left_minus) lemma minus_unique: "a + b = 0 \<Longrightarrow> - a = b" by (fact add.inverse_unique) lemma minus_zero: "- 0 = 0" by (fact add.inverse_neutral) lemma minus_minus: "- (- a) = a" by (fact add.inverse_inverse) lemma right_minus: "a + - a = 0" by (fact add.right_inverse) lemma diff_self [simp]: "a - a = 0" using right_minus [of a] by simp subclass cancel_semigroup_add by standard (simp_all add: add.left_cancel add.right_cancel) lemma minus_add_cancel [simp]: "- a + (a + b) = b" by (simp add: add.assoc [symmetric]) lemma add_minus_cancel [simp]: "a + (- a + b) = b" by (simp add: add.assoc [symmetric]) lemma diff_add_cancel [simp]: "a - b + b = a" by (simp only: diff_conv_add_uminus add.assoc) simp lemma add_diff_cancel [simp]: "a + b - b = a" by (simp only: diff_conv_add_uminus add.assoc) simp lemma minus_add: "- (a + b) = - b + - a" by (fact add.inverse_distrib_swap) lemma right_minus_eq [simp]: "a - b = 0 \<longleftrightarrow> a = b" proof assume "a - b = 0" have "a = (a - b) + b" by (simp add: add.assoc) also have "\<dots> = b" using \<open>a - b = 0\<close> by simp finally show "a = b" . next assume "a = b" then show "a - b = 0" by simp qed lemma eq_iff_diff_eq_0: "a = b \<longleftrightarrow> a - b = 0" by (fact right_minus_eq [symmetric]) lemma diff_0 [simp]: "0 - a = - a" by (simp only: diff_conv_add_uminus add_0_left) lemma diff_0_right [simp]: "a - 0 = a" by (simp only: diff_conv_add_uminus minus_zero add_0_right) lemma diff_minus_eq_add [simp]: "a - - b = a + b" by (simp only: diff_conv_add_uminus minus_minus) lemma neg_equal_iff_equal [simp]: "- a = - b \<longleftrightarrow> a = b" proof assume "- a = - b" then have "- (- a) = - (- b)" by simp then show "a = b" by simp next assume "a = b" then show "- a = - b" by simp qed lemma neg_equal_0_iff_equal [simp]: "- a = 0 \<longleftrightarrow> a = 0" by (subst neg_equal_iff_equal [symmetric]) simp lemma neg_0_equal_iff_equal [simp]: "0 = - a \<longleftrightarrow> 0 = a" by (subst neg_equal_iff_equal [symmetric]) simp text \<open>The next two equations can make the simplifier loop!\<close> lemma equation_minus_iff: "a = - b \<longleftrightarrow> b = - a" proof - have "- (- a) = - b \<longleftrightarrow> - a = b" by (rule neg_equal_iff_equal) then show ?thesis by (simp add: eq_commute) qed lemma minus_equation_iff: "- a = b \<longleftrightarrow> - b = a" proof - have "- a = - (- b) \<longleftrightarrow> a = -b" by (rule neg_equal_iff_equal) then show ?thesis by (simp add: eq_commute) qed lemma eq_neg_iff_add_eq_0: "a = - b \<longleftrightarrow> a + b = 0" proof assume "a = - b" then show "a + b = 0" by simp next assume "a + b = 0" moreover have "a + (b + - b) = (a + b) + - b" by (simp only: add.assoc) ultimately show "a = - b" by simp qed lemma add_eq_0_iff2: "a + b = 0 \<longleftrightarrow> a = - b" by (fact eq_neg_iff_add_eq_0 [symmetric]) lemma neg_eq_iff_add_eq_0: "- a = b \<longleftrightarrow> a + b = 0" by (auto simp add: add_eq_0_iff2) lemma add_eq_0_iff: "a + b = 0 \<longleftrightarrow> b = - a" by (auto simp add: neg_eq_iff_add_eq_0 [symmetric]) lemma minus_diff_eq [simp]: "- (a - b) = b - a" by (simp only: neg_eq_iff_add_eq_0 diff_conv_add_uminus add.assoc minus_add_cancel) simp lemma add_diff_eq [algebra_simps, field_simps]: "a + (b - c) = (a + b) - c" by (simp only: diff_conv_add_uminus add.assoc) lemma diff_add_eq_diff_diff_swap: "a - (b + c) = a - c - b" by (simp only: diff_conv_add_uminus add.assoc minus_add) lemma diff_eq_eq [algebra_simps, field_simps]: "a - b = c \<longleftrightarrow> a = c + b" by auto lemma eq_diff_eq [algebra_simps, field_simps]: "a = c - b \<longleftrightarrow> a + b = c" by auto lemma diff_diff_eq2 [algebra_simps, field_simps]: "a - (b - c) = (a + c) - b" by (simp only: diff_conv_add_uminus add.assoc) simp lemma diff_eq_diff_eq: "a - b = c - d \<Longrightarrow> a = b \<longleftrightarrow> c = d" by (simp only: eq_iff_diff_eq_0 [of a b] eq_iff_diff_eq_0 [of c d]) end class ab_group_add = minus + uminus + comm_monoid_add + assumes ab_left_minus: "- a + a = 0" assumes ab_diff_conv_add_uminus: "a - b = a + (- b)" begin subclass group_add by standard (simp_all add: ab_left_minus ab_diff_conv_add_uminus) subclass cancel_comm_monoid_add proof fix a b c :: 'a have "b + a - a = b" by simp then show "a + b - a = b" by (simp add: ac_simps) show "a - b - c = a - (b + c)" by (simp add: algebra_simps) qed lemma uminus_add_conv_diff [simp]: "- a + b = b - a" by (simp add: add.commute) lemma minus_add_distrib [simp]: "- (a + b) = - a + - b" by (simp add: algebra_simps) lemma diff_add_eq [algebra_simps, field_simps]: "(a - b) + c = (a + c) - b" by (simp add: algebra_simps) end subsection \<open>(Partially) Ordered Groups\<close> text \<open> The theory of partially ordered groups is taken from the books: \<^item> \<^emph>\<open>Lattice Theory\<close> by Garret Birkhoff, American Mathematical Society, 1979 \<^item> \<^emph>\<open>Partially Ordered Algebraic Systems\<close>, Pergamon Press, 1963 Most of the used notions can also be looked up in \<^item> \<^url>\<open>http://www.mathworld.com\<close> by Eric Weisstein et. al. \<^item> \<^emph>\<open>Algebra I\<close> by van der Waerden, Springer \<close> class ordered_ab_semigroup_add = order + ab_semigroup_add + assumes add_left_mono: "a \<le> b \<Longrightarrow> c + a \<le> c + b" begin lemma add_right_mono: "a \<le> b \<Longrightarrow> a + c \<le> b + c" by (simp add: add.commute [of _ c] add_left_mono) text \<open>non-strict, in both arguments\<close> lemma add_mono: "a \<le> b \<Longrightarrow> c \<le> d \<Longrightarrow> a + c \<le> b + d" apply (erule add_right_mono [THEN order_trans]) apply (simp add: add.commute add_left_mono) done end text \<open>Strict monotonicity in both arguments\<close> class strict_ordered_ab_semigroup_add = ordered_ab_semigroup_add + assumes add_strict_mono: "a < b \<Longrightarrow> c < d \<Longrightarrow> a + c < b + d" class ordered_cancel_ab_semigroup_add = ordered_ab_semigroup_add + cancel_ab_semigroup_add begin lemma add_strict_left_mono: "a < b \<Longrightarrow> c + a < c + b" by (auto simp add: less_le add_left_mono) lemma add_strict_right_mono: "a < b \<Longrightarrow> a + c < b + c" by (simp add: add.commute [of _ c] add_strict_left_mono) subclass strict_ordered_ab_semigroup_add apply standard apply (erule add_strict_right_mono [THEN less_trans]) apply (erule add_strict_left_mono) done lemma add_less_le_mono: "a < b \<Longrightarrow> c \<le> d \<Longrightarrow> a + c < b + d" apply (erule add_strict_right_mono [THEN less_le_trans]) apply (erule add_left_mono) done lemma add_le_less_mono: "a \<le> b \<Longrightarrow> c < d \<Longrightarrow> a + c < b + d" apply (erule add_right_mono [THEN le_less_trans]) apply (erule add_strict_left_mono) done end class ordered_ab_semigroup_add_imp_le = ordered_cancel_ab_semigroup_add + assumes add_le_imp_le_left: "c + a \<le> c + b \<Longrightarrow> a \<le> b" begin lemma add_less_imp_less_left: assumes less: "c + a < c + b" shows "a < b" proof - from less have le: "c + a \<le> c + b" by (simp add: order_le_less) have "a \<le> b" apply (insert le) apply (drule add_le_imp_le_left) apply (insert le) apply (drule add_le_imp_le_left) apply assumption done moreover have "a \<noteq> b" proof (rule ccontr) assume "\<not> ?thesis" then have "a = b" by simp then have "c + a = c + b" by simp with less show "False" by simp qed ultimately show "a < b" by (simp add: order_le_less) qed lemma add_less_imp_less_right: "a + c < b + c \<Longrightarrow> a < b" by (rule add_less_imp_less_left [of c]) (simp add: add.commute) lemma add_less_cancel_left [simp]: "c + a < c + b \<longleftrightarrow> a < b" by (blast intro: add_less_imp_less_left add_strict_left_mono) lemma add_less_cancel_right [simp]: "a + c < b + c \<longleftrightarrow> a < b" by (blast intro: add_less_imp_less_right add_strict_right_mono) lemma add_le_cancel_left [simp]: "c + a \<le> c + b \<longleftrightarrow> a \<le> b" apply auto apply (drule add_le_imp_le_left) apply (simp_all add: add_left_mono) done lemma add_le_cancel_right [simp]: "a + c \<le> b + c \<longleftrightarrow> a \<le> b" by (simp add: add.commute [of a c] add.commute [of b c]) lemma add_le_imp_le_right: "a + c \<le> b + c \<Longrightarrow> a \<le> b" by simp lemma max_add_distrib_left: "max x y + z = max (x + z) (y + z)" unfolding max_def by auto lemma min_add_distrib_left: "min x y + z = min (x + z) (y + z)" unfolding min_def by auto lemma max_add_distrib_right: "x + max y z = max (x + y) (x + z)" unfolding max_def by auto lemma min_add_distrib_right: "x + min y z = min (x + y) (x + z)" unfolding min_def by auto end subsection \<open>Support for reasoning about signs\<close> class ordered_comm_monoid_add = comm_monoid_add + ordered_ab_semigroup_add begin lemma add_nonneg_nonneg [simp]: "0 \<le> a \<Longrightarrow> 0 \<le> b \<Longrightarrow> 0 \<le> a + b" using add_mono[of 0 a 0 b] by simp lemma add_nonpos_nonpos: "a \<le> 0 \<Longrightarrow> b \<le> 0 \<Longrightarrow> a + b \<le> 0" using add_mono[of a 0 b 0] by simp lemma add_nonneg_eq_0_iff: "0 \<le> x \<Longrightarrow> 0 \<le> y \<Longrightarrow> x + y = 0 \<longleftrightarrow> x = 0 \<and> y = 0" using add_left_mono[of 0 y x] add_right_mono[of 0 x y] by auto lemma add_nonpos_eq_0_iff: "x \<le> 0 \<Longrightarrow> y \<le> 0 \<Longrightarrow> x + y = 0 \<longleftrightarrow> x = 0 \<and> y = 0" using add_left_mono[of y 0 x] add_right_mono[of x 0 y] by auto lemma add_increasing: "0 \<le> a \<Longrightarrow> b \<le> c \<Longrightarrow> b \<le> a + c" using add_mono [of 0 a b c] by simp lemma add_increasing2: "0 \<le> c \<Longrightarrow> b \<le> a \<Longrightarrow> b \<le> a + c" by (simp add: add_increasing add.commute [of a]) lemma add_decreasing: "a \<le> 0 \<Longrightarrow> c \<le> b \<Longrightarrow> a + c \<le> b" using add_mono [of a 0 c b] by simp lemma add_decreasing2: "c \<le> 0 \<Longrightarrow> a \<le> b \<Longrightarrow> a + c \<le> b" using add_mono[of a b c 0] by simp lemma add_pos_nonneg: "0 < a \<Longrightarrow> 0 \<le> b \<Longrightarrow> 0 < a + b" using less_le_trans[of 0 a "a + b"] by (simp add: add_increasing2) lemma add_pos_pos: "0 < a \<Longrightarrow> 0 < b \<Longrightarrow> 0 < a + b" by (intro add_pos_nonneg less_imp_le) lemma add_nonneg_pos: "0 \<le> a \<Longrightarrow> 0 < b \<Longrightarrow> 0 < a + b" using add_pos_nonneg[of b a] by (simp add: add_commute) lemma add_neg_nonpos: "a < 0 \<Longrightarrow> b \<le> 0 \<Longrightarrow> a + b < 0" using le_less_trans[of "a + b" a 0] by (simp add: add_decreasing2) lemma add_neg_neg: "a < 0 \<Longrightarrow> b < 0 \<Longrightarrow> a + b < 0" by (intro add_neg_nonpos less_imp_le) lemma add_nonpos_neg: "a \<le> 0 \<Longrightarrow> b < 0 \<Longrightarrow> a + b < 0" using add_neg_nonpos[of b a] by (simp add: add_commute) lemmas add_sign_intros = add_pos_nonneg add_pos_pos add_nonneg_pos add_nonneg_nonneg add_neg_nonpos add_neg_neg add_nonpos_neg add_nonpos_nonpos end class strict_ordered_comm_monoid_add = comm_monoid_add + strict_ordered_ab_semigroup_add begin lemma pos_add_strict: "0 < a \<Longrightarrow> b < c \<Longrightarrow> b < a + c" using add_strict_mono [of 0 a b c] by simp end class ordered_cancel_comm_monoid_add = ordered_comm_monoid_add + cancel_ab_semigroup_add begin subclass ordered_cancel_ab_semigroup_add .. subclass strict_ordered_comm_monoid_add .. lemma add_strict_increasing: "0 < a \<Longrightarrow> b \<le> c \<Longrightarrow> b < a + c" using add_less_le_mono [of 0 a b c] by simp lemma add_strict_increasing2: "0 \<le> a \<Longrightarrow> b < c \<Longrightarrow> b < a + c" using add_le_less_mono [of 0 a b c] by simp end class ordered_ab_semigroup_monoid_add_imp_le = monoid_add + ordered_ab_semigroup_add_imp_le begin lemma add_less_same_cancel1 [simp]: "b + a < b \<longleftrightarrow> a < 0" using add_less_cancel_left [of _ _ 0] by simp lemma add_less_same_cancel2 [simp]: "a + b < b \<longleftrightarrow> a < 0" using add_less_cancel_right [of _ _ 0] by simp lemma less_add_same_cancel1 [simp]: "a < a + b \<longleftrightarrow> 0 < b" using add_less_cancel_left [of _ 0] by simp lemma less_add_same_cancel2 [simp]: "a < b + a \<longleftrightarrow> 0 < b" using add_less_cancel_right [of 0] by simp lemma add_le_same_cancel1 [simp]: "b + a \<le> b \<longleftrightarrow> a \<le> 0" using add_le_cancel_left [of _ _ 0] by simp lemma add_le_same_cancel2 [simp]: "a + b \<le> b \<longleftrightarrow> a \<le> 0" using add_le_cancel_right [of _ _ 0] by simp lemma le_add_same_cancel1 [simp]: "a \<le> a + b \<longleftrightarrow> 0 \<le> b" using add_le_cancel_left [of _ 0] by simp lemma le_add_same_cancel2 [simp]: "a \<le> b + a \<longleftrightarrow> 0 \<le> b" using add_le_cancel_right [of 0] by simp subclass cancel_comm_monoid_add by standard auto subclass ordered_cancel_comm_monoid_add by standard end class ordered_ab_group_add = ab_group_add + ordered_ab_semigroup_add begin subclass ordered_cancel_ab_semigroup_add .. subclass ordered_ab_semigroup_monoid_add_imp_le proof fix a b c :: 'a assume "c + a \<le> c + b" then have "(-c) + (c + a) \<le> (-c) + (c + b)" by (rule add_left_mono) then have "((-c) + c) + a \<le> ((-c) + c) + b" by (simp only: add.assoc) then show "a \<le> b" by simp qed lemma max_diff_distrib_left: "max x y - z = max (x - z) (y - z)" using max_add_distrib_left [of x y "- z"] by simp lemma min_diff_distrib_left: "min x y - z = min (x - z) (y - z)" using min_add_distrib_left [of x y "- z"] by simp lemma le_imp_neg_le: assumes "a \<le> b" shows "- b \<le> - a" proof - from assms have "- a + a \<le> - a + b" by (rule add_left_mono) then have "0 \<le> - a + b" by simp then have "0 + (- b) \<le> (- a + b) + (- b)" by (rule add_right_mono) then show ?thesis by (simp add: algebra_simps) qed lemma neg_le_iff_le [simp]: "- b \<le> - a \<longleftrightarrow> a \<le> b" proof assume "- b \<le> - a" then have "- (- a) \<le> - (- b)" by (rule le_imp_neg_le) then show "a \<le> b" by simp next assume "a \<le> b" then show "- b \<le> - a" by (rule le_imp_neg_le) qed lemma neg_le_0_iff_le [simp]: "- a \<le> 0 \<longleftrightarrow> 0 \<le> a" by (subst neg_le_iff_le [symmetric]) simp lemma neg_0_le_iff_le [simp]: "0 \<le> - a \<longleftrightarrow> a \<le> 0" by (subst neg_le_iff_le [symmetric]) simp lemma neg_less_iff_less [simp]: "- b < - a \<longleftrightarrow> a < b" by (auto simp add: less_le) lemma neg_less_0_iff_less [simp]: "- a < 0 \<longleftrightarrow> 0 < a" by (subst neg_less_iff_less [symmetric]) simp lemma neg_0_less_iff_less [simp]: "0 < - a \<longleftrightarrow> a < 0" by (subst neg_less_iff_less [symmetric]) simp text \<open>The next several equations can make the simplifier loop!\<close> lemma less_minus_iff: "a < - b \<longleftrightarrow> b < - a" proof - have "- (- a) < - b \<longleftrightarrow> b < - a" by (rule neg_less_iff_less) then show ?thesis by simp qed lemma minus_less_iff: "- a < b \<longleftrightarrow> - b < a" proof - have "- a < - (- b) \<longleftrightarrow> - b < a" by (rule neg_less_iff_less) then show ?thesis by simp qed lemma le_minus_iff: "a \<le> - b \<longleftrightarrow> b \<le> - a" proof - have mm: "- (- a) < - b \<Longrightarrow> - (- b) < -a" for a b :: 'a by (simp only: minus_less_iff) have "- (- a) \<le> - b \<longleftrightarrow> b \<le> - a" apply (auto simp only: le_less) apply (drule mm) apply (simp_all) apply (drule mm[simplified], assumption) done then show ?thesis by simp qed lemma minus_le_iff: "- a \<le> b \<longleftrightarrow> - b \<le> a" by (auto simp add: le_less minus_less_iff) lemma diff_less_0_iff_less [simp]: "a - b < 0 \<longleftrightarrow> a < b" proof - have "a - b < 0 \<longleftrightarrow> a + (- b) < b + (- b)" by simp also have "\<dots> \<longleftrightarrow> a < b" by (simp only: add_less_cancel_right) finally show ?thesis . qed lemmas less_iff_diff_less_0 = diff_less_0_iff_less [symmetric] lemma diff_less_eq [algebra_simps, field_simps]: "a - b < c \<longleftrightarrow> a < c + b" apply (subst less_iff_diff_less_0 [of a]) apply (rule less_iff_diff_less_0 [of _ c, THEN ssubst]) apply (simp add: algebra_simps) done lemma less_diff_eq[algebra_simps, field_simps]: "a < c - b \<longleftrightarrow> a + b < c" apply (subst less_iff_diff_less_0 [of "a + b"]) apply (subst less_iff_diff_less_0 [of a]) apply (simp add: algebra_simps) done lemma diff_gt_0_iff_gt [simp]: "a - b > 0 \<longleftrightarrow> a > b" by (simp add: less_diff_eq) lemma diff_le_eq [algebra_simps, field_simps]: "a - b \<le> c \<longleftrightarrow> a \<le> c + b" by (auto simp add: le_less diff_less_eq ) lemma le_diff_eq [algebra_simps, field_simps]: "a \<le> c - b \<longleftrightarrow> a + b \<le> c" by (auto simp add: le_less less_diff_eq) lemma diff_le_0_iff_le [simp]: "a - b \<le> 0 \<longleftrightarrow> a \<le> b" by (simp add: algebra_simps) lemmas le_iff_diff_le_0 = diff_le_0_iff_le [symmetric] lemma diff_ge_0_iff_ge [simp]: "a - b \<ge> 0 \<longleftrightarrow> a \<ge> b" by (simp add: le_diff_eq) lemma diff_eq_diff_less: "a - b = c - d \<Longrightarrow> a < b \<longleftrightarrow> c < d" by (auto simp only: less_iff_diff_less_0 [of a b] less_iff_diff_less_0 [of c d]) lemma diff_eq_diff_less_eq: "a - b = c - d \<Longrightarrow> a \<le> b \<longleftrightarrow> c \<le> d" by (auto simp only: le_iff_diff_le_0 [of a b] le_iff_diff_le_0 [of c d]) lemma diff_mono: "a \<le> b \<Longrightarrow> d \<le> c \<Longrightarrow> a - c \<le> b - d" by (simp add: field_simps add_mono) lemma diff_left_mono: "b \<le> a \<Longrightarrow> c - a \<le> c - b" by (simp add: field_simps) lemma diff_right_mono: "a \<le> b \<Longrightarrow> a - c \<le> b - c" by (simp add: field_simps) lemma diff_strict_mono: "a < b \<Longrightarrow> d < c \<Longrightarrow> a - c < b - d" by (simp add: field_simps add_strict_mono) lemma diff_strict_left_mono: "b < a \<Longrightarrow> c - a < c - b" by (simp add: field_simps) lemma diff_strict_right_mono: "a < b \<Longrightarrow> a - c < b - c" by (simp add: field_simps) end ML_file "Tools/group_cancel.ML" simproc_setup group_cancel_add ("a + b::'a::ab_group_add") = \<open>fn phi => fn ss => try Group_Cancel.cancel_add_conv\<close> simproc_setup group_cancel_diff ("a - b::'a::ab_group_add") = \<open>fn phi => fn ss => try Group_Cancel.cancel_diff_conv\<close> simproc_setup group_cancel_eq ("a = (b::'a::ab_group_add)") = \<open>fn phi => fn ss => try Group_Cancel.cancel_eq_conv\<close> simproc_setup group_cancel_le ("a \<le> (b::'a::ordered_ab_group_add)") = \<open>fn phi => fn ss => try Group_Cancel.cancel_le_conv\<close> simproc_setup group_cancel_less ("a < (b::'a::ordered_ab_group_add)") = \<open>fn phi => fn ss => try Group_Cancel.cancel_less_conv\<close> class linordered_ab_semigroup_add = linorder + ordered_ab_semigroup_add class linordered_cancel_ab_semigroup_add = linorder + ordered_cancel_ab_semigroup_add begin subclass linordered_ab_semigroup_add .. subclass ordered_ab_semigroup_add_imp_le proof fix a b c :: 'a assume le1: "c + a \<le> c + b" show "a \<le> b" proof (rule ccontr) assume *: "\<not> ?thesis" then have "b \<le> a" by (simp add: linorder_not_le) then have "c + b \<le> c + a" by (rule add_left_mono) with le1 have "a = b" apply - apply (drule antisym) apply simp_all done with * show False by (simp add: linorder_not_le [symmetric]) qed qed end class linordered_ab_group_add = linorder + ordered_ab_group_add begin subclass linordered_cancel_ab_semigroup_add .. lemma equal_neg_zero [simp]: "a = - a \<longleftrightarrow> a = 0" proof assume "a = 0" then show "a = - a" by simp next assume A: "a = - a" show "a = 0" proof (cases "0 \<le> a") case True with A have "0 \<le> - a" by auto with le_minus_iff have "a \<le> 0" by simp with True show ?thesis by (auto intro: order_trans) next case False then have B: "a \<le> 0" by auto with A have "- a \<le> 0" by auto with B show ?thesis by (auto intro: order_trans) qed qed lemma neg_equal_zero [simp]: "- a = a \<longleftrightarrow> a = 0" by (auto dest: sym) lemma neg_less_eq_nonneg [simp]: "- a \<le> a \<longleftrightarrow> 0 \<le> a" proof assume *: "- a \<le> a" show "0 \<le> a" proof (rule classical) assume "\<not> ?thesis" then have "a < 0" by auto with * have "- a < 0" by (rule le_less_trans) then show ?thesis by auto qed next assume *: "0 \<le> a" then have "- a \<le> 0" by (simp add: minus_le_iff) from this * show "- a \<le> a" by (rule order_trans) qed lemma neg_less_pos [simp]: "- a < a \<longleftrightarrow> 0 < a" by (auto simp add: less_le) lemma less_eq_neg_nonpos [simp]: "a \<le> - a \<longleftrightarrow> a \<le> 0" using neg_less_eq_nonneg [of "- a"] by simp lemma less_neg_neg [simp]: "a < - a \<longleftrightarrow> a < 0" using neg_less_pos [of "- a"] by simp lemma double_zero [simp]: "a + a = 0 \<longleftrightarrow> a = 0" proof assume "a + a = 0" then have a: "- a = a" by (rule minus_unique) then show "a = 0" by (simp only: neg_equal_zero) next assume "a = 0" then show "a + a = 0" by simp qed lemma double_zero_sym [simp]: "0 = a + a \<longleftrightarrow> a = 0" apply (rule iffI) apply (drule sym) apply simp_all done lemma zero_less_double_add_iff_zero_less_single_add [simp]: "0 < a + a \<longleftrightarrow> 0 < a" proof assume "0 < a + a" then have "0 - a < a" by (simp only: diff_less_eq) then have "- a < a" by simp then show "0 < a" by simp next assume "0 < a" with this have "0 + 0 < a + a" by (rule add_strict_mono) then show "0 < a + a" by simp qed lemma zero_le_double_add_iff_zero_le_single_add [simp]: "0 \<le> a + a \<longleftrightarrow> 0 \<le> a" by (auto simp add: le_less) lemma double_add_less_zero_iff_single_add_less_zero [simp]: "a + a < 0 \<longleftrightarrow> a < 0" proof - have "\<not> a + a < 0 \<longleftrightarrow> \<not> a < 0" by (simp add: not_less) then show ?thesis by simp qed lemma double_add_le_zero_iff_single_add_le_zero [simp]: "a + a \<le> 0 \<longleftrightarrow> a \<le> 0" proof - have "\<not> a + a \<le> 0 \<longleftrightarrow> \<not> a \<le> 0" by (simp add: not_le) then show ?thesis by simp qed lemma minus_max_eq_min: "- max x y = min (- x) (- y)" by (auto simp add: max_def min_def) lemma minus_min_eq_max: "- min x y = max (- x) (- y)" by (auto simp add: max_def min_def) end class abs = fixes abs :: "'a \<Rightarrow> 'a" ("\<bar>_\<bar>") class sgn = fixes sgn :: "'a \<Rightarrow> 'a" class ordered_ab_group_add_abs = ordered_ab_group_add + abs + assumes abs_ge_zero [simp]: "\<bar>a\<bar> \<ge> 0" and abs_ge_self: "a \<le> \<bar>a\<bar>" and abs_leI: "a \<le> b \<Longrightarrow> - a \<le> b \<Longrightarrow> \<bar>a\<bar> \<le> b" and abs_minus_cancel [simp]: "\<bar>-a\<bar> = \<bar>a\<bar>" and abs_triangle_ineq: "\<bar>a + b\<bar> \<le> \<bar>a\<bar> + \<bar>b\<bar>" begin lemma abs_minus_le_zero: "- \<bar>a\<bar> \<le> 0" unfolding neg_le_0_iff_le by simp lemma abs_of_nonneg [simp]: assumes nonneg: "0 \<le> a" shows "\<bar>a\<bar> = a" proof (rule antisym) show "a \<le> \<bar>a\<bar>" by (rule abs_ge_self) from nonneg le_imp_neg_le have "- a \<le> 0" by simp from this nonneg have "- a \<le> a" by (rule order_trans) then show "\<bar>a\<bar> \<le> a" by (auto intro: abs_leI) qed lemma abs_idempotent [simp]: "\<bar>\<bar>a\<bar>\<bar> = \<bar>a\<bar>" by (rule antisym) (auto intro!: abs_ge_self abs_leI order_trans [of "- \<bar>a\<bar>" 0 "\<bar>a\<bar>"]) lemma abs_eq_0 [simp]: "\<bar>a\<bar> = 0 \<longleftrightarrow> a = 0" proof - have "\<bar>a\<bar> = 0 \<Longrightarrow> a = 0" proof (rule antisym) assume zero: "\<bar>a\<bar> = 0" with abs_ge_self show "a \<le> 0" by auto from zero have "\<bar>-a\<bar> = 0" by simp with abs_ge_self [of "- a"] have "- a \<le> 0" by auto with neg_le_0_iff_le show "0 \<le> a" by auto qed then show ?thesis by auto qed lemma abs_zero [simp]: "\<bar>0\<bar> = 0" by simp lemma abs_0_eq [simp]: "0 = \<bar>a\<bar> \<longleftrightarrow> a = 0" proof - have "0 = \<bar>a\<bar> \<longleftrightarrow> \<bar>a\<bar> = 0" by (simp only: eq_ac) then show ?thesis by simp qed lemma abs_le_zero_iff [simp]: "\<bar>a\<bar> \<le> 0 \<longleftrightarrow> a = 0" proof assume "\<bar>a\<bar> \<le> 0" then have "\<bar>a\<bar> = 0" by (rule antisym) simp then show "a = 0" by simp next assume "a = 0" then show "\<bar>a\<bar> \<le> 0" by simp qed lemma abs_le_self_iff [simp]: "\<bar>a\<bar> \<le> a \<longleftrightarrow> 0 \<le> a" proof - have "0 \<le> \<bar>a\<bar>" using abs_ge_zero by blast then have "\<bar>a\<bar> \<le> a \<Longrightarrow> 0 \<le> a" using order.trans by blast then show ?thesis using abs_of_nonneg eq_refl by blast qed lemma zero_less_abs_iff [simp]: "0 < \<bar>a\<bar> \<longleftrightarrow> a \<noteq> 0" by (simp add: less_le) lemma abs_not_less_zero [simp]: "\<not> \<bar>a\<bar> < 0" proof - have "x \<le> y \<Longrightarrow> \<not> y < x" for x y by auto then show ?thesis by simp qed lemma abs_ge_minus_self: "- a \<le> \<bar>a\<bar>" proof - have "- a \<le> \<bar>-a\<bar>" by (rule abs_ge_self) then show ?thesis by simp qed lemma abs_minus_commute: "\<bar>a - b\<bar> = \<bar>b - a\<bar>" proof - have "\<bar>a - b\<bar> = \<bar>- (a - b)\<bar>" by (simp only: abs_minus_cancel) also have "\<dots> = \<bar>b - a\<bar>" by simp finally show ?thesis . qed lemma abs_of_pos: "0 < a \<Longrightarrow> \<bar>a\<bar> = a" by (rule abs_of_nonneg) (rule less_imp_le) lemma abs_of_nonpos [simp]: assumes "a \<le> 0" shows "\<bar>a\<bar> = - a" proof - let ?b = "- a" have "- ?b \<le> 0 \<Longrightarrow> \<bar>- ?b\<bar> = - (- ?b)" unfolding abs_minus_cancel [of ?b] unfolding neg_le_0_iff_le [of ?b] unfolding minus_minus by (erule abs_of_nonneg) then show ?thesis using assms by auto qed lemma abs_of_neg: "a < 0 \<Longrightarrow> \<bar>a\<bar> = - a" by (rule abs_of_nonpos) (rule less_imp_le) lemma abs_le_D1: "\<bar>a\<bar> \<le> b \<Longrightarrow> a \<le> b" using abs_ge_self by (blast intro: order_trans) lemma abs_le_D2: "\<bar>a\<bar> \<le> b \<Longrightarrow> - a \<le> b" using abs_le_D1 [of "- a"] by simp lemma abs_le_iff: "\<bar>a\<bar> \<le> b \<longleftrightarrow> a \<le> b \<and> - a \<le> b" by (blast intro: abs_leI dest: abs_le_D1 abs_le_D2) lemma abs_triangle_ineq2: "\<bar>a\<bar> - \<bar>b\<bar> \<le> \<bar>a - b\<bar>" proof - have "\<bar>a\<bar> = \<bar>b + (a - b)\<bar>" by (simp add: algebra_simps) then have "\<bar>a\<bar> \<le> \<bar>b\<bar> + \<bar>a - b\<bar>" by (simp add: abs_triangle_ineq) then show ?thesis by (simp add: algebra_simps) qed lemma abs_triangle_ineq2_sym: "\<bar>a\<bar> - \<bar>b\<bar> \<le> \<bar>b - a\<bar>" by (simp only: abs_minus_commute [of b] abs_triangle_ineq2) lemma abs_triangle_ineq3: "\<bar>\<bar>a\<bar> - \<bar>b\<bar>\<bar> \<le> \<bar>a - b\<bar>" by (simp add: abs_le_iff abs_triangle_ineq2 abs_triangle_ineq2_sym) lemma abs_triangle_ineq4: "\<bar>a - b\<bar> \<le> \<bar>a\<bar> + \<bar>b\<bar>" proof - have "\<bar>a - b\<bar> = \<bar>a + - b\<bar>" by (simp add: algebra_simps) also have "\<dots> \<le> \<bar>a\<bar> + \<bar>- b\<bar>" by (rule abs_triangle_ineq) finally show ?thesis by simp qed lemma abs_diff_triangle_ineq: "\<bar>a + b - (c + d)\<bar> \<le> \<bar>a - c\<bar> + \<bar>b - d\<bar>" proof - have "\<bar>a + b - (c + d)\<bar> = \<bar>(a - c) + (b - d)\<bar>" by (simp add: algebra_simps) also have "\<dots> \<le> \<bar>a - c\<bar> + \<bar>b - d\<bar>" by (rule abs_triangle_ineq) finally show ?thesis . qed lemma abs_add_abs [simp]: "\<bar>\<bar>a\<bar> + \<bar>b\<bar>\<bar> = \<bar>a\<bar> + \<bar>b\<bar>" (is "?L = ?R") proof (rule antisym) show "?L \<ge> ?R" by (rule abs_ge_self) have "?L \<le> \<bar>\<bar>a\<bar>\<bar> + \<bar>\<bar>b\<bar>\<bar>" by (rule abs_triangle_ineq) also have "\<dots> = ?R" by simp finally show "?L \<le> ?R" . qed end lemma dense_eq0_I: fixes x::"'a::{dense_linorder,ordered_ab_group_add_abs}" shows "(\<And>e. 0 < e \<Longrightarrow> \<bar>x\<bar> \<le> e) \<Longrightarrow> x = 0" apply (cases "\<bar>x\<bar> = 0") apply simp apply (simp only: zero_less_abs_iff [symmetric]) apply (drule dense) apply (auto simp add: not_less [symmetric]) done hide_fact (open) ab_diff_conv_add_uminus add_0 mult_1 ab_left_minus lemmas add_0 = add_0_left (* FIXME duplicate *) lemmas mult_1 = mult_1_left (* FIXME duplicate *) lemmas ab_left_minus = left_minus (* FIXME duplicate *) lemmas diff_diff_eq = diff_diff_add (* FIXME duplicate *) subsection \<open>Canonically ordered monoids\<close> text \<open>Canonically ordered monoids are never groups.\<close> class canonically_ordered_monoid_add = comm_monoid_add + order + assumes le_iff_add: "a \<le> b \<longleftrightarrow> (\<exists>c. b = a + c)" begin lemma zero_le[simp]: "0 \<le> x" by (auto simp: le_iff_add) lemma le_zero_eq[simp]: "n \<le> 0 \<longleftrightarrow> n = 0" by (auto intro: antisym) lemma not_less_zero[simp]: "\<not> n < 0" by (auto simp: less_le) lemma zero_less_iff_neq_zero: "0 < n \<longleftrightarrow> n \<noteq> 0" by (auto simp: less_le) text \<open>This theorem is useful with \<open>blast\<close>\<close> lemma gr_zeroI: "(n = 0 \<Longrightarrow> False) \<Longrightarrow> 0 < n" by (rule zero_less_iff_neq_zero[THEN iffD2]) iprover lemma not_gr_zero[simp]: "\<not> 0 < n \<longleftrightarrow> n = 0" by (simp add: zero_less_iff_neq_zero) subclass ordered_comm_monoid_add proof qed (auto simp: le_iff_add add_ac) lemma gr_implies_not_zero: "m < n \<Longrightarrow> n \<noteq> 0" by auto lemma add_eq_0_iff_both_eq_0[simp]: "x + y = 0 \<longleftrightarrow> x = 0 \<and> y = 0" by (intro add_nonneg_eq_0_iff zero_le) lemma zero_eq_add_iff_both_eq_0[simp]: "0 = x + y \<longleftrightarrow> x = 0 \<and> y = 0" using add_eq_0_iff_both_eq_0[of x y] unfolding eq_commute[of 0] . lemmas zero_order = zero_le le_zero_eq not_less_zero zero_less_iff_neq_zero not_gr_zero \<comment> \<open>This should be attributed with \<open>[iff]\<close>, but then \<open>blast\<close> fails in \<open>Set\<close>.\<close> end class ordered_cancel_comm_monoid_diff = canonically_ordered_monoid_add + comm_monoid_diff + ordered_ab_semigroup_add_imp_le begin context fixes a b :: 'a assumes le: "a \<le> b" begin lemma add_diff_inverse: "a + (b - a) = b" using le by (auto simp add: le_iff_add) lemma add_diff_assoc: "c + (b - a) = c + b - a" using le by (auto simp add: le_iff_add add.left_commute [of c]) lemma add_diff_assoc2: "b - a + c = b + c - a" using le by (auto simp add: le_iff_add add.assoc) lemma diff_add_assoc: "c + b - a = c + (b - a)" using le by (simp add: add.commute add_diff_assoc) lemma diff_add_assoc2: "b + c - a = b - a + c" using le by (simp add: add.commute add_diff_assoc) lemma diff_diff_right: "c - (b - a) = c + a - b" by (simp add: add_diff_inverse add_diff_cancel_left [of a c "b - a", symmetric] add.commute) lemma diff_add: "b - a + a = b" by (simp add: add.commute add_diff_inverse) lemma le_add_diff: "c \<le> b + c - a" by (auto simp add: add.commute diff_add_assoc2 le_iff_add) lemma le_imp_diff_is_add: "a \<le> b \<Longrightarrow> b - a = c \<longleftrightarrow> b = c + a" by (auto simp add: add.commute add_diff_inverse) lemma le_diff_conv2: "c \<le> b - a \<longleftrightarrow> c + a \<le> b" (is "?P \<longleftrightarrow> ?Q") proof assume ?P then have "c + a \<le> b - a + a" by (rule add_right_mono) then show ?Q by (simp add: add_diff_inverse add.commute) next assume ?Q then have "a + c \<le> a + (b - a)" by (simp add: add_diff_inverse add.commute) then show ?P by simp qed end end subsection \<open>Tools setup\<close> lemma add_mono_thms_linordered_semiring: fixes i j k :: "'a::ordered_ab_semigroup_add" shows "i \<le> j \<and> k \<le> l \<Longrightarrow> i + k \<le> j + l" and "i = j \<and> k \<le> l \<Longrightarrow> i + k \<le> j + l" and "i \<le> j \<and> k = l \<Longrightarrow> i + k \<le> j + l" and "i = j \<and> k = l \<Longrightarrow> i + k = j + l" by (rule add_mono, clarify+)+ lemma add_mono_thms_linordered_field: fixes i j k :: "'a::ordered_cancel_ab_semigroup_add" shows "i < j \<and> k = l \<Longrightarrow> i + k < j + l" and "i = j \<and> k < l \<Longrightarrow> i + k < j + l" and "i < j \<and> k \<le> l \<Longrightarrow> i + k < j + l" and "i \<le> j \<and> k < l \<Longrightarrow> i + k < j + l" and "i < j \<and> k < l \<Longrightarrow> i + k < j + l" by (auto intro: add_strict_right_mono add_strict_left_mono add_less_le_mono add_le_less_mono add_strict_mono) code_identifier code_module Groups \<rightharpoonup> (SML) Arith and (OCaml) Arith and (Haskell) Arith end
/- Copyright (c) 2022 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang ! This file was ported from Lean 3 source module algebraic_geometry.morphisms.finite_type ! leanprover-community/mathlib commit 70fd9563a21e7b963887c9360bd29b2393e6225a ! Please do not edit these lines, except to modify the commit id ! if you have ported upstream changes. -/ import Mathbin.AlgebraicGeometry.Morphisms.RingHomProperties import Mathbin.RingTheory.RingHom.FiniteType /-! # Morphisms of finite type A morphism of schemes `f : X ⟶ Y` is locally of finite type if for each affine `U ⊆ Y` and `V ⊆ f ⁻¹' U`, The induced map `Γ(Y, U) ⟶ Γ(X, V)` is of finite type. A morphism of schemes is of finite type if it is both locally of finite type and quasi-compact. We show that these properties are local, and are stable under compositions. -/ noncomputable section open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace universe v u namespace AlgebraicGeometry variable {X Y : Scheme.{u}} (f : X ⟶ Y) /-- A morphism of schemes `f : X ⟶ Y` is locally of finite type if for each affine `U ⊆ Y` and `V ⊆ f ⁻¹' U`, The induced map `Γ(Y, U) ⟶ Γ(X, V)` is of finite type. -/ @[mk_iff] class LocallyOfFiniteType (f : X ⟶ Y) : Prop where finiteType_of_affine_subset : ∀ (U : Y.affineOpens) (V : X.affineOpens) (e : V.1 ≤ (Opens.map f.1.base).obj U.1), (f.appLe e).FiniteType #align algebraic_geometry.locally_of_finite_type AlgebraicGeometry.LocallyOfFiniteType theorem locallyOfFiniteType_eq : @LocallyOfFiniteType = affineLocally @RingHom.FiniteType := by ext (X Y f) rw [locally_of_finite_type_iff, affine_locally_iff_affine_opens_le] exact RingHom.finiteType_respectsIso #align algebraic_geometry.locally_of_finite_type_eq AlgebraicGeometry.locallyOfFiniteType_eq instance (priority := 900) locallyOfFiniteTypeOfIsOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [IsOpenImmersion f] : LocallyOfFiniteType f := locallyOfFiniteType_eq.symm ▸ RingHom.finiteType_is_local.affineLocally_of_isOpenImmersion f #align algebraic_geometry.locally_of_finite_type_of_is_open_immersion AlgebraicGeometry.locallyOfFiniteTypeOfIsOpenImmersion theorem locallyOfFiniteType_stableUnderComposition : MorphismProperty.StableUnderComposition @LocallyOfFiniteType := locallyOfFiniteType_eq.symm ▸ RingHom.finiteType_is_local.affineLocally_stableUnderComposition #align algebraic_geometry.locally_of_finite_type_stable_under_composition AlgebraicGeometry.locallyOfFiniteType_stableUnderComposition instance locallyOfFiniteTypeComp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [hf : LocallyOfFiniteType f] [hg : LocallyOfFiniteType g] : LocallyOfFiniteType (f ≫ g) := locallyOfFiniteType_stableUnderComposition f g hf hg #align algebraic_geometry.locally_of_finite_type_comp AlgebraicGeometry.locallyOfFiniteTypeComp theorem locallyOfFiniteTypeOfComp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [hf : LocallyOfFiniteType (f ≫ g)] : LocallyOfFiniteType f := by revert hf rw [locally_of_finite_type_eq] apply ring_hom.finite_type_is_local.affine_locally_of_comp introv H exact RingHom.FiniteType.of_comp_finiteType H #align algebraic_geometry.locally_of_finite_type_of_comp AlgebraicGeometry.locallyOfFiniteTypeOfComp theorem LocallyOfFiniteType.affine_openCover_iff {X Y : Scheme.{u}} (f : X ⟶ Y) (𝒰 : Scheme.OpenCover.{u} Y) [∀ i, IsAffine (𝒰.obj i)] (𝒰' : ∀ i, Scheme.OpenCover.{u} ((𝒰.pullbackCover f).obj i)) [∀ i j, IsAffine ((𝒰' i).obj j)] : LocallyOfFiniteType f ↔ ∀ i j, (Scheme.Γ.map ((𝒰' i).map j ≫ pullback.snd).op).FiniteType := locallyOfFiniteType_eq.symm ▸ RingHom.finiteType_is_local.affine_openCover_iff f 𝒰 𝒰' #align algebraic_geometry.locally_of_finite_type.affine_open_cover_iff AlgebraicGeometry.LocallyOfFiniteType.affine_openCover_iff theorem LocallyOfFiniteType.source_openCover_iff {X Y : Scheme.{u}} (f : X ⟶ Y) (𝒰 : Scheme.OpenCover.{u} X) : LocallyOfFiniteType f ↔ ∀ i, LocallyOfFiniteType (𝒰.map i ≫ f) := locallyOfFiniteType_eq.symm ▸ RingHom.finiteType_is_local.source_openCover_iff f 𝒰 #align algebraic_geometry.locally_of_finite_type.source_open_cover_iff AlgebraicGeometry.LocallyOfFiniteType.source_openCover_iff theorem LocallyOfFiniteType.openCover_iff {X Y : Scheme.{u}} (f : X ⟶ Y) (𝒰 : Scheme.OpenCover.{u} Y) : LocallyOfFiniteType f ↔ ∀ i, LocallyOfFiniteType (pullback.snd : pullback f (𝒰.map i) ⟶ _) := locallyOfFiniteType_eq.symm ▸ RingHom.finiteType_is_local.isLocalAffineLocally.openCover_iff f 𝒰 #align algebraic_geometry.locally_of_finite_type.open_cover_iff AlgebraicGeometry.LocallyOfFiniteType.openCover_iff theorem locallyOfFiniteType_respectsIso : MorphismProperty.RespectsIso @LocallyOfFiniteType := locallyOfFiniteType_eq.symm ▸ targetAffineLocally_respectsIso (sourceAffineLocally_respectsIso RingHom.finiteType_respectsIso) #align algebraic_geometry.locally_of_finite_type_respects_iso AlgebraicGeometry.locallyOfFiniteType_respectsIso end AlgebraicGeometry
/- Copyright (c) 2020 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Ken Lee, Chris Hughes -/ import tactic.ring import group_theory.group_action.units /-! # Coprime elements of a ring > THIS FILE IS SYNCHRONIZED WITH MATHLIB4. > Any changes to this file require a corresponding PR to mathlib4. ## Main definitions * `is_coprime x y`: that `x` and `y` are coprime, defined to be the existence of `a` and `b` such that `a * x + b * y = 1`. Note that elements with no common divisors are not necessarily coprime, e.g., the multivariate polynomials `x₁` and `x₂` are not coprime. See also `ring_theory.coprime.lemmas` for further development of coprime elements. -/ open_locale classical universes u v section comm_semiring variables {R : Type u} [comm_semiring R] (x y z : R) /-- The proposition that `x` and `y` are coprime, defined to be the existence of `a` and `b` such that `a * x + b * y = 1`. Note that elements with no common divisors are not necessarily coprime, e.g., the multivariate polynomials `x₁` and `x₂` are not coprime. -/ @[simp] def is_coprime : Prop := ∃ a b, a * x + b * y = 1 variables {x y z} theorem is_coprime.symm (H : is_coprime x y) : is_coprime y x := let ⟨a, b, H⟩ := H in ⟨b, a, by rw [add_comm, H]⟩ theorem is_coprime_comm : is_coprime x y ↔ is_coprime y x := ⟨is_coprime.symm, is_coprime.symm⟩ theorem is_coprime_self : is_coprime x x ↔ is_unit x := ⟨λ ⟨a, b, h⟩, is_unit_of_mul_eq_one x (a + b) $ by rwa [mul_comm, add_mul], λ h, let ⟨b, hb⟩ := is_unit_iff_exists_inv'.1 h in ⟨b, 0, by rwa [zero_mul, add_zero]⟩⟩ theorem is_coprime_zero_left : is_coprime 0 x ↔ is_unit x := ⟨λ ⟨a, b, H⟩, is_unit_of_mul_eq_one x b $ by rwa [mul_zero, zero_add, mul_comm] at H, λ H, let ⟨b, hb⟩ := is_unit_iff_exists_inv'.1 H in ⟨1, b, by rwa [one_mul, zero_add]⟩⟩ theorem is_coprime_zero_right : is_coprime x 0 ↔ is_unit x := is_coprime_comm.trans is_coprime_zero_left lemma not_coprime_zero_zero [nontrivial R] : ¬ is_coprime (0 : R) 0 := mt is_coprime_zero_right.mp not_is_unit_zero /-- If a 2-vector `p` satisfies `is_coprime (p 0) (p 1)`, then `p ≠ 0`. -/ lemma is_coprime.ne_zero [nontrivial R] {p : fin 2 → R} (h : is_coprime (p 0) (p 1)) : p ≠ 0 := by { rintro rfl, exact not_coprime_zero_zero h } theorem is_coprime_one_left : is_coprime 1 x := ⟨1, 0, by rw [one_mul, zero_mul, add_zero]⟩ theorem is_coprime_one_right : is_coprime x 1 := ⟨0, 1, by rw [one_mul, zero_mul, zero_add]⟩ theorem is_coprime.dvd_of_dvd_mul_right (H1 : is_coprime x z) (H2 : x ∣ y * z) : x ∣ y := let ⟨a, b, H⟩ := H1 in by { rw [← mul_one y, ← H, mul_add, ← mul_assoc, mul_left_comm], exact dvd_add (dvd_mul_left _ _) (H2.mul_left _) } theorem is_coprime.dvd_of_dvd_mul_left (H1 : is_coprime x y) (H2 : x ∣ y * z) : x ∣ z := let ⟨a, b, H⟩ := H1 in by { rw [← one_mul z, ← H, add_mul, mul_right_comm, mul_assoc b], exact dvd_add (dvd_mul_left _ _) (H2.mul_left _) } theorem is_coprime.mul_left (H1 : is_coprime x z) (H2 : is_coprime y z) : is_coprime (x * y) z := let ⟨a, b, h1⟩ := H1, ⟨c, d, h2⟩ := H2 in ⟨a * c, a * x * d + b * c * y + b * d * z, calc a * c * (x * y) + (a * x * d + b * c * y + b * d * z) * z = (a * x + b * z) * (c * y + d * z) : by ring ... = 1 : by rw [h1, h2, mul_one]⟩ theorem is_coprime.mul_right (H1 : is_coprime x y) (H2 : is_coprime x z) : is_coprime x (y * z) := by { rw is_coprime_comm at H1 H2 ⊢, exact H1.mul_left H2 } theorem is_coprime.mul_dvd (H : is_coprime x y) (H1 : x ∣ z) (H2 : y ∣ z) : x * y ∣ z := begin obtain ⟨a, b, h⟩ := H, rw [← mul_one z, ← h, mul_add], apply dvd_add, { rw [mul_comm z, mul_assoc], exact (mul_dvd_mul_left _ H2).mul_left _ }, { rw [mul_comm b, ← mul_assoc], exact (mul_dvd_mul_right H1 _).mul_right _ } end theorem is_coprime.of_mul_left_left (H : is_coprime (x * y) z) : is_coprime x z := let ⟨a, b, h⟩ := H in ⟨a * y, b, by rwa [mul_right_comm, mul_assoc]⟩ theorem is_coprime.of_mul_left_right (H : is_coprime (x * y) z) : is_coprime y z := by { rw mul_comm at H, exact H.of_mul_left_left } theorem is_coprime.of_mul_right_left (H : is_coprime x (y * z)) : is_coprime x y := by { rw is_coprime_comm at H ⊢, exact H.of_mul_left_left } theorem is_coprime.of_mul_right_right (H : is_coprime x (y * z)) : is_coprime x z := by { rw mul_comm at H, exact H.of_mul_right_left } theorem is_coprime.mul_left_iff : is_coprime (x * y) z ↔ is_coprime x z ∧ is_coprime y z := ⟨λ H, ⟨H.of_mul_left_left, H.of_mul_left_right⟩, λ ⟨H1, H2⟩, H1.mul_left H2⟩ theorem is_coprime.mul_right_iff : is_coprime x (y * z) ↔ is_coprime x y ∧ is_coprime x z := by rw [is_coprime_comm, is_coprime.mul_left_iff, is_coprime_comm, @is_coprime_comm _ _ z] theorem is_coprime.of_coprime_of_dvd_left (h : is_coprime y z) (hdvd : x ∣ y) : is_coprime x z := begin obtain ⟨d, rfl⟩ := hdvd, exact is_coprime.of_mul_left_left h end theorem is_coprime.of_coprime_of_dvd_right (h : is_coprime z y) (hdvd : x ∣ y) : is_coprime z x := (h.symm.of_coprime_of_dvd_left hdvd).symm theorem is_coprime.is_unit_of_dvd (H : is_coprime x y) (d : x ∣ y) : is_unit x := let ⟨k, hk⟩ := d in is_coprime_self.1 $ is_coprime.of_mul_right_left $ show is_coprime x (x * k), from hk ▸ H theorem is_coprime.is_unit_of_dvd' {a b x : R} (h : is_coprime a b) (ha : x ∣ a) (hb : x ∣ b) : is_unit x := (h.of_coprime_of_dvd_left ha).is_unit_of_dvd hb theorem is_coprime.map (H : is_coprime x y) {S : Type v} [comm_semiring S] (f : R →+* S) : is_coprime (f x) (f y) := let ⟨a, b, h⟩ := H in ⟨f a, f b, by rw [← f.map_mul, ← f.map_mul, ← f.map_add, h, f.map_one]⟩ variables {x y z} lemma is_coprime.of_add_mul_left_left (h : is_coprime (x + y * z) y) : is_coprime x y := let ⟨a, b, H⟩ := h in ⟨a, a * z + b, by simpa only [add_mul, mul_add, add_assoc, add_comm, add_left_comm, mul_assoc, mul_comm, mul_left_comm] using H⟩ lemma is_coprime.of_add_mul_right_left (h : is_coprime (x + z * y) y) : is_coprime x y := by { rw mul_comm at h, exact h.of_add_mul_left_left } lemma is_coprime.of_add_mul_left_right (h : is_coprime x (y + x * z)) : is_coprime x y := by { rw is_coprime_comm at h ⊢, exact h.of_add_mul_left_left } lemma is_coprime.of_add_mul_right_right (h : is_coprime x (y + z * x)) : is_coprime x y := by { rw mul_comm at h, exact h.of_add_mul_left_right } lemma is_coprime.of_mul_add_left_left (h : is_coprime (y * z + x) y) : is_coprime x y := by { rw add_comm at h, exact h.of_add_mul_left_left } lemma is_coprime.of_mul_add_right_left (h : is_coprime (z * y + x) y) : is_coprime x y := by { rw add_comm at h, exact h.of_add_mul_right_left } lemma is_coprime.of_mul_add_left_right (h : is_coprime x (x * z + y)) : is_coprime x y := by { rw add_comm at h, exact h.of_add_mul_left_right } lemma is_coprime.of_mul_add_right_right (h : is_coprime x (z * x + y)) : is_coprime x y := by { rw add_comm at h, exact h.of_add_mul_right_right } end comm_semiring section scalar_tower variables {R G : Type*} [comm_semiring R] [group G] [mul_action G R] [smul_comm_class G R R] [is_scalar_tower G R R] (x : G) (y z : R) lemma is_coprime_group_smul_left : is_coprime (x • y) z ↔ is_coprime y z := ⟨λ ⟨a, b, h⟩, ⟨x • a, b, by rwa [smul_mul_assoc, ←mul_smul_comm]⟩, λ ⟨a, b, h⟩, ⟨x⁻¹ • a, b, by rwa [smul_mul_smul, inv_mul_self, one_smul]⟩⟩ lemma is_coprime_group_smul_right : is_coprime y (x • z) ↔ is_coprime y z := is_coprime_comm.trans $ (is_coprime_group_smul_left x z y).trans is_coprime_comm lemma is_coprime_group_smul : is_coprime (x • y) (x • z) ↔ is_coprime y z := (is_coprime_group_smul_left x y (x • z)).trans (is_coprime_group_smul_right x y z) end scalar_tower section comm_semiring_unit variables {R : Type*} [comm_semiring R] {x : R} (hu : is_unit x) (y z : R) lemma is_coprime_mul_unit_left_left : is_coprime (x * y) z ↔ is_coprime y z := let ⟨u, hu⟩ := hu in hu ▸ is_coprime_group_smul_left u y z lemma is_coprime_mul_unit_left_right : is_coprime y (x * z) ↔ is_coprime y z := let ⟨u, hu⟩ := hu in hu ▸ is_coprime_group_smul_right u y z lemma is_coprime_mul_unit_left : is_coprime (x * y) (x * z) ↔ is_coprime y z := (is_coprime_mul_unit_left_left hu y (x * z)).trans (is_coprime_mul_unit_left_right hu y z) lemma is_coprime_mul_unit_right_left : is_coprime (y * x) z ↔ is_coprime y z := mul_comm x y ▸ is_coprime_mul_unit_left_left hu y z lemma is_coprime_mul_unit_right_right : is_coprime y (z * x) ↔ is_coprime y z := mul_comm x z ▸ is_coprime_mul_unit_left_right hu y z lemma is_coprime_mul_unit_right : is_coprime (y * x) (z * x) ↔ is_coprime y z := (is_coprime_mul_unit_right_left hu y (z * x)).trans (is_coprime_mul_unit_right_right hu y z) end comm_semiring_unit namespace is_coprime section comm_ring variables {R : Type u} [comm_ring R] lemma add_mul_left_left {x y : R} (h : is_coprime x y) (z : R) : is_coprime (x + y * z) y := @of_add_mul_left_left R _ _ _ (-z) $ by simpa only [mul_neg, add_neg_cancel_right] using h lemma add_mul_right_left {x y : R} (h : is_coprime x y) (z : R) : is_coprime (x + z * y) y := by { rw mul_comm, exact h.add_mul_left_left z } lemma add_mul_left_right {x y : R} (h : is_coprime x y) (z : R) : is_coprime x (y + x * z) := by { rw is_coprime_comm, exact h.symm.add_mul_left_left z } lemma add_mul_right_right {x y : R} (h : is_coprime x y) (z : R) : is_coprime x (y + z * x) := by { rw is_coprime_comm, exact h.symm.add_mul_right_left z } lemma mul_add_left_left {x y : R} (h : is_coprime x y) (z : R) : is_coprime (y * z + x) y := by { rw add_comm, exact h.add_mul_left_left z } lemma mul_add_right_left {x y : R} (h : is_coprime x y) (z : R) : is_coprime (z * y + x) y := by { rw add_comm, exact h.add_mul_right_left z } lemma mul_add_left_right {x y : R} (h : is_coprime x y) (z : R) : is_coprime x (x * z + y) := by { rw add_comm, exact h.add_mul_left_right z } lemma mul_add_right_right {x y : R} (h : is_coprime x y) (z : R) : is_coprime x (z * x + y) := by { rw add_comm, exact h.add_mul_right_right z } lemma add_mul_left_left_iff {x y z : R} : is_coprime (x + y * z) y ↔ is_coprime x y := ⟨of_add_mul_left_left, λ h, h.add_mul_left_left z⟩ lemma add_mul_right_left_iff {x y z : R} : is_coprime (x + z * y) y ↔ is_coprime x y := ⟨of_add_mul_right_left, λ h, h.add_mul_right_left z⟩ lemma add_mul_left_right_iff {x y z : R} : is_coprime x (y + x * z) ↔ is_coprime x y := ⟨of_add_mul_left_right, λ h, h.add_mul_left_right z⟩ lemma add_mul_right_right_iff {x y z : R} : is_coprime x (y + z * x) ↔ is_coprime x y := ⟨of_add_mul_right_right, λ h, h.add_mul_right_right z⟩ lemma mul_add_left_left_iff {x y z : R} : is_coprime (y * z + x) y ↔ is_coprime x y := ⟨of_mul_add_left_left, λ h, h.mul_add_left_left z⟩ lemma mul_add_right_left_iff {x y z : R} : is_coprime (z * y + x) y ↔ is_coprime x y := ⟨of_mul_add_right_left, λ h, h.mul_add_right_left z⟩ lemma mul_add_left_right_iff {x y z : R} : is_coprime x (x * z + y) ↔ is_coprime x y := ⟨of_mul_add_left_right, λ h, h.mul_add_left_right z⟩ lemma mul_add_right_right_iff {x y z : R} : is_coprime x (z * x + y) ↔ is_coprime x y := ⟨of_mul_add_right_right, λ h, h.mul_add_right_right z⟩ lemma neg_left {x y : R} (h : is_coprime x y) : is_coprime (-x) y := begin obtain ⟨a, b, h⟩ := h, use [-a, b], rwa neg_mul_neg, end lemma neg_left_iff (x y : R) : is_coprime (-x) y ↔ is_coprime x y := ⟨λ h, neg_neg x ▸ h.neg_left, neg_left⟩ lemma neg_right {x y : R} (h : is_coprime x y) : is_coprime x (-y) := h.symm.neg_left.symm lemma neg_right_iff (x y : R) : is_coprime x (-y) ↔ is_coprime x y := ⟨λ h, neg_neg y ▸ h.neg_right, neg_right⟩ lemma neg_neg {x y : R} (h : is_coprime x y) : is_coprime (-x) (-y) := h.neg_left.neg_right lemma neg_neg_iff (x y : R) : is_coprime (-x) (-y) ↔ is_coprime x y := (neg_left_iff _ _).trans (neg_right_iff _ _) end comm_ring lemma sq_add_sq_ne_zero {R : Type*} [linear_ordered_comm_ring R] {a b : R} (h : is_coprime a b) : a ^ 2 + b ^ 2 ≠ 0 := begin intros h', obtain ⟨ha, hb⟩ := (add_eq_zero_iff' (sq_nonneg a) (sq_nonneg b)).mp h', obtain rfl := pow_eq_zero ha, obtain rfl := pow_eq_zero hb, exact not_coprime_zero_zero h end end is_coprime
lemma setdist_Lipschitz: "\<bar>setdist {x} S - setdist {y} S\<bar> \<le> dist x y"
From Coqprime Require Import PocklingtonRefl. Local Open Scope positive_scope. Lemma primo116: prime 37680100350880616627817671311-> prime 4955950558850274991939631318283193. Proof. intro H. apply (Pocklington_refl (Ell_certif 4955950558850274991939631318283193 131527 ((37680100350880616627817671311,1)::nil) 0 1015808 32 1024) ((Proof_certif _ H) :: nil)). native_cast_no_check (refl_equal true). Time Qed.
// // Licensed to Green Energy Corp (www.greenenergycorp.com) under one or // more contributor license agreements. See the NOTICE file distributed // with this work for additional information regarding copyright ownership. // Green Energy Corp licenses this file to you under the Apache License, // Version 2.0 (the "License"); you may not use this file except in // compliance with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // This file was forked on 01/01/2013 by Automatak, LLC and modifications // have been made to this file. Automatak, LLC licenses these modifications to // you under the GNU Affero General Public License Version 3.0 // (the "Additional License"). You may not use these modifications except in // compliance with the additional license. You may obtain a copy of the Additional // License at // // http://www.gnu.org/licenses/agpl.html // // Contact Automatak, LLC for a commercial license to these modifications // #include <boost/test/unit_test.hpp> #include <opendnp3/RandomizedBuffer.h> #include <opendnp3/LoggableMacros.h> #include "MockPhysicalLayerMonitor.h" #include "VtoIntegrationTestBase.h" #include <functional> using namespace opendnp3; using namespace std::chrono; class VtoOnewayTestStack : public VtoIntegrationTestBase { public: VtoOnewayTestStack( bool clientOnSlave = true, bool aImmediateOutput = false, FilterLevel level = LEV_INFO, boost::uint16_t port = MACRO_PORT_VALUE) : VtoIntegrationTestBase(clientOnSlave, aImmediateOutput, level, port), local(mLog.GetLogger(level, "local-mock-phys-monitor"), &vtoClient, milliseconds(500), seconds(10)), remote(mLog.GetLogger(level, "remote-mock-phys-monitor"), &vtoServer, milliseconds(500), seconds(10)) { } virtual ~VtoOnewayTestStack() { local.Shutdown(); remote.Shutdown(); } bool WaitForBothSides(ChannelState aState, millis_t aTimeout = 30000) { return this->WaitForLocalState(aState) && this->WaitForRemoteState(aState); } bool WaitForLocalState(ChannelState aState, millis_t aTimeout = 30000) { LOG_BLOCK(LEV_EVENT, "Waiting for local state: " << ConvertChannelStateToString(aState)); return testObj.ProceedUntil(std::bind(&MockPhysicalLayerMonitor::NextStateIs, &local, aState), aTimeout); } bool WaitForRemoteState(ChannelState aState, millis_t aTimeout = 30000) { LOG_BLOCK(LEV_EVENT, "Waiting for remote state: " << ConvertChannelStateToString(aState)); return testObj.ProceedUntil(std::bind(&MockPhysicalLayerMonitor::NextStateIs, &remote, aState), aTimeout); } bool WaitForExpectedDataToBeReceived(millis_t aTimeout = 30000) { return testObj.ProceedUntil(std::bind(&MockPhysicalLayerMonitor::AllExpectedDataHasBeenReceived, &remote), aTimeout); } MockPhysicalLayerMonitor local; MockPhysicalLayerMonitor remote; }; BOOST_AUTO_TEST_SUITE(VtoOnewayIntegrationSuite) BOOST_AUTO_TEST_CASE(Reconnection) { VtoOnewayTestStack stack(true, false); // start up everything, the local side should be able to open stack.remote.Start(); stack.local.Start(); RandomizedBuffer data(100); for(size_t i = 0; i < 1; ++i) { stack.Log(LOCATION, "Begin iteration - Waiting for both sides to open"); BOOST_REQUIRE(stack.WaitForBothSides(CS_OPEN)); // test that data is correctly sent both ways data.Randomize(); stack.local.ExpectData(data); stack.local.WriteData(data); stack.Log(LOCATION, "Waiting for expected data"); BOOST_REQUIRE(stack.WaitForExpectedDataToBeReceived()); // close the remote loopback server, which will cause both sides to close and reopen stack.remote.Close(); stack.Log(LOCATION, "Waiting for both sides to close"); BOOST_REQUIRE(stack.WaitForBothSides(CS_CLOSED)); } } BOOST_AUTO_TEST_CASE(RemoteSideOpenFailureBouncesLocalConnection) { VtoOnewayTestStack test(true, false); BOOST_REQUIRE(test.WaitForLocalState(CS_CLOSED)); test.local.Start(); for(size_t i = 0; i < 3; ++i) { // start local connection, we should immediately be able to connect to this side BOOST_REQUIRE(test.WaitForLocalState(CS_OPEN)); // since the remote side can't connect to the port we should have our local connection bounced BOOST_REQUIRE(test.WaitForLocalState(CS_CLOSED)); } } BOOST_AUTO_TEST_CASE(SocketIsClosedIfRemoteDrops) { VtoOnewayTestStack stack(true, false); // start all components, should connect stack.remote.Start(); stack.local.Start(); for(size_t i = 0; i < 3; ++i) { BOOST_REQUIRE(stack.WaitForBothSides(CS_OPEN)); // kill remote connection, should kill our local connection stack.remote.Close(); BOOST_REQUIRE(stack.WaitForBothSides(CS_CLOSED)); } } void TestLargeDataOneWay(VtoOnewayTestStack& arTest, size_t aSizeInBytes) { // start everything arTest.local.Start(); arTest.remote.Start(); BOOST_REQUIRE(arTest.WaitForBothSides(CS_OPEN)); // test that a large set of data flowing one way works RandomizedBuffer data(aSizeInBytes); arTest.remote.ExpectData(data); arTest.local.WriteData(data); BOOST_REQUIRE(arTest.WaitForExpectedDataToBeReceived(60000)); // this will cause an exception if we receive any more data beyond what we wrote arTest.testObj.ProceedForTime(1000); } #define MACRO_BUFFER_SIZE 1<< 20 // 1 << 20 == 1MB, 1<<24 == 16MB BOOST_AUTO_TEST_CASE(LargeDataTransferMasterToSlave) { VtoOnewayTestStack stack(true, false); // stack.tcpPipe.client.SetCorruptionProbability(0.005); // stack.tcpPipe.server.SetCorruptionProbability(0.005); TestLargeDataOneWay(stack, MACRO_BUFFER_SIZE); } BOOST_AUTO_TEST_CASE(LargeDataTransferSlaveToMaster) { VtoOnewayTestStack stack(false, false); // stack.tcpPipe.client.SetCorruptionProbability(0.005); // stack.tcpPipe.server.SetCorruptionProbability(0.005); TestLargeDataOneWay(stack, MACRO_BUFFER_SIZE); } BOOST_AUTO_TEST_SUITE_END() /* vim: set ts=4 sw=4: */
From iris.proofmode Require Import tactics. From iris.algebra Require Import auth. From iris.program_logic Require Export weakestpre adequacy. From iris.heap_lang Require Import proofmode notation. From iris Require Import options. Class heapPreG Σ := HeapPreG { heap_preG_iris :> invPreG Σ; heap_preG_heap :> gen_heapPreG loc (option val) Σ; heap_preG_inv_heap :> inv_heapPreG loc (option val) Σ; heap_preG_proph :> proph_mapPreG proph_id (val * val) Σ; }. Definition heapΣ : gFunctors := #[invΣ; gen_heapΣ loc (option val); inv_heapΣ loc (option val); proph_mapΣ proph_id (val * val)]. Instance subG_heapPreG {Σ} : subG heapΣ Σ → heapPreG Σ. Proof. solve_inG. Qed. Definition heap_adequacy Σ `{!heapPreG Σ} s e σ φ : (∀ `{!heapG Σ}, ⊢ inv_heap_inv -∗ WP e @ s; ⊤ {{ v, ⌜φ v⌝ }}) → adequate s e σ (λ v _, φ v). Proof. intros Hwp; eapply (wp_adequacy _ _); iIntros (??) "". iMod (gen_heap_init σ.(heap)) as (?) "Hh". iMod (inv_heap_init loc (option val)) as (?) ">Hi". iMod (proph_map_init κs σ.(used_proph_id)) as (?) "Hp". iModIntro. iExists (λ σ κs, (gen_heap_interp σ.(heap) ∗ proph_map_interp κs σ.(used_proph_id))%I), (λ _, True%I). iFrame. iApply (Hwp (HeapG _ _ _ _ _)). done. Qed.
theory ex_4_4 imports Main begin inductive ev::"nat\<Rightarrow>bool" where ev0: "ev 0" | evSS: "ev n \<Longrightarrow> ev (Suc (Suc n))" lemma "\<not> ev (Suc (Suc (Suc 0)))" proof assume "ev (Suc (Suc (Suc 0)))" thus False proof cases assume "ev (Suc 0)" thus False by cases qed qed end
From ConCert.Utils Require Import Extras. From ConCert.Execution Require Import Blockchain. From ConCert.Execution Require Import Containers. From ConCert.Execution Require Import ResultMonad. From ConCert.Execution Require Import Serializable. From ConCert.Execution.Test Require Import QCTest. From ConCert.Examples.Congress Require Import Congress. From ConCert.Examples.Congress Require Export CongressGens. From ConCert.Examples.Congress Require Export CongressPrinters. From Coq Require Import ZArith. From Coq Require Import List. Import ListNotations. Definition LocalChainBase : ChainBase := TestUtils.LocalChainBase. Definition chain1 : ChainBuilder := builder_initial. Definition chain2 : ChainBuilder := unpack_result (add_block chain1 []). Definition chain3 : ChainBuilder := unpack_result (add_block chain2 [build_transfer creator person_1 10]). Definition setup_rules := {| min_vote_count_permille := 200; (* 20% of congress needs to vote *) margin_needed_permille := 501; debating_period_in_blocks := 0; |}. Definition setup := Congress.build_setup setup_rules. Definition deploy_congress : ActionBody := create_deployment 5 Congress.contract setup. Definition chain4 : ChainBuilder := unpack_result (add_block chain3 [build_deploy person_1 5 Congress.contract setup]). Definition congress_1 : Address := match outgoing_txs (builder_trace chain4) person_1 with | tx :: _ => tx_to tx | _ => person_1 end. Definition congress_ifc : ContractInterface Congress.Msg := match get_contract_interface chain4 congress_1 Congress.Msg with | Some x => x (* Using unpack_option here is extremely slow *) | None => @build_contract_interface _ _ creator (fun a m => deploy_congress) end. (* person_1 adds person_1 and person_2 as members of congress *) Definition add_person p := congress_ifc.(send) 0 (Some (add_member p)). Definition chain5 : ChainBuilder := let acts := [build_act person_1 person_1 (add_person person_1); build_act person_1 person_1 (add_person person_2)] in unpack_result (add_block chain4 acts). Definition create_proposal_call := congress_ifc.(send) 0 (Some (create_proposal [cact_transfer person_3 3])). Definition congress_chain := chain5. Definition congress_caddr := addr_of_Z 128%Z. Module NotationInfo <: TestNotationParameters. Definition gAction := (fun env => GCongressAction env act_depth congress_caddr). Definition init_cb := congress_chain. End NotationInfo. Module TN := TestNotations NotationInfo. Import TN. (* Sample gChain. *) Definition nr_cacts (msg : option Congress.Msg) := match msg with | Some (create_proposal ls) => length ls | _ => 0 end. Definition num_cacts_in_state state := sumnat (fun '(k, v) => length (actions v)) (FMap.elements (proposals state)). (* This property states that the number of actions to be performed by the congress never increases more than the actions that are added in proposals, i.e. actions can't appear out of nowhere. *) (* If we replace '<=' with '<' QC finds a counterexample - a proposal can contain an empty list of actions, so they are equal before/after add_proposal *) Definition receive_state_well_behaved state msg new_state (resp_acts : list ActionBody) := num_cacts_in_state new_state + length resp_acts <= num_cacts_in_state state + nr_cacts msg. #[export] Instance receive_state_well_behaved_dec_ {state : Congress.State} {msg : option Congress.Msg} {new_state : Congress.State} {resp_acts : list ActionBody} : Dec (receive_state_well_behaved state msg new_state resp_acts). Proof. intros; unfold receive_state_well_behaved; constructor; apply le_dec. Qed. #[export] Instance receive_state_well_behaved_checkable {state : Congress.State} {msg : option Congress.Msg} {new_state : Congress.State} {resp_acts : list ActionBody} : Checkable (receive_state_well_behaved state msg new_state resp_acts). Proof. apply testDec. Qed. Definition receive_state_well_behaved_P (chain : Chain) (cctx : ContractCallContext) (old_state : Congress.State) (msg : Congress.Msg) (result : option (Congress.State * list ActionBody)) := checker match result with | Some (new_state, resp_acts) => (receive_state_well_behaved old_state (Some msg) new_state resp_acts)? | _ => false end. (* QuickChick ( {{fun _ _ => true}} congress_caddr {{receive_state_well_behaved_P}} ). *) (* coqtop-stdout:+++ Passed 10000 tests (0 discards) *) Open Scope nat. (* A property about the way States are generated. *) (* It says that a State generated at some time slot cannot contain proposals later than this time slot. *) Definition state_proposals_proposed_in_valid_P (block_slot : nat) (state : Congress.State) := let proposals := map snd (FMap.elements (proposals state)) in forallb (fun p => proposed_in p <=? block_slot) proposals. Definition state_proposals_proposed_in_valid (cs : ChainState) := let state_opt := get_contract_state Congress.State cs congress_caddr in whenFail (show cs.(env_chain)) match state_opt with | Some state => checker (state_proposals_proposed_in_valid_P cs.(current_slot) state) | None => checker true end. (* QuickChick (forAllBlocks state_proposals_proposed_in_valid). *) (* coqtop-stdout:+++ Passed 10000 tests (0 discards) *) Definition congress_has_votes_on_some_proposal (cs : ChainState) := let state_opt := get_contract_state Congress.State cs congress_caddr in match state_opt with | Some state => let proposals := map snd (FMap.elements (proposals state)) in existsb (fun proposal => 0 <? FMap.size proposal.(votes) ) proposals | None => false end. (* QuickChick (chain5 ~~> congress_has_votes_on_some_proposal). *) (* Success - found witness satisfying the predicate! +++ Failed (as expected) after 7 tests and 0 shrinks. (0 discards) *) (* This assumes that in a previous block, there was an active proposal *) Definition congress_finished_a_vote (cs : ChainState) := let acts := cs.(chain_state_queue) in let act_is_finish_vote (act : Action) := match act.(act_body) with | act_call _ _ msg => match deserialize Congress.Msg _ msg with | Some (Congress.finish_proposal _) => true | _ => false end | _ => false end in existsb act_is_finish_vote acts. (* QuickChick (chain5 ~~> congress_finished_a_vote). *) (* Success - found witness satisfying the predicate! +++ Failed (as expected) after 14 tests and 0 shrinks. (0 discards) *)
Cole , Tim . " Representing the Holocaust in America : Mixed Motives or Abuse ? " , The Public Historian , Vol . 24 , No. 4 . ( Fall , 2002 ) , pp. 127 – 31
# Built-in Combinations([1 .. n], m); Combinations([1 .. 5], 3); # [ [ 1, 2, 3 ], [ 1, 2, 4 ], [ 1, 2, 5 ], [ 1, 3, 4 ], [ 1, 3, 5 ], # [ 1, 4, 5 ], [ 2, 3, 4 ], [ 2, 3, 5 ], [ 2, 4, 5 ], [ 3, 4, 5 ] ]
[GOAL] m n : ℤ ⊢ ¬n % 2 = 1 ↔ n % 2 = 0 [PROOFSTEP] cases' emod_two_eq_zero_or_one n with h h [GOAL] case inl m n : ℤ h : n % 2 = 0 ⊢ ¬n % 2 = 1 ↔ n % 2 = 0 [PROOFSTEP] simp [h] [GOAL] case inr m n : ℤ h : n % 2 = 1 ⊢ ¬n % 2 = 1 ↔ n % 2 = 0 [PROOFSTEP] simp [h] [GOAL] m n : ℤ ⊢ ¬n % 2 = 0 ↔ n % 2 = 1 [PROOFSTEP] cases' emod_two_eq_zero_or_one n with h h [GOAL] case inl m n : ℤ h : n % 2 = 0 ⊢ ¬n % 2 = 0 ↔ n % 2 = 1 [PROOFSTEP] simp [h] [GOAL] case inr m n : ℤ h : n % 2 = 1 ⊢ ¬n % 2 = 0 ↔ n % 2 = 1 [PROOFSTEP] simp [h] [GOAL] m✝ n : ℤ x✝ : Even n m : ℤ hm : n = m + m ⊢ n % 2 = 0 [PROOFSTEP] simp [← two_mul, hm] [GOAL] m n : ℤ h : n % 2 = 0 ⊢ n % 2 + 2 * (n / 2) = n / 2 + n / 2 [PROOFSTEP] simp [← two_mul, h] [GOAL] m✝ n : ℤ x✝ : Odd n m : ℤ hm : n = 2 * m + 1 ⊢ n % 2 = 1 [PROOFSTEP] rw [hm, add_emod] [GOAL] m✝ n : ℤ x✝ : Odd n m : ℤ hm : n = 2 * m + 1 ⊢ (2 * m % 2 + 1 % 2) % 2 = 1 [PROOFSTEP] norm_num [GOAL] m n : ℤ h : n % 2 = 1 ⊢ n % 2 + 2 * (n / 2) = 2 * (n / 2) + 1 [PROOFSTEP] rw [h] [GOAL] m n : ℤ h : n % 2 = 1 ⊢ 1 + 2 * (n / 2) = 2 * (n / 2) + 1 [PROOFSTEP] abel [GOAL] m n : ℤ h : n % 2 = 1 ⊢ 1 + 2 * (n / 2) = 2 * (n / 2) + 1 [PROOFSTEP] abel [GOAL] m n : ℤ ⊢ ¬Even n ↔ n % 2 = 1 [PROOFSTEP] rw [even_iff, emod_two_ne_zero] [GOAL] m n : ℤ ⊢ ¬Odd n ↔ n % 2 = 0 [PROOFSTEP] rw [odd_iff, emod_two_ne_one] [GOAL] m n : ℤ ⊢ Even n ↔ ¬Odd n [PROOFSTEP] rw [not_odd_iff, even_iff] [GOAL] m n : ℤ ⊢ Odd n ↔ ¬Even n [PROOFSTEP] rw [not_even_iff, odd_iff] [GOAL] m n : ℤ ⊢ IsCompl {n | Even n} {n | Odd n} [PROOFSTEP] simp [← Set.compl_setOf, isCompl_compl] [GOAL] m n✝ n : ℤ ⊢ ∃ k, n = 2 * k ∨ n = 2 * k + 1 [PROOFSTEP] simpa only [two_mul, exists_or, Odd, Even] using even_or_odd n [GOAL] m n✝ n : ℤ ⊢ Xor' (Even n) (Odd n) [PROOFSTEP] cases even_or_odd n with | inl h => exact Or.inl ⟨h, even_iff_not_odd.mp h⟩ | inr h => exact Or.inr ⟨h, odd_iff_not_even.mp h⟩ [GOAL] m n✝ n : ℤ x✝ : Even n ∨ Odd n ⊢ Xor' (Even n) (Odd n) [PROOFSTEP] cases even_or_odd n with | inl h => exact Or.inl ⟨h, even_iff_not_odd.mp h⟩ | inr h => exact Or.inr ⟨h, odd_iff_not_even.mp h⟩ [GOAL] case inl m n✝ n : ℤ h : Even n ⊢ Xor' (Even n) (Odd n) [PROOFSTEP] | inl h => exact Or.inl ⟨h, even_iff_not_odd.mp h⟩ [GOAL] case inl m n✝ n : ℤ h : Even n ⊢ Xor' (Even n) (Odd n) [PROOFSTEP] exact Or.inl ⟨h, even_iff_not_odd.mp h⟩ [GOAL] case inr m n✝ n : ℤ h : Odd n ⊢ Xor' (Even n) (Odd n) [PROOFSTEP] | inr h => exact Or.inr ⟨h, odd_iff_not_even.mp h⟩ [GOAL] case inr m n✝ n : ℤ h : Odd n ⊢ Xor' (Even n) (Odd n) [PROOFSTEP] exact Or.inr ⟨h, odd_iff_not_even.mp h⟩ [GOAL] m n✝ n : ℤ ⊢ ∃ k, Xor' (n = 2 * k) (n = 2 * k + 1) [PROOFSTEP] rcases even_or_odd n with (⟨k, rfl⟩ | ⟨k, rfl⟩) [GOAL] case inl.intro m n k : ℤ ⊢ ∃ k_1, Xor' (k + k = 2 * k_1) (k + k = 2 * k_1 + 1) [PROOFSTEP] use k [GOAL] case inr.intro m n k : ℤ ⊢ ∃ k_1, Xor' (2 * k + 1 = 2 * k_1) (2 * k + 1 = 2 * k_1 + 1) [PROOFSTEP] use k [GOAL] case h m n k : ℤ ⊢ Xor' (k + k = 2 * k) (k + k = 2 * k + 1) [PROOFSTEP] simpa only [← two_mul, Xor', true_and_iff, eq_self_iff_true, not_true, or_false_iff, and_false_iff] using (succ_ne_self (2 * k)).symm [GOAL] case h m n k : ℤ ⊢ Xor' (2 * k + 1 = 2 * k) (2 * k + 1 = 2 * k + 1) [PROOFSTEP] simp only [Xor', add_right_eq_self, false_or_iff, eq_self_iff_true, not_true, not_false_iff, one_ne_zero, and_self_iff] [GOAL] m n : ℤ ⊢ ¬Even 1 [PROOFSTEP] rw [even_iff] [GOAL] m n : ℤ ⊢ ¬1 % 2 = 0 [PROOFSTEP] norm_num [GOAL] m n : ℤ ⊢ Even (m + n) ↔ (Even m ↔ Even n) [PROOFSTEP] cases' emod_two_eq_zero_or_one m with h₁ h₁ [GOAL] case inl m n : ℤ h₁ : m % 2 = 0 ⊢ Even (m + n) ↔ (Even m ↔ Even n) [PROOFSTEP] cases' emod_two_eq_zero_or_one n with h₂ h₂ [GOAL] case inr m n : ℤ h₁ : m % 2 = 1 ⊢ Even (m + n) ↔ (Even m ↔ Even n) [PROOFSTEP] cases' emod_two_eq_zero_or_one n with h₂ h₂ [GOAL] case inl.inl m n : ℤ h₁ : m % 2 = 0 h₂ : n % 2 = 0 ⊢ Even (m + n) ↔ (Even m ↔ Even n) [PROOFSTEP] simp [even_iff, h₁, h₂, Int.add_emod] [GOAL] case inl.inr m n : ℤ h₁ : m % 2 = 0 h₂ : n % 2 = 1 ⊢ Even (m + n) ↔ (Even m ↔ Even n) [PROOFSTEP] simp [even_iff, h₁, h₂, Int.add_emod] [GOAL] case inr.inl m n : ℤ h₁ : m % 2 = 1 h₂ : n % 2 = 0 ⊢ Even (m + n) ↔ (Even m ↔ Even n) [PROOFSTEP] simp [even_iff, h₁, h₂, Int.add_emod] [GOAL] case inr.inr m n : ℤ h₁ : m % 2 = 1 h₂ : n % 2 = 1 ⊢ Even (m + n) ↔ (Even m ↔ Even n) [PROOFSTEP] simp [even_iff, h₁, h₂, Int.add_emod] [GOAL] m n : ℤ ⊢ Even (m + n) ↔ (Odd m ↔ Odd n) [PROOFSTEP] rw [even_add, even_iff_not_odd, even_iff_not_odd, not_iff_not] [GOAL] m n✝ n : ℤ ⊢ ¬Even (bit1 n) [PROOFSTEP] simp [bit1, parity_simps] [GOAL] m n✝ n : ℤ ⊢ ¬2 ∣ 2 * n + 1 [PROOFSTEP] simp [add_emod] [GOAL] m n : ℤ ⊢ Even (m - n) ↔ (Even m ↔ Even n) [PROOFSTEP] simp [sub_eq_add_neg, parity_simps] [GOAL] m n : ℤ ⊢ Even (m - n) ↔ (Odd m ↔ Odd n) [PROOFSTEP] rw [even_sub, even_iff_not_odd, even_iff_not_odd, not_iff_not] [GOAL] m n : ℤ ⊢ Even (n + 1) ↔ ¬Even n [PROOFSTEP] simp [even_add] [GOAL] m n : ℤ ⊢ Even (m * n) ↔ Even m ∨ Even n [PROOFSTEP] cases' emod_two_eq_zero_or_one m with h₁ h₁ [GOAL] case inl m n : ℤ h₁ : m % 2 = 0 ⊢ Even (m * n) ↔ Even m ∨ Even n [PROOFSTEP] cases' emod_two_eq_zero_or_one n with h₂ h₂ [GOAL] case inr m n : ℤ h₁ : m % 2 = 1 ⊢ Even (m * n) ↔ Even m ∨ Even n [PROOFSTEP] cases' emod_two_eq_zero_or_one n with h₂ h₂ [GOAL] case inl.inl m n : ℤ h₁ : m % 2 = 0 h₂ : n % 2 = 0 ⊢ Even (m * n) ↔ Even m ∨ Even n [PROOFSTEP] simp [even_iff, h₁, h₂, Int.mul_emod] [GOAL] case inl.inr m n : ℤ h₁ : m % 2 = 0 h₂ : n % 2 = 1 ⊢ Even (m * n) ↔ Even m ∨ Even n [PROOFSTEP] simp [even_iff, h₁, h₂, Int.mul_emod] [GOAL] case inr.inl m n : ℤ h₁ : m % 2 = 1 h₂ : n % 2 = 0 ⊢ Even (m * n) ↔ Even m ∨ Even n [PROOFSTEP] simp [even_iff, h₁, h₂, Int.mul_emod] [GOAL] case inr.inr m n : ℤ h₁ : m % 2 = 1 h₂ : n % 2 = 1 ⊢ Even (m * n) ↔ Even m ∨ Even n [PROOFSTEP] simp [even_iff, h₁, h₂, Int.mul_emod] [GOAL] m n : ℤ ⊢ Odd (m * n) ↔ Odd m ∧ Odd n [PROOFSTEP] simp [not_or, parity_simps] [GOAL] m n✝ : ℤ n : ℕ ⊢ Even (m ^ n) ↔ Even m ∧ n ≠ 0 [PROOFSTEP] induction' n with n ih [GOAL] case zero m n : ℤ ⊢ Even (m ^ Nat.zero) ↔ Even m ∧ Nat.zero ≠ 0 [PROOFSTEP] simp [*, even_mul, pow_succ] [GOAL] case succ m n✝ : ℤ n : ℕ ih : Even (m ^ n) ↔ Even m ∧ n ≠ 0 ⊢ Even (m ^ Nat.succ n) ↔ Even m ∧ Nat.succ n ≠ 0 [PROOFSTEP] simp [*, even_mul, pow_succ] [GOAL] case succ m n✝ : ℤ n : ℕ ih : Even (m ^ n) ↔ Even m ∧ n ≠ 0 ⊢ Even m → ¬n = 0 → Even m [PROOFSTEP] tauto [GOAL] m n✝ : ℤ n : ℕ ⊢ Odd (m ^ n) ↔ Odd m ∨ n = 0 [PROOFSTEP] rw [← not_iff_not, ← Int.even_iff_not_odd, not_or, ← Int.even_iff_not_odd, Int.even_pow] [GOAL] m n : ℤ ⊢ Odd (m + n) ↔ (Odd m ↔ Even n) [PROOFSTEP] rw [odd_iff_not_even, even_add, not_iff, odd_iff_not_even] [GOAL] m n : ℤ ⊢ Odd (m + n) ↔ (Odd n ↔ Even m) [PROOFSTEP] rw [add_comm, odd_add] [GOAL] m n : ℤ h : Odd (m + n) hnot : m = n ⊢ False [PROOFSTEP] simp [hnot, parity_simps] at h [GOAL] m n : ℤ ⊢ Odd (m - n) ↔ (Odd m ↔ Even n) [PROOFSTEP] rw [odd_iff_not_even, even_sub, not_iff, odd_iff_not_even] [GOAL] m n : ℤ ⊢ Odd (m - n) ↔ (Odd n ↔ Even m) [PROOFSTEP] rw [odd_iff_not_even, even_sub, not_iff, not_iff_comm, odd_iff_not_even] [GOAL] m n✝ n : ℤ ⊢ Even (n * (n + 1)) [PROOFSTEP] simpa [even_mul, parity_simps] using n.even_or_odd [GOAL] m n✝ : ℤ n : ℕ ⊢ Even ↑n ↔ Even n [PROOFSTEP] rw_mod_cast [even_iff, Nat.even_iff] [GOAL] m n✝ : ℤ n : ℕ ⊢ Odd ↑n ↔ Odd n [PROOFSTEP] rw [odd_iff_not_even, Nat.odd_iff_not_even, even_coe_nat] [GOAL] m n : ℤ ⊢ Even (natAbs n) ↔ Even n [PROOFSTEP] simp [even_iff_two_dvd, dvd_natAbs, coe_nat_dvd_left.symm] [GOAL] m n : ℤ ⊢ Odd (natAbs n) ↔ Odd n [PROOFSTEP] rw [odd_iff_not_even, Nat.odd_iff_not_even, natAbs_even] [GOAL] m n a b : ℤ ha : Odd a hb : Odd b ⊢ 4 ∣ a + b ∨ 4 ∣ a - b [PROOFSTEP] obtain ⟨m, rfl⟩ := ha [GOAL] case intro m✝ n b : ℤ hb : Odd b m : ℤ ⊢ 4 ∣ 2 * m + 1 + b ∨ 4 ∣ 2 * m + 1 - b [PROOFSTEP] obtain ⟨n, rfl⟩ := hb [GOAL] case intro.intro m✝ n✝ m n : ℤ ⊢ 4 ∣ 2 * m + 1 + (2 * n + 1) ∨ 4 ∣ 2 * m + 1 - (2 * n + 1) [PROOFSTEP] obtain h | h := Int.even_or_odd (m + n) [GOAL] case intro.intro.inl m✝ n✝ m n : ℤ h : Even (m + n) ⊢ 4 ∣ 2 * m + 1 + (2 * n + 1) ∨ 4 ∣ 2 * m + 1 - (2 * n + 1) [PROOFSTEP] right [GOAL] case intro.intro.inl.h m✝ n✝ m n : ℤ h : Even (m + n) ⊢ 4 ∣ 2 * m + 1 - (2 * n + 1) [PROOFSTEP] rw [Int.even_add, ← Int.even_sub] at h [GOAL] case intro.intro.inl.h m✝ n✝ m n : ℤ h : Even (m - n) ⊢ 4 ∣ 2 * m + 1 - (2 * n + 1) [PROOFSTEP] obtain ⟨k, hk⟩ := h [GOAL] case intro.intro.inl.h.intro m✝ n✝ m n k : ℤ hk : m - n = k + k ⊢ 4 ∣ 2 * m + 1 - (2 * n + 1) [PROOFSTEP] convert dvd_mul_right 4 k using 1 [GOAL] case h.e'_4 m✝ n✝ m n k : ℤ hk : m - n = k + k ⊢ 2 * m + 1 - (2 * n + 1) = 4 * k [PROOFSTEP] rw [eq_add_of_sub_eq hk, mul_add, add_assoc, add_sub_cancel, ← two_mul, ← mul_assoc] [GOAL] case h.e'_4 m✝ n✝ m n k : ℤ hk : m - n = k + k ⊢ 2 * 2 * k = 4 * k [PROOFSTEP] rfl [GOAL] case intro.intro.inr m✝ n✝ m n : ℤ h : Odd (m + n) ⊢ 4 ∣ 2 * m + 1 + (2 * n + 1) ∨ 4 ∣ 2 * m + 1 - (2 * n + 1) [PROOFSTEP] left [GOAL] case intro.intro.inr.h m✝ n✝ m n : ℤ h : Odd (m + n) ⊢ 4 ∣ 2 * m + 1 + (2 * n + 1) [PROOFSTEP] obtain ⟨k, hk⟩ := h [GOAL] case intro.intro.inr.h.intro m✝ n✝ m n k : ℤ hk : m + n = 2 * k + 1 ⊢ 4 ∣ 2 * m + 1 + (2 * n + 1) [PROOFSTEP] convert dvd_mul_right 4 (k + 1) using 1 [GOAL] case h.e'_4 m✝ n✝ m n k : ℤ hk : m + n = 2 * k + 1 ⊢ 2 * m + 1 + (2 * n + 1) = 4 * (k + 1) [PROOFSTEP] rw [eq_sub_of_add_eq hk, add_right_comm, ← add_sub, mul_add, mul_sub, add_assoc, add_assoc, sub_add, add_assoc, ← sub_sub (2 * n), sub_self, zero_sub, sub_neg_eq_add, ← mul_assoc, mul_add] [GOAL] case h.e'_4 m✝ n✝ m n k : ℤ hk : m + n = 2 * k + 1 ⊢ 2 * 2 * k + (2 * 1 + (1 + 1)) = 4 * k + 4 * 1 [PROOFSTEP] rfl [GOAL] m n : ℤ ⊢ Odd n → 2 * (n / 2) + 1 = n [PROOFSTEP] rintro ⟨c, rfl⟩ [GOAL] case intro m c : ℤ ⊢ 2 * ((2 * c + 1) / 2) + 1 = 2 * c + 1 [PROOFSTEP] rw [mul_comm] [GOAL] case intro m c : ℤ ⊢ (2 * c + 1) / 2 * 2 + 1 = 2 * c + 1 [PROOFSTEP] convert Int.ediv_add_emod' (2 * c + 1) 2 [GOAL] case h.e'_2.h.e'_6 m c : ℤ ⊢ 1 = (2 * c + 1) % 2 [PROOFSTEP] simp [Int.add_emod] [GOAL] m n : ℤ ⊢ Odd n → n / 2 * 2 + 1 = n [PROOFSTEP] rintro ⟨c, rfl⟩ [GOAL] case intro m c : ℤ ⊢ (2 * c + 1) / 2 * 2 + 1 = 2 * c + 1 [PROOFSTEP] convert Int.ediv_add_emod' (2 * c + 1) 2 [GOAL] case h.e'_2.h.e'_6 m c : ℤ ⊢ 1 = (2 * c + 1) % 2 [PROOFSTEP] simp [Int.add_emod] [GOAL] m n : ℤ ⊢ Odd n → 1 + n / 2 * 2 = n [PROOFSTEP] rintro ⟨c, rfl⟩ [GOAL] case intro m c : ℤ ⊢ 1 + (2 * c + 1) / 2 * 2 = 2 * c + 1 [PROOFSTEP] rw [add_comm] [GOAL] case intro m c : ℤ ⊢ (2 * c + 1) / 2 * 2 + 1 = 2 * c + 1 [PROOFSTEP] convert Int.ediv_add_emod' (2 * c + 1) 2 [GOAL] case h.e'_2.h.e'_6 m c : ℤ ⊢ 1 = (2 * c + 1) % 2 [PROOFSTEP] simp [Int.add_emod] [GOAL] m✝ n✝ m n : ℤ h : Even m ⊢ ¬Even (n + 3) ↔ Even (m ^ 2 + m + n) [PROOFSTEP] simp [*, (by decide : ¬2 = 0), parity_simps] [GOAL] m✝ n✝ m n : ℤ h : Even m ⊢ ¬2 = 0 [PROOFSTEP] decide [GOAL] m n : ℤ ⊢ ¬Even 25394535 [PROOFSTEP] simp
import geometry.manifold.instances.sphere import to_mathlib.linear_algebra.finite_dimensional import to_mathlib.analysis.inner_product_space.rotation import global.gromov import global.twist_one_jet_sec -- import interactive_expr -- set_option trace.filter_inst_type true noncomputable theory open metric finite_dimensional set function linear_map filter open_locale manifold topology section general variables {E : Type*} [normed_add_comm_group E] [normed_space ℝ E] {H : Type*} [topological_space H] (I : model_with_corners ℝ E H) {M : Type*} [topological_space M] [charted_space H M] [smooth_manifold_with_corners I M] {E' : Type*} [normed_add_comm_group E'] [normed_space ℝ E'] {H' : Type*} [topological_space H'] (I' : model_with_corners ℝ E' H') {M' : Type*} [topological_space M'] [charted_space H' M'] [smooth_manifold_with_corners I' M'] {F : Type*} [normed_add_comm_group F] [normed_space ℝ F] {G : Type*} [topological_space G] (J : model_with_corners ℝ F G) (N : Type*) [topological_space N] [charted_space G N] [smooth_manifold_with_corners J N] local notation `TM` := tangent_space I local notation `TM'` := tangent_space I' local notation `HJ` := model_prod (model_prod H H') (E →L[ℝ] E') local notation `ψJ` := chart_at HJ /-- A map between manifolds is an immersion if it is differentiable and its differential at any point is injective. Note the formalized definition doesn't require differentiability. If `f` is not differentiable at `m` then, by definition, `mfderiv I I' f m` is zero, which is not injective unless the source dimension is zero, which implies differentiability. -/ def immersion (f : M → M') : Prop := ∀ m, injective (mfderiv I I' f m) variables (M M') /-- The relation of immersions for maps between two manifolds. -/ def immersion_rel : rel_mfld I M I' M' := {σ | injective σ.2} variables {M M'} @[simp] lemma mem_immersion_rel_iff {σ : one_jet_bundle I M I' M'} : σ ∈ immersion_rel I M I' M' ↔ injective (σ.2 : tangent_space I _ →L[ℝ] tangent_space I' _) := iff.rfl /-- A characterisation of the immersion relation in terms of a local chart. -/ lemma mem_immersion_rel_iff' {σ σ' : one_jet_bundle I M I' M'} (hσ' : σ' ∈ (ψJ σ).source) : σ' ∈ immersion_rel I M I' M' ↔ injective (ψJ σ σ').2 := begin simp only [fiber_bundle.charted_space_chart_at] with mfld_simps at hσ', simp_rw [mem_immersion_rel_iff], rw [one_jet_bundle_chart_at_apply', in_coordinates'_eq], simp_rw [continuous_linear_map.coe_comp', continuous_linear_equiv.coe_coe, equiv_like.comp_injective, equiv_like.injective_comp], exacts [hσ'.1.1, hσ'.1.2], end lemma chart_at_image_immersion_rel_eq {σ : one_jet_bundle I M I' M'} : (ψJ σ) '' ((ψJ σ).source ∩ immersion_rel I M I' M') = (ψJ σ).target ∩ {q : HJ | injective q.2} := local_equiv.is_image.image_eq $ λ σ' hσ', (mem_immersion_rel_iff' I I' hσ').symm variables [finite_dimensional ℝ E] [finite_dimensional ℝ E'] lemma immersion_rel_open : is_open (immersion_rel I M I' M') := begin simp_rw [charted_space.is_open_iff HJ (immersion_rel I M I' M'), chart_at_image_immersion_rel_eq], refine λ σ, (ψJ σ).open_target.inter _, convert is_open_univ.prod continuous_linear_map.is_open_injective, { ext, simp, }, { apply_instance, }, { apply_instance, }, end @[simp] lemma immersion_rel_slice_eq {m : M} {m' : M'} {p : dual_pair $ tangent_space I m} {φ : tangent_space I m →L[ℝ] tangent_space I' m'} (hφ : injective φ) : (immersion_rel I M I' M').slice ⟨(m, m'), φ⟩ p = ((ker p.π).map φ)ᶜ := set.ext_iff.mpr $ λ w, p.injective_update_iff hφ lemma immersion_rel_ample (h : finrank ℝ E < finrank ℝ E') : (immersion_rel I M I' M').ample := begin rw [rel_mfld.ample_iff], rintros ⟨⟨m, m'⟩, φ : tangent_space I m →L[ℝ] tangent_space I' m'⟩ (p : dual_pair (tangent_space I m)) (hφ : injective φ), haveI : finite_dimensional ℝ (tangent_space I m) := (by apply_instance : finite_dimensional ℝ E), have hcodim := two_le_rank_of_rank_lt_rank p.ker_pi_ne_top h φ.to_linear_map, rw [immersion_rel_slice_eq I I' hφ], exact ample_of_two_le_codim hcodim, end /-- This is lemma `lem:open_ample_immersion` from the blueprint. -/ lemma immersion_rel_open_ample (h : finrank ℝ E < finrank ℝ E') : is_open (immersion_rel I M I' M') ∧ (immersion_rel I M I' M').ample := ⟨immersion_rel_open I I', immersion_rel_ample I I' h⟩ end general section generalbis variables {E : Type*} [normed_add_comm_group E] [normed_space ℝ E] [finite_dimensional ℝ E] {H : Type*} [topological_space H] (I : model_with_corners ℝ E H) [model_with_corners.boundaryless I] {M : Type*} [topological_space M] [charted_space H M] [smooth_manifold_with_corners I M] {E' : Type*} [normed_add_comm_group E'] [normed_space ℝ E'] [finite_dimensional ℝ E'] {H' : Type*} [topological_space H'] (I' : model_with_corners ℝ E' H') [model_with_corners.boundaryless I'] {M' : Type*} [metric_space M'] [charted_space H' M'] [smooth_manifold_with_corners I' M'] variables [finite_dimensional ℝ E] [finite_dimensional ℝ E'] variables {EP : Type*} [normed_add_comm_group EP] [normed_space ℝ EP] [finite_dimensional ℝ EP] {HP : Type*} [topological_space HP] {IP : model_with_corners ℝ EP HP} [model_with_corners.boundaryless IP] {P : Type*} [topological_space P] [charted_space HP P] [smooth_manifold_with_corners IP P] {C : set (P × M)} {ε : M → ℝ} include I I' M' IP variables (I M I' M' IP P) /-- parametric h-principle for immersions. -/ theorem immersion_rel_satisfies_h_principle_with [nonempty P] [t2_space P] [sigma_compact_space P] [locally_compact_space P] [nonempty M] [t2_space M] [sigma_compact_space M] [locally_compact_space M] [nonempty M'] [t2_space M'] [locally_compact_space M'] [sigma_compact_space M'] (h : finrank ℝ E < finrank ℝ E') (hC : is_closed C) (hε_pos : ∀ x, 0 < ε x) (hε_cont : continuous ε) : (immersion_rel I M I' M').satisfies_h_principle_with IP C ε := by exact (immersion_rel_ample I I' h).satisfies_h_principle_with (immersion_rel_open I I') hC hε_pos hε_cont end generalbis section sphere_eversion variables (E : Type*) [normed_add_comm_group E] [inner_product_space ℝ E] [fact (finrank ℝ E = 3)] local attribute [instance] fact_finite_dimensional_of_finrank_eq_succ local notation `𝕊²` := sphere (0 : E) 1 /- Maybe the next two lemmas won't be used directly, but they should be done first as sanity checks. -/ lemma immersion_inclusion_sphere : immersion (𝓡 2) 𝓘(ℝ, E) (λ x : 𝕊², (x : E)) := mfderiv_coe_sphere_injective lemma immersion_antipodal_sphere : immersion (𝓡 2) 𝓘(ℝ, E) (λ x : 𝕊², -(x : E)) := begin intros x, change injective (mfderiv (𝓡 2) 𝓘(ℝ, E) (-(λ x : 𝕊², (x:E))) x), rw mfderiv_neg, exact neg_injective.comp (mfderiv_coe_sphere_injective x), end /- The relation of immersion of a two-sphere into its ambient Euclidean space. -/ local notation `𝓡_imm` := immersion_rel (𝓡 2) 𝕊² 𝓘(ℝ, E) E variables (ω : orientation ℝ E (fin 3)) lemma smooth_bs : smooth (𝓘(ℝ, ℝ).prod (𝓡 2)) 𝓘(ℝ, E) (λ p : ℝ × 𝕊², ((1-p.1) • p.2 + p.1 • (-p.2) : E)) := begin refine (cont_mdiff.smul _ _).add (cont_mdiff_fst.smul _), { exact (cont_diff_const.sub cont_diff_id).cont_mdiff.comp cont_mdiff_fst }, { exact cont_mdiff_coe_sphere.comp cont_mdiff_snd }, { exact (cont_diff_neg.cont_mdiff.comp cont_mdiff_coe_sphere).comp cont_mdiff_snd }, end def formal_eversion_aux : family_one_jet_sec (𝓡 2) 𝕊² 𝓘(ℝ, E) E 𝓘(ℝ, ℝ) ℝ := family_join (smooth_bs E) $ family_twist (drop (one_jet_ext_sec ⟨(coe : 𝕊² → E), cont_mdiff_coe_sphere⟩)) (λ p : ℝ × 𝕊², ω.rot (p.1, p.2)) begin intros p, have : smooth_at (𝓘(ℝ, ℝ × E)) 𝓘(ℝ, E →L[ℝ] E) ω.rot (p.1, p.2), { refine (ω.cont_diff_rot _).cont_mdiff_at, exact ne_zero_of_mem_unit_sphere p.2 }, refine this.comp p (smooth.smooth_at _), exact smooth_fst.prod_mk (cont_mdiff_coe_sphere.comp smooth_snd), end /-- A formal eversion of a two-sphere into its ambient Euclidean space. -/ def formal_eversion_aux2 : htpy_formal_sol 𝓡_imm := { is_sol' := λ t x, (ω.isometry_rot t x).injective.comp (mfderiv_coe_sphere_injective x), .. formal_eversion_aux E ω } def formal_eversion : htpy_formal_sol 𝓡_imm := (formal_eversion_aux2 E ω).reindex ⟨smooth_step, cont_mdiff_iff_cont_diff.mpr smooth_step.smooth⟩ @[simp] lemma formal_eversion_bs (t : ℝ) : (formal_eversion E ω t).bs = λ x : 𝕊², (1 - smooth_step t : ℝ) • (x : E) + (smooth_step t : ℝ) • (-x : E) := rfl lemma formal_eversion_zero (x : 𝕊²) : (formal_eversion E ω 0).bs x = x := by simp lemma formal_eversion_one (x : 𝕊²) : (formal_eversion E ω 1).bs x = -x := by simp lemma formal_eversion_hol_at_zero {t : ℝ} (ht : t < 1/4) : (formal_eversion E ω t).to_one_jet_sec.is_holonomic := begin intros x, change mfderiv (𝓡 2) 𝓘(ℝ, E) (λ y : 𝕊², ((1 : ℝ) - smooth_step t) • (y:E) + smooth_step t • -y) x = (ω.rot (smooth_step t, x)).comp (mfderiv (𝓡 2) 𝓘(ℝ, E) (λ y : 𝕊², (y:E)) x), simp_rw [smooth_step.of_lt ht, ω.rot_zero, continuous_linear_map.id_comp], congr, ext y, simp [smooth_step.of_lt ht], end lemma formal_eversion_hol_at_one {t : ℝ} (ht : 3/4 < t) : (formal_eversion E ω t).to_one_jet_sec.is_holonomic := begin intros x, change mfderiv (𝓡 2) 𝓘(ℝ, E) (λ y : 𝕊², ((1:ℝ) - smooth_step t) • (y:E) + smooth_step t • -y) x = (ω.rot (smooth_step t, x)).comp (mfderiv (𝓡 2) 𝓘(ℝ, E) (λ y : 𝕊², (y:E)) x), transitivity mfderiv (𝓡 2) 𝓘(ℝ, E) (-(λ y : 𝕊², (y:E))) x, { congr' 2, ext y, simp [smooth_step.of_gt ht], }, ext v, simp_rw [mfderiv_neg, continuous_linear_map.coe_comp', comp_app, continuous_linear_map.neg_apply, smooth_step.of_gt ht], rw [ω.rot_one], rw [← range_mfderiv_coe_sphere x], exact linear_map.mem_range_self _ _, end lemma formal_eversion_hol_near_zero_one : ∀ᶠ (s : ℝ × 𝕊²) near {0, 1} ×ˢ univ, (formal_eversion E ω s.1).to_one_jet_sec.is_holonomic_at s.2 := begin have : (Iio (1/4 : ℝ) ∪ Ioi (3/4)) ×ˢ (univ : set 𝕊²) ∈ 𝓝ˢ (({0, 1} : set ℝ) ×ˢ univ), { refine ((is_open_Iio.union is_open_Ioi).prod is_open_univ).mem_nhds_set.mpr _, rintro ⟨s, x⟩ ⟨hs, hx⟩, refine ⟨_, mem_univ _⟩, simp_rw [mem_insert_iff, mem_singleton_iff] at hs, rcases hs with rfl|rfl, { exact or.inl (show (0 : ℝ) < 1 / 4, by norm_num) }, { exact or.inr (show (3 / 4 : ℝ) < 1, by norm_num) } }, refine eventually_of_mem this _, rintro ⟨t, x⟩ ⟨ht|ht, hx⟩, { exact formal_eversion_hol_at_zero E ω ht x }, { exact formal_eversion_hol_at_one E ω ht x } end theorem sphere_eversion : ∃ f : ℝ → 𝕊² → E, (cont_mdiff (𝓘(ℝ, ℝ).prod (𝓡 2)) 𝓘(ℝ, E) ∞ (uncurry f)) ∧ (f 0 = λ x, x) ∧ (f 1 = λ x, -x) ∧ ∀ t, immersion (𝓡 2) 𝓘(ℝ, E) (f t) := begin classical, let ω : orientation ℝ E (fin 3) := ((std_orthonormal_basis _ _).reindex $ fin_congr (fact.out _ : finrank ℝ E = 3)).to_basis.orientation, have rankE := fact.out (finrank ℝ E = 3), haveI : finite_dimensional ℝ E := finite_dimensional_of_finrank_eq_succ rankE, have ineq_rank : finrank ℝ (euclidean_space ℝ (fin 2)) < finrank ℝ E := by simp [rankE], let ε : 𝕊² → ℝ := λ x, 1, have hε_pos : ∀ x, 0 < ε x, from λ x, zero_lt_one, have hε_cont : continuous ε := continuous_const, haveI : nontrivial E := nontrivial_of_finrank_eq_succ (fact.out _ : finrank ℝ E = 3), haveI : nonempty ↥(sphere 0 1 : set E) := (normed_space.sphere_nonempty.mpr zero_le_one).to_subtype, rcases (immersion_rel_satisfies_h_principle_with (𝓡 2) 𝕊² 𝓘(ℝ, E) E 𝓘(ℝ, ℝ) ℝ ineq_rank ((finite.is_closed (by simp : ({0, 1} : set ℝ).finite)).prod is_closed_univ) hε_pos hε_cont).bs (formal_eversion E ω) (formal_eversion_hol_near_zero_one E ω) with ⟨f, h₁, h₂, -, h₅⟩, have := h₂.nhds_set_forall_mem, refine ⟨f, h₁, _, _, h₅⟩, { ext x, rw [this (0, x) (by simp)], convert formal_eversion_zero E ω x }, { ext x, rw [this (1, x) (by simp)], convert formal_eversion_one E ω x }, end -- The next instance will be used in the main file instance (n : ℕ) : fact (finrank ℝ (euclidean_space ℝ $ fin n) = n) := ⟨finrank_euclidean_space_fin⟩ -- The next notation will be used in the main file notation `ℝ^`n:max := euclidean_space ℝ (fin n) end sphere_eversion
[GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M ⊢ #((n : ℕ) × Functions (Language.sum L (skolem₁ L)) n) = #((n : ℕ) × BoundedFormula L Empty (n + 1)) [PROOFSTEP] simp only [card_functions_sum, skolem₁_Functions, mk_sigma, sum_add_distrib'] [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M ⊢ ((sum fun i => lift #(Functions L i)) + sum fun i => lift #(BoundedFormula L Empty (i + 1))) = sum fun i => #(BoundedFormula L Empty (i + 1)) [PROOFSTEP] conv_lhs => enter [2, 1, i]; rw [lift_id'.{u, v}] [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M | (sum fun i => lift #(Functions L i)) + sum fun i => lift #(BoundedFormula L Empty (i + 1)) [PROOFSTEP] enter [2, 1, i]; rw [lift_id'.{u, v}] [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M | (sum fun i => lift #(Functions L i)) + sum fun i => lift #(BoundedFormula L Empty (i + 1)) [PROOFSTEP] enter [2, 1, i]; rw [lift_id'.{u, v}] [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M | (sum fun i => lift #(Functions L i)) + sum fun i => lift #(BoundedFormula L Empty (i + 1)) [PROOFSTEP] enter [2, 1, i] [GOAL] case h L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M i : ℕ | lift #(BoundedFormula L Empty (i + 1)) [PROOFSTEP] rw [lift_id'.{u, v}] [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M ⊢ ((sum fun i => lift #(Functions L i)) + sum fun i => #(BoundedFormula L Empty (i + 1))) = sum fun i => #(BoundedFormula L Empty (i + 1)) [PROOFSTEP] rw [add_comm, add_eq_max, max_eq_left] [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M ⊢ (sum fun i => lift #(Functions L i)) ≤ sum fun i => #(BoundedFormula L Empty (i + 1)) [PROOFSTEP] refine' sum_le_sum _ _ fun n => _ [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M n : ℕ ⊢ lift #(Functions L n) ≤ #(BoundedFormula L Empty (n + 1)) [PROOFSTEP] rw [← lift_le.{_, max u v}, lift_lift, lift_mk_le.{v}] [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M n : ℕ ⊢ Nonempty (Functions L n ↪ BoundedFormula L Empty (n + 1)) [PROOFSTEP] refine' ⟨⟨fun f => (func f default).bdEqual (func f default), fun f g h => _⟩⟩ [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M n : ℕ f g : Functions L n h : (fun f => func f default =' func f default) f = (fun f => func f default =' func f default) g ⊢ f = g [PROOFSTEP] rcases h with ⟨rfl, ⟨rfl⟩⟩ [GOAL] case refl L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M n : ℕ f : Functions L n ⊢ f = f [PROOFSTEP] rfl [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M ⊢ ℵ₀ ≤ sum fun i => #(BoundedFormula L Empty (i + 1)) [PROOFSTEP] rw [← mk_sigma] [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M ⊢ ℵ₀ ≤ #((i : ℕ) × BoundedFormula L Empty (i + 1)) [PROOFSTEP] exact infinite_iff.1 (Infinite.of_injective (fun n => ⟨n, ⊥⟩) fun x y xy => (Sigma.mk.inj_iff.1 xy).1) [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M ⊢ #((n : ℕ) × Functions (Language.sum L (skolem₁ L)) n) ≤ max ℵ₀ (card L) [PROOFSTEP] rw [card_functions_sum_skolem₁] [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M ⊢ #((n : ℕ) × BoundedFormula L Empty (n + 1)) ≤ max ℵ₀ (card L) [PROOFSTEP] trans #(Σ n, L.BoundedFormula Empty n) [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M ⊢ #((n : ℕ) × BoundedFormula L Empty (n + 1)) ≤ #((n : ℕ) × BoundedFormula L Empty n) [PROOFSTEP] exact ⟨⟨Sigma.map Nat.succ fun _ => id, Nat.succ_injective.sigma_map fun _ => Function.injective_id⟩⟩ [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M ⊢ #((n : ℕ) × BoundedFormula L Empty n) ≤ max ℵ₀ (card L) [PROOFSTEP] refine' _root_.trans BoundedFormula.card_le (lift_le.{max u v}.1 _) [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M ⊢ lift (max ℵ₀ (lift #Empty + lift (card L))) ≤ lift (max ℵ₀ (card L)) [PROOFSTEP] simp only [mk_empty, lift_zero, lift_uzero, zero_add] [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M ⊢ lift (max ℵ₀ (card L)) ≤ lift (max ℵ₀ (card L)) [PROOFSTEP] rfl [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M S : Substructure (Language.sum L (skolem₁ L)) M ⊢ IsElementary (↑(LHom.substructureReduct LHom.sumInl) S) [PROOFSTEP] apply (LHom.sumInl.substructureReduct S).isElementary_of_exists [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M S : Substructure (Language.sum L (skolem₁ L)) M ⊢ ∀ (n : ℕ) (φ : BoundedFormula L Empty (n + 1)) (x : Fin n → { x // x ∈ ↑(LHom.substructureReduct LHom.sumInl) S }) (a : M), BoundedFormula.Realize φ default (Fin.snoc (Subtype.val ∘ x) a) → ∃ b, BoundedFormula.Realize φ default (Fin.snoc (Subtype.val ∘ x) ↑b) [PROOFSTEP] intro n φ x a h [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M S : Substructure (Language.sum L (skolem₁ L)) M n : ℕ φ : BoundedFormula L Empty (n + 1) x : Fin n → { x // x ∈ ↑(LHom.substructureReduct LHom.sumInl) S } a : M h : BoundedFormula.Realize φ default (Fin.snoc (Subtype.val ∘ x) a) ⊢ ∃ b, BoundedFormula.Realize φ default (Fin.snoc (Subtype.val ∘ x) ↑b) [PROOFSTEP] let φ' : (L.sum L.skolem₁).Functions n := LHom.sumInr.onFunction φ [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M S : Substructure (Language.sum L (skolem₁ L)) M n : ℕ φ : BoundedFormula L Empty (n + 1) x : Fin n → { x // x ∈ ↑(LHom.substructureReduct LHom.sumInl) S } a : M h : BoundedFormula.Realize φ default (Fin.snoc (Subtype.val ∘ x) a) φ' : Functions (Language.sum L (skolem₁ L)) n := LHom.onFunction LHom.sumInr φ ⊢ ∃ b, BoundedFormula.Realize φ default (Fin.snoc (Subtype.val ∘ x) ↑b) [PROOFSTEP] exact ⟨⟨funMap φ' ((↑) ∘ x), S.fun_mem (LHom.sumInr.onFunction φ) ((↑) ∘ x) (by exact fun i => (x i).2)⟩, by exact Classical.epsilon_spec (p := fun a => BoundedFormula.Realize φ default (Fin.snoc (Subtype.val ∘ x) a)) ⟨a, h⟩⟩ [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M S : Substructure (Language.sum L (skolem₁ L)) M n : ℕ φ : BoundedFormula L Empty (n + 1) x : Fin n → { x // x ∈ ↑(LHom.substructureReduct LHom.sumInl) S } a : M h : BoundedFormula.Realize φ default (Fin.snoc (Subtype.val ∘ x) a) φ' : Functions (Language.sum L (skolem₁ L)) n := LHom.onFunction LHom.sumInr φ ⊢ ∀ (i : Fin n), (Subtype.val ∘ x) i ∈ ↑S [PROOFSTEP] exact fun i => (x i).2 [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M S : Substructure (Language.sum L (skolem₁ L)) M n : ℕ φ : BoundedFormula L Empty (n + 1) x : Fin n → { x // x ∈ ↑(LHom.substructureReduct LHom.sumInl) S } a : M h : BoundedFormula.Realize φ default (Fin.snoc (Subtype.val ∘ x) a) φ' : Functions (Language.sum L (skolem₁ L)) n := LHom.onFunction LHom.sumInr φ ⊢ BoundedFormula.Realize φ default (Fin.snoc (Subtype.val ∘ x) ↑{ val := funMap φ' (Subtype.val ∘ x), property := (_ : funMap (LHom.onFunction LHom.sumInr φ) (Subtype.val ∘ x) ∈ ↑S) }) [PROOFSTEP] exact Classical.epsilon_spec (p := fun a => BoundedFormula.Realize φ default (Fin.snoc (Subtype.val ∘ x) a)) ⟨a, h⟩ [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M ⊢ Small.{?u.38330, w} { x // x ∈ elementarySkolem₁Reduct ⊥ } [PROOFSTEP] rw [coeSort_elementarySkolem₁Reduct] [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M ⊢ Small.{?u.38330, w} { x // x ∈ ⊥ } [PROOFSTEP] infer_instance [GOAL] L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M s : Set M κ : Cardinal.{w'} h1 : ℵ₀ ≤ κ h2 : lift #↑s ≤ lift κ h3 : lift (card L) ≤ lift κ h4 : lift κ ≤ lift #M ⊢ ∃ S, s ⊆ ↑S ∧ lift #{ x // x ∈ S } = lift κ [PROOFSTEP] obtain ⟨s', hs'⟩ := Cardinal.le_mk_iff_exists_set.1 h4 [GOAL] case intro L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M s : Set M κ : Cardinal.{w'} h1 : ℵ₀ ≤ κ h2 : lift #↑s ≤ lift κ h3 : lift (card L) ≤ lift κ h4 : lift κ ≤ lift #M s' : Set (ULift M) hs' : #↑s' = lift κ ⊢ ∃ S, s ⊆ ↑S ∧ lift #{ x // x ∈ S } = lift κ [PROOFSTEP] rw [← aleph0_le_lift.{_, w}] at h1 [GOAL] case intro L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M s : Set M κ : Cardinal.{w'} h1 : ℵ₀ ≤ lift κ h2 : lift #↑s ≤ lift κ h3 : lift (card L) ≤ lift κ h4 : lift κ ≤ lift #M s' : Set (ULift M) hs' : #↑s' = lift κ ⊢ ∃ S, s ⊆ ↑S ∧ lift #{ x // x ∈ S } = lift κ [PROOFSTEP] rw [← hs'] at h1 h2 ⊢ [GOAL] case intro L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M s : Set M κ : Cardinal.{w'} h3 : lift (card L) ≤ lift κ h4 : lift κ ≤ lift #M s' : Set (ULift M) h2 : lift #↑s ≤ #↑s' h1 : ℵ₀ ≤ #↑s' hs' : #↑s' = lift κ ⊢ ∃ S, s ⊆ ↑S ∧ lift #{ x // x ∈ S } = #↑s' [PROOFSTEP] refine' ⟨elementarySkolem₁Reduct (closure (L.sum L.skolem₁) (s ∪ Equiv.ulift '' s')), (s.subset_union_left _).trans subset_closure, _⟩ [GOAL] case intro L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M s : Set M κ : Cardinal.{w'} h3 : lift (card L) ≤ lift κ h4 : lift κ ≤ lift #M s' : Set (ULift M) h2 : lift #↑s ≤ #↑s' h1 : ℵ₀ ≤ #↑s' hs' : #↑s' = lift κ ⊢ lift #{ x // x ∈ elementarySkolem₁Reduct (LowerAdjoint.toFun (closure (Language.sum L (skolem₁ L))) (s ∪ ↑Equiv.ulift '' s')) } = #↑s' [PROOFSTEP] have h := mk_image_eq_lift _ s' Equiv.ulift.injective [GOAL] case intro L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M s : Set M κ : Cardinal.{w'} h3 : lift (card L) ≤ lift κ h4 : lift κ ≤ lift #M s' : Set (ULift M) h2 : lift #↑s ≤ #↑s' h1 : ℵ₀ ≤ #↑s' hs' : #↑s' = lift κ h : lift #↑(↑Equiv.ulift '' s') = lift #↑s' ⊢ lift #{ x // x ∈ elementarySkolem₁Reduct (LowerAdjoint.toFun (closure (Language.sum L (skolem₁ L))) (s ∪ ↑Equiv.ulift '' s')) } = #↑s' [PROOFSTEP] rw [lift_umax.{w, w'}, lift_id'.{w, w'}] at h [GOAL] case intro L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M s : Set M κ : Cardinal.{w'} h3 : lift (card L) ≤ lift κ h4 : lift κ ≤ lift #M s' : Set (ULift M) h2 : lift #↑s ≤ #↑s' h1 : ℵ₀ ≤ #↑s' hs' : #↑s' = lift κ h : lift #↑(↑Equiv.ulift '' s') = #↑s' ⊢ lift #{ x // x ∈ elementarySkolem₁Reduct (LowerAdjoint.toFun (closure (Language.sum L (skolem₁ L))) (s ∪ ↑Equiv.ulift '' s')) } = #↑s' [PROOFSTEP] rw [coeSort_elementarySkolem₁Reduct, ← h, lift_inj] [GOAL] case intro L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M s : Set M κ : Cardinal.{w'} h3 : lift (card L) ≤ lift κ h4 : lift κ ≤ lift #M s' : Set (ULift M) h2 : lift #↑s ≤ #↑s' h1 : ℵ₀ ≤ #↑s' hs' : #↑s' = lift κ h : lift #↑(↑Equiv.ulift '' s') = #↑s' ⊢ #{ x // x ∈ LowerAdjoint.toFun (closure (Language.sum L (skolem₁ L))) (s ∪ ↑Equiv.ulift '' s') } = #↑(↑Equiv.ulift '' s') [PROOFSTEP] refine' le_antisymm (lift_le.1 (lift_card_closure_le.trans _)) (mk_le_mk_of_subset ((Set.subset_union_right _ _).trans subset_closure)) [GOAL] case intro L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M s : Set M κ : Cardinal.{w'} h3 : lift (card L) ≤ lift κ h4 : lift κ ≤ lift #M s' : Set (ULift M) h2 : lift #↑s ≤ #↑s' h1 : ℵ₀ ≤ #↑s' hs' : #↑s' = lift κ h : lift #↑(↑Equiv.ulift '' s') = #↑s' ⊢ max ℵ₀ (lift #↑(s ∪ ↑Equiv.ulift '' s') + lift #((i : ℕ) × Functions (Language.sum L (skolem₁ L)) i)) ≤ lift #↑(↑Equiv.ulift '' s') [PROOFSTEP] rw [max_le_iff, aleph0_le_lift, ← aleph0_le_lift.{_, w'}, h, add_eq_max, max_le_iff, lift_le] [GOAL] case intro L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M s : Set M κ : Cardinal.{w'} h3 : lift (card L) ≤ lift κ h4 : lift κ ≤ lift #M s' : Set (ULift M) h2 : lift #↑s ≤ #↑s' h1 : ℵ₀ ≤ #↑s' hs' : #↑s' = lift κ h : lift #↑(↑Equiv.ulift '' s') = #↑s' ⊢ ℵ₀ ≤ #↑s' ∧ #↑(s ∪ ↑Equiv.ulift '' s') ≤ #↑(↑Equiv.ulift '' s') ∧ lift #((i : ℕ) × Functions (Language.sum L (skolem₁ L)) i) ≤ lift #↑(↑Equiv.ulift '' s') case intro L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M s : Set M κ : Cardinal.{w'} h3 : lift (card L) ≤ lift κ h4 : lift κ ≤ lift #M s' : Set (ULift M) h2 : lift #↑s ≤ #↑s' h1 : ℵ₀ ≤ #↑s' hs' : #↑s' = lift κ h : lift #↑(↑Equiv.ulift '' s') = #↑s' ⊢ ℵ₀ ≤ lift #↑(s ∪ ↑Equiv.ulift '' s') [PROOFSTEP] refine' ⟨h1, (mk_union_le _ _).trans _, (lift_le.2 card_functions_sum_skolem₁_le).trans _⟩ [GOAL] case intro.refine'_1 L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M s : Set M κ : Cardinal.{w'} h3 : lift (card L) ≤ lift κ h4 : lift κ ≤ lift #M s' : Set (ULift M) h2 : lift #↑s ≤ #↑s' h1 : ℵ₀ ≤ #↑s' hs' : #↑s' = lift κ h : lift #↑(↑Equiv.ulift '' s') = #↑s' ⊢ #↑s + #↑(↑Equiv.ulift '' s') ≤ #↑(↑Equiv.ulift '' s') [PROOFSTEP] rw [← lift_le, lift_add, h, add_comm, add_eq_max h1] [GOAL] case intro.refine'_1 L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M s : Set M κ : Cardinal.{w'} h3 : lift (card L) ≤ lift κ h4 : lift κ ≤ lift #M s' : Set (ULift M) h2 : lift #↑s ≤ #↑s' h1 : ℵ₀ ≤ #↑s' hs' : #↑s' = lift κ h : lift #↑(↑Equiv.ulift '' s') = #↑s' ⊢ max (#↑s') (lift #↑s) ≤ #↑s' [PROOFSTEP] exact max_le le_rfl h2 [GOAL] case intro.refine'_2 L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M s : Set M κ : Cardinal.{w'} h3 : lift (card L) ≤ lift κ h4 : lift κ ≤ lift #M s' : Set (ULift M) h2 : lift #↑s ≤ #↑s' h1 : ℵ₀ ≤ #↑s' hs' : #↑s' = lift κ h : lift #↑(↑Equiv.ulift '' s') = #↑s' ⊢ lift (max ℵ₀ (card L)) ≤ lift #↑(↑Equiv.ulift '' s') [PROOFSTEP] rw [lift_max, lift_aleph0, max_le_iff, aleph0_le_lift, and_comm, ← lift_le.{w'}, lift_lift, lift_lift, ← aleph0_le_lift, h] [GOAL] case intro.refine'_2 L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M s : Set M κ : Cardinal.{w'} h3 : lift (card L) ≤ lift κ h4 : lift κ ≤ lift #M s' : Set (ULift M) h2 : lift #↑s ≤ #↑s' h1 : ℵ₀ ≤ #↑s' hs' : #↑s' = lift κ h : lift #↑(↑Equiv.ulift '' s') = #↑s' ⊢ lift (card L) ≤ lift #↑(↑Equiv.ulift '' s') ∧ ℵ₀ ≤ #↑s' [PROOFSTEP] refine' ⟨_, h1⟩ [GOAL] case intro.refine'_2 L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M s : Set M κ : Cardinal.{w'} h3 : lift (card L) ≤ lift κ h4 : lift κ ≤ lift #M s' : Set (ULift M) h2 : lift #↑s ≤ #↑s' h1 : ℵ₀ ≤ #↑s' hs' : #↑s' = lift κ h : lift #↑(↑Equiv.ulift '' s') = #↑s' ⊢ lift (card L) ≤ lift #↑(↑Equiv.ulift '' s') [PROOFSTEP] rw [← lift_lift.{w', w}] [GOAL] case intro.refine'_2 L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M s : Set M κ : Cardinal.{w'} h3 : lift (card L) ≤ lift κ h4 : lift κ ≤ lift #M s' : Set (ULift M) h2 : lift #↑s ≤ #↑s' h1 : ℵ₀ ≤ #↑s' hs' : #↑s' = lift κ h : lift #↑(↑Equiv.ulift '' s') = #↑s' ⊢ lift (lift (card L)) ≤ lift #↑(↑Equiv.ulift '' s') [PROOFSTEP] refine' _root_.trans (lift_le.{w}.2 h3) _ [GOAL] case intro.refine'_2 L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M s : Set M κ : Cardinal.{w'} h3 : lift (card L) ≤ lift κ h4 : lift κ ≤ lift #M s' : Set (ULift M) h2 : lift #↑s ≤ #↑s' h1 : ℵ₀ ≤ #↑s' hs' : #↑s' = lift κ h : lift #↑(↑Equiv.ulift '' s') = #↑s' ⊢ lift (lift κ) ≤ lift #↑(↑Equiv.ulift '' s') [PROOFSTEP] rw [lift_lift, ← lift_lift.{w, max u v}, ← hs', ← h, lift_lift] [GOAL] case intro L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M s : Set M κ : Cardinal.{w'} h3 : lift (card L) ≤ lift κ h4 : lift κ ≤ lift #M s' : Set (ULift M) h2 : lift #↑s ≤ #↑s' h1 : ℵ₀ ≤ #↑s' hs' : #↑s' = lift κ h : lift #↑(↑Equiv.ulift '' s') = #↑s' ⊢ ℵ₀ ≤ lift #↑(s ∪ ↑Equiv.ulift '' s') [PROOFSTEP] refine' _root_.trans _ (lift_le.2 (mk_le_mk_of_subset (Set.subset_union_right _ _))) [GOAL] case intro L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M s : Set M κ : Cardinal.{w'} h3 : lift (card L) ≤ lift κ h4 : lift κ ≤ lift #M s' : Set (ULift M) h2 : lift #↑s ≤ #↑s' h1 : ℵ₀ ≤ #↑s' hs' : #↑s' = lift κ h : lift #↑(↑Equiv.ulift '' s') = #↑s' ⊢ ℵ₀ ≤ lift #↑(↑Equiv.ulift '' s') [PROOFSTEP] rw [aleph0_le_lift, ← aleph0_le_lift, h] [GOAL] case intro L : Language M : Type w inst✝¹ : Nonempty M inst✝ : Structure L M s : Set M κ : Cardinal.{w'} h3 : lift (card L) ≤ lift κ h4 : lift κ ≤ lift #M s' : Set (ULift M) h2 : lift #↑s ≤ #↑s' h1 : ℵ₀ ≤ #↑s' hs' : #↑s' = lift κ h : lift #↑(↑Equiv.ulift '' s') = #↑s' ⊢ ℵ₀ ≤ #↑s' [PROOFSTEP] exact h1
myTestRule { #Input parameters are: # Twitter name # Twitter password # Message #Output parameter is: # Status # # This microservice worked with Twitter's basic authentication, through Spring 2010 # - OAuth-based tweeting from iRODS is not yet implemented # msiTwitterPost(*Username, *Passwd, *Msg, *Status); writePosInt("stdout", *Status); writeLine("stdout", " is the status for twitter post"); } INPUT *Username="rods", *Passwd="password", *Msg="Electronic Records Summer Camp is now open" OUTPUT ruleExecOut
(* Definition of the finite set spec *) Require Import Coq.Sets.Ensembles Fiat.ADT.Core Fiat.Common.Ensembles Fiat.ADT.ComputationalADT Fiat.ADTNotation. Require Export Fiat.FiniteSetADTs.BedrockWord. Set Implicit Arguments. Local Open Scope string_scope. (** TODO: Test: Do we get a speedup if we replace these definitions with [{| bindex := "$STRING-HERE" |}]? *) Definition sEmpty := "Empty". Definition sAdd := "Add". Definition sRemove := "Remove". Definition sIn := "In". Definition sSize := "Size". Definition cardinal (S : Ensemble W) : Comp W := (n <- { n : nat | cardinal _ S n }; ret (from_nat n)). (** We define the interface for finite sets *) (** QUESTION: Does Facade give us any other methods? Do we want to provide any other methods? *) Definition FiniteSetSig : ADTSig := ADTsignature { Constructor sEmpty : unit -> rep, Method sAdd : rep x W -> rep x unit, Method sRemove : rep x W -> rep x unit, Method sIn : rep x W -> rep x bool, Method sSize : rep x unit -> rep x W }. (** And now the spec *) Definition FiniteSetSpec : ADT FiniteSetSig := ADTRep (Ensemble W) { Def Constructor sEmpty (_ : unit) : rep := ret (Empty_set _), Def Method sAdd (xs : rep , x : W) : unit := ret (Add _ xs x, tt), Def Method sRemove (xs : rep , x : W) : unit := ret (Subtract _ xs x, tt), Def Method sIn (xs : rep , x : W) : bool := (b <- { b : bool | b = true <-> Ensembles.In _ xs x }; ret (xs, b)), Def Method sSize (xs : rep , _ : unit) : W := (n <- cardinal xs; ret (xs, n)) }.
From iris.bi Require Import big_op fixpoint. From iris.proofmode Require Import tactics. From iris.algebra Require Import gmap auth agree gset coPset list. From iris.program_logic Require Export total_weakestpre adequacy. From iris Require Import options. Import uPred. Section adequacy. Context `{!irisG Λ Σ}. Implicit Types e : expr Λ. Definition twptp_pre (twptp : list (expr Λ) → iProp Σ) (t1 : list (expr Λ)) : iProp Σ := (∀ t2 σ1 κ κs σ2 n, ⌜step (t1,σ1) κ (t2,σ2)⌝ -∗ state_interp σ1 κs n ={⊤}=∗ ∃ n', ⌜κ = []⌝ ∗ state_interp σ2 κs n' ∗ twptp t2)%I. Lemma twptp_pre_mono (twptp1 twptp2 : list (expr Λ) → iProp Σ) : ⊢ <pers> (∀ t, twptp1 t -∗ twptp2 t) → ∀ t, twptp_pre twptp1 t -∗ twptp_pre twptp2 t. Proof. iIntros "#H"; iIntros (t) "Hwp". rewrite /twptp_pre. iIntros (t2 σ1 κ κs σ2 n1) "Hstep Hσ". iMod ("Hwp" with "[$] [$]") as (n2) "($ & Hσ & ?)". iModIntro. iExists n2. iFrame "Hσ". by iApply "H". Qed. Local Instance twptp_pre_mono' : BiMonoPred twptp_pre. Proof. constructor; first apply twptp_pre_mono. intros wp Hwp n t1 t2 ?%(discrete_iff _ _)%leibniz_equiv; solve_proper. Qed. Definition twptp (t : list (expr Λ)) : iProp Σ := bi_least_fixpoint twptp_pre t. Lemma twptp_unfold t : twptp t ⊣⊢ twptp_pre twptp t. Proof. by rewrite /twptp least_fixpoint_unfold. Qed. Lemma twptp_ind Ψ : ⊢ (□ ∀ t, twptp_pre (λ t, Ψ t ∧ twptp t) t -∗ Ψ t) → ∀ t, twptp t -∗ Ψ t. Proof. iIntros "#IH" (t) "H". assert (NonExpansive Ψ). { by intros n ?? ->%(discrete_iff _ _)%leibniz_equiv. } iApply (least_fixpoint_strong_ind _ Ψ with "[] H"). iIntros "!>" (t') "H". by iApply "IH". Qed. Instance twptp_Permutation : Proper ((≡ₚ) ==> (⊢)) twptp. Proof. iIntros (t1 t1' Ht) "Ht1". iRevert (t1' Ht); iRevert (t1) "Ht1". iApply twptp_ind; iIntros "!>" (t1) "IH"; iIntros (t1' Ht). rewrite twptp_unfold /twptp_pre. iIntros (t2 σ1 κ κs σ2 n Hstep) "Hσ". destruct (step_Permutation t1' t1 t2 κ σ1 σ2) as (t2'&?&?); [done..|]. iMod ("IH" $! t2' with "[% //] Hσ") as (n2) "($ & Hσ & IH & _)". iModIntro. iExists n2. iFrame "Hσ". by iApply "IH". Qed. Lemma twptp_app t1 t2 : twptp t1 -∗ twptp t2 -∗ twptp (t1 ++ t2). Proof. iIntros "H1". iRevert (t2). iRevert (t1) "H1". iApply twptp_ind; iIntros "!>" (t1) "IH1". iIntros (t2) "H2". iRevert (t1) "IH1"; iRevert (t2) "H2". iApply twptp_ind; iIntros "!>" (t2) "IH2". iIntros (t1) "IH1". rewrite twptp_unfold /twptp_pre. iIntros (t1'' σ1 κ κs σ2 n Hstep) "Hσ1". destruct Hstep as [e1 σ1' e2 σ2' efs' t1' t2' [=Ht ?] ? Hstep]; simplify_eq/=. apply app_eq_inv in Ht as [(t&?&?)|(t&?&?)]; subst. - destruct t as [|e1' ?]; simplify_eq/=. + iMod ("IH2" with "[%] Hσ1") as (n2) "($ & Hσ & IH2 & _)". { by eapply step_atomic with (t1:=[]). } iModIntro. iExists n2. iFrame "Hσ". rewrite -{2}(left_id_L [] (++) (e2 :: _)). iApply "IH2". by setoid_rewrite (right_id_L [] (++)). + iMod ("IH1" with "[%] Hσ1") as (n2) "($ & Hσ & IH1 & _)"; first by econstructor. iAssert (twptp t2) with "[IH2]" as "Ht2". { rewrite twptp_unfold. iApply (twptp_pre_mono with "[] IH2"). iIntros "!> * [_ ?] //". } iModIntro. iExists n2. iFrame "Hσ". rewrite -assoc_L (comm _ t2) !cons_middle !assoc_L. by iApply "IH1". - iMod ("IH2" with "[%] Hσ1") as (n2) "($ & Hσ & IH2 & _)"; first by econstructor. iModIntro. iExists n2. iFrame "Hσ". rewrite -assoc_L. by iApply "IH2". Qed. Lemma twp_twptp s Φ e : WP e @ s; ⊤ [{ Φ }] -∗ twptp [e]. Proof. iIntros "He". remember (⊤ : coPset) as E eqn:HE. iRevert (HE). iRevert (e E Φ) "He". iApply twp_ind. iIntros "!>" (e E Φ); iIntros "IH" (->). rewrite twptp_unfold /twptp_pre /twp_pre. iIntros (t1' σ1' κ κs σ2' n Hstep) "Hσ1". destruct Hstep as [e1 σ1 e2 σ2 efs [|? t1] t2 ?? Hstep]; simplify_eq/=; try discriminate_list. destruct (to_val e1) as [v|] eqn:He1. { apply val_stuck in Hstep; naive_solver. } iMod ("IH" with "Hσ1") as "[_ IH]". iMod ("IH" with "[% //]") as "($ & Hσ & [IH _] & IHfork)". iModIntro. iExists (length efs + n). iFrame "Hσ". iApply (twptp_app [_] with "(IH [//])"). clear. iInduction efs as [|e efs] "IH"; simpl. { rewrite twptp_unfold /twptp_pre. iIntros (t2 σ1 κ κs σ2 n1 Hstep). destruct Hstep; simplify_eq/=; discriminate_list. } iDestruct "IHfork" as "[[IH' _] IHfork]". iApply (twptp_app [_] with "(IH' [//])"). by iApply "IH". Qed. Lemma twptp_total n σ t : state_interp σ [] n -∗ twptp t ={⊤}=∗ ▷ ⌜sn erased_step (t, σ)⌝. Proof. iIntros "Hσ Ht". iRevert (σ n) "Hσ". iRevert (t) "Ht". iApply twptp_ind; iIntros "!>" (t) "IH"; iIntros (σ n) "Hσ". iApply (pure_mono _ _ (Acc_intro _)). iIntros ([t' σ'] [κ Hstep]). rewrite /twptp_pre. iMod ("IH" with "[% //] Hσ") as (n' ->) "[Hσ [H _]]". by iApply "H". Qed. End adequacy. Theorem twp_total Σ Λ `{!invPreG Σ} s e σ Φ : (∀ `{Hinv : !invG Σ}, ⊢ |={⊤}=> ∃ (stateI : state Λ → list (observation Λ) → nat → iProp Σ) (fork_post : val Λ → iProp Σ), let _ : irisG Λ Σ := IrisG _ _ Hinv stateI fork_post in stateI σ [] 0 ∗ WP e @ s; ⊤ [{ Φ }]) → sn erased_step ([e], σ). (* i.e. ([e], σ) is strongly normalizing *) Proof. intros Hwp. apply (soundness (M:=iResUR Σ) _ 1); simpl. apply (fupd_plain_soundness ⊤ ⊤ _)=> Hinv. iMod (Hwp) as (stateI fork_post) "[Hσ H]". iApply (@twptp_total _ _ (IrisG _ _ Hinv stateI fork_post) with "Hσ"). by iApply (@twp_twptp _ _ (IrisG _ _ Hinv stateI fork_post)). Qed.
[STATEMENT] lemma "Suc 0 \<noteq> Suc 1" [PROOF STATE] proof (prove) goal (1 subgoal): 1. Suc 0 \<noteq> Suc 1 [PROOF STEP] by normalization
program gainchk c C common /gainblk/ phase,gain complex gain,PREAMP,FFTAMP c do i = 1,200 f = .1*i ich = 3 IPA = 4 ! EXDC GAIN = PREAMP(IPA,F) GAIN = GAIN*FFTAMP(ICH,F) WRITE(23,*) f,CABS(GAIN) print*,f,CABS(GAIN) enddo stop end
-- An ATP type must be used with data-types or postulates. -- This error is detected by TypeChecking.Rules.Decl. module ATPBadType2 where foo : Set → Set foo A = A {-# ATP type foo #-}
module #12 where {- Using the propositions as types interpretation, derive the following tautologies. (i) If A, then (if B then A). (ii) If A, then not (not A). (iii) If (not A or not B), then not (A and B). -} open import Data.Product open import Data.Sum open import Relation.Nullary const : {A B : Set} → A → (B → A) const = λ z _ → z double-negation : {A : Set} → A → ¬ (¬ A) double-negation = λ z z₁ → z₁ z demorgans-law₁ : {A B C : Set} → ((¬ A) ⊎ (¬ B)) → (¬ (A × B)) demorgans-law₁ (inj₁ ¬x) (a , _) = ¬x a demorgans-law₁ (inj₂ ¬y) (_ , b) = ¬y b
[STATEMENT] theorem rewrite_Goto_chain_safe: "rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t \<longleftrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t" [PROOF STATE] proof (prove) goal (1 subgoal): 1. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t [PROOF STEP] proof(induction \<Gamma> rs arbitrary: rs' s rule: rewrite_Goto_chain_safe.induct) [PROOF STATE] proof (state) goal (10 subgoals): 1. \<And>uu_ rs' s. rewrite_Goto_chain_safe uu_ [] = Some rs' \<Longrightarrow> uu_,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = uu_,\<gamma>,p\<turnstile>\<^sub>g \<langle>[], s\<rangle> \<Rightarrow> t 2. \<And>\<Gamma> m chain rs rs' s. \<lbrakk>\<And>x2 rs' s. \<lbrakk>\<Gamma> chain = Some x2; \<not> \<not> terminal_chain x2; rewrite_Goto_chain_safe \<Gamma> rs = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule m (Goto chain) # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, s\<rangle> \<Rightarrow> t 3. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Accept # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Accept # rs, s\<rangle> \<Rightarrow> t 4. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Drop # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Drop # rs, s\<rangle> \<Rightarrow> t 5. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Log # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Log # rs, s\<rangle> \<Rightarrow> t 6. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Reject # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Reject # rs, s\<rangle> \<Rightarrow> t 7. \<And>\<Gamma> v vb rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v (Call vb) # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v (Call vb) # rs, s\<rangle> \<Rightarrow> t 8. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Return # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Return # rs, s\<rangle> \<Rightarrow> t 9. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Empty # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Empty # rs, s\<rangle> \<Rightarrow> t 10. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Unknown # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Unknown # rs, s\<rangle> \<Rightarrow> t [PROOF STEP] case 1 [PROOF STATE] proof (state) this: rewrite_Goto_chain_safe uu_ [] = Some rs' goal (10 subgoals): 1. \<And>uu_ rs' s. rewrite_Goto_chain_safe uu_ [] = Some rs' \<Longrightarrow> uu_,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = uu_,\<gamma>,p\<turnstile>\<^sub>g \<langle>[], s\<rangle> \<Rightarrow> t 2. \<And>\<Gamma> m chain rs rs' s. \<lbrakk>\<And>x2 rs' s. \<lbrakk>\<Gamma> chain = Some x2; \<not> \<not> terminal_chain x2; rewrite_Goto_chain_safe \<Gamma> rs = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule m (Goto chain) # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, s\<rangle> \<Rightarrow> t 3. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Accept # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Accept # rs, s\<rangle> \<Rightarrow> t 4. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Drop # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Drop # rs, s\<rangle> \<Rightarrow> t 5. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Log # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Log # rs, s\<rangle> \<Rightarrow> t 6. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Reject # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Reject # rs, s\<rangle> \<Rightarrow> t 7. \<And>\<Gamma> v vb rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v (Call vb) # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v (Call vb) # rs, s\<rangle> \<Rightarrow> t 8. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Return # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Return # rs, s\<rangle> \<Rightarrow> t 9. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Empty # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Empty # rs, s\<rangle> \<Rightarrow> t 10. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Unknown # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Unknown # rs, s\<rangle> \<Rightarrow> t [PROOF STEP] thus ?case [PROOF STATE] proof (prove) using this: rewrite_Goto_chain_safe uu_ [] = Some rs' goal (1 subgoal): 1. uu_,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = uu_,\<gamma>,p\<turnstile>\<^sub>g \<langle>[], s\<rangle> \<Rightarrow> t [PROOF STEP] by (simp split: option.split_asm if_split_asm) [PROOF STATE] proof (state) this: uu_,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = uu_,\<gamma>,p\<turnstile>\<^sub>g \<langle>[], s\<rangle> \<Rightarrow> t goal (9 subgoals): 1. \<And>\<Gamma> m chain rs rs' s. \<lbrakk>\<And>x2 rs' s. \<lbrakk>\<Gamma> chain = Some x2; \<not> \<not> terminal_chain x2; rewrite_Goto_chain_safe \<Gamma> rs = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule m (Goto chain) # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, s\<rangle> \<Rightarrow> t 2. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Accept # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Accept # rs, s\<rangle> \<Rightarrow> t 3. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Drop # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Drop # rs, s\<rangle> \<Rightarrow> t 4. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Log # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Log # rs, s\<rangle> \<Rightarrow> t 5. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Reject # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Reject # rs, s\<rangle> \<Rightarrow> t 6. \<And>\<Gamma> v vb rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v (Call vb) # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v (Call vb) # rs, s\<rangle> \<Rightarrow> t 7. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Return # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Return # rs, s\<rangle> \<Rightarrow> t 8. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Empty # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Empty # rs, s\<rangle> \<Rightarrow> t 9. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Unknown # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Unknown # rs, s\<rangle> \<Rightarrow> t [PROOF STEP] next [PROOF STATE] proof (state) goal (9 subgoals): 1. \<And>\<Gamma> m chain rs rs' s. \<lbrakk>\<And>x2 rs' s. \<lbrakk>\<Gamma> chain = Some x2; \<not> \<not> terminal_chain x2; rewrite_Goto_chain_safe \<Gamma> rs = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule m (Goto chain) # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, s\<rangle> \<Rightarrow> t 2. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Accept # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Accept # rs, s\<rangle> \<Rightarrow> t 3. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Drop # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Drop # rs, s\<rangle> \<Rightarrow> t 4. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Log # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Log # rs, s\<rangle> \<Rightarrow> t 5. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Reject # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Reject # rs, s\<rangle> \<Rightarrow> t 6. \<And>\<Gamma> v vb rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v (Call vb) # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v (Call vb) # rs, s\<rangle> \<Rightarrow> t 7. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Return # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Return # rs, s\<rangle> \<Rightarrow> t 8. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Empty # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Empty # rs, s\<rangle> \<Rightarrow> t 9. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Unknown # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Unknown # rs, s\<rangle> \<Rightarrow> t [PROOF STEP] case (2 \<Gamma> m chain rs) [PROOF STATE] proof (state) this: \<lbrakk>\<Gamma> chain = Some ?x2.0; \<not> \<not> terminal_chain ?x2.0; rewrite_Goto_chain_safe \<Gamma> rs = Some ?rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>?rs', ?s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ?s\<rangle> \<Rightarrow> t rewrite_Goto_chain_safe \<Gamma> (Rule m (Goto chain) # rs) = Some rs' goal (9 subgoals): 1. \<And>\<Gamma> m chain rs rs' s. \<lbrakk>\<And>x2 rs' s. \<lbrakk>\<Gamma> chain = Some x2; \<not> \<not> terminal_chain x2; rewrite_Goto_chain_safe \<Gamma> rs = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule m (Goto chain) # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, s\<rangle> \<Rightarrow> t 2. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Accept # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Accept # rs, s\<rangle> \<Rightarrow> t 3. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Drop # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Drop # rs, s\<rangle> \<Rightarrow> t 4. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Log # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Log # rs, s\<rangle> \<Rightarrow> t 5. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Reject # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Reject # rs, s\<rangle> \<Rightarrow> t 6. \<And>\<Gamma> v vb rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v (Call vb) # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v (Call vb) # rs, s\<rangle> \<Rightarrow> t 7. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Return # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Return # rs, s\<rangle> \<Rightarrow> t 8. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Empty # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Empty # rs, s\<rangle> \<Rightarrow> t 9. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Unknown # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Unknown # rs, s\<rangle> \<Rightarrow> t [PROOF STEP] from 2(2) [PROOF STATE] proof (chain) picking this: rewrite_Goto_chain_safe \<Gamma> (Rule m (Goto chain) # rs) = Some rs' [PROOF STEP] obtain z x2 where "\<Gamma> chain = Some x2" and "terminal_chain x2" and "rs' = Rule m (Call chain) # z" and "Some z = rewrite_Goto_chain_safe \<Gamma> rs" [PROOF STATE] proof (prove) using this: rewrite_Goto_chain_safe \<Gamma> (Rule m (Goto chain) # rs) = Some rs' goal (1 subgoal): 1. (\<And>x2 z. \<lbrakk>\<Gamma> chain = Some x2; terminal_chain x2; rs' = Rule m (Call chain) # z; Some z = rewrite_Goto_chain_safe \<Gamma> rs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis [PROOF STEP] by(auto split: option.split_asm if_split_asm) [PROOF STATE] proof (state) this: \<Gamma> chain = Some x2 terminal_chain x2 rs' = Rule m (Call chain) # z Some z = rewrite_Goto_chain_safe \<Gamma> rs goal (9 subgoals): 1. \<And>\<Gamma> m chain rs rs' s. \<lbrakk>\<And>x2 rs' s. \<lbrakk>\<Gamma> chain = Some x2; \<not> \<not> terminal_chain x2; rewrite_Goto_chain_safe \<Gamma> rs = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule m (Goto chain) # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, s\<rangle> \<Rightarrow> t 2. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Accept # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Accept # rs, s\<rangle> \<Rightarrow> t 3. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Drop # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Drop # rs, s\<rangle> \<Rightarrow> t 4. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Log # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Log # rs, s\<rangle> \<Rightarrow> t 5. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Reject # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Reject # rs, s\<rangle> \<Rightarrow> t 6. \<And>\<Gamma> v vb rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v (Call vb) # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v (Call vb) # rs, s\<rangle> \<Rightarrow> t 7. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Return # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Return # rs, s\<rangle> \<Rightarrow> t 8. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Empty # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Empty # rs, s\<rangle> \<Rightarrow> t 9. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Unknown # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Unknown # rs, s\<rangle> \<Rightarrow> t [PROOF STEP] from 2(1) \<open>\<Gamma> chain = Some x2\<close> \<open>terminal_chain x2\<close> \<open>Some z = rewrite_Goto_chain_safe \<Gamma> rs\<close> [PROOF STATE] proof (chain) picking this: \<lbrakk>\<Gamma> chain = Some ?x2.0; \<not> \<not> terminal_chain ?x2.0; rewrite_Goto_chain_safe \<Gamma> rs = Some ?rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>?rs', ?s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ?s\<rangle> \<Rightarrow> t \<Gamma> chain = Some x2 terminal_chain x2 Some z = rewrite_Goto_chain_safe \<Gamma> rs [PROOF STEP] have IH: "\<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t" for s [PROOF STATE] proof (prove) using this: \<lbrakk>\<Gamma> chain = Some ?x2.0; \<not> \<not> terminal_chain ?x2.0; rewrite_Goto_chain_safe \<Gamma> rs = Some ?rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>?rs', ?s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ?s\<rangle> \<Rightarrow> t \<Gamma> chain = Some x2 terminal_chain x2 Some z = rewrite_Goto_chain_safe \<Gamma> rs goal (1 subgoal): 1. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t [PROOF STEP] by simp [PROOF STATE] proof (state) this: \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, ?s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ?s\<rangle> \<Rightarrow> t goal (9 subgoals): 1. \<And>\<Gamma> m chain rs rs' s. \<lbrakk>\<And>x2 rs' s. \<lbrakk>\<Gamma> chain = Some x2; \<not> \<not> terminal_chain x2; rewrite_Goto_chain_safe \<Gamma> rs = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule m (Goto chain) # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, s\<rangle> \<Rightarrow> t 2. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Accept # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Accept # rs, s\<rangle> \<Rightarrow> t 3. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Drop # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Drop # rs, s\<rangle> \<Rightarrow> t 4. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Log # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Log # rs, s\<rangle> \<Rightarrow> t 5. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Reject # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Reject # rs, s\<rangle> \<Rightarrow> t 6. \<And>\<Gamma> v vb rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v (Call vb) # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v (Call vb) # rs, s\<rangle> \<Rightarrow> t 7. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Return # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Return # rs, s\<rangle> \<Rightarrow> t 8. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Empty # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Empty # rs, s\<rangle> \<Rightarrow> t 9. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Unknown # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Unknown # rs, s\<rangle> \<Rightarrow> t [PROOF STEP] have "\<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t \<longleftrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t" (is "?lhs \<longleftrightarrow> ?rhs") [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] proof(intro iffI) [PROOF STATE] proof (state) goal (2 subgoals): 1. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t 2. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] assume ?lhs [PROOF STATE] proof (state) this: \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t goal (2 subgoals): 1. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t 2. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] with IH [PROOF STATE] proof (chain) picking this: \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, ?s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ?s\<rangle> \<Rightarrow> t \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] obtain ti where ti1: "\<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Call chain)], Undecided\<rangle> \<Rightarrow> ti" and ti2: "\<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ti\<rangle> \<Rightarrow> t" [PROOF STATE] proof (prove) using this: \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, ?s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ?s\<rangle> \<Rightarrow> t \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t goal (1 subgoal): 1. (\<And>ti. \<lbrakk>\<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Call chain)], Undecided\<rangle> \<Rightarrow> ti; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ti\<rangle> \<Rightarrow> t\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis [PROOF STEP] by(auto elim: seqE_cons) [PROOF STATE] proof (state) this: \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Call chain)], Undecided\<rangle> \<Rightarrow> ti \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ti\<rangle> \<Rightarrow> t goal (2 subgoals): 1. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t 2. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] show ?rhs [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] proof(cases "matches \<gamma> m p") [PROOF STATE] proof (state) goal (2 subgoals): 1. matches \<gamma> m p \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t 2. \<not> matches \<gamma> m p \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] case False [PROOF STATE] proof (state) this: \<not> matches \<gamma> m p goal (2 subgoals): 1. matches \<gamma> m p \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t 2. \<not> matches \<gamma> m p \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] from replace_Goto_with_Call_in_terminal_chain \<open>\<Gamma> chain = Some x2\<close> \<open>terminal_chain x2\<close> [PROOF STATE] proof (chain) picking this: \<lbrakk>?\<Gamma> ?chain = Some ?rs; terminal_chain ?rs\<rbrakk> \<Longrightarrow> ?\<Gamma>,?\<gamma>,?p\<turnstile>\<^sub>g \<langle>[Rule ?m (Goto ?chain)], ?s\<rangle> \<Rightarrow> ?t = ?\<Gamma>,?\<gamma>,?p\<turnstile>\<^sub>g \<langle>[Rule ?m (Call ?chain)], ?s\<rangle> \<Rightarrow> ?t \<Gamma> chain = Some x2 terminal_chain x2 [PROOF STEP] have " \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Call chain)], Undecided\<rangle> \<Rightarrow> ti \<longleftrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> ti" [PROOF STATE] proof (prove) using this: \<lbrakk>?\<Gamma> ?chain = Some ?rs; terminal_chain ?rs\<rbrakk> \<Longrightarrow> ?\<Gamma>,?\<gamma>,?p\<turnstile>\<^sub>g \<langle>[Rule ?m (Goto ?chain)], ?s\<rangle> \<Rightarrow> ?t = ?\<Gamma>,?\<gamma>,?p\<turnstile>\<^sub>g \<langle>[Rule ?m (Call ?chain)], ?s\<rangle> \<Rightarrow> ?t \<Gamma> chain = Some x2 terminal_chain x2 goal (1 subgoal): 1. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Call chain)], Undecided\<rangle> \<Rightarrow> ti = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> ti [PROOF STEP] by fast [PROOF STATE] proof (state) this: \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Call chain)], Undecided\<rangle> \<Rightarrow> ti = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> ti goal (2 subgoals): 1. matches \<gamma> m p \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t 2. \<not> matches \<gamma> m p \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] with False ti1 ti2 [PROOF STATE] proof (chain) picking this: \<not> matches \<gamma> m p \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Call chain)], Undecided\<rangle> \<Rightarrow> ti \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ti\<rangle> \<Rightarrow> t \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Call chain)], Undecided\<rangle> \<Rightarrow> ti = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> ti [PROOF STEP] show ?thesis [PROOF STATE] proof (prove) using this: \<not> matches \<gamma> m p \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Call chain)], Undecided\<rangle> \<Rightarrow> ti \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ti\<rangle> \<Rightarrow> t \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Call chain)], Undecided\<rangle> \<Rightarrow> ti = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> ti goal (1 subgoal): 1. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] by(rule_tac t=ti in seq'_cons) simp+ [PROOF STATE] proof (state) this: \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t goal (1 subgoal): 1. matches \<gamma> m p \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] next [PROOF STATE] proof (state) goal (1 subgoal): 1. matches \<gamma> m p \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] case True [PROOF STATE] proof (state) this: matches \<gamma> m p goal (1 subgoal): 1. matches \<gamma> m p \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] from ti1 \<open>\<Gamma> chain = Some x2\<close> \<open>terminal_chain x2\<close> [PROOF STATE] proof (chain) picking this: \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Call chain)], Undecided\<rangle> \<Rightarrow> ti \<Gamma> chain = Some x2 terminal_chain x2 [PROOF STEP] have g: "\<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> ti" [PROOF STATE] proof (prove) using this: \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Call chain)], Undecided\<rangle> \<Rightarrow> ti \<Gamma> chain = Some x2 terminal_chain x2 goal (1 subgoal): 1. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> ti [PROOF STEP] by(subst(asm) replace_Goto_with_Call_in_terminal_chain[symmetric]) simp+ [PROOF STATE] proof (state) this: \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> ti goal (1 subgoal): 1. matches \<gamma> m p \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] with True \<open>\<Gamma> chain = Some x2\<close> \<open>terminal_chain x2\<close> [PROOF STATE] proof (chain) picking this: matches \<gamma> m p \<Gamma> chain = Some x2 terminal_chain x2 \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> ti [PROOF STEP] obtain X where X: "ti = Decision X" [PROOF STATE] proof (prove) using this: matches \<gamma> m p \<Gamma> chain = Some x2 terminal_chain x2 \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> ti goal (1 subgoal): 1. (\<And>X. ti = Decision X \<Longrightarrow> thesis) \<Longrightarrow> thesis [PROOF STEP] by(blast dest: terminal_chain_Goto_decision) [PROOF STATE] proof (state) this: ti = Decision X goal (1 subgoal): 1. matches \<gamma> m p \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] with this ti2 [PROOF STATE] proof (chain) picking this: ti = Decision X \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ti\<rangle> \<Rightarrow> t ti = Decision X [PROOF STEP] have "t = Decision X" [PROOF STATE] proof (prove) using this: ti = Decision X \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ti\<rangle> \<Rightarrow> t ti = Decision X goal (1 subgoal): 1. t = Decision X [PROOF STEP] by(simp add: decisionD) [PROOF STATE] proof (state) this: t = Decision X goal (1 subgoal): 1. matches \<gamma> m p \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] with g X True ti2 \<open>\<Gamma> chain = Some x2\<close> \<open>terminal_chain x2\<close> [PROOF STATE] proof (chain) picking this: \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> ti ti = Decision X matches \<gamma> m p \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ti\<rangle> \<Rightarrow> t \<Gamma> chain = Some x2 terminal_chain x2 t = Decision X [PROOF STEP] show ?thesis [PROOF STATE] proof (prove) using this: \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> ti ti = Decision X matches \<gamma> m p \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ti\<rangle> \<Rightarrow> t \<Gamma> chain = Some x2 terminal_chain x2 t = Decision X goal (1 subgoal): 1. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] apply(simp) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>\<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> Decision X; ti = Decision X; matches \<gamma> m p; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, Decision X\<rangle> \<Rightarrow> Decision X; \<Gamma> chain = Some x2; terminal_chain x2; t = Decision X\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> Decision X [PROOF STEP] apply(rule seq_cons_Goto_t, simp_all) [PROOF STATE] proof (prove) goal: No subgoals! [PROOF STEP] done [PROOF STATE] proof (state) this: \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t goal: No subgoals! [PROOF STEP] qed [PROOF STATE] proof (state) this: \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t goal (1 subgoal): 1. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] next [PROOF STATE] proof (state) goal (1 subgoal): 1. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] assume ?rhs [PROOF STATE] proof (state) this: \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t goal (1 subgoal): 1. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] with IH \<open>\<Gamma> chain = Some x2\<close> \<open>terminal_chain x2\<close> \<open>Some z = rewrite_Goto_chain_safe \<Gamma> rs\<close> [PROOF STATE] proof (chain) picking this: \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, ?s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ?s\<rangle> \<Rightarrow> t \<Gamma> chain = Some x2 terminal_chain x2 Some z = rewrite_Goto_chain_safe \<Gamma> rs \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] show ?lhs [PROOF STATE] proof (prove) using this: \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, ?s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ?s\<rangle> \<Rightarrow> t \<Gamma> chain = Some x2 terminal_chain x2 Some z = rewrite_Goto_chain_safe \<Gamma> rs \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t goal (1 subgoal): 1. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] apply - [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>\<And>s. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; \<Gamma> chain = Some x2; terminal_chain x2; Some z = rewrite_Goto_chain_safe \<Gamma> rs; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] apply(erule seqE_cons) [PROOF STATE] proof (prove) goal (2 subgoals): 1. \<And>ti. \<lbrakk>\<And>s. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; \<Gamma> chain = Some x2; terminal_chain x2; Some z = rewrite_Goto_chain_safe \<Gamma> rs; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> ti; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ti\<rangle> \<Rightarrow> t; no_matching_Goto \<gamma> p [Rule m (Goto chain)]\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t 2. \<lbrakk>\<And>s. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; \<Gamma> chain = Some x2; terminal_chain x2; Some z = rewrite_Goto_chain_safe \<Gamma> rs; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> t; \<not> no_matching_Goto \<gamma> p [Rule m (Goto chain)]\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] subgoal for ti [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>\<And>s. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; \<Gamma> chain = Some x2; terminal_chain x2; Some z = rewrite_Goto_chain_safe \<Gamma> rs; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> ti; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ti\<rangle> \<Rightarrow> t; no_matching_Goto \<gamma> p [Rule m (Goto chain)]\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] apply simp_all [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>\<And>s. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; \<Gamma> chain = Some x2; terminal_chain x2; Some z = rewrite_Goto_chain_safe \<Gamma> rs; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> ti; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ti\<rangle> \<Rightarrow> t; \<not> matches \<gamma> m p\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] apply(rule_tac t=ti in seq'_cons) [PROOF STATE] proof (prove) goal (3 subgoals): 1. \<lbrakk>\<And>s. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; \<Gamma> chain = Some x2; terminal_chain x2; Some z = rewrite_Goto_chain_safe \<Gamma> rs; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> ti; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ti\<rangle> \<Rightarrow> t; \<not> matches \<gamma> m p\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Call chain)], Undecided\<rangle> \<Rightarrow> ti 2. \<lbrakk>\<And>s. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; \<Gamma> chain = Some x2; terminal_chain x2; Some z = rewrite_Goto_chain_safe \<Gamma> rs; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> ti; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ti\<rangle> \<Rightarrow> t; \<not> matches \<gamma> m p\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, ti\<rangle> \<Rightarrow> t 3. \<lbrakk>\<And>s. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; \<Gamma> chain = Some x2; terminal_chain x2; Some z = rewrite_Goto_chain_safe \<Gamma> rs; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> ti; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ti\<rangle> \<Rightarrow> t; \<not> matches \<gamma> m p\<rbrakk> \<Longrightarrow> no_matching_Goto \<gamma> p [Rule m (Call chain)] [PROOF STEP] apply simp_all [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>\<And>s. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; \<Gamma> chain = Some x2; terminal_chain x2; Some z = rewrite_Goto_chain_safe \<Gamma> rs; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> ti; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ti\<rangle> \<Rightarrow> t; \<not> matches \<gamma> m p\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Call chain)], Undecided\<rangle> \<Rightarrow> ti [PROOF STEP] using replace_Goto_with_Call_in_terminal_chain [PROOF STATE] proof (prove) using this: \<lbrakk>?\<Gamma> ?chain = Some ?rs; terminal_chain ?rs\<rbrakk> \<Longrightarrow> ?\<Gamma>,?\<gamma>,?p\<turnstile>\<^sub>g \<langle>[Rule ?m (Goto ?chain)], ?s\<rangle> \<Rightarrow> ?t = ?\<Gamma>,?\<gamma>,?p\<turnstile>\<^sub>g \<langle>[Rule ?m (Call ?chain)], ?s\<rangle> \<Rightarrow> ?t goal (1 subgoal): 1. \<lbrakk>\<And>s. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; \<Gamma> chain = Some x2; terminal_chain x2; Some z = rewrite_Goto_chain_safe \<Gamma> rs; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> ti; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, ti\<rangle> \<Rightarrow> t; \<not> matches \<gamma> m p\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Call chain)], Undecided\<rangle> \<Rightarrow> ti [PROOF STEP] by fast [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>\<And>s. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; \<Gamma> chain = Some x2; terminal_chain x2; Some z = rewrite_Goto_chain_safe \<Gamma> rs; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> t; \<not> no_matching_Goto \<gamma> p [Rule m (Goto chain)]\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] apply simp [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>\<And>s. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; \<Gamma> chain = Some x2; terminal_chain x2; Some z = rewrite_Goto_chain_safe \<Gamma> rs; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> t; matches \<gamma> m p\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] apply(frule(3) terminal_chain_Goto_decision) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>\<And>s. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; \<Gamma> chain = Some x2; terminal_chain x2; Some z = rewrite_Goto_chain_safe \<Gamma> rs; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Goto chain)], Undecided\<rangle> \<Rightarrow> t; matches \<gamma> m p; \<exists>X. t = Decision X\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] apply(subst(asm) replace_Goto_with_Call_in_terminal_chain, simp_all) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>\<And>s. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; \<Gamma> chain = Some x2; terminal_chain x2; Some z = rewrite_Goto_chain_safe \<Gamma> rs; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Call chain)], Undecided\<rangle> \<Rightarrow> t; matches \<gamma> m p; \<exists>X. t = Decision X\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] apply(rule seq'_cons, simp_all) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>\<And>s. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; \<Gamma> chain = Some x2; terminal_chain x2; Some z = rewrite_Goto_chain_safe \<Gamma> rs; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Call chain)], Undecided\<rangle> \<Rightarrow> t; matches \<gamma> m p; \<exists>X. t = Decision X\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, t\<rangle> \<Rightarrow> t [PROOF STEP] apply(elim exE) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<And>X. \<lbrakk>\<And>s. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>z, s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; \<Gamma> chain = Some x2; terminal_chain x2; Some z = rewrite_Goto_chain_safe \<Gamma> rs; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>[Rule m (Call chain)], Undecided\<rangle> \<Rightarrow> t; matches \<gamma> m p; t = Decision X\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, t\<rangle> \<Rightarrow> t [PROOF STEP] by (simp add: decision) [PROOF STATE] proof (state) this: \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t goal: No subgoals! [PROOF STEP] qed [PROOF STATE] proof (state) this: \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t goal (9 subgoals): 1. \<And>\<Gamma> m chain rs rs' s. \<lbrakk>\<And>x2 rs' s. \<lbrakk>\<Gamma> chain = Some x2; \<not> \<not> terminal_chain x2; rewrite_Goto_chain_safe \<Gamma> rs = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule m (Goto chain) # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, s\<rangle> \<Rightarrow> t 2. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Accept # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Accept # rs, s\<rangle> \<Rightarrow> t 3. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Drop # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Drop # rs, s\<rangle> \<Rightarrow> t 4. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Log # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Log # rs, s\<rangle> \<Rightarrow> t 5. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Reject # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Reject # rs, s\<rangle> \<Rightarrow> t 6. \<And>\<Gamma> v vb rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v (Call vb) # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v (Call vb) # rs, s\<rangle> \<Rightarrow> t 7. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Return # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Return # rs, s\<rangle> \<Rightarrow> t 8. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Empty # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Empty # rs, s\<rangle> \<Rightarrow> t 9. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Unknown # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Unknown # rs, s\<rangle> \<Rightarrow> t [PROOF STEP] with \<open>rs' = Rule m (Call chain) # z\<close> [PROOF STATE] proof (chain) picking this: rs' = Rule m (Call chain) # z \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] show ?case [PROOF STATE] proof (prove) using this: rs' = Rule m (Call chain) # z \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t goal (1 subgoal): 1. \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, s\<rangle> \<Rightarrow> t [PROOF STEP] apply - [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>rs' = Rule m (Call chain) # z; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, s\<rangle> \<Rightarrow> t [PROOF STEP] apply(rule just_show_all_bigstep_semantics_equalities_with_start_Undecided) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>rs' = Rule m (Call chain) # z; \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Call chain) # z, Undecided\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', Undecided\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, Undecided\<rangle> \<Rightarrow> t [PROOF STEP] by simp [PROOF STATE] proof (state) this: \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule m (Goto chain) # rs, s\<rangle> \<Rightarrow> t goal (8 subgoals): 1. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Accept # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Accept # rs, s\<rangle> \<Rightarrow> t 2. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Drop # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Drop # rs, s\<rangle> \<Rightarrow> t 3. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Log # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Log # rs, s\<rangle> \<Rightarrow> t 4. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Reject # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Reject # rs, s\<rangle> \<Rightarrow> t 5. \<And>\<Gamma> v vb rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v (Call vb) # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v (Call vb) # rs, s\<rangle> \<Rightarrow> t 6. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Return # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Return # rs, s\<rangle> \<Rightarrow> t 7. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Empty # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Empty # rs, s\<rangle> \<Rightarrow> t 8. \<And>\<Gamma> v rs rs' s. \<lbrakk>\<And>rs' s. rewrite_Goto_chain_safe \<Gamma> rs = Some rs' \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs, s\<rangle> \<Rightarrow> t; rewrite_Goto_chain_safe \<Gamma> (Rule v Unknown # rs) = Some rs'\<rbrakk> \<Longrightarrow> \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>rs', s\<rangle> \<Rightarrow> t = \<Gamma>,\<gamma>,p\<turnstile>\<^sub>g \<langle>Rule v Unknown # rs, s\<rangle> \<Rightarrow> t [PROOF STEP] qed(auto cong: step_IH_cong)
Thiruvananthapuram , India
(* Title: Rref.thy Author: Jose Divasón <jose.divasonm at unirioja.es> Author: Jesús Aransay <jesus-maria.aransay at unirioja.es> *) section\<open>Reduced row echelon form\<close> theory Rref imports Rank_Nullity_Theorem.Mod_Type Rank_Nullity_Theorem.Miscellaneous begin subsection\<open>Defining the concept of Reduced Row Echelon Form\<close> subsubsection\<open>Previous definitions and properties\<close> text\<open>This function returns True if each position lesser than k in a column contains a zero.\<close> definition is_zero_row_upt_k :: "'rows => nat =>'a::{zero}^'columns::{mod_type}^'rows => bool" where "is_zero_row_upt_k i k A = (\<forall>j::'columns. (to_nat j) < k \<longrightarrow> A $ i $ j = 0)" definition is_zero_row :: "'rows =>'a::{zero}^'columns::{mod_type}^'rows => bool" where "is_zero_row i A = is_zero_row_upt_k i (ncols A) A" lemma is_zero_row_upt_ncols: fixes A::"'a::{zero}^'columns::{mod_type}^'rows" shows "is_zero_row_upt_k i (ncols A) A = (\<forall>j::'columns. A $ i $ j = 0)" unfolding is_zero_row_def is_zero_row_upt_k_def ncols_def by auto corollary is_zero_row_def': fixes A::"'a::{zero}^'columns::{mod_type}^'rows" shows "is_zero_row i A = (\<forall>j::'columns. A $ i $ j = 0)" using is_zero_row_upt_ncols unfolding is_zero_row_def ncols_def . lemma is_zero_row_eq_row_zero: "is_zero_row a A = (row a A = 0)" unfolding is_zero_row_def' row_def unfolding vec_nth_inverse unfolding vec_eq_iff zero_index .. lemma not_is_zero_row_upt_suc: assumes "\<not> is_zero_row_upt_k i (Suc k) A" and "\<forall>i. A $ i $ (from_nat k) = 0" shows "\<not> is_zero_row_upt_k i k A" using assms from_nat_to_nat_id using is_zero_row_upt_k_def less_SucE by metis lemma is_zero_row_upt_k_suc: assumes "is_zero_row_upt_k i k A" and "A $ i $ (from_nat k) = 0" shows "is_zero_row_upt_k i (Suc k) A" using assms unfolding is_zero_row_upt_k_def using less_SucE to_nat_from_nat by metis lemma is_zero_row_utp_0: shows "is_zero_row_upt_k m 0 A" unfolding is_zero_row_upt_k_def by fast lemma is_zero_row_upt_k_le: assumes "is_zero_row_upt_k i (Suc k) A" shows "is_zero_row_upt_k i k A" using assms unfolding is_zero_row_upt_k_def by simp lemma is_zero_row_imp_is_zero_row_upt: assumes "is_zero_row i A" shows "is_zero_row_upt_k i k A" using assms unfolding is_zero_row_def is_zero_row_upt_k_def ncols_def by simp subsubsection\<open>Definition of reduced row echelon form up to a column\<close> text\<open>This definition returns True if a matrix is in reduced row echelon form up to the column k (not included), otherwise False.\<close> (*In the third condition, i<i+1 is assumed to avoid that row i can be the last row (in that case, i+1 would be the first row):*) definition reduced_row_echelon_form_upt_k :: "'a::{zero, one}^'m::{mod_type}^'n::{finite, ord, plus, one} => nat => bool" where "reduced_row_echelon_form_upt_k A k = ( (\<forall>i. is_zero_row_upt_k i k A \<longrightarrow> \<not> (\<exists>j. j>i \<and> \<not> is_zero_row_upt_k j k A)) \<and> (\<forall>i. \<not> (is_zero_row_upt_k i k A) \<longrightarrow> A $ i $ (LEAST k. A $ i $ k \<noteq> 0) = 1) \<and> (\<forall>i. i<i+1 \<and> \<not> (is_zero_row_upt_k i k A) \<and> \<not> (is_zero_row_upt_k (i+1) k A) \<longrightarrow> ((LEAST n. A $ i $ n \<noteq> 0) < (LEAST n. A $ (i+1) $ n \<noteq> 0))) \<and> (\<forall>i. \<not> (is_zero_row_upt_k i k A) \<longrightarrow> (\<forall>j. i \<noteq> j \<longrightarrow> A $ j $ (LEAST n. A $ i $ n \<noteq> 0) = 0)) )" lemma rref_upt_0: "reduced_row_echelon_form_upt_k A 0" unfolding reduced_row_echelon_form_upt_k_def is_zero_row_upt_k_def by auto lemma rref_upt_condition1: assumes r: "reduced_row_echelon_form_upt_k A k" shows "(\<forall>i. is_zero_row_upt_k i k A \<longrightarrow> \<not> (\<exists>j. j>i \<and> \<not> is_zero_row_upt_k j k A))" using r unfolding reduced_row_echelon_form_upt_k_def by simp lemma rref_upt_condition2: assumes r: "reduced_row_echelon_form_upt_k A k" shows "(\<forall>i. \<not> (is_zero_row_upt_k i k A) \<longrightarrow> A $ i $ (LEAST k. A $ i $ k \<noteq> 0) = 1)" using r unfolding reduced_row_echelon_form_upt_k_def by simp lemma rref_upt_condition3: assumes r: "reduced_row_echelon_form_upt_k A k" shows "(\<forall>i. i<i+1 \<and> \<not> (is_zero_row_upt_k i k A) \<and> \<not> (is_zero_row_upt_k (i+1) k A) \<longrightarrow> ((LEAST n. A $ i $ n \<noteq> 0) < (LEAST n. A $ (i+1) $ n \<noteq> 0)))" using r unfolding reduced_row_echelon_form_upt_k_def by simp lemma rref_upt_condition4: assumes r: "reduced_row_echelon_form_upt_k A k" shows " (\<forall>i. \<not> (is_zero_row_upt_k i k A) \<longrightarrow> (\<forall>j. i \<noteq> j \<longrightarrow> A $ j $ (LEAST n. A $ i $ n \<noteq> 0) = 0))" using r unfolding reduced_row_echelon_form_upt_k_def by simp text\<open>Explicit lemmas for each condition\<close> lemma rref_upt_condition1_explicit: assumes "reduced_row_echelon_form_upt_k A k" and "is_zero_row_upt_k i k A" and "j>i" shows "is_zero_row_upt_k j k A" using assms rref_upt_condition1 by blast lemma rref_upt_condition2_explicit: assumes rref_A: "reduced_row_echelon_form_upt_k A k" and "\<not> is_zero_row_upt_k i k A" shows "A $ i $ (LEAST k. A $ i $ k \<noteq> 0) = 1" using rref_upt_condition2 assms by blast lemma rref_upt_condition3_explicit: assumes "reduced_row_echelon_form_upt_k A k" and "i < i + 1" and "\<not> is_zero_row_upt_k i k A" and "\<not> is_zero_row_upt_k (i + 1) k A " shows "(LEAST n. A $ i $ n \<noteq> 0) < (LEAST n. A $ (i + 1) $ n \<noteq> 0)" using assms rref_upt_condition3 by blast lemma rref_upt_condition4_explicit: assumes "reduced_row_echelon_form_upt_k A k" and "\<not> is_zero_row_upt_k i k A" and "i \<noteq> j" shows "A $ j $ (LEAST n. A $ i $ n \<noteq> 0) = 0" using assms rref_upt_condition4 by auto text\<open>Intro lemma and general properties\<close> lemma reduced_row_echelon_form_upt_k_intro: assumes "(\<forall>i. is_zero_row_upt_k i k A \<longrightarrow> \<not> (\<exists>j. j>i \<and> \<not> is_zero_row_upt_k j k A))" and "(\<forall>i. \<not> (is_zero_row_upt_k i k A) \<longrightarrow> A $ i $ (LEAST k. A $ i $ k \<noteq> 0) = 1)" and "(\<forall>i. i<i+1 \<and> \<not> (is_zero_row_upt_k i k A) \<and> \<not> (is_zero_row_upt_k (i+1) k A) \<longrightarrow> ((LEAST n. A $ i $ n \<noteq> 0) < (LEAST n. A $ (i+1) $ n \<noteq> 0)))" and "(\<forall>i. \<not> (is_zero_row_upt_k i k A) \<longrightarrow> (\<forall>j. i \<noteq> j \<longrightarrow> A $ j $ (LEAST n. A $ i $ n \<noteq> 0) = 0))" shows "reduced_row_echelon_form_upt_k A k" unfolding reduced_row_echelon_form_upt_k_def using assms by fast lemma rref_suc_imp_rref: fixes A::"'a::{semiring_1}^'n::{mod_type}^'m::{mod_type}" assumes r: "reduced_row_echelon_form_upt_k A (Suc k)" and k_le_card: "Suc k < ncols A" shows "reduced_row_echelon_form_upt_k A k" proof (rule reduced_row_echelon_form_upt_k_intro) show "\<forall>i. \<not> is_zero_row_upt_k i k A \<longrightarrow> A $ i $ (LEAST k. A $ i $ k \<noteq> 0) = 1" using rref_upt_condition2[OF r] less_SucI unfolding is_zero_row_upt_k_def by blast show "\<forall>i. i < i + 1 \<and> \<not> is_zero_row_upt_k i k A \<and> \<not> is_zero_row_upt_k (i + 1) k A \<longrightarrow> (LEAST n. A $ i $ n \<noteq> 0) < (LEAST n. A $ (i + 1) $ n \<noteq> 0)" using rref_upt_condition3[OF r] less_SucI unfolding is_zero_row_upt_k_def by blast show "\<forall>i. \<not> is_zero_row_upt_k i k A \<longrightarrow> (\<forall>j. i \<noteq> j \<longrightarrow> A $ j $ (LEAST n. A $ i $ n \<noteq> 0) = 0)" using rref_upt_condition4[OF r] less_SucI unfolding is_zero_row_upt_k_def by blast show "\<forall>i. is_zero_row_upt_k i k A \<longrightarrow> \<not> (\<exists>j>i. \<not> is_zero_row_upt_k j k A)" proof (clarify, rule ccontr) fix i j assume zero_i: "is_zero_row_upt_k i k A" and i_less_j: "i < j" and not_zero_j: "\<not> is_zero_row_upt_k j k A" have not_zero_j_suc: "\<not> is_zero_row_upt_k j (Suc k) A" using not_zero_j unfolding is_zero_row_upt_k_def by fastforce hence not_zero_i_suc: "\<not> is_zero_row_upt_k i (Suc k) A" using rref_upt_condition1[OF r] i_less_j by fast have not_zero_i_plus_suc: "\<not> is_zero_row_upt_k (i+1) (Suc k) A" proof (cases "j=i+1") case True thus ?thesis using not_zero_j_suc by simp next case False have "i+1<j" by (rule Suc_less[OF i_less_j False[symmetric]]) thus ?thesis using rref_upt_condition1[OF r] not_zero_j_suc by blast qed from this obtain n where a: "A $ (i+1) $ n \<noteq> 0" and n_less_suc: "to_nat n < Suc k" unfolding is_zero_row_upt_k_def by blast have "(LEAST n. A $ (i+1) $ n \<noteq> 0) \<le> n" by (rule Least_le, simp add: a) also have "... \<le> from_nat k" by (metis Suc_lessD from_nat_mono' from_nat_to_nat_id k_le_card less_Suc_eq_le n_less_suc ncols_def) finally have least_le: "(LEAST n. A $ (i + 1) $ n \<noteq> 0) \<le> from_nat k" . have least_eq_k: "(LEAST n. A $ i $ n \<noteq> 0) = from_nat k" proof (rule Least_equality) show "A $ i $ from_nat k \<noteq> 0" using not_zero_i_suc zero_i unfolding is_zero_row_upt_k_def by (metis from_nat_to_nat_id less_SucE) show "\<And>y. A $ i $ y \<noteq> 0 \<Longrightarrow> from_nat k \<le> y" by (metis is_zero_row_upt_k_def not_le_imp_less to_nat_le zero_i) qed have i_less: "i<i+1" proof (rule Suc_le', rule ccontr) assume "\<not> i + 1 \<noteq> 0" hence "i+1=0" by simp hence "i=-1" using diff_0 diff_add_cancel diff_minus_eq_add by metis hence "j <= i" using Greatest_is_minus_1 by blast thus False using i_less_j by fastforce qed have "from_nat k < (LEAST n. A $ (i+1) $ n \<noteq> 0)" using rref_upt_condition3[OF r] i_less not_zero_i_suc not_zero_i_plus_suc least_eq_k by fastforce thus False using least_le by simp qed qed lemma reduced_row_echelon_if_all_zero: assumes all_zero: "\<forall>n. is_zero_row_upt_k n k A" shows "reduced_row_echelon_form_upt_k A k" using assms unfolding reduced_row_echelon_form_upt_k_def is_zero_row_upt_k_def by auto subsubsection\<open>The definition of reduced row echelon form\<close> text\<open>Definition of reduced row echelon form, based on \<open>reduced_row_echelon_form_upt_k_def\<close>\<close> definition reduced_row_echelon_form :: "'a::{zero, one}^'m::{mod_type}^'n::{finite, ord, plus, one} => bool" where "reduced_row_echelon_form A = reduced_row_echelon_form_upt_k A (ncols A)" text\<open>Equivalence between our definition of reduced row echelon form and the one presented in Steven Roman's book: Advanced Linear Algebra.\<close> lemma reduced_row_echelon_form_def': "reduced_row_echelon_form A = ( (\<forall>i. is_zero_row i A \<longrightarrow> \<not> (\<exists>j. j>i \<and> \<not> is_zero_row j A)) \<and> (\<forall>i. \<not> (is_zero_row i A) \<longrightarrow> A $ i $ (LEAST k. A $ i $ k \<noteq> 0) = 1) \<and> (\<forall>i. i<i+1 \<and> \<not> (is_zero_row i A) \<and> \<not> (is_zero_row (i+1) A) \<longrightarrow> ((LEAST k. A $ i $ k \<noteq> 0) < (LEAST k. A $ (i+1) $ k \<noteq> 0))) \<and> (\<forall>i. \<not> (is_zero_row i A) \<longrightarrow> (\<forall>j. i \<noteq> j \<longrightarrow> A $ j $ (LEAST k. A $ i $ k \<noteq> 0) = 0)) )" unfolding reduced_row_echelon_form_def reduced_row_echelon_form_upt_k_def is_zero_row_def .. subsection\<open>Properties of the reduced row echelon form of a matrix\<close> lemma rref_condition1: assumes r: "reduced_row_echelon_form A" shows "(\<forall>i. is_zero_row i A \<longrightarrow> \<not> (\<exists>j. j>i \<and> \<not> is_zero_row j A))" using r unfolding reduced_row_echelon_form_def' by simp lemma rref_condition2: assumes r: "reduced_row_echelon_form A" shows " (\<forall>i. \<not> (is_zero_row i A) \<longrightarrow> A $ i $ (LEAST k. A $ i $ k \<noteq> 0) = 1)" using r unfolding reduced_row_echelon_form_def' by simp lemma rref_condition3: assumes r: "reduced_row_echelon_form A" shows "(\<forall>i. i<i+1 \<and> \<not> (is_zero_row i A) \<and> \<not> (is_zero_row (i+1) A) \<longrightarrow> ((LEAST n. A $ i $ n \<noteq> 0) < (LEAST n. A $ (i+1) $ n \<noteq> 0)))" using r unfolding reduced_row_echelon_form_def' by simp text\<open>Explicit lemmas for each condition\<close> lemma rref_condition1_explicit: assumes rref_A: "reduced_row_echelon_form A" and "is_zero_row i A" shows "\<forall>j>i. is_zero_row j A" using rref_condition1 assms by blast lemma rref_condition2_explicit: assumes rref_A: "reduced_row_echelon_form A" and "\<not> is_zero_row i A" shows "A $ i $ (LEAST k. A $ i $ k \<noteq> 0) = 1" using rref_condition2 assms by blast lemma rref_condition3_explicit: assumes rref_A: "reduced_row_echelon_form A" and i_le: "i < i + 1" and "\<not> is_zero_row i A" and "\<not> is_zero_row (i + 1) A" shows "(LEAST n. A $ i $ n \<noteq> 0) < (LEAST n. A $ (i + 1) $ n \<noteq> 0)" using rref_condition3 assms by blast lemma rref_condition4_explicit: assumes rref_A: "reduced_row_echelon_form A" and "\<not> is_zero_row i A" and "i \<noteq> j" shows "A $ j $ (LEAST n. A $ i $ n \<noteq> 0) = 0" using rref_condition4 assms by blast text\<open>Other properties and equivalences\<close> lemma rref_condition3_equiv1: fixes A::"'a::{one, zero}^'cols::{mod_type}^'rows::{mod_type}" assumes rref: "reduced_row_echelon_form A" and i_less_j: "i<j" and j_less_nrows: "j<nrows A" and not_zero_i: "\<not> is_zero_row (from_nat i) A" and not_zero_j: "\<not> is_zero_row (from_nat j) A" shows "(LEAST n. A $ (from_nat i) $ n \<noteq> 0) < (LEAST n. A $ (from_nat j) $ n \<noteq> 0)" using i_less_j not_zero_j j_less_nrows proof (induct j) case 0 show ?case using "0.prems"(1) by simp next fix j assume hyp: "i < j \<Longrightarrow> \<not> is_zero_row (from_nat j) A \<Longrightarrow> j < nrows A \<Longrightarrow> (LEAST n. A $ from_nat i $ n \<noteq> 0) < (LEAST n. A $ from_nat j $ n \<noteq> 0)" and i_less_suc_j: "i < Suc j" and not_zero_suc_j: "\<not> is_zero_row (from_nat (Suc j)) A" and Suc_j_less_nrows: "Suc j < nrows A" have j_less: "(from_nat j::'rows) < from_nat (j+1)" by (rule from_nat_mono, auto simp add: Suc_j_less_nrows[unfolded nrows_def]) hence not_zero_j: "\<not> is_zero_row (from_nat j) A" using rref_condition1[OF rref] not_zero_suc_j unfolding Suc_eq_plus1 by blast show "(LEAST n. A $ from_nat i $ n \<noteq> 0) < (LEAST n. A $ from_nat (Suc j) $ n \<noteq> 0)" proof (cases "i=j") case True show ?thesis proof (unfold True Suc_eq_plus1 from_nat_suc, rule rref_condition3_explicit) show "reduced_row_echelon_form A" using rref . show "(from_nat j::'rows) < from_nat j + 1" using j_less unfolding from_nat_suc . show "\<not> is_zero_row (from_nat j) A" using not_zero_j . show "\<not> is_zero_row (from_nat j + 1) A" using not_zero_suc_j unfolding Suc_eq_plus1 from_nat_suc . qed next case False have "(LEAST n. A $ from_nat i $ n \<noteq> 0) < (LEAST n. A $ from_nat j $ n \<noteq> 0)" proof (rule hyp) show "i < j" using False i_less_suc_j by simp show "\<not> is_zero_row (from_nat j) A" using not_zero_j . show "j < nrows A" using Suc_j_less_nrows by simp qed also have "... < (LEAST n. A $ from_nat (j+1) $ n \<noteq> 0)" proof (unfold from_nat_suc, rule rref_condition3_explicit) show "reduced_row_echelon_form A" using rref . show "(from_nat j::'rows) < from_nat j + 1" using j_less unfolding from_nat_suc . show "\<not> is_zero_row (from_nat j) A" using not_zero_j . show "\<not> is_zero_row (from_nat j + 1) A" using not_zero_suc_j unfolding Suc_eq_plus1 from_nat_suc . qed finally show "(LEAST n. A $ from_nat i $ n \<noteq> 0) < (LEAST n. A $ from_nat (Suc j) $ n \<noteq> 0)" unfolding Suc_eq_plus1 . qed qed corollary rref_condition3_equiv: fixes A::"'a::{one, zero}^'cols::{mod_type}^'rows::{mod_type}" assumes rref: "reduced_row_echelon_form A" and i_less_j: "i<j" and i: "\<not> is_zero_row i A" and j: "\<not> is_zero_row j A" shows "(LEAST n. A $ i $ n \<noteq> 0) < (LEAST n. A $ j $ n \<noteq> 0)" proof (rule rref_condition3_equiv1[of A "to_nat i" "to_nat j", unfolded from_nat_to_nat_id]) show "reduced_row_echelon_form A" using rref . show "to_nat i < to_nat j" by (rule to_nat_mono[OF i_less_j]) show "to_nat j < nrows A" using to_nat_less_card unfolding nrows_def . show "\<not> is_zero_row i A" using i . show "\<not> is_zero_row j A" using j . qed lemma rref_implies_rref_upt: fixes A::"'a::{one,zero}^'cols::{mod_type}^'rows::{mod_type}" assumes rref: "reduced_row_echelon_form A" shows "reduced_row_echelon_form_upt_k A k" proof (rule reduced_row_echelon_form_upt_k_intro) show "\<forall>i. \<not> is_zero_row_upt_k i k A \<longrightarrow> A $ i $ (LEAST k. A $ i $ k \<noteq> 0) = 1" using rref_condition2[OF rref] is_zero_row_imp_is_zero_row_upt by blast show "\<forall>i. i < i + 1 \<and> \<not> is_zero_row_upt_k i k A \<and> \<not> is_zero_row_upt_k (i + 1) k A \<longrightarrow> (LEAST n. A $ i $ n \<noteq> 0) < (LEAST n. A $ (i + 1) $ n \<noteq> 0)" using rref_condition3[OF rref] is_zero_row_imp_is_zero_row_upt by blast show "\<forall>i. \<not> is_zero_row_upt_k i k A \<longrightarrow> (\<forall>j. i \<noteq> j \<longrightarrow> A $ j $ (LEAST n. A $ i $ n \<noteq> 0) = 0)" using rref_condition4[OF rref] is_zero_row_imp_is_zero_row_upt by blast show "\<forall>i. is_zero_row_upt_k i k A \<longrightarrow> \<not> (\<exists>j>i. \<not> is_zero_row_upt_k j k A)" proof (auto, rule ccontr) fix i j assume zero_i_k: "is_zero_row_upt_k i k A" and i_less_j: "i < j" and not_zero_j_k:"\<not> is_zero_row_upt_k j k A" have not_zero_j: "\<not> is_zero_row j A" using is_zero_row_imp_is_zero_row_upt not_zero_j_k by blast hence not_zero_i: "\<not> is_zero_row i A" using rref_condition1[OF rref] i_less_j by blast have Least_less: "(LEAST n. A $ i $ n \<noteq> 0) < (LEAST n. A $ j $ n \<noteq> 0)" by (rule rref_condition3_equiv[OF rref i_less_j not_zero_i not_zero_j]) moreover have "(LEAST n. A $ j $ n \<noteq> 0) < (LEAST n. A $ i $ n \<noteq> 0)" proof (rule LeastI2_ex) show "\<exists>a. A $ i $ a \<noteq> 0" using not_zero_i unfolding is_zero_row_def is_zero_row_upt_k_def by fast fix x assume Aix_not_0: "A $ i $ x \<noteq> 0" have k_less_x: "k \<le> to_nat x" using zero_i_k Aix_not_0 unfolding is_zero_row_upt_k_def by force hence k_less_ncols: "k < ncols A" unfolding ncols_def using to_nat_less_card[of x] by simp obtain s where Ajs_not_zero: "A $ j $ s \<noteq> 0" and s_less_k: "to_nat s < k" using not_zero_j_k unfolding is_zero_row_upt_k_def by blast have "(LEAST n. A $ j $ n \<noteq> 0) \<le> s" using Ajs_not_zero Least_le by fast also have "... = from_nat (to_nat s)" unfolding from_nat_to_nat_id .. also have "... < from_nat k" by (rule from_nat_mono[OF s_less_k k_less_ncols[unfolded ncols_def]]) also have "... \<le> x" using k_less_x leD not_le_imp_less to_nat_le by fast finally show "(LEAST n. A $ j $ n \<noteq> 0) < x" . qed ultimately show False by fastforce qed qed lemma rref_first_position_zero_imp_column_0: fixes A::"'a::{one,zero}^'cols::{mod_type}^'rows::{mod_type}" assumes rref: "reduced_row_echelon_form A" and A_00: "A $ 0 $ 0 = 0" shows "column 0 A = 0" proof (unfold column_def, vector, clarify) fix i have "is_zero_row_upt_k 0 1 A" unfolding is_zero_row_upt_k_def using A_00 by (metis One_nat_def less_Suc0 to_nat_eq_0) hence "is_zero_row_upt_k i 1 A" using rref_upt_condition1[OF rref_implies_rref_upt[OF rref]] using least_mod_type less_le by metis thus "A $ i $ 0 = 0" unfolding is_zero_row_upt_k_def using to_nat_eq_0 by blast qed lemma rref_first_element: fixes A::"'a::{one,zero}^'cols::{mod_type}^'rows::{mod_type}" assumes rref: "reduced_row_echelon_form A" and column_not_0: "column 0 A \<noteq> 0" shows "A $ 0 $ 0 = 1" proof (rule ccontr) have A_00_not_0: "A $ 0 $ 0 \<noteq> 0" proof (rule ccontr, simp) assume A_00: "A $ 0 $ 0 = 0" from this obtain i where Ai0: "A $ i $ 0 \<noteq> 0" and i: "i>0" using column_not_0 unfolding column_def by (metis column_def rref rref_first_position_zero_imp_column_0) have "is_zero_row_upt_k 0 1 A" unfolding is_zero_row_upt_k_def using A_00 by (metis One_nat_def less_Suc0 to_nat_eq_0) moreover have "\<not> is_zero_row_upt_k i 1 A" using Ai0 by (metis is_zero_row_upt_k_def to_nat_0 zero_less_one) ultimately have "\<not> reduced_row_echelon_form A" by (metis A_00 column_not_0 rref_first_position_zero_imp_column_0) thus False using rref by contradiction qed assume A_00_not_1: "A $ 0 $ 0 \<noteq> 1" have Least_eq_0: "(LEAST n. A $ 0 $ n \<noteq> 0) = 0" proof (rule Least_equality) show "A $ 0 $ 0 \<noteq> 0" by (rule A_00_not_0) show "\<And>y. A $ 0 $ y \<noteq> 0 \<Longrightarrow> 0 \<le> y" using least_mod_type . qed moreover have "\<not> is_zero_row 0 A" unfolding is_zero_row_def is_zero_row_upt_k_def ncols_def using A_00_not_0 by auto ultimately have "A $ 0 $ (LEAST n. A $ 0 $ n \<noteq> 0) = 1" using rref_condition2[OF rref] by fast thus False unfolding Least_eq_0 using A_00_not_1 by contradiction qed end
{-# OPTIONS --without-K --rewriting #-} open import HoTT module stash.modalities.FiberedPushout {i j k} {X : Type i} {Y : Type j} where {- X ---glue-left--- P ---glue-right--- Y -} module _ (P : X → Y → Type k) where fibered-pushout-span : Span fibered-pushout-span = record { A = Σ X λ x → Σ Y λ y → P x y ; B = Coprod X Y ; C = Coprod (Σ X λ x → Σ Y λ y → P x y) (Σ X λ x → Σ Y λ y → P x y) ; f = λ{ (inl p) → p ; (inr p) → p} ; g = λ{ (inl p) → inl (fst p) ; (inr p) → inr (fst (snd p))} } FiberedPushout : Type (lmax (lmax i j) k) FiberedPushout = Pushout fibered-pushout-span module _ {P : X → Y → Type k} where in-left : X → FiberedPushout P in-left = right ∘ inl in-right : Y → FiberedPushout P in-right = right ∘ inr in-mid : ∀ {x y} → P x y → FiberedPushout P in-mid p = left (_ , _ , p) glue-left : ∀ {x y} (p : P x y) → in-mid p == in-left x glue-left p = glue (inl (_ , _ , p)) glue-right : ∀ {x y} (p : P x y) → in-mid p == in-right y glue-right p = glue (inr (_ , _ , p)) module FiberedPushoutElim {l} (C : FiberedPushout P → Type l) (b1 : (x : X) → C (in-left x)) (b2 : (x : X) (y : Y) (p : P x y) → C (in-mid p)) (b3 : (y : Y) → C (in-right y)) (glue-left' : (x : X) (y : Y) (p : P x y) → b2 x y p == b1 x [ C ↓ glue-left p ]) (glue-right' : (x : X) (y : Y) (p : P x y) → b2 x y p == b3 y [ C ↓ glue-right p ]) where private module PElim = PushoutElim {d = fibered-pushout-span P} {P = C} (λ{(x , y , p) → b2 x y p}) (λ{(inl x) → b1 x ; (inr y) → b3 y}) (λ{(inl (_ , _ , p)) → glue-left' _ _ p ; (inr (_ , _ , p)) → glue-right' _ _ p}) f = PElim.f glue-left-β : ∀ {x y} (p : P x y) → apd f (glue-left p) == glue-left' x y p glue-left-β p = PElim.glue-β (inl (_ , _ , p)) glue-right-β : ∀ {x y} (p : P x y) → apd f (glue-right p) == glue-right' x y p glue-right-β p = PElim.glue-β (inr (_ , _ , p))
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl -/ import algebra.geom_sum import analysis.asymptotics.asymptotics import order.filter.archimedean import order.iterate import topology.instances.ennreal /-! # A collection of specific limit computations -/ noncomputable theory open classical set function filter finset metric asymptotics open_locale classical topological_space nat big_operators uniformity nnreal ennreal variables {α : Type*} {β : Type*} {ι : Type*} lemma tendsto_norm_at_top_at_top : tendsto (norm : ℝ → ℝ) at_top at_top := tendsto_abs_at_top_at_top lemma summable_of_absolute_convergence_real {f : ℕ → ℝ} : (∃r, tendsto (λn, (∑ i in range n, |f i|)) at_top (𝓝 r)) → summable f | ⟨r, hr⟩ := begin refine summable_of_summable_norm ⟨r, (has_sum_iff_tendsto_nat_of_nonneg _ _).2 _⟩, exact assume i, norm_nonneg _, simpa only using hr end lemma tendsto_inverse_at_top_nhds_0_nat : tendsto (λ n : ℕ, (n : ℝ)⁻¹) at_top (𝓝 0) := tendsto_inv_at_top_zero.comp tendsto_coe_nat_at_top_at_top lemma tendsto_const_div_at_top_nhds_0_nat (C : ℝ) : tendsto (λ n : ℕ, C / n) at_top (𝓝 0) := by simpa only [mul_zero] using tendsto_const_nhds.mul tendsto_inverse_at_top_nhds_0_nat lemma nnreal.tendsto_inverse_at_top_nhds_0_nat : tendsto (λ n : ℕ, (n : ℝ≥0)⁻¹) at_top (𝓝 0) := by { rw ← nnreal.tendsto_coe, convert tendsto_inverse_at_top_nhds_0_nat, simp } lemma nnreal.tendsto_const_div_at_top_nhds_0_nat (C : ℝ≥0) : tendsto (λ n : ℕ, C / n) at_top (𝓝 0) := by simpa using tendsto_const_nhds.mul nnreal.tendsto_inverse_at_top_nhds_0_nat lemma tendsto_one_div_add_at_top_nhds_0_nat : tendsto (λ n : ℕ, 1 / ((n : ℝ) + 1)) at_top (𝓝 0) := suffices tendsto (λ n : ℕ, 1 / (↑(n + 1) : ℝ)) at_top (𝓝 0), by simpa, (tendsto_add_at_top_iff_nat 1).2 (tendsto_const_div_at_top_nhds_0_nat 1) /-! ### Powers -/ lemma tendsto_add_one_pow_at_top_at_top_of_pos [linear_ordered_semiring α] [archimedean α] {r : α} (h : 0 < r) : tendsto (λ n:ℕ, (r + 1)^n) at_top at_top := tendsto_at_top_at_top_of_monotone' (λ n m, pow_le_pow (le_add_of_nonneg_left (le_of_lt h))) $ not_bdd_above_iff.2 $ λ x, set.exists_range_iff.2 $ add_one_pow_unbounded_of_pos _ h lemma tendsto_pow_at_top_at_top_of_one_lt [linear_ordered_ring α] [archimedean α] {r : α} (h : 1 < r) : tendsto (λn:ℕ, r ^ n) at_top at_top := sub_add_cancel r 1 ▸ tendsto_add_one_pow_at_top_at_top_of_pos (sub_pos.2 h) lemma nat.tendsto_pow_at_top_at_top_of_one_lt {m : ℕ} (h : 1 < m) : tendsto (λn:ℕ, m ^ n) at_top at_top := tsub_add_cancel_of_le (le_of_lt h) ▸ tendsto_add_one_pow_at_top_at_top_of_pos (tsub_pos_of_lt h) lemma tendsto_norm_zero' {𝕜 : Type*} [normed_group 𝕜] : tendsto (norm : 𝕜 → ℝ) (𝓝[{0}ᶜ] 0) (𝓝[set.Ioi 0] 0) := tendsto_norm_zero.inf $ tendsto_principal_principal.2 $ λ x hx, norm_pos_iff.2 hx namespace normed_field lemma tendsto_norm_inverse_nhds_within_0_at_top {𝕜 : Type*} [normed_field 𝕜] : tendsto (λ x:𝕜, ∥x⁻¹∥) (𝓝[{0}ᶜ] 0) at_top := (tendsto_inv_zero_at_top.comp tendsto_norm_zero').congr $ λ x, (normed_field.norm_inv x).symm lemma tendsto_norm_zpow_nhds_within_0_at_top {𝕜 : Type*} [normed_field 𝕜] {m : ℤ} (hm : m < 0) : tendsto (λ x : 𝕜, ∥x ^ m∥) (𝓝[{0}ᶜ] 0) at_top := begin rcases neg_surjective m with ⟨m, rfl⟩, rw neg_lt_zero at hm, lift m to ℕ using hm.le, rw int.coe_nat_pos at hm, simp only [normed_field.norm_pow, zpow_neg₀, zpow_coe_nat, ← inv_pow₀], exact (tendsto_pow_at_top hm).comp normed_field.tendsto_norm_inverse_nhds_within_0_at_top end @[simp] lemma continuous_at_zpow {𝕜 : Type*} [nondiscrete_normed_field 𝕜] {m : ℤ} {x : 𝕜} : continuous_at (λ x, x ^ m) x ↔ x ≠ 0 ∨ 0 ≤ m := begin refine ⟨_, continuous_at_zpow _ _⟩, contrapose!, rintro ⟨rfl, hm⟩ hc, exact not_tendsto_at_top_of_tendsto_nhds (hc.tendsto.mono_left nhds_within_le_nhds).norm (tendsto_norm_zpow_nhds_within_0_at_top hm) end @[simp] lemma continuous_at_inv {𝕜 : Type*} [nondiscrete_normed_field 𝕜] {x : 𝕜} : continuous_at has_inv.inv x ↔ x ≠ 0 := by simpa [(@zero_lt_one ℤ _ _).not_le] using @continuous_at_zpow _ _ (-1) x end normed_field lemma tendsto_pow_at_top_nhds_0_of_lt_1 {𝕜 : Type*} [linear_ordered_field 𝕜] [archimedean 𝕜] [topological_space 𝕜] [order_topology 𝕜] {r : 𝕜} (h₁ : 0 ≤ r) (h₂ : r < 1) : tendsto (λn:ℕ, r^n) at_top (𝓝 0) := h₁.eq_or_lt.elim (assume : 0 = r, (tendsto_add_at_top_iff_nat 1).mp $ by simp [pow_succ, ← this, tendsto_const_nhds]) (assume : 0 < r, have tendsto (λn, (r⁻¹ ^ n)⁻¹) at_top (𝓝 0), from tendsto_inv_at_top_zero.comp (tendsto_pow_at_top_at_top_of_one_lt $ one_lt_inv this h₂), this.congr (λ n, by simp)) lemma tendsto_pow_at_top_nhds_within_0_of_lt_1 {𝕜 : Type*} [linear_ordered_field 𝕜] [archimedean 𝕜] [topological_space 𝕜] [order_topology 𝕜] {r : 𝕜} (h₁ : 0 < r) (h₂ : r < 1) : tendsto (λn:ℕ, r^n) at_top (𝓝[Ioi 0] 0) := tendsto_inf.2 ⟨tendsto_pow_at_top_nhds_0_of_lt_1 h₁.le h₂, tendsto_principal.2 $ eventually_of_forall $ λ n, pow_pos h₁ _⟩ lemma is_o_pow_pow_of_lt_left {r₁ r₂ : ℝ} (h₁ : 0 ≤ r₁) (h₂ : r₁ < r₂) : is_o (λ n : ℕ, r₁ ^ n) (λ n, r₂ ^ n) at_top := have H : 0 < r₂ := h₁.trans_lt h₂, is_o_of_tendsto (λ n hn, false.elim $ H.ne' $ pow_eq_zero hn) $ (tendsto_pow_at_top_nhds_0_of_lt_1 (div_nonneg h₁ (h₁.trans h₂.le)) ((div_lt_one H).2 h₂)).congr (λ n, div_pow _ _ _) lemma is_O_pow_pow_of_le_left {r₁ r₂ : ℝ} (h₁ : 0 ≤ r₁) (h₂ : r₁ ≤ r₂) : is_O (λ n : ℕ, r₁ ^ n) (λ n, r₂ ^ n) at_top := h₂.eq_or_lt.elim (λ h, h ▸ is_O_refl _ _) (λ h, (is_o_pow_pow_of_lt_left h₁ h).is_O) lemma is_o_pow_pow_of_abs_lt_left {r₁ r₂ : ℝ} (h : |r₁| < |r₂|) : is_o (λ n : ℕ, r₁ ^ n) (λ n, r₂ ^ n) at_top := begin refine (is_o.of_norm_left _).of_norm_right, exact (is_o_pow_pow_of_lt_left (abs_nonneg r₁) h).congr (pow_abs r₁) (pow_abs r₂) end /-- Various statements equivalent to the fact that `f n` grows exponentially slower than `R ^ n`. * 0: $f n = o(a ^ n)$ for some $-R < a < R$; * 1: $f n = o(a ^ n)$ for some $0 < a < R$; * 2: $f n = O(a ^ n)$ for some $-R < a < R$; * 3: $f n = O(a ^ n)$ for some $0 < a < R$; * 4: there exist `a < R` and `C` such that one of `C` and `R` is positive and $|f n| ≤ Ca^n$ for all `n`; * 5: there exists `0 < a < R` and a positive `C` such that $|f n| ≤ Ca^n$ for all `n`; * 6: there exists `a < R` such that $|f n| ≤ a ^ n$ for sufficiently large `n`; * 7: there exists `0 < a < R` such that $|f n| ≤ a ^ n$ for sufficiently large `n`. NB: For backwards compatibility, if you add more items to the list, please append them at the end of the list. -/ lemma tfae_exists_lt_is_o_pow (f : ℕ → ℝ) (R : ℝ) : tfae [∃ a ∈ Ioo (-R) R, is_o f (pow a) at_top, ∃ a ∈ Ioo 0 R, is_o f (pow a) at_top, ∃ a ∈ Ioo (-R) R, is_O f (pow a) at_top, ∃ a ∈ Ioo 0 R, is_O f (pow a) at_top, ∃ (a < R) C (h₀ : 0 < C ∨ 0 < R), ∀ n, |f n| ≤ C * a ^ n, ∃ (a ∈ Ioo 0 R) (C > 0), ∀ n, |f n| ≤ C * a ^ n, ∃ a < R, ∀ᶠ n in at_top, |f n| ≤ a ^ n, ∃ a ∈ Ioo 0 R, ∀ᶠ n in at_top, |f n| ≤ a ^ n] := begin have A : Ico 0 R ⊆ Ioo (-R) R, from λ x hx, ⟨(neg_lt_zero.2 (hx.1.trans_lt hx.2)).trans_le hx.1, hx.2⟩, have B : Ioo 0 R ⊆ Ioo (-R) R := subset.trans Ioo_subset_Ico_self A, -- First we prove that 1-4 are equivalent using 2 → 3 → 4, 1 → 3, and 2 → 1 tfae_have : 1 → 3, from λ ⟨a, ha, H⟩, ⟨a, ha, H.is_O⟩, tfae_have : 2 → 1, from λ ⟨a, ha, H⟩, ⟨a, B ha, H⟩, tfae_have : 3 → 2, { rintro ⟨a, ha, H⟩, rcases exists_between (abs_lt.2 ha) with ⟨b, hab, hbR⟩, exact ⟨b, ⟨(abs_nonneg a).trans_lt hab, hbR⟩, H.trans_is_o (is_o_pow_pow_of_abs_lt_left (hab.trans_le (le_abs_self b)))⟩ }, tfae_have : 2 → 4, from λ ⟨a, ha, H⟩, ⟨a, ha, H.is_O⟩, tfae_have : 4 → 3, from λ ⟨a, ha, H⟩, ⟨a, B ha, H⟩, -- Add 5 and 6 using 4 → 6 → 5 → 3 tfae_have : 4 → 6, { rintro ⟨a, ha, H⟩, rcases bound_of_is_O_nat_at_top H with ⟨C, hC₀, hC⟩, refine ⟨a, ha, C, hC₀, λ n, _⟩, simpa only [real.norm_eq_abs, abs_pow, abs_of_nonneg ha.1.le] using hC (pow_ne_zero n ha.1.ne') }, tfae_have : 6 → 5, from λ ⟨a, ha, C, H₀, H⟩, ⟨a, ha.2, C, or.inl H₀, H⟩, tfae_have : 5 → 3, { rintro ⟨a, ha, C, h₀, H⟩, rcases sign_cases_of_C_mul_pow_nonneg (λ n, (abs_nonneg _).trans (H n)) with rfl | ⟨hC₀, ha₀⟩, { obtain rfl : f = 0, by { ext n, simpa using H n }, simp only [lt_irrefl, false_or] at h₀, exact ⟨0, ⟨neg_lt_zero.2 h₀, h₀⟩, is_O_zero _ _⟩ }, exact ⟨a, A ⟨ha₀, ha⟩, is_O_of_le' _ (λ n, (H n).trans $ mul_le_mul_of_nonneg_left (le_abs_self _) hC₀.le)⟩ }, -- Add 7 and 8 using 2 → 8 → 7 → 3 tfae_have : 2 → 8, { rintro ⟨a, ha, H⟩, refine ⟨a, ha, (H.def zero_lt_one).mono (λ n hn, _)⟩, rwa [real.norm_eq_abs, real.norm_eq_abs, one_mul, abs_pow, abs_of_pos ha.1] at hn }, tfae_have : 8 → 7, from λ ⟨a, ha, H⟩, ⟨a, ha.2, H⟩, tfae_have : 7 → 3, { rintro ⟨a, ha, H⟩, have : 0 ≤ a, from nonneg_of_eventually_pow_nonneg (H.mono $ λ n, (abs_nonneg _).trans), refine ⟨a, A ⟨this, ha⟩, is_O.of_bound 1 _⟩, simpa only [real.norm_eq_abs, one_mul, abs_pow, abs_of_nonneg this] }, tfae_finish end lemma uniformity_basis_dist_pow_of_lt_1 {α : Type*} [pseudo_metric_space α] {r : ℝ} (h₀ : 0 < r) (h₁ : r < 1) : (𝓤 α).has_basis (λ k : ℕ, true) (λ k, {p : α × α | dist p.1 p.2 < r ^ k}) := metric.mk_uniformity_basis (λ i _, pow_pos h₀ _) $ λ ε ε0, (exists_pow_lt_of_lt_one ε0 h₁).imp $ λ k hk, ⟨trivial, hk.le⟩ lemma geom_lt {u : ℕ → ℝ} {c : ℝ} (hc : 0 ≤ c) {n : ℕ} (hn : 0 < n) (h : ∀ k < n, c * u k < u (k + 1)) : c ^ n * u 0 < u n := begin refine (monotone_mul_left_of_nonneg hc).seq_pos_lt_seq_of_le_of_lt hn _ _ h, { simp }, { simp [pow_succ, mul_assoc, le_refl] } end lemma geom_le {u : ℕ → ℝ} {c : ℝ} (hc : 0 ≤ c) (n : ℕ) (h : ∀ k < n, c * u k ≤ u (k + 1)) : c ^ n * u 0 ≤ u n := by refine (monotone_mul_left_of_nonneg hc).seq_le_seq n _ _ h; simp [pow_succ, mul_assoc, le_refl] lemma lt_geom {u : ℕ → ℝ} {c : ℝ} (hc : 0 ≤ c) {n : ℕ} (hn : 0 < n) (h : ∀ k < n, u (k + 1) < c * u k) : u n < c ^ n * u 0 := begin refine (monotone_mul_left_of_nonneg hc).seq_pos_lt_seq_of_lt_of_le hn _ h _, { simp }, { simp [pow_succ, mul_assoc, le_refl] } end lemma le_geom {u : ℕ → ℝ} {c : ℝ} (hc : 0 ≤ c) (n : ℕ) (h : ∀ k < n, u (k + 1) ≤ c * u k) : u n ≤ (c ^ n) * u 0 := by refine (monotone_mul_left_of_nonneg hc).seq_le_seq n _ h _; simp [pow_succ, mul_assoc, le_refl] /-- For any natural `k` and a real `r > 1` we have `n ^ k = o(r ^ n)` as `n → ∞`. -/ lemma is_o_pow_const_const_pow_of_one_lt {R : Type*} [normed_ring R] (k : ℕ) {r : ℝ} (hr : 1 < r) : is_o (λ n, n ^ k : ℕ → R) (λ n, r ^ n) at_top := begin have : tendsto (λ x : ℝ, x ^ k) (𝓝[Ioi 1] 1) (𝓝 1), from ((continuous_id.pow k).tendsto' (1 : ℝ) 1 (one_pow _)).mono_left inf_le_left, obtain ⟨r' : ℝ, hr' : r' ^ k < r, h1 : 1 < r'⟩ := ((this.eventually (gt_mem_nhds hr)).and self_mem_nhds_within).exists, have h0 : 0 ≤ r' := zero_le_one.trans h1.le, suffices : is_O _ (λ n : ℕ, (r' ^ k) ^ n) at_top, from this.trans_is_o (is_o_pow_pow_of_lt_left (pow_nonneg h0 _) hr'), conv in ((r' ^ _) ^ _) { rw [← pow_mul, mul_comm, pow_mul] }, suffices : ∀ n : ℕ, ∥(n : R)∥ ≤ (r' - 1)⁻¹ * ∥(1 : R)∥ * ∥r' ^ n∥, from (is_O_of_le' _ this).pow _, intro n, rw mul_right_comm, refine n.norm_cast_le.trans (mul_le_mul_of_nonneg_right _ (norm_nonneg _)), simpa [div_eq_inv_mul, real.norm_eq_abs, abs_of_nonneg h0] using n.cast_le_pow_div_sub h1 end /-- For a real `r > 1` we have `n = o(r ^ n)` as `n → ∞`. -/ lemma is_o_coe_const_pow_of_one_lt {R : Type*} [normed_ring R] {r : ℝ} (hr : 1 < r) : is_o (coe : ℕ → R) (λ n, r ^ n) at_top := by simpa only [pow_one] using is_o_pow_const_const_pow_of_one_lt 1 hr /-- If `∥r₁∥ < r₂`, then for any naturak `k` we have `n ^ k r₁ ^ n = o (r₂ ^ n)` as `n → ∞`. -/ lemma is_o_pow_const_mul_const_pow_const_pow_of_norm_lt {R : Type*} [normed_ring R] (k : ℕ) {r₁ : R} {r₂ : ℝ} (h : ∥r₁∥ < r₂) : is_o (λ n, n ^ k * r₁ ^ n : ℕ → R) (λ n, r₂ ^ n) at_top := begin by_cases h0 : r₁ = 0, { refine (is_o_zero _ _).congr' (mem_at_top_sets.2 $ ⟨1, λ n hn, _⟩) eventually_eq.rfl, simp [zero_pow (zero_lt_one.trans_le hn), h0] }, rw [← ne.def, ← norm_pos_iff] at h0, have A : is_o (λ n, n ^ k : ℕ → R) (λ n, (r₂ / ∥r₁∥) ^ n) at_top, from is_o_pow_const_const_pow_of_one_lt k ((one_lt_div h0).2 h), suffices : is_O (λ n, r₁ ^ n) (λ n, ∥r₁∥ ^ n) at_top, by simpa [div_mul_cancel _ (pow_pos h0 _).ne'] using A.mul_is_O this, exact is_O.of_bound 1 (by simpa using eventually_norm_pow_le r₁) end lemma tendsto_pow_const_div_const_pow_of_one_lt (k : ℕ) {r : ℝ} (hr : 1 < r) : tendsto (λ n, n ^ k / r ^ n : ℕ → ℝ) at_top (𝓝 0) := (is_o_pow_const_const_pow_of_one_lt k hr).tendsto_0 /-- If `|r| < 1`, then `n ^ k r ^ n` tends to zero for any natural `k`. -/ lemma tendsto_pow_const_mul_const_pow_of_abs_lt_one (k : ℕ) {r : ℝ} (hr : |r| < 1) : tendsto (λ n, n ^ k * r ^ n : ℕ → ℝ) at_top (𝓝 0) := begin by_cases h0 : r = 0, { exact tendsto_const_nhds.congr' (mem_at_top_sets.2 ⟨1, λ n hn, by simp [zero_lt_one.trans_le hn, h0]⟩) }, have hr' : 1 < (|r|)⁻¹, from one_lt_inv (abs_pos.2 h0) hr, rw tendsto_zero_iff_norm_tendsto_zero, simpa [div_eq_mul_inv] using tendsto_pow_const_div_const_pow_of_one_lt k hr' end /-- If a sequence `v` of real numbers satisfies `k * v n ≤ v (n+1)` with `1 < k`, then it goes to +∞. -/ lemma tendsto_at_top_of_geom_le {v : ℕ → ℝ} {c : ℝ} (h₀ : 0 < v 0) (hc : 1 < c) (hu : ∀ n, c * v n ≤ v (n + 1)) : tendsto v at_top at_top := tendsto_at_top_mono (λ n, geom_le (zero_le_one.trans hc.le) n (λ k hk, hu k)) $ (tendsto_pow_at_top_at_top_of_one_lt hc).at_top_mul_const h₀ lemma nnreal.tendsto_pow_at_top_nhds_0_of_lt_1 {r : ℝ≥0} (hr : r < 1) : tendsto (λ n:ℕ, r^n) at_top (𝓝 0) := nnreal.tendsto_coe.1 $ by simp only [nnreal.coe_pow, nnreal.coe_zero, tendsto_pow_at_top_nhds_0_of_lt_1 r.coe_nonneg hr] lemma ennreal.tendsto_pow_at_top_nhds_0_of_lt_1 {r : ℝ≥0∞} (hr : r < 1) : tendsto (λ n:ℕ, r^n) at_top (𝓝 0) := begin rcases ennreal.lt_iff_exists_coe.1 hr with ⟨r, rfl, hr'⟩, rw [← ennreal.coe_zero], norm_cast at *, apply nnreal.tendsto_pow_at_top_nhds_0_of_lt_1 hr end /-- In a normed ring, the powers of an element x with `∥x∥ < 1` tend to zero. -/ lemma tendsto_pow_at_top_nhds_0_of_norm_lt_1 {R : Type*} [normed_ring R] {x : R} (h : ∥x∥ < 1) : tendsto (λ (n : ℕ), x ^ n) at_top (𝓝 0) := begin apply squeeze_zero_norm' (eventually_norm_pow_le x), exact tendsto_pow_at_top_nhds_0_of_lt_1 (norm_nonneg _) h, end lemma tendsto_pow_at_top_nhds_0_of_abs_lt_1 {r : ℝ} (h : |r| < 1) : tendsto (λn:ℕ, r^n) at_top (𝓝 0) := tendsto_pow_at_top_nhds_0_of_norm_lt_1 h /-! ### Geometric series-/ section geometric lemma has_sum_geometric_of_lt_1 {r : ℝ} (h₁ : 0 ≤ r) (h₂ : r < 1) : has_sum (λn:ℕ, r ^ n) (1 - r)⁻¹ := have r ≠ 1, from ne_of_lt h₂, have tendsto (λn, (r ^ n - 1) * (r - 1)⁻¹) at_top (𝓝 ((0 - 1) * (r - 1)⁻¹)), from ((tendsto_pow_at_top_nhds_0_of_lt_1 h₁ h₂).sub tendsto_const_nhds).mul tendsto_const_nhds, have (λ n, (∑ i in range n, r ^ i)) = (λ n, geom_sum r n) := rfl, (has_sum_iff_tendsto_nat_of_nonneg (pow_nonneg h₁) _).mpr $ by simp [neg_inv, geom_sum_eq, div_eq_mul_inv, *] at * lemma summable_geometric_of_lt_1 {r : ℝ} (h₁ : 0 ≤ r) (h₂ : r < 1) : summable (λn:ℕ, r ^ n) := ⟨_, has_sum_geometric_of_lt_1 h₁ h₂⟩ lemma tsum_geometric_of_lt_1 {r : ℝ} (h₁ : 0 ≤ r) (h₂ : r < 1) : ∑'n:ℕ, r ^ n = (1 - r)⁻¹ := (has_sum_geometric_of_lt_1 h₁ h₂).tsum_eq lemma has_sum_geometric_two : has_sum (λn:ℕ, ((1:ℝ)/2) ^ n) 2 := by convert has_sum_geometric_of_lt_1 _ _; norm_num lemma summable_geometric_two : summable (λn:ℕ, ((1:ℝ)/2) ^ n) := ⟨_, has_sum_geometric_two⟩ lemma tsum_geometric_two : ∑'n:ℕ, ((1:ℝ)/2) ^ n = 2 := has_sum_geometric_two.tsum_eq lemma sum_geometric_two_le (n : ℕ) : ∑ (i : ℕ) in range n, (1 / (2 : ℝ)) ^ i ≤ 2 := begin have : ∀ i, 0 ≤ (1 / (2 : ℝ)) ^ i, { intro i, apply pow_nonneg, norm_num }, convert sum_le_tsum (range n) (λ i _, this i) summable_geometric_two, exact tsum_geometric_two.symm end lemma has_sum_geometric_two' (a : ℝ) : has_sum (λn:ℕ, (a / 2) / 2 ^ n) a := begin convert has_sum.mul_left (a / 2) (has_sum_geometric_of_lt_1 (le_of_lt one_half_pos) one_half_lt_one), { funext n, simp, refl, }, { norm_num } end lemma summable_geometric_two' (a : ℝ) : summable (λ n:ℕ, (a / 2) / 2 ^ n) := ⟨a, has_sum_geometric_two' a⟩ lemma tsum_geometric_two' (a : ℝ) : ∑' n:ℕ, (a / 2) / 2^n = a := (has_sum_geometric_two' a).tsum_eq /-- **Sum of a Geometric Series** -/ lemma nnreal.has_sum_geometric {r : ℝ≥0} (hr : r < 1) : has_sum (λ n : ℕ, r ^ n) (1 - r)⁻¹ := begin apply nnreal.has_sum_coe.1, push_cast, rw [nnreal.coe_sub (le_of_lt hr)], exact has_sum_geometric_of_lt_1 r.coe_nonneg hr end lemma nnreal.summable_geometric {r : ℝ≥0} (hr : r < 1) : summable (λn:ℕ, r ^ n) := ⟨_, nnreal.has_sum_geometric hr⟩ lemma tsum_geometric_nnreal {r : ℝ≥0} (hr : r < 1) : ∑'n:ℕ, r ^ n = (1 - r)⁻¹ := (nnreal.has_sum_geometric hr).tsum_eq /-- The series `pow r` converges to `(1-r)⁻¹`. For `r < 1` the RHS is a finite number, and for `1 ≤ r` the RHS equals `∞`. -/ @[simp] lemma ennreal.tsum_geometric (r : ℝ≥0∞) : ∑'n:ℕ, r ^ n = (1 - r)⁻¹ := begin cases lt_or_le r 1 with hr hr, { rcases ennreal.lt_iff_exists_coe.1 hr with ⟨r, rfl, hr'⟩, norm_cast at *, convert ennreal.tsum_coe_eq (nnreal.has_sum_geometric hr), rw [ennreal.coe_inv $ ne_of_gt $ tsub_pos_iff_lt.2 hr] }, { rw [tsub_eq_zero_iff_le.mpr hr, ennreal.inv_zero, ennreal.tsum_eq_supr_nat, supr_eq_top], refine λ a ha, (ennreal.exists_nat_gt (lt_top_iff_ne_top.1 ha)).imp (λ n hn, lt_of_lt_of_le hn _), calc (n:ℝ≥0∞) = ∑ i in range n, 1 : by rw [sum_const, nsmul_one, card_range] ... ≤ ∑ i in range n, r ^ i : sum_le_sum (λ k _, one_le_pow_of_one_le' hr k) } end variables {K : Type*} [normed_field K] {ξ : K} lemma has_sum_geometric_of_norm_lt_1 (h : ∥ξ∥ < 1) : has_sum (λn:ℕ, ξ ^ n) (1 - ξ)⁻¹ := begin have xi_ne_one : ξ ≠ 1, by { contrapose! h, simp [h] }, have A : tendsto (λn, (ξ ^ n - 1) * (ξ - 1)⁻¹) at_top (𝓝 ((0 - 1) * (ξ - 1)⁻¹)), from ((tendsto_pow_at_top_nhds_0_of_norm_lt_1 h).sub tendsto_const_nhds).mul tendsto_const_nhds, have B : (λ n, (∑ i in range n, ξ ^ i)) = (λ n, geom_sum ξ n) := rfl, rw [has_sum_iff_tendsto_nat_of_summable_norm, B], { simpa [geom_sum_eq, xi_ne_one, neg_inv, div_eq_mul_inv] using A }, { simp [normed_field.norm_pow, summable_geometric_of_lt_1 (norm_nonneg _) h] } end lemma summable_geometric_of_norm_lt_1 (h : ∥ξ∥ < 1) : summable (λn:ℕ, ξ ^ n) := ⟨_, has_sum_geometric_of_norm_lt_1 h⟩ lemma tsum_geometric_of_norm_lt_1 (h : ∥ξ∥ < 1) : ∑'n:ℕ, ξ ^ n = (1 - ξ)⁻¹ := (has_sum_geometric_of_norm_lt_1 h).tsum_eq lemma has_sum_geometric_of_abs_lt_1 {r : ℝ} (h : |r| < 1) : has_sum (λn:ℕ, r ^ n) (1 - r)⁻¹ := has_sum_geometric_of_norm_lt_1 h lemma summable_geometric_of_abs_lt_1 {r : ℝ} (h : |r| < 1) : summable (λn:ℕ, r ^ n) := summable_geometric_of_norm_lt_1 h lemma tsum_geometric_of_abs_lt_1 {r : ℝ} (h : |r| < 1) : ∑'n:ℕ, r ^ n = (1 - r)⁻¹ := tsum_geometric_of_norm_lt_1 h /-- A geometric series in a normed field is summable iff the norm of the common ratio is less than one. -/ @[simp] lemma summable_geometric_iff_norm_lt_1 : summable (λ n : ℕ, ξ ^ n) ↔ ∥ξ∥ < 1 := begin refine ⟨λ h, _, summable_geometric_of_norm_lt_1⟩, obtain ⟨k : ℕ, hk : dist (ξ ^ k) 0 < 1⟩ := (h.tendsto_cofinite_zero.eventually (ball_mem_nhds _ zero_lt_one)).exists, simp only [normed_field.norm_pow, dist_zero_right] at hk, rw [← one_pow k] at hk, exact lt_of_pow_lt_pow _ zero_le_one hk end end geometric section mul_geometric lemma summable_norm_pow_mul_geometric_of_norm_lt_1 {R : Type*} [normed_ring R] (k : ℕ) {r : R} (hr : ∥r∥ < 1) : summable (λ n : ℕ, ∥(n ^ k * r ^ n : R)∥) := begin rcases exists_between hr with ⟨r', hrr', h⟩, exact summable_of_is_O_nat (summable_geometric_of_lt_1 ((norm_nonneg _).trans hrr'.le) h) (is_o_pow_const_mul_const_pow_const_pow_of_norm_lt _ hrr').is_O.norm_left end lemma summable_pow_mul_geometric_of_norm_lt_1 {R : Type*} [normed_ring R] [complete_space R] (k : ℕ) {r : R} (hr : ∥r∥ < 1) : summable (λ n, n ^ k * r ^ n : ℕ → R) := summable_of_summable_norm $ summable_norm_pow_mul_geometric_of_norm_lt_1 _ hr /-- If `∥r∥ < 1`, then `∑' n : ℕ, n * r ^ n = r / (1 - r) ^ 2`, `has_sum` version. -/ lemma has_sum_coe_mul_geometric_of_norm_lt_1 {𝕜 : Type*} [normed_field 𝕜] [complete_space 𝕜] {r : 𝕜} (hr : ∥r∥ < 1) : has_sum (λ n, n * r ^ n : ℕ → 𝕜) (r / (1 - r) ^ 2) := begin have A : summable (λ n, n * r ^ n : ℕ → 𝕜), by simpa using summable_pow_mul_geometric_of_norm_lt_1 1 hr, have B : has_sum (pow r : ℕ → 𝕜) (1 - r)⁻¹, from has_sum_geometric_of_norm_lt_1 hr, refine A.has_sum_iff.2 _, have hr' : r ≠ 1, by { rintro rfl, simpa [lt_irrefl] using hr }, set s : 𝕜 := ∑' n : ℕ, n * r ^ n, calc s = (1 - r) * s / (1 - r) : (mul_div_cancel_left _ (sub_ne_zero.2 hr'.symm)).symm ... = (s - r * s) / (1 - r) : by rw [sub_mul, one_mul] ... = ((0 : ℕ) * r ^ 0 + (∑' n : ℕ, (n + 1) * r ^ (n + 1)) - r * s) / (1 - r) : by { congr, exact tsum_eq_zero_add A } ... = (r * (∑' n : ℕ, (n + 1) * r ^ n) - r * s) / (1 - r) : by simp [pow_succ, mul_left_comm _ r, tsum_mul_left] ... = r / (1 - r) ^ 2 : by simp [add_mul, tsum_add A B.summable, mul_add, B.tsum_eq, ← div_eq_mul_inv, sq, div_div_eq_div_mul] end /-- If `∥r∥ < 1`, then `∑' n : ℕ, n * r ^ n = r / (1 - r) ^ 2`. -/ lemma tsum_coe_mul_geometric_of_norm_lt_1 {𝕜 : Type*} [normed_field 𝕜] [complete_space 𝕜] {r : 𝕜} (hr : ∥r∥ < 1) : (∑' n : ℕ, n * r ^ n : 𝕜) = (r / (1 - r) ^ 2) := (has_sum_coe_mul_geometric_of_norm_lt_1 hr).tsum_eq end mul_geometric /-! ### Sequences with geometrically decaying distance in metric spaces In this paragraph, we discuss sequences in metric spaces or emetric spaces for which the distance between two consecutive terms decays geometrically. We show that such sequences are Cauchy sequences, and bound their distances to the limit. We also discuss series with geometrically decaying terms. -/ section edist_le_geometric variables [pseudo_emetric_space α] (r C : ℝ≥0∞) (hr : r < 1) (hC : C ≠ ⊤) {f : ℕ → α} (hu : ∀n, edist (f n) (f (n+1)) ≤ C * r^n) include hr hC hu /-- If `edist (f n) (f (n+1))` is bounded by `C * r^n`, `C ≠ ∞`, `r < 1`, then `f` is a Cauchy sequence.-/ lemma cauchy_seq_of_edist_le_geometric : cauchy_seq f := begin refine cauchy_seq_of_edist_le_of_tsum_ne_top _ hu _, rw [ennreal.tsum_mul_left, ennreal.tsum_geometric], refine ennreal.mul_ne_top hC (ennreal.inv_ne_top.2 _), exact (tsub_pos_iff_lt.2 hr).ne' end omit hr hC /-- If `edist (f n) (f (n+1))` is bounded by `C * r^n`, then the distance from `f n` to the limit of `f` is bounded above by `C * r^n / (1 - r)`. -/ lemma edist_le_of_edist_le_geometric_of_tendsto {a : α} (ha : tendsto f at_top (𝓝 a)) (n : ℕ) : edist (f n) a ≤ (C * r^n) / (1 - r) := begin convert edist_le_tsum_of_edist_le_of_tendsto _ hu ha _, simp only [pow_add, ennreal.tsum_mul_left, ennreal.tsum_geometric, div_eq_mul_inv, mul_assoc] end /-- If `edist (f n) (f (n+1))` is bounded by `C * r^n`, then the distance from `f 0` to the limit of `f` is bounded above by `C / (1 - r)`. -/ lemma edist_le_of_edist_le_geometric_of_tendsto₀ {a : α} (ha : tendsto f at_top (𝓝 a)) : edist (f 0) a ≤ C / (1 - r) := by simpa only [pow_zero, mul_one] using edist_le_of_edist_le_geometric_of_tendsto r C hu ha 0 end edist_le_geometric section edist_le_geometric_two variables [pseudo_emetric_space α] (C : ℝ≥0∞) (hC : C ≠ ⊤) {f : ℕ → α} (hu : ∀n, edist (f n) (f (n+1)) ≤ C / 2^n) {a : α} (ha : tendsto f at_top (𝓝 a)) include hC hu /-- If `edist (f n) (f (n+1))` is bounded by `C * 2^-n`, then `f` is a Cauchy sequence.-/ lemma cauchy_seq_of_edist_le_geometric_two : cauchy_seq f := begin simp only [div_eq_mul_inv, ennreal.inv_pow] at hu, refine cauchy_seq_of_edist_le_geometric 2⁻¹ C _ hC hu, simp [ennreal.one_lt_two] end omit hC include ha /-- If `edist (f n) (f (n+1))` is bounded by `C * 2^-n`, then the distance from `f n` to the limit of `f` is bounded above by `2 * C * 2^-n`. -/ lemma edist_le_of_edist_le_geometric_two_of_tendsto (n : ℕ) : edist (f n) a ≤ 2 * C / 2^n := begin simp only [div_eq_mul_inv, ennreal.inv_pow] at *, rw [mul_assoc, mul_comm], convert edist_le_of_edist_le_geometric_of_tendsto 2⁻¹ C hu ha n, rw [ennreal.one_sub_inv_two, ennreal.inv_inv] end /-- If `edist (f n) (f (n+1))` is bounded by `C * 2^-n`, then the distance from `f 0` to the limit of `f` is bounded above by `2 * C`. -/ lemma edist_le_of_edist_le_geometric_two_of_tendsto₀: edist (f 0) a ≤ 2 * C := by simpa only [pow_zero, div_eq_mul_inv, ennreal.inv_one, mul_one] using edist_le_of_edist_le_geometric_two_of_tendsto C hu ha 0 end edist_le_geometric_two section le_geometric variables [pseudo_metric_space α] {r C : ℝ} (hr : r < 1) {f : ℕ → α} (hu : ∀n, dist (f n) (f (n+1)) ≤ C * r^n) include hr hu lemma aux_has_sum_of_le_geometric : has_sum (λ n : ℕ, C * r^n) (C / (1 - r)) := begin rcases sign_cases_of_C_mul_pow_nonneg (λ n, dist_nonneg.trans (hu n)) with rfl | ⟨C₀, r₀⟩, { simp [has_sum_zero] }, { refine has_sum.mul_left C _, simpa using has_sum_geometric_of_lt_1 r₀ hr } end variables (r C) /-- If `dist (f n) (f (n+1))` is bounded by `C * r^n`, `r < 1`, then `f` is a Cauchy sequence. Note that this lemma does not assume `0 ≤ C` or `0 ≤ r`. -/ lemma cauchy_seq_of_le_geometric : cauchy_seq f := cauchy_seq_of_dist_le_of_summable _ hu ⟨_, aux_has_sum_of_le_geometric hr hu⟩ /-- If `dist (f n) (f (n+1))` is bounded by `C * r^n`, `r < 1`, then the distance from `f n` to the limit of `f` is bounded above by `C * r^n / (1 - r)`. -/ lemma dist_le_of_le_geometric_of_tendsto₀ {a : α} (ha : tendsto f at_top (𝓝 a)) : dist (f 0) a ≤ C / (1 - r) := (aux_has_sum_of_le_geometric hr hu).tsum_eq ▸ dist_le_tsum_of_dist_le_of_tendsto₀ _ hu ⟨_, aux_has_sum_of_le_geometric hr hu⟩ ha /-- If `dist (f n) (f (n+1))` is bounded by `C * r^n`, `r < 1`, then the distance from `f 0` to the limit of `f` is bounded above by `C / (1 - r)`. -/ lemma dist_le_of_le_geometric_of_tendsto {a : α} (ha : tendsto f at_top (𝓝 a)) (n : ℕ) : dist (f n) a ≤ (C * r^n) / (1 - r) := begin have := aux_has_sum_of_le_geometric hr hu, convert dist_le_tsum_of_dist_le_of_tendsto _ hu ⟨_, this⟩ ha n, simp only [pow_add, mul_left_comm C, mul_div_right_comm], rw [mul_comm], exact (this.mul_left _).tsum_eq.symm end omit hr hu variable (hu₂ : ∀ n, dist (f n) (f (n+1)) ≤ (C / 2) / 2^n) /-- If `dist (f n) (f (n+1))` is bounded by `(C / 2) / 2^n`, then `f` is a Cauchy sequence. -/ lemma cauchy_seq_of_le_geometric_two : cauchy_seq f := cauchy_seq_of_dist_le_of_summable _ hu₂ $ ⟨_, has_sum_geometric_two' C⟩ /-- If `dist (f n) (f (n+1))` is bounded by `(C / 2) / 2^n`, then the distance from `f 0` to the limit of `f` is bounded above by `C`. -/ lemma dist_le_of_le_geometric_two_of_tendsto₀ {a : α} (ha : tendsto f at_top (𝓝 a)) : dist (f 0) a ≤ C := (tsum_geometric_two' C) ▸ dist_le_tsum_of_dist_le_of_tendsto₀ _ hu₂ (summable_geometric_two' C) ha include hu₂ /-- If `dist (f n) (f (n+1))` is bounded by `(C / 2) / 2^n`, then the distance from `f n` to the limit of `f` is bounded above by `C / 2^n`. -/ lemma dist_le_of_le_geometric_two_of_tendsto {a : α} (ha : tendsto f at_top (𝓝 a)) (n : ℕ) : dist (f n) a ≤ C / 2^n := begin convert dist_le_tsum_of_dist_le_of_tendsto _ hu₂ (summable_geometric_two' C) ha n, simp only [add_comm n, pow_add, ← div_div_eq_div_mul], symmetry, exact ((has_sum_geometric_two' C).div_const _).tsum_eq end end le_geometric section summable_le_geometric variables [semi_normed_group α] {r C : ℝ} {f : ℕ → α} lemma semi_normed_group.cauchy_seq_of_le_geometric {C : ℝ} {r : ℝ} (hr : r < 1) {u : ℕ → α} (h : ∀ n, ∥u n - u (n + 1)∥ ≤ C*r^n) : cauchy_seq u := cauchy_seq_of_le_geometric r C hr (by simpa [dist_eq_norm] using h) lemma dist_partial_sum_le_of_le_geometric (hf : ∀n, ∥f n∥ ≤ C * r^n) (n : ℕ) : dist (∑ i in range n, f i) (∑ i in range (n+1), f i) ≤ C * r ^ n := begin rw [sum_range_succ, dist_eq_norm, ← norm_neg, neg_sub, add_sub_cancel'], exact hf n, end /-- If `∥f n∥ ≤ C * r ^ n` for all `n : ℕ` and some `r < 1`, then the partial sums of `f` form a Cauchy sequence. This lemma does not assume `0 ≤ r` or `0 ≤ C`. -/ lemma cauchy_seq_finset_of_geometric_bound (hr : r < 1) (hf : ∀n, ∥f n∥ ≤ C * r^n) : cauchy_seq (λ s : finset (ℕ), ∑ x in s, f x) := cauchy_seq_finset_of_norm_bounded _ (aux_has_sum_of_le_geometric hr (dist_partial_sum_le_of_le_geometric hf)).summable hf /-- If `∥f n∥ ≤ C * r ^ n` for all `n : ℕ` and some `r < 1`, then the partial sums of `f` are within distance `C * r ^ n / (1 - r)` of the sum of the series. This lemma does not assume `0 ≤ r` or `0 ≤ C`. -/ lemma norm_sub_le_of_geometric_bound_of_has_sum (hr : r < 1) (hf : ∀n, ∥f n∥ ≤ C * r^n) {a : α} (ha : has_sum f a) (n : ℕ) : ∥(∑ x in finset.range n, f x) - a∥ ≤ (C * r ^ n) / (1 - r) := begin rw ← dist_eq_norm, apply dist_le_of_le_geometric_of_tendsto r C hr (dist_partial_sum_le_of_le_geometric hf), exact ha.tendsto_sum_nat end @[simp] lemma dist_partial_sum (u : ℕ → α) (n : ℕ) : dist (∑ k in range (n + 1), u k) (∑ k in range n, u k) = ∥u n∥ := by simp [dist_eq_norm, sum_range_succ] @[simp] lemma dist_partial_sum' (u : ℕ → α) (n : ℕ) : dist (∑ k in range n, u k) (∑ k in range (n+1), u k) = ∥u n∥ := by simp [dist_eq_norm', sum_range_succ] lemma cauchy_series_of_le_geometric {C : ℝ} {u : ℕ → α} {r : ℝ} (hr : r < 1) (h : ∀ n, ∥u n∥ ≤ C*r^n) : cauchy_seq (λ n, ∑ k in range n, u k) := cauchy_seq_of_le_geometric r C hr (by simp [h]) lemma normed_group.cauchy_series_of_le_geometric' {C : ℝ} {u : ℕ → α} {r : ℝ} (hr : r < 1) (h : ∀ n, ∥u n∥ ≤ C*r^n) : cauchy_seq (λ n, ∑ k in range (n + 1), u k) := begin by_cases hC : C = 0, { subst hC, simp at h, exact cauchy_seq_of_le_geometric 0 0 zero_lt_one (by simp [h]) }, have : 0 ≤ C, { simpa using (norm_nonneg _).trans (h 0) }, replace hC : 0 < C, from (ne.symm hC).le_iff_lt.mp this, have : 0 ≤ r, { have := (norm_nonneg _).trans (h 1), rw pow_one at this, exact (zero_le_mul_left hC).mp this }, simp_rw finset.sum_range_succ_comm, have : cauchy_seq u, { apply tendsto.cauchy_seq, apply squeeze_zero_norm h, rw show 0 = C*0, by simp, exact tendsto_const_nhds.mul (tendsto_pow_at_top_nhds_0_of_lt_1 this hr) }, exact this.add (cauchy_series_of_le_geometric hr h), end lemma normed_group.cauchy_series_of_le_geometric'' {C : ℝ} {u : ℕ → α} {N : ℕ} {r : ℝ} (hr₀ : 0 < r) (hr₁ : r < 1) (h : ∀ n ≥ N, ∥u n∥ ≤ C*r^n) : cauchy_seq (λ n, ∑ k in range (n + 1), u k) := begin set v : ℕ → α := λ n, if n < N then 0 else u n, have hC : 0 ≤ C, from (zero_le_mul_right $ pow_pos hr₀ N).mp ((norm_nonneg _).trans $ h N $ le_refl N), have : ∀ n ≥ N, u n = v n, { intros n hn, simp [v, hn, if_neg (not_lt.mpr hn)] }, refine cauchy_seq_sum_of_eventually_eq this (normed_group.cauchy_series_of_le_geometric' hr₁ _), { exact C }, intro n, dsimp [v], split_ifs with H H, { rw norm_zero, exact mul_nonneg hC (pow_nonneg hr₀.le _) }, { push_neg at H, exact h _ H } end end summable_le_geometric section normed_ring_geometric variables {R : Type*} [normed_ring R] [complete_space R] open normed_space /-- A geometric series in a complete normed ring is summable. Proved above (same name, different namespace) for not-necessarily-complete normed fields. -/ lemma normed_ring.summable_geometric_of_norm_lt_1 (x : R) (h : ∥x∥ < 1) : summable (λ (n:ℕ), x ^ n) := begin have h1 : summable (λ (n:ℕ), ∥x∥ ^ n) := summable_geometric_of_lt_1 (norm_nonneg _) h, refine summable_of_norm_bounded_eventually _ h1 _, rw nat.cofinite_eq_at_top, exact eventually_norm_pow_le x, end /-- Bound for the sum of a geometric series in a normed ring. This formula does not assume that the normed ring satisfies the axiom `∥1∥ = 1`. -/ lemma normed_ring.tsum_geometric_of_norm_lt_1 (x : R) (h : ∥x∥ < 1) : ∥∑' n:ℕ, x ^ n∥ ≤ ∥(1:R)∥ - 1 + (1 - ∥x∥)⁻¹ := begin rw tsum_eq_zero_add (normed_ring.summable_geometric_of_norm_lt_1 x h), simp only [pow_zero], refine le_trans (norm_add_le _ _) _, have : ∥∑' b : ℕ, (λ n, x ^ (n + 1)) b∥ ≤ (1 - ∥x∥)⁻¹ - 1, { refine tsum_of_norm_bounded _ (λ b, norm_pow_le' _ (nat.succ_pos b)), convert (has_sum_nat_add_iff' 1).mpr (has_sum_geometric_of_lt_1 (norm_nonneg x) h), simp }, linarith end lemma geom_series_mul_neg (x : R) (h : ∥x∥ < 1) : (∑' i:ℕ, x ^ i) * (1 - x) = 1 := begin have := ((normed_ring.summable_geometric_of_norm_lt_1 x h).has_sum.mul_right (1 - x)), refine tendsto_nhds_unique this.tendsto_sum_nat _, have : tendsto (λ (n : ℕ), 1 - x ^ n) at_top (𝓝 1), { simpa using tendsto_const_nhds.sub (tendsto_pow_at_top_nhds_0_of_norm_lt_1 h) }, convert ← this, ext n, rw [←geom_sum_mul_neg, geom_sum_def, finset.sum_mul], end lemma mul_neg_geom_series (x : R) (h : ∥x∥ < 1) : (1 - x) * ∑' i:ℕ, x ^ i = 1 := begin have := (normed_ring.summable_geometric_of_norm_lt_1 x h).has_sum.mul_left (1 - x), refine tendsto_nhds_unique this.tendsto_sum_nat _, have : tendsto (λ (n : ℕ), 1 - x ^ n) at_top (nhds 1), { simpa using tendsto_const_nhds.sub (tendsto_pow_at_top_nhds_0_of_norm_lt_1 h) }, convert ← this, ext n, rw [←mul_neg_geom_sum, geom_sum_def, finset.mul_sum] end end normed_ring_geometric /-! ### Summability tests based on comparison with geometric series -/ lemma summable_of_ratio_norm_eventually_le {α : Type*} [semi_normed_group α] [complete_space α] {f : ℕ → α} {r : ℝ} (hr₁ : r < 1) (h : ∀ᶠ n in at_top, ∥f (n+1)∥ ≤ r * ∥f n∥) : summable f := begin by_cases hr₀ : 0 ≤ r, { rw eventually_at_top at h, rcases h with ⟨N, hN⟩, rw ← @summable_nat_add_iff α _ _ _ _ N, refine summable_of_norm_bounded (λ n, ∥f N∥ * r^n) (summable.mul_left _ $ summable_geometric_of_lt_1 hr₀ hr₁) (λ n, _), conv_rhs {rw [mul_comm, ← zero_add N]}, refine le_geom hr₀ n (λ i _, _), convert hN (i + N) (N.le_add_left i) using 3, ac_refl }, { push_neg at hr₀, refine summable_of_norm_bounded_eventually 0 summable_zero _, rw nat.cofinite_eq_at_top, filter_upwards [h], intros n hn, by_contra h, push_neg at h, exact not_lt.mpr (norm_nonneg _) (lt_of_le_of_lt hn $ mul_neg_of_neg_of_pos hr₀ h) } end lemma summable_of_ratio_test_tendsto_lt_one {α : Type*} [normed_group α] [complete_space α] {f : ℕ → α} {l : ℝ} (hl₁ : l < 1) (hf : ∀ᶠ n in at_top, f n ≠ 0) (h : tendsto (λ n, ∥f (n+1)∥/∥f n∥) at_top (𝓝 l)) : summable f := begin rcases exists_between hl₁ with ⟨r, hr₀, hr₁⟩, refine summable_of_ratio_norm_eventually_le hr₁ _, filter_upwards [eventually_le_of_tendsto_lt hr₀ h, hf], intros n h₀ h₁, rwa ← div_le_iff (norm_pos_iff.mpr h₁) end lemma not_summable_of_ratio_norm_eventually_ge {α : Type*} [semi_normed_group α] {f : ℕ → α} {r : ℝ} (hr : 1 < r) (hf : ∃ᶠ n in at_top, ∥f n∥ ≠ 0) (h : ∀ᶠ n in at_top, r * ∥f n∥ ≤ ∥f (n+1)∥) : ¬ summable f := begin rw eventually_at_top at h, rcases h with ⟨N₀, hN₀⟩, rw frequently_at_top at hf, rcases hf N₀ with ⟨N, hNN₀ : N₀ ≤ N, hN⟩, rw ← @summable_nat_add_iff α _ _ _ _ N, refine mt summable.tendsto_at_top_zero (λ h', not_tendsto_at_top_of_tendsto_nhds (tendsto_norm_zero.comp h') _), convert tendsto_at_top_of_geom_le _ hr _, { refine lt_of_le_of_ne (norm_nonneg _) _, intro h'', specialize hN₀ N hNN₀, simp only [comp_app, zero_add] at h'', exact hN h''.symm }, { intro i, dsimp only [comp_app], convert (hN₀ (i + N) (hNN₀.trans (N.le_add_left i))) using 3, ac_refl } end lemma not_summable_of_ratio_test_tendsto_gt_one {α : Type*} [semi_normed_group α] {f : ℕ → α} {l : ℝ} (hl : 1 < l) (h : tendsto (λ n, ∥f (n+1)∥/∥f n∥) at_top (𝓝 l)) : ¬ summable f := begin have key : ∀ᶠ n in at_top, ∥f n∥ ≠ 0, { filter_upwards [eventually_ge_of_tendsto_gt hl h], intros n hn hc, rw [hc, div_zero] at hn, linarith }, rcases exists_between hl with ⟨r, hr₀, hr₁⟩, refine not_summable_of_ratio_norm_eventually_ge hr₀ key.frequently _, filter_upwards [eventually_ge_of_tendsto_gt hr₁ h, key], intros n h₀ h₁, rwa ← le_div_iff (lt_of_le_of_ne (norm_nonneg _) h₁.symm) end /-- A series whose terms are bounded by the terms of a converging geometric series converges. -/ lemma summable_one_div_pow_of_le {m : ℝ} {f : ℕ → ℕ} (hm : 1 < m) (fi : ∀ i, i ≤ f i) : summable (λ i, 1 / m ^ f i) := begin refine summable_of_nonneg_of_le (λ a, one_div_nonneg.mpr (pow_nonneg (zero_le_one.trans hm.le) _)) (λ a, _) (summable_geometric_of_lt_1 (one_div_nonneg.mpr (zero_le_one.trans hm.le)) ((one_div_lt (zero_lt_one.trans hm) zero_lt_one).mpr (one_div_one.le.trans_lt hm))), rw [div_pow, one_pow], refine (one_div_le_one_div _ _).mpr (pow_le_pow hm.le (fi a)); exact pow_pos (zero_lt_one.trans hm) _ end /-! ### Positive sequences with small sums on encodable types -/ /-- For any positive `ε`, define on an encodable type a positive sequence with sum less than `ε` -/ def pos_sum_of_encodable {ε : ℝ} (hε : 0 < ε) (ι) [encodable ι] : {ε' : ι → ℝ // (∀ i, 0 < ε' i) ∧ ∃ c, has_sum ε' c ∧ c ≤ ε} := begin let f := λ n, (ε / 2) / 2 ^ n, have hf : has_sum f ε := has_sum_geometric_two' _, have f0 : ∀ n, 0 < f n := λ n, div_pos (half_pos hε) (pow_pos zero_lt_two _), refine ⟨f ∘ encodable.encode, λ i, f0 _, _⟩, rcases hf.summable.comp_injective (@encodable.encode_injective ι _) with ⟨c, hg⟩, refine ⟨c, hg, has_sum_le_inj _ (@encodable.encode_injective ι _) _ _ hg hf⟩, { assume i _, exact le_of_lt (f0 _) }, { assume n, exact le_refl _ } end lemma set.countable.exists_pos_has_sum_le {ι : Type*} {s : set ι} (hs : s.countable) {ε : ℝ} (hε : 0 < ε) : ∃ ε' : ι → ℝ, (∀ i, 0 < ε' i) ∧ ∃ c, has_sum (λ i : s, ε' i) c ∧ c ≤ ε := begin haveI := hs.to_encodable, rcases pos_sum_of_encodable hε s with ⟨f, hf0, ⟨c, hfc, hcε⟩⟩, refine ⟨λ i, if h : i ∈ s then f ⟨i, h⟩ else 1, λ i, _, ⟨c, _, hcε⟩⟩, { split_ifs, exacts [hf0 _, zero_lt_one] }, { simpa only [subtype.coe_prop, dif_pos, subtype.coe_eta] } end lemma set.countable.exists_pos_forall_sum_le {ι : Type*} {s : set ι} (hs : s.countable) {ε : ℝ} (hε : 0 < ε) : ∃ ε' : ι → ℝ, (∀ i, 0 < ε' i) ∧ ∀ t : finset ι, ↑t ⊆ s → ∑ i in t, ε' i ≤ ε := begin rcases hs.exists_pos_has_sum_le hε with ⟨ε', hpos, c, hε'c, hcε⟩, refine ⟨ε', hpos, λ t ht, _⟩, rw [← sum_subtype_of_mem _ ht], refine (sum_le_has_sum _ _ hε'c).trans hcε, exact λ _ _, (hpos _).le end namespace nnreal theorem exists_pos_sum_of_encodable {ε : ℝ≥0} (hε : ε ≠ 0) (ι) [encodable ι] : ∃ ε' : ι → ℝ≥0, (∀ i, 0 < ε' i) ∧ ∃c, has_sum ε' c ∧ c < ε := let ⟨a, a0, aε⟩ := exists_between (pos_iff_ne_zero.2 hε) in let ⟨ε', hε', c, hc, hcε⟩ := pos_sum_of_encodable a0 ι in ⟨ λi, ⟨ε' i, le_of_lt $ hε' i⟩, assume i, nnreal.coe_lt_coe.1 $ hε' i, ⟨c, has_sum_le (assume i, le_of_lt $ hε' i) has_sum_zero hc ⟩, nnreal.has_sum_coe.1 hc, lt_of_le_of_lt (nnreal.coe_le_coe.1 hcε) aε ⟩ end nnreal namespace ennreal theorem exists_pos_sum_of_encodable {ε : ℝ≥0∞} (hε : ε ≠ 0) (ι) [encodable ι] : ∃ ε' : ι → ℝ≥0, (∀ i, 0 < ε' i) ∧ ∑' i, (ε' i : ℝ≥0∞) < ε := begin rcases exists_between (pos_iff_ne_zero.2 hε) with ⟨r, h0r, hrε⟩, rcases lt_iff_exists_coe.1 hrε with ⟨x, rfl, hx⟩, rcases nnreal.exists_pos_sum_of_encodable (coe_pos.1 h0r).ne' ι with ⟨ε', hp, c, hc, hcr⟩, exact ⟨ε', hp, (ennreal.tsum_coe_eq hc).symm ▸ lt_trans (coe_lt_coe.2 hcr) hrε⟩ end theorem exists_pos_sum_of_encodable' {ε : ℝ≥0∞} (hε : ε ≠ 0) (ι) [encodable ι] : ∃ ε' : ι → ℝ≥0∞, (∀ i, 0 < ε' i) ∧ (∑' i, ε' i) < ε := let ⟨δ, δpos, hδ⟩ := exists_pos_sum_of_encodable hε ι in ⟨λ i, δ i, λ i, ennreal.coe_pos.2 (δpos i), hδ⟩ theorem exists_pos_tsum_mul_lt_of_encodable {ε : ℝ≥0∞} (hε : ε ≠ 0) {ι} [encodable ι] (w : ι → ℝ≥0∞) (hw : ∀ i, w i ≠ ∞) : ∃ δ : ι → ℝ≥0, (∀ i, 0 < δ i) ∧ ∑' i, (w i * δ i : ℝ≥0∞) < ε := begin lift w to ι → ℝ≥0 using hw, rcases exists_pos_sum_of_encodable hε ι with ⟨δ', Hpos, Hsum⟩, have : ∀ i, 0 < max 1 (w i), from λ i, zero_lt_one.trans_le (le_max_left _ _), refine ⟨λ i, δ' i / max 1 (w i), λ i, nnreal.div_pos (Hpos _) (this i), _⟩, refine lt_of_le_of_lt (ennreal.tsum_le_tsum $ λ i, _) Hsum, rw [coe_div (this i).ne'], refine mul_le_of_le_div' (ennreal.mul_le_mul le_rfl $ ennreal.inv_le_inv.2 _), exact coe_le_coe.2 (le_max_right _ _) end end ennreal /-! ### Factorial -/ lemma factorial_tendsto_at_top : tendsto nat.factorial at_top at_top := tendsto_at_top_at_top_of_monotone nat.monotone_factorial (λ n, ⟨n, n.self_le_factorial⟩) lemma tendsto_factorial_div_pow_self_at_top : tendsto (λ n, n! / n^n : ℕ → ℝ) at_top (𝓝 0) := tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds (tendsto_const_div_at_top_nhds_0_nat 1) (eventually_of_forall $ λ n, div_nonneg (by exact_mod_cast n.factorial_pos.le) (pow_nonneg (by exact_mod_cast n.zero_le) _)) begin refine (eventually_gt_at_top 0).mono (λ n hn, _), rcases nat.exists_eq_succ_of_ne_zero hn.ne.symm with ⟨k, rfl⟩, rw [← prod_range_add_one_eq_factorial, pow_eq_prod_const, div_eq_mul_inv, ← inv_eq_one_div, prod_nat_cast, nat.cast_succ, ← prod_inv_distrib', ← prod_mul_distrib, finset.prod_range_succ'], simp only [prod_range_succ', one_mul, nat.cast_add, zero_add, nat.cast_one], refine mul_le_of_le_one_left (inv_nonneg.mpr $ by exact_mod_cast hn.le) (prod_le_one _ _); intros x hx; rw finset.mem_range at hx, { refine mul_nonneg _ (inv_nonneg.mpr _); norm_cast; linarith }, { refine (div_le_one $ by exact_mod_cast hn).mpr _, norm_cast, linarith } end /-- The series `∑' n, x ^ n / n!` is summable of any `x : ℝ`. See also `exp_series_field_summable` for a version that also works in `ℂ`, and `exp_series_summable'` for a version that works in any normed algebra over `ℝ` or `ℂ`. -/ lemma real.summable_pow_div_factorial (x : ℝ) : summable (λ n, x ^ n / n! : ℕ → ℝ) := begin -- We start with trivial extimates have A : (0 : ℝ) < ⌊∥x∥⌋₊ + 1, from zero_lt_one.trans_le (by simp), have B : ∥x∥ / (⌊∥x∥⌋₊ + 1) < 1, from (div_lt_one A).2 (nat.lt_floor_add_one _), -- Then we apply the ratio test. The estimate works for `n ≥ ⌊∥x∥⌋₊`. suffices : ∀ n ≥ ⌊∥x∥⌋₊, ∥x ^ (n + 1) / (n + 1)!∥ ≤ ∥x∥ / (⌊∥x∥⌋₊ + 1) * ∥x ^ n / ↑n!∥, from summable_of_ratio_norm_eventually_le B (eventually_at_top.2 ⟨⌊∥x∥⌋₊, this⟩), -- Finally, we prove the upper estimate intros n hn, calc ∥x ^ (n + 1) / (n + 1)!∥ = (∥x∥ / (n + 1)) * ∥x ^ n / n!∥ : by rw [pow_succ, nat.factorial_succ, nat.cast_mul, ← div_mul_div, normed_field.norm_mul, normed_field.norm_div, real.norm_coe_nat, nat.cast_succ] ... ≤ (∥x∥ / (⌊∥x∥⌋₊ + 1)) * ∥x ^ n / n!∥ : by mono* with [0 ≤ ∥x ^ n / n!∥, 0 ≤ ∥x∥]; apply norm_nonneg end lemma real.tendsto_pow_div_factorial_at_top (x : ℝ) : tendsto (λ n, x ^ n / n! : ℕ → ℝ) at_top (𝓝 0) := (real.summable_pow_div_factorial x).tendsto_at_top_zero /-! ### Ceil and floor -/ section variables {R : Type*} [topological_space R] [linear_ordered_field R] [order_topology R] [floor_ring R] lemma tendsto_nat_floor_mul_div_at_top {a : R} (ha : 0 ≤ a) : tendsto (λ x, (⌊a * x⌋₊ : R) / x) at_top (𝓝 a) := begin have A : tendsto (λ (x : R), a - x⁻¹) at_top (𝓝 (a - 0)) := tendsto_const_nhds.sub tendsto_inv_at_top_zero, rw sub_zero at A, apply tendsto_of_tendsto_of_tendsto_of_le_of_le' A tendsto_const_nhds, { refine eventually_at_top.2 ⟨1, λ x hx, _⟩, simp only [le_div_iff (zero_lt_one.trans_le hx), sub_mul, inv_mul_cancel (zero_lt_one.trans_le hx).ne'], have := nat.lt_floor_add_one (a * x), linarith }, { refine eventually_at_top.2 ⟨1, λ x hx, _⟩, rw div_le_iff (zero_lt_one.trans_le hx), simp [nat.floor_le (mul_nonneg ha (zero_le_one.trans hx))] } end lemma tendsto_nat_ceil_mul_div_at_top {a : R} (ha : 0 ≤ a) : tendsto (λ x, (⌈a * x⌉₊ : R) / x) at_top (𝓝 a) := begin have A : tendsto (λ (x : R), a + x⁻¹) at_top (𝓝 (a + 0)) := tendsto_const_nhds.add tendsto_inv_at_top_zero, rw add_zero at A, apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds A, { refine eventually_at_top.2 ⟨1, λ x hx, _⟩, rw le_div_iff (zero_lt_one.trans_le hx), exact nat.le_ceil _ }, { refine eventually_at_top.2 ⟨1, λ x hx, _⟩, simp [div_le_iff (zero_lt_one.trans_le hx), inv_mul_cancel (zero_lt_one.trans_le hx).ne', (nat.ceil_lt_add_one ((mul_nonneg ha (zero_le_one.trans hx)))).le, add_mul] } end end
[GOAL] R : Type u_1 Γ₀ : Type u_2 inst✝¹ : CommRing R inst✝ : LinearOrderedCommMonoidWithZero Γ₀ v : Valuation R Γ₀ J : Ideal R hJ : J ≤ supp v q : R ⧸ J a b : R h : Setoid.r a b ⊢ ↑v a = ↑v (b + -(-a + b)) [PROOFSTEP] simp [GOAL] R : Type u_1 Γ₀ : Type u_2 inst✝¹ : CommRing R inst✝ : LinearOrderedCommMonoidWithZero Γ₀ v✝ : Valuation R Γ₀ J : Ideal R v : Valuation (R ⧸ J) Γ₀ ⊢ J ≤ supp (comap (Ideal.Quotient.mk J) v) [PROOFSTEP] rw [comap_supp, ← Ideal.map_le_iff_le_comap] [GOAL] R : Type u_1 Γ₀ : Type u_2 inst✝¹ : CommRing R inst✝ : LinearOrderedCommMonoidWithZero Γ₀ v✝ : Valuation R Γ₀ J : Ideal R v : Valuation (R ⧸ J) Γ₀ ⊢ Ideal.map (Ideal.Quotient.mk J) J ≤ supp v [PROOFSTEP] simp [GOAL] R : Type u_1 Γ₀ : Type u_2 inst✝¹ : CommRing R inst✝ : LinearOrderedCommMonoidWithZero Γ₀ v✝ : Valuation R Γ₀ J : Ideal R v : Valuation (R ⧸ J) Γ₀ ⊢ ∀ (r : R ⧸ J), ↑(onQuot (comap (Ideal.Quotient.mk J) v) (_ : J ≤ supp (comap (Ideal.Quotient.mk J) v))) r = ↑v r [PROOFSTEP] rintro ⟨x⟩ [GOAL] case mk R : Type u_1 Γ₀ : Type u_2 inst✝¹ : CommRing R inst✝ : LinearOrderedCommMonoidWithZero Γ₀ v✝ : Valuation R Γ₀ J : Ideal R v : Valuation (R ⧸ J) Γ₀ r✝ : R ⧸ J x : R ⊢ ↑(onQuot (comap (Ideal.Quotient.mk J) v) (_ : J ≤ supp (comap (Ideal.Quotient.mk J) v))) (Quot.mk Setoid.r x) = ↑v (Quot.mk Setoid.r x) [PROOFSTEP] rfl [GOAL] R : Type u_1 Γ₀ : Type u_2 inst✝¹ : CommRing R inst✝ : LinearOrderedCommMonoidWithZero Γ₀ v : Valuation R Γ₀ J : Ideal R hJ : J ≤ supp v ⊢ supp (onQuot v hJ) = Ideal.map (Ideal.Quotient.mk J) (supp v) [PROOFSTEP] apply le_antisymm [GOAL] case a R : Type u_1 Γ₀ : Type u_2 inst✝¹ : CommRing R inst✝ : LinearOrderedCommMonoidWithZero Γ₀ v : Valuation R Γ₀ J : Ideal R hJ : J ≤ supp v ⊢ supp (onQuot v hJ) ≤ Ideal.map (Ideal.Quotient.mk J) (supp v) [PROOFSTEP] rintro ⟨x⟩ hx [GOAL] case a.mk R : Type u_1 Γ₀ : Type u_2 inst✝¹ : CommRing R inst✝ : LinearOrderedCommMonoidWithZero Γ₀ v : Valuation R Γ₀ J : Ideal R hJ : J ≤ supp v x✝ : R ⧸ J x : R hx : Quot.mk Setoid.r x ∈ supp (onQuot v hJ) ⊢ Quot.mk Setoid.r x ∈ Ideal.map (Ideal.Quotient.mk J) (supp v) [PROOFSTEP] apply Ideal.subset_span [GOAL] case a.mk.a R : Type u_1 Γ₀ : Type u_2 inst✝¹ : CommRing R inst✝ : LinearOrderedCommMonoidWithZero Γ₀ v : Valuation R Γ₀ J : Ideal R hJ : J ≤ supp v x✝ : R ⧸ J x : R hx : Quot.mk Setoid.r x ∈ supp (onQuot v hJ) ⊢ Quot.mk Setoid.r x ∈ ↑(Ideal.Quotient.mk J) '' ↑(supp v) [PROOFSTEP] exact ⟨x, hx, rfl⟩ [GOAL] case a R : Type u_1 Γ₀ : Type u_2 inst✝¹ : CommRing R inst✝ : LinearOrderedCommMonoidWithZero Γ₀ v : Valuation R Γ₀ J : Ideal R hJ : J ≤ supp v ⊢ Ideal.map (Ideal.Quotient.mk J) (supp v) ≤ supp (onQuot v hJ) [PROOFSTEP] rw [Ideal.map_le_iff_le_comap] [GOAL] case a R : Type u_1 Γ₀ : Type u_2 inst✝¹ : CommRing R inst✝ : LinearOrderedCommMonoidWithZero Γ₀ v : Valuation R Γ₀ J : Ideal R hJ : J ≤ supp v ⊢ supp v ≤ Ideal.comap (Ideal.Quotient.mk J) (supp (onQuot v hJ)) [PROOFSTEP] intro x hx [GOAL] case a R : Type u_1 Γ₀ : Type u_2 inst✝¹ : CommRing R inst✝ : LinearOrderedCommMonoidWithZero Γ₀ v : Valuation R Γ₀ J : Ideal R hJ : J ≤ supp v x : R hx : x ∈ supp v ⊢ x ∈ Ideal.comap (Ideal.Quotient.mk J) (supp (onQuot v hJ)) [PROOFSTEP] exact hx [GOAL] R : Type u_1 Γ₀ : Type u_2 inst✝¹ : CommRing R inst✝ : LinearOrderedCommMonoidWithZero Γ₀ v : Valuation R Γ₀ ⊢ supp (onQuot v (_ : supp v ≤ supp v)) = 0 [PROOFSTEP] rw [supp_quot] [GOAL] R : Type u_1 Γ₀ : Type u_2 inst✝¹ : CommRing R inst✝ : LinearOrderedCommMonoidWithZero Γ₀ v : Valuation R Γ₀ ⊢ Ideal.map (Ideal.Quotient.mk (supp v)) (supp v) = 0 [PROOFSTEP] exact Ideal.map_quotient_self _
Formal statement is: lemma emeasure_lborel_UNIV [simp]: "emeasure lborel (UNIV::'a::euclidean_space set) = \<infinity>" Informal statement is: The Lebesgue measure of the entire space is infinite.
import definitions import data.list.basic definition fib_mod (m : ℕ) : ℕ → ℕ | 0 := 0 % m | 1 := 1 % m | (n + 2) := ( (fib_mod n) + (fib_mod (n + 1)) ) % m def luc_mod (m : ℕ) : ℕ → ℕ | 0 := 2 % m | 1 := 1 % m | (n + 2) := ( (luc_mod n) + (luc_mod (n + 1)) ) % m theorem luc_mod_is_luc (m : ℕ) : ∀ r : ℕ, luc_mod m r = (luc r) % m | 0 := rfl | 1 := rfl | (n + 2) := begin have Hn := luc_mod_is_luc n, have Hnp1 := luc_mod_is_luc (n + 1), unfold luc_mod, unfold luc, rw Hn, rw Hnp1, show (luc n % m + luc (n + 1) % m) % m = (luc n + luc (n + 1)) % m, apply nat.mod_add, end theorem fib_mod_eq (m n : ℕ) : (fib_mod m) n = (fib n) % m := nat.rec_on_two n (rfl) (rfl) (begin intros d Hd Hdplus1, unfold fib, unfold fib_mod, rw Hd, rw Hdplus1, exact nat.mod_add _ _ _ end) theorem luc_mod_eq (m n : ℕ) : (luc_mod m) n = (luc n) % m := nat.rec_on_two n (rfl) (rfl) (begin intros d Hd Hdplus1, unfold luc, unfold luc_mod, rw Hd, rw Hdplus1, exact nat.mod_add _ _ _ end) theorem fib_mod_16_aux (n : ℕ) : (fib_mod 16) (n + 24) = (fib_mod 16) n := nat.rec_on_two n (rfl) (rfl) (begin intros d Hd Hdplus1, show (fib_mod 16 (d + 24) + fib_mod 16 (nat.succ d + 24)) % 16 = (fib_mod 16 d + fib_mod 16 (nat.succ d)) % 16, rw Hd,rw Hdplus1, end) theorem fib_mod_16 (n : ℕ) : (fib_mod 16) n = (fib_mod 16) (n % 24) := begin have H : ∀ n k, fib_mod 16 (n + 24 * k) = (fib_mod 16) n, { intros n k, induction k with d Hd, -- base case { refl}, -- inductive step { show fib_mod 16 (n + 24 * (d + 1)) = fib_mod 16 n, rwa [mul_add,←add_assoc,mul_one,fib_mod_16_aux], }, }, conv begin to_lhs, rw ←nat.mod_add_div n 24, end, rw H (n % 24) (n / 24) end theorem luc_mod_8_aux (n : ℕ) : (luc_mod 8) (n + 12) = (luc_mod 8) n := nat.rec_on_two n (rfl) (rfl) (begin intros d Hd Hdplus1, show (luc_mod 8 (d + 12) + luc_mod 8 (nat.succ d + 12)) % 8 = (luc_mod 8 d + luc_mod 8 (nat.succ d)) % 8, rw Hd,rw Hdplus1, end) theorem luc_mod_8 (n : ℕ) : (luc_mod 8) n = (luc_mod 8) (n % 12) := begin have H : ∀ n k, luc_mod 8 (n + 12 * k) = (luc_mod 8) n, { intros n k, induction k with d Hd, -- base case { refl}, -- inductive step { show luc_mod 8 (n + 12 * (d + 1)) = luc_mod 8 n, rwa [mul_add,←add_assoc,mul_one,luc_mod_8_aux], }, }, conv begin to_lhs, rw ←nat.mod_add_div n 12, end, rw H (n % 12) (n / 12) end theorem luc_mod_3_aux (n : ℕ) : (luc_mod 3) (n + 8) = (luc_mod 3) n := nat.rec_on_two n (rfl) (rfl) (begin intros d Hd Hdplus1, show (luc_mod 3 (d + 8) + luc_mod 3 (nat.succ d + 8)) % 3 = (luc_mod 3 d + luc_mod 3 (nat.succ d)) % 3, rw Hd,rw Hdplus1, end) theorem luc_mod_3 (n : ℕ) : (luc_mod 3) n = (luc_mod 3) (n % 8) := begin have H : ∀ n k, luc_mod 3 (n + 8 * k) = (luc_mod 3) n, { intros n k, induction k with d Hd, -- base case { refl}, -- inductive step { show luc_mod 3 (n + 8 * (d + 1)) = luc_mod 3 n, rwa [mul_add,←add_assoc,mul_one,luc_mod_3_aux], }, }, conv begin to_lhs, rw ←nat.mod_add_div n 8, end, rw H (n % 8) (n / 8) end theorem luc_mod_2_aux (n : ℕ) : (luc_mod 2) (n + 3) = (luc_mod 2) n := nat.rec_on_two n (rfl) (rfl) (begin intros d Hd Hdplus1, show (luc_mod 2 (d + 3) + luc_mod 2 (nat.succ d + 3)) % 2 = (luc_mod 2 d + luc_mod 2 (nat.succ d)) % 2, rw Hd,rw Hdplus1, end) theorem luc_mod_2 (n : ℕ) : (luc_mod 2) n = (luc_mod 2) (n % 3) := begin have H : ∀ n k, luc_mod 2 (n + 3 * k) = (luc_mod 2) n, { intros n k, induction k with d Hd, -- base case { refl}, -- inductive step { show luc_mod 2 (n + 3 * (d + 1)) = luc_mod 2 n, rwa [mul_add,←add_assoc,mul_one,luc_mod_2_aux], }, }, conv begin to_lhs, rw ←nat.mod_add_div n 3, end, rw H (n % 3) (n / 3) end
[STATEMENT] lemma zip_fill_code [code]: "zip_fill xs [] = map (\<lambda>x. (Some x, None)) xs" "zip_fill [] ys = map (\<lambda>y. (None, Some y)) ys" "zip_fill (x # xs) (y # ys) = (Some x, Some y) # zip_fill xs ys" [PROOF STATE] proof (prove) goal (1 subgoal): 1. zip_fill xs [] = map (\<lambda>x. (Some x, None)) xs &&& zip_fill [] ys = map (\<lambda>y. (None, Some y)) ys &&& zip_fill (x # xs) (y # ys) = (Some x, Some y) # zip_fill xs ys [PROOF STEP] subgoal [PROOF STATE] proof (prove) goal (1 subgoal): 1. zip_fill xs [] = map (\<lambda>x. (Some x, None)) xs [PROOF STEP] by (induct xs) (auto simp: zip_fill_def) [PROOF STATE] proof (prove) goal (2 subgoals): 1. zip_fill [] ys = map (\<lambda>y. (None, Some y)) ys 2. zip_fill (x # xs) (y # ys) = (Some x, Some y) # zip_fill xs ys [PROOF STEP] subgoal [PROOF STATE] proof (prove) goal (1 subgoal): 1. zip_fill [] ys = map (\<lambda>y. (None, Some y)) ys [PROOF STEP] by (induct ys) (auto simp: zip_fill_def) [PROOF STATE] proof (prove) goal (1 subgoal): 1. zip_fill (x # xs) (y # ys) = (Some x, Some y) # zip_fill xs ys [PROOF STEP] subgoal [PROOF STATE] proof (prove) goal (1 subgoal): 1. zip_fill (x # xs) (y # ys) = (Some x, Some y) # zip_fill xs ys [PROOF STEP] by (auto simp: zip_fill_def) [PROOF STATE] proof (prove) goal: No subgoals! [PROOF STEP] done
module RecordConstructors (Parameter : Set) where -- Note that the fixity declaration has to be given outside of the -- record definition. infix 6 _⟨_⟩_ record R (X : Set) (Y : Set) : Set₁ where constructor _⟨_⟩_ field {A} : Set f : A → X {B} D {E} : Set g : B → Y → E postulate A : Set r : R A A r = f ⟨ A ⟩ λ (_ : A) → f where f : A → A f x = x data _≡_ {A : Set₁} (x : A) : A → Set where refl : x ≡ x lemma : r ≡ record {} lemma = refl -- Record constructors can be overloaded. record R′ : Set₁ where constructor _⟨_⟩_ field T₁ T₂ T₃ : Set data D : Set where _⟨_⟩_ : D r′ : R′ r′ = A ⟨ A ⟩ A d : D d = _⟨_⟩_
function gray = gray_salt_and_pepper ( gray, level ) %*****************************************************************************80 % %% GRAY_SALT_AND_PEPPER adds salt-and-pepper noise to a grayscale image. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 26 February 2011 % % Author: % % John Burkardt % % Parameters: % % Input, uint8 GRAY(:,:), the image. % % Input, real LEVEL, the level of noise to add, between 0.0 (none) % and 1.0 (all). % % Output, uint8 GRAY(:,:), the image with added noise. A fraction of % about LEVEL of the pixels have been reset to 0 or 255. % [ m, n ] = size ( gray ); r = rand ( m, n ); i0 = find ( r <= level / 2 ); gray ( i0 ) = 0; i255 = find ( 1 - level / 2 <= r ); gray ( i255 ) = 255; return end
lemma measure_null_measure[simp]: "measure (null_measure M) X = 0"
function sparse_builder(fun::Function, ::Type{T}, M, N; issymmetric=false, ishermitian=false) where T I = Int[] J = Int[] V = T[] set! = if issymmetric || ishermitian && T <: Real (i,j,v) -> begin iszero(v) && return push!(I, i) push!(J, j) push!(V, v) push!(I, j) push!(J, i) push!(V, v) end elseif ishermitian (i,j,v) -> begin iszero(v) && return push!(I, i) push!(J, j) push!(V, v) push!(I, j) push!(J, i) push!(V, conj(v)) end else (i,j,v) -> begin iszero(v) && return push!(I, i) push!(J, j) push!(V, v) end end fun(set!) sparse(I, J, V, M, N) end
-- theorem ex : Not (1 = 2) := of_decide_eq_false rfl
(*Reals*) Require Import Rbase. Require Import Rfunctions. Require Import Psatz. (*Require Export SeqSeries. Require Export Rtrigo. Require Export Ranalysis. Require Export Integration. Require Import Fourier.*) Open Scope R_scope. (*Axioms*) Require Import Classical. Require Import ClassicalChoice. Require Import FunctionalExtensionality. Require Import PropExtensionality. Require Import Description. Require Import ClassicalDescription. (*Lists*) Require Import List. (***************) (*Miscellaneous*) (***************) Lemma sup_caract : forall (X : R -> Prop), forall (s : R), is_lub X s <-> (forall epsilon, epsilon > 0 -> exists y, X y /\ s - epsilon < y) /\ is_upper_bound X s. Proof. intros X s. split. - intro H. split. + intro epsilon. intro H_pos. unfold is_lub in H. Search (~ (forall _, (~ _))). apply not_all_not_ex. intro H_false. destruct H as [H1 H2]. unfold is_upper_bound in H2. specialize (H2 (s - epsilon)). enough (s <= s - epsilon) by lra. apply H2. intro x. specialize (H_false x). Search (~ ( _ /\ _)). apply not_and_or in H_false. destruct H_false as [H_false | H_false]. * tauto. * lra. + unfold is_lub in H. apply H. - intros [He H_maj]. unfold is_lub. split. + assumption. + intro b. unfold is_upper_bound. intro H. clear H_maj. apply NNPP. intro H0. specialize (He (s-b)). destruct He as [y Hy]. * lra. * specialize (H y). destruct Hy. specialize (H H1). lra. Qed. Lemma min_or : forall (x y : R), (Rmin x y) = x \/ (Rmin x y) = y. Proof. intros x y. apply Rmin_case ; auto. Qed. Lemma le_epsilon_0 : forall (r1 : R), (forall epsilon :R, 0 < epsilon -> r1 <= epsilon) -> r1 <= 0. Proof. intro r1. intro H. apply le_epsilon. intro eps. intro H_ineq. specialize (H eps). lra. Qed. Lemma Rabs_zero : forall (r : R), Rabs r = 0 -> r = 0. Proof. intros r H. apply NNPP. intro H1. apply Rabs_no_R0 in H1. auto. Qed. Lemma le_k_epsilon_0 : forall (k : R), forall (r : R), (forall epsilon, 0 < epsilon -> r <= k * epsilon) -> r <= 0. Proof. intros k r. intro H. apply le_epsilon_0. destruct (excluded_middle_informative (0 < k)). - intro eps. intro H_pos_eps. specialize (H (eps/k)). replace (k * (eps / k)) with eps in H. + assert (0 < eps / k). * apply Rinv_0_lt_compat in r0. nra. * auto. + Search ( _ / _). Search (Rinv). Search (Rmult). unfold Rdiv. rewrite <- Rmult_assoc. rewrite Rinv_r_simpl_m. reflexivity. lra. - destruct (excluded_middle_informative (0 = k)). + intro eps. intro e'. Search ( ~ _ < _). apply Rnot_lt_le in n. specialize (H eps e'). nra. + exfalso. assert (r < 0). * specialize (H 1). nra. * specialize (H (2*r/k )). assert (0 < 2*r/k). -- enough (0 < (-r)/(-k)) by ( unfold Rdiv in *; rewrite <- Ropp_inv_permute in H1 ; nra). apply Rdiv_lt_0_compat ; nra. -- apply H in H1. unfold Rdiv in *. generalize (Rinv_r k). nra. Qed. (*Functions*) Definition sum (f g : R -> R) := fun x => f x + g x. Definition mult_scalar (f : R -> R) (alpha : R) := fun x => alpha * f x. (******************************) (*P-paritions and Riemann sums*) (******************************) (*Based on https://dmi.units.it/~fonda/p2017_book_KH.pdf *) (*We don't care about closed/open intervals*) Record bounded_interval := mk_bounded_interval {interval_inf : R ; interval_sup : R}. Definition is_ordered (i : bounded_interval) := i.(interval_inf) <= i.(interval_sup). Record triplet := mk_triplet {inf_bound : R ; sup_bound : R ; value : R}. Definition valid_triplet a b t := a = t.(inf_bound) /\ b = t.(sup_bound) /\ a <= t.(value) /\ t.(value) <= b. Definition partition : Type := list triplet. Fixpoint is_p_partition (i : bounded_interval) (p : partition) := match p with | nil => (i.(interval_inf) = i.(interval_sup)) | t :: q => (valid_triplet i.(interval_inf) t.(sup_bound) t) /\ (is_p_partition {| interval_inf := t.(sup_bound) ; interval_sup := i.(interval_sup)|} q) end. Definition concat_partitions (p1 p2 : partition) := p1 ++ p2. Lemma is_concat_partition : forall (p1 p2 : partition), forall (i1 i2 : bounded_interval), (is_p_partition i1 p1) -> (is_p_partition i2 p2) -> i1.(interval_sup) = i2.(interval_inf) -> (is_p_partition {|interval_inf := i1.(interval_inf) ; interval_sup := i2.(interval_sup) |} (concat_partitions p1 p2)). Proof. induction p1 as [|t1 q1 Hp1]. - simpl. intro p2. intros i1 i2. intros -> H1 -> . destruct i2. simpl. assumption. - simpl. intro p2. intros i1 i2. intros [H_triplet H_q1]. intro H_p2. intro H_int. split. + assumption. + apply (Hp1 _ _ _ H_q1 H_p2). simpl. assumption. Qed. Definition value_triplet_function t f := (f t.(value)) * (t.(sup_bound) - t.(inf_bound)). Fixpoint riemann_sum_partition (f : R -> R) (p : partition) := match p with | nil => 0 | t :: q => (value_triplet_function t f) + (riemann_sum_partition f q) end. Lemma value_triplet_sum (t : triplet) (f g : R -> R) : (value_triplet_function t (sum f g)) = (value_triplet_function t f) + (value_triplet_function t g). Proof. unfold value_triplet_function. unfold sum. lra. Qed. Lemma riemann_sum_sum (f g : R -> R) (p : partition) : (riemann_sum_partition (sum f g) p) = (riemann_sum_partition f p) + (riemann_sum_partition g p). Proof. induction p as [|t q Hp]. - simpl. lra. - simpl. rewrite Hp. rewrite value_triplet_sum. lra. Qed. (******************************) (*The notion of delta-fineness*) (******************************) (*We suppose that I = [a,b].*) Definition is_gauge (i : bounded_interval) (delta : R -> R) := forall x, i.(interval_inf) <= x -> x <= i.(interval_sup) -> 0 < delta x. Definition is_delta_fine_triplet (delta : R -> R) (t : triplet) := t.(value) - t.(inf_bound) <= delta t.(value) /\ t.(sup_bound) - t.(value) <= delta t.(value). Definition is_delta_fine (delta : R -> R) (p : partition) := forall t, In t p -> is_delta_fine_triplet delta t. Definition is_gauge_finer (delta delta' : R -> R) := forall x, delta x <= delta' x. Lemma is_delta_fine_concat (delta : R -> R) : forall (p1 : partition), is_delta_fine delta p1 -> ( forall (p2 : partition), is_delta_fine delta p2 -> is_delta_fine delta (concat_partitions p1 p2)). Proof. destruct p1 as [| t1 q1]. - simpl. intro H. intro p2. firstorder. - intro H1. intro p2. intro H_p2. unfold is_delta_fine. intro t. intro H_in. apply in_app_or in H_in. destruct H_in as [H_in | H_in]. + unfold is_delta_fine in H1. specialize (H1 t). apply H1 in H_in. assumption. + unfold is_delta_fine in H_p2. specialize (H_p2 t). apply H_p2 in H_in. assumption. Qed. Lemma is_finer_triplet : forall (t : triplet), forall (delta delta' : R -> R), (forall x, delta x <= delta' x) -> is_delta_fine_triplet delta t -> is_delta_fine_triplet delta' t. Proof. intro t. intros delta delta'. intro H. intro H_fine. unfold is_delta_fine_triplet in *. specialize (H (t.(value))). lra. Qed. Lemma is_finer : forall (p : partition), forall (delta delta' : R -> R), (is_gauge_finer delta delta') -> is_delta_fine delta p -> is_delta_fine delta' p. Proof. intro p. intros delta delta'. intros H H_fine. unfold is_delta_fine in *. intro t. specialize (H_fine t). intro H_t. apply H_fine in H_t. eapply is_finer_triplet ; eassumption. Qed. (*Let's prove a lemma about the minimum of two gauges, as we use this later*) Definition min_gauge (delta delta' : R -> R) := fun x => Rmin (delta x) (delta' x). Lemma min_gauge_is_gauge : forall (delta delta' : R -> R), forall (i : bounded_interval), is_gauge i delta -> is_gauge i delta' -> is_gauge i (min_gauge delta delta'). Proof. intros delta delta'. intro i. intros H_delta H_delta'. unfold is_gauge in *. intro x. specialize (H_delta x). specialize (H_delta' x). intros H1 H2. unfold min_gauge. apply Rmin_glb_lt ; [apply (H_delta H1) | apply (H_delta' H1)] ; assumption. Qed. (*Here is the Cousin's theorem !*) Theorem arbitrary_fine_partition : forall (i : bounded_interval), forall (delta : R -> R), is_gauge i delta -> is_ordered i -> exists (p : partition), is_delta_fine delta p /\ is_p_partition i p. Proof. intros i delta. intros H1 H2. set (U := (fun x => (exists (p : partition), is_delta_fine delta p /\ is_p_partition {|interval_inf := i.(interval_inf) ; interval_sup := x|} p /\ x <= i.(interval_sup)))). assert (U i.(interval_inf)). { set (t := {| inf_bound := i.(interval_inf) ; sup_bound := i.(interval_inf) ; value := i.(interval_inf) |}). exists (t :: nil). split. - simpl. unfold is_delta_fine_triplet. simpl. specialize (H1 i.(interval_inf)). unfold is_ordered in H2. intros t1 H_in. simpl in H_in. destruct H_in as [H_in1 | []]. rewrite <- H_in1. unfold is_delta_fine_triplet. simpl. lra. - simpl. split ; [|exact H2]. unfold valid_triplet ; simpl. lra. } assert (is_upper_bound U i.(interval_sup)). { unfold is_upper_bound. intro x. intro H0. destruct H0 as [p [Hp1 [Hp2 Hp3]]] ; assumption. } destruct (completeness U) as [sup Hsup]. - unfold bound. exists i.(interval_sup). assumption. - exists i.(interval_inf). assumption. - assert (i.(interval_inf) <= sup /\ sup <= i.(interval_sup)). { split. - destruct Hsup as [Hsup1 Hsup2]. apply Hsup1. assumption. - destruct Hsup as [Hsup1 Hsup2]. apply Hsup2. assumption. } rewrite -> sup_caract in Hsup. destruct Hsup as [Hsup1 Hsup2]. specialize (Hsup1 (delta sup)). destruct Hsup1 as [y Hy]. { apply H1 ; tauto. } set (i1 := {| interval_inf := interval_inf i; interval_sup := y |} ). set (i2 := {|interval_inf := y ; interval_sup := Rmin (sup + delta sup) (i.(interval_sup))|} ). destruct Hy as [Hy1 Hy2]. remember Hy1 as Hy1'. clear HeqHy1'. destruct Hy1 as [p [Hp1 [Hp2 Hp3]]]. set (t := {|inf_bound := y ; sup_bound := Rmin (sup + (delta sup)) (i.(interval_sup)) ; value := sup |}). exists (p ++ (t :: nil)). split. + apply is_delta_fine_concat. * assumption. * unfold is_delta_fine. intro t0. intro H_in_triplet. simpl in H_in_triplet. destruct H_in_triplet as [H_in_triplet | H_in_triplet]. -- unfold is_delta_fine_triplet. split. ++ rewrite <- H_in_triplet. simpl. lra. ++ rewrite <- H_in_triplet. simpl. assert (A := Rmin_l (sup + delta sup) (i.(interval_sup))). lra. -- exfalso. assumption. + assert (A1 :is_p_partition i2 (t :: nil) ). { - simpl. split. + unfold valid_triplet. simpl. repeat (split ; try lra). * apply Hsup2. assumption. * apply Rmin_glb. -- specialize (H1 sup). lra. -- lra. + reflexivity. } assert (A2 : i1.(interval_sup) = i2.(interval_inf)). { simpl. reflexivity. } assert (B := is_concat_partition p (t :: nil) i1 i2 Hp2 A1 A2). unfold concat_partitions in B. assert (A3 : U (Rmin (sup + delta sup) (i.(interval_sup)))). * exists (p ++ t :: nil). split. -- apply is_delta_fine_concat. ++ assumption. ++ unfold is_delta_fine. intro t0. intro H_temp. destruct H_temp. ** rewrite <- H4. unfold is_delta_fine_triplet. simpl. split. --- lra. --- assert (D := Rmin_l (sup + delta sup) (i.(interval_sup))). lra. ** destruct H4. -- split. ++ assumption. ++ apply Rmin_r. * assert (A4 : Rmin (sup + delta sup) (i.(interval_sup)) = sup). -- apply Rle_antisym. ++ apply Hsup2. assumption. ++ apply Rmin_glb. ** specialize (H1 sup). lra. ** tauto. -- replace i with {| interval_inf := interval_inf i1; interval_sup := interval_sup i2 |}. ++ assumption. ++ simpl. rewrite A4. destruct (min_or (sup + delta sup) (i.(interval_sup))) in A4. ** rewrite A4 in H4. specialize (H1 sup). exfalso. lra. ** rewrite A4 in H4. rewrite H4. destruct i. simpl. reflexivity. Qed. (********************************************) (*Integrable functions on a compact interval*) (********************************************) Definition has_integral (f : R -> R) (i : bounded_interval) (A : R) := forall (epsilon : R), 0 < epsilon -> exists (delta : R -> R), is_gauge i delta /\ forall (p : partition), is_delta_fine delta p -> is_p_partition i p -> Rabs (A - (riemann_sum_partition f p)) <= epsilon. Definition is_integrable (f : R -> R) (i : bounded_interval) := exists (A : R), has_integral f i A. Lemma unique_integral (f : R -> R) (i : bounded_interval) : (is_ordered i) -> forall (A A' : R), has_integral f i A -> has_integral f i A' -> A = A'. Proof. intro H_order. intros A A'. intros HA HA'. unfold has_integral in HA. unfold has_integral in HA'. assert (forall epsilon, 0 < epsilon -> Rabs (A - A') <= 2 * epsilon). - intro eps. intro H_ineq. specialize (HA eps). specialize (HA' eps). remember H_ineq as H_ineq'. clear HeqH_ineq'. apply HA in H_ineq. apply HA' in H_ineq'. clear HA HA'. destruct H_ineq as [delta H_delta]. destruct H_ineq' as [delta' H_delta']. set (delta'' := fun x => Rmin (delta x) (delta' x)). assert (is_gauge i delta''). + apply min_gauge_is_gauge ; destruct H_delta ; destruct H_delta' ; assumption. + assert (E := arbitrary_fine_partition i delta'' H H_order ). destruct E as [p [Hp1 Hp2]]. assert (forall x, delta'' x <= delta x) by (intro x ; apply Rmin_l). assert (forall x, delta'' x <= delta' x) by (intro x ; apply Rmin_r). assert (is_delta_fine delta p) by (apply (is_finer p delta'' delta H0 Hp1)). assert (is_delta_fine delta' p) by (apply (is_finer p delta'' delta' H1 Hp1)). destruct H_delta as [H_delta1 H_delta2]. destruct H_delta' as [H_delta'1 H_delta'2]. specialize (H_delta2 p). specialize (H_delta'2 p). specialize (H_delta2 H2 Hp2). specialize (H_delta'2 H3 Hp2). replace (A - A') with (A - (riemann_sum_partition f p) + (riemann_sum_partition f p - A')) by lra. assert ((Rabs (A - riemann_sum_partition f p + (riemann_sum_partition f p - A'))) <= Rabs (A - riemann_sum_partition f p) + Rabs (riemann_sum_partition f p - A')) by apply (Rabs_triang). eapply Rle_trans ; [exact H4|]. rewrite Rabs_minus_sym in H_delta'2. lra. - assert (Rabs (A - A') = 0). + apply le_k_epsilon_0 in H. assert (0 <= Rabs (A - A') ). * apply (Rabs_pos (A - A')). * lra. + assert (A - A' = 0). * apply Rabs_zero in H0 ; assumption. * lra. Qed. (***************************************) (*Elementary properties of the integral*) (***************************************) Lemma sum_integrals : forall (i : bounded_interval), forall (f g : R -> R), forall (Lf Lg : R), (has_integral f i Lf) -> (has_integral g i Lg) -> (has_integral (sum f g) i (Lf + Lg)). Proof. intro i. intros f g. intros Lf Lg. intros Hf Hg. unfold has_integral in *. intro eps. intro H_pos_eps. specialize (Hf (eps/2)). specialize (Hg (eps/2)). assert (H_eq : 0 < eps/2) by lra. remember H_eq as H_eq'. clear HeqH_eq'. apply Hf in H_eq. apply Hg in H_eq'. clear Hf Hg. destruct H_eq as [delta_f Hf]. destruct H_eq' as [delta_g Hg]. destruct Hf as [Hf1 Hf2]. destruct Hg as [Hg1 Hg2]. set (delta := fun x => Rmin (delta_f x) (delta_g x)). exists delta. split. - apply min_gauge_is_gauge ; assumption. - assert (A1 : forall x, delta x <= delta_f x) by (intro x ;apply Rmin_l). assert (A2 : forall x, delta x <= delta_g x) by (intro x ; apply Rmin_r). intro p. intro H_fine. intro H_part. specialize (Hf2 p). specialize (Hg2 p). assert (E1 : is_delta_fine delta_f p) by (apply (is_finer p delta delta_f A1 H_fine)). assert (E2 : is_delta_fine delta_g p) by (apply (is_finer p delta delta_g A2 H_fine)). assert (F1 := Hf2 E1 H_part). assert (F2 := Hg2 E2 H_part). rewrite (riemann_sum_sum). replace (Lf + Lg - (riemann_sum_partition f p + riemann_sum_partition g p)) with ((Lf - riemann_sum_partition f p) + (Lg - riemann_sum_partition g p)) by lra. eapply Rle_trans ; [apply Rabs_triang|]. lra. Qed. Lemma sum_integrable : forall (i : bounded_interval), forall (f g : R -> R), (is_integrable f i) -> (is_integrable g i) -> (is_integrable (fun x => f x + g x) i). Proof. intro i. intros f g. intros Hf Hg. unfold is_integrable in *. destruct Hf as [Lf Hf]. destruct Hg as [Lg Hg]. exists (Lf + Lg). apply sum_integrals ; assumption. Qed. Lemma mult_by_scalar_integral : forall (i : bounded_interval), forall (f : R -> R), forall (Lf : R), forall (alpha : R), (has_integral f i Lf) -> (has_integral (mult_scalar f alpha) i (alpha * Lf)). Proof. intro i. intro f. intro Lf. intro alpha. intro H.
* MB04OD EXAMPLE PROGRAM TEXT. * Copyright (c) 2002-2020 NICONET e.V. * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER (ZERO = 0.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, NMAX, PMAX PARAMETER ( MMAX = 20, NMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDR PARAMETER ( LDA = PMAX, LDB = NMAX, LDC = PMAX, $ LDR = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( NMAX-1,MMAX ) ) * .. Local Scalars .. CHARACTER*1 UPLO INTEGER I, J, M, N, P * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,MMAX), $ DWORK(LDWORK), R(LDR,NMAX), TAU(NMAX) * .. External Subroutines .. EXTERNAL MB04OD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, UPLO IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99993 ) N ELSE IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99992 ) M ELSE IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99991 ) P ELSE READ ( NIN, FMT = * ) ( ( R(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,M ), I = 1,P ) * Compute and apply QR factorization. CALL MB04OD( UPLO, N, M, P, R, LDR, A, LDA, B, LDB, C, $ LDC, TAU, DWORK ) * WRITE ( NOUT, FMT = 99997 ) DO 40 I = 1, N DO 20 J = 1, I-1 R(I,J) = ZERO 20 CONTINUE WRITE ( NOUT, FMT = 99996 ) ( R(I,J), J = 1,N ) 40 CONTINUE IF ( M.GT.0 ) THEN WRITE ( NOUT, FMT = 99995 ) DO 60 I = 1, N WRITE ( NOUT, FMT = 99996 ) ( B(I,J), J = 1,M ) 60 CONTINUE IF ( P.GT.0 ) THEN WRITE ( NOUT, FMT = 99994 ) DO 80 I = 1, P WRITE ( NOUT, FMT = 99996 ) ( C(I,J), J = 1,M ) 80 CONTINUE END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' MB04OD EXAMPLE PROGRAM RESULTS',/1X) 99997 FORMAT (' The updated matrix R is ') 99996 FORMAT (20(1X,F10.4)) 99995 FORMAT (' The updated matrix B is ') 99994 FORMAT (' The updated matrix C is ') 99993 FORMAT (/' N is out of range.',/' N = ',I5) 99992 FORMAT (/' M is out of range.',/' M = ',I5) 99991 FORMAT (/' P is out of range.',/' P = ',I5) END
(**************************************************************************) (* *) (* SMTCoq *) (* Copyright (C) 2011 - 2019 *) (* *) (* See file "AUTHORS" for the list of authors *) (* *) (* This file is distributed under the terms of the CeCILL-C licence *) (* *) (**************************************************************************) (* [Require Import SMTCoq.SMTCoq.] loads the SMTCoq library. If you are using native-coq instead of Coq 8.11, replace it with: Require Import SMTCoq. *) Require Import SMTCoq.SMTCoq. Require Import Bool. Require Import ZArith. Import BVList.BITVECTOR_LIST. Local Open Scope bv_scope. Import FArray. Local Open Scope farray_scope. (* Examples that check ZChaff certificates *) Local Open Scope int63_scope. Zchaff_Checker "sat.cnf" "sat.log". Zchaff_Theorem sat "sat.cnf" "sat.log". Check sat. Zchaff_Checker "hole4.cnf" "hole4.log". (* Example that checks a VeriT certificate, for logic QF_UFLIA *) Section Verit. Verit_Checker "lia.smt2" "lia.vtlog". End Verit. (* Example that checks a LFSC certificate, for logic QF_UFLIA *) Section Lfsc. Lfsc_Checker "lia.smt2" "lia.lfsc". End Lfsc. (********************** Examples for Comp Reports **********************) Theorem orIntroL : forall (a b: Prop), a -> a \/ b. Proof. intros a b Ha. left. apply Ha. Qed. Theorem LEMProp : forall (a : Prop), a \/ ~a. Proof. intros a. Abort. Theorem LEMBool : forall a : bool, a || (negb a) = true. Proof. intros a. destruct a. + simpl. reflexivity. + simpl. reflexivity. Qed. Theorem LEMBool' : forall a : bool, a || (negb a) = true. Proof. smt. Qed. Theorem Z_congBool : forall (a b : Z) (f : Z -> Z), (Z.eqb a b) = true -> (Z.eqb (f a) (f b) = true). Proof. intros. smt. Qed. Theorem Z_congBool : forall (a b : Z) (f : Z -> Z), (Z.eqb a b) = true -> (Z.eqb (f a) (f b) = true). Proof. intros. smt. Qed. Theorem Z_congProp : forall (a b : Z) (f : Z -> Z), a = b -> f a = f b. Proof. smt. Qed. Theorem BV_ulteZeroBool : forall (b : bitvector 4), bv_ult #b|0|0|0|0| b = true \/ bv_eq b #b|0|0|0|0| = true. Proof. smt. Qed. Theorem BV_ulteZeroProp : forall (b : bitvector 4), bv_ultP #b|0|0|0|0| b \/ b = #b|0|0|0|0|. Proof. smt. Qed. Theorem LEM_Z : forall (i : Z), i = 0%Z \/ ~(i = 0%Z). Proof. smt. Qed. Theorem LEMBV : forall (b : bitvector 4), b = #b|0|0|0|0| \/ ~(b = #b|0|0|0|0|). Proof. smt. Qed. (*************************************************************************) (* CVC4 doesn't have a shl bit-blasting rule *) Theorem BV_shl : forall (b : bitvector 4), bv_shl b #b|0|0|0|0| = b. Proof. smt. Abort. (**************** Passing recursive functions to SMT solver ****************) Definition f' (x : Z) : Prop := True. Fixpoint evenP (x : nat) : Prop := match x with | O => True | S n => evenP (n-1) end. Definition f (x : Z) : Z := 1. Theorem Z_congBool' : forall (a b : Z), (Z.eqb a b) = true -> (Z.eqb (f a) (f b) = false). Proof. (*smt.*) Abort. Inductive ev : nat -> Prop := | ev_0 : ev 0 | ev_SS (n : nat) (H : ev n) : ev (S (S n)). Theorem testPropFun : forall (a b : Z) (f : Z -> Prop), (Z.eqb a b) = true -> f a. Proof. (*smt.*) Abort. (***************************** Example from Report *****************************) Theorem F : forall (a b c : bool), (b && negb c) || (a && negb b) || negb a || c. Proof. smt. Qed. (***********************************************************************) Goal forall a b c, (a || b || c) && ((negb a) || (negb b) || (negb c)) && ((negb a) || b) && ((negb b) || c) && ((negb c) || a) = false. Proof. zchaff. Qed. Goal forall (i j k : Z), let a := Z.eqb i j in let b := Z.eqb j k in let c := Z.eqb k i in (a || b || c) && ((negb a) || (negb b) || (negb c)) && ((negb a) || b) && ((negb b) || c) && ((negb c) || a) = false. Proof. zchaff. Qed. (* Examples of the verit tactics (requires verit in your PATH environment variable), which handle - propositional logic - theory of equality - linear integer arithmetic - universally quantified hypotheses *) Goal forall a b c, ((a || b || c) && ((negb a) || (negb b) || (negb c)) && ((negb a) || b) && ((negb b) || c) && ((negb c) || a)) = false. Proof. verit_bool. Qed. Local Open Scope Z_scope. Goal forall (a b : Z) (P : Z -> bool) (f : Z -> Z), (negb (Z.eqb (f a) b)) || (negb (P (f a))) || (P b). Proof. verit_bool. Qed. Goal forall b1 b2 x1 x2, implb (ifb b1 (ifb b2 (Z.eqb (2*x1+1) (2*x2+1)) (Z.eqb (2*x1+1) (2*x2))) (ifb b2 (Z.eqb (2*x1) (2*x2+1)) (Z.eqb (2*x1) (2*x2)))) ((implb b1 b2) && (implb b2 b1) && (Z.eqb x1 x2)). Proof. verit_bool. Qed. Goal forall (x y: Z) (f: Z -> Z), x = y + 1 -> f y = f (x - 1). Proof. verit. Qed. Check (1 =? 2). (*Some examples of using verit with lemmas. Use <verit H1 .. Hn> to temporarily add the lemmas H1 .. Hn to the verit environment. *) Lemma const_fun_is_eq_val_0 : forall f : Z -> Z, (forall a b, f a =? f b = true) -> forall x, f x =? f 0 = true. Proof. intros f Hf. verit Hf. Qed. Section With_lemmas. Variable f : Z -> Z. Variable k : Z. Hypothesis f_k_linear : forall x, f (x + 1) =? f x + k. Lemma fSS2: forall x, f (x + 2) =? f x + 2 * k. Proof. verit_no_check f_k_linear. Qed. End With_lemmas. (* Instantiating a lemma with multiple quantifiers *) Section NonLinear. Lemma distr_right_inst a b (mult : Z -> Z -> Z) : (forall x y z, mult (x + y) z =? mult x z + mult y z) -> (mult (3 + a) b =? mult 3 b + mult a b). Proof. intro H. verit H. Qed. End NonLinear. (* You can use <Add_lemmas H1 .. Hn> to permanently add the lemmas H1 .. Hn to the environment. If you did so in a section then, at the end of the section, you should use <Clear_lemmas> to empty the globally added lemmas because those lemmas won't be available outside of the section. *) Section mult3. Variable mult3 : Z -> Z. Hypothesis mult3_0 : mult3 0 =? 0. Hypothesis mult3_Sn : forall n, mult3 (n+1) =? mult3 n + 3. Add_lemmas mult3_0 mult3_Sn. Lemma mult_3_4_12 : mult3 4 =? 12. Proof. verit. Qed. Clear_lemmas. End mult3. (* Examples of the smt tactic (requires verit and cvc4 in your PATH environment variable): - propositional logic - theory of equality - linear integer arithmetic - theory of fixed-sized bit-vectors - theory of arrays *) Goal forall a b c, ((a || b || c) && ((negb a) || (negb b) || (negb c)) && ((negb a) || b) && ((negb b) || c) && ((negb c) || a)) = false. Proof. smt. Qed. Goal forall (a b : Z) (P : Z -> bool) (f : Z -> Z), (negb (Z.eqb (f a) b)) || (negb (P (f a))) || (P b). Proof. smt. Qed. Goal forall b1 b2 x1 x2, implb (ifb b1 (ifb b2 (Z.eqb (2*x1+1) (2*x2+1)) (Z.eqb (2*x1+1) (2*x2))) (ifb b2 (Z.eqb (2*x1) (2*x2+1)) (Z.eqb (2*x1) (2*x2)))) ((implb b1 b2) && (implb b2 b1) && (Z.eqb x1 x2)). Proof. smt. Qed. Goal forall (x y: Z) (f: Z -> Z), x = y + 1 -> f y = f (x - 1). Proof. smt. Qed. Goal forall (bv1 bv2 bv3: bitvector 4), bv1 = #b|0|0|0|0| /\ bv2 = #b|1|0|0|0| /\ bv3 = #b|1|1|0|0| -> bv_ultP bv1 bv2 /\ bv_ultP bv2 bv3. Proof. smt. Qed. (* All tactics have a "no_check" variant that is faster but, in case of failure, it will only fail at Qed *) Goal forall (bv1 bv2 bv3: bitvector 4), bv1 = #b|0|0|0|0| /\ bv2 = #b|1|0|0|0| /\ bv3 = #b|1|1|0|0| -> bv_ultP bv1 bv2 /\ bv_ultP bv2 bv3. Proof. smt_no_check. Qed. (* From cvc4_bool : Uncaught exception Not_found *) (* Goal forall (a b c d: farray Z Z), *) (* b[0 <- 4] = c -> *) (* d = b[0 <- 4][1 <- 4] -> *) (* a = d[1 <- b[1]] -> *) (* a = c. *) (* Proof. *) (* smt. *) (* Qed. *) Goal forall (a b: farray Z Z) (v w x y z t: Z) (r s: bitvector 4) (f: Z -> Z) (g: farray Z Z -> Z) (h: bitvector 4 -> Z), a[x <- v] = b /\ a[y <- w] = b -> a[z <- w] = b /\ a[t <- v] = b -> r = s -> v < x + 10 /\ v > x - 5 -> ~ (g a = g b) \/ f (h r) = f (h s). Proof. smt. Qed. (** SMTCoq also provides conversion tactics, to inject various integer types into the type Z supported by SMTCoq. They can be called before the standard SMTCoq tactics. **) Local Open Scope positive_scope. Goal forall (f : positive -> positive) (x y : positive), implb ((x + 3) =? y) ((f (x + 3)) <=? (f y)) = true. Proof. pos_convert. verit. Qed. Goal forall (f : positive -> positive) (x y : positive), implb ((x + 3) =? y) ((3 <? y) && ((f (x + 3)) <=? (f y))) = true. Proof. pos_convert. verit. Qed. Local Close Scope positive_scope. Local Open Scope N_scope. Goal forall (f : N -> N) (x y : N), implb ((x + 3) =? y) ((f (x + 3)) <=? (f y)) = true. Proof. N_convert. verit. Qed. Goal forall (f : N -> N) (x y : N), implb ((x + 3) =? y) ((2 <? y) && ((f (x + 3)) <=? (f y))) = true. Proof. N_convert. verit. Qed. Local Close Scope N_scope. Require Import NPeano. Local Open Scope nat_scope. Goal forall (f : nat -> nat) (x y : nat), implb (Nat.eqb (x + 3) y) ((f (x + 3)) <=? (f y)) = true. Proof. nat_convert. verit. Qed. Goal forall (f : nat -> nat) (x y : nat), implb (Nat.eqb (x + 3) y) ((2 <? y) && ((f (x + 3)) <=? (f y))) = true. Proof. nat_convert. verit. Qed. Local Close Scope nat_scope. (* An example with all 3 types and a binary function *) Goal forall f : positive -> nat -> N, forall (x : positive) (y : nat), implb (x =? 3)%positive (implb (Nat.eqb y 7) (implb (f 3%positive 7%nat =? 12)%N (f x y =? 12)%N)) = true. pos_convert. nat_convert. N_convert. verit. Qed. Open Scope Z_scope. (** Now more insightful examples. The first one automatically proves properties in group theory. **) Section group. Variable op : Z -> Z -> Z. Variable inv : Z -> Z. Variable e : Z. (* We can prove automatically that we have a group if we only have the "left" versions of the axioms of a group *) Hypothesis associative : forall a b c : Z, op a (op b c) =? op (op a b) c. Hypothesis inverse : forall a : Z, (op (inv a) a =? e). Hypothesis identity : forall a : Z, (op e a =? a). Add_lemmas associative identity inverse. (* The "right" version of inverse *) Lemma inverse' : forall a : Z, (op a (inv a) =? e). Proof. smt. Qed. (* The "right" version of identity *) Lemma identity' : forall a : Z, (op a e =? a). Proof. smt inverse'. Qed. (* Some other interesting facts about groups *) Lemma unique_identity e': (forall z, op e' z =? z) -> e' =? e. Proof. intros pe'; smt pe'. Qed. Lemma simplification_right x1 x2 y: op x1 y =? op x2 y -> x1 =? x2. Proof. intro H. smt_no_check H inverse'. Qed. Lemma simplification_left x1 x2 y: op y x1 =? op y x2 -> x1 =? x2. Proof. intro H. smt_no_check H inverse'. Qed. Clear_lemmas. End group. (* A full example coming from CompCert, slightly revisited. See: https://hal.inria.fr/inria-00289542 https://xavierleroy.org/memory-model/doc/Memory.html (Section 3) *) Section CompCert. Definition block := Z. Variable mem: Set. Variable dec_mem : CompDec mem. Variable alloc_block: mem -> Z -> Z -> block. Variable alloc_mem: mem -> Z -> Z -> mem. Variable valid_block: mem -> block -> bool. Hypothesis alloc_valid_block_1: forall m lo hi b, valid_block (alloc_mem m lo hi) b ---> ((b =? (alloc_block m lo hi)) || valid_block m b). Hypothesis alloc_valid_block_2: forall m lo hi b, ((b =? (alloc_block m lo hi)) || valid_block m b) ---> valid_block (alloc_mem m lo hi) b. Hypothesis alloc_not_valid_block: forall m lo hi, negb (valid_block m (alloc_block m lo hi)). Lemma alloc_valid_block_inv m lo hi b : valid_block m b -> valid_block (alloc_mem m lo hi) b. Proof. intro H. unfold block in *. verit alloc_valid_block_2 H. Qed. Lemma alloc_not_valid_block_2 m lo hi b' : valid_block m b' -> b' =? (alloc_block m lo hi) = false. Proof. intro H. unfold block in *. verit alloc_not_valid_block H. Qed. End CompCert.
/- Copyright 2020 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -/ import order.filter.basic import data.real.basic import topology.basic import topology.instances.real import data.complex.exponential import topology.algebra.infinite_sum import data.nat.basic import analysis.specific_limits import analysis.calculus.deriv import analysis.asymptotics import formal_ml.nat import formal_ml.core lemma abs_eq_norm {a:ℝ}:abs a = ∥a∥ := rfl ---Results about the reals-------------------------------------------------------------------------- --Unused (except in classical_limit.lean) lemma inv_pow_cancel2 (x:ℝ) (n:ℕ):(x≠ 0) → (x⁻¹)^n * (x)^n = 1 := begin intro A1, rw ← mul_pow, rw inv_mul_cancel, simp, apply A1, end lemma real_nat_abs_coe {n:ℕ}:abs (n:ℝ)= (n:ℝ) := begin have A1:abs (n:ℝ) =((abs n):ℝ) := rfl, rw A1, simp, end lemma abs_pos_of_nonzero {x:ℝ}:x ≠ 0 → 0 < abs x := begin intro A1, have A2:x < 0 ∨ x = 0 ∨ 0 < x := lt_trichotomy x 0, cases A2, { apply abs_pos_of_neg A2, }, cases A2, { exfalso, apply A1, apply A2, }, { apply abs_pos_of_pos A2, } end lemma pow_two_pos (n:ℕ):0 < (2:ℝ)^n := begin apply pow_pos, apply zero_lt_two, end lemma pow_nonneg_of_nonneg {x:ℝ} {k:ℕ}:0 ≤ x → 0 ≤ x^k := begin intro A1, induction k, { simp, apply le_of_lt, apply zero_lt_one, }, { rw pow_succ, apply mul_nonneg, apply A1, apply k_ih, } end lemma real_pow_mono {x y:real} {k:ℕ}: 0 ≤ x → x ≤ y → x^k ≤ y^k := begin intros A0 A1, induction k, { simp, }, { rw pow_succ, rw pow_succ, apply mul_le_mul, { exact A1, }, { apply k_ih, }, { simp, apply pow_nonneg_of_nonneg, apply A0, }, { simp, apply le_trans, apply A0, apply A1, }, } end lemma div_inv (x:ℝ):1/x = x⁻¹ := begin simp, end lemma inv_exp (n:ℕ):((2:ℝ)^n)⁻¹ = ((2:ℝ)⁻¹)^n := begin induction n, { simp, }, { have A1:nat.succ n_n = 1 + n_n, { apply nat_succ_one_add, }, rw A1, rw pow_add, rw pow_add, simp, rw mul_inv', } end lemma abs_mul_eq_mul_abs (a b:ℝ):(0 ≤ a) → abs (a * b) = a * abs (b) := begin intro A1, rw abs_mul, rw abs_of_nonneg, apply A1, end lemma pos_of_pos_of_mul_pos {a b:ℝ}:(0 ≤ a) → (0 < a * b) → 0 < b := begin intros A1 A2, have A3:0 < b ∨ (b ≤ 0), { apply lt_or_ge, }, cases A3, { apply A3, }, { exfalso, have A3A:(a * b)≤ 0, { apply mul_nonpos_of_nonneg_of_nonpos, apply A1, apply A3, }, apply not_lt_of_le A3A, apply A2, } end lemma inv_pos_of_pos {a:ℝ}:(0 < a) → 0 < (a⁻¹) := begin intro A1, apply pos_of_pos_of_mul_pos, apply le_of_lt, apply A1, rw mul_inv_cancel, apply zero_lt_one, intro A2, rw A2 at A1, apply lt_irrefl _ A1, end lemma inv_lt_one_of_one_lt {a:ℝ}:(1 < a) → (a⁻¹)< 1 := begin intro A1, have A2:0 < a, { apply lt_trans, apply zero_lt_one, apply A1, }, have A3:0 < a⁻¹, { apply inv_pos_of_pos A2, }, have A4:a⁻¹ * 1 < a⁻¹ * a, { apply mul_lt_mul_of_pos_left, apply A1, apply A3, }, rw inv_mul_cancel at A4, rw mul_one at A4, apply A4, { intro A5, rw A5 at A2, apply lt_irrefl _ A2, } end lemma div_def {a b:ℝ}:a/b = a * b⁻¹ := rfl --Raise to a linear ordered field (or a linear ordered division ring?). --Unused. lemma div_lt_div_of_lt_of_lt {a b c:ℝ}:(0<c) → (a < b) → (a/c < b/c) := begin intros A1 A2, rw div_def, rw div_def, apply mul_lt_mul_of_pos_right, apply A2, apply inv_pos_of_pos, apply A1, end --TODO: replace with half_lt_self lemma epsilon_half_lt_epsilon {α:Type*} [linear_ordered_field α] {ε:α}: 0 < ε → (ε / 2) < ε := begin apply half_lt_self, end --TODO: replace with inv_nonneg.mpr. lemma inv_nonneg_of_nonneg {a:ℝ}:(0 ≤ a) → (0 ≤ a⁻¹) := begin apply inv_nonneg.mpr, end lemma move_le {a b c:ℝ}:(0 < c) → (a ≤ b * c) → (a * c⁻¹) ≤ b := begin intros A1 A2, have A3:0 < c⁻¹ := inv_pos_of_pos A1, have A4:(a * c⁻¹) ≤ (b * c) * (c⁻¹), { apply mul_le_mul_of_nonneg_right, apply A2, apply le_of_lt, apply A3, }, have A5:b * c * c⁻¹ = b, { rw mul_assoc, rw mul_inv_cancel, rw mul_one, symmetry, apply ne_of_lt, apply A1, }, rw A5 at A4, apply A4, end lemma move_le2 {a b c:ℝ}:(0 < c) → (a * c⁻¹) ≤ b → (a ≤ b * c) := begin intros A1 A2, have A4:(a * c⁻¹) * c ≤ (b * c), { apply mul_le_mul_of_nonneg_right, apply A2, apply le_of_lt, apply A1, }, have A5:a * c⁻¹ * c = a, { rw mul_assoc, rw inv_mul_cancel, rw mul_one, symmetry, apply ne_of_lt, apply A1, }, rw A5 at A4, apply A4, end --Probably a repeat. --nlinarith failed. lemma inv_decreasing {x y:ℝ}:(0 < x) → (x < y)→ (y⁻¹ < x⁻¹) := begin intros A1 A2, have A3:0< y, { apply lt_trans, apply A1, apply A2, }, have A4:0 < x * y, { apply mul_pos;assumption, }, have A5:x⁻¹ * x < x⁻¹ * y, { apply mul_lt_mul_of_pos_left, apply A2, apply inv_pos_of_pos, apply A1, }, rw inv_mul_cancel at A5, have A6:1 * y⁻¹ < x⁻¹ * y * y⁻¹, { apply mul_lt_mul_of_pos_right, apply A5, apply inv_pos_of_pos, apply A3, }, rw one_mul at A6, rw mul_assoc at A6, rw mul_inv_cancel at A6, rw mul_one at A6, apply A6, { intro A7, rw A7 at A3, apply lt_irrefl 0 A3, }, { intro A7, rw A7 at A1, apply lt_irrefl 0 A1, } end lemma abs_nonzero_pos {x:ℝ}:(x ≠ 0) → (0 < abs (x)) := begin intro A1, have A2:(x < 0 ∨ x = 0 ∨ 0 < x) := lt_trichotomy x 0, cases A2, { apply abs_pos_of_neg, apply A2, }, cases A2, { exfalso, apply A1, apply A2, }, { apply abs_pos_of_pos, apply A2, }, end lemma diff_ne_zero_of_ne {x x':ℝ}:(x ≠ x') → (x - x' ≠ 0) := begin intro A1, intro A2, apply A1, linarith [A2], end --nlinarith failed lemma abs_diff_pos {x x':ℝ}:(x ≠ x') → (0 < abs (x - x')) := begin intro A1, apply abs_nonzero_pos, apply diff_ne_zero_of_ne A1, end --nlinarith failed lemma neg_inv_of_neg {x:ℝ}:x < 0 → (x⁻¹ < 0) := begin intro A1, have A2:x⁻¹ < 0 ∨ (0 ≤ x⁻¹) := lt_or_le x⁻¹ 0, cases A2, { apply A2, }, { exfalso, have A3:(x * x⁻¹ ≤ 0), { apply mul_nonpos_of_nonpos_of_nonneg, apply le_of_lt, apply A1, apply A2, }, rw mul_inv_cancel at A3, apply not_lt_of_le A3, apply zero_lt_one, intro A4, rw A4 at A1, apply lt_irrefl (0:ℝ), apply A1, } end lemma sub_inv {a b:ℝ}:a - (a - b) = b := begin linarith, end --Classical, but filter_util.lean still has dependencies. lemma x_in_Ioo {x r:ℝ}:(0 < r) → (x∈ set.Ioo (x- r) (x + r)) := begin intro A1, simp [A1], end --Classical. lemma abs_lt2 {x x' r:ℝ}: (abs (x' - x) < r) ↔ ((x - r < x') ∧ (x' < x + r)) := begin rw abs_lt, split;intros A1;cases A1 with A2 A3;split, { apply add_lt_of_lt_sub_left A2, }, { apply lt_add_of_sub_left_lt A3, }, { apply lt_sub_left_of_add_lt A2, }, { apply sub_left_lt_of_lt_add A3, } end --Classical. lemma abs_lt_iff_in_Ioo {x x' r:ℝ}: (abs (x' - x) < r) ↔ x' ∈ set.Ioo (x - r) (x + r) := begin apply iff.trans, apply abs_lt2, simp, end --TODO: replace with neg_neg_of_pos lemma neg_lt_of_pos {x:ℝ}:(0 < x) → (-x < 0) := begin apply neg_neg_of_pos, end --Classical. lemma abs_lt_iff_in_Ioo2 {x x' r:ℝ}: (abs (x - x') < r) ↔ x' ∈ set.Ioo (x - r) (x + r) := begin have A1:abs (x - x')=abs (x' - x), { have A1A:x' - x = -(x - x'), { simp, }, rw A1A, rw abs_neg, }, rw A1, apply abs_lt_iff_in_Ioo, end --Unlikely novel. lemma real_lt_coe {a b:ℕ}:a < b → (a:ℝ) < (b:ℝ) := begin simp, end lemma add_of_sub {a b c:ℝ}:a - b = c ↔ a = b + c := begin split;intros A1;linarith [A1], end --linarith and nlinarith fails. lemma sub_half_eq_half {a:ℝ}:(a - a * 2⁻¹)=a * 2⁻¹ := begin rw add_of_sub, rw ← div_def, simp, end --linarith and nlinarith fails. lemma half_pos2:0 < (2:ℝ)⁻¹ := begin apply inv_pos_of_pos, apply zero_lt_two, end /- The halfway point is in the middle. -/ lemma half_bound_lower {a b:ℝ}:a < b → a < (a + b)/2 := begin intro A1, linarith [A1], end lemma half_bound_upper {a b:ℝ}:a < b → (a + b)/2 < b := begin intro A1, linarith [A1], end lemma lt_of_sub_lt_sub {a b c:ℝ}:a - c < b - c → a < b := begin intro A1, linarith [A1], end lemma abs_antisymm {a b:ℝ}:abs (a - b) = abs (b - a) := begin have A1:-(a-b)=(b - a), { simp, }, rw ← A1, rw abs_neg, end lemma add_sub_triangle {a b c:ℝ}:(a - b) = (a - c) + (c - b) := begin linarith, end lemma abs_triangle {a b c:ℝ}:abs (a - b) ≤ abs (a - c) + abs (c - b) := begin have h_nonneg_or_neg:∀ a:ℝ, (0 ≤ a)∨ (a<0), {intros a,have A1:=lt_or_ge a 0, cases A1,apply or.inr A1, apply or.inl A1}, cases (h_nonneg_or_neg (a - b)) with A1 A1; cases (h_nonneg_or_neg (a - c)) with A2 A2; cases (h_nonneg_or_neg (c - b)) with A3 A3; simp [A1,A2,A3,abs_of_nonneg,abs_of_neg]; linarith, end lemma pow_complex {x:ℝ} {n:ℕ}:((x:ℂ)^n).re=(x^n) := begin induction n, { simp, }, { rw pow_succ, rw pow_succ, simp, rw n_ih, simp, } end lemma div_complex {x y:ℝ}:((x:ℂ)/(y:ℂ)).re=x/y := begin rw complex.div_re, simp, have A1:y=0 ∨ y≠ 0 := eq_or_ne, cases A1, { rw A1, simp, }, { rw mul_div_mul_right, apply A1, } end lemma complex_norm_sq_nat {y:ℕ}:complex.norm_sq (y:ℂ) = ((y:ℝ) * (y:ℝ)) := begin unfold complex.norm_sq, simp, end lemma num_denom_eq (a b c d:ℝ): (a = b) → (c = d) → (a/c)=(b/d) := begin intros A1 A2, rw A1, rw A2, end lemma complex_pow_div_complex_re {x:ℝ} {n:ℕ} {y:ℕ}:(((x:ℂ)^n)/(y:ℂ)).re=x^n/(y:ℝ) := begin rw complex.div_re, simp, have A1:(y:ℝ)=0 ∨ (y:ℝ) ≠ 0 := eq_or_ne, cases A1, { rw A1, simp, }, { rw complex_norm_sq_nat, rw mul_div_mul_right, apply num_denom_eq, { rw pow_complex, }, { refl, }, apply A1, } end lemma half_lt_one:(2:ℝ)⁻¹ < 1 := begin have A1:1/(2:ℝ) < 1 := epsilon_half_lt_epsilon zero_lt_one, rw div_def at A1, rw one_mul at A1, apply A1, end lemma half_pos_lit:0 < (2:ℝ)⁻¹ := begin apply inv_pos_of_pos, apply zero_lt_two, end /- lemma div_re_eq_re_div_re (x y:ℂ):(x / y).re = (x.re)/(y.re) := begin simp, end -/ --It is a common pattern that we calculate the distance to the middle, --and then show that if you add or subtract it, you get to that middle. lemma half_equal {x y ε:ℝ}:ε = (x - y)/2 → x - ε = y + ε := begin intro A1, have A2:(x - ε) + (ε - y) = (y + ε) + (ε - y), { rw ← add_sub_triangle, rw ← add_sub_assoc, rw add_comm (y+ε), rw add_comm y ε, rw ← add_assoc, rw add_sub_assoc, rw sub_self, rw add_zero, rw A1, simp, }, apply add_right_cancel A2, end lemma real.unit_frac_pos (n:ℕ):0 < (1/((n:real) + 1)) := begin simp, -- ⊢ 0 < ↑n + 1 rw add_comm, apply add_pos_of_pos_of_nonneg, { apply zero_lt_one, }, { simp, }, end --TODO:Unlikely to be novel. --Solvable by linarith. lemma real.sub_lt_sub_of_lt {a b c:real}:a < b → a - c < b - c := begin simp, end lemma real.rat_le_rat_iff {q r:ℚ}:q ≤ r ↔ (q:ℝ) ≤ (r:ℝ) := begin rw ← real.of_rat_eq_cast, rw ← real.of_rat_eq_cast, rw le_iff_lt_or_eq, rw le_iff_lt_or_eq, split;intros A3;cases A3, { left, rw real.of_rat_lt, apply A3, }, { right, simp, apply A3, }, { left, rw ← real.of_rat_lt, apply A3, }, { right, simp at A3, apply A3, }, end lemma real.eq_add_of_sub_eq {a b c:real}: a - b = c → a = b + c := begin intros A1, linarith [A1], end lemma real.sub_add_sub {a b c:real}:(a - b) + (b - c) = a - c := by linarith
-- (Γ ⇒ Δ ∪ · A) → (Γ ⇒ Δ ∪ · (A ∨ B)) -- The conclusion (A ∨ B) is the principal/major formula of the rule. -- The premiss A is the active/minor formula of the rule -- Γ, Δ is the side formulas of the rule. -- Γ ⇒ Δ -- LHS Γ is the antecedent of the sequent. -- RHS Γ is the consequent of the sequent.
lemma pCons_0_0 [simp]: "pCons 0 0 = 0"
--- author: Nathan Carter ([email protected]) --- This answer assumes you have imported SymPy as follows. ```python from sympy import * # load all math functions init_printing( use_latex='mathjax' ) # use pretty math output ``` Let's compute the area under $\sin x$ from $x=0$ to $x=\pi$. We use the same technique as in how to write and evaluate indefinite integrals, except that we add the lower and upper bounds together with $x$, as shown below. ```python var( 'x' ) formula = sin(x) Integral( formula, (x,0,pi) ) ``` $\displaystyle \int\limits_{0}^{\pi} \sin{\left(x \right)}\, dx$ The above code just displays the definite integral. To evaluate it, use the `integrate` command. ```python integrate( formula, (x,0,pi) ) ``` $\displaystyle 2$
############################################################################# ## #W sml512.f GAP library of groups Hans Ulrich Besche ## Bettina Eick, Eamonn O'Brien ## SMALL_GROUP_LIB[ 512 ][ 6 ] := [ "%%%%%/8Yh09,,8&(D8,,%D%b&%%%%%!}tH%:i!}wH%0k!}uH%0k!}xH%0k!}t3%0k!}w3%0k!}u\ 3%0k!}x3%0k!}tQ%0k!}wQ%0k!}uQ%0k!}xQ%0k!}t%D0k!}w%D2/ }u%D%I6Y.QAd*M:^2UE(K8\ [0SCf,O=b4WGj&J7Z/RBe+N<a3Fi)L9]1TDg-P>c5XHk }x%D%I6Y.QAd*M:2UEh(K8[0SCf,Ob4\ WGj&J7Z/RBe+<a3VFi)L9]1TDg-P>c5XHk }%DD%I6Y.Qd*M:^2", Concatenation( "%%%%%/8Yh09,,8&(D8,%%D%D&%%%%% }tDUEh(K8[0SC,O=b4WGj&J7ZRBe+N<a3VFi)L9]1Dg-\ P>c5XHk }wD%IY.QAd*M:^2UE(K80SCf,O=b4WGjJ7Z/RBe+N<a3VFi)9]1TDg-P>c5XHk }uD%I\ 6Y.QAd*M:^2Uh(K[0SCf,O=b4WG&J7Z/RBe+N<a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z*%+,!z{*%+,!zzH%+,!z{H%+,!}t\ 3%0k!}tQ%0k!zw%D+*!z{%D+,!zzDD+,!z{DD+,!}t/D0k!}tMD0k!zw)D+*!z{)D+,!zzGD+,!z\ {GD+,!}t2D0k!}bPD/]", "%%%%%k8Yj/8,,8b(D8,,%&%%%%%%%%!}tPM=T!zw&M+*!z{&M+,!zzEM+,!z{EM+,!}t0M0k!}t\ NM0k!zw*M+*!z{*M+,!zzHM+,!z{HM+,!}t3M0k!}tQM0k!}t%),M!}w%)0k!}u%)0k!}x%)0k!}\ tD)0k!}wD)0k!z&D),o", "%%%%%k8Yj/8,,8b%D%%)%&%%%%%%%%!}uD=/!}xD0k!}t/0k!}w/0k!}u/0k!}x/0k!}tM0k!}w\ M0k!}uM0k!}xM0k!}t),M!}w)0k!}u)0k!}x)0k!}tG0k!}wG0g" ];
[STATEMENT] theorem RA1: "(P ;; (Q ;; R)) = ((P ;; Q) ;; R)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. P ;; Q ;; R = (P ;; Q) ;; R [PROOF STEP] by (simp add: seqr_assoc)
# Aufgabe 7 library(ggplot2) png(filename="Gaussian-k-sigma.png") # Parameters mu = 3 sigma = 3 step_size = 0.05 k = 10 # Logic x = seq(from=mu-k*sigma, to=mu+k*sigma, by=step_size) dens = dnorm(x, mean=mu, sd=sigma) d <- data.frame(x=x, y=dens) plot(d, type="lines") for (k in k:1) { print(paste("k=", k, ", P(...)=", pnorm(mu+k*sigma, mean=mu, sd=sigma) - pnorm(mu-k*sigma, mean=mu, sd=sigma))) k1start = mu - k*sigma k1end = mu + k*sigma cord.x <- c(k1start, seq(k1start, k1end, step_size), k1end) cord.y <- c(0,dnorm(seq(k1start, k1end, step_size), mean=mu, sd=sigma),0) polygon(cord.x, cord.y, col=rainbow(3)[k]) } dev.off()
State Before: α : Type u s : Set α c : Cardinal ⊢ (#{ t // t ⊆ s ∧ (#↑t) ≤ c }) ≤ max (#↑s) ℵ₀ ^ c State After: α : Type u s : Set α c : Cardinal ⊢ (#{ t // t ⊆ s ∧ (#↑t) ≤ c }) ≤ (#{ t // (#↑t) ≤ c }) Tactic: refine' le_trans _ (mk_bounded_set_le s c) State Before: α : Type u s : Set α c : Cardinal ⊢ (#{ t // t ⊆ s ∧ (#↑t) ≤ c }) ≤ (#{ t // (#↑t) ≤ c }) State After: case refine'_1 α : Type u s : Set α c : Cardinal ⊢ { t // t ⊆ s ∧ (#↑t) ≤ c } ↪ Set ↑s case refine'_2 α : Type u s : Set α c : Cardinal ⊢ ∀ (a : { t // t ⊆ s ∧ (#↑t) ≤ c }), ↑?refine'_1 a ∈ fun t => Quot.lift ((fun α β => Nonempty (α ↪ β)) ↑t) (_ : ∀ (a b : Type u), a ≈ b → Nonempty (↑t ↪ a) = Nonempty (↑t ↪ b)) c Tactic: refine' ⟨Embedding.codRestrict _ _ _⟩ State Before: case refine'_1 α : Type u s : Set α c : Cardinal ⊢ { t // t ⊆ s ∧ (#↑t) ≤ c } ↪ Set ↑s case refine'_2 α : Type u s : Set α c : Cardinal ⊢ ∀ (a : { t // t ⊆ s ∧ (#↑t) ≤ c }), ↑?refine'_1 a ∈ fun t => Quot.lift ((fun α β => Nonempty (α ↪ β)) ↑t) (_ : ∀ (a b : Type u), a ≈ b → Nonempty (↑t ↪ a) = Nonempty (↑t ↪ b)) c State After: case refine'_1 α : Type u s : Set α c : Cardinal ⊢ Injective fun t => Subtype.val ⁻¹' ↑t case refine'_2 α : Type u s : Set α c : Cardinal ⊢ ∀ (a : { t // t ⊆ s ∧ (#↑t) ≤ c }), ↑{ toFun := fun t => Subtype.val ⁻¹' ↑t, inj' := ?refine'_1 } a ∈ fun t => Quot.lift ((fun α β => Nonempty (α ↪ β)) ↑t) (_ : ∀ (a b : Type u), a ≈ b → Nonempty (↑t ↪ a) = Nonempty (↑t ↪ b)) c Tactic: use fun t => (↑) ⁻¹' t.1 State Before: case refine'_2 α : Type u s : Set α c : Cardinal ⊢ ∀ (a : { t // t ⊆ s ∧ (#↑t) ≤ c }), ↑{ toFun := fun t => Subtype.val ⁻¹' ↑t, inj' := (_ : ∀ ⦃a₁ a₂ : { t // t ⊆ s ∧ (#↑t) ≤ c }⦄, (fun t => Subtype.val ⁻¹' ↑t) a₁ = (fun t => Subtype.val ⁻¹' ↑t) a₂ → a₁ = a₂) } a ∈ fun t => Quot.lift ((fun α β => Nonempty (α ↪ β)) ↑t) (_ : ∀ (a b : Type u), a ≈ b → Nonempty (↑t ↪ a) = Nonempty (↑t ↪ b)) c State After: case refine'_2.mk.intro α : Type u s : Set α c : Cardinal t : Set α left✝ : t ⊆ s h2t : (#↑t) ≤ c ⊢ ↑{ toFun := fun t => Subtype.val ⁻¹' ↑t, inj' := (_ : ∀ ⦃a₁ a₂ : { t // t ⊆ s ∧ (#↑t) ≤ c }⦄, (fun t => Subtype.val ⁻¹' ↑t) a₁ = (fun t => Subtype.val ⁻¹' ↑t) a₂ → a₁ = a₂) } { val := t, property := (_ : t ⊆ s ∧ (#↑t) ≤ c) } ∈ fun t => Quot.lift ((fun α β => Nonempty (α ↪ β)) ↑t) (_ : ∀ (a b : Type u), a ≈ b → Nonempty (↑t ↪ a) = Nonempty (↑t ↪ b)) c Tactic: rintro ⟨t, _, h2t⟩ State Before: case refine'_2.mk.intro α : Type u s : Set α c : Cardinal t : Set α left✝ : t ⊆ s h2t : (#↑t) ≤ c ⊢ ↑{ toFun := fun t => Subtype.val ⁻¹' ↑t, inj' := (_ : ∀ ⦃a₁ a₂ : { t // t ⊆ s ∧ (#↑t) ≤ c }⦄, (fun t => Subtype.val ⁻¹' ↑t) a₁ = (fun t => Subtype.val ⁻¹' ↑t) a₂ → a₁ = a₂) } { val := t, property := (_ : t ⊆ s ∧ (#↑t) ≤ c) } ∈ fun t => Quot.lift ((fun α β => Nonempty (α ↪ β)) ↑t) (_ : ∀ (a b : Type u), a ≈ b → Nonempty (↑t ↪ a) = Nonempty (↑t ↪ b)) c State After: no goals Tactic: exact (mk_preimage_of_injective _ _ Subtype.val_injective).trans h2t State Before: case refine'_1 α : Type u s : Set α c : Cardinal ⊢ Injective fun t => Subtype.val ⁻¹' ↑t State After: case refine'_1.mk.intro.mk.intro α : Type u s : Set α c : Cardinal t : Set α ht1 : t ⊆ s ht2 : (#↑t) ≤ c t' : Set α h1t' : t' ⊆ s h2t' : (#↑t') ≤ c h : (fun t => Subtype.val ⁻¹' ↑t) { val := t, property := (_ : t ⊆ s ∧ (#↑t) ≤ c) } = (fun t => Subtype.val ⁻¹' ↑t) { val := t', property := (_ : t' ⊆ s ∧ (#↑t') ≤ c) } ⊢ { val := t, property := (_ : t ⊆ s ∧ (#↑t) ≤ c) } = { val := t', property := (_ : t' ⊆ s ∧ (#↑t') ≤ c) } Tactic: rintro ⟨t, ht1, ht2⟩ ⟨t', h1t', h2t'⟩ h State Before: case refine'_1.mk.intro.mk.intro α : Type u s : Set α c : Cardinal t : Set α ht1 : t ⊆ s ht2 : (#↑t) ≤ c t' : Set α h1t' : t' ⊆ s h2t' : (#↑t') ≤ c h : (fun t => Subtype.val ⁻¹' ↑t) { val := t, property := (_ : t ⊆ s ∧ (#↑t) ≤ c) } = (fun t => Subtype.val ⁻¹' ↑t) { val := t', property := (_ : t' ⊆ s ∧ (#↑t') ≤ c) } ⊢ { val := t, property := (_ : t ⊆ s ∧ (#↑t) ≤ c) } = { val := t', property := (_ : t' ⊆ s ∧ (#↑t') ≤ c) } State After: case refine'_1.mk.intro.mk.intro.a α : Type u s : Set α c : Cardinal t : Set α ht1 : t ⊆ s ht2 : (#↑t) ≤ c t' : Set α h1t' : t' ⊆ s h2t' : (#↑t') ≤ c h : (fun t => Subtype.val ⁻¹' ↑t) { val := t, property := (_ : t ⊆ s ∧ (#↑t) ≤ c) } = (fun t => Subtype.val ⁻¹' ↑t) { val := t', property := (_ : t' ⊆ s ∧ (#↑t') ≤ c) } ⊢ ↑{ val := t, property := (_ : t ⊆ s ∧ (#↑t) ≤ c) } = ↑{ val := t', property := (_ : t' ⊆ s ∧ (#↑t') ≤ c) } Tactic: apply Subtype.eq State Before: case refine'_1.mk.intro.mk.intro.a α : Type u s : Set α c : Cardinal t : Set α ht1 : t ⊆ s ht2 : (#↑t) ≤ c t' : Set α h1t' : t' ⊆ s h2t' : (#↑t') ≤ c h : (fun t => Subtype.val ⁻¹' ↑t) { val := t, property := (_ : t ⊆ s ∧ (#↑t) ≤ c) } = (fun t => Subtype.val ⁻¹' ↑t) { val := t', property := (_ : t' ⊆ s ∧ (#↑t') ≤ c) } ⊢ ↑{ val := t, property := (_ : t ⊆ s ∧ (#↑t) ≤ c) } = ↑{ val := t', property := (_ : t' ⊆ s ∧ (#↑t') ≤ c) } State After: case refine'_1.mk.intro.mk.intro.a α : Type u s : Set α c : Cardinal t : Set α ht1 : t ⊆ s ht2 : (#↑t) ≤ c t' : Set α h1t' : t' ⊆ s h2t' : (#↑t') ≤ c h : Subtype.val ⁻¹' t = Subtype.val ⁻¹' t' ⊢ t = t' Tactic: dsimp only at h⊢ State Before: case refine'_1.mk.intro.mk.intro.a α : Type u s : Set α c : Cardinal t : Set α ht1 : t ⊆ s ht2 : (#↑t) ≤ c t' : Set α h1t' : t' ⊆ s h2t' : (#↑t') ≤ c h : Subtype.val ⁻¹' t = Subtype.val ⁻¹' t' ⊢ t = t' State After: no goals Tactic: refine' (preimage_eq_preimage' _ _).1 h <;> rw [Subtype.range_coe] <;> assumption
[STATEMENT] lemma dirichlet_inverse_cong [cong]: assumes "\<And>n. n > 0 \<Longrightarrow> f n = f' n" "i = i'" "n = n'" shows "dirichlet_inverse f i n = dirichlet_inverse f' i' n'" [PROOF STATE] proof (prove) goal (1 subgoal): 1. dirichlet_inverse f i n = dirichlet_inverse f' i' n' [PROOF STEP] proof - [PROOF STATE] proof (state) goal (1 subgoal): 1. dirichlet_inverse f i n = dirichlet_inverse f' i' n' [PROOF STEP] have "dirichlet_inverse f i n = dirichlet_inverse f' i n" [PROOF STATE] proof (prove) goal (1 subgoal): 1. dirichlet_inverse f i n = dirichlet_inverse f' i n [PROOF STEP] using assms(1) [PROOF STATE] proof (prove) using this: 0 < ?n \<Longrightarrow> f ?n = f' ?n goal (1 subgoal): 1. dirichlet_inverse f i n = dirichlet_inverse f' i n [PROOF STEP] proof (induction n rule: dirichlet_inverse_induct) [PROOF STATE] proof (state) goal (3 subgoals): 1. (\<And>n. 0 < n \<Longrightarrow> f n = f' n) \<Longrightarrow> dirichlet_inverse f i 0 = dirichlet_inverse f' i 0 2. (\<And>n. 0 < n \<Longrightarrow> f n = f' n) \<Longrightarrow> dirichlet_inverse f i (Suc 0) = dirichlet_inverse f' i (Suc 0) 3. \<And>n. \<lbrakk>1 < n; \<And>k. \<lbrakk>k < n; \<And>n. 0 < n \<Longrightarrow> f n = f' n\<rbrakk> \<Longrightarrow> dirichlet_inverse f i k = dirichlet_inverse f' i k; \<And>n. 0 < n \<Longrightarrow> f n = f' n\<rbrakk> \<Longrightarrow> dirichlet_inverse f i n = dirichlet_inverse f' i n [PROOF STEP] case (gt1 n) [PROOF STATE] proof (state) this: 1 < n \<lbrakk>?k < n; \<And>n. 0 < n \<Longrightarrow> f n = f' n\<rbrakk> \<Longrightarrow> dirichlet_inverse f i ?k = dirichlet_inverse f' i ?k 0 < ?n \<Longrightarrow> f ?n = f' ?n goal (3 subgoals): 1. (\<And>n. 0 < n \<Longrightarrow> f n = f' n) \<Longrightarrow> dirichlet_inverse f i 0 = dirichlet_inverse f' i 0 2. (\<And>n. 0 < n \<Longrightarrow> f n = f' n) \<Longrightarrow> dirichlet_inverse f i (Suc 0) = dirichlet_inverse f' i (Suc 0) 3. \<And>n. \<lbrakk>1 < n; \<And>k. \<lbrakk>k < n; \<And>n. 0 < n \<Longrightarrow> f n = f' n\<rbrakk> \<Longrightarrow> dirichlet_inverse f i k = dirichlet_inverse f' i k; \<And>n. 0 < n \<Longrightarrow> f n = f' n\<rbrakk> \<Longrightarrow> dirichlet_inverse f i n = dirichlet_inverse f' i n [PROOF STEP] have *: "dirichlet_inverse f i k = dirichlet_inverse f' i k" if "k dvd n \<and> k < n" for k [PROOF STATE] proof (prove) goal (1 subgoal): 1. dirichlet_inverse f i k = dirichlet_inverse f' i k [PROOF STEP] using that [PROOF STATE] proof (prove) using this: k dvd n \<and> k < n goal (1 subgoal): 1. dirichlet_inverse f i k = dirichlet_inverse f' i k [PROOF STEP] by (intro gt1) auto [PROOF STATE] proof (state) this: ?k dvd n \<and> ?k < n \<Longrightarrow> dirichlet_inverse f i ?k = dirichlet_inverse f' i ?k goal (3 subgoals): 1. (\<And>n. 0 < n \<Longrightarrow> f n = f' n) \<Longrightarrow> dirichlet_inverse f i 0 = dirichlet_inverse f' i 0 2. (\<And>n. 0 < n \<Longrightarrow> f n = f' n) \<Longrightarrow> dirichlet_inverse f i (Suc 0) = dirichlet_inverse f' i (Suc 0) 3. \<And>n. \<lbrakk>1 < n; \<And>k. \<lbrakk>k < n; \<And>n. 0 < n \<Longrightarrow> f n = f' n\<rbrakk> \<Longrightarrow> dirichlet_inverse f i k = dirichlet_inverse f' i k; \<And>n. 0 < n \<Longrightarrow> f n = f' n\<rbrakk> \<Longrightarrow> dirichlet_inverse f i n = dirichlet_inverse f' i n [PROOF STEP] have *: "(\<Sum>d | d dvd n \<and> d < n. f (n div d) * dirichlet_inverse f i d) = (\<Sum>d | d dvd n \<and> d < n. f' (n div d) * dirichlet_inverse f' i d)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. (\<Sum>d | d dvd n \<and> d < n. f (n div d) * dirichlet_inverse f i d) = (\<Sum>d | d dvd n \<and> d < n. f' (n div d) * dirichlet_inverse f' i d) [PROOF STEP] by (intro sum.cong refl) (subst gt1.prems, auto elim: dvdE simp: *) [PROOF STATE] proof (state) this: (\<Sum>d | d dvd n \<and> d < n. f (n div d) * dirichlet_inverse f i d) = (\<Sum>d | d dvd n \<and> d < n. f' (n div d) * dirichlet_inverse f' i d) goal (3 subgoals): 1. (\<And>n. 0 < n \<Longrightarrow> f n = f' n) \<Longrightarrow> dirichlet_inverse f i 0 = dirichlet_inverse f' i 0 2. (\<And>n. 0 < n \<Longrightarrow> f n = f' n) \<Longrightarrow> dirichlet_inverse f i (Suc 0) = dirichlet_inverse f' i (Suc 0) 3. \<And>n. \<lbrakk>1 < n; \<And>k. \<lbrakk>k < n; \<And>n. 0 < n \<Longrightarrow> f n = f' n\<rbrakk> \<Longrightarrow> dirichlet_inverse f i k = dirichlet_inverse f' i k; \<And>n. 0 < n \<Longrightarrow> f n = f' n\<rbrakk> \<Longrightarrow> dirichlet_inverse f i n = dirichlet_inverse f' i n [PROOF STEP] consider "n = 0" | "n = 1" | "n > 1" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>n = 0 \<Longrightarrow> thesis; n = 1 \<Longrightarrow> thesis; 1 < n \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis [PROOF STEP] by force [PROOF STATE] proof (state) this: \<lbrakk>n = 0 \<Longrightarrow> ?thesis; n = 1 \<Longrightarrow> ?thesis; 1 < n \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis goal (3 subgoals): 1. (\<And>n. 0 < n \<Longrightarrow> f n = f' n) \<Longrightarrow> dirichlet_inverse f i 0 = dirichlet_inverse f' i 0 2. (\<And>n. 0 < n \<Longrightarrow> f n = f' n) \<Longrightarrow> dirichlet_inverse f i (Suc 0) = dirichlet_inverse f' i (Suc 0) 3. \<And>n. \<lbrakk>1 < n; \<And>k. \<lbrakk>k < n; \<And>n. 0 < n \<Longrightarrow> f n = f' n\<rbrakk> \<Longrightarrow> dirichlet_inverse f i k = dirichlet_inverse f' i k; \<And>n. 0 < n \<Longrightarrow> f n = f' n\<rbrakk> \<Longrightarrow> dirichlet_inverse f i n = dirichlet_inverse f' i n [PROOF STEP] thus ?case [PROOF STATE] proof (prove) using this: \<lbrakk>n = 0 \<Longrightarrow> ?thesis; n = 1 \<Longrightarrow> ?thesis; 1 < n \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis goal (1 subgoal): 1. dirichlet_inverse f i n = dirichlet_inverse f' i n [PROOF STEP] by cases (insert *, simp_all add: dirichlet_inverse_gt_1 * cong: sum.cong) [PROOF STATE] proof (state) this: dirichlet_inverse f i n = dirichlet_inverse f' i n goal (2 subgoals): 1. (\<And>n. 0 < n \<Longrightarrow> f n = f' n) \<Longrightarrow> dirichlet_inverse f i 0 = dirichlet_inverse f' i 0 2. (\<And>n. 0 < n \<Longrightarrow> f n = f' n) \<Longrightarrow> dirichlet_inverse f i (Suc 0) = dirichlet_inverse f' i (Suc 0) [PROOF STEP] qed auto [PROOF STATE] proof (state) this: dirichlet_inverse f i n = dirichlet_inverse f' i n goal (1 subgoal): 1. dirichlet_inverse f i n = dirichlet_inverse f' i' n' [PROOF STEP] with assms(2,3) [PROOF STATE] proof (chain) picking this: i = i' n = n' dirichlet_inverse f i n = dirichlet_inverse f' i n [PROOF STEP] show ?thesis [PROOF STATE] proof (prove) using this: i = i' n = n' dirichlet_inverse f i n = dirichlet_inverse f' i n goal (1 subgoal): 1. dirichlet_inverse f i n = dirichlet_inverse f' i' n' [PROOF STEP] by simp [PROOF STATE] proof (state) this: dirichlet_inverse f i n = dirichlet_inverse f' i' n' goal: No subgoals! [PROOF STEP] qed
[STATEMENT] lemma strand_vars_split: "vars\<^sub>s\<^sub>t (S@S') = vars\<^sub>s\<^sub>t S \<union> vars\<^sub>s\<^sub>t S'" "wfrestrictedvars\<^sub>s\<^sub>t (S@S') = wfrestrictedvars\<^sub>s\<^sub>t S \<union> wfrestrictedvars\<^sub>s\<^sub>t S'" "fv\<^sub>s\<^sub>t (S@S') = fv\<^sub>s\<^sub>t S \<union> fv\<^sub>s\<^sub>t S'" [PROOF STATE] proof (prove) goal (1 subgoal): 1. vars\<^sub>s\<^sub>t (S @ S') = vars\<^sub>s\<^sub>t S \<union> vars\<^sub>s\<^sub>t S' &&& wfrestrictedvars\<^sub>s\<^sub>t (S @ S') = wfrestrictedvars\<^sub>s\<^sub>t S \<union> wfrestrictedvars\<^sub>s\<^sub>t S' &&& fv\<^sub>s\<^sub>t (S @ S') = fv\<^sub>s\<^sub>t S \<union> fv\<^sub>s\<^sub>t S' [PROOF STEP] by auto
integer i ! 3 READ(JPL,*,END=200) i ! 3 READ(JPL,*) i 3 READ *, i 4 WRITE (*,*) i i = 0 ! 200 CONTINUE end
lemma contrapositive (P Q : Prop) : (P → Q) → (¬ Q → ¬ P) := begin repeat {rw not_iff_imp_false}, intros a b c, exact b(a(c)), end
/- Copyright (c) 2020 Zhouhang Zhou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Zhouhang Zhou, Yury Kudryashov ! This file was ported from Lean 3 source module measure_theory.integral.set_integral ! leanprover-community/mathlib commit 46b633fd842bef9469441c0209906f6dddd2b4f5 ! Please do not edit these lines, except to modify the commit id ! if you have ported upstream changes. -/ import Mathbin.MeasureTheory.Integral.IntegrableOn import Mathbin.MeasureTheory.Integral.Bochner import Mathbin.MeasureTheory.Function.LocallyIntegrable import Mathbin.Order.Filter.IndicatorFunction import Mathbin.Topology.MetricSpace.ThickenedIndicator import Mathbin.Topology.ContinuousFunction.Compact /-! # Set integral In this file we prove some properties of `∫ x in s, f x ∂μ`. Recall that this notation is defined as `∫ x, f x ∂(μ.restrict s)`. In `integral_indicator` we prove that for a measurable function `f` and a measurable set `s` this definition coincides with another natural definition: `∫ x, indicator s f x ∂μ = ∫ x in s, f x ∂μ`, where `indicator s f x` is equal to `f x` for `x ∈ s` and is zero otherwise. Since `∫ x in s, f x ∂μ` is a notation, one can rewrite or apply any theorem about `∫ x, f x ∂μ` directly. In this file we prove some theorems about dependence of `∫ x in s, f x ∂μ` on `s`, e.g. `integral_union`, `integral_empty`, `integral_univ`. We use the property `integrable_on f s μ := integrable f (μ.restrict s)`, defined in `measure_theory.integrable_on`. We also defined in that same file a predicate `integrable_at_filter (f : α → E) (l : filter α) (μ : measure α)` saying that `f` is integrable at some set `s ∈ l`. Finally, we prove a version of the [Fundamental theorem of calculus](https://en.wikipedia.org/wiki/Fundamental_theorem_of_calculus) for set integral, see `filter.tendsto.integral_sub_linear_is_o_ae` and its corollaries. Namely, consider a measurably generated filter `l`, a measure `μ` finite at this filter, and a function `f` that has a finite limit `c` at `l ⊓ μ.ae`. Then `∫ x in s, f x ∂μ = μ s • c + o(μ s)` as `s` tends to `l.small_sets`, i.e. for any `ε>0` there exists `t ∈ l` such that `‖∫ x in s, f x ∂μ - μ s • c‖ ≤ ε * μ s` whenever `s ⊆ t`. We also formulate a version of this theorem for a locally finite measure `μ` and a function `f` continuous at a point `a`. ## Notation We provide the following notations for expressing the integral of a function on a set : * `∫ a in s, f a ∂μ` is `measure_theory.integral (μ.restrict s) f` * `∫ a in s, f a` is `∫ a in s, f a ∂volume` Note that the set notations are defined in the file `measure_theory/integral/bochner`, but we reference them here because all theorems about set integrals are in this file. -/ noncomputable section open Set Filter TopologicalSpace MeasureTheory Function open Classical Topology Interval BigOperators Filter ENNReal NNReal MeasureTheory variable {α β E F : Type _} [MeasurableSpace α] namespace MeasureTheory section NormedAddCommGroup variable [NormedAddCommGroup E] {f g : α → E} {s t : Set α} {μ ν : Measure α} {l l' : Filter α} variable [CompleteSpace E] [NormedSpace ℝ E] theorem set_integral_congr_ae₀ (hs : NullMeasurableSet s μ) (h : ∀ᵐ x ∂μ, x ∈ s → f x = g x) : (∫ x in s, f x ∂μ) = ∫ x in s, g x ∂μ := integral_congr_ae ((ae_restrict_iff'₀ hs).2 h) #align measure_theory.set_integral_congr_ae₀ MeasureTheory.set_integral_congr_ae₀ theorem set_integral_congr_ae (hs : MeasurableSet s) (h : ∀ᵐ x ∂μ, x ∈ s → f x = g x) : (∫ x in s, f x ∂μ) = ∫ x in s, g x ∂μ := integral_congr_ae ((ae_restrict_iff' hs).2 h) #align measure_theory.set_integral_congr_ae MeasureTheory.set_integral_congr_ae theorem set_integral_congr₀ (hs : NullMeasurableSet s μ) (h : EqOn f g s) : (∫ x in s, f x ∂μ) = ∫ x in s, g x ∂μ := set_integral_congr_ae₀ hs <| eventually_of_forall h #align measure_theory.set_integral_congr₀ MeasureTheory.set_integral_congr₀ theorem set_integral_congr (hs : MeasurableSet s) (h : EqOn f g s) : (∫ x in s, f x ∂μ) = ∫ x in s, g x ∂μ := set_integral_congr_ae hs <| eventually_of_forall h #align measure_theory.set_integral_congr MeasureTheory.set_integral_congr theorem set_integral_congr_set_ae (hst : s =ᵐ[μ] t) : (∫ x in s, f x ∂μ) = ∫ x in t, f x ∂μ := by rw [measure.restrict_congr_set hst] #align measure_theory.set_integral_congr_set_ae MeasureTheory.set_integral_congr_set_ae theorem integral_union_ae (hst : AeDisjoint μ s t) (ht : NullMeasurableSet t μ) (hfs : IntegrableOn f s μ) (hft : IntegrableOn f t μ) : (∫ x in s ∪ t, f x ∂μ) = (∫ x in s, f x ∂μ) + ∫ x in t, f x ∂μ := by simp only [integrable_on, measure.restrict_union₀ hst ht, integral_add_measure hfs hft] #align measure_theory.integral_union_ae MeasureTheory.integral_union_ae theorem integral_union (hst : Disjoint s t) (ht : MeasurableSet t) (hfs : IntegrableOn f s μ) (hft : IntegrableOn f t μ) : (∫ x in s ∪ t, f x ∂μ) = (∫ x in s, f x ∂μ) + ∫ x in t, f x ∂μ := integral_union_ae hst.AeDisjoint ht.NullMeasurableSet hfs hft #align measure_theory.integral_union MeasureTheory.integral_union theorem integral_diff (ht : MeasurableSet t) (hfs : IntegrableOn f s μ) (hts : t ⊆ s) : (∫ x in s \ t, f x ∂μ) = (∫ x in s, f x ∂μ) - ∫ x in t, f x ∂μ := by rw [eq_sub_iff_add_eq, ← integral_union, diff_union_of_subset hts] exacts[disjoint_sdiff_self_left, ht, hfs.mono_set (diff_subset _ _), hfs.mono_set hts] #align measure_theory.integral_diff MeasureTheory.integral_diff theorem integral_inter_add_diff₀ (ht : NullMeasurableSet t μ) (hfs : IntegrableOn f s μ) : ((∫ x in s ∩ t, f x ∂μ) + ∫ x in s \ t, f x ∂μ) = ∫ x in s, f x ∂μ := by rw [← measure.restrict_inter_add_diff₀ s ht, integral_add_measure] · exact integrable.mono_measure hfs (measure.restrict_mono (inter_subset_left _ _) le_rfl) · exact integrable.mono_measure hfs (measure.restrict_mono (diff_subset _ _) le_rfl) #align measure_theory.integral_inter_add_diff₀ MeasureTheory.integral_inter_add_diff₀ theorem integral_inter_add_diff (ht : MeasurableSet t) (hfs : IntegrableOn f s μ) : ((∫ x in s ∩ t, f x ∂μ) + ∫ x in s \ t, f x ∂μ) = ∫ x in s, f x ∂μ := integral_inter_add_diff₀ ht.NullMeasurableSet hfs #align measure_theory.integral_inter_add_diff MeasureTheory.integral_inter_add_diff theorem integral_finset_bUnion {ι : Type _} (t : Finset ι) {s : ι → Set α} (hs : ∀ i ∈ t, MeasurableSet (s i)) (h's : Set.Pairwise (↑t) (Disjoint on s)) (hf : ∀ i ∈ t, IntegrableOn f (s i) μ) : (∫ x in ⋃ i ∈ t, s i, f x ∂μ) = ∑ i in t, ∫ x in s i, f x ∂μ := by induction' t using Finset.induction_on with a t hat IH hs h's · simp · simp only [Finset.coe_insert, Finset.forall_mem_insert, Set.pairwise_insert, Finset.set_bunionᵢ_insert] at hs hf h's⊢ rw [integral_union _ _ hf.1 (integrable_on_finset_Union.2 hf.2)] · rw [Finset.sum_insert hat, IH hs.2 h's.1 hf.2] · simp only [disjoint_Union_right] exact fun i hi => (h's.2 i hi (ne_of_mem_of_not_mem hi hat).symm).1 · exact Finset.measurableSet_bunionᵢ _ hs.2 #align measure_theory.integral_finset_bUnion MeasureTheory.integral_finset_bUnion theorem integral_fintype_unionᵢ {ι : Type _} [Fintype ι] {s : ι → Set α} (hs : ∀ i, MeasurableSet (s i)) (h's : Pairwise (Disjoint on s)) (hf : ∀ i, IntegrableOn f (s i) μ) : (∫ x in ⋃ i, s i, f x ∂μ) = ∑ i, ∫ x in s i, f x ∂μ := by convert integral_finset_bUnion Finset.univ (fun i hi => hs i) _ fun i _ => hf i · simp · simp [pairwise_univ, h's] #align measure_theory.integral_fintype_Union MeasureTheory.integral_fintype_unionᵢ theorem integral_empty : (∫ x in ∅, f x ∂μ) = 0 := by rw [measure.restrict_empty, integral_zero_measure] #align measure_theory.integral_empty MeasureTheory.integral_empty theorem integral_univ : (∫ x in univ, f x ∂μ) = ∫ x, f x ∂μ := by rw [measure.restrict_univ] #align measure_theory.integral_univ MeasureTheory.integral_univ theorem integral_add_compl₀ (hs : NullMeasurableSet s μ) (hfi : Integrable f μ) : ((∫ x in s, f x ∂μ) + ∫ x in sᶜ, f x ∂μ) = ∫ x, f x ∂μ := by rw [← integral_union_ae (@disjoint_compl_right (Set α) _ _).AeDisjoint hs.compl hfi.integrable_on hfi.integrable_on, union_compl_self, integral_univ] #align measure_theory.integral_add_compl₀ MeasureTheory.integral_add_compl₀ theorem integral_add_compl (hs : MeasurableSet s) (hfi : Integrable f μ) : ((∫ x in s, f x ∂μ) + ∫ x in sᶜ, f x ∂μ) = ∫ x, f x ∂μ := integral_add_compl₀ hs.NullMeasurableSet hfi #align measure_theory.integral_add_compl MeasureTheory.integral_add_compl /-- For a function `f` and a measurable set `s`, the integral of `indicator s f` over the whole space is equal to `∫ x in s, f x ∂μ` defined as `∫ x, f x ∂(μ.restrict s)`. -/ theorem integral_indicator (hs : MeasurableSet s) : (∫ x, indicator s f x ∂μ) = ∫ x in s, f x ∂μ := by by_cases hfi : integrable_on f s μ; swap · rwa [integral_undef, integral_undef] rwa [integrable_indicator_iff hs] calc (∫ x, indicator s f x ∂μ) = (∫ x in s, indicator s f x ∂μ) + ∫ x in sᶜ, indicator s f x ∂μ := (integral_add_compl hs (hfi.integrable_indicator hs)).symm _ = (∫ x in s, f x ∂μ) + ∫ x in sᶜ, 0 ∂μ := (congr_arg₂ (· + ·) (integral_congr_ae (indicator_ae_eq_restrict hs)) (integral_congr_ae (indicator_ae_eq_restrict_compl hs))) _ = ∫ x in s, f x ∂μ := by simp #align measure_theory.integral_indicator MeasureTheory.integral_indicator theorem set_integral_indicator (ht : MeasurableSet t) : (∫ x in s, t.indicator f x ∂μ) = ∫ x in s ∩ t, f x ∂μ := by rw [integral_indicator ht, measure.restrict_restrict ht, Set.inter_comm] #align measure_theory.set_integral_indicator MeasureTheory.set_integral_indicator theorem ofReal_set_integral_one_of_measure_ne_top {α : Type _} {m : MeasurableSpace α} {μ : Measure α} {s : Set α} (hs : μ s ≠ ∞) : ENNReal.ofReal (∫ x in s, (1 : ℝ) ∂μ) = μ s := calc ENNReal.ofReal (∫ x in s, (1 : ℝ) ∂μ) = ENNReal.ofReal (∫ x in s, ‖(1 : ℝ)‖ ∂μ) := by simp only [norm_one] _ = ∫⁻ x in s, 1 ∂μ := by rw [of_real_integral_norm_eq_lintegral_nnnorm (integrable_on_const.2 (Or.inr hs.lt_top))] simp only [nnnorm_one, ENNReal.coe_one] _ = μ s := set_lintegral_one _ #align measure_theory.of_real_set_integral_one_of_measure_ne_top MeasureTheory.ofReal_set_integral_one_of_measure_ne_top theorem ofReal_set_integral_one {α : Type _} {m : MeasurableSpace α} (μ : Measure α) [IsFiniteMeasure μ] (s : Set α) : ENNReal.ofReal (∫ x in s, (1 : ℝ) ∂μ) = μ s := ofReal_set_integral_one_of_measure_ne_top (measure_ne_top μ s) #align measure_theory.of_real_set_integral_one MeasureTheory.ofReal_set_integral_one theorem integral_piecewise [DecidablePred (· ∈ s)] (hs : MeasurableSet s) (hf : IntegrableOn f s μ) (hg : IntegrableOn g (sᶜ) μ) : (∫ x, s.piecewise f g x ∂μ) = (∫ x in s, f x ∂μ) + ∫ x in sᶜ, g x ∂μ := by rw [← Set.indicator_add_compl_eq_piecewise, integral_add' (hf.integrable_indicator hs) (hg.integrable_indicator hs.compl), integral_indicator hs, integral_indicator hs.compl] #align measure_theory.integral_piecewise MeasureTheory.integral_piecewise theorem tendsto_set_integral_of_monotone {ι : Type _} [Countable ι] [SemilatticeSup ι] {s : ι → Set α} (hsm : ∀ i, MeasurableSet (s i)) (h_mono : Monotone s) (hfi : IntegrableOn f (⋃ n, s n) μ) : Tendsto (fun i => ∫ a in s i, f a ∂μ) atTop (𝓝 (∫ a in ⋃ n, s n, f a ∂μ)) := by have hfi' : (∫⁻ x in ⋃ n, s n, ‖f x‖₊ ∂μ) < ∞ := hfi.2 set S := ⋃ i, s i have hSm : MeasurableSet S := MeasurableSet.unionᵢ hsm have hsub : ∀ {i}, s i ⊆ S := subset_Union s rw [← with_density_apply _ hSm] at hfi' set ν := μ.with_density fun x => ‖f x‖₊ with hν refine' metric.nhds_basis_closed_ball.tendsto_right_iff.2 fun ε ε0 => _ lift ε to ℝ≥0 using ε0.le have : ∀ᶠ i in at_top, ν (s i) ∈ Icc (ν S - ε) (ν S + ε) := tendsto_measure_Union h_mono (ENNReal.Icc_mem_nhds hfi'.ne (ENNReal.coe_pos.2 ε0).ne') refine' this.mono fun i hi => _ rw [mem_closedBall_iff_norm', ← integral_diff (hsm i) hfi hsub, ← coe_nnnorm, NNReal.coe_le_coe, ← ENNReal.coe_le_coe] refine' (ennnorm_integral_le_lintegral_ennnorm _).trans _ rw [← with_density_apply _ (hSm.diff (hsm _)), ← hν, measure_diff hsub (hsm _)] exacts[tsub_le_iff_tsub_le.mp hi.1, (hi.2.trans_lt <| ENNReal.add_lt_top.2 ⟨hfi', ENNReal.coe_lt_top⟩).Ne] #align measure_theory.tendsto_set_integral_of_monotone MeasureTheory.tendsto_set_integral_of_monotone theorem hasSum_integral_unionᵢ_ae {ι : Type _} [Countable ι] {s : ι → Set α} (hm : ∀ i, NullMeasurableSet (s i) μ) (hd : Pairwise (AeDisjoint μ on s)) (hfi : IntegrableOn f (⋃ i, s i) μ) : HasSum (fun n => ∫ a in s n, f a ∂μ) (∫ a in ⋃ n, s n, f a ∂μ) := by simp only [integrable_on, measure.restrict_Union_ae hd hm] at hfi⊢ exact has_sum_integral_measure hfi #align measure_theory.has_sum_integral_Union_ae MeasureTheory.hasSum_integral_unionᵢ_ae theorem hasSum_integral_unionᵢ {ι : Type _} [Countable ι] {s : ι → Set α} (hm : ∀ i, MeasurableSet (s i)) (hd : Pairwise (Disjoint on s)) (hfi : IntegrableOn f (⋃ i, s i) μ) : HasSum (fun n => ∫ a in s n, f a ∂μ) (∫ a in ⋃ n, s n, f a ∂μ) := hasSum_integral_unionᵢ_ae (fun i => (hm i).NullMeasurableSet) (hd.mono fun i j h => h.AeDisjoint) hfi #align measure_theory.has_sum_integral_Union MeasureTheory.hasSum_integral_unionᵢ theorem integral_unionᵢ {ι : Type _} [Countable ι] {s : ι → Set α} (hm : ∀ i, MeasurableSet (s i)) (hd : Pairwise (Disjoint on s)) (hfi : IntegrableOn f (⋃ i, s i) μ) : (∫ a in ⋃ n, s n, f a ∂μ) = ∑' n, ∫ a in s n, f a ∂μ := (HasSum.tsum_eq (hasSum_integral_unionᵢ hm hd hfi)).symm #align measure_theory.integral_Union MeasureTheory.integral_unionᵢ theorem integral_unionᵢ_ae {ι : Type _} [Countable ι] {s : ι → Set α} (hm : ∀ i, NullMeasurableSet (s i) μ) (hd : Pairwise (AeDisjoint μ on s)) (hfi : IntegrableOn f (⋃ i, s i) μ) : (∫ a in ⋃ n, s n, f a ∂μ) = ∑' n, ∫ a in s n, f a ∂μ := (HasSum.tsum_eq (hasSum_integral_unionᵢ_ae hm hd hfi)).symm #align measure_theory.integral_Union_ae MeasureTheory.integral_unionᵢ_ae theorem set_integral_eq_zero_of_ae_eq_zero (ht_eq : ∀ᵐ x ∂μ, x ∈ t → f x = 0) : (∫ x in t, f x ∂μ) = 0 := by by_cases hf : ae_strongly_measurable f (μ.restrict t) swap · rw [integral_undef] contrapose! hf exact hf.1 have : (∫ x in t, hf.mk f x ∂μ) = 0 := by refine' integral_eq_zero_of_ae _ rw [eventually_eq, ae_restrict_iff (hf.strongly_measurable_mk.measurable_set_eq_fun strongly_measurable_zero)] filter_upwards [ae_imp_of_ae_restrict hf.ae_eq_mk, ht_eq]with x hx h'x h''x rw [← hx h''x] exact h'x h''x rw [← this] exact integral_congr_ae hf.ae_eq_mk #align measure_theory.set_integral_eq_zero_of_ae_eq_zero MeasureTheory.set_integral_eq_zero_of_ae_eq_zero theorem set_integral_eq_zero_of_forall_eq_zero (ht_eq : ∀ x ∈ t, f x = 0) : (∫ x in t, f x ∂μ) = 0 := set_integral_eq_zero_of_ae_eq_zero (eventually_of_forall ht_eq) #align measure_theory.set_integral_eq_zero_of_forall_eq_zero MeasureTheory.set_integral_eq_zero_of_forall_eq_zero theorem integral_union_eq_left_of_ae_aux (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0) (haux : StronglyMeasurable f) (H : IntegrableOn f (s ∪ t) μ) : (∫ x in s ∪ t, f x ∂μ) = ∫ x in s, f x ∂μ := by let k := f ⁻¹' {0} have hk : MeasurableSet k := by borelize E exact haux.measurable (measurable_set_singleton _) have h's : integrable_on f s μ := H.mono (subset_union_left _ _) le_rfl have A : ∀ u : Set α, (∫ x in u ∩ k, f x ∂μ) = 0 := fun u => set_integral_eq_zero_of_forall_eq_zero fun x hx => hx.2 rw [← integral_inter_add_diff hk h's, ← integral_inter_add_diff hk H, A, A, zero_add, zero_add, union_diff_distrib, union_comm] apply set_integral_congr_set_ae rw [union_ae_eq_right] apply measure_mono_null (diff_subset _ _) rw [measure_zero_iff_ae_nmem] filter_upwards [ae_imp_of_ae_restrict ht_eq]with x hx h'x using h'x.2 (hx h'x.1) #align measure_theory.integral_union_eq_left_of_ae_aux MeasureTheory.integral_union_eq_left_of_ae_aux theorem integral_union_eq_left_of_ae (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0) : (∫ x in s ∪ t, f x ∂μ) = ∫ x in s, f x ∂μ := by have ht : integrable_on f t μ := by apply integrable_on.congr_fun' integrable_on_zero symm exact ht_eq by_cases H : integrable_on f (s ∪ t) μ swap · rw [integral_undef H, integral_undef] simpa [integrable_on_union, ht] using H let f' := H.1.mk f calc (∫ x : α in s ∪ t, f x ∂μ) = ∫ x : α in s ∪ t, f' x ∂μ := integral_congr_ae H.1.ae_eq_mk _ = ∫ x in s, f' x ∂μ := by apply integral_union_eq_left_of_ae_aux _ H.1.stronglyMeasurable_mk (H.congr_fun' H.1.ae_eq_mk) filter_upwards [ht_eq, ae_mono (measure.restrict_mono (subset_union_right s t) le_rfl) H.1.ae_eq_mk]with x hx h'x rw [← h'x, hx] _ = ∫ x in s, f x ∂μ := integral_congr_ae (ae_mono (measure.restrict_mono (subset_union_left s t) le_rfl) H.1.ae_eq_mk.symm) #align measure_theory.integral_union_eq_left_of_ae MeasureTheory.integral_union_eq_left_of_ae theorem integral_union_eq_left_of_forall₀ {f : α → E} (ht : NullMeasurableSet t μ) (ht_eq : ∀ x ∈ t, f x = 0) : (∫ x in s ∪ t, f x ∂μ) = ∫ x in s, f x ∂μ := integral_union_eq_left_of_ae ((ae_restrict_iff'₀ ht).2 (eventually_of_forall ht_eq)) #align measure_theory.integral_union_eq_left_of_forall₀ MeasureTheory.integral_union_eq_left_of_forall₀ theorem integral_union_eq_left_of_forall {f : α → E} (ht : MeasurableSet t) (ht_eq : ∀ x ∈ t, f x = 0) : (∫ x in s ∪ t, f x ∂μ) = ∫ x in s, f x ∂μ := integral_union_eq_left_of_forall₀ ht.NullMeasurableSet ht_eq #align measure_theory.integral_union_eq_left_of_forall MeasureTheory.integral_union_eq_left_of_forall theorem set_integral_eq_of_subset_of_ae_diff_eq_zero_aux (hts : s ⊆ t) (h't : ∀ᵐ x ∂μ, x ∈ t \ s → f x = 0) (haux : StronglyMeasurable f) (h'aux : IntegrableOn f t μ) : (∫ x in t, f x ∂μ) = ∫ x in s, f x ∂μ := by let k := f ⁻¹' {0} have hk : MeasurableSet k := by borelize E exact haux.measurable (measurable_set_singleton _) calc (∫ x in t, f x ∂μ) = (∫ x in t ∩ k, f x ∂μ) + ∫ x in t \ k, f x ∂μ := by rw [integral_inter_add_diff hk h'aux] _ = ∫ x in t \ k, f x ∂μ := by rw [set_integral_eq_zero_of_forall_eq_zero fun x hx => _, zero_add] exact hx.2 _ = ∫ x in s \ k, f x ∂μ := by apply set_integral_congr_set_ae filter_upwards [h't]with x hx change (x ∈ t \ k) = (x ∈ s \ k) simp only [mem_preimage, mem_singleton_iff, eq_iff_iff, and_congr_left_iff, mem_diff] intro h'x by_cases xs : x ∈ s · simp only [xs, hts xs] · simp only [xs, iff_false_iff] intro xt exact h'x (hx ⟨xt, xs⟩) _ = (∫ x in s ∩ k, f x ∂μ) + ∫ x in s \ k, f x ∂μ := by have : ∀ x ∈ s ∩ k, f x = 0 := fun x hx => hx.2 rw [set_integral_eq_zero_of_forall_eq_zero this, zero_add] _ = ∫ x in s, f x ∂μ := by rw [integral_inter_add_diff hk (h'aux.mono hts le_rfl)] #align measure_theory.set_integral_eq_of_subset_of_ae_diff_eq_zero_aux MeasureTheory.set_integral_eq_of_subset_of_ae_diff_eq_zero_aux /-- If a function vanishes almost everywhere on `t \ s` with `s ⊆ t`, then its integrals on `s` and `t` coincide if `t` is null-measurable. -/ theorem set_integral_eq_of_subset_of_ae_diff_eq_zero (ht : NullMeasurableSet t μ) (hts : s ⊆ t) (h't : ∀ᵐ x ∂μ, x ∈ t \ s → f x = 0) : (∫ x in t, f x ∂μ) = ∫ x in s, f x ∂μ := by by_cases h : integrable_on f t μ; swap · have : ¬integrable_on f s μ := fun H => h (H.ofAeDiffEqZero ht h't) rw [integral_undef h, integral_undef this] let f' := h.1.mk f calc (∫ x in t, f x ∂μ) = ∫ x in t, f' x ∂μ := integral_congr_ae h.1.ae_eq_mk _ = ∫ x in s, f' x ∂μ := by apply set_integral_eq_of_subset_of_ae_diff_eq_zero_aux hts _ h.1.stronglyMeasurable_mk (h.congr h.1.ae_eq_mk) filter_upwards [h't, ae_imp_of_ae_restrict h.1.ae_eq_mk]with x hx h'x h''x rw [← h'x h''x.1, hx h''x] _ = ∫ x in s, f x ∂μ := by apply integral_congr_ae apply ae_restrict_of_ae_restrict_of_subset hts exact h.1.ae_eq_mk.symm #align measure_theory.set_integral_eq_of_subset_of_ae_diff_eq_zero MeasureTheory.set_integral_eq_of_subset_of_ae_diff_eq_zero /-- If a function vanishes on `t \ s` with `s ⊆ t`, then its integrals on `s` and `t` coincide if `t` is measurable. -/ theorem set_integral_eq_of_subset_of_forall_diff_eq_zero (ht : MeasurableSet t) (hts : s ⊆ t) (h't : ∀ x ∈ t \ s, f x = 0) : (∫ x in t, f x ∂μ) = ∫ x in s, f x ∂μ := set_integral_eq_of_subset_of_ae_diff_eq_zero ht.NullMeasurableSet hts (eventually_of_forall fun x hx => h't x hx) #align measure_theory.set_integral_eq_of_subset_of_forall_diff_eq_zero MeasureTheory.set_integral_eq_of_subset_of_forall_diff_eq_zero /-- If a function vanishes almost everywhere on `sᶜ`, then its integral on `s` coincides with its integral on the whole space. -/ theorem set_integral_eq_integral_of_ae_compl_eq_zero (h : ∀ᵐ x ∂μ, x ∉ s → f x = 0) : (∫ x in s, f x ∂μ) = ∫ x, f x ∂μ := by conv_rhs => rw [← integral_univ] symm apply set_integral_eq_of_subset_of_ae_diff_eq_zero null_measurable_set_univ (subset_univ _) filter_upwards [h]with x hx h'x using hx h'x.2 #align measure_theory.set_integral_eq_integral_of_ae_compl_eq_zero MeasureTheory.set_integral_eq_integral_of_ae_compl_eq_zero /-- If a function vanishes on `sᶜ`, then its integral on `s` coincides with its integral on the whole space. -/ theorem set_integral_eq_integral_of_forall_compl_eq_zero (h : ∀ x, x ∉ s → f x = 0) : (∫ x in s, f x ∂μ) = ∫ x, f x ∂μ := set_integral_eq_integral_of_ae_compl_eq_zero (eventually_of_forall h) #align measure_theory.set_integral_eq_integral_of_forall_compl_eq_zero MeasureTheory.set_integral_eq_integral_of_forall_compl_eq_zero theorem set_integral_neg_eq_set_integral_nonpos [LinearOrder E] {f : α → E} (hf : AeStronglyMeasurable f μ) : (∫ x in { x | f x < 0 }, f x ∂μ) = ∫ x in { x | f x ≤ 0 }, f x ∂μ := by have h_union : { x | f x ≤ 0 } = { x | f x < 0 } ∪ { x | f x = 0 } := by ext simp_rw [Set.mem_union, Set.mem_setOf_eq] exact le_iff_lt_or_eq rw [h_union] have B : null_measurable_set { x | f x = 0 } μ := hf.null_measurable_set_eq_fun ae_strongly_measurable_zero symm refine' integral_union_eq_left_of_ae _ filter_upwards [ae_restrict_mem₀ B]with x hx using hx #align measure_theory.set_integral_neg_eq_set_integral_nonpos MeasureTheory.set_integral_neg_eq_set_integral_nonpos theorem integral_norm_eq_pos_sub_neg {f : α → ℝ} (hfi : Integrable f μ) : (∫ x, ‖f x‖ ∂μ) = (∫ x in { x | 0 ≤ f x }, f x ∂μ) - ∫ x in { x | f x ≤ 0 }, f x ∂μ := have h_meas : NullMeasurableSet { x | 0 ≤ f x } μ := aeStronglyMeasurableConst.nullMeasurableSetLe hfi.1 calc (∫ x, ‖f x‖ ∂μ) = (∫ x in { x | 0 ≤ f x }, ‖f x‖ ∂μ) + ∫ x in { x | 0 ≤ f x }ᶜ, ‖f x‖ ∂μ := by rw [← integral_add_compl₀ h_meas hfi.norm] _ = (∫ x in { x | 0 ≤ f x }, f x ∂μ) + ∫ x in { x | 0 ≤ f x }ᶜ, ‖f x‖ ∂μ := by congr 1 refine' set_integral_congr₀ h_meas fun x hx => _ dsimp only rw [Real.norm_eq_abs, abs_eq_self.mpr _] exact hx _ = (∫ x in { x | 0 ≤ f x }, f x ∂μ) - ∫ x in { x | 0 ≤ f x }ᶜ, f x ∂μ := by congr 1 rw [← integral_neg] refine' set_integral_congr₀ h_meas.compl fun x hx => _ dsimp only rw [Real.norm_eq_abs, abs_eq_neg_self.mpr _] rw [Set.mem_compl_iff, Set.nmem_setOf_iff] at hx linarith _ = (∫ x in { x | 0 ≤ f x }, f x ∂μ) - ∫ x in { x | f x ≤ 0 }, f x ∂μ := by rw [← set_integral_neg_eq_set_integral_nonpos hfi.1] congr ext1 x simp #align measure_theory.integral_norm_eq_pos_sub_neg MeasureTheory.integral_norm_eq_pos_sub_neg theorem set_integral_const (c : E) : (∫ x in s, c ∂μ) = (μ s).toReal • c := by rw [integral_const, measure.restrict_apply_univ] #align measure_theory.set_integral_const MeasureTheory.set_integral_const @[simp] theorem integral_indicator_const (e : E) ⦃s : Set α⦄ (s_meas : MeasurableSet s) : (∫ a : α, s.indicator (fun x : α => e) a ∂μ) = (μ s).toReal • e := by rw [integral_indicator s_meas, ← set_integral_const] #align measure_theory.integral_indicator_const MeasureTheory.integral_indicator_const @[simp] theorem integral_indicator_one ⦃s : Set α⦄ (hs : MeasurableSet s) : (∫ a, s.indicator 1 a ∂μ) = (μ s).toReal := (integral_indicator_const 1 hs).trans ((smul_eq_mul _).trans (mul_one _)) #align measure_theory.integral_indicator_one MeasureTheory.integral_indicator_one theorem set_integral_indicatorConstLp {p : ℝ≥0∞} (hs : MeasurableSet s) (ht : MeasurableSet t) (hμt : μ t ≠ ∞) (x : E) : (∫ a in s, indicatorConstLp p ht hμt x a ∂μ) = (μ (t ∩ s)).toReal • x := calc (∫ a in s, indicatorConstLp p ht hμt x a ∂μ) = ∫ a in s, t.indicator (fun _ => x) a ∂μ := by rw [set_integral_congr_ae hs (indicator_const_Lp_coe_fn.mono fun x hx hxs => hx)] _ = (μ (t ∩ s)).toReal • x := by rw [integral_indicator_const _ ht, measure.restrict_apply ht] #align measure_theory.set_integral_indicator_const_Lp MeasureTheory.set_integral_indicatorConstLp theorem integral_indicatorConstLp {p : ℝ≥0∞} (ht : MeasurableSet t) (hμt : μ t ≠ ∞) (x : E) : (∫ a, indicatorConstLp p ht hμt x a ∂μ) = (μ t).toReal • x := calc (∫ a, indicatorConstLp p ht hμt x a ∂μ) = ∫ a in univ, indicatorConstLp p ht hμt x a ∂μ := by rw [integral_univ] _ = (μ (t ∩ univ)).toReal • x := (set_integral_indicatorConstLp MeasurableSet.univ ht hμt x) _ = (μ t).toReal • x := by rw [inter_univ] #align measure_theory.integral_indicator_const_Lp MeasureTheory.integral_indicatorConstLp theorem set_integral_map {β} [MeasurableSpace β] {g : α → β} {f : β → E} {s : Set β} (hs : MeasurableSet s) (hf : AeStronglyMeasurable f (Measure.map g μ)) (hg : AeMeasurable g μ) : (∫ y in s, f y ∂Measure.map g μ) = ∫ x in g ⁻¹' s, f (g x) ∂μ := by rw [measure.restrict_map_of_ae_measurable hg hs, integral_map (hg.mono_measure measure.restrict_le_self) (hf.mono_measure _)] exact measure.map_mono_of_ae_measurable measure.restrict_le_self hg #align measure_theory.set_integral_map MeasureTheory.set_integral_map theorem MeasurableEmbedding.set_integral_map {β} {_ : MeasurableSpace β} {f : α → β} (hf : MeasurableEmbedding f) (g : β → E) (s : Set β) : (∫ y in s, g y ∂Measure.map f μ) = ∫ x in f ⁻¹' s, g (f x) ∂μ := by rw [hf.restrict_map, hf.integral_map] #align measurable_embedding.set_integral_map MeasurableEmbedding.set_integral_map theorem ClosedEmbedding.set_integral_map [TopologicalSpace α] [BorelSpace α] {β} [MeasurableSpace β] [TopologicalSpace β] [BorelSpace β] {g : α → β} {f : β → E} (s : Set β) (hg : ClosedEmbedding g) : (∫ y in s, f y ∂Measure.map g μ) = ∫ x in g ⁻¹' s, f (g x) ∂μ := hg.MeasurableEmbedding.set_integral_map _ _ #align closed_embedding.set_integral_map ClosedEmbedding.set_integral_map theorem MeasurePreserving.set_integral_preimage_emb {β} {_ : MeasurableSpace β} {f : α → β} {ν} (h₁ : MeasurePreserving f μ ν) (h₂ : MeasurableEmbedding f) (g : β → E) (s : Set β) : (∫ x in f ⁻¹' s, g (f x) ∂μ) = ∫ y in s, g y ∂ν := (h₁.restrictPreimageEmb h₂ s).integral_comp h₂ _ #align measure_theory.measure_preserving.set_integral_preimage_emb MeasureTheory.MeasurePreserving.set_integral_preimage_emb theorem MeasurePreserving.set_integral_image_emb {β} {_ : MeasurableSpace β} {f : α → β} {ν} (h₁ : MeasurePreserving f μ ν) (h₂ : MeasurableEmbedding f) (g : β → E) (s : Set α) : (∫ y in f '' s, g y ∂ν) = ∫ x in s, g (f x) ∂μ := Eq.symm <| (h₁.restrictImageEmb h₂ s).integral_comp h₂ _ #align measure_theory.measure_preserving.set_integral_image_emb MeasureTheory.MeasurePreserving.set_integral_image_emb theorem set_integral_map_equiv {β} [MeasurableSpace β] (e : α ≃ᵐ β) (f : β → E) (s : Set β) : (∫ y in s, f y ∂Measure.map e μ) = ∫ x in e ⁻¹' s, f (e x) ∂μ := e.MeasurableEmbedding.set_integral_map f s #align measure_theory.set_integral_map_equiv MeasureTheory.set_integral_map_equiv theorem norm_set_integral_le_of_norm_le_const_ae {C : ℝ} (hs : μ s < ∞) (hC : ∀ᵐ x ∂μ.restrict s, ‖f x‖ ≤ C) : ‖∫ x in s, f x ∂μ‖ ≤ C * (μ s).toReal := by rw [← measure.restrict_apply_univ] at * haveI : is_finite_measure (μ.restrict s) := ⟨‹_›⟩ exact norm_integral_le_of_norm_le_const hC #align measure_theory.norm_set_integral_le_of_norm_le_const_ae MeasureTheory.norm_set_integral_le_of_norm_le_const_ae theorem norm_set_integral_le_of_norm_le_const_ae' {C : ℝ} (hs : μ s < ∞) (hC : ∀ᵐ x ∂μ, x ∈ s → ‖f x‖ ≤ C) (hfm : AeStronglyMeasurable f (μ.restrict s)) : ‖∫ x in s, f x ∂μ‖ ≤ C * (μ s).toReal := by apply norm_set_integral_le_of_norm_le_const_ae hs have A : ∀ᵐ x : α ∂μ, x ∈ s → ‖ae_strongly_measurable.mk f hfm x‖ ≤ C := by filter_upwards [hC, hfm.ae_mem_imp_eq_mk]with _ h1 h2 h3 rw [← h2 h3] exact h1 h3 have B : MeasurableSet { x | ‖(hfm.mk f) x‖ ≤ C } := hfm.strongly_measurable_mk.norm.measurable measurableSet_Iic filter_upwards [hfm.ae_eq_mk, (ae_restrict_iff B).2 A]with _ h1 _ rwa [h1] #align measure_theory.norm_set_integral_le_of_norm_le_const_ae' MeasureTheory.norm_set_integral_le_of_norm_le_const_ae' theorem norm_set_integral_le_of_norm_le_const_ae'' {C : ℝ} (hs : μ s < ∞) (hsm : MeasurableSet s) (hC : ∀ᵐ x ∂μ, x ∈ s → ‖f x‖ ≤ C) : ‖∫ x in s, f x ∂μ‖ ≤ C * (μ s).toReal := norm_set_integral_le_of_norm_le_const_ae hs <| by rwa [ae_restrict_eq hsm, eventually_inf_principal] #align measure_theory.norm_set_integral_le_of_norm_le_const_ae'' MeasureTheory.norm_set_integral_le_of_norm_le_const_ae'' theorem norm_set_integral_le_of_norm_le_const {C : ℝ} (hs : μ s < ∞) (hC : ∀ x ∈ s, ‖f x‖ ≤ C) (hfm : AeStronglyMeasurable f (μ.restrict s)) : ‖∫ x in s, f x ∂μ‖ ≤ C * (μ s).toReal := norm_set_integral_le_of_norm_le_const_ae' hs (eventually_of_forall hC) hfm #align measure_theory.norm_set_integral_le_of_norm_le_const MeasureTheory.norm_set_integral_le_of_norm_le_const theorem norm_set_integral_le_of_norm_le_const' {C : ℝ} (hs : μ s < ∞) (hsm : MeasurableSet s) (hC : ∀ x ∈ s, ‖f x‖ ≤ C) : ‖∫ x in s, f x ∂μ‖ ≤ C * (μ s).toReal := norm_set_integral_le_of_norm_le_const_ae'' hs hsm <| eventually_of_forall hC #align measure_theory.norm_set_integral_le_of_norm_le_const' MeasureTheory.norm_set_integral_le_of_norm_le_const' theorem set_integral_eq_zero_iff_of_nonneg_ae {f : α → ℝ} (hf : 0 ≤ᵐ[μ.restrict s] f) (hfi : IntegrableOn f s μ) : (∫ x in s, f x ∂μ) = 0 ↔ f =ᵐ[μ.restrict s] 0 := integral_eq_zero_iff_of_nonneg_ae hf hfi #align measure_theory.set_integral_eq_zero_iff_of_nonneg_ae MeasureTheory.set_integral_eq_zero_iff_of_nonneg_ae theorem set_integral_pos_iff_support_of_nonneg_ae {f : α → ℝ} (hf : 0 ≤ᵐ[μ.restrict s] f) (hfi : IntegrableOn f s μ) : (0 < ∫ x in s, f x ∂μ) ↔ 0 < μ (support f ∩ s) := by rw [integral_pos_iff_support_of_nonneg_ae hf hfi, measure.restrict_apply₀] rw [support_eq_preimage] exact hfi.ae_strongly_measurable.ae_measurable.null_measurable (measurable_set_singleton 0).compl #align measure_theory.set_integral_pos_iff_support_of_nonneg_ae MeasureTheory.set_integral_pos_iff_support_of_nonneg_ae theorem set_integral_gt_gt {R : ℝ} {f : α → ℝ} (hR : 0 ≤ R) (hfm : Measurable f) (hfint : IntegrableOn f { x | ↑R < f x } μ) (hμ : μ { x | ↑R < f x } ≠ 0) : (μ { x | ↑R < f x }).toReal * R < ∫ x in { x | ↑R < f x }, f x ∂μ := by have : integrable_on (fun x => R) { x | ↑R < f x } μ := by refine' ⟨ae_strongly_measurable_const, lt_of_le_of_lt _ hfint.2⟩ refine' set_lintegral_mono (Measurable.nnnorm _).coe_nNReal_eNNReal hfm.nnnorm.coe_nnreal_ennreal fun x hx => _ · exact measurable_const · simp only [ENNReal.coe_le_coe, Real.nnnorm_of_nonneg hR, Real.nnnorm_of_nonneg (hR.trans <| le_of_lt hx), Subtype.mk_le_mk] exact le_of_lt hx rw [← sub_pos, ← smul_eq_mul, ← set_integral_const, ← integral_sub hfint this, set_integral_pos_iff_support_of_nonneg_ae] · rw [← zero_lt_iff] at hμ rwa [Set.inter_eq_self_of_subset_right] exact fun x hx => Ne.symm (ne_of_lt <| sub_pos.2 hx) · change ∀ᵐ x ∂μ.restrict _, _ rw [ae_restrict_iff] · exact eventually_of_forall fun x hx => sub_nonneg.2 <| le_of_lt hx · exact measurableSet_le measurable_zero (hfm.sub measurable_const) · exact integrable.sub hfint this #align measure_theory.set_integral_gt_gt MeasureTheory.set_integral_gt_gt theorem set_integral_trim {α} {m m0 : MeasurableSpace α} {μ : Measure α} (hm : m ≤ m0) {f : α → E} (hf_meas : strongly_measurable[m] f) {s : Set α} (hs : measurable_set[m] s) : (∫ x in s, f x ∂μ) = ∫ x in s, f x ∂μ.trim hm := by rwa [integral_trim hm hf_meas, restrict_trim hm μ] #align measure_theory.set_integral_trim MeasureTheory.set_integral_trim theorem integral_Icc_eq_integral_Ioc' [PartialOrder α] {f : α → E} {a b : α} (ha : μ {a} = 0) : (∫ t in Icc a b, f t ∂μ) = ∫ t in Ioc a b, f t ∂μ := set_integral_congr_set_ae (Ioc_ae_eq_Icc' ha).symm #align measure_theory.integral_Icc_eq_integral_Ioc' MeasureTheory.integral_Icc_eq_integral_Ioc' theorem integral_Ioc_eq_integral_Ioo' [PartialOrder α] {f : α → E} {a b : α} (hb : μ {b} = 0) : (∫ t in Ioc a b, f t ∂μ) = ∫ t in Ioo a b, f t ∂μ := set_integral_congr_set_ae (Ioo_ae_eq_Ioc' hb).symm #align measure_theory.integral_Ioc_eq_integral_Ioo' MeasureTheory.integral_Ioc_eq_integral_Ioo' theorem integral_Icc_eq_integral_Ioc [PartialOrder α] {f : α → E} {a b : α} [HasNoAtoms μ] : (∫ t in Icc a b, f t ∂μ) = ∫ t in Ioc a b, f t ∂μ := integral_Icc_eq_integral_Ioc' <| measure_singleton a #align measure_theory.integral_Icc_eq_integral_Ioc MeasureTheory.integral_Icc_eq_integral_Ioc theorem integral_Ioc_eq_integral_Ioo [PartialOrder α] {f : α → E} {a b : α} [HasNoAtoms μ] : (∫ t in Ioc a b, f t ∂μ) = ∫ t in Ioo a b, f t ∂μ := integral_Ioc_eq_integral_Ioo' <| measure_singleton b #align measure_theory.integral_Ioc_eq_integral_Ioo MeasureTheory.integral_Ioc_eq_integral_Ioo end NormedAddCommGroup section Mono variable {μ : Measure α} {f g : α → ℝ} {s t : Set α} (hf : IntegrableOn f s μ) (hg : IntegrableOn g s μ) theorem set_integral_mono_ae_restrict (h : f ≤ᵐ[μ.restrict s] g) : (∫ a in s, f a ∂μ) ≤ ∫ a in s, g a ∂μ := integral_mono_ae hf hg h #align measure_theory.set_integral_mono_ae_restrict MeasureTheory.set_integral_mono_ae_restrict theorem set_integral_mono_ae (h : f ≤ᵐ[μ] g) : (∫ a in s, f a ∂μ) ≤ ∫ a in s, g a ∂μ := set_integral_mono_ae_restrict hf hg (ae_restrict_of_ae h) #align measure_theory.set_integral_mono_ae MeasureTheory.set_integral_mono_ae theorem set_integral_mono_on (hs : MeasurableSet s) (h : ∀ x ∈ s, f x ≤ g x) : (∫ a in s, f a ∂μ) ≤ ∫ a in s, g a ∂μ := set_integral_mono_ae_restrict hf hg (by simp [hs, eventually_le, eventually_inf_principal, ae_of_all _ h]) #align measure_theory.set_integral_mono_on MeasureTheory.set_integral_mono_on include hf hg -- why do I need this include, but we don't need it in other lemmas? theorem set_integral_mono_on_ae (hs : MeasurableSet s) (h : ∀ᵐ x ∂μ, x ∈ s → f x ≤ g x) : (∫ a in s, f a ∂μ) ≤ ∫ a in s, g a ∂μ := by refine' set_integral_mono_ae_restrict hf hg _ rwa [eventually_le, ae_restrict_iff' hs] #align measure_theory.set_integral_mono_on_ae MeasureTheory.set_integral_mono_on_ae omit hf hg theorem set_integral_mono (h : f ≤ g) : (∫ a in s, f a ∂μ) ≤ ∫ a in s, g a ∂μ := integral_mono hf hg h #align measure_theory.set_integral_mono MeasureTheory.set_integral_mono theorem set_integral_mono_set (hfi : IntegrableOn f t μ) (hf : 0 ≤ᵐ[μ.restrict t] f) (hst : s ≤ᵐ[μ] t) : (∫ x in s, f x ∂μ) ≤ ∫ x in t, f x ∂μ := integral_mono_measure (Measure.restrict_mono_ae hst) hf hfi #align measure_theory.set_integral_mono_set MeasureTheory.set_integral_mono_set theorem set_integral_ge_of_const_le {c : ℝ} (hs : MeasurableSet s) (hμs : μ s ≠ ∞) (hf : ∀ x ∈ s, c ≤ f x) (hfint : IntegrableOn (fun x : α => f x) s μ) : c * (μ s).toReal ≤ ∫ x in s, f x ∂μ := by rw [mul_comm, ← smul_eq_mul, ← set_integral_const c] exact set_integral_mono_on (integrable_on_const.2 (Or.inr hμs.lt_top)) hfint hs hf #align measure_theory.set_integral_ge_of_const_le MeasureTheory.set_integral_ge_of_const_le end Mono section Nonneg variable {μ : Measure α} {f : α → ℝ} {s : Set α} theorem set_integral_nonneg_of_ae_restrict (hf : 0 ≤ᵐ[μ.restrict s] f) : 0 ≤ ∫ a in s, f a ∂μ := integral_nonneg_of_ae hf #align measure_theory.set_integral_nonneg_of_ae_restrict MeasureTheory.set_integral_nonneg_of_ae_restrict theorem set_integral_nonneg_of_ae (hf : 0 ≤ᵐ[μ] f) : 0 ≤ ∫ a in s, f a ∂μ := set_integral_nonneg_of_ae_restrict (ae_restrict_of_ae hf) #align measure_theory.set_integral_nonneg_of_ae MeasureTheory.set_integral_nonneg_of_ae theorem set_integral_nonneg (hs : MeasurableSet s) (hf : ∀ a, a ∈ s → 0 ≤ f a) : 0 ≤ ∫ a in s, f a ∂μ := set_integral_nonneg_of_ae_restrict ((ae_restrict_iff' hs).mpr (ae_of_all μ hf)) #align measure_theory.set_integral_nonneg MeasureTheory.set_integral_nonneg theorem set_integral_nonneg_ae (hs : MeasurableSet s) (hf : ∀ᵐ a ∂μ, a ∈ s → 0 ≤ f a) : 0 ≤ ∫ a in s, f a ∂μ := set_integral_nonneg_of_ae_restrict <| by rwa [eventually_le, ae_restrict_iff' hs] #align measure_theory.set_integral_nonneg_ae MeasureTheory.set_integral_nonneg_ae theorem set_integral_le_nonneg {s : Set α} (hs : MeasurableSet s) (hf : StronglyMeasurable f) (hfi : Integrable f μ) : (∫ x in s, f x ∂μ) ≤ ∫ x in { y | 0 ≤ f y }, f x ∂μ := by rw [← integral_indicator hs, ← integral_indicator (strongly_measurable_const.measurable_set_le hf)] exact integral_mono (hfi.indicator hs) (hfi.indicator (strongly_measurable_const.measurable_set_le hf)) (indicator_le_indicator_nonneg s f) #align measure_theory.set_integral_le_nonneg MeasureTheory.set_integral_le_nonneg theorem set_integral_nonpos_of_ae_restrict (hf : f ≤ᵐ[μ.restrict s] 0) : (∫ a in s, f a ∂μ) ≤ 0 := integral_nonpos_of_ae hf #align measure_theory.set_integral_nonpos_of_ae_restrict MeasureTheory.set_integral_nonpos_of_ae_restrict theorem set_integral_nonpos_of_ae (hf : f ≤ᵐ[μ] 0) : (∫ a in s, f a ∂μ) ≤ 0 := set_integral_nonpos_of_ae_restrict (ae_restrict_of_ae hf) #align measure_theory.set_integral_nonpos_of_ae MeasureTheory.set_integral_nonpos_of_ae theorem set_integral_nonpos (hs : MeasurableSet s) (hf : ∀ a, a ∈ s → f a ≤ 0) : (∫ a in s, f a ∂μ) ≤ 0 := set_integral_nonpos_of_ae_restrict ((ae_restrict_iff' hs).mpr (ae_of_all μ hf)) #align measure_theory.set_integral_nonpos MeasureTheory.set_integral_nonpos theorem set_integral_nonpos_ae (hs : MeasurableSet s) (hf : ∀ᵐ a ∂μ, a ∈ s → f a ≤ 0) : (∫ a in s, f a ∂μ) ≤ 0 := set_integral_nonpos_of_ae_restrict <| by rwa [eventually_le, ae_restrict_iff' hs] #align measure_theory.set_integral_nonpos_ae MeasureTheory.set_integral_nonpos_ae theorem set_integral_nonpos_le {s : Set α} (hs : MeasurableSet s) (hf : StronglyMeasurable f) (hfi : Integrable f μ) : (∫ x in { y | f y ≤ 0 }, f x ∂μ) ≤ ∫ x in s, f x ∂μ := by rw [← integral_indicator hs, ← integral_indicator (hf.measurable_set_le strongly_measurable_const)] exact integral_mono (hfi.indicator (hf.measurable_set_le strongly_measurable_const)) (hfi.indicator hs) (indicator_nonpos_le_indicator s f) #align measure_theory.set_integral_nonpos_le MeasureTheory.set_integral_nonpos_le end Nonneg section IntegrableUnion variable {μ : Measure α} [NormedAddCommGroup E] [Countable β] theorem integrableOnUnionOfSummableIntegralNorm {f : α → E} {s : β → Set α} (hs : ∀ b : β, MeasurableSet (s b)) (hi : ∀ b : β, IntegrableOn f (s b) μ) (h : Summable fun b : β => ∫ a : α in s b, ‖f a‖ ∂μ) : IntegrableOn f (unionᵢ s) μ := by refine' ⟨ae_strongly_measurable.Union fun i => (hi i).1, (lintegral_Union_le _ _).trans_lt _⟩ have B := fun b : β => lintegral_coe_eq_integral (fun a : α => ‖f a‖₊) (hi b).norm rw [tsum_congr B] have S' : Summable fun b : β => (⟨∫ a : α in s b, ‖f a‖₊ ∂μ, set_integral_nonneg (hs b) fun a ha => NNReal.coe_nonneg _⟩ : NNReal) := by rw [← NNReal.summable_coe] exact h have S'' := ENNReal.tsum_coe_eq S'.has_sum simp_rw [ENNReal.coe_nnreal_eq, NNReal.coe_mk, coe_nnnorm] at S'' convert ENNReal.ofReal_lt_top #align measure_theory.integrable_on_Union_of_summable_integral_norm MeasureTheory.integrableOnUnionOfSummableIntegralNorm variable [TopologicalSpace α] [BorelSpace α] [MetrizableSpace α] [IsLocallyFiniteMeasure μ] /-- If `s` is a countable family of compact sets, `f` is a continuous function, and the sequence `‖f.restrict (s i)‖ * μ (s i)` is summable, then `f` is integrable on the union of the `s i`. -/ theorem integrableOnUnionOfSummableNormRestrict {f : C(α, E)} {s : β → Compacts α} (hf : Summable fun i : β => ‖f.restrict (s i)‖ * ENNReal.toReal (μ <| s i)) : IntegrableOn f (⋃ i : β, s i) μ := by refine' integrable_on_Union_of_summable_integral_norm (fun i => (s i).IsCompact.IsClosed.MeasurableSet) (fun i => (map_continuous f).ContinuousOn.integrableOnCompact (s i).IsCompact) (summable_of_nonneg_of_le (fun ι => integral_nonneg fun x => norm_nonneg _) (fun i => _) hf) rw [← (Real.norm_of_nonneg (integral_nonneg fun a => norm_nonneg _) : ‖_‖ = ∫ x in s i, ‖f x‖ ∂μ)] exact norm_set_integral_le_of_norm_le_const' (s i).IsCompact.measure_lt_top (s i).IsCompact.IsClosed.MeasurableSet fun x hx => (norm_norm (f x)).symm ▸ (f.restrict ↑(s i)).norm_coe_le_norm ⟨x, hx⟩ #align measure_theory.integrable_on_Union_of_summable_norm_restrict MeasureTheory.integrableOnUnionOfSummableNormRestrict /-- If `s` is a countable family of compact sets covering `α`, `f` is a continuous function, and the sequence `‖f.restrict (s i)‖ * μ (s i)` is summable, then `f` is integrable. -/ theorem integrableOfSummableNormRestrict {f : C(α, E)} {s : β → Compacts α} (hf : Summable fun i : β => ‖f.restrict (s i)‖ * ENNReal.toReal (μ <| s i)) (hs : (⋃ i : β, ↑(s i)) = (univ : Set α)) : Integrable f μ := by simpa only [hs, integrable_on_univ] using integrable_on_Union_of_summable_norm_restrict hf #align measure_theory.integrable_of_summable_norm_restrict MeasureTheory.integrableOfSummableNormRestrict end IntegrableUnion section TendstoMono variable {μ : Measure α} [NormedAddCommGroup E] [CompleteSpace E] [NormedSpace ℝ E] {s : ℕ → Set α} {f : α → E} /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:38: in filter_upwards #[[], ["with", ident a], ["using", expr le_trans (h_anti.tendsto_indicator _ _ _) (pure_le_nhds _)]]: ./././Mathport/Syntax/Translate/Basic.lean:349:22: unsupported: parse error @ arg 0: next failed, no more args -/ theorem Antitone.tendsto_set_integral (hsm : ∀ i, MeasurableSet (s i)) (h_anti : Antitone s) (hfi : IntegrableOn f (s 0) μ) : Tendsto (fun i => ∫ a in s i, f a ∂μ) atTop (𝓝 (∫ a in ⋂ n, s n, f a ∂μ)) := by let bound : α → ℝ := indicator (s 0) fun a => ‖f a‖ have h_int_eq : (fun i => ∫ a in s i, f a ∂μ) = fun i => ∫ a, (s i).indicator f a ∂μ := funext fun i => (integral_indicator (hsm i)).symm rw [h_int_eq] rw [← integral_indicator (MeasurableSet.interᵢ hsm)] refine' tendsto_integral_of_dominated_convergence bound _ _ _ _ · intro n rw [aeStronglyMeasurable_indicator_iff (hsm n)] exact (integrable_on.mono_set hfi (h_anti (zero_le n))).1 · rw [integrable_indicator_iff (hsm 0)] exact hfi.norm · simp_rw [norm_indicator_eq_indicator_norm] refine' fun n => eventually_of_forall fun x => _ exact indicator_le_indicator_of_subset (h_anti (zero_le n)) (fun a => norm_nonneg _) _ · trace "./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:38: in filter_upwards #[[], [\"with\", ident a], [\"using\", expr le_trans (h_anti.tendsto_indicator _ _ _) (pure_le_nhds _)]]: ./././Mathport/Syntax/Translate/Basic.lean:349:22: unsupported: parse error @ arg 0: next failed, no more args" #align antitone.tendsto_set_integral Antitone.tendsto_set_integral end TendstoMono /-! ### Continuity of the set integral We prove that for any set `s`, the function `λ f : α →₁[μ] E, ∫ x in s, f x ∂μ` is continuous. -/ section ContinuousSetIntegral variable [NormedAddCommGroup E] {𝕜 : Type _} [NormedField 𝕜] [NormedAddCommGroup F] [NormedSpace 𝕜 F] {p : ℝ≥0∞} {μ : Measure α} /-- For `f : Lp E p μ`, we can define an element of `Lp E p (μ.restrict s)` by `(Lp.mem_ℒp f).restrict s).to_Lp f`. This map is additive. -/ theorem lp_toLp_restrict_add (f g : lp E p μ) (s : Set α) : ((lp.memℒp (f + g)).restrict s).toLp ⇑(f + g) = ((lp.memℒp f).restrict s).toLp f + ((lp.memℒp g).restrict s).toLp g := by ext1 refine' (ae_restrict_of_ae (Lp.coe_fn_add f g)).mp _ refine' (Lp.coe_fn_add (mem_ℒp.to_Lp f ((Lp.mem_ℒp f).restrict s)) (mem_ℒp.to_Lp g ((Lp.mem_ℒp g).restrict s))).mp _ refine' (mem_ℒp.coe_fn_to_Lp ((Lp.mem_ℒp f).restrict s)).mp _ refine' (mem_ℒp.coe_fn_to_Lp ((Lp.mem_ℒp g).restrict s)).mp _ refine' (mem_ℒp.coe_fn_to_Lp ((Lp.mem_ℒp (f + g)).restrict s)).mono fun x hx1 hx2 hx3 hx4 hx5 => _ rw [hx4, hx1, Pi.add_apply, hx2, hx3, hx5, Pi.add_apply] #align measure_theory.Lp_to_Lp_restrict_add MeasureTheory.lp_toLp_restrict_add /-- For `f : Lp E p μ`, we can define an element of `Lp E p (μ.restrict s)` by `(Lp.mem_ℒp f).restrict s).to_Lp f`. This map commutes with scalar multiplication. -/ theorem lp_toLp_restrict_smul (c : 𝕜) (f : lp F p μ) (s : Set α) : ((lp.memℒp (c • f)).restrict s).toLp ⇑(c • f) = c • ((lp.memℒp f).restrict s).toLp f := by ext1 refine' (ae_restrict_of_ae (Lp.coe_fn_smul c f)).mp _ refine' (mem_ℒp.coe_fn_to_Lp ((Lp.mem_ℒp f).restrict s)).mp _ refine' (mem_ℒp.coe_fn_to_Lp ((Lp.mem_ℒp (c • f)).restrict s)).mp _ refine' (Lp.coe_fn_smul c (mem_ℒp.to_Lp f ((Lp.mem_ℒp f).restrict s))).mono fun x hx1 hx2 hx3 hx4 => _ rw [hx2, hx1, Pi.smul_apply, hx3, hx4, Pi.smul_apply] #align measure_theory.Lp_to_Lp_restrict_smul MeasureTheory.lp_toLp_restrict_smul /-- For `f : Lp E p μ`, we can define an element of `Lp E p (μ.restrict s)` by `(Lp.mem_ℒp f).restrict s).to_Lp f`. This map is non-expansive. -/ theorem norm_lp_toLp_restrict_le (s : Set α) (f : lp E p μ) : ‖((lp.memℒp f).restrict s).toLp f‖ ≤ ‖f‖ := by rw [Lp.norm_def, Lp.norm_def, ENNReal.toReal_le_toReal (Lp.snorm_ne_top _) (Lp.snorm_ne_top _)] refine' (le_of_eq _).trans (snorm_mono_measure _ measure.restrict_le_self) · exact s exact snorm_congr_ae (mem_ℒp.coe_fn_to_Lp _) #align measure_theory.norm_Lp_to_Lp_restrict_le MeasureTheory.norm_lp_toLp_restrict_le variable (α F 𝕜) /-- Continuous linear map sending a function of `Lp F p μ` to the same function in `Lp F p (μ.restrict s)`. -/ def lpToLpRestrictClm (μ : Measure α) (p : ℝ≥0∞) [hp : Fact (1 ≤ p)] (s : Set α) : lp F p μ →L[𝕜] lp F p (μ.restrict s) := @LinearMap.mkContinuous 𝕜 𝕜 (lp F p μ) (lp F p (μ.restrict s)) _ _ _ _ _ _ (RingHom.id 𝕜) ⟨fun f => Memℒp.toLp f ((lp.memℒp f).restrict s), fun f g => lp_toLp_restrict_add f g s, fun c f => lp_toLp_restrict_smul c f s⟩ 1 (by intro f rw [one_mul] exact norm_Lp_to_Lp_restrict_le s f) #align measure_theory.Lp_to_Lp_restrict_clm MeasureTheory.lpToLpRestrictClm variable {α F 𝕜} variable (𝕜) theorem lpToLpRestrictClm_coeFn [hp : Fact (1 ≤ p)] (s : Set α) (f : lp F p μ) : lpToLpRestrictClm α F 𝕜 μ p s f =ᵐ[μ.restrict s] f := Memℒp.coeFn_toLp ((lp.memℒp f).restrict s) #align measure_theory.Lp_to_Lp_restrict_clm_coe_fn MeasureTheory.lpToLpRestrictClm_coeFn variable {𝕜} @[continuity] theorem continuous_set_integral [NormedSpace ℝ E] [CompleteSpace E] (s : Set α) : Continuous fun f : α →₁[μ] E => ∫ x in s, f x ∂μ := by haveI : Fact ((1 : ℝ≥0∞) ≤ 1) := ⟨le_rfl⟩ have h_comp : (fun f : α →₁[μ] E => ∫ x in s, f x ∂μ) = integral (μ.restrict s) ∘ fun f => Lp_to_Lp_restrict_clm α E ℝ μ 1 s f := by ext1 f rw [Function.comp_apply, integral_congr_ae (Lp_to_Lp_restrict_clm_coe_fn ℝ s f)] rw [h_comp] exact continuous_integral.comp (Lp_to_Lp_restrict_clm α E ℝ μ 1 s).Continuous #align measure_theory.continuous_set_integral MeasureTheory.continuous_set_integral end ContinuousSetIntegral end MeasureTheory open MeasureTheory Asymptotics Metric variable {ι : Type _} [NormedAddCommGroup E] /-- Fundamental theorem of calculus for set integrals: if `μ` is a measure that is finite at a filter `l` and `f` is a measurable function that has a finite limit `b` at `l ⊓ μ.ae`, then `∫ x in s i, f x ∂μ = μ (s i) • b + o(μ (s i))` at a filter `li` provided that `s i` tends to `l.small_sets` along `li`. Since `μ (s i)` is an `ℝ≥0∞` number, we use `(μ (s i)).to_real` in the actual statement. Often there is a good formula for `(μ (s i)).to_real`, so the formalization can take an optional argument `m` with this formula and a proof `of `(λ i, (μ (s i)).to_real) =ᶠ[li] m`. Without these arguments, `m i = (μ (s i)).to_real` is used in the output. -/ theorem Filter.Tendsto.integral_sub_linear_isOCat_ae [NormedSpace ℝ E] [CompleteSpace E] {μ : Measure α} {l : Filter α} [l.IsMeasurablyGenerated] {f : α → E} {b : E} (h : Tendsto f (l ⊓ μ.ae) (𝓝 b)) (hfm : StronglyMeasurableAtFilter f l μ) (hμ : μ.FiniteAtFilter l) {s : ι → Set α} {li : Filter ι} (hs : Tendsto s li l.smallSets) (m : ι → ℝ := fun i => (μ (s i)).toReal) (hsμ : (fun i => (μ (s i)).toReal) =ᶠ[li] m := by rfl) : (fun i => (∫ x in s i, f x ∂μ) - m i • b) =o[li] m := by suffices : (fun s => (∫ x in s, f x ∂μ) - (μ s).toReal • b) =o[l.small_sets] fun s => (μ s).toReal exact (this.comp_tendsto hs).congr' (hsμ.mono fun a ha => ha ▸ rfl) hsμ refine' is_o_iff.2 fun ε ε₀ => _ have : ∀ᶠ s in l.small_sets, ∀ᶠ x in μ.ae, x ∈ s → f x ∈ closed_ball b ε := eventually_small_sets_eventually.2 (h.eventually <| closed_ball_mem_nhds _ ε₀) filter_upwards [hμ.eventually, (hμ.integrable_at_filter_of_tendsto_ae hfm h).Eventually, hfm.eventually, this] simp only [mem_closed_ball, dist_eq_norm] intro s hμs h_integrable hfm h_norm rw [← set_integral_const, ← integral_sub h_integrable (integrable_on_const.2 <| Or.inr hμs), Real.norm_eq_abs, abs_of_nonneg ENNReal.toReal_nonneg] exact norm_set_integral_le_of_norm_le_const_ae' hμs h_norm (hfm.sub ae_strongly_measurable_const) #align filter.tendsto.integral_sub_linear_is_o_ae Filter.Tendsto.integral_sub_linear_isOCat_ae /-- Fundamental theorem of calculus for set integrals, `nhds_within` version: if `μ` is a locally finite measure and `f` is an almost everywhere measurable function that is continuous at a point `a` within a measurable set `t`, then `∫ x in s i, f x ∂μ = μ (s i) • f a + o(μ (s i))` at a filter `li` provided that `s i` tends to `(𝓝[t] a).small_sets` along `li`. Since `μ (s i)` is an `ℝ≥0∞` number, we use `(μ (s i)).to_real` in the actual statement. Often there is a good formula for `(μ (s i)).to_real`, so the formalization can take an optional argument `m` with this formula and a proof `of `(λ i, (μ (s i)).to_real) =ᶠ[li] m`. Without these arguments, `m i = (μ (s i)).to_real` is used in the output. -/ theorem ContinuousWithinAt.integral_sub_linear_isOCat_ae [TopologicalSpace α] [OpensMeasurableSpace α] [NormedSpace ℝ E] [CompleteSpace E] {μ : Measure α} [IsLocallyFiniteMeasure μ] {a : α} {t : Set α} {f : α → E} (ha : ContinuousWithinAt f t a) (ht : MeasurableSet t) (hfm : StronglyMeasurableAtFilter f (𝓝[t] a) μ) {s : ι → Set α} {li : Filter ι} (hs : Tendsto s li (𝓝[t] a).smallSets) (m : ι → ℝ := fun i => (μ (s i)).toReal) (hsμ : (fun i => (μ (s i)).toReal) =ᶠ[li] m := by rfl) : (fun i => (∫ x in s i, f x ∂μ) - m i • f a) =o[li] m := haveI : (𝓝[t] a).IsMeasurablyGenerated := ht.nhds_within_is_measurably_generated _ (ha.mono_left inf_le_left).integral_sub_linear_isOCat_ae hfm (μ.finite_at_nhds_within a t) hs m hsμ #align continuous_within_at.integral_sub_linear_is_o_ae ContinuousWithinAt.integral_sub_linear_isOCat_ae /-- Fundamental theorem of calculus for set integrals, `nhds` version: if `μ` is a locally finite measure and `f` is an almost everywhere measurable function that is continuous at a point `a`, then `∫ x in s i, f x ∂μ = μ (s i) • f a + o(μ (s i))` at `li` provided that `s` tends to `(𝓝 a).small_sets` along `li. Since `μ (s i)` is an `ℝ≥0∞` number, we use `(μ (s i)).to_real` in the actual statement. Often there is a good formula for `(μ (s i)).to_real`, so the formalization can take an optional argument `m` with this formula and a proof `of `(λ i, (μ (s i)).to_real) =ᶠ[li] m`. Without these arguments, `m i = (μ (s i)).to_real` is used in the output. -/ theorem ContinuousAt.integral_sub_linear_isOCat_ae [TopologicalSpace α] [OpensMeasurableSpace α] [NormedSpace ℝ E] [CompleteSpace E] {μ : Measure α} [IsLocallyFiniteMeasure μ] {a : α} {f : α → E} (ha : ContinuousAt f a) (hfm : StronglyMeasurableAtFilter f (𝓝 a) μ) {s : ι → Set α} {li : Filter ι} (hs : Tendsto s li (𝓝 a).smallSets) (m : ι → ℝ := fun i => (μ (s i)).toReal) (hsμ : (fun i => (μ (s i)).toReal) =ᶠ[li] m := by rfl) : (fun i => (∫ x in s i, f x ∂μ) - m i • f a) =o[li] m := (ha.mono_left inf_le_left).integral_sub_linear_isOCat_ae hfm (μ.finiteAtNhds a) hs m hsμ #align continuous_at.integral_sub_linear_is_o_ae ContinuousAt.integral_sub_linear_isOCat_ae /-- Fundamental theorem of calculus for set integrals, `nhds_within` version: if `μ` is a locally finite measure, `f` is continuous on a measurable set `t`, and `a ∈ t`, then `∫ x in (s i), f x ∂μ = μ (s i) • f a + o(μ (s i))` at `li` provided that `s i` tends to `(𝓝[t] a).small_sets` along `li`. Since `μ (s i)` is an `ℝ≥0∞` number, we use `(μ (s i)).to_real` in the actual statement. Often there is a good formula for `(μ (s i)).to_real`, so the formalization can take an optional argument `m` with this formula and a proof `of `(λ i, (μ (s i)).to_real) =ᶠ[li] m`. Without these arguments, `m i = (μ (s i)).to_real` is used in the output. -/ theorem ContinuousOn.integral_sub_linear_isOCat_ae [TopologicalSpace α] [OpensMeasurableSpace α] [NormedSpace ℝ E] [CompleteSpace E] [SecondCountableTopologyEither α E] {μ : Measure α} [IsLocallyFiniteMeasure μ] {a : α} {t : Set α} {f : α → E} (hft : ContinuousOn f t) (ha : a ∈ t) (ht : MeasurableSet t) {s : ι → Set α} {li : Filter ι} (hs : Tendsto s li (𝓝[t] a).smallSets) (m : ι → ℝ := fun i => (μ (s i)).toReal) (hsμ : (fun i => (μ (s i)).toReal) =ᶠ[li] m := by rfl) : (fun i => (∫ x in s i, f x ∂μ) - m i • f a) =o[li] m := (hft a ha).integral_sub_linear_isOCat_ae ht ⟨t, self_mem_nhdsWithin, hft.AeStronglyMeasurable ht⟩ hs m hsμ #align continuous_on.integral_sub_linear_is_o_ae ContinuousOn.integral_sub_linear_isOCat_ae section /-! ### Continuous linear maps composed with integration The goal of this section is to prove that integration commutes with continuous linear maps. This holds for simple functions. The general result follows from the continuity of all involved operations on the space `L¹`. Note that composition by a continuous linear map on `L¹` is not just the composition, as we are dealing with classes of functions, but it has already been defined as `continuous_linear_map.comp_Lp`. We take advantage of this construction here. -/ open ComplexConjugate variable {μ : Measure α} {𝕜 : Type _} [IsROrC 𝕜] [NormedSpace 𝕜 E] [NormedAddCommGroup F] [NormedSpace 𝕜 F] {p : ENNReal} namespace ContinuousLinearMap variable [CompleteSpace F] [NormedSpace ℝ F] theorem integral_compLp (L : E →L[𝕜] F) (φ : lp E p μ) : (∫ a, (L.compLp φ) a ∂μ) = ∫ a, L (φ a) ∂μ := integral_congr_ae <| coeFn_compLp _ _ #align continuous_linear_map.integral_comp_Lp ContinuousLinearMap.integral_compLp theorem set_integral_compLp (L : E →L[𝕜] F) (φ : lp E p μ) {s : Set α} (hs : MeasurableSet s) : (∫ a in s, (L.compLp φ) a ∂μ) = ∫ a in s, L (φ a) ∂μ := set_integral_congr_ae hs ((L.coeFn_compLp φ).mono fun x hx hx2 => hx) #align continuous_linear_map.set_integral_comp_Lp ContinuousLinearMap.set_integral_compLp theorem continuous_integral_comp_L1 (L : E →L[𝕜] F) : Continuous fun φ : α →₁[μ] E => ∫ a : α, L (φ a) ∂μ := by rw [← funext L.integral_comp_Lp] exact continuous_integral.comp (L.comp_LpL 1 μ).Continuous #align continuous_linear_map.continuous_integral_comp_L1 ContinuousLinearMap.continuous_integral_comp_L1 variable [CompleteSpace E] [NormedSpace ℝ E] theorem integral_comp_comm (L : E →L[𝕜] F) {φ : α → E} (φ_int : Integrable φ μ) : (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ) := by apply integrable.induction fun φ => (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ) · intro e s s_meas s_finite rw [integral_indicator_const e s_meas, ← @smul_one_smul E ℝ 𝕜 _ _ _ _ _ (μ s).toReal e, ContinuousLinearMap.map_smul, @smul_one_smul F ℝ 𝕜 _ _ _ _ _ (μ s).toReal (L e), ← integral_indicator_const (L e) s_meas] congr 1 with a rw [Set.indicator_comp_of_zero L.map_zero] · intro f g H f_int g_int hf hg simp [L.map_add, integral_add f_int g_int, integral_add (L.integrable_comp f_int) (L.integrable_comp g_int), hf, hg] · exact isClosed_eq L.continuous_integral_comp_L1 (L.continuous.comp continuous_integral) · intro f g hfg f_int hf convert hf using 1 <;> clear hf · exact integral_congr_ae (hfg.fun_comp L).symm · rw [integral_congr_ae hfg.symm] all_goals assumption #align continuous_linear_map.integral_comp_comm ContinuousLinearMap.integral_comp_comm theorem integral_apply {H : Type _} [NormedAddCommGroup H] [NormedSpace 𝕜 H] {φ : α → H →L[𝕜] E} (φ_int : Integrable φ μ) (v : H) : (∫ a, φ a ∂μ) v = ∫ a, φ a v ∂μ := ((ContinuousLinearMap.apply 𝕜 E v).integral_comp_comm φ_int).symm #align continuous_linear_map.integral_apply ContinuousLinearMap.integral_apply theorem integral_comp_comm' (L : E →L[𝕜] F) {K} (hL : AntilipschitzWith K L) (φ : α → E) : (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ) := by by_cases h : integrable φ μ · exact integral_comp_comm L h have : ¬integrable (L ∘ φ) μ := by rwa [lipschitz_with.integrable_comp_iff_of_antilipschitz L.lipschitz hL L.map_zero] simp [integral_undef, h, this] #align continuous_linear_map.integral_comp_comm' ContinuousLinearMap.integral_comp_comm' theorem integral_comp_L1_comm (L : E →L[𝕜] F) (φ : α →₁[μ] E) : (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ) := L.integral_comp_comm (L1.integrableCoeFn φ) #align continuous_linear_map.integral_comp_L1_comm ContinuousLinearMap.integral_comp_L1_comm end ContinuousLinearMap namespace LinearIsometry variable [CompleteSpace F] [NormedSpace ℝ F] [CompleteSpace E] [NormedSpace ℝ E] theorem integral_comp_comm (L : E →ₗᵢ[𝕜] F) (φ : α → E) : (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ) := L.toContinuousLinearMap.integral_comp_comm' L.antilipschitz _ #align linear_isometry.integral_comp_comm LinearIsometry.integral_comp_comm end LinearIsometry namespace ContinuousLinearEquiv variable [CompleteSpace F] [NormedSpace ℝ F] [CompleteSpace E] [NormedSpace ℝ E] theorem integral_comp_comm (L : E ≃L[𝕜] F) (φ : α → E) : (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ) := L.toContinuousLinearMap.integral_comp_comm' L.antilipschitz _ #align continuous_linear_equiv.integral_comp_comm ContinuousLinearEquiv.integral_comp_comm end ContinuousLinearEquiv variable [CompleteSpace E] [NormedSpace ℝ E] [CompleteSpace F] [NormedSpace ℝ F] @[norm_cast] theorem integral_of_real {f : α → ℝ} : (∫ a, (f a : 𝕜) ∂μ) = ↑(∫ a, f a ∂μ) := (@IsROrC.ofRealLi 𝕜 _).integral_comp_comm f #align integral_of_real integral_of_real theorem integral_re {f : α → 𝕜} (hf : Integrable f μ) : (∫ a, IsROrC.re (f a) ∂μ) = IsROrC.re (∫ a, f a ∂μ) := (@IsROrC.reClm 𝕜 _).integral_comp_comm hf #align integral_re integral_re theorem integral_im {f : α → 𝕜} (hf : Integrable f μ) : (∫ a, IsROrC.im (f a) ∂μ) = IsROrC.im (∫ a, f a ∂μ) := (@IsROrC.imClm 𝕜 _).integral_comp_comm hf #align integral_im integral_im theorem integral_conj {f : α → 𝕜} : (∫ a, conj (f a) ∂μ) = conj (∫ a, f a ∂μ) := (@IsROrC.conjLie 𝕜 _).toLinearIsometry.integral_comp_comm f #align integral_conj integral_conj theorem integral_coe_re_add_coe_im {f : α → 𝕜} (hf : Integrable f μ) : (∫ x, (IsROrC.re (f x) : 𝕜) ∂μ) + (∫ x, IsROrC.im (f x) ∂μ) * IsROrC.i = ∫ x, f x ∂μ := by rw [mul_comm, ← smul_eq_mul, ← integral_smul, ← integral_add] · congr ext1 x rw [smul_eq_mul, mul_comm, IsROrC.re_add_im] · exact hf.re.of_real · exact hf.im.of_real.smul IsROrC.i #align integral_coe_re_add_coe_im integral_coe_re_add_coe_im theorem integral_re_add_im {f : α → 𝕜} (hf : Integrable f μ) : ((∫ x, IsROrC.re (f x) ∂μ : ℝ) : 𝕜) + (∫ x, IsROrC.im (f x) ∂μ : ℝ) * IsROrC.i = ∫ x, f x ∂μ := by rw [← integral_of_real, ← integral_of_real, integral_coe_re_add_coe_im hf] #align integral_re_add_im integral_re_add_im theorem set_integral_re_add_im {f : α → 𝕜} {i : Set α} (hf : IntegrableOn f i μ) : ((∫ x in i, IsROrC.re (f x) ∂μ : ℝ) : 𝕜) + (∫ x in i, IsROrC.im (f x) ∂μ : ℝ) * IsROrC.i = ∫ x in i, f x ∂μ := integral_re_add_im hf #align set_integral_re_add_im set_integral_re_add_im theorem fst_integral {f : α → E × F} (hf : Integrable f μ) : (∫ x, f x ∂μ).1 = ∫ x, (f x).1 ∂μ := ((ContinuousLinearMap.fst ℝ E F).integral_comp_comm hf).symm #align fst_integral fst_integral theorem snd_integral {f : α → E × F} (hf : Integrable f μ) : (∫ x, f x ∂μ).2 = ∫ x, (f x).2 ∂μ := ((ContinuousLinearMap.snd ℝ E F).integral_comp_comm hf).symm #align snd_integral snd_integral theorem integral_pair {f : α → E} {g : α → F} (hf : Integrable f μ) (hg : Integrable g μ) : (∫ x, (f x, g x) ∂μ) = (∫ x, f x ∂μ, ∫ x, g x ∂μ) := have := hf.prod_mk hg Prod.ext (fst_integral this) (snd_integral this) #align integral_pair integral_pair theorem integral_smul_const {𝕜 : Type _} [IsROrC 𝕜] [NormedSpace 𝕜 E] (f : α → 𝕜) (c : E) : (∫ x, f x • c ∂μ) = (∫ x, f x ∂μ) • c := by by_cases hf : integrable f μ · exact ((1 : 𝕜 →L[𝕜] 𝕜).smul_right c).integral_comp_comm hf · by_cases hc : c = 0 · simp only [hc, integral_zero, smul_zero] rw [integral_undef hf, integral_undef, zero_smul] simp_rw [integrable_smul_const hc, hf, not_false_iff] #align integral_smul_const integral_smul_const section Inner variable {E' : Type _} variable [NormedAddCommGroup E'] [InnerProductSpace 𝕜 E'] variable [CompleteSpace E'] [NormedSpace ℝ E'] -- mathport name: «expr⟪ , ⟫» local notation "⟪" x ", " y "⟫" => @inner 𝕜 E' _ x y theorem integral_inner {f : α → E'} (hf : Integrable f μ) (c : E') : (∫ x, ⟪c, f x⟫ ∂μ) = ⟪c, ∫ x, f x ∂μ⟫ := ((innerSL 𝕜 c).restrictScalars ℝ).integral_comp_comm hf #align integral_inner integral_inner variable (𝕜) -- mathport name: inner_with_explicit -- variable binder update doesn't work for lemmas which refer to `𝕜` only via the notation local notation "⟪" x ", " y "⟫" => @inner 𝕜 E' _ x y theorem integral_eq_zero_of_forall_integral_inner_eq_zero (f : α → E') (hf : Integrable f μ) (hf_int : ∀ c : E', (∫ x, ⟪c, f x⟫ ∂μ) = 0) : (∫ x, f x ∂μ) = 0 := by specialize hf_int (∫ x, f x ∂μ) rwa [integral_inner hf, inner_self_eq_zero] at hf_int #align integral_eq_zero_of_forall_integral_inner_eq_zero integral_eq_zero_of_forall_integral_inner_eq_zero end Inner theorem integral_withDensity_eq_integral_smul {f : α → ℝ≥0} (f_meas : Measurable f) (g : α → E) : (∫ a, g a ∂μ.withDensity fun x => f x) = ∫ a, f a • g a ∂μ := by by_cases hg : integrable g (μ.with_density fun x => f x); swap · rw [integral_undef hg, integral_undef] rwa [← integrable_with_density_iff_integrable_smul f_meas] <;> infer_instance refine' integrable.induction _ _ _ _ _ hg · intro c s s_meas hs rw [integral_indicator s_meas] simp_rw [← indicator_smul_apply, integral_indicator s_meas] simp only [s_meas, integral_const, measure.restrict_apply', univ_inter, with_density_apply] rw [lintegral_coe_eq_integral, ENNReal.toReal_ofReal, ← integral_smul_const] · rfl · exact integral_nonneg fun x => NNReal.coe_nonneg _ · refine' ⟨f_meas.coe_nnreal_real.AeMeasurable.AeStronglyMeasurable, _⟩ rw [with_density_apply _ s_meas] at hs rw [has_finite_integral] convert hs ext1 x simp only [NNReal.nnnorm_eq] · intro u u' h_disj u_int u'_int h h' change (∫ a : α, u a + u' a ∂μ.with_density fun x : α => ↑(f x)) = ∫ a : α, f a • (u a + u' a) ∂μ simp_rw [smul_add] rw [integral_add u_int u'_int, h, h', integral_add] · exact (integrable_with_density_iff_integrable_smul f_meas).1 u_int · exact (integrable_with_density_iff_integrable_smul f_meas).1 u'_int · have C1 : Continuous fun u : Lp E 1 (μ.with_density fun x => f x) => ∫ x, u x ∂μ.with_density fun x => f x := continuous_integral have C2 : Continuous fun u : Lp E 1 (μ.with_density fun x => f x) => ∫ x, f x • u x ∂μ := by have : Continuous ((fun u : Lp E 1 μ => ∫ x, u x ∂μ) ∘ with_density_smul_li μ f_meas) := continuous_integral.comp (with_density_smul_li μ f_meas).Continuous convert this ext1 u simp only [Function.comp_apply, with_density_smul_li_apply] exact integral_congr_ae (mem_ℒ1_smul_of_L1_with_density f_meas u).coeFn_toLp.symm exact isClosed_eq C1 C2 · intro u v huv u_int hu rw [← integral_congr_ae huv, hu] apply integral_congr_ae filter_upwards [(ae_with_density_iff f_meas.coe_nnreal_ennreal).1 huv]with x hx rcases eq_or_ne (f x) 0 with (h'x | h'x) · simp only [h'x, zero_smul] · rw [hx _] simpa only [Ne.def, ENNReal.coe_eq_zero] using h'x #align integral_with_density_eq_integral_smul integral_withDensity_eq_integral_smul theorem integral_withDensity_eq_integral_smul₀ {f : α → ℝ≥0} (hf : AeMeasurable f μ) (g : α → E) : (∫ a, g a ∂μ.withDensity fun x => f x) = ∫ a, f a • g a ∂μ := by let f' := hf.mk _ calc (∫ a, g a ∂μ.with_density fun x => f x) = ∫ a, g a ∂μ.with_density fun x => f' x := by congr 1 apply with_density_congr_ae filter_upwards [hf.ae_eq_mk]with x hx rw [hx] _ = ∫ a, f' a • g a ∂μ := (integral_withDensity_eq_integral_smul hf.measurable_mk _) _ = ∫ a, f a • g a ∂μ := by apply integral_congr_ae filter_upwards [hf.ae_eq_mk]with x hx rw [hx] #align integral_with_density_eq_integral_smul₀ integral_withDensity_eq_integral_smul₀ theorem set_integral_withDensity_eq_set_integral_smul {f : α → ℝ≥0} (f_meas : Measurable f) (g : α → E) {s : Set α} (hs : MeasurableSet s) : (∫ a in s, g a ∂μ.withDensity fun x => f x) = ∫ a in s, f a • g a ∂μ := by rw [restrict_with_density hs, integral_withDensity_eq_integral_smul f_meas] #align set_integral_with_density_eq_set_integral_smul set_integral_withDensity_eq_set_integral_smul theorem set_integral_withDensity_eq_set_integral_smul₀ {f : α → ℝ≥0} {s : Set α} (hf : AeMeasurable f (μ.restrict s)) (g : α → E) (hs : MeasurableSet s) : (∫ a in s, g a ∂μ.withDensity fun x => f x) = ∫ a in s, f a • g a ∂μ := by rw [restrict_with_density hs, integral_withDensity_eq_integral_smul₀ hf] #align set_integral_with_density_eq_set_integral_smul₀ set_integral_withDensity_eq_set_integral_smul₀ end section thickenedIndicator variable [PseudoEMetricSpace α] theorem measure_le_lintegral_thickenedIndicatorAux (μ : Measure α) {E : Set α} (E_mble : MeasurableSet E) (δ : ℝ) : μ E ≤ ∫⁻ a, (thickenedIndicatorAux δ E a : ℝ≥0∞) ∂μ := by convert_to lintegral μ (E.indicator fun _ => (1 : ℝ≥0∞)) ≤ lintegral μ (thickenedIndicatorAux δ E) · rw [lintegral_indicator _ E_mble] simp only [lintegral_one, measure.restrict_apply, MeasurableSet.univ, univ_inter] · apply lintegral_mono apply indicator_le_thickenedIndicatorAux #align measure_le_lintegral_thickened_indicator_aux measure_le_lintegral_thickenedIndicatorAux theorem measure_le_lintegral_thickenedIndicator (μ : Measure α) {E : Set α} (E_mble : MeasurableSet E) {δ : ℝ} (δ_pos : 0 < δ) : μ E ≤ ∫⁻ a, (thickenedIndicator δ_pos E a : ℝ≥0∞) ∂μ := by convert measure_le_lintegral_thickenedIndicatorAux μ E_mble δ dsimp simp only [thickened_indicator_aux_lt_top.ne, ENNReal.coe_toNNReal, Ne.def, not_false_iff] #align measure_le_lintegral_thickened_indicator measure_le_lintegral_thickenedIndicator end thickenedIndicator section BilinearMap namespace MeasureTheory variable {f : β → ℝ} {m m0 : MeasurableSpace β} {μ : Measure β} theorem Integrable.simpleFuncMul (g : SimpleFunc β ℝ) (hf : Integrable f μ) : Integrable (g * f) μ := by refine' simple_func.induction (fun c s hs => _) (fun g₁ g₂ h_disj h_int₁ h_int₂ => (h_int₁.add h_int₂).congr (by rw [simple_func.coe_add, add_mul])) g simp only [simple_func.const_zero, simple_func.coe_piecewise, simple_func.coe_const, simple_func.coe_zero, Set.piecewise_eq_indicator] have : Set.indicator s (Function.const β c) * f = s.indicator (c • f) := by ext1 x by_cases hx : x ∈ s · simp only [hx, Pi.mul_apply, Set.indicator_of_mem, Pi.smul_apply, Algebra.id.smul_eq_mul] · simp only [hx, Pi.mul_apply, Set.indicator_of_not_mem, not_false_iff, MulZeroClass.zero_mul] rw [this, integrable_indicator_iff hs] exact (hf.smul c).IntegrableOn #align measure_theory.integrable.simple_func_mul MeasureTheory.Integrable.simpleFuncMul theorem Integrable.simpleFuncMul' (hm : m ≤ m0) (g : @SimpleFunc β m ℝ) (hf : Integrable f μ) : Integrable (g * f) μ := by rw [← simple_func.coe_to_larger_space_eq hm g] exact hf.simple_func_mul (g.to_larger_space hm) #align measure_theory.integrable.simple_func_mul' MeasureTheory.Integrable.simpleFuncMul' end MeasureTheory end BilinearMap
% ****** Start of file aipsamp.tex ****** % % This file is part of the AIP files in the AIP distribution for REVTeX 4. % Version 4.1 of REVTeX, October 2009 % % Copyright (c) 2009 American Institute of Physics. % Use this file as a source of example code for your aip document. % Use the file aiptemplate.tex as a template for your document. \documentclass[% aip, jmp,% amsmath,amssymb, %preprint,% reprint,% floatfix, %author-year,% %author-numerical,% ]{revtex4-1} \usepackage{graphicx}% Include figure files \usepackage{grffile} \usepackage{dcolumn}% Align table columns on decimal point \usepackage{bm}% bold math %\usepackage[mathlines]{lineno}% Enable numbering of text and display math %\linenumbers\relax % Commence numbering lines \maxdeadcycles=1000 \usepackage{multirow} \usepackage{color} % for the notes \usepackage{etex} \usepackage{float} \usepackage{pgffor} \usepackage{morefloats} \reserveinserts{358} %\extrafloats{1000} \usepackage{hyperref} \usepackage[usenames,dvipsnames]{xcolor} \usepackage{amsmath} \hypersetup{ colorlinks, linkcolor={red!50!black}, citecolor={blue!50!black}, urlcolor={blue!80!black} } \usepackage{longtable} \usepackage{float} \usepackage{supertabular} \usepackage{booktabs} \usepackage{array} %\usepackage{placeins} \usepackage{xr} \externaldocument{paper} \usepackage[section] {placeins} \newcommand{\minput}[1]{% \IfFileExists{#1}{\input{#1}}{} } \newcommand{\finput}[1]{% \IfFileExists{#1}{ \begin{figure}[!h] \centering \includegraphics[width=0.5\textwidth]{#1} \caption{First two principal components.} \end{figure} }{} } \newcommand{\beginsupplement}{% % \setcounter{table}{0} \renewcommand{\thesection}{S\Roman{section}}% \setcounter{table}{0} \renewcommand{\thetable}{S\arabic{table}}% \setcounter{figure}{0} \renewcommand{\thefigure}{S\arabic{figure}}% } \beginsupplement \begin{document} \preprint{XXXXX (preprint)} %\title[Evolution of interaction networks]{On the evolution of interaction networks: primitive typology of vertex, prominence of measures and activity statistics}% Force line breaks with \\ %\title[Evolution of interaction networks]{On the evolution of interaction networks: a primitive typology of vertex}% Force line breaks with \\ %\title[Interaction networks stability: SUPPORTING INFORMATION]{Time stability in human interaction networks: primitive typology of vertex, prominence of measures and time activity statistics (SUPPORTING INFORMATION)}% Force line breaks with \\ %\title[Textual differentiation in interaction networks (Supporting Information)]{Temporal stability in human interaction networks: sector sizes, topological prominence and activity along diverse timescales (Supporting Information document)}% Force line breaks with \\ \title[Text and topology in interaction networks (Supporting Information)]{Text and topology in in human interaction networks: differences among Erd\"os sectors and correlation of metrics (Supporting Information document)}% Force line breaks with \\ \author{Renato Fabbri}% \homepage{http://ifsc.usp.br/~fabbri/} \email{[email protected]} \affiliation{ S\~ao Carlos Institute of Physics, University of S\~ao Paulo (IFSC/USP), PO Box 369, 13560-970, S\~ao Carlos, SP, Brazil %\\This line break forced with \textbackslash\textbackslash } % %\author{Vilson V. da Silva Jr.} %\homepage{http://automata.cc/} %\email{[email protected]} %\altaffiliation[Also at ]{IFSC-USP}%Lines break automatically or can be forced with \\ % %\author{Ricardo Fabbri} %\homepage{http://www.lems.brown.edu/~rfabbri/} %\email{[email protected]} %\altaffiliation{ % Instituto Polit\'ecnico, Universidade Estadual do Rio de Janeiro (IPRJ) %}%Lines break automatically or can be forced with \\ % %\author{Deborah C. Antunes} %\homepage{http://lattes.cnpq.br/1065956470701739} %\email{[email protected]} %\altaffiliation{ % Curso de Psicologia, Universidade Federal do Cer\'a (UFC) %}%Lines break automatically or can be forced with \\ % %\author{Marilia M. Pisani} %\homepage{http://lattes.cnpq.br/6738980149860322} %\email{[email protected]} %\altaffiliation{ % %Centro de Ciências Naturais e Humanas, Universidade Federal do ABC (CCNH/UFABC) %}%Lines break automatically or can be forced with \\ % %% %%%\author{Luciano da Fontoura Costa} %%% \homepage{http://cyvision.ifsc.usp.br/~luciano/} %%% \email{[email protected]} %% \altaffiliation[Also at ]{IFSC-USP}%Lines break automatically or can be forced with \\ %% %\author{Leonardo Paulo Maia} % \homepage{http://www.ifsc.usp.br/~lpmaia/} % \email{[email protected] } % \altaffiliation[Also at ]{IFSC-USP}%Lines break automatically or can be forced with \\ % % %\author{Osvaldo N. Oliveira Jr.} % \homepage{www.polimeros.ifsc.usp.br/professors/professor.php?id=4} % \email{[email protected]} % \altaffiliation[Also at ]{IFSC-USP}%Lines break automatically or can be forced with \\ %\author{Renato Fabbri}% % \homepage{http://ifsc.usp.br/~fabbri/} % \email{[email protected]} % \affiliation{ %S\~ao Carlos Institute of Physics, University of S\~ao Paulo (IFSC/USP)%\\This line break forced with \textbackslash\textbackslash %} % %%\author{Vilson V. da Silva Jr.} %% \homepage{http://automata.cc/} %% \email{[email protected]} %% \altaffiliation[Also at ]{IFSC-USP}%Lines break automatically or can be forced with \\ %% %\author{Ricardo Fabbri} % \homepage{http://www.lems.brown.edu/~rfabbri/} % \email{[email protected]} % \altaffiliation{ %Instituto Polit\'ecnico, Universidade Estadual do Rio de Janeiro (IPRJ) %}%Lines break automatically or can be forced with \\ % %\author{Deborah C. Antunes} % \homepage{http://lattes.cnpq.br/1065956470701739} % \email{[email protected]} % \altaffiliation{ %Curso de Psicologia, Universidade Federal do Cer\'a (UFC) %}%Lines break automatically or can be forced with \\ % %\author{Marilia M. Pisani} % \homepage{http://lattes.cnpq.br/6738980149860322} % \email{[email protected]} % \altaffiliation{ %Centro de Ci\^encias Naturais e Humanas, Universidade Federal do ABC (CCNH/UFABC) %}%Lines break automatically or can be forced with \\ % %% %%%\author{Luciano da Fontoura Costa} %%% \homepage{http://cyvision.ifsc.usp.br/~luciano/} %%% \email{[email protected]} %% \altaffiliation[Also at ]{IFSC-USP}%Lines break automatically or can be forced with \\ %\author{Leonardo Paulo Maia} % \homepage{http://www.ifsc.usp.br/~lpmaia/} % \email{[email protected] } % \altaffiliation[Also at ]{IFSC-USP}%Lines break automatically or can be forced with \\ % % % %\author{Osvaldo N. Oliveira Jr.} % \homepage{www.polimeros.ifsc.usp.br/professors/professor.php?id=4} % \email{[email protected]} % \altaffiliation[Also at ]{IFSC-USP}%Lines break automatically or can be forced with \\ \date{\today}% It is always \today, today, % but any date may be explicitly specified \maketitle \tableofcontents %:\vfill %:\newpage This Supporting Information document exposes extensive measurements on interaction networks erived from email lists, Twitter, Participabr and IRC. \section{Measures}\label{sec:sigen} \subsection{General characteristics of activity distribution among participants}\label{sec:sigen} % \FloatBarrier % \subsubsection{Snapshots of 1000 messages}\label{sec:sigen1000} % \minput{tables/SI/labelsIDs} % \foreach \index in {0, ..., 20} { % \minput{tables/SI/mergedA\index} % } \clearpage \FloatBarrier \subsubsection{Snapshots of 2000 messages}\label{sec:sichar2000} \minput{tables/SI2/labelsIDs} \foreach \index in {0, ..., 20} { \minput{tables/SI2/mergedA\index} } \clearpage \FloatBarrier \subsection{POS tags and wordnet synsets}\label{sec:sipos} % \subsubsection{Snapshots of 1000 messages}\label{sec:simsg1000} % \foreach \index in {0, ..., 20} { % \minput{tables/SI/posMerged\index} % \minput{tables/SI/wnPOSInline2-n-\index} % \minput{tables/SI/wnPOSInline2-as-\index} % \minput{tables/SI/wnPOSInline2-v-\index} % \minput{tables/SI/wnPOSInline2-r-\index} % \clearpage % } % \FloatBarrier \subsubsection{Snapshots of 2000 messages}\label{sec:sichar2000} \foreach \index in {0, ..., 20} { \minput{tables/SI2/posMerged\index} \minput{tables/SI2/wnPOSInline2-n-\index} \minput{tables/SI2/wnPOSInline2-n-\index tag_} \clearpage \minput{tables/SI2/wnPOSInline2-as-\index} \minput{tables/SI2/wnPOSInline2-as-\index tag_} \clearpage \minput{tables/SI2/wnPOSInline2-v-\index} \minput{tables/SI2/wnPOSInline2-v-\index tag_} \clearpage \minput{tables/SI2/wnPOSInline2-r-\index} \minput{tables/SI2/wnPOSInline2-r-\index tag_} \clearpage } \FloatBarrier \subsection{Differentiation of the texts from Erd\"os sectors}\label{subsec:di} % \subsubsection{Snapshots of 1000 messages}\label{sec:simsg1000} % \foreach \index in {0, ..., 20} { % \minput{tables/SI/ksTokens\index _} % \minput{tables/SI/ksWords\index _} % \minput{tables/SI/ksSents\index _} % \minput{tables/SI/ksAdjs\index _} % \minput{tables/SI/ksSubs\index _} % \minput{tables/SI/ksPuns\index _} % \minput{tables/SI/ksChars\index _} % \minput{tables/SI/ksVerbs\index _} % \clearpage % } \subsubsection{Snapshots of 2000 messages}\label{sec:siwn2000} \FloatBarrier \foreach \index in {0, ..., 20} { \minput{tables/SI2/ksTokens\index _} \minput{tables/SI2/ksWords\index _} \minput{tables/SI2/ksSents\index _} \minput{tables/SI2/ksAdjs\index _} \minput{tables/SI2/ksSubs\index _} \minput{tables/SI2/ksPuns\index _} \minput{tables/SI2/ksChars\index _} \minput{tables/SI2/ksVerbs\index _} \clearpage } \FloatBarrier \subsection{Correlation of topological and textual metrics}\label{subsec:cor} % \subsubsection{Snapshots of 1000 messages}\label{sec:simsg1000} % \foreach \index in {0, ..., 20} { % \minput{tables/SI/correlationInline\index _} % } % \FloatBarrier \subsubsection{Snapshots of 2000 messages}\label{sec:simsg1000} \foreach \index in {0, ..., 20} { \minput{tables/SI2/correlationInline\index _} } \FloatBarrier \subsection{Formation of principal components}\label{subsec:pc} %\input{tables/pcaInline_} % \subsubsection{Snapshots of 1000 messages}\label{sec:simsg1000} % \foreach \index in {0, ..., 20} { % \minput{tables/SI/pcaInline\index _} % \finput{figs/SI/plot_pca-\index.png} % \clearpage % \FloatBarrier % } \FloatBarrier \subsubsection{Snapshots of 2000 messages}\label{sec:simsg1000} \foreach \index in {0, ..., 20} { \minput{tables/SI2/pcaInline\index _} \finput{figs/SI2/plot_pca-\index .png} \clearpage \FloatBarrier } \clearpage %\nocite{*} \newpage \section{Histograms of existent and incident words}\label{sec:resE} See subsection~\ref{subsec:sii}, and Figures~\ref{fig:kw}-\ref{fig:nssnsw} for discussion and directions. \begin{figure*}[h!] \centering \includegraphics[width=\textwidth]{figs/kw} \caption{Size of words that are known in English. Crossing of incident and existential sizes is around 5 (Figure~\ref{fig:kwnsw} shows a shift to length 6-7 when consider only non stopwords). Words with three letters have maximum incidence, while most words have 7 letters. See subsection~\ref{subsec:sii} for discussion and directions.} \label{fig:kw} \end{figure*} \begin{figure*}[h!] \centering \includegraphics[width=\textwidth]{figs/kwnsw} \caption{Size of words that are known in English and are not stopwords. Crossing of incident and existential sizes is around 6-7 (figure~\ref{fig:kw} shows a shift to length 5 when considered stopwords). In this case, words with 4 letters have maximum incidence, while most words still have 7 letters. Exception for ELE, which exhibits maximum incidence of words with 5 letters and most words having 8 letters, which might be associated with ELE network typology discussed in tables~\ref{tab:tokens} and~\label{tab:caracteres}. See subsection~\ref{subsec:sii} for discussion and directions.} \label{fig:kwnsw} \end{figure*} \begin{figure*}[h!] \centering \includegraphics[width=\textwidth]{figs/kwssnsw} \caption{Size of words that are known, are not stopwords and have synsets. Resembles figure~\ref{fig:kwnsw}. Stopword sizes histogram are in figure~\ref{fig:sw}. Differences suggests $\approx 0.5$ might be constant. LAD and LAU exquisite vocabulary (GNU/Linux, programming, sound/signal processing, music) might be responsible for higher difference of distributions. See subsection~\ref{subsec:sii} for discussion and directions. See subsection~\ref{subsec:sii} for discussion and directions.} \label{fig:kwssnsw} \end{figure*} \begin{figure*}[h!] \centering \includegraphics[width=\textwidth]{figs/sw} \caption{Size histogram of stopwords. Stopwords with two letters are the most frequent, while most of them have four letters. Differences in distribution seem stable around $\approx 0.6$. See subsection~\ref{subsec:sii} for discussion and directions.} \label{fig:sw} \end{figure*} \begin{figure*}[h!] \centering \includegraphics[width=\textwidth]{figs/nssnsw} \caption{Size histogram of known English words that are not stopwords and do not return synsets. Differences in distribution suggests less stable behavior, with high incidence of few words high number of existing words with many letters. Observe difference $\geq 1$, as observed only with all known words, but even higher. See subsection~\ref{subsec:sii} for discussion and directions.} \label{fig:nssnsw} \end{figure*} %\nocite{*} %\nocite{*} \bibliography{supportingInformation}% Produces the bibliography via BibTeX. \end{document} % % ****** End of file aipsamp.tex ******
[STATEMENT] lemma setTextPost_absorb[simp]: "setTitlePost (setTitlePost pst tit) tit1 = setTitlePost pst tit1" "setTextPost (setTextPost pst txt) txt1 = setTextPost pst txt1" "setImgPost (setImgPost pst img) img1 = setImgPost pst img1" [PROOF STATE] proof (prove) goal (1 subgoal): 1. setTitlePost (setTitlePost pst tit) tit1 = setTitlePost pst tit1 &&& setTextPost (setTextPost pst txt) txt1 = setTextPost pst txt1 &&& setImgPost (setImgPost pst img) img1 = setImgPost pst img1 [PROOF STEP] (* "setVisPost (setVisPost pst vis) vis1 = setVisPost pst vis1" *) [PROOF STATE] proof (prove) goal (1 subgoal): 1. setTitlePost (setTitlePost pst tit) tit1 = setTitlePost pst tit1 &&& setTextPost (setTextPost pst txt) txt1 = setTextPost pst txt1 &&& setImgPost (setImgPost pst img) img1 = setImgPost pst img1 [PROOF STEP] by (cases pst, auto)+
{-# LANGUAGE BangPatterns #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} ----------------------------------------------------------------------------- -- | -- Copyright : (c) Edward Kmett 2010-2014 -- License : BSD3 -- Maintainer : [email protected] -- Stability : experimental -- Portability : GHC only -- ----------------------------------------------------------------------------- module Numeric.AD.Rank1.Newton ( -- * Newton's Method (Forward) findZero , inverse , fixedPoint , extremum -- * Gradient Ascent/Descent (Kahn) , gradientDescent , gradientAscent ) where import Prelude hiding (all, mapM) import Data.Foldable (all) import Data.Traversable import Numeric.AD.Mode import Numeric.AD.Rank1.Forward (Forward, diff, diff') import Numeric.AD.Rank1.Kahn as Kahn (Kahn, gradWith') import Numeric.AD.Internal.On -- $setup -- >>> import Data.Complex -- | The 'findZero' function finds a zero of a scalar function using -- Newton's method; its output is a stream of increasingly accurate -- results. (Modulo the usual caveats.) If the stream becomes constant -- ("it converges"), no further elements are returned. -- -- Examples: -- -- >>> take 10 $ findZero (\x->x^2-4) 1 -- [1.0,2.5,2.05,2.000609756097561,2.0000000929222947,2.000000000000002,2.0] -- -- >>> last $ take 10 $ findZero ((+1).(^2)) (1 :+ 1) -- 0.0 :+ 1.0 findZero :: (Fractional a, Eq a) => (Forward a -> Forward a) -> a -> [a] findZero f = go where go x = x : if x == xn then [] else go xn where (y,y') = diff' f x xn = x - y/y' {-# INLINE findZero #-} -- | The 'inverse' function inverts a scalar function using -- Newton's method; its output is a stream of increasingly accurate -- results. (Modulo the usual caveats.) If the stream becomes -- constant ("it converges"), no further elements are returned. -- -- Example: -- -- >>> last $ take 10 $ inverse sqrt 1 (sqrt 10) -- 10.0 inverse :: (Fractional a, Eq a) => (Forward a -> Forward a) -> a -> a -> [a] inverse f x0 y = findZero (\x -> f x - auto y) x0 {-# INLINE inverse #-} -- | The 'fixedPoint' function find a fixedpoint of a scalar -- function using Newton's method; its output is a stream of -- increasingly accurate results. (Modulo the usual caveats.) -- -- If the stream becomes constant ("it converges"), no further -- elements are returned. -- -- >>> last $ take 10 $ fixedPoint cos 1 -- 0.7390851332151607 fixedPoint :: (Fractional a, Eq a) => (Forward a -> Forward a) -> a -> [a] fixedPoint f = findZero (\x -> f x - x) {-# INLINE fixedPoint #-} -- | The 'extremum' function finds an extremum of a scalar -- function using Newton's method; produces a stream of increasingly -- accurate results. (Modulo the usual caveats.) If the stream -- becomes constant ("it converges"), no further elements are returned. -- -- >>> last $ take 10 $ extremum cos 1 -- 0.0 extremum :: (Fractional a, Eq a) => (On (Forward (Forward a)) -> On (Forward (Forward a))) -> a -> [a] extremum f = findZero (diff (off . f . On)) {-# INLINE extremum #-} -- | The 'gradientDescent' function performs a multivariate -- optimization, based on the naive-gradient-descent in the file -- @stalingrad\/examples\/flow-tests\/pre-saddle-1a.vlad@ from the -- VLAD compiler Stalingrad sources. Its output is a stream of -- increasingly accurate results. (Modulo the usual caveats.) -- -- It uses reverse mode automatic differentiation to compute the gradient. gradientDescent :: (Traversable f, Fractional a, Ord a) => (f (Kahn a) -> Kahn a) -> f a -> [f a] gradientDescent f x0 = go x0 fx0 xgx0 0.1 (0 :: Int) where (fx0, xgx0) = Kahn.gradWith' (,) f x0 go x fx xgx !eta !i | eta == 0 = [] -- step size is 0 | fx1 > fx = go x fx xgx (eta/2) 0 -- we stepped too far | zeroGrad xgx = [] -- gradient is 0 | otherwise = x1 : if i == 10 then go x1 fx1 xgx1 (eta*2) 0 else go x1 fx1 xgx1 eta (i+1) where zeroGrad = all (\(_,g) -> g == 0) x1 = fmap (\(xi,gxi) -> xi - eta * gxi) xgx (fx1, xgx1) = Kahn.gradWith' (,) f x1 {-# INLINE gradientDescent #-} -- | Perform a gradient descent using reverse mode automatic differentiation to compute the gradient. gradientAscent :: (Traversable f, Fractional a, Ord a) => (f (Kahn a) -> Kahn a) -> f a -> [f a] gradientAscent f = gradientDescent (negate . f) {-# INLINE gradientAscent #-}
lemma coeffs_Poly [simp]: "coeffs (Poly as) = strip_while (HOL.eq 0) as"
= = Implementation and results = =
import data.real.basic import algebra.field.basic import data.nat.parity import algebra.big_operators.ring open_locale big_operators open division_ring open finset open nat -- supporting proofs theorem alg_sup_proof_1 (n : ℕ) (h₀ : n > 1) : (n-1)/2 < n := begin rw nat.div_lt_iff_lt_mul, { induction n with n hn, {linarith}, {rw succ_eq_add_one, simp, linarith} }, {exact zero_lt_two} end theorem alg_sup_proof_2 (n : ℕ) (h₀ : n > 1) : n/2 < n := begin rw nat.div_lt_iff_lt_mul, {linarith}, {exact zero_lt_two} end theorem alg_sup_proof_3 (n k : ℕ) : 2 * 2 ^ k * (n + 1) > 1 := begin have hx : ∃ x : ℕ, x = 2 ^ k, by use 2 ^ k, cases hx with x hx, have hx₂ : x > 0, by simp *, have hy : ∃ y : ℕ, y = n + 1, by use (n+1), cases hy with y hy, have hy₂ : y > 0, by simp *, have hxy : ∃ xy : ℕ, xy = x * y, by use x * y, cases hxy with xy hxy, have hxy₂ : xy > 0, by {rw hxy, exact mul_pos hx₂ hy₂}, rw [←hx, ←hy, mul_assoc, ←hxy], linarith end def c : ℕ → ℤ | n := if h₀ : n > 1 then if h₁ : odd n then have (n-1)/2 < n, by exact alg_sup_proof_1 n h₀, (-1) ^ ((n-1)/2) * c ((n-1)/2) else have n/2 < n, by exact alg_sup_proof_2 n h₀, c (n/2) else 1 -- lhs of core theorem c_2n_eq_c_n (n : ℕ) : c(2*n) = c(n) := begin rw c, cases n, {simp, rw c, simp}, { rw succ_eq_add_one, have n_greater : 2 * (n + 1) > 1, by { exact (cmp_eq_lt_iff 1 (2 * (n + 1))).mp rfl }, have n_even : even (2 * (n + 1)), by {rw even, use n + 1}, simp *, } end theorem c_2n_add_2_eq_c_n_add_1 (n : ℕ) : c(2*n+2) = c(n+1) := begin have eq_ex : 2 * n + 2 = 2 * (n + 1), by linarith, rw eq_ex, exact c_2n_eq_c_n (n + 1) end -- rhs of core theorem c_2n_add_1_eq_sign_c_n (n : ℕ) : c(2*n+1) = (-1) ^ n * c(n) := begin rw c, cases n, {simp, rw c, simp}, { rw succ_eq_add_one, have ex_greater : 2 * (n + 1) + 1 > 1, by linarith, have ex_odd : odd (2*(n+1)+1), by {rw odd, use (n+1)}, simp * } end theorem c_2n_add_3_eq_sign_c_n_add_1 (n : ℕ) : c(2*n+3) = (-1) ^ (n+1) * c(n+1) := begin have eq_ex : 2 * n + 3 = 2 * (n + 1) + 1, by linarith, rw eq_ex, exact c_2n_add_1_eq_sign_c_n (n + 1) end -- main equality theorem core_eq_putnam (n : ℕ) : c(2*n) * c(2*n+2) = (-1) * c(2*n+1) * c(2*n+3) := begin -- exploiting mini-proofs to simplify rw c_2n_eq_c_n, rw c_2n_add_2_eq_c_n_add_1, rw c_2n_add_1_eq_sign_c_n, rw c_2n_add_3_eq_sign_c_n_add_1, -- deal with signs -- get rid of (-1)^(2) rw [←mul_assoc, ←mul_assoc, ←pow_succ], rw mul_assoc ((-1 : ℤ) ^ (n + 1)), rw mul_comm (c(n)) ((-1)^(n+1)), rw [←mul_assoc, pow_succ, ←mul_assoc], rw [mul_assoc (-1 : ℤ), mul_comm ((-1 : ℤ)^n)], rw ←mul_assoc (-1 : ℤ) (-1) ((-1)^n), rw [←sq (-1 : ℤ), neg_one_sq, one_mul], -- get rid of (-1)^n rw [←pow_add, ←two_mul, mul_comm 2 n], rw [pow_mul', neg_one_sq, one_pow, one_mul] end theorem putnam_2013_b1 : ∑ i in range 2014, c(i) * c(i+2) = 0 := begin have eq : 2014 = 2 * 1007, by norm_num, rw eq, induction 1007, {simp}, { rw [succ_eq_add_one, mul_add, mul_one], rw [sum_range_succ, sum_range_succ], rw [ih, zero_add, core_eq_putnam], linarith } end
(* Title: Inverse.thy Author: Jose Divasón <jose.divasonm at unirioja.es> Author: Jesús Aransay <jesus-maria.aransay at unirioja.es> *) section\<open>Inverse of a matrix using the Gauss Jordan algorithm\<close> theory Inverse imports Gauss_Jordan_PA begin subsection\<open>Several properties\<close> text\<open>Properties about Gauss Jordan algorithm, reduced row echelon form, rank, identity matrix and invertibility\<close> lemma rref_id_implies_invertible: fixes A::"'a::{field}^'n::{mod_type}^'n::{mod_type}" assumes Gauss_mat_1: "Gauss_Jordan A = mat 1" shows "invertible A" proof - obtain P where P: "invertible P" and PA: "Gauss_Jordan A = P ** A" using invertible_Gauss_Jordan[of A] by blast have "A = mat 1 ** A" unfolding matrix_mul_lid .. also have "... = (matrix_inv P ** P) ** A" using P invertible_def matrix_inv_unique by metis also have "... = (matrix_inv P) ** (P ** A)" by (metis PA assms calculation matrix_eq matrix_vector_mul_assoc matrix_vector_mul_lid) also have "... = (matrix_inv P) ** mat 1" unfolding PA[symmetric] Gauss_mat_1 .. also have "... = (matrix_inv P)" unfolding matrix_mul_rid .. finally have "A = (matrix_inv P)" . thus ?thesis using P unfolding invertible_def using matrix_inv_unique by blast qed text\<open>In the following case, nrows is equivalent to ncols due to we are working with a square matrix\<close> lemma full_rank_implies_invertible: fixes A::"'a::{field}^'n::{mod_type}^'n::{mod_type}" assumes rank_n: "rank A = nrows A" shows "invertible A" proof (unfold invertible_left_inverse[of A] matrix_left_invertible_ker, clarify) fix x assume Ax: "A *v x = 0" have rank_eq_card_n: "rank A = CARD('n)" using rank_n unfolding nrows_def . have "vec.dim (null_space A)=0" unfolding dim_null_space unfolding rank_eq_card_n dimension_vector by simp hence "null_space A = {0}" using vec.dim_zero_eq using Ax null_space_def by auto thus "x = 0" unfolding null_space_def using Ax by blast qed lemma invertible_implies_full_rank: fixes A::"'a::{field}^'n::{mod_type}^'n::{mod_type}" assumes inv_A: "invertible A" shows "rank A = nrows A" proof - have "(\<forall>x. A *v x = 0 \<longrightarrow> x = 0)" using inv_A unfolding invertible_left_inverse[unfolded matrix_left_invertible_ker] . hence null_space_eq_0: "(null_space A) = {0}" unfolding null_space_def using matrix_vector_mult_0_right by fast have dim_null_space: "vec.dim (null_space A) = 0" unfolding vec.dim_def by (metis (no_types) null_space_eq_0 vec.dim_def vec.dim_zero_eq') show ?thesis using rank_nullity_theorem_matrices[of A] unfolding dim_null_space rank_eq_dim_col_space nrows_def unfolding col_space_eq unfolding ncols_def by simp qed definition id_upt_k :: "'a::{zero, one}^'n::{mod_type}^'n::{mod_type} \<Rightarrow> nat => bool" where "id_upt_k A k = (\<forall>i j. to_nat i < k \<and> to_nat j < k \<longrightarrow> ((i = j \<longrightarrow> A $ i $ j = 1) \<and> (i \<noteq> j \<longrightarrow> A $ i $ j = 0)))" lemma id_upt_nrows_mat_1: assumes "id_upt_k A (nrows A)" shows "A = mat 1" unfolding mat_def apply vector using assms unfolding id_upt_k_def nrows_def using to_nat_less_card[where ?'a='b] by presburger subsection\<open>Computing the inverse of a matrix using the Gauss Jordan algorithm\<close> text\<open>This lemma is essential to demonstrate that the Gauss Jordan form of an invertible matrix is the identity. The proof is made by induction and it is explained in @{url "http://www.unirioja.es/cu/jodivaso/Isabelle/Gauss-Jordan-2013-2-Generalized/Demonstration_invertible.pdf"}\<close> lemma id_upt_k_Gauss_Jordan: fixes A::"'a::{field}^'n::{mod_type}^'n::{mod_type}" assumes inv_A: "invertible A" shows "id_upt_k (Gauss_Jordan A) k" proof (induct k) case 0 show ?case unfolding id_upt_k_def by fast next case (Suc k) note id_k=Suc.hyps have rref_k: "reduced_row_echelon_form_upt_k (Gauss_Jordan A) k" using rref_implies_rref_upt[OF rref_Gauss_Jordan] . have rref_suc_k: "reduced_row_echelon_form_upt_k (Gauss_Jordan A) (Suc k)" using rref_implies_rref_upt[OF rref_Gauss_Jordan] . have inv_gj: "invertible (Gauss_Jordan A)" by (metis inv_A invertible_Gauss_Jordan invertible_mult) show "id_upt_k (Gauss_Jordan A) (Suc k)" proof (unfold id_upt_k_def, auto) fix j::'n assume j_less_suc: "to_nat j < Suc k" \<comment> \<open>First of all we prove a property which will be useful later\<close> have greatest_prop: "j \<noteq> 0 \<Longrightarrow> to_nat j = k \<Longrightarrow> (GREATEST m. \<not> is_zero_row_upt_k m k (Gauss_Jordan A)) = j - 1" proof (rule Greatest_equality) assume j_not_zero: "j \<noteq> 0" and j_eq_k: "to_nat j = k" have j_minus_1: "to_nat (j - 1) < k" by (metis (full_types) Suc_le' diff_add_cancel j_eq_k j_not_zero to_nat_mono) show "\<not> is_zero_row_upt_k (j - 1) k (Gauss_Jordan A)" unfolding is_zero_row_upt_k_def proof (auto, rule exI[of _ "j - 1"], rule conjI) show "to_nat (j - 1) < k" using j_minus_1 . show "Gauss_Jordan A $ (j - 1) $ (j - 1) \<noteq> 0" using id_k unfolding id_upt_k_def using j_minus_1 by simp qed fix a::'n assume not_zero_a: "\<not> is_zero_row_upt_k a k (Gauss_Jordan A)" show "a \<le> j - 1" proof (rule ccontr) assume " \<not> a \<le> j - 1" hence a_greater_i_minus_1: "a > j - 1" by simp have "is_zero_row_upt_k a k (Gauss_Jordan A)" unfolding is_zero_row_upt_k_def proof (clarify) fix b::'n assume a: "to_nat b < k" have Least_eq: "(LEAST n. Gauss_Jordan A $ b $ n \<noteq> 0) = b" proof (rule Least_equality) show "Gauss_Jordan A $ b $ b \<noteq> 0" by (metis a id_k id_upt_k_def zero_neq_one) show "\<And>y. Gauss_Jordan A $ b $ y \<noteq> 0 \<Longrightarrow> b \<le> y" by (metis (hide_lams, no_types) a not_less_iff_gr_or_eq id_k id_upt_k_def less_trans not_less to_nat_mono) qed moreover have "\<not> is_zero_row_upt_k b k (Gauss_Jordan A)" unfolding is_zero_row_upt_k_def apply auto apply (rule exI[of _ b]) using a id_k unfolding id_upt_k_def by simp moreover have "a \<noteq> b" proof - have "b < from_nat k" by (metis a from_nat_to_nat_id j_eq_k not_less_iff_gr_or_eq to_nat_le) also have "... = j" using j_eq_k to_nat_from_nat by auto also have "... \<le> a" using a_greater_i_minus_1 by (metis diff_add_cancel le_Suc) finally show ?thesis by simp qed ultimately show "Gauss_Jordan A $ a $ b = 0" using rref_upt_condition4[OF rref_k] by auto qed thus "False" using not_zero_a by contradiction qed qed show Gauss_jj_1: "Gauss_Jordan A $ j $ j = 1" proof (cases "j=0") \<comment> \<open>In case that j be zero, the result is trivial\<close> case True show ?thesis proof (unfold True, rule rref_first_element) show "reduced_row_echelon_form (Gauss_Jordan A)" by (rule rref_Gauss_Jordan) show "column 0 (Gauss_Jordan A) \<noteq> 0" by (metis det_zero_column inv_gj invertible_det_nz) qed next case False note j_not_zero = False show ?thesis proof (cases "to_nat j < k") case True thus ?thesis using id_k unfolding id_upt_k_def by presburger \<comment> \<open>Easy due to the inductive hypothesis\<close> next case False hence j_eq_k: "to_nat j = k" using j_less_suc by auto have j_minus_1: "to_nat (j - 1) < k" by (metis (full_types) Suc_le' diff_add_cancel j_eq_k j_not_zero to_nat_mono) have "(GREATEST m. \<not> is_zero_row_upt_k m k (Gauss_Jordan A)) = j - 1" by (rule greatest_prop[OF j_not_zero j_eq_k]) hence zero_j_k: "is_zero_row_upt_k j k (Gauss_Jordan A)" by (metis not_le greatest_ge_nonzero_row j_eq_k j_minus_1 to_nat_mono') show ?thesis proof (rule ccontr, cases "Gauss_Jordan A $ j $ j = 0") case False note gauss_jj_not_0 = False assume gauss_jj_not_1: "Gauss_Jordan A $ j $ j \<noteq> 1" have "(LEAST n. Gauss_Jordan A $ j $ n \<noteq> 0) = j" proof (rule Least_equality) show "Gauss_Jordan A $ j $ j \<noteq> 0" using gauss_jj_not_0 . show "\<And>y. Gauss_Jordan A $ j $ y \<noteq> 0 \<Longrightarrow> j \<le> y" by (metis le_less_linear is_zero_row_upt_k_def j_eq_k to_nat_mono zero_j_k) qed hence "Gauss_Jordan A $ j $ (LEAST n. Gauss_Jordan A $ j $ n \<noteq> 0) \<noteq> 1" using gauss_jj_not_1 by auto \<comment> \<open>Contradiction with the second condition of rref\<close> thus False by (metis gauss_jj_not_0 is_zero_row_upt_k_def j_eq_k lessI rref_suc_k rref_upt_condition2) next case True note gauss_jj_0 = True have zero_j_suc_k: "is_zero_row_upt_k j (Suc k) (Gauss_Jordan A)" by (rule is_zero_row_upt_k_suc[OF zero_j_k], metis gauss_jj_0 j_eq_k to_nat_from_nat) have "\<not> (\<exists>B. B ** (Gauss_Jordan A) = mat 1)" \<comment> \<open>This will be a contradiction\<close> proof (unfold matrix_left_invertible_independent_columns, simp, rule exI[of _ "\<lambda>i. (if i < j then column j (Gauss_Jordan A) $ i else if i=j then -1 else 0)"], rule conjI) show "(\<Sum>i\<in>UNIV. (if i < j then column j (Gauss_Jordan A) $ i else if i=j then -1 else 0) *s column i (Gauss_Jordan A)) = 0" proof (unfold vec_eq_iff sum_component, auto) \<comment> \<open>We write the column j in a linear combination of the previous ones, which is a contradiction (the matrix wouldn't be invertible)\<close> let ?f="\<lambda>i. (if i < j then column j (Gauss_Jordan A) $ i else if i=j then -1 else 0)" fix i let ?g="(\<lambda>x. ?f x * column x (Gauss_Jordan A) $ i)" show "sum ?g UNIV = 0" proof (cases "i<j") case True note i_less_j = True have sum_rw: "sum ?g (UNIV - {i}) = ?g j + sum ?g ((UNIV - {i}) - {j})" proof (rule sum.remove) show "finite (UNIV - {i})" using finite_code by simp show "j \<in> UNIV - {i}" using True by blast qed have sum_g0: "sum ?g (UNIV - {i} - {j}) = 0" proof (rule sum.neutral, auto) fix a assume a_not_j: "a \<noteq> j" and a_not_i: "a \<noteq> i" and a_less_j: "a < j" and column_a_not_zero: "column a (Gauss_Jordan A) $ i \<noteq> 0" have "Gauss_Jordan A $ i $ a = 0" using id_k unfolding id_upt_k_def using a_less_j j_eq_k using i_less_j a_not_i to_nat_mono by blast thus "column j (Gauss_Jordan A) $ a = 0" using column_a_not_zero unfolding column_def by simp \<comment> \<open>Contradiction\<close> qed have "sum ?g UNIV = ?g i + sum ?g (UNIV - {i})" by (rule sum.remove, simp_all) also have "... = ?g i + ?g j + sum ?g (UNIV - {i} - {j})" unfolding sum_rw by auto also have "... = ?g i + ?g j" unfolding sum_g0 by simp also have "... = 0" using True unfolding column_def by (simp, metis id_k id_upt_k_def j_eq_k to_nat_mono) finally show ?thesis . next case False have zero_i_suc_k: "is_zero_row_upt_k i (Suc k) (Gauss_Jordan A)" by (metis False zero_j_suc_k linorder_cases rref_suc_k rref_upt_condition1) show ?thesis proof (rule sum.neutral, auto) show "column j (Gauss_Jordan A) $ i = 0" using zero_i_suc_k unfolding column_def is_zero_row_upt_k_def by (metis j_eq_k lessI vec_lambda_beta) next fix a assume a_not_j: "a \<noteq> j" and a_less_j: "a < j" and column_a_i: "column a (Gauss_Jordan A) $ i \<noteq> 0" have "Gauss_Jordan A $ i $ a = 0" using zero_i_suc_k unfolding is_zero_row_upt_k_def by (metis (full_types) a_less_j j_eq_k less_SucI to_nat_mono) thus "column j (Gauss_Jordan A) $ a = 0" using column_a_i unfolding column_def by simp qed qed qed next show "\<exists>i. (if i < j then column j (Gauss_Jordan A) $ i else if i = j then -1 else 0) \<noteq> 0" by (metis False j_eq_k neg_equal_0_iff_equal to_nat_mono zero_neq_one) qed thus False using inv_gj unfolding invertible_def by simp qed qed qed fix i::'n assume i_less_suc: "to_nat i < Suc k" and i_not_j: "i \<noteq> j" show "Gauss_Jordan A $ i $ j = 0" \<comment> \<open>This result is proved making use of the 4th condition of rref\<close> proof (cases "to_nat i < k \<and> to_nat j < k") case True thus ?thesis using id_k i_not_j unfolding id_upt_k_def by blast \<comment> \<open>Easy due to the inductive hypothesis\<close> next case False note i_or_j_ge_k = False show ?thesis proof (cases "to_nat i < k") case True hence j_eq_k: "to_nat j = k" using i_or_j_ge_k j_less_suc by simp have j_noteq_0: "j \<noteq> 0" by (metis True j_eq_k less_nat_zero_code to_nat_0) have j_minus_1: "to_nat (j - 1) < k" by (metis (full_types) Suc_le' diff_add_cancel j_eq_k j_noteq_0 to_nat_mono) have "(GREATEST m. \<not> is_zero_row_upt_k m k (Gauss_Jordan A)) = j - 1" by (rule greatest_prop[OF j_noteq_0 j_eq_k]) hence zero_j_k: "is_zero_row_upt_k j k (Gauss_Jordan A)" by (metis (lifting, mono_tags) less_linear less_asym j_eq_k j_minus_1 not_greater_Greatest to_nat_mono) have Least_eq_j: "(LEAST n. Gauss_Jordan A $ j $ n \<noteq> 0) = j" proof (rule Least_equality) show "Gauss_Jordan A $ j $ j \<noteq> 0" using Gauss_jj_1 by simp show "\<And>y. Gauss_Jordan A $ j $ y \<noteq> 0 \<Longrightarrow> j \<le> y" by (metis True le_cases from_nat_to_nat_id i_or_j_ge_k is_zero_row_upt_k_def j_less_suc less_Suc_eq_le less_le to_nat_le zero_j_k) qed moreover have "\<not> is_zero_row_upt_k j (Suc k) (Gauss_Jordan A)" unfolding is_zero_row_upt_k_def by (metis Gauss_jj_1 j_less_suc zero_neq_one) ultimately show ?thesis using rref_upt_condition4[OF rref_suc_k] i_not_j by fastforce next case False hence i_eq_k: "to_nat i = k" by (metis \<open>to_nat i < Suc k\<close> less_SucE) hence j_less_k: "to_nat j < k" by (metis i_not_j j_less_suc less_SucE to_nat_from_nat) have "(LEAST n. Gauss_Jordan A $ j $ n \<noteq> 0) = j" proof (rule Least_equality) show "Gauss_Jordan A $ j $ j \<noteq> 0" by (metis Gauss_jj_1 zero_neq_one) show "\<And>y. Gauss_Jordan A $ j $ y \<noteq> 0 \<Longrightarrow> j \<le> y" by (metis le_cases id_k id_upt_k_def j_less_k less_trans not_less to_nat_mono) qed moreover have "\<not> is_zero_row_upt_k j k (Gauss_Jordan A)" by (metis (full_types) Gauss_jj_1 is_zero_row_upt_k_def j_less_k zero_neq_one) ultimately show ?thesis using rref_upt_condition4[OF rref_k] i_not_j by fastforce qed qed qed qed lemma invertible_implies_rref_id: fixes A::"'a::{field}^'n::{mod_type}^'n::{mod_type}" assumes inv_A: "invertible A" shows "Gauss_Jordan A = mat 1" using id_upt_k_Gauss_Jordan[OF inv_A, of "nrows (Gauss_Jordan A)"] using id_upt_nrows_mat_1 by fast lemma matrix_inv_Gauss: fixes A::"'a::{field}^'n::{mod_type}^'n::{mod_type}" assumes inv_A: "invertible A" and Gauss_eq: "Gauss_Jordan A = P ** A" shows "matrix_inv A = P" proof (unfold matrix_inv_def, rule some1_equality) show "\<exists>!A'. A ** A' = mat 1 \<and> A' ** A = mat 1" by (metis inv_A invertible_def matrix_inv_unique matrix_left_right_inverse) show "A ** P = mat 1 \<and> P ** A = mat 1" by (metis Gauss_eq inv_A invertible_implies_rref_id matrix_left_right_inverse) qed lemma matrix_inv_Gauss_Jordan_PA: fixes A::"'a::{field}^'n::{mod_type}^'n::{mod_type}" assumes inv_A: "invertible A" shows "matrix_inv A = fst (Gauss_Jordan_PA A)" by (metis Gauss_Jordan_PA_eq fst_Gauss_Jordan_PA inv_A matrix_inv_Gauss) lemma invertible_eq_full_rank[code_unfold]: fixes A::"'a::{field}^'n::{mod_type}^'n::{mod_type}" shows "invertible A = (rank A = nrows A)" by (metis full_rank_implies_invertible invertible_implies_full_rank) definition "inverse_matrix A = (if invertible A then Some (matrix_inv A) else None)" lemma the_inverse_matrix: fixes A::"'a::{field}^'n::{mod_type}^'n::{mod_type}" assumes "invertible A" shows "the (inverse_matrix A) = P_Gauss_Jordan A" by (metis P_Gauss_Jordan_def assms inverse_matrix_def matrix_inv_Gauss_Jordan_PA option.sel) lemma inverse_matrix: fixes A::"'a::{field}^'n::{mod_type}^'n::{mod_type}" shows "inverse_matrix A = (if invertible A then Some (P_Gauss_Jordan A) else None)" by (metis inverse_matrix_def option.sel the_inverse_matrix) lemma inverse_matrix_code[code_unfold]: fixes A::"'a::{field}^'n::{mod_type}^'n::{mod_type}" shows "inverse_matrix A = (let GJ = Gauss_Jordan_PA A; rank_A = (if A = 0 then 0 else to_nat (GREATEST a. row a (snd GJ) \<noteq> 0) + 1) in if nrows A = rank_A then Some (fst(GJ)) else None)" unfolding inverse_matrix unfolding invertible_eq_full_rank unfolding rank_Gauss_Jordan_code unfolding P_Gauss_Jordan_def unfolding Let_def Gauss_Jordan_PA_eq by presburger end
```python import scipy as sp import sympy import numpy as np import scipy as sp import sklearn as sk import matplotlib as mpl mpl.use('Agg') import matplotlib.pylab as plt from mpl_toolkits.mplot3d import Axes3D %matplotlib inline ``` /home/kang/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py:8: UserWarning: This call to matplotlib.use() has no effect because the backend has already been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot, or matplotlib.backends is imported for the first time. The backend was *originally* set to 'module://ipykernel.pylab.backend_inline' by the following code: File "/home/kang/anaconda3/lib/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/home/kang/anaconda3/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/kang/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py", line 16, in <module> app.launch_new_instance() File "/home/kang/anaconda3/lib/python3.6/site-packages/traitlets/config/application.py", line 657, in launch_instance app.initialize(argv) File "<decorator-gen-123>", line 2, in initialize File "/home/kang/anaconda3/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error return method(app, *args, **kwargs) File "/home/kang/anaconda3/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 462, in initialize self.init_gui_pylab() File "/home/kang/anaconda3/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 403, in init_gui_pylab InteractiveShellApp.init_gui_pylab(self) File "/home/kang/anaconda3/lib/python3.6/site-packages/IPython/core/shellapp.py", line 207, in init_gui_pylab r = enable(key) File "/home/kang/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2930, in enable_matplotlib pt.activate_matplotlib(backend) File "/home/kang/anaconda3/lib/python3.6/site-packages/IPython/core/pylabtools.py", line 307, in activate_matplotlib matplotlib.pyplot.switch_backend(backend) File "/home/kang/anaconda3/lib/python3.6/site-packages/matplotlib/pyplot.py", line 229, in switch_backend matplotlib.use(newbackend, warn=False, force=True) File "/home/kang/anaconda3/lib/python3.6/site-packages/matplotlib/__init__.py", line 1305, in use reload(sys.modules['matplotlib.backends']) File "/home/kang/anaconda3/lib/python3.6/importlib/__init__.py", line 166, in reload _bootstrap._exec(spec, module) File "/home/kang/anaconda3/lib/python3.6/site-packages/matplotlib/backends/__init__.py", line 14, in <module> line for line in traceback.format_stack() ```python def f2p(x) : return -400.0 * x[0] * (-x[0] ** 2 + x[1]) + 2*x[0] - 2 ``` ```python x ``` ```python result = sp.optimize.minimize(f2, (-2, -2), jac = f2p) print(result) ``` ```python x, y = sympy.symbols(' x y ') f2 = (1 - x) ** 2 + 100 * (y - x ** 2) ** 2 f2 ``` (-x + 1)**2 + 100*(-x**2 + y)**2 ```python sympy.diff(f2, x ) ``` -400*x*(-x**2 + y) + 2*x - 2 ```python f2 = ``` ```python def f2(x) : return (1 - x[0]) ** 2 + 100.0 * (x [1] - x [0] ** 2) ** 2 ``` ```python def f2p(x) : return -400 * x[0] * ( -x[0] ** 2 + x[1]) + 2 * x[0] - 2 ``` ```python def f2g(x): """gradient of f2(x)""" return np.array((2.0 * (x[0] - 1) - 400.0 * x[0] * (x[1] - x[0]**2), 200.0 * (x[1] - x[0]**2))) ``` ```python result = sp.optimize.minimize(f2, (3, 3), jac = f2g) print(result) x0 = result['x'] x0 ``` fun: 7.880245049711645e-20 hess_inv: array([[ 0.48216528, 0.9656648 ], [ 0.9656648 , 1.93889528]]) jac: array([ -1.11665241e-08, 5.53674884e-09]) message: 'Optimization terminated successfully.' nfev: 58 nit: 43 njev: 58 status: 0 success: True x: array([ 1., 1.]) array([ 1., 1.]) ```python def f1logs(x) : return np.log(x[0]) + np.log(x[1]) def eq_constraint(x) : return x[0] + x[1] - 1 sp.optimize.fmin_slsqp(f1logs, np.array([(1, 1)]) , eqcons = [eq_constraint]) ``` Optimization terminated successfully. (Exit mode 0) Current function value: -1.3862943611198901 Iterations: 2 Function evaluations: 8 Gradient evaluations: 2 array([ 0.5, 0.5]) ```python ``` ```python def f2(x) : return np.sqrt((x[0] - 3)) ```
import analysis.topology.continuity import analysis.topology.topological_space import analysis.topology.infinite_sum import analysis.topology.topological_structures import analysis.topology.uniform_space import Topology.Material.Sutherland_Chapter_8 import data.equiv.basic local attribute [instance] classical.prop_decidable universes u v w open set filter lattice classical -- Below is the definition of the subspace_topology -- I think we should actually use the subspace topology already in lean -- It is the one induced by the inclusion map, subspace.val -- It is called subtype.topological_space def subspace_topology {α : Type u} [X : topological_space α] (A : set α) : topological_space A := { is_open := λ I, ∃ U : set α, X.is_open U ∧ subtype.val '' I = U ∩ A, is_open_univ := begin existsi univ, split, exact X.is_open_univ, rw univ_inter, unfold set.image, simp, end, is_open_inter := begin intros s t Hs Ht, cases Hs with Us HUs, cases Ht with Ut HUt, let Ust := Us ∩ Ut, existsi Ust, split, exact X.is_open_inter Us Ut HUs.1 HUt.1, have H1 : Ust ∩ A = (Us ∩ A) ∩ (Ut ∩ A), rw inter_right_comm Us A (Ut ∩ A), simp [inter_assoc], rw H1, rw [← HUs.2, ← HUt.2], rw set.image_inter, exact subtype.val_injective, end, is_open_sUnion := begin intros I HI, let Uset := {U : set α | topological_space.is_open X U ∧ ∃ t ∈ I, subtype.val '' t = U ∩ A}, let Uunion := ⋃₀ Uset, existsi Uunion, split, have H1 : (∀ (t : set α), t ∈ Uset → is_open t), intros t Ht, exact Ht.1, exact is_open_sUnion H1, apply set.ext, intro x, split, swap, intro Hx, cases Hx with Hx1 Hx2, simp at Hx1, cases Hx1 with U HU, simp, existsi Hx2, cases HU with HU HxU, cases HU with HUopen HU, cases HU with t Ht, existsi t, apply and.intro Ht.1, rw ← preimage_image_eq t subtype.val_injective, show x ∈ subtype.val '' t, rw Ht.2, exact ⟨HxU,Hx2⟩, simp, intros Hx HxinU0I, cases HxinU0I with t Ht, split, swap, exact Hx, have Hnext := HI t Ht.1, cases Hnext with Unext HUnext, existsi Unext, split, apply and.intro HUnext.1, existsi t, exact ⟨Ht.1, HUnext.2⟩, have x_in_val_t : x ∈ subtype.val '' t, simp, existsi Hx, exact Ht.2, rw HUnext.2 at x_in_val_t, exact x_in_val_t.1, end, } --Proof of equivalence of definitions theorem subspace_top_eq_subtype_top {α : Type u} [X : topological_space α] (A : set α) : (subspace_topology A).is_open = (subtype.topological_space).is_open := begin dunfold subtype.topological_space, unfold topological_space.induced, simp, funext V, apply propext, split, intro HU, cases HU with U HU, existsi U, apply and.intro HU.1, have H0 : subtype.val ⁻¹' (subtype.val '' V) = subtype.val ⁻¹' (A ∩ U), rw HU.2, simp, apply inter_comm, have H1 : V = subtype.val ⁻¹' (A ∩ U), rw ← H0, rw preimage_image_eq, exact subtype.val_injective, rw H1, simp, have preimage_A_eq_univ : subtype.val ⁻¹' A = @univ (subtype A), apply set.ext, intro x, simp, exact x.2, rw preimage_A_eq_univ, apply univ_inter, intro HU, cases HU with U HU, existsi U, apply and.intro HU.1, have H0 : subtype.val '' V = subtype.val '' (subtype.val ⁻¹' U), by rw HU.2, rw H0, apply set.ext, intro x, simp, split, intro Hx, cases Hx with a Ha, rw ← Ha.2.2, apply and.intro Ha.2.1, exact Ha.1, intro Hx, existsi x, exact ⟨Hx.2, Hx.1, refl x⟩, end --Prop 10.4 theorem inclusion_cont_subtype_top {α : Type u} [X : topological_space α] (A : set α) : @continuous _ _ (subtype.topological_space) _ (λ (a : A), (a : α)) := begin unfold continuous, unfold is_open, intros s Hs, simp, unfold subtype.topological_space, unfold topological_space.induced, simp, existsi s, apply and.intro Hs, unfold coe, unfold lift_t, unfold has_lift_t.lift, unfold coe_t, unfold has_coe_t.coe, unfold coe_b, unfold has_coe.coe, end --Prop 10.4 but with subspace topology (I won't do any more with the subspace topology) theorem inclusion_cont_subspace_top {α : Type u} [X : topological_space α] (A : set α) : @continuous _ _ (subspace_topology A) _ (λ (a : A), (a : α)) := begin unfold continuous, unfold is_open, rw subspace_top_eq_subtype_top, exact inclusion_cont_subtype_top A, end --Corollary 10.5 theorem restriction_cont {α : Type u} [X : topological_space α] {β : Type v} [Y : topological_space β] (f : α → β) (H : continuous f) (A : set α) : continuous (λ (x : A), f x) := begin have H0 : (λ (x : A), f ↑x) = f ∘ (λ (a : A), (a : α)), by simp, rw H0, exact (continuous.comp (inclusion_cont_subtype_top A) H), end --Proposition 10.6 theorem inclusion_comp_cont_iff_cont {α : Type*} [X : topological_space α] {A : set α} {γ : Type*} [Z : topological_space γ] (g : γ → A) : continuous g ↔ continuous ((λ (a : A), (a : α)) ∘ g) := begin split, intro Hg, exact continuous.comp Hg (inclusion_cont_subtype_top A), simp, unfold continuous, unfold is_open, intro H_i_comp_g, intros V HV, unfold subtype.topological_space at HV, unfold topological_space.induced at HV, simp at HV, cases HV with U HU, have H1 := H_i_comp_g U HU.1, rw HU.2, exact H1, end --Proposition 10.8 theorem inclusion_comp_cont_iff_cont_to_subtype_top {α : Type u} [X : topological_space α] {A : set α} (Trandom : topological_space A) : (∀ {γ : Type u} [Z : topological_space γ] (g : γ → A), (@continuous γ ↥A Z _ g ↔ @continuous γ α Z _ ((λ (a : A), (a : α)) ∘ g))) ↔ Trandom.is_open = (subtype.topological_space).is_open := begin split, swap, { intros H _ _ _, rw ←(@inclusion_comp_cont_iff_cont _ _ _ _ Z g), unfold continuous, unfold is_open, rw H, }, intro H, apply set.ext, intro V, split, swap, have H1 := (@H (↥A) Trandom (@id A)).1 id_map_continuous, intro HV, unfold subtype.topological_space at HV, unfold topological_space.induced at HV, simp at HV, cases HV with U HU, have H2 : Trandom.is_open (subtype.val ⁻¹' U), simp at H1, unfold continuous at H1, exact H1 U HU.1, rw ← HU.2 at H2, assumption, have H1 := (@H (↥A) subtype.topological_space (@id A)).2, simp at H1, intro HV, have H2 := H1 _, unfold continuous at H2, exact H2 V HV, exact continuous_subtype_val, end --Product Topologies def product_top {α : Type*} {β : Type*} (X : topological_space α) (Y : topological_space β) : topological_space (α × β) := {is_open := λ (W : set (α × β)), ∃ (I ⊆ { b : set (α × β) | ∃ (U : set α) (V : set β), is_open U ∧ is_open V ∧ b = set.prod U V}), W = ⋃₀ I, is_open_univ := begin existsi {d : set (α × β) | d = set.prod univ univ}, have H : set.subset {d : set (α × β) | d = set.prod univ univ} {b : set (α × β) | ∃ (U : set α) (V : set β), is_open U ∧ is_open V ∧ b = set.prod U V}, rw univ_prod_univ, unfold set.subset, intros a Ha, rw mem_set_of_eq at Ha, rw Ha, existsi univ, existsi univ, apply and.intro is_open_univ, apply and.intro is_open_univ, rw univ_prod_univ, existsi H, rw univ_prod_univ, have H1 : {d : set (α × β) | d = univ} = {univ}, apply set.ext, intro x, rw mem_set_of_eq, rw mem_singleton_iff, rw H1, rw sUnion_singleton, end, is_open_inter := begin intros W1 W2 HW1 HW2, cases HW1 with I1 HI1, cases HI1 with HI1 HWI1, cases HW2 with I2 HI2, cases HI2 with HI2 HWI2, existsi {e : set (α × β) | ∃ (U ∈ I1) (V ∈ I2), e = U ∩ V}, have H : set.subset {e : set (α × β) | ∃ (U : set (α × β)) (H : U ∈ I1) (V : set (α × β)) (H : V ∈ I2), e = U ∩ V} {b : set (α × β) | ∃ (U : set α) (V : set β), is_open U ∧ is_open V ∧ b = set.prod U V}, unfold set.subset, simp, intros a w1 Hw1 w2 Hw2 Ha, rw Ha, have H1 := HI1 Hw1, rw mem_set_of_eq at H1, have H2 := HI2 Hw2, rw mem_set_of_eq at H2, rcases H1 with ⟨U1, V1, HU1, HV1, H1UV⟩, rcases H2 with ⟨U2, V2, HU2, HV2, H2UV⟩, existsi (U1 ∩ U2), apply and.intro (X.is_open_inter U1 U2 HU1 HU2), existsi (V1 ∩ V2), apply and.intro (Y.is_open_inter V1 V2 HV1 HV2), rw H1UV, rw H2UV, apply prod_inter_prod, existsi H, rw HWI1, rw HWI2, apply set.ext, intro x, rw mem_set_of_eq, unfold set.inter, rw mem_set_of_eq, unfold set.sUnion, rw mem_set_of_eq, rw mem_set_of_eq, split, intro Hx, rcases Hx with ⟨HU, V, HV1, HV2⟩, rcases HU with ⟨U, HU1, HU2⟩, existsi (U ∩ V), existsi _, exact ⟨HU2, HV2⟩, rw mem_set_of_eq, existsi [U, HU1, V, HV1], trivial, intro Hx, rcases Hx with ⟨a, Ha1, Ha2⟩, rw mem_set_of_eq at Ha1, rcases Ha1 with ⟨U, HU, V, HV, HUV⟩, rw HUV at Ha2, split, existsi [U, HU], exact Ha2.1, existsi [V, HV], exact Ha2.2, end, is_open_sUnion := begin intros I2 HI2, let Iset := {I | set.subset I {b : set (α × β) | ∃ (U : set α) (V : set β), is_open U ∧ is_open V ∧ b = set.prod U V} ∧ (∃ t ∈ I2, t = ⋃₀ I)}, existsi ⋃₀ Iset, existsi _, swap, intros x Hx, rw mem_set_of_eq at Hx, rcases Hx with ⟨a, Ha, Ha2⟩, rw mem_set_of_eq at Ha, exact Ha.1 Ha2, apply set.ext, intro s, simp, split, intro HW, rcases HW with ⟨W, HW, HW2⟩, have H := HI2 W HW, rcases H with ⟨IW, HIW, HIIW⟩, rw HIIW at HW2, rw mem_sUnion_eq at HW2, rcases HW2 with ⟨square, Hsquare, Hsquare_s⟩, existsi square, split, existsi IW, refine ⟨_, Hsquare⟩, rw HIIW at HW, refine ⟨_, HW⟩, have Hsame : {b : set (α × β) | ∃ (U : set α) (V : set β), is_open U ∧ is_open V ∧ b = set.prod U V} = {b : set (α × β) | ∃ (U : set α), is_open U ∧ ∃ (V : set β), is_open V ∧ b = set.prod U V}, apply set.ext, intro x, simp, rw ←Hsame, exact HIW, exact Hsquare_s, intro HW, cases HW with W HW, cases HW with HW HsW, cases HW with I HI, existsi ⋃₀ I, refine ⟨HI.1.2, _⟩, rw mem_sUnion_eq, existsi W, existsi HI.2, exact HsW, end } --Product Topology Basis definition product_top_basis {α : Type*} {β : Type*} (X : topological_space α) (Y : topological_space β) : set (set (α × β)) := { b : set (α × β) | ∃ (U : set α) (V : set β), is_open U ∧ is_open V ∧ b = set.prod U V} theorem is_basis_product_top_basis {α : Type*} {β : Type*} (X : topological_space α) (Y : topological_space β) : @topological_space.is_topological_basis _ (product_top X Y) (product_top_basis X Y) := begin unfold topological_space.is_topological_basis, split, intros t1 Ht1 t2 Ht2 x Hx, unfold product_top_basis at Ht1, rw mem_set_of_eq at Ht1, unfold product_top_basis at Ht2, rw mem_set_of_eq at Ht2, rcases Ht1 with ⟨U1, V1, Ht1⟩, rcases Ht2 with ⟨U2, V2, Ht2⟩, existsi (set.prod (U1 ∩ U2) (V1 ∩ V2)), refine ⟨_,_⟩, unfold product_top_basis, rw mem_set_of_eq, existsi [U1 ∩ U2, V1 ∩ V2], exact ⟨is_open_inter Ht1.1 Ht2.1, is_open_inter Ht1.2.1 Ht2.2.1, refl (set.prod (U1 ∩ U2) (V1 ∩ V2))⟩, rw mem_prod, cases Hx with Hx1 Hx2, rw Ht1.2.2 at Hx1, rw Ht2.2.2 at Hx2, rw mem_prod at Hx1, rw mem_prod at Hx2, refine ⟨⟨⟨Hx1.1,Hx2.1⟩,Hx1.2,Hx2.2⟩,_⟩, rw Ht1.2.2, rw Ht2.2.2, intros y Hy, rw mem_prod at Hy, split, exact ⟨Hy.1.1, Hy.2.1⟩, exact ⟨Hy.1.2, Hy.2.2⟩, split, apply eq_univ_of_univ_subset, apply subset_sUnion_of_mem, existsi [univ, univ], apply and.intro is_open_univ, apply and.intro is_open_univ, rw ← univ_prod_univ, unfold product_top, unfold topological_space.generate_from, apply topological_space_eq, apply set.ext, intro W, split, intro HW, rcases HW with ⟨open_rects_set, Hopen_rects_set, HW⟩, unfold product_top_basis, rw HW, exact topological_space.generate_open.sUnion open_rects_set (λ (s : set (α × β)) (H : s ∈ open_rects_set), topological_space.generate_open.basic s (Hopen_rects_set H)), apply topological_space.generate_open.rec, --THIS IS THE CORRECT PATH intros s Hs, unfold product_top_basis at Hs, rcases Hs with ⟨U, V, HU, HV, HW⟩, existsi {set.prod U V}, have H : {set.prod U V} ⊆ {b : set (α × β) | ∃ (U : set α) (V : set β), is_open U ∧ is_open V ∧ b = set.prod U V}, intros s Hs, rw mem_singleton_iff at Hs, rw Hs, existsi [U, V], exact ⟨HU, HV, refl (set.prod U V)⟩, existsi H, rw sUnion_singleton, exact HW, existsi {univ}, have H : {univ} ⊆ {b : set (α × β) | ∃ (U : set α) (V : set β), is_open U ∧ is_open V ∧ b = set.prod U V}, intros UNI HUNI, existsi [univ, univ], rw mem_singleton_iff at HUNI, rw HUNI, apply and.intro is_open_univ, apply and.intro is_open_univ, exact eq.symm univ_prod_univ, existsi H, rw sUnion_singleton, intros s t Hs1 Ht1 Hs Ht, rcases Hs with ⟨Is, HIs, HsUnionIs⟩, rcases Ht with ⟨It, HIt, HsUnionIt⟩, apply is_open_inter, existsi [Is, HIs], assumption, existsi [It, HIt], assumption, intros I HI_gen_prod_top_bas HI_open_sets, -- WHat set do I need? The set that contains all open rectangles appearing in any element of I existsi { b : set (α × β) | (∃ (U : set α) (V : set β), is_open U ∧ is_open V ∧ b = set.prod U V) ∧ ∃ s ∈ I, b ⊆ s}, existsi _, swap, intros x Hx, rw mem_set_of_eq, rw mem_set_of_eq at Hx, cases Hx with Hx1 Hx2, exact Hx1, apply eq_of_subset_of_subset, intros x Hx, rw mem_sUnion_eq at Hx, rcases Hx with ⟨t, Ht, Hxt⟩, -- Need to existsi the open rectangle that x is in have H := HI_open_sets t Ht, cases H with It HIt, cases HIt with HIt HIt2, rw HIt2 at Hxt, rcases Hxt with ⟨rect,rectIt,xrect⟩, existsi rect, refine ⟨⟨HIt rectIt,_⟩, _⟩, existsi [t, Ht], rw HIt2, apply subset_sUnion_of_mem rectIt, exact xrect, apply sUnion_subset, intros t Ht, cases Ht, rcases Ht_right, cases Ht_right_h, apply subset.trans Ht_right_h_h (subset_sUnion_of_mem Ht_right_h_w), end --Proof that our definition of product top is equivalent to the instance built into mathlib. theorem product_top_eq_induced_prod_top {α : Type*} {β : Type*} (X : topological_space α) (Y : topological_space β) : product_top X Y = topological_space.induced prod.fst X ⊔ topological_space.induced prod.snd Y := begin apply topological_space_eq, unfold product_top, unfold lattice.has_sup.sup, unfold semilattice_sup.sup, unfold semilattice_sup_bot.sup, unfold bounded_lattice.sup, unfold complete_lattice.sup, unfold Inf, unfold has_Inf.Inf, simp only [exists_prop, mem_set_of_eq, not_and, and_imp], apply set.ext, intro U, split, intro HU, rcases HU with ⟨I_U,HI_U,HI_U2⟩, intros T HXT HYT, unfold has_le.le at HXT, unfold preorder.le at HXT, unfold partial_order.le at HXT, unfold has_le.le at HXT, unfold preorder.le at HXT, unfold has_le.le at HXT, unfold preorder.le at HXT, unfold partial_order.le at HXT, unfold order_bot.le at HXT, unfold bounded_lattice.le at HXT, unfold complete_lattice.le at HXT, unfold bounded_lattice.le at HXT, --THe following should be each prod U1 univ, prod univ V1 for all rectangles prod U1 V1 --in U. Then intersect each pair and union them. rw HI_U2, apply is_open_sUnion, intros rect Hrect, --Split rect into the intersection of prod U1 univ and prod univ V1 have Hrect2 := HI_U Hrect, rcases Hrect2 with ⟨Urect,Vrect,HUrect,HVrect,HUrectVrect⟩, have HUrectuniv : topological_space.is_open T (set.prod Urect univ), apply HXT, existsi Urect, split, exact HUrect, unfold preimage, apply set.ext, intro x, rw mem_set_of_eq, rw mem_prod, rw and_iff_left, exact mem_univ _, have HunivVrect : topological_space.is_open T (set.prod univ Vrect), apply HYT, existsi Vrect, split, exact HVrect, unfold preimage, apply set.ext, intro x, rw mem_set_of_eq, rw mem_prod, rw and_iff_right, exact mem_univ _, have H_open_rect := T.is_open_inter _ _ HUrectuniv HunivVrect, have Hrect_prod : set.prod Urect univ ∩ set.prod univ Vrect = rect, rw prod_inter_prod, rw inter_univ, rw univ_inter, rw HUrectVrect, rw Hrect_prod at H_open_rect, exact H_open_rect, intro HU, have H := HU (product_top X Y), have HX : topological_space.induced prod.fst X ≤ product_top X Y, intros V HV, unfold topological_space.induced at HV, cases HV with S HS, cases HS with HS HV, unfold preimage at HV, rw HV, existsi {set.prod S univ}, existsi _, rw sUnion_singleton, apply set.ext, intro x, rw mem_set_of_eq,rw mem_prod, rw and_iff_left, exact mem_univ _, intros x Hx, existsi S, existsi univ, exact ⟨HS, is_open_univ, mem_singleton_iff.1 Hx⟩, have HY : topological_space.induced prod.snd Y ≤ product_top X Y, intros V HV, cases HV with S HS, cases HS with HS HV, unfold preimage at HV, rw HV, existsi {set.prod univ S}, existsi _, rw sUnion_singleton, apply set.ext, intro x, rw mem_set_of_eq, rw mem_prod, rw and_iff_right, exact mem_univ _, intros x Hx, existsi univ, existsi S, exact ⟨is_open_univ, HS, mem_singleton_iff.1 Hx⟩, have H1 := H HX HY, unfold product_top at H1, simp only [exists_prop, mem_set_of_eq, not_and, and_imp] at H1, exact H1, end #print prefix set --Proposition 10.10 theorem left_proj_cont {α : Type*} {β : Type*} (X : topological_space α) (Y : topological_space β) : @continuous (α × β) α (product_top X Y) X (λ p, p.1) := begin unfold continuous, unfold is_open, intros s Hs, unfold product_top, existsi {set.prod s (univ : set β)}, split, intros pre Hpre, rw mem_singleton_iff at Hpre, rw Hpre, rw mem_set_of_eq, existsi [s, univ], exact ⟨Hs, Y.is_open_univ, rfl⟩, apply set.ext, intro x, rw mem_preimage_eq, rw sUnion_singleton, rw mem_prod, rw and_iff_left, exact mem_univ x.snd, end theorem right_proj_cont {α : Type*} {β : Type*} (X : topological_space α) (Y : topological_space β) : @continuous (α × β) β (product_top X Y) Y (λ p, p.2) := begin unfold continuous, unfold is_open, intros s Hs, unfold product_top, existsi {set.prod (univ : set α) s}, split, intros pre Hpre, rw @mem_singleton_iff at Hpre, rw Hpre, rw mem_set_of_eq, existsi [univ, s], exact ⟨X.is_open_univ, Hs, rfl⟩, apply set.ext, intro x, rw mem_preimage_eq, rw sUnion_singleton, rw mem_prod, rw and_iff_right, exact mem_univ x.fst, end --set_option pp.implicit true set_option trace.simplify.rewrite true theorem cont_iff_proj_cont {α : Type*} {β : Type*} {γ : Type*} (X : topological_space α) (Y : topological_space β) (Z : topological_space γ) (f : γ → (α × β)) : @continuous _ _ Z (product_top X Y) f ↔ (continuous ((λ (p : α × β), p.2) ∘ f) ∧ continuous ((λ (p : α × β), p.1) ∘ f)) := begin split, intro Hf, split, exact @continuous.comp _ _ _ _ (product_top X Y) _ _ _ Hf (right_proj_cont X Y), exact @continuous.comp _ _ _ _ (product_top X Y) _ _ _ Hf (left_proj_cont X Y), intro Hf, apply continuous_basis_to_continuous, apply is_basis_product_top_basis, intro b, unfold product_top_basis at b, rename b b1, rcases b.property with ⟨U, V, HU, HV,HB⟩, cases Hf with Hfsnd Hffst, have Hsnd := Hfsnd V HV, have Hfst := Hffst U HU, have H1 := is_open_inter Hfst Hsnd, have EQ : (λ (p : α × β), p.fst) ∘ f ⁻¹' U ∩ (λ (p : α × β), p.snd) ∘ f ⁻¹' V = (f ⁻¹' ↑b), rw preimage_comp, rw @preimage_comp _ _ _ f (λ (p : α × β), p.snd) _, rw ← preimage_inter, have H2 : prod.fst ⁻¹' U = set.prod U univ, apply set.ext, intro x, split, intro Hx, rw mem_preimage_eq at Hx, split, exact Hx, exact @mem_univ β x.snd, intro Hx, rw mem_preimage_eq, exact Hx.1, rw H2, have H3 : prod.snd ⁻¹' V = set.prod univ V, apply set.ext, intro x, split, intro Hx, rw mem_preimage_eq at Hx, split, exact @mem_univ α x.fst, exact Hx, intro Hx, rw mem_preimage_eq, exact Hx.2, rw H3, rw prod_inter_prod, rw inter_univ, rw univ_inter, rw ← HB, have H4 : b.val = ↑b, trivial, rw H4, rw ← EQ, exact H1, end
[STATEMENT] lemma UINF_mem_true [simp]: "A \<noteq> {} \<Longrightarrow> (\<Sqinter> i\<in>A \<bullet> true) = true" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<not> A = {} \<Longrightarrow> (\<Sqinter> i \<in> A \<bullet> true) = true [PROOF STEP] by (pred_auto)
(* A proof of Karp's theorem about probabilistic recurrence relations *) From discprob.basic Require Import base order nify. From discprob.prob Require Import prob countable finite stochastic_order. From discprob.rec Require Export rec_convert. From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq div choice fintype. From mathcomp Require Import tuple finfun bigop prime binomial finset. Require Import Reals Fourier FunctionalExtensionality. Require Import Psatz. Require Import Coq.omega.Omega. Require Import Ranalysis5. Global Set Bullet Behavior "Strict Subproofs". Notation "x ≤ y" := (le x y) (at level 70, no associativity) : nat_scope. Notation "x ≥ y" := (ge x y) (at level 70, no associativity) : nat_scope. Notation "x ≤ y" := (Rle x y) (at level 70, no associativity). Notation "x ≥ y" := (Rge x y) (at level 70, no associativity). Definition Rceil x := match (frac_part x) == R0 with | true => Int_part x | false => (Int_part x + 1)%Z end. Lemma Int_part_minus x x': (Int_part (x - x') <= Int_part x - Int_part x')%Z. Proof. assert (frac_part x ≥ frac_part x' ∨ frac_part x < frac_part x') as [Hge|Hlt]. { destruct (total_order_T (frac_part x) (frac_part x')) as [[Hlt|Heq]|Hgt]; auto. - rewrite Heq. left. right. auto. - left. left. auto. } rewrite Rminus_Int_part1; eauto. omega. rewrite Rminus_Int_part2; eauto. omega. Qed. Lemma Int_part_pos x: 0 ≤ x → (0 <= Int_part x)%Z. Proof. rewrite /Int_part => Hpos. apply le_IZR. rewrite minus_IZR. replace (IZR 1) with 1 by auto. replace (IZR 0) with 0 by auto. case (Rge_dec x 1). - edestruct (archimed x). intros. nra. - edestruct (archimed x). intros. assert (up x = (0 + 1)%Z) as ->. { symmetry. apply up_tech; eauto. rewrite //=. nra. } rewrite //=. nra. Qed. Lemma Int_part_mono x x': x ≤ x' → (Int_part x <= Int_part x')%Z. Proof. intros. cut (0 <= Int_part x' - Int_part x)%Z; first by omega. etransitivity; last eapply Int_part_minus. apply Int_part_pos; fourier. Qed. Lemma up_mono x x': x ≤ x' → (up x <= up x')%Z. Proof. intros Hint%Int_part_mono. rewrite /Int_part in Hint. omega. Qed. Lemma Int_frac_decompose x: x = IZR (Int_part x) + frac_part x. Proof. rewrite /frac_part/Int_part minus_IZR. ring. Qed. Lemma Rceil_mono x x': x ≤ x' → (Rceil x <= Rceil x')%Z. Proof. rewrite /Rceil. case: ifP. - case: ifP; intros ?? ?%Int_part_mono; omega. - case: ifP. * move /eqP => Heq0. move /eqP => Hneq0. intros Hle. cut (Int_part x < Int_part x')%Z; first by omega. specialize (Int_frac_decompose x) => Hde. specialize (Int_frac_decompose x') => Hde'. rewrite Hde Hde' in Hle. rewrite Heq0 in Hle. assert (frac_part x > 0). { edestruct (base_fp x). inversion H; auto. nra. } intros. apply lt_IZR. fourier. * intros ?? ?%Int_part_mono; omega. Qed. Definition Rmono (f: R → R): Prop := ∀ x x', x ≤ x' → f x ≤ f x'. Definition Rantimono (f: R → R): Prop := ∀ x x', x ≤ x' → f x ≥ f x'. Definition Rmono_P P (f: R → R): Prop := ∀ x x', P x → P x' → x ≤ x' → f x ≤ f x'. Definition Rantimono_P P (f: R → R): Prop := ∀ x x', P x → P x' → x ≤ x' → f x ≥ f x'. Lemma Int_part_IZR z: Int_part (IZR z) = z. Proof. rewrite /Int_part -(up_tech (IZR z) z) //=; try reflexivity; try fourier; try omega. apply IZR_lt; omega. Qed. Lemma Rceil_IZR z: Rceil (IZR z) = z. Proof. rewrite /Rceil. case: ifP. - rewrite Int_part_IZR //. - move /eqP => Hnonz. contradiction (Hnonz). generalize (Int_frac_decompose (IZR z)). rewrite Int_part_IZR. intros Heq%(Rplus_eq_compat_l (- (IZR z))). by rewrite -Rplus_assoc ?Rplus_opp_l Rplus_0_l in Heq. Qed. Lemma Rceil_interval_decompose (f: Z → R → R) (g: R → R): (∀ k, Rmono (f k)) → (∀ k x, g x = IZR k → f k x = f (k + 1)%Z x) → Rantimono g → continuity g → Rmono (λ z, f (Rceil (g z)) z). Proof. intros Hfmono Hboundary Hganti Hcontinuity. rewrite /Rmono => x x' Hle. assert (∃ k, Rceil (g x) - Rceil (g x') = Z_of_nat k)%Z as (k&Heqk). { apply Hganti, Rge_le, Rceil_mono in Hle. eapply Z_of_nat_complete. omega. } revert x x' Hle Heqk. induction k; (* [|induction k]; *) intros x x'. - rewrite //= => Hle Heq0. assert (Rceil (g x) = Rceil (g x')) as <- by omega. apply (Hfmono (Rceil (g x))); auto. - intros. rewrite Nat2Z.inj_succ in Heqk. cut (∃ y, x ≤ y ∧ y ≤ x' ∧ (g y) = IZR (Rceil (g x) - 1))%Z. { intros (y&?&?&Hedge). apply Hganti, Rge_le, Rceil_mono in Hle. generalize (f_equal Rceil Hedge) => Hedge'. rewrite Rceil_IZR in Hedge'. transitivity (f (Rceil (g y)) y). * rewrite (Hboundary _ y) Hedge' //. rewrite Zplus_comm Zplus_minus. apply Hfmono; auto. * eapply IHk; eauto. omega. } inversion Hle as [Hlt|Heq]; last first. { rewrite Heq in Heqk. rewrite -Zminus_diag_reverse in Heqk. exfalso. specialize (Zle_0_nat k). rewrite Heqk. omega. } destruct (f_interv_is_interv (λ z, - g z) x x' (- IZR (Rceil (g x) - 1))) as (y&(?&?)&Hneg); eauto. * split; apply Ropp_ge_le_contravar. ** rewrite {1}(Int_frac_decompose (g x)). rewrite /Rceil. case: ifP. *** move /eqP => ->. rewrite minus_IZR. replace (IZR 1) with 1 by (rewrite /IZR //=). fourier. *** move /eqP. destruct (base_fp (g x)) as (?&?). rewrite minus_IZR. rewrite plus_IZR. intros. fourier. ** transitivity (IZR (Rceil (g x'))); first (apply IZR_ge; omega). rewrite {2}(Int_frac_decompose (g x')). rewrite /Rceil. case: ifP. *** move /eqP => ->. fourier. *** move /eqP. destruct (base_fp (g x')) as (?&?). rewrite plus_IZR. replace (IZR 1) with 1 by (rewrite /IZR //=). intros. fourier. * intros. apply continuity_opp; auto. * exists y. repeat split; auto. rewrite -(Ropp_involutive (g y)). rewrite -(Ropp_involutive (IZR _)). by apply Ropp_eq_compat. Qed. Definition convex (P: R → Prop) := ∀ x y, P x → P y → ∀ z, x ≤ z → z ≤ y → P z. Lemma Rceil_interval_decompose_P P (f: Z → R → R) (g: R → R): convex P → (∀ k, (∃ x, P x ∧ Rceil (g x) = k) → Rmono_P P (f k)) → (∀ k x, P x → g x = IZR k → f k x ≥ f (k + 1)%Z x) → Rantimono_P P g → (∀ x, P x → continuity_pt g x) → Rmono_P P (λ z, f (Rceil (g z)) z). Proof. intros Hconvex Hfmono Hboundary Hganti Hcontinuity. rewrite /Rmono => x x' HP HP' Hle. assert (∃ k, Rceil (g x) - Rceil (g x') = Z_of_nat k)%Z as (k&Heqk). { apply Hganti, Rge_le, Rceil_mono in Hle; eauto. eapply Z_of_nat_complete. omega. } revert x x' HP HP' Hle Heqk. induction k; (* [|induction k]; *) intros x x' HP HP'. - rewrite //= => Hle Heq0. assert (Rceil (g x) = Rceil (g x')) as <- by omega. apply (Hfmono (Rceil (g x))); auto. exists x; eauto. - intros. rewrite Nat2Z.inj_succ in Heqk. cut (∃ y, x ≤ y ∧ y ≤ x' ∧ (g y) = IZR (Rceil (g x) - 1))%Z. { intros (y&?&?&Hedge). apply Hganti, Rge_le, Rceil_mono in Hle; eauto. generalize (f_equal Rceil Hedge) => Hedge'. rewrite Rceil_IZR in Hedge'. transitivity (f (Rceil (g y)) y). * transitivity (f (Rceil (g x)) y); first eapply Hfmono; eauto. rewrite Hedge' //. apply Rge_le. replace (Rceil (g x)) with ((Rceil (g x) - 1) + 1)%Z at 2 by omega. apply Hboundary; eauto. * eapply IHk; eauto. omega. } inversion Hle as [Hlt|Heq]; last first. { rewrite Heq in Heqk. rewrite -Zminus_diag_reverse in Heqk. exfalso. specialize (Zle_0_nat k). rewrite Heqk. omega. } destruct (f_interv_is_interv (λ z, - g z) x x' (- IZR (Rceil (g x) - 1))) as (y&(?&?)&Hneg); eauto. * split; apply Ropp_ge_le_contravar. ** rewrite {1}(Int_frac_decompose (g x)). rewrite /Rceil. case: ifP. *** move /eqP => ->. rewrite minus_IZR. replace (IZR 1) with 1 by (rewrite /IZR //=). fourier. *** move /eqP. destruct (base_fp (g x)) as (?&?). rewrite minus_IZR. rewrite plus_IZR. intros. fourier. ** transitivity (IZR (Rceil (g x'))); first (apply IZR_ge; omega). rewrite {2}(Int_frac_decompose (g x')). rewrite /Rceil. case: ifP. *** move /eqP => ->. fourier. *** move /eqP. destruct (base_fp (g x')) as (?&?). rewrite plus_IZR. replace (IZR 1) with 1 by (rewrite /IZR //=). intros. fourier. * intros ? (?&?). apply continuity_pt_opp. eapply Hcontinuity, (Hconvex x x'); eauto; fourier. * exists y. repeat split; auto. rewrite -(Ropp_involutive (g y)). rewrite -(Ropp_involutive (IZR _)). by apply Ropp_eq_compat. Qed. Section rec_var. Variable X: eqType. Variable B : X → finType. Variable Ω : ∀ x, distrib (B x). Variable h: ∀ x: X, rvar (Ω x) X. Fixpoint recN_space (x: X) (n: nat) : finType := match n with | O => [finType of unit] | S n' => [finType of {i : B x & (recN_space ((h x) i) n')}] end. Fixpoint recN_pmf (a: X) (n: nat) : recN_space a n → R. Proof. induction n as [| n']. - intros _. exact 1. - intros (i&?). exact ((rvar_dist (h a)) i * (recN_pmf ((h a) i) n' s)). Defined. Lemma recN_0 a n x: recN_pmf a n x ≥ 0. Proof. revert a x. induction n as [| n'] => //=. - intros; fourier. - intros ? (i&s) => //=. apply Rle_ge, Rmult_le_pos; eauto using Rge_le, pmf_pos. Qed. Lemma in_tagged (I: eqType) a (T_i: I → finType) X' (i: {x : I & T_i x}): i \in [seq @Tagged I a (λ x0 : I, T_i x0) x | x <- X'] → projT1 i = a. Proof. induction X' => //=. rewrite in_cons. case: eqP => // -> //=. Qed. Lemma recN_1_aux a n: \big[Rplus/0]_(x in (recN_space a n)) ((recN_pmf a n) x) = 1%R. Proof. revert a. induction n as [| n'] => //=. - intros ?. by rewrite /index_enum {1}[@Finite.enum]unlock big_seq1. - intros a. rewrite /index_enum {1}[@Finite.enum]unlock //=. rewrite /tag_enum. rewrite big_flatten //=. transitivity (\big[Rplus/0]_(i <- Finite.enum (B a)) (rvar_dist (h a)) i). + induction (Finite.enum (B a)). rewrite //=. rewrite ?big_nil //=. rewrite ?big_cons //=. f_equal; eauto. rewrite big_seq_cond. rewrite //=. etransitivity; first eapply (eq_bigr (λ (i: {x: B a & recN_space ((h a) x) n'}), (rvar_dist (h a) a0 * (let (x, s) := i in recN_pmf ((h a) x) n' s)))). * intros i. move /andP. intros (Hin&_). move: (in_tagged _ _ _ _ _ Hin). destruct i as (i'&s). clear. rewrite //=. intros ->. done. * rewrite -big_seq_cond -big_distrr //=. rewrite -[a in _ = a]Rmult_1_r; f_equal. specialize (IHn' ((h a) a0)). rewrite -IHn'. rewrite big_map //=. + rewrite -SeriesC_fin_big. apply is_series_unique. eapply pmf_sum1. Qed. Lemma recN_1 a n: is_series (countable_sum (recN_pmf a n)) 1. Proof. rewrite -(recN_1_aux a n) -SeriesF_big_op. apply SeriesF_is_seriesC. Qed. Definition recN_dist a n : distrib (recN_space a n) := @mkDistrib _ (recN_pmf a n) (recN_0 a n) (recN_1 a n). Fixpoint recN_fun a n : recN_space a n → X. Proof. induction n as [| n']. - intro. exact a. - intros (x&s). exact (recN_fun ((h a) x) n' s). Defined. Definition recN_rvar a n := mkRvar (recN_dist a n) (recN_fun a n). Fixpoint pr_rec a n v := match n with | 0 => if (a == v) then 1 else 0 | S n => \big[Rplus/0]_(a' : imgT (h a)) (pr_eq (h a) (sval a') * pr_rec (sval a') n v) end. Lemma recN_pr_base v v': pr_eq (recN_rvar v' 0) v = (if v' == v then 1 else 0). Proof. rewrite /pr_eq/pr//=. rewrite SeriesC_fin_big. rewrite ?/index_enum {1}[@Finite.enum]unlock //=. case: ifP; move /eqP => Heq; rewrite big_cons big_nil //=; nra. Qed. Lemma recN_pr_comp_base {C: eqType} (f: X → C) (v: C) (v': X): pr_eq (rvar_comp (recN_rvar v' 0) f) v = (if f v' == v then 1 else 0). Proof. rewrite /pr_eq/pr//=. rewrite SeriesC_fin_big ?/index_enum {1}[@Finite.enum]unlock //=. case: ifP; move /eqP => Heq; rewrite big_cons big_nil //=; nra. Qed. Lemma nested_sum_recN_space x n F: \big[Rplus/0]_(i in B x) (\big[Rplus/0]_(b in recN_space ((h x) i) n) F i b) = \big[Rplus/0]_(ib in pred_of_argType {i : B x & recN_space ((h x) i) n}) let (i, b) := ib in F i b. Proof. - symmetry. rewrite ?/index_enum {1}[@Finite.enum]unlock //=. rewrite /tag_enum. rewrite big_flatten //=. induction (Finite.enum (B x)). * rewrite //= ?big_nil //. * rewrite ?big_cons_Rplus //=. f_equal; auto. clear. induction (Finite.enum (recN_space ((h x) a) n)). ** rewrite //= ?big_nil //. ** rewrite //= ?big_cons_Rplus //=. f_equal; auto. Qed. (* TODO: refactor using above lemma *) Lemma recN_pr_unfold a n v: pr_eq (recN_rvar a (S n)) v = \big[Rplus/0]_(a' : imgT (h a)) (pr_eq (h a) (sval a') * pr_eq (recN_rvar (sval a') n) v). Proof. transitivity (Ex (rvar_comp (h a) (fun a' => pr_eq (recN_rvar a' n) v))). - rewrite Ex_fin_pt. rewrite /pr_eq/pr //= SeriesC_fin_big. rewrite ?/index_enum {1}[@Finite.enum]unlock //=. rewrite /tag_enum. rewrite big_flatten //=. induction (Finite.enum (B a)). * rewrite //= ?big_nil //. * rewrite 2!big_cons_Rplus //=. f_equal; auto. rewrite ?SeriesC_fin_big. rewrite ?/index_enum. induction (Finite.enum (recN_space ((h a) a0) n)). ** by rewrite //= ?big_nil Rmult_0_l. ** rewrite //= ?big_cons_Rplus //=. rewrite Rmult_plus_distr_r. f_equal; auto. rewrite Rmult_if_distrib Rmult_0_l Rmult_comm. apply if_case_match. rewrite ?in_set //=. - rewrite Ex_fin_comp. done. Qed. Lemma recN_pr_unfold_comp (f: X → R) a n v: pr_eq (rvar_comp (recN_rvar a (S n)) f) v = \big[Rplus/0]_(a' : imgT (h a)) (pr_eq (h a) (sval a') * pr_eq (rvar_comp (recN_rvar (sval a') n) f) v). Proof. transitivity (Ex (rvar_comp (h a) (fun a' => pr_eq (rvar_comp (recN_rvar a' n) f) v))). - rewrite Ex_fin_pt. rewrite /pr_eq/pr //= ?SeriesC_fin_big. rewrite ?/index_enum {1}[@Finite.enum]unlock //=. rewrite /tag_enum. rewrite big_flatten //=. induction (Finite.enum (B a)). * rewrite //= ?big_nil //. * rewrite 2!big_cons_Rplus //=. f_equal; auto. rewrite ?SeriesC_fin_big. rewrite ?/index_enum. induction (Finite.enum (recN_space ((h a) a0) n)). ** by rewrite //= ?big_nil Rmult_0_l. ** rewrite //= ?big_cons_Rplus //=. rewrite Rmult_plus_distr_r. f_equal; auto. rewrite Rmult_if_distrib Rmult_0_l Rmult_comm. apply if_case_match. rewrite ?in_set //=. - rewrite Ex_fin_comp. apply eq_bigr => ?. rewrite Rmult_comm //. Qed. Lemma recN_pr_pr_rec a n v: pr_eq (recN_rvar a n) v = pr_rec a n v. Proof. revert a v. induction n => a v //=. - eapply recN_pr_base. - rewrite recN_pr_unfold. apply eq_bigr => ??. rewrite IHn //=. Qed. Lemma recN_pr_gt f n z v: pr_gt (rvar_comp (recN_rvar z (S n)) f) v = \big[Rplus/0]_(i : (imgT (h z))) (pr_eq (h z) (sval i) * pr_gt (rvar_comp (recN_rvar (sval i) n) f) v). Proof. rewrite /pr_gt pr_gt_alt3. etransitivity. { apply eq_bigr. intros ??. rewrite recN_pr_unfold_comp //. } rewrite exchange_big. apply eq_bigr => x' _. rewrite -big_distrr. eapply Rmult_eq_0_inv_r => Hneq. rewrite pr_gt_alt3. symmetry. rewrite !big_filter //=. rewrite [@Finite.enum]unlock //=. rewrite (img_fin_big' _ (λ i, (pr_eq (rvar_comp _ _) i)) (λ x, Rgt_dec x v)). rewrite (img_fin_big' _ (λ i, (pr_eq (rvar_comp _ _) i)) (λ x, Rgt_dec x v)). eapply sum_reidx_map with (h0 := λ x, x); auto. - intros a Hin' ->; split; auto. apply img_alt'. destruct x' as (x&Hin). rewrite //= in Hneq. rewrite //= in Hin'. apply img_alt in Hin as (x0&?). apply img_alt' in Hin' as (x1&?). subst; exists (existT (x0) x1). done. - intros b Hin' Hgt Hfalse. assert (∀ x, 0 ≤ x → (x > 0 → False) → x = 0) as Hcases. { inversion 1. intros Hbad. exfalso. apply Hbad. fourier. done. } apply Hcases. * apply Rge_le; first apply ge_pr_0. * intros Hin''%pr_img. apply Hfalse. exists b. split; auto. apply img_alt'. apply img_alt. auto. - rewrite /img. apply undup_uniq. - rewrite /img. apply undup_uniq. Qed. Lemma recN_pr_unfold' a n v: pr_eq (recN_rvar a (S n)) v = \big[Rplus/0]_(a' : imgT (recN_rvar a n)) (pr_eq (h (sval a')) v * pr_eq (recN_rvar a n) (sval a')). Proof. revert a v. induction n => a v. - rewrite recN_pr_pr_rec //=. symmetry. etransitivity. eapply eq_bigr. intros; rewrite (recN_pr_base _ a). done. rewrite ?recN_pr_unfold. rewrite //= /enum_mem/index_enum {1}[@Finite.enum]unlock //=. rewrite (img_fin_big' _ (λ i, pr_eq (h i) v * (if a == i then 1 else 0)) (λ x, true)) //=. rewrite //= /enum_mem/index_enum {1}[@Finite.enum]unlock //=. rewrite big_seq1. rewrite eq_refl Rmult_1_r. symmetry; etransitivity; first eapply eq_bigr. { intros. rewrite Rmult_comm Rmult_if_distrib Rmult_0_l Rmult_1_l //. } rewrite -big_mkcondr. rewrite /pr_eq. destruct (ge_pr_0 (rvar_dist (h a)) (λ a0 : B a, (h a) a0 == v)) as [Hlt|Heq0]. * apply pr_img in Hlt => //=. rewrite //= /enum_mem/index_enum {1}[@Finite.enum]unlock //=. rewrite -(big_map sval (λ i, i == v) (λ i, pr (rvar_dist (h a)) (λ a0 : B a, (h a) a0 == i))). rewrite img_fin_enum_sval. rewrite -big_filter. rewrite filter_pred1_uniq; auto. ** rewrite /rvar_dist //= big_cons big_nil //=; field. ** apply undup_uniq. ** apply img_alt'. apply img_alt. auto. * rewrite Heq0. rewrite big_seq_cond. apply big1 => i. rewrite //=. move /andP => [Hin Heq']. move /eqP in Heq'. subst. auto. - rewrite recN_pr_unfold. etransitivity. { eapply eq_bigr. intros. rewrite IHn. reflexivity. } rewrite //=. symmetry. etransitivity. { intros. eapply eq_bigr. intros. rewrite recN_pr_unfold. reflexivity. } rewrite //=. etransitivity. { eapply eq_bigr. intros. rewrite big_distrr. reflexivity. } rewrite //=. rewrite exchange_big. rewrite //=. eapply eq_bigr. intros i _. rewrite big_distrr //=. symmetry. rewrite /index_enum. rewrite [@Finite.enum]unlock //=. rewrite (img_fin_big' _ (λ x, (pr_eq (h a) (sval i) * (pr_eq (h x) v * pr_eq (recN_rvar (sval i) n) x))) (λ x, true)). rewrite (img_fin_big' _ (λ x, (pr_eq (h x) v * (pr_eq (h a) (sval i) * pr_eq (recN_rvar (sval i) n) x))) (λ x, true)). destruct i as (i&Hin). destruct (proj1 (img_alt _ _) Hin) as (x&Heq). eapply sum_reidx_map with (h0 := λ x, x). * intros; field. * intros a' (s&Heq')%img_alt' _. split; auto. apply img_alt'. subst. exists (existT (x) s). done. * intros b Hin' Hgt Hfalse. rewrite /pr. destruct (ge_pr_0 (rvar_dist (recN_rvar i n)) (λ x, (recN_rvar i n) x == b)) as [Hlt|Heq']. ** contradiction Hfalse. apply Rlt_gt, pr_img in Hlt. exists b. repeat split; auto. apply img_alt', img_alt. done. ** rewrite /pr_eq. rewrite ?Heq'. field. * rewrite /img. apply undup_uniq. * rewrite /img. apply undup_uniq. * intros ??. trivial. Qed. Lemma recN_pr_unfold_comp' (f: X → R) a n v: pr_eq (rvar_comp (recN_rvar a (S n)) f) v = \big[Rplus/0]_(a' : imgT (recN_rvar a n)) (pr_eq (rvar_comp (h (sval a')) f) v * pr_eq (recN_rvar a n) (sval a')). Proof. revert a v. induction n => a v. - rewrite recN_pr_unfold_comp //=. symmetry. etransitivity. eapply eq_bigr. intros; rewrite (recN_pr_base _ a). done. rewrite ?recN_pr_unfold_comp. rewrite //= /enum_mem/index_enum {1}[@Finite.enum]unlock //=. rewrite (img_fin_big' _ (λ i, pr_eq (rvar_comp (h i) f) v * (if a == i then 1 else 0)) (λ x, true)) //=. rewrite //= /enum_mem/index_enum {1}[@Finite.enum]unlock //=. rewrite big_seq1. rewrite eq_refl Rmult_1_r. symmetry; etransitivity; first eapply eq_bigr. { intros. rewrite recN_pr_comp_base Rmult_comm Rmult_if_distrib Rmult_0_l Rmult_1_l //. } rewrite /pr_eq. rewrite pr_eq_alt_comp. rewrite /index_enum. eauto. - rewrite recN_pr_unfold_comp. etransitivity. { eapply eq_bigr. intros. rewrite IHn. reflexivity. } rewrite //=. symmetry. etransitivity. { intros. eapply eq_bigr. intros. rewrite recN_pr_unfold. reflexivity. } rewrite //=. etransitivity. { eapply eq_bigr. intros. rewrite big_distrr. reflexivity. } rewrite //=. rewrite exchange_big. rewrite //=. eapply eq_bigr. intros i _. rewrite big_distrr //=. symmetry. rewrite /index_enum. rewrite [@Finite.enum]unlock //=. rewrite (img_fin_big' _ (λ x, (pr_eq (h a) (sval i) * (pr_eq (rvar_comp (h x) f) v * pr_eq (recN_rvar (sval i) n) x))) (λ x, true)). rewrite (img_fin_big' _ (λ x, (pr_eq (rvar_comp (h x) f) v * (pr_eq (h a) (sval i) * pr_eq (recN_rvar (sval i) n) x))) (λ x, true)). destruct i as (i&Hin). destruct (proj1 (img_alt _ _) Hin) as (x&Heq). eapply sum_reidx_map with (h0 := λ x, x). * intros; field. * intros a' (s&Heq')%img_alt' _. split; auto. apply img_alt'. subst; exists (existT (x) s). done. * intros b Hin' Hgt Hfalse. rewrite /pr. destruct (ge_pr_0 (rvar_dist (recN_rvar i n)) (λ x, (recN_rvar i n) x == b)) as [Hlt|Heq']. ** contradiction Hfalse. apply Rlt_gt, pr_img in Hlt. exists b. repeat split; auto. apply img_alt', img_alt. done. ** rewrite /pr_eq. rewrite ?Heq'. field. * rewrite /img. apply undup_uniq. * rewrite /img. apply undup_uniq. * intros ??. trivial. Qed. Lemma recN_space_snoc n z (xn: recN_space z n) (xSn: B (recN_fun z n xn)) : recN_space z (S n). Proof. revert z xn xSn. induction n => z xn xSn. - exact (existT (xSn) tt). - destruct xn as (x0&xn'). exact (existT x0 (IHn _ xn' xSn)). Defined. Lemma h_recN_space_snoc n z xn xSn: h (recN_rvar z n xn) xSn = recN_fun (h z (projT1 (recN_space_snoc n z xn xSn))) n (projT2 (recN_space_snoc n z xn xSn)). Proof. revert z xn xSn. induction n; rewrite //=. destruct xn => //= xSn. rewrite IHn. destruct (recN_space_snoc _ _ _) => //. Qed. Lemma recN_pr_gt' f n z v: pr_gt (rvar_comp (recN_rvar z (S n)) f) v = \big[Rplus/0]_(i : imgT (recN_rvar z n)) (pr_eq (recN_rvar z n) (sval i) * pr_gt (rvar_comp (h (sval i)) f) v). Proof. rewrite /pr_gt pr_gt_alt3. etransitivity. { apply eq_bigr. intros ??. rewrite recN_pr_unfold_comp' //. } rewrite exchange_big. apply eq_bigr => x' _. rewrite -big_distrl Rmult_comm. eapply Rmult_eq_0_inv_l => Hneq. rewrite pr_gt_alt3. symmetry. rewrite !big_filter //=. rewrite [@Finite.enum]unlock //=. rewrite (img_fin_big' _ (λ i, (pr_eq (rvar_comp _ _) i)) (λ x, Rgt_dec x v)). rewrite (img_fin_big' _ (λ i, (pr_eq (rvar_comp _ _) i)) (λ x, Rgt_dec x v)). eapply sum_reidx_map with (h0 := λ x, x); auto. - intros a Hin' ->; split; auto. apply img_alt'. destruct x' as (x&Hin). rewrite //= in Hneq. rewrite //= in Hin'. apply img_alt in Hin as (x0&Hx0). apply img_alt' in Hin' as (x1&?). subst. specialize (h_recN_space_snoc n _ x0 x1) => Hhrec. edestruct (recN_space_snoc n _ x0 x1) as (x&s). exists (existT x s). rewrite Hhrec => //. - intros ??? Hfalse. destruct (ge_pr_0 (rvar_dist (rvar_comp (h (sval x')) f)) (λ x, f ((h (sval x')) x) == b)) as [Hlt|Heq']; last by rewrite //=. contradiction Hfalse. apply Rlt_gt in Hlt. apply (pr_img (rvar_comp (h (sval x')) f)) in Hlt. exists b. repeat split; auto. apply img_alt', img_alt; auto. - rewrite /img. apply undup_uniq. - rewrite /img. apply undup_uniq. Qed. End rec_var. Arguments recN_space {_ _ _} _ _ _. Arguments recN_rvar {_ _ _} _ _ _. Section lemma31. Variable A : finType. Variable Ω: distrib A. Variable X: rrvar Ω. Variable f: R → R. Variable x c: R. Hypothesis xgt : x > 0. Hypothesis cgt : c > 0. Hypothesis Xrange: ∀ r, r \in img X → 0 ≤ r ∧ r ≤ x. Hypothesis f0: f 0 = 0. Hypothesis frange1: ∀ x, 0 ≤ f x. Variable z : R. Hypothesis zgt1 : z ≥ 1. Hypothesis frange2: ∀ y, y ≥ c → f y = z. Hypothesis fnondec: ∀ y y', (y ≤ y') ∧ (0 < y ∧ y ≤ c) ∧ (0 < y' ∧ y' ≤ c) → (f y / y) ≤ (f y' / y'). Lemma min_xc_gt: Rmin x c > 0. Proof. by apply Rmin_case. Qed. Lemma min_xc_neq0: Rmin x c ≠ 0. Proof. eapply Rlt_not_eq'. apply min_xc_gt. Qed. Lemma lemma31: Ex (rvar_comp X f) ≤ Ex X * f (Rmin x c) / (Rmin x c). Proof. rewrite /Rdiv Rmult_assoc Rmult_comm. rewrite ?Ex_fin_pt//=. rewrite big_distrr//=. apply Rle_bigr => i Hin. rewrite -Rmult_assoc. apply Rmult_le_compat; auto; try reflexivity. * apply Rge_le, pmf_pos. * destruct (Xrange (X i)) as ([Hgt|HX0]&?). { apply img_alt; eauto. } ** apply (Rmult_le_reg_r (Rdiv 1 (X i))). apply Rdiv_lt_0_compat; fourier. transitivity (f (Rmin x c) / (Rmin x c)); last first. *** apply Req_le. rewrite //=. rewrite /Rdiv. field; split. **** by apply Rlt_not_eq'. **** apply min_xc_neq0. *** rewrite -Rmult_assoc. rewrite Rmult_1_r. destruct (Rlt_or_le (X i) c) as [?|Hge']. **** eapply fnondec; repeat split; auto; try fourier. { apply Rmin_case; fourier. } { apply Rmin_case; fourier. } { apply Rmin_r. } **** assert (Rmin x c = c) as ->. { apply Rmin_right. fourier. } rewrite //= in Hge'. rewrite frange2; last fourier. rewrite frange2; last fourier. rewrite /Rdiv. apply Rmult_le_compat; try fourier. { apply Rlt_le. apply Rinv_0_lt_compat. fourier. } eapply Rinv_le_contravar; auto. ** rewrite -HX0 f0 Rmult_0_r. fourier. Qed. End lemma31. Section karp_bound_sec. Variable X: eqType. Variable size: X → R. Variable A B : X → finType. Variable ΩT : ∀ x : X, distrib (A x). Variable Ωh : ∀ x : X, distrib (B x). Variable T: ∀ x: X, rrvar (ΩT x). Variable h: ∀ x: X, rvar (Ωh x) X. (* Sometimes it is natural to only consider cases where an invariant is preserved throughout the recurrence. We use this parameter P for such invariants rather than subtyping X because it can be more natural *) Variable P: X → Prop. Variable a m: R → R. Variable u u': R → R. Variable d: R. Hypothesis umin: R. Hypothesis umin_non_neg: 0 ≤ umin. Hypothesis umin_lb: ∀ x, x > d → umin ≤ u x - a x. Variable u_mono: ∀ x y, x ≤ y → u x ≤ u y. Variable u_strict_inc: ∀ x y, x ≥ d → x < y → u x < u y. Variable u'_mono: ∀ x y, x ≤ y → u' x ≤ u' y. Variable u'_pos: ∀ x, u' x > 0. Variable u'u: ∀ x, (* d < x → *) x ≤ u' (u x). Variable u'_inv_above: ∀ z, d < z → u' (u z) = z. Variable u_inv_above: ∀ z, umin < z → u (u' z) = z. Variable ud_umin: u d = umin. Variable m_bound_Eh: ∀ x, Ex (rvar_comp (h x) size) ≤ m (size x). Variable u_cont: ∀ x, d < x → continuity_pt u x. Variable a_cont: ∀ x, d < x → continuity_pt a x. (* Technically, I don't think Karp states this assumption but it appears to be needed *) Hypothesis T_non_neg: ∀ x n, (T x) n ≥ 0. Hypothesis Trec: ∀ x r, P x → pr_gt (T x) r ≤ \big[Rplus/0]_(x' : imgT (h x)) ((pr_eq (h x) (sval x')) * pr_gt (T (sval x')) (r - a (size x))). Hypothesis urec: ∀ x, x > d → u x ≥ a x + u (m x). Hypothesis hP: ∀ x n, P x → P ((h x) n). Hypothesis hrange1: ∀ x n, size ((h x) n) ≤ size x. Hypothesis hrange2: ∀ x n, d < size x → 0 ≤ size ((h x) n). Hypothesis alower: ∀ x, x ≤ d → a x = 0. Hypothesis a_nonneg: ∀ x, a x ≥ 0. Hypothesis a_mono: Rmono a. Hypothesis a_pos: ∀ x, d < x → 0 < a x. Hypothesis mnondec: ∀ y y', 0 < y → y ≤ y' → (m y / y) ≤ (m y' / y'). Hypothesis d_non_neg: 0 ≤ d. (* Karp does not state this assumption, but Neal Young has suggested that _some_ additional assumption is needed, and the following suffices *) (* In any case, I believe this follows from prior assumptions + Markov's inequality if lim_(n -> infty) m^n(x) < d. *) Hypothesis hinf_0: ∀ a eps, eps > 0 → ∃ n, pr_gt (rvar_comp (recN_rvar h a n) size) d < eps. (* Karp does not have an assumption like the following either. *) Hypothesis Tbelow: ∀ x e, size x ≤ d → (T x) e ≤ umin. Hypothesis mpos: ∀ x, 0 ≤ x → 0 ≤ m x. Definition K r z := pr (rvar_dist (T z)) (λ n, Rgt_dec ((T z) n) r). Lemma umin_lb_simple: ∀ x, x ≥ d → umin ≤ u x. Proof. rewrite /Rge => x [Hgt|Heq]. - transitivity (u x - a x); first auto. assert (a x > 0) by (apply a_pos; auto). fourier. - subst. reflexivity. Qed. Lemma K_alt4 r z: P z → K r z ≤ \big[Rplus/0]_(i : imgT (h z)) (pr_eq (h z) (sval i) * (K (r - (a (size z))) (sval i))). Proof. rewrite /K; eauto. Qed. Definition K0 r (z: X) := if (Rlt_dec r umin) then 1 else 0. Fixpoint Krec i r x := match i with | 0 => K0 r x | S i' => Ex (rvar_comp (h x) (Krec i' (r - a (size x)))) end. Definition round r x := Rceil ((r - u x) / a x). Definition D r x := if Rle_dec r umin then 1 else if Rle_dec x d then 0 else if Rle_dec r (u x) then 1 else (m x / x)^(Z.to_nat (round r x)) * (x / (u' (r - a(x) * IZR (round r x)))). Definition Dalt r x := if Rle_dec r umin then 1 else if Rle_dec x d then 0 else if Rlt_dec r (u x) then 1 else (m x / x)^(Z.to_nat (round r x)) * (x / (u' (r - a(x) * IZR (round r x)))). Lemma Rceil_0: Rceil 0 = 0%Z. Proof. rewrite /Rceil. replace 0 with (IZR 0) by auto. rewrite fp_R0 eq_refl. rewrite Int_part_IZR //=. Qed. Lemma D_Dalt_equiv r x: D r x = Dalt r x. Proof. rewrite /Dalt /D. destruct (Rle_dec) as [?|Hgt] => //=. apply Rnot_le_gt in Hgt. destruct (Rle_dec) as [?|Hgt'] => //=. apply Rnot_le_gt in Hgt'. destruct (Rle_dec) as [Hle|?] => //=. - inversion Hle as [Hlt|Heq]. * destruct (Rlt_dec) => //=. * subst. destruct (Rlt_dec) => //=. assert (round (u x) x = 0%Z) as ->. { rewrite /round. rewrite -Rceil_0. f_equal. rewrite Rminus_diag_eq // /Rdiv Rmult_0_l //. } rewrite //= Rmult_0_r /Rminus Ropp_0 Rplus_0_r u'_inv_above //=. rewrite /Rdiv Rmult_1_l Rinv_r //. apply Rgt_not_eq. fourier. - destruct (Rlt_dec) => //=. intros. exfalso. nra. Qed. Lemma K_0 r z: r < 0 → K r z = 1. Proof. intros Hlt. rewrite /K /pr. rewrite -(pmf_sum1_Series (rvar_dist (T z))). rewrite ?SeriesC_fin_big. eapply eq_big; auto. intros x Hin. destruct (Rgt_dec) as [?|Hngt] => //=. exfalso; apply Hngt. eapply Rlt_le_trans; eauto. apply Rge_le, T_non_neg. Qed. Lemma K_unfold r x: P x → K r x ≤ Ex (rvar_comp (h x) (K (r - a (size x)))). Proof. etransitivity; first apply K_alt4; auto. rewrite Ex_fin_comp. right; apply eq_bigr => ??. by rewrite Rmult_comm. Qed. Lemma Krec_non_decS: ∀ (i: nat) r x, Krec i r x ≤ Krec (S i) r x. Proof. induction i as [|i'] => r x. - rewrite /Krec. rewrite Ex_fin_pt //= /K0. destruct (Rlt_dec) as [H|H]; rewrite //= /rvar_comp //=. * destruct Rlt_dec as [|Hfalse]. ** rewrite //=. rewrite -big_distrr //=. rewrite -SeriesC_fin_big pmf_sum1_Series. nra. ** exfalso. eapply Hfalse. specialize (a_nonneg (size x)). intros. fourier. * destruct Rlt_dec as [|]. ** rewrite //=. rewrite -big_distrr //=. rewrite -SeriesC_fin_big pmf_sum1_Series. nra. ** rewrite //=. right. symmetry; apply big1 => ??. nra. - rewrite /Krec ?Ex_fin_pt. apply Rle_bigr => i ?. etransitivity. * apply Rmult_le_compat_r. { apply Rge_le, pmf_pos. } { eapply IHi'. } * rewrite //= ?Ex_fin_pt /rvar_comp //=; reflexivity. Qed. Lemma Krec_non_dec (i i': nat) r x: (i ≤ i')%nat → Krec i r x ≤ Krec i' r x. Proof. induction 1; first reflexivity. etransitivity; [ apply IHle | apply Krec_non_decS ]. Qed. Lemma Krec_bound01 r x i: 0 ≤ Krec i r x ∧ Krec i r x ≤ 1. Proof. revert r x. induction i => r x. - rewrite //= /K0. split; destruct Rlt_dec => //=; fourier. - rewrite /Krec. rewrite Ex_fin_pt /rvar_comp //=; split. * eapply Rle_big0 => ??. rewrite -[a in a ≤ _](Rmult_0_l 0). apply Rmult_le_compat; try fourier; last (apply Rge_le, pmf_pos). edestruct IHi; eauto. * transitivity (\big[Rplus/0]_(a in B x) (rvar_dist (h x) a)). ** eapply Rle_bigr => a' ?. specialize (IHi (r - a (size x)) ((h x) a')). rewrite -[a in _ ≤ a](Rmult_1_l). eapply Rmult_le_compat_r; first (apply Rge_le, pmf_pos). edestruct IHi; eauto. ** right. rewrite -SeriesC_fin_big. apply pmf_sum1_Series. Qed. Lemma Krec_bound r x: bound (fun v => ∃ i, Krec i r x = v). Proof. rewrite /bound /is_upper_bound. exists 1 => v [i <-]. edestruct Krec_bound01; eauto. Qed. Definition Krec_sup (r: R) x : R := proj1_sig (completeness (fun v => ∃ i, Krec i r x = v) (Krec_bound r x) (ex_intro _ (Krec 0 r x) (ex_intro _ O erefl))). Lemma Krec_sup_is_lub r x: is_lub (fun v => ∃ i, Krec i r x = v) (Krec_sup r x). Proof. rewrite /Krec_sup //=. by destruct (completeness _). Qed. Lemma Rle_lub_eps x E v: is_lub E v → (∀ eps, eps > 0 → ∃ v, E v ∧ x ≤ v + eps) → x ≤ v. Proof. intros [Hub ?] Hle. eapply le_epsilon => eps Hgt0. destruct (Hle eps Hgt0) as (v'&HE&Hle'). specialize (Hub v' HE). fourier. Qed. Lemma K_Krec_leq_below i r x: size x ≤ d → K r x ≤ Krec i r x. Proof. revert r x. induction i as [| i'] => r x Hle. - rewrite /K /Krec /K0 //=. destruct (Rlt_dec). + intros. eapply pr_le_1. + rewrite /pr//=. right. rewrite SeriesC_fin_big. eapply big1 => b ?. rewrite //=. destruct (Rgt_dec) as [?|Hnlt] => //=; try nra. specialize (Tbelow _ b Hle). exfalso. destruct (T x); simpl in *. nra. - etransitivity; first eapply IHi'; eauto. apply Krec_non_decS. Qed. Lemma K_Krec_bounded_gap i r x: K r x ≤ Krec i r x + 1. Proof. transitivity 1; first apply pr_le_1. destruct (Krec_bound01 r x i). fourier. Qed. Definition recN_a {i: nat} x (b: @recN_space _ _ _ h x i) : R. revert x b. induction i. - intros x ?. exact 0. - intros x (b&b'). exact (a (size x) + IHi ((h x) b) b'). Defined. Lemma Krec_unfold_recN_varS r x i: Krec i r x = \big[Rplus/0]_(b in @recN_space _ _ _ h x i) (Krec 0 (r - recN_a x b) (recN_rvar h x i b) * `(rvar_dist (recN_rvar h x i)) b). Proof. revert r x. induction i => r x. - by rewrite /index_enum {1}[@Finite.enum]unlock big_seq1 //= Rmult_1_r Rminus_0_r. - rewrite {1}/Krec -/Krec Ex_fin_pt //=/rvar_comp. etransitivity. * eapply eq_bigr. intros. rewrite IHi big_distrl. reflexivity. * rewrite //=. rewrite nested_sum_recN_space //=. apply eq_bigr => ib H. destruct ib. rewrite Rmult_assoc. f_equal. ** f_equal. by rewrite /Rminus Ropp_plus_distr Rplus_assoc. ** by rewrite Rmult_comm. Qed. Lemma K_unfold_recN_varS r x i: P x → K r x ≤ \big[Rplus/0]_(b in @recN_space _ _ _ h x i) (K (r - recN_a x b) (recN_rvar h x i b) * (rvar_dist (recN_rvar h x i)) b). Proof. revert r x. induction i => r x HP. - right. by rewrite /index_enum {1}[@Finite.enum]unlock big_seq1 //= Rmult_1_r Rminus_0_r. - etransitivity; first apply K_unfold; auto. rewrite /K Ex_fin_pt /rvar_comp //=. etransitivity. * etransitivity. ** eapply Rle_bigr. intros. apply Rmult_le_compat_r. *** apply Rge_le, pmf_pos. *** apply IHi. eauto. ** right. apply eq_bigr => ??. rewrite big_distrl; reflexivity. * rewrite //=. rewrite nested_sum_recN_space //=. right. apply eq_bigr => ib H. destruct ib. rewrite Rmult_assoc. f_equal. ** f_equal. by rewrite /Rminus Ropp_plus_distr Rplus_assoc. ** by rewrite Rmult_comm. Qed. Lemma diff_bound x y z: 0 ≤ x → x ≤ z → 0 ≤ y → y ≤ z → x + -y ≤ z. Proof. intros; fourier. Qed. Lemma Rle_plus_minus x y z: x - y ≤ z → x ≤ z + y. Proof. intros. fourier. Qed. Require Import Coq.Classes.Morphisms. Instance Rle_plus_proper: Proper (Rle ==> Rle ==> Rle) Rplus. Proof. intros ?? Hle ?? Hle'. apply Rplus_le_compat; auto. Qed. Lemma K_le_supKrec r x: P x → K r x ≤ Krec_sup r x. Proof. intros HP. eapply (Rle_lub_eps _ _ _ (Krec_sup_is_lub _ _)) => eps Hgt0. destruct (hinf_0 x eps Hgt0) as [i Hhlt]. exists (Krec i r x); split; eauto. rewrite Krec_unfold_recN_varS. setoid_rewrite (K_unfold_recN_varS _ _ i); last done. rewrite (bigID (λ b, Rgt_dec (size ((recN_rvar h x i) b)) d)) //=. rewrite [a in _ ≤ a + _](bigID (λ b, Rgt_dec (size ((recN_rvar h x i) b)) d)) //=. rewrite [a in _ ≤ a]Rplus_comm -Rplus_assoc. eapply Rplus_le_compat. - apply Rle_plus_minus, diff_bound. * eapply Rle_big0 => ??. rewrite -[a in a ≤ _](Rmult_0_l 0). apply Rmult_le_compat; try fourier; eauto using Rge_le, pmf_pos, recN_0, ge_pr_0. * etransitivity; last (by rewrite /pr_gt /pr_eq /pr in Hhlt; left; eapply Hhlt). rewrite SeriesC_fin_big. rewrite /index_enum. eapply Rle_bigr'. ** intros ?. destruct (Rgt_dec) => //= _. split; auto. rewrite //=. rewrite -[a in _ ≤ a]Rmult_1_l; apply Rmult_le_compat; try nra; eauto. *** apply Rge_le, ge_pr_0. *** apply Rge_le, recN_0. *** apply pr_le_1. ** intros. rewrite //=. destruct (Rgt_dec) => //=. reflexivity. * eapply Rle_big0 => ??. rewrite -[a in a ≤ _](Rmult_0_l 0). apply Rmult_le_compat; try fourier; eauto using Rge_le, ge_pr_0, recN_0. eapply (proj1 (Krec_bound01 _ _ 0)). * etransitivity; last (rewrite /pr_gt /pr_eq /pr in Hhlt; left; eapply Hhlt). rewrite SeriesC_fin_big. rewrite /index_enum. eapply Rle_bigr'. ** intros ?. destruct (Rgt_dec) => //= _. split; auto. rewrite //=. rewrite -[a in _ ≤ a]Rmult_1_l; apply Rmult_le_compat; try nra; eauto. *** eapply (proj1 (Krec_bound01 _ _ 0)). *** apply Rge_le, recN_0. *** eapply (proj2 (Krec_bound01 _ _ 0)). ** intros. destruct (Rgt_dec) => //=. reflexivity. - apply Rle_bigr => b //=. move /negP. destruct (Rgt_dec) as [|Hngt] => //= _. apply Rmult_le_compat_r. * apply Rge_le, recN_0. * apply (K_Krec_leq_below 0). apply Rnot_lt_ge in Hngt. fourier. Qed. Lemma Rmult_pos x y: 0 ≤ x → 0 ≤ y → 0 ≤ x * y. Proof. intros. rewrite -[a in a ≤ _](Rmult_0_l 0). apply Rmult_le_compat; eauto; try reflexivity. Qed. Lemma D0_aux r x: 0 < x → 0 ≤ (m x / x) ^ Z.to_nat (round r x) * (x / u' (r - a x * IZR (round r x))). Proof. intros Hlt. eapply Rmult_pos. * eapply pow_le. rewrite /Rdiv. eapply Rle_mult_inv_pos; eauto. eapply mpos. left. done. * rewrite /round //=. eapply Rle_mult_inv_pos. ** fourier. ** eapply u'_pos. Qed. Lemma D0 r x: 0 ≤ D r x. Proof. rewrite /D. destruct (Rle_dec) => //=; intros; try nra. destruct (Rle_dec) => //=; intros; try nra. destruct (Rle_dec) => //=; intros; try nra. intros. apply D0_aux. nra. Qed. Lemma Rmult_nonneg x y: 0 ≤ x → 0 ≤ y → 0 ≤ x * y. Proof. intros. rewrite -(Rmult_0_l 0). apply Rmult_le_compat; eauto; try reflexivity. Qed. Lemma uu'_adjoint x y: (* d < x → *) umin < y → x ≤ u' y ↔ u x ≤ y. Proof. split. - intros ?%u_mono. transitivity (u (u' y)); eauto. right. by rewrite u_inv_above. - transitivity (u' (u x)); eauto. Qed. Lemma uu'_adjointrl x y: umin < y → x ≤ u' y → u x ≤ y. Proof. eapply uu'_adjoint. Qed. Lemma uu'_adjointlr x y: (* d < x → *) u x ≤ y → x ≤ u' y. Proof. transitivity (u' (u x)); eauto. Qed. Lemma uu': ∀ x, umin < x → u (u' x) ≤ x. Proof. intros. apply uu'_adjointrl; auto; reflexivity. Qed. Lemma Rinv_pos z: 0 < z → 0 ≤ / z. Proof. intros. rewrite -(Rmult_1_l (/ z)). apply Rle_mult_inv_pos; auto; fourier. Qed. Lemma Dnondec r x x': r > umin → (x ≤ x') ∧ (0 < x ∧ x ≤ (u' r)) ∧ (0 < x' ∧ x' ≤ (u' r)) → (D r x / x) ≤ (D r x' / x'). Proof. intros Hr (Hle&(Hxrange1&Hxrange2)&(Hx'range1&Hx'range2)). assert (0 < r) by fourier. rewrite ?D_Dalt_equiv. rewrite /Dalt //=. destruct (Rle_dec) => //=; first nra. destruct (Rle_dec) => //=. { destruct (Rle_dec) => //=; first nra. rewrite /Rdiv ?Rmult_0_l //=. destruct (Rlt_dec) => //=; eapply Rle_mult_inv_pos; try fourier. eapply D0_aux; eauto. } destruct (Rlt_dec) => //=. { destruct (Rle_dec) => //=. { exfalso. nra. } destruct (Rlt_dec) => //=. {assert (x = x') as ->. { destruct Hle as [Hlt|]; auto. exfalso. eapply u_strict_inc in Hlt; eauto; try nra. apply u_mono in Hxrange2. apply u_mono in Hx'range2. assert (u x ≤ r) by (etransitivity; eauto using uu'). assert (u x' ≤ r) by (etransitivity; eauto using uu'). fourier. } reflexivity. } exfalso. assert (u x' < u x) by nra. destruct Hle as [Hlt|]; subst. - apply u_strict_inc in Hlt; nra. - nra. } destruct (Rle_dec) => //=. { intros; exfalso; nra. } destruct (Rlt_dec) => //=. { exfalso. apply u_mono in Hx'range2. assert (u x' ≤ r) by (etransitivity; eauto using uu'). nra. } eapply (Rceil_interval_decompose_P (λ x, 0 < x ∧ d < x ∧ x ≤ u' r) (λ z x, (m x / x) ^ Z.to_nat z * (x / u' (r - a x * IZR z)) / x) (λ x, (r - u x) / a x)); eauto. - intros ?? (?&(?&?)) (?&(?&?)) z; repeat split; fourier. - intros k (xk&Hxk) z z' (?&(?&?)) (?&(?&?)) Hlez. assert (Hpow_pos: ∀ k z, 0 < z → 0 ≤ (m z / z) ^ k). { intros k' ? Hgt; induction k' => //=; try fourier. apply Rmult_nonneg; auto. apply Rle_mult_inv_pos; auto. apply mpos; fourier. } rewrite ?/Rdiv. rewrite Rmult_assoc. rewrite [a in _ ≤ a]Rmult_assoc. apply Rmult_le_compat; eauto; try fourier. * apply Rmult_nonneg; auto. ** apply Rle_mult_inv_pos; first fourier. apply Rgt_lt, u'_pos. ** rewrite -(Rmult_1_l (/ z)). apply Rle_mult_inv_pos; fourier. * induction (Z.to_nat k) => //=; try fourier. apply Rmult_le_compat; eauto. ** move: (Hpow_pos 1%nat z). rewrite //= Rmult_1_r. eauto. * assert (∀ a b, 0 < a → a * b * / a = b) as Hcancel. { clear. intros. rewrite (Rmult_comm a) Rmult_assoc. rewrite Rinv_r; first rewrite Rmult_1_r //. by apply Rgt_not_eq. } rewrite ?Hcancel //. apply Rinv_le_contravar; try eapply u'_pos. apply u'_mono. specialize (a_mono z z' Hlez). intros. assert (IZR k ≥ 0). { apply Rle_ge. replace 0 with (IZR 0) by auto. apply IZR_le. destruct Hxk as ((?&(?&?%uu'_adjoint))&<-). replace 0%Z with (Rceil 0); last first. { rewrite /Rceil. replace 0 with (IZR 0) by auto. rewrite fp_R0 eq_refl. rewrite Int_part_IZR //=. } apply Rceil_mono. apply Rle_mult_inv_pos; auto; try fourier. - fourier. } generalize (a_nonneg z) => ?. specialize (a_nonneg z'); intros. rewrite /Rminus. apply Rplus_le_compat_l. apply Ropp_le_contravar. apply Rmult_le_compat; fourier. - intros k z (?&?&Hzle) Heq. assert (Hkpos: (0 <= k)%Z). { apply le_IZR. replace (IZR 0) with 0 by auto. rewrite -Heq. apply Rle_mult_inv_pos; auto using a_pos. rewrite uu'_adjoint in Hzle *; intros; fourier. } destruct (Req_dec (m z) 0) as [Heq0|Hneq0]. { rewrite ?Heq0. apply Rle_ge. rewrite Z2Nat.inj_add //=. rewrite (plus_comm) //=. rewrite /Rdiv. rewrite ?Rmult_0_l ?Rmult_1_l. repeat apply Rmult_pos; try fourier. * induction (Z.to_nat) => //=; try fourier. * apply Rinv_pos, u'_pos. * apply Rinv_pos; fourier. } assert (0 < m z). { edestruct (mpos z); try fourier. congruence. } apply (Rmult_eq_compat_r (a z)) in Heq. rewrite /Rdiv Rmult_assoc Rinv_l in Heq; last apply Rgt_not_eq, a_pos; auto. rewrite Rmult_1_r Rmult_comm in Heq. apply (Rplus_eq_compat_r (u z)) in Heq. rewrite /Rminus Rplus_assoc Rplus_opp_l Rplus_0_r in Heq. apply (Rplus_eq_compat_l (-(a z * IZR k))) in Heq. rewrite -Rplus_assoc Rplus_opp_l Rplus_0_l Rplus_comm in Heq. rewrite /Rminus. generalize (urec z) => Hrec. rewrite -Heq in Hrec. assert (Heq': u (m z) ≤ r + - (a z * (IZR (k+ 1)))). { rewrite plus_IZR. replace (IZR 1) with 1 by auto. rewrite Rmult_plus_distr_l Rmult_1_r. rewrite Ropp_plus_distr. apply (Rplus_ge_compat_r (- a z)), Rge_le in Hrec; auto. rewrite Rplus_comm -Rplus_assoc Rplus_opp_l Rplus_0_l ?Rplus_assoc in Hrec; auto. } intros. apply uu'_adjointlr in Heq'; auto. apply Rle_ge. apply (f_equal u') in Heq. rewrite u'_inv_above // in Heq. rewrite Heq. etransitivity. * apply Rmult_le_compat. ** apply Rmult_pos. *** induction (Z.to_nat _) => //=; try fourier. apply Rmult_pos; auto. apply Rle_mult_inv_pos; auto. apply mpos; fourier. *** apply Rle_mult_inv_pos; auto; try fourier. ** apply Rinv_pos; auto. ** apply Rmult_le_compat. *** induction (Z.to_nat _) => //=; try fourier. apply Rmult_pos; auto. apply Rle_mult_inv_pos; auto. apply mpos; fourier. *** apply Rle_mult_inv_pos; auto; try fourier. *** reflexivity. *** apply Rdiv_le_compat_contra; last first. **** apply Heq'. **** reflexivity. **** auto. **** fourier. ** reflexivity. * rewrite /Rdiv. rewrite (Z2Nat.inj_add) //= plus_comm //=. rewrite (Rmult_comm (m z / z)). right. rewrite ?Rmult_assoc. field. split; auto. apply Rgt_not_eq. fourier. - intros z z' (?&?&Hltu'1) (?&?&Hltu'2) Hlez. apply Rle_ge. apply Rdiv_le_compat_contra. * rewrite uu'_adjoint // in Hltu'2 *; intros; fourier. * apply a_pos; auto. * apply u_mono in Hlez. fourier. * apply a_mono in Hlez. fourier. - intros z (?&?&?). apply continuity_pt_div; auto. apply continuity_pt_minus; auto. by apply continuity_pt_const. apply Rgt_not_eq. by apply a_pos. - repeat split; nra. - split; nra. Qed. Lemma fp_plus_fp0 x y: frac_part y = 0 → frac_part (x + y) = frac_part x. Proof. intros Hfp0. case (Rge_dec (frac_part x + frac_part y) 1). - rewrite Hfp0 Rplus_0_r. intros. edestruct (base_fp x); fourier. - intros ?%Rnot_ge_lt; by rewrite plus_frac_part2 // Hfp0 Rplus_0_r. Qed. Lemma frac_part_1: frac_part 1 = 0. Proof. rewrite /frac_part. replace 1 with (IZR 1) by auto. rewrite Int_part_IZR //. ring. Qed. Lemma frac_part_n1: frac_part (-1) = 0. Proof. rewrite /frac_part. replace (-1) with (IZR (-1)) by auto. rewrite Int_part_IZR //. ring. Qed. Lemma frac_part_0: frac_part 0 = 0. Proof. rewrite /frac_part. replace 0 with (IZR 0) at 1 2 by auto. rewrite Int_part_IZR //. ring. Qed. Lemma Rceil_plus_1 x: (Rceil (x + 1) = Rceil x + 1)%Z. Proof. rewrite /Rceil fp_plus_fp0 //; auto using frac_part_1. rewrite plus_Int_part2 //=; last first. { rewrite frac_part_1. destruct (base_fp x); fourier. } replace 1 with (IZR 1) by auto. rewrite Int_part_IZR //. case: ifP; intros; omega. Qed. Lemma Rceil_minus_1 x: (Rceil (x - 1) = Rceil x - 1)%Z. Proof. rewrite /Rceil fp_plus_fp0 //; auto using frac_part_n1. rewrite plus_Int_part2 //=; last first. { rewrite frac_part_n1. destruct (base_fp x); fourier. } replace (-(1)) with (IZR (-1)) by auto. rewrite Int_part_IZR //. case: ifP; intros; omega. Qed. Lemma Rceil_mono_strict x x': frac_part x = 0 → x < x' → (Rceil x < Rceil x')%Z. Proof. rewrite /Rceil. rewrite {2}(Int_frac_decompose x). rewrite {1}(Int_frac_decompose x'). move => -> //. rewrite eq_refl //=. case: ifP. - move /eqP => ->. rewrite ?Rplus_0_r. apply lt_IZR. - intros. apply lt_IZR. rewrite plus_IZR. replace (IZR 1) with 1 by auto. destruct (base_fp x'). fourier. Qed. Lemma Rceil_positive_le1 x: (Rceil x > 0)%Z → x ≤ 1 → Rceil x = 1%Z. Proof. rewrite /Rceil => Hgt. rewrite {1}(Int_frac_decompose x). move:Hgt. case: ifP. - move /eqP => Hfp0 Hgt. rewrite Hfp0 Rplus_0_r. replace 1 with (IZR 1) by auto. move /le_IZR => ?; omega. - move /eqP => ?. intros. cut (Int_part x < 1)%Z; first by (intros; omega). apply lt_IZR. destruct (base_fp x) as (Hge0&Hlt1). replace (IZR 1) with 1 by auto. move: Hgt. move /Zgt_lt/IZR_lt. rewrite plus_IZR. replace (IZR 1) with 1 by auto. replace (IZR 0) with 0 by auto. inversion Hge0; intros; [fourier|nra]. Qed. Lemma Krec_le_D: ∀ i r x, Krec i r x ≤ D r (size x). Proof. induction i => r x. - rewrite /K /D. destruct (Rle_dec) as [|Hgtmin]; first by (edestruct Krec_bound01; eauto). rewrite //=. destruct (Rle_dec) as [Hge|Hnge]. { right. rewrite //= /K0 //=. destruct (Rlt_dec) => //=; try nra. } rewrite //=. destruct (Rle_dec) as [Hge|Hnge']. { rewrite //=. edestruct (Krec_bound01 r x O); eauto. } rewrite //= /K0. destruct (Rlt_dec) => //=. { exfalso; eapply Hgtmin. nra. } eapply D0_aux. apply Rnot_le_gt in Hnge. fourier. - rewrite /D. destruct (Rle_dec) as [|Hgtmin]. { rewrite /is_left. edestruct (Krec_bound01 r x (S i)); auto. } destruct (Rle_dec) as [Hge|Hnge]. { right. revert r x Hgtmin Hge. induction (S i). * rewrite //= /K0 //=. intros. destruct Rlt_dec => //=; auto. intros. exfalso. apply Hgtmin. nra. * intros. rewrite {1}/Krec -/Krec Ex_fin_pt /rvar_comp //=. rewrite alower; last fourier. rewrite Rminus_0_r. eapply big1 => b ?. rewrite IHn //=; try nra. transitivity (size x) => //. } destruct (Rle_dec) as [Hge|Hnge']; first by (edestruct (Krec_bound01 r x (S i)); auto). assert (r - a (size x) > umin) as Hgt. { apply Rgt_ge_trans with (r2 := u (size x) - a (size x)); first by nra. apply /Rle_ge/umin_lb. nra. } destruct (Rge_dec d (u' (r - a (size x)))) as [Hge|Hlt]; [| apply Rnot_ge_lt in Hlt]. { exfalso. apply Rge_le in Hge. apply u_mono in Hge. rewrite u_inv_above //= in Hge. fourier. } transitivity (Ex (rvar_comp (rvar_comp (h x) size) (λ x', D (r - a (size x)) x'))). * rewrite /Krec -/Krec ?Ex_fin_pt //=. apply Rle_bigr => z ?. apply Rmult_le_compat_r; eauto using Rge_le, pmf_pos. * etransitivity; first eapply lemma31 with (x := size x) (c := u' (r - a (size x))) (z := 1). ** nra. ** apply u'_pos. ** intros p. rewrite img_alt. intros (n&?). subst. split; rewrite //=; eauto. eapply hrange2. nra. ** rewrite /D. destruct (Rle_dec) => //=; first by nra. destruct (Rle_dec) => //=. ** intros. eapply D0. ** fourier. ** intros y Hley. rewrite /D. repeat (destruct (Rle_dec) => //=; try nra); []. apply Rge_le, u_mono in Hley. rewrite u_inv_above // in Hley. ** intros. eapply Dnondec; eauto. ** rewrite /Rdiv Rmult_assoc. etransitivity. apply Rmult_le_compat_r; last apply m_bound_Eh. { intros. apply Rle_mult_inv_pos; auto. **** apply D0. **** apply Rmin_case; nra. } assert (round r (size x) = 1 + round (r - a (size x)) (size x))%Z as Hplus. { rewrite /round. rewrite Zplus_comm -Rceil_plus_1; f_equal. field. apply Rgt_not_eq. apply a_pos. nra. } assert (Hrgt0: (round r (size x) > 0)%Z). { rewrite /round. rewrite -Rceil_0. apply Zlt_gt, Rceil_mono_strict. apply frac_part_0. apply Rdiv_lt_0_compat. - nra. - apply a_pos. nra. } assert (0 <= round (r - a (size x)) (size x))%Z by omega. apply Rmin_case_strong. *** rewrite Hplus. intros Hminl. rewrite D_Dalt_equiv. rewrite /Dalt //. destruct (Rle_dec); rewrite /is_left; first by (nra). destruct (Rle_dec); rewrite /is_left; first by (nra). destruct (Rlt_dec) as [Hlt'|?]; rewrite /is_left. { exfalso. apply uu'_adjointrl in Hminl; nra. } right. rewrite Z2Nat.inj_add; try omega. rewrite plus_IZR. replace (IZR 1) with 1 by auto. rewrite //=. rewrite Rmult_plus_distr_l Rmult_1_r. rewrite /Rminus. rewrite Ropp_plus_distr. rewrite Rplus_assoc. rewrite /Rdiv; field. split. **** apply Rgt_not_eq, u'_pos. **** apply Rgt_not_eq. nra. *** intros Hminr. rewrite D_Dalt_equiv /Dalt. destruct (Rle_dec); rewrite /is_left; first by nra. destruct (Rle_dec); rewrite /is_left; first by nra. destruct (Rlt_dec) as [Hlt'|?]; rewrite /is_left. { rewrite u_inv_above in Hlt'; nra. } right. symmetry. assert (round (r - a (size x)) (u' (r - a (size x))) = 0)%Z as ->. { rewrite /round -Rceil_0. f_equal. rewrite u_inv_above /Rdiv; last done. apply Rmult_eq_0_compat_r; ring. } rewrite //= Rmult_0_r Rminus_0_r Rmult_1_l /Rdiv Rinv_r; last by apply Rgt_not_eq, u'_pos. rewrite Rmult_1_l. assert (round r (size x) = 1)%Z as ->. { rewrite /round. apply Rceil_positive_le1. - move: Hrgt0. rewrite /round. done. - apply (Rmult_le_reg_r (a (size x))). * apply a_pos. nra. * rewrite Rmult_1_l /Rdiv Rmult_assoc Rinv_l. ** rewrite Rmult_1_r. apply u_mono in Hminr. rewrite u_inv_above in Hminr; nra. ** apply Rgt_not_eq, a_pos; nra. } replace (IZR 1) with 1 by auto. rewrite //= ?Rmult_1_r. field; split; nra. Qed. Theorem karp_bound r x: P x → K r x ≤ D r (size x). Proof. transitivity (Krec_sup r x). - apply K_le_supKrec; auto. - apply (proj2 (Krec_sup_is_lub r x)). intros ? (i&<-); apply Krec_le_D. Qed. (* N.B. the parameter P here can be used to restrict attention to recurrences that preserve some invariant throughout execution. *) Theorem karp_bound_simple w x: size x > d → P x → pr_gt (T x) (u (size x) + INR w * a (size x)) ≤ (m (size x) / size x) ^ w. Proof. set (r := u (size x) + INR w * a (size x)). transitivity (D r (size x)). - apply karp_bound; auto. - rewrite /D/r. destruct (Rle_dec) as [Hle|?]. { rewrite //=. destruct w; first by (rewrite //=; reflexivity). assert (umin <= u (size x)) by (apply umin_lb_simple; nra). assert (a (size x) > 0) by (apply a_pos; nra). specialize (pos_INR w). intros. rewrite S_INR in Hle. exfalso. nra. } rewrite //=. destruct Rle_dec => //=; try nra; []. destruct Rle_dec as [Hle|?]. { intros. rewrite //=. destruct w; first by (rewrite //=; reflexivity). assert (umin <= u (size x)) by (apply umin_lb_simple; nra). assert (a (size x) > 0) by (apply a_pos; nra). specialize (pos_INR w). intros. exfalso. rewrite S_INR in Hle. exfalso. nra. } rewrite //=. assert (round (u (size x) + INR w * a (size x)) (size x) = Z_of_nat w) as Hround. { rewrite /round. assert ((u (size x) + INR w * a (size x) - u (size x)) / a (size x)= INR w) as ->. { field. specialize (a_pos (size x)). nra. } rewrite INR_IZR_INZ Rceil_IZR. done. } rewrite Hround //=. rewrite INR_IZR_INZ. rewrite (Rmult_comm (IZR _)). assert (u (size x) + a (size x) * IZR (Z.of_nat w) - a (size x) * IZR (Z.of_nat w) = u (size x)) as -> by field. rewrite u'_inv_above; last by nra. rewrite /Rdiv. rewrite Rinv_r; last by nra. rewrite Rmult_1_r. rewrite Nat2Z.id. reflexivity. Qed. End karp_bound_sec.
module DuplicateBuiltinBinding where {-# BUILTIN STRING String #-} {-# BUILTIN STRING String #-}
/- Copyright (c) 2020 Floris van Doorn. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Floris van Doorn ! This file was ported from Lean 3 source module measure_theory.constructions.prod ! leanprover-community/mathlib commit f2ce6086713c78a7f880485f7917ea547a215982 ! Please do not edit these lines, except to modify the commit id ! if you have ported upstream changes. -/ import Mathbin.MeasureTheory.Measure.GiryMonad import Mathbin.Dynamics.Ergodic.MeasurePreserving import Mathbin.MeasureTheory.Integral.SetIntegral import Mathbin.MeasureTheory.Measure.OpenPos /-! # The product measure In this file we define and prove properties about the binary product measure. If `α` and `β` have σ-finite measures `μ` resp. `ν` then `α × β` can be equipped with a σ-finite measure `μ.prod ν` that satisfies `(μ.prod ν) s = ∫⁻ x, ν {y | (x, y) ∈ s} ∂μ`. We also have `(μ.prod ν) (s ×ˢ t) = μ s * ν t`, i.e. the measure of a rectangle is the product of the measures of the sides. We also prove Tonelli's theorem and Fubini's theorem. ## Main definition * `measure_theory.measure.prod`: The product of two measures. ## Main results * `measure_theory.measure.prod_apply` states `μ.prod ν s = ∫⁻ x, ν {y | (x, y) ∈ s} ∂μ` for measurable `s`. `measure_theory.measure.prod_apply_symm` is the reversed version. * `measure_theory.measure.prod_prod` states `μ.prod ν (s ×ˢ t) = μ s * ν t` for measurable sets `s` and `t`. * `measure_theory.lintegral_prod`: Tonelli's theorem. It states that for a measurable function `α × β → ℝ≥0∞` we have `∫⁻ z, f z ∂(μ.prod ν) = ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ`. The version for functions `α → β → ℝ≥0∞` is reversed, and called `lintegral_lintegral`. Both versions have a variant with `_symm` appended, where the order of integration is reversed. The lemma `measurable.lintegral_prod_right'` states that the inner integral of the right-hand side is measurable. * `measure_theory.integrable_prod_iff` states that a binary function is integrable iff both * `y ↦ f (x, y)` is integrable for almost every `x`, and * the function `x ↦ ∫ ‖f (x, y)‖ dy` is integrable. * `measure_theory.integral_prod`: Fubini's theorem. It states that for a integrable function `α × β → E` (where `E` is a second countable Banach space) we have `∫ z, f z ∂(μ.prod ν) = ∫ x, ∫ y, f (x, y) ∂ν ∂μ`. This theorem has the same variants as Tonelli's theorem. The lemma `measure_theory.integrable.integral_prod_right` states that the inner integral of the right-hand side is integrable. ## Implementation Notes Many results are proven twice, once for functions in curried form (`α → β → γ`) and one for functions in uncurried form (`α × β → γ`). The former often has an assumption `measurable (uncurry f)`, which could be inconvenient to discharge, but for the latter it is more common that the function has to be given explicitly, since Lean cannot synthesize the function by itself. We name the lemmas about the uncurried form with a prime. Tonelli's theorem and Fubini's theorem have a different naming scheme, since the version for the uncurried version is reversed. ## Tags product measure, Fubini's theorem, Tonelli's theorem, Fubini-Tonelli theorem -/ noncomputable section open Classical Topology ENNReal MeasureTheory open Set Function Real ENNReal open MeasureTheory MeasurableSpace MeasureTheory.Measure open TopologicalSpace hiding generateFrom open Filter hiding prod_eq map variable {α α' β β' γ E : Type _} /- ./././Mathport/Syntax/Translate/Expr.lean:228:8: unsupported: ambiguous notation -/ /-- Rectangles formed by π-systems form a π-system. -/ theorem IsPiSystem.prod {C : Set (Set α)} {D : Set (Set β)} (hC : IsPiSystem C) (hD : IsPiSystem D) : IsPiSystem (image2 (· ×ˢ ·) C D) := by rintro _ ⟨s₁, t₁, hs₁, ht₁, rfl⟩ _ ⟨s₂, t₂, hs₂, ht₂, rfl⟩ hst rw [prod_inter_prod] at hst⊢; rw [prod_nonempty_iff] at hst exact mem_image2_of_mem (hC _ hs₁ _ hs₂ hst.1) (hD _ ht₁ _ ht₂ hst.2) #align is_pi_system.prod IsPiSystem.prod /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ /- ./././Mathport/Syntax/Translate/Expr.lean:228:8: unsupported: ambiguous notation -/ /-- Rectangles of countably spanning sets are countably spanning. -/ theorem IsCountablySpanning.prod {C : Set (Set α)} {D : Set (Set β)} (hC : IsCountablySpanning C) (hD : IsCountablySpanning D) : IsCountablySpanning (image2 (· ×ˢ ·) C D) := by rcases hC, hD with ⟨⟨s, h1s, h2s⟩, t, h1t, h2t⟩ refine' ⟨fun n => s n.unpair.1 ×ˢ t n.unpair.2, fun n => mem_image2_of_mem (h1s _) (h1t _), _⟩ rw [Union_unpair_prod, h2s, h2t, univ_prod_univ] #align is_countably_spanning.prod IsCountablySpanning.prod variable [MeasurableSpace α] [MeasurableSpace α'] [MeasurableSpace β] [MeasurableSpace β'] variable [MeasurableSpace γ] variable {μ μ' : Measure α} {ν ν' : Measure β} {τ : Measure γ} variable [NormedAddCommGroup E] /-! ### Measurability Before we define the product measure, we can talk about the measurability of operations on binary functions. We show that if `f` is a binary measurable function, then the function that integrates along one of the variables (using either the Lebesgue or Bochner integral) is measurable. -/ /- ./././Mathport/Syntax/Translate/Expr.lean:228:8: unsupported: ambiguous notation -/ /-- The product of generated σ-algebras is the one generated by rectangles, if both generating sets are countably spanning. -/ theorem generateFrom_prod_eq {α β} {C : Set (Set α)} {D : Set (Set β)} (hC : IsCountablySpanning C) (hD : IsCountablySpanning D) : @Prod.measurableSpace _ _ (generateFrom C) (generateFrom D) = generateFrom (image2 (· ×ˢ ·) C D) := by apply le_antisymm · refine' sup_le _ _ <;> rw [comap_generate_from] <;> apply generate_from_le <;> rintro _ ⟨s, hs, rfl⟩ · rcases hD with ⟨t, h1t, h2t⟩ rw [← prod_univ, ← h2t, prod_Union] apply MeasurableSet.unionᵢ intro n apply measurable_set_generate_from exact ⟨s, t n, hs, h1t n, rfl⟩ · rcases hC with ⟨t, h1t, h2t⟩ rw [← univ_prod, ← h2t, Union_prod_const] apply MeasurableSet.unionᵢ rintro n apply measurable_set_generate_from exact mem_image2_of_mem (h1t n) hs · apply generate_from_le rintro _ ⟨s, t, hs, ht, rfl⟩ rw [prod_eq] apply (measurable_fst _).inter (measurable_snd _) · exact measurable_set_generate_from hs · exact measurable_set_generate_from ht #align generate_from_prod_eq generateFrom_prod_eq /- ./././Mathport/Syntax/Translate/Expr.lean:228:8: unsupported: ambiguous notation -/ /-- If `C` and `D` generate the σ-algebras on `α` resp. `β`, then rectangles formed by `C` and `D` generate the σ-algebra on `α × β`. -/ theorem generateFrom_eq_prod {C : Set (Set α)} {D : Set (Set β)} (hC : generateFrom C = ‹_›) (hD : generateFrom D = ‹_›) (h2C : IsCountablySpanning C) (h2D : IsCountablySpanning D) : generateFrom (image2 (· ×ˢ ·) C D) = Prod.measurableSpace := by rw [← hC, ← hD, generateFrom_prod_eq h2C h2D] #align generate_from_eq_prod generateFrom_eq_prod /- ./././Mathport/Syntax/Translate/Expr.lean:228:8: unsupported: ambiguous notation -/ /-- The product σ-algebra is generated from boxes, i.e. `s ×ˢ t` for sets `s : set α` and `t : set β`. -/ theorem generateFrom_prod : generateFrom (image2 (· ×ˢ ·) { s : Set α | MeasurableSet s } { t : Set β | MeasurableSet t }) = Prod.measurableSpace := generateFrom_eq_prod generateFrom_measurableSet generateFrom_measurableSet isCountablySpanning_measurableSet isCountablySpanning_measurableSet #align generate_from_prod generateFrom_prod /- ./././Mathport/Syntax/Translate/Expr.lean:228:8: unsupported: ambiguous notation -/ /-- Rectangles form a π-system. -/ theorem isPiSystem_prod : IsPiSystem (image2 (· ×ˢ ·) { s : Set α | MeasurableSet s } { t : Set β | MeasurableSet t }) := isPiSystem_measurableSet.Prod isPiSystem_measurableSet #align is_pi_system_prod isPiSystem_prod /-- If `ν` is a finite measure, and `s ⊆ α × β` is measurable, then `x ↦ ν { y | (x, y) ∈ s }` is a measurable function. `measurable_measure_prod_mk_left` is strictly more general. -/ theorem measurable_measure_prod_mk_left_finite [IsFiniteMeasure ν] {s : Set (α × β)} (hs : MeasurableSet s) : Measurable fun x => ν (Prod.mk x ⁻¹' s) := by refine' induction_on_inter generate_from_prod.symm isPiSystem_prod _ _ _ _ hs · simp [measurable_zero, const_def] · rintro _ ⟨s, t, hs, ht, rfl⟩ simp only [mk_preimage_prod_right_eq_if, measure_if] exact measurable_const.indicator hs · intro t ht h2t simp_rw [preimage_compl, measure_compl (measurable_prod_mk_left ht) (measure_ne_top ν _)] exact h2t.const_sub _ · intro f h1f h2f h3f simp_rw [preimage_Union] have : ∀ b, ν (⋃ i, Prod.mk b ⁻¹' f i) = ∑' i, ν (Prod.mk b ⁻¹' f i) := fun b => measure_Union (fun i j hij => Disjoint.preimage _ (h1f hij)) fun i => measurable_prod_mk_left (h2f i) simp_rw [this] apply Measurable.eNNReal_tsum h3f #align measurable_measure_prod_mk_left_finite measurable_measure_prod_mk_left_finite /-- If `ν` is a σ-finite measure, and `s ⊆ α × β` is measurable, then `x ↦ ν { y | (x, y) ∈ s }` is a measurable function. -/ theorem measurable_measure_prod_mk_left [SigmaFinite ν] {s : Set (α × β)} (hs : MeasurableSet s) : Measurable fun x => ν (Prod.mk x ⁻¹' s) := by have : ∀ x, MeasurableSet (Prod.mk x ⁻¹' s) := fun x => measurable_prod_mk_left hs simp only [← @supr_restrict_spanning_sets _ _ ν, this] apply measurable_supᵢ; intro i haveI := Fact.mk (measure_spanning_sets_lt_top ν i) exact measurable_measure_prod_mk_left_finite hs #align measurable_measure_prod_mk_left measurable_measure_prod_mk_left /-- If `μ` is a σ-finite measure, and `s ⊆ α × β` is measurable, then `y ↦ μ { x | (x, y) ∈ s }` is a measurable function. -/ theorem measurable_measure_prod_mk_right {μ : Measure α} [SigmaFinite μ] {s : Set (α × β)} (hs : MeasurableSet s) : Measurable fun y => μ ((fun x => (x, y)) ⁻¹' s) := measurable_measure_prod_mk_left (measurableSet_swap_iff.mpr hs) #align measurable_measure_prod_mk_right measurable_measure_prod_mk_right theorem Measurable.map_prod_mk_left [SigmaFinite ν] : Measurable fun x : α => map (Prod.mk x) ν := by apply measurable_of_measurable_coe; intro s hs simp_rw [map_apply measurable_prod_mk_left hs] exact measurable_measure_prod_mk_left hs #align measurable.map_prod_mk_left Measurable.map_prod_mk_left theorem Measurable.map_prod_mk_right {μ : Measure α} [SigmaFinite μ] : Measurable fun y : β => map (fun x : α => (x, y)) μ := by apply measurable_of_measurable_coe; intro s hs simp_rw [map_apply measurable_prod_mk_right hs] exact measurable_measure_prod_mk_right hs #align measurable.map_prod_mk_right Measurable.map_prod_mk_right /-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of) Tonelli's theorem is measurable. -/ theorem Measurable.lintegral_prod_right' [SigmaFinite ν] : ∀ {f : α × β → ℝ≥0∞} (hf : Measurable f), Measurable fun x => ∫⁻ y, f (x, y) ∂ν := by have m := @measurable_prod_mk_left refine' Measurable.eNNReal_induction _ _ _ · intro c s hs simp only [← indicator_comp_right] suffices Measurable fun x => c * ν (Prod.mk x ⁻¹' s) by simpa [lintegral_indicator _ (m hs)] exact (measurable_measure_prod_mk_left hs).const_mul _ · rintro f g - hf hg h2f h2g simp_rw [Pi.add_apply, lintegral_add_left (hf.comp m)] exact h2f.add h2g · intro f hf h2f h3f have := measurable_supᵢ h3f have : ∀ x, Monotone fun n y => f n (x, y) := fun x i j hij y => h2f hij (x, y) simpa [lintegral_supr fun n => (hf n).comp m, this] #align measurable.lintegral_prod_right' Measurable.lintegral_prod_right' /-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of) Tonelli's theorem is measurable. This version has the argument `f` in curried form. -/ theorem Measurable.lintegral_prod_right [SigmaFinite ν] {f : α → β → ℝ≥0∞} (hf : Measurable (uncurry f)) : Measurable fun x => ∫⁻ y, f x y ∂ν := hf.lintegral_prod_right' #align measurable.lintegral_prod_right Measurable.lintegral_prod_right /-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of) the symmetric version of Tonelli's theorem is measurable. -/ theorem Measurable.lintegral_prod_left' [SigmaFinite μ] {f : α × β → ℝ≥0∞} (hf : Measurable f) : Measurable fun y => ∫⁻ x, f (x, y) ∂μ := (measurable_swap_iff.mpr hf).lintegral_prod_right' #align measurable.lintegral_prod_left' Measurable.lintegral_prod_left' /-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of) the symmetric version of Tonelli's theorem is measurable. This version has the argument `f` in curried form. -/ theorem Measurable.lintegral_prod_left [SigmaFinite μ] {f : α → β → ℝ≥0∞} (hf : Measurable (uncurry f)) : Measurable fun y => ∫⁻ x, f x y ∂μ := hf.lintegral_prod_left' #align measurable.lintegral_prod_left Measurable.lintegral_prod_left theorem measurableSet_integrable [SigmaFinite ν] ⦃f : α → β → E⦄ (hf : StronglyMeasurable (uncurry f)) : MeasurableSet { x | Integrable (f x) ν } := by simp_rw [integrable, hf.of_uncurry_left.ae_strongly_measurable, true_and_iff] exact measurableSet_lt (Measurable.lintegral_prod_right hf.ennnorm) measurable_const #align measurable_set_integrable measurableSet_integrable section variable [NormedSpace ℝ E] [CompleteSpace E] /-- The Bochner integral is measurable. This shows that the integrand of (the right-hand-side of) Fubini's theorem is measurable. This version has `f` in curried form. -/ theorem MeasureTheory.StronglyMeasurable.integral_prod_right [SigmaFinite ν] ⦃f : α → β → E⦄ (hf : StronglyMeasurable (uncurry f)) : StronglyMeasurable fun x => ∫ y, f x y ∂ν := by borelize E haveI : separable_space (range (uncurry f) ∪ {0} : Set E) := hf.separable_space_range_union_singleton let s : ℕ → simple_func (α × β) E := simple_func.approx_on _ hf.measurable (range (uncurry f) ∪ {0}) 0 (by simp) let s' : ℕ → α → simple_func β E := fun n x => (s n).comp (Prod.mk x) measurable_prod_mk_left let f' : ℕ → α → E := fun n => { x | integrable (f x) ν }.indicator fun x => (s' n x).integral ν have hf' : ∀ n, strongly_measurable (f' n) := by intro n refine' strongly_measurable.indicator _ (measurableSet_integrable hf) have : ∀ x, ((s' n x).range.filterₓ fun x => x ≠ 0) ⊆ (s n).range := by intro x refine' Finset.Subset.trans (Finset.filter_subset _ _) _ intro y simp_rw [simple_func.mem_range] rintro ⟨z, rfl⟩ exact ⟨(x, z), rfl⟩ simp only [simple_func.integral_eq_sum_of_subset (this _)] refine' Finset.stronglyMeasurable_sum _ fun x _ => _ refine' (Measurable.eNNReal_toReal _).StronglyMeasurable.smul_const _ simp (config := { singlePass := true }) only [simple_func.coe_comp, preimage_comp] apply measurable_measure_prod_mk_left exact (s n).measurableSet_fiber x have h2f' : tendsto f' at_top (𝓝 fun x : α => ∫ y : β, f x y ∂ν) := by rw [tendsto_pi_nhds] intro x by_cases hfx : integrable (f x) ν · have : ∀ n, integrable (s' n x) ν := by intro n apply (hfx.norm.add hfx.norm).mono' (s' n x).AeStronglyMeasurable apply eventually_of_forall intro y simp_rw [s', simple_func.coe_comp] exact simple_func.norm_approx_on_zero_le _ _ (x, y) n simp only [f', hfx, simple_func.integral_eq_integral _ (this _), indicator_of_mem, mem_set_of_eq] refine' tendsto_integral_of_dominated_convergence (fun y => ‖f x y‖ + ‖f x y‖) (fun n => (s' n x).AeStronglyMeasurable) (hfx.norm.add hfx.norm) _ _ · exact fun n => eventually_of_forall fun y => simple_func.norm_approx_on_zero_le _ _ (x, y) n · refine' eventually_of_forall fun y => simple_func.tendsto_approx_on _ _ _ apply subset_closure simp [-uncurry_apply_pair] · simp [f', hfx, integral_undef] exact stronglyMeasurable_of_tendsto _ hf' h2f' #align measure_theory.strongly_measurable.integral_prod_right MeasureTheory.StronglyMeasurable.integral_prod_right /-- The Bochner integral is measurable. This shows that the integrand of (the right-hand-side of) Fubini's theorem is measurable. -/ theorem MeasureTheory.StronglyMeasurable.integral_prod_right' [SigmaFinite ν] ⦃f : α × β → E⦄ (hf : StronglyMeasurable f) : StronglyMeasurable fun x => ∫ y, f (x, y) ∂ν := by rw [← uncurry_curry f] at hf exact hf.integral_prod_right #align measure_theory.strongly_measurable.integral_prod_right' MeasureTheory.StronglyMeasurable.integral_prod_right' /-- The Bochner integral is measurable. This shows that the integrand of (the right-hand-side of) the symmetric version of Fubini's theorem is measurable. This version has `f` in curried form. -/ theorem MeasureTheory.StronglyMeasurable.integral_prod_left [SigmaFinite μ] ⦃f : α → β → E⦄ (hf : StronglyMeasurable (uncurry f)) : StronglyMeasurable fun y => ∫ x, f x y ∂μ := (hf.compMeasurable measurable_swap).integral_prod_right' #align measure_theory.strongly_measurable.integral_prod_left MeasureTheory.StronglyMeasurable.integral_prod_left /-- The Bochner integral is measurable. This shows that the integrand of (the right-hand-side of) the symmetric version of Fubini's theorem is measurable. -/ theorem MeasureTheory.StronglyMeasurable.integral_prod_left' [SigmaFinite μ] ⦃f : α × β → E⦄ (hf : StronglyMeasurable f) : StronglyMeasurable fun y => ∫ x, f (x, y) ∂μ := (hf.compMeasurable measurable_swap).integral_prod_right' #align measure_theory.strongly_measurable.integral_prod_left' MeasureTheory.StronglyMeasurable.integral_prod_left' end /-! ### The product measure -/ namespace MeasureTheory namespace Measure /-- The binary product of measures. They are defined for arbitrary measures, but we basically prove all properties under the assumption that at least one of them is σ-finite. -/ protected irreducible_def prod (μ : Measure α) (ν : Measure β) : Measure (α × β) := bind μ fun x : α => map (Prod.mk x) ν #align measure_theory.measure.prod MeasureTheory.Measure.prod instance prod.measureSpace {α β} [MeasureSpace α] [MeasureSpace β] : MeasureSpace (α × β) where volume := volume.Prod volume #align measure_theory.measure.prod.measure_space MeasureTheory.Measure.prod.measureSpace variable [SigmaFinite ν] theorem volume_eq_prod (α β) [MeasureSpace α] [MeasureSpace β] : (volume : Measure (α × β)) = (volume : Measure α).Prod (volume : Measure β) := rfl #align measure_theory.measure.volume_eq_prod MeasureTheory.Measure.volume_eq_prod theorem prod_apply {s : Set (α × β)} (hs : MeasurableSet s) : μ.Prod ν s = ∫⁻ x, ν (Prod.mk x ⁻¹' s) ∂μ := by simp_rw [measure.prod, bind_apply hs Measurable.map_prod_mk_left, map_apply measurable_prod_mk_left hs] #align measure_theory.measure.prod_apply MeasureTheory.Measure.prod_apply /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ /-- The product measure of the product of two sets is the product of their measures. Note that we do not need the sets to be measurable. -/ @[simp] theorem prod_prod (s : Set α) (t : Set β) : μ.Prod ν (s ×ˢ t) = μ s * ν t := by apply le_antisymm · set ST := to_measurable μ s ×ˢ to_measurable ν t have hSTm : MeasurableSet ST := (measurable_set_to_measurable _ _).Prod (measurable_set_to_measurable _ _) calc μ.prod ν (s ×ˢ t) ≤ μ.prod ν ST := measure_mono <| Set.prod_mono (subset_to_measurable _ _) (subset_to_measurable _ _) _ = μ (to_measurable μ s) * ν (to_measurable ν t) := by simp_rw [prod_apply hSTm, mk_preimage_prod_right_eq_if, measure_if, lintegral_indicator _ (measurable_set_to_measurable _ _), lintegral_const, restrict_apply_univ, mul_comm] _ = μ s * ν t := by rw [measure_to_measurable, measure_to_measurable] · -- Formalization is based on https://mathoverflow.net/a/254134/136589 set ST := to_measurable (μ.prod ν) (s ×ˢ t) have hSTm : MeasurableSet ST := measurable_set_to_measurable _ _ have hST : s ×ˢ t ⊆ ST := subset_to_measurable _ _ set f : α → ℝ≥0∞ := fun x => ν (Prod.mk x ⁻¹' ST) have hfm : Measurable f := measurable_measure_prod_mk_left hSTm set s' : Set α := { x | ν t ≤ f x } have hss' : s ⊆ s' := fun x hx => measure_mono fun y hy => hST <| mk_mem_prod hx hy calc μ s * ν t ≤ μ s' * ν t := mul_le_mul_right' (measure_mono hss') _ _ = ∫⁻ x in s', ν t ∂μ := by rw [set_lintegral_const, mul_comm] _ ≤ ∫⁻ x in s', f x ∂μ := (set_lintegral_mono measurable_const hfm fun x => id) _ ≤ ∫⁻ x, f x ∂μ := (lintegral_mono' restrict_le_self le_rfl) _ = μ.prod ν ST := (prod_apply hSTm).symm _ = μ.prod ν (s ×ˢ t) := measure_to_measurable _ #align measure_theory.measure.prod_prod MeasureTheory.Measure.prod_prod instance {X Y : Type _} [TopologicalSpace X] [TopologicalSpace Y] {m : MeasurableSpace X} {μ : Measure X} [IsOpenPosMeasure μ] {m' : MeasurableSpace Y} {ν : Measure Y} [IsOpenPosMeasure ν] [SigmaFinite ν] : IsOpenPosMeasure (μ.Prod ν) := by constructor rintro U U_open ⟨⟨x, y⟩, hxy⟩ rcases isOpen_prod_iff.1 U_open x y hxy with ⟨u, v, u_open, v_open, xu, yv, huv⟩ refine' ne_of_gt (lt_of_lt_of_le _ (measure_mono huv)) simp only [prod_prod, CanonicallyOrderedCommSemiring.mul_pos] constructor · exact u_open.measure_pos μ ⟨x, xu⟩ · exact v_open.measure_pos ν ⟨y, yv⟩ instance {α β : Type _} {mα : MeasurableSpace α} {mβ : MeasurableSpace β} (μ : Measure α) (ν : Measure β) [IsFiniteMeasure μ] [IsFiniteMeasure ν] : IsFiniteMeasure (μ.Prod ν) := by constructor rw [← univ_prod_univ, prod_prod] exact mul_lt_top (measure_lt_top _ _).Ne (measure_lt_top _ _).Ne instance {α β : Type _} {mα : MeasurableSpace α} {mβ : MeasurableSpace β} (μ : Measure α) (ν : Measure β) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] : IsProbabilityMeasure (μ.Prod ν) := ⟨by rw [← univ_prod_univ, prod_prod, measure_univ, measure_univ, mul_one]⟩ /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ instance {α β : Type _} [TopologicalSpace α] [TopologicalSpace β] {mα : MeasurableSpace α} {mβ : MeasurableSpace β} (μ : Measure α) (ν : Measure β) [IsFiniteMeasureOnCompacts μ] [IsFiniteMeasureOnCompacts ν] [SigmaFinite ν] : IsFiniteMeasureOnCompacts (μ.Prod ν) := by refine' ⟨fun K hK => _⟩ set L := (Prod.fst '' K) ×ˢ (Prod.snd '' K) with hL have : K ⊆ L := by rintro ⟨x, y⟩ hxy simp only [prod_mk_mem_set_prod_eq, mem_image, Prod.exists, exists_and_right, exists_eq_right] exact ⟨⟨y, hxy⟩, ⟨x, hxy⟩⟩ apply lt_of_le_of_lt (measure_mono this) rw [hL, prod_prod] exact mul_lt_top (IsCompact.measure_lt_top (hK.image continuous_fst)).Ne (IsCompact.measure_lt_top (hK.image continuous_snd)).Ne theorem ae_measure_lt_top {s : Set (α × β)} (hs : MeasurableSet s) (h2s : (μ.Prod ν) s ≠ ∞) : ∀ᵐ x ∂μ, ν (Prod.mk x ⁻¹' s) < ∞ := by simp_rw [prod_apply hs] at h2s refine' ae_lt_top (measurable_measure_prod_mk_left hs) h2s #align measure_theory.measure.ae_measure_lt_top MeasureTheory.Measure.ae_measure_lt_top theorem integrableMeasureProdMkLeft {s : Set (α × β)} (hs : MeasurableSet s) (h2s : (μ.Prod ν) s ≠ ∞) : Integrable (fun x => (ν (Prod.mk x ⁻¹' s)).toReal) μ := by refine' ⟨(measurable_measure_prod_mk_left hs).eNNReal_toReal.AeMeasurable.AeStronglyMeasurable, _⟩ simp_rw [has_finite_integral, ennnorm_eq_of_real to_real_nonneg] convert h2s.lt_top using 1; simp_rw [prod_apply hs]; apply lintegral_congr_ae refine' (ae_measure_lt_top hs h2s).mp _; apply eventually_of_forall; intro x hx rw [lt_top_iff_ne_top] at hx; simp [of_real_to_real, hx] #align measure_theory.measure.integrable_measure_prod_mk_left MeasureTheory.Measure.integrableMeasureProdMkLeft /-- Note: the assumption `hs` cannot be dropped. For a counterexample, see Walter Rudin *Real and Complex Analysis*, example (c) in section 8.9. -/ theorem measure_prod_null {s : Set (α × β)} (hs : MeasurableSet s) : μ.Prod ν s = 0 ↔ (fun x => ν (Prod.mk x ⁻¹' s)) =ᵐ[μ] 0 := by simp_rw [prod_apply hs, lintegral_eq_zero_iff (measurable_measure_prod_mk_left hs)] #align measure_theory.measure.measure_prod_null MeasureTheory.Measure.measure_prod_null /-- Note: the converse is not true without assuming that `s` is measurable. For a counterexample, see Walter Rudin *Real and Complex Analysis*, example (c) in section 8.9. -/ theorem measure_ae_null_of_prod_null {s : Set (α × β)} (h : μ.Prod ν s = 0) : (fun x => ν (Prod.mk x ⁻¹' s)) =ᵐ[μ] 0 := by obtain ⟨t, hst, mt, ht⟩ := exists_measurable_superset_of_null h simp_rw [measure_prod_null mt] at ht rw [eventually_le_antisymm_iff] exact ⟨eventually_le.trans_eq (eventually_of_forall fun x => (measure_mono (preimage_mono hst) : _)) ht, eventually_of_forall fun x => zero_le _⟩ #align measure_theory.measure.measure_ae_null_of_prod_null MeasureTheory.Measure.measure_ae_null_of_prod_null theorem AbsolutelyContinuous.prod [SigmaFinite ν'] (h1 : μ ≪ μ') (h2 : ν ≪ ν') : μ.Prod ν ≪ μ'.Prod ν' := by refine' absolutely_continuous.mk fun s hs h2s => _ simp_rw [measure_prod_null hs] at h2s⊢ exact (h2s.filter_mono h1.ae_le).mono fun _ h => h2 h #align measure_theory.measure.absolutely_continuous.prod MeasureTheory.Measure.AbsolutelyContinuous.prod /-- Note: the converse is not true. For a counterexample, see Walter Rudin *Real and Complex Analysis*, example (c) in section 8.9. -/ theorem ae_ae_of_ae_prod {p : α × β → Prop} (h : ∀ᵐ z ∂μ.Prod ν, p z) : ∀ᵐ x ∂μ, ∀ᵐ y ∂ν, p (x, y) := measure_ae_null_of_prod_null h #align measure_theory.measure.ae_ae_of_ae_prod MeasureTheory.Measure.ae_ae_of_ae_prod /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ /- ./././Mathport/Syntax/Translate/Expr.lean:228:8: unsupported: ambiguous notation -/ /-- `μ.prod ν` has finite spanning sets in rectangles of finite spanning sets. -/ noncomputable def FiniteSpanningSetsIn.prod {ν : Measure β} {C : Set (Set α)} {D : Set (Set β)} (hμ : μ.FiniteSpanningSetsIn C) (hν : ν.FiniteSpanningSetsIn D) : (μ.Prod ν).FiniteSpanningSetsIn (image2 (· ×ˢ ·) C D) := by haveI := hν.sigma_finite refine' ⟨fun n => hμ.set n.unpair.1 ×ˢ hν.set n.unpair.2, fun n => mem_image2_of_mem (hμ.set_mem _) (hν.set_mem _), fun n => _, _⟩ · rw [prod_prod] exact mul_lt_top (hμ.finite _).Ne (hν.finite _).Ne · simp_rw [Union_unpair_prod, hμ.spanning, hν.spanning, univ_prod_univ] #align measure_theory.measure.finite_spanning_sets_in.prod MeasureTheory.Measure.FiniteSpanningSetsIn.prod theorem quasiMeasurePreservingFst : QuasiMeasurePreserving Prod.fst (μ.Prod ν) μ := by refine' ⟨measurable_fst, absolutely_continuous.mk fun s hs h2s => _⟩ rw [map_apply measurable_fst hs, ← prod_univ, prod_prod, h2s, MulZeroClass.zero_mul] #align measure_theory.measure.quasi_measure_preserving_fst MeasureTheory.Measure.quasiMeasurePreservingFst theorem quasiMeasurePreservingSnd : QuasiMeasurePreserving Prod.snd (μ.Prod ν) ν := by refine' ⟨measurable_snd, absolutely_continuous.mk fun s hs h2s => _⟩ rw [map_apply measurable_snd hs, ← univ_prod, prod_prod, h2s, MulZeroClass.mul_zero] #align measure_theory.measure.quasi_measure_preserving_snd MeasureTheory.Measure.quasiMeasurePreservingSnd variable [SigmaFinite μ] instance prod.sigmaFinite : SigmaFinite (μ.Prod ν) := (μ.toFiniteSpanningSetsIn.Prod ν.toFiniteSpanningSetsIn).SigmaFinite #align measure_theory.measure.prod.sigma_finite MeasureTheory.Measure.prod.sigmaFinite /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ /-- A measure on a product space equals the product measure if they are equal on rectangles with as sides sets that generate the corresponding σ-algebras. -/ theorem prod_eq_generateFrom {μ : Measure α} {ν : Measure β} {C : Set (Set α)} {D : Set (Set β)} (hC : generateFrom C = ‹_›) (hD : generateFrom D = ‹_›) (h2C : IsPiSystem C) (h2D : IsPiSystem D) (h3C : μ.FiniteSpanningSetsIn C) (h3D : ν.FiniteSpanningSetsIn D) {μν : Measure (α × β)} (h₁ : ∀ s ∈ C, ∀ t ∈ D, μν (s ×ˢ t) = μ s * ν t) : μ.Prod ν = μν := by refine' (h3C.prod h3D).ext (generateFrom_eq_prod hC hD h3C.is_countably_spanning h3D.is_countably_spanning).symm (h2C.prod h2D) _ · rintro _ ⟨s, t, hs, ht, rfl⟩ haveI := h3D.sigma_finite rw [h₁ s hs t ht, prod_prod] #align measure_theory.measure.prod_eq_generate_from MeasureTheory.Measure.prod_eq_generateFrom /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ /-- A measure on a product space equals the product measure if they are equal on rectangles. -/ theorem prod_eq {μν : Measure (α × β)} (h : ∀ s t, MeasurableSet s → MeasurableSet t → μν (s ×ˢ t) = μ s * ν t) : μ.Prod ν = μν := prod_eq_generateFrom generateFrom_measurableSet generateFrom_measurableSet isPiSystem_measurableSet isPiSystem_measurableSet μ.toFiniteSpanningSetsIn ν.toFiniteSpanningSetsIn fun s hs t ht => h s t hs ht #align measure_theory.measure.prod_eq MeasureTheory.Measure.prod_eq theorem prod_swap : map Prod.swap (μ.Prod ν) = ν.Prod μ := by refine' (prod_eq _).symm intro s t hs ht simp_rw [map_apply measurable_swap (hs.prod ht), preimage_swap_prod, prod_prod, mul_comm] #align measure_theory.measure.prod_swap MeasureTheory.Measure.prod_swap theorem measurePreservingSwap : MeasurePreserving Prod.swap (μ.Prod ν) (ν.Prod μ) := ⟨measurable_swap, prod_swap⟩ #align measure_theory.measure.measure_preserving_swap MeasureTheory.Measure.measurePreservingSwap theorem prod_apply_symm {s : Set (α × β)} (hs : MeasurableSet s) : μ.Prod ν s = ∫⁻ y, μ ((fun x => (x, y)) ⁻¹' s) ∂ν := by rw [← prod_swap, map_apply measurable_swap hs] simp only [prod_apply (measurable_swap hs)] rfl #align measure_theory.measure.prod_apply_symm MeasureTheory.Measure.prod_apply_symm theorem prodAssoc_prod [SigmaFinite τ] : map MeasurableEquiv.prodAssoc ((μ.Prod ν).Prod τ) = μ.Prod (ν.Prod τ) := by refine' (prod_eq_generateFrom generate_from_measurable_set generateFrom_prod is_pi_system_measurable_set isPiSystem_prod μ.to_finite_spanning_sets_in (ν.to_finite_spanning_sets_in.prod τ.to_finite_spanning_sets_in) _).symm rintro s hs _ ⟨t, u, ht, hu, rfl⟩; rw [mem_set_of_eq] at hs ht hu simp_rw [map_apply (MeasurableEquiv.measurable _) (hs.prod (ht.prod hu)), MeasurableEquiv.prodAssoc, MeasurableEquiv.coe_mk, Equiv.prod_assoc_preimage, prod_prod, mul_assoc] #align measure_theory.measure.prod_assoc_prod MeasureTheory.Measure.prodAssoc_prod /-! ### The product of specific measures -/ /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ theorem prod_restrict (s : Set α) (t : Set β) : (μ.restrict s).Prod (ν.restrict t) = (μ.Prod ν).restrict (s ×ˢ t) := by refine' prod_eq fun s' t' hs' ht' => _ rw [restrict_apply (hs'.prod ht'), prod_inter_prod, prod_prod, restrict_apply hs', restrict_apply ht'] #align measure_theory.measure.prod_restrict MeasureTheory.Measure.prod_restrict /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ theorem restrict_prod_eq_prod_univ (s : Set α) : (μ.restrict s).Prod ν = (μ.Prod ν).restrict (s ×ˢ (univ : Set β)) := by have : ν = ν.restrict Set.univ := measure.restrict_univ.symm rwa [this, measure.prod_restrict, ← this] #align measure_theory.measure.restrict_prod_eq_prod_univ MeasureTheory.Measure.restrict_prod_eq_prod_univ theorem prod_dirac (y : β) : μ.Prod (dirac y) = map (fun x => (x, y)) μ := by refine' prod_eq fun s t hs ht => _ simp_rw [map_apply measurable_prod_mk_right (hs.prod ht), mk_preimage_prod_left_eq_if, measure_if, dirac_apply' _ ht, ← indicator_mul_right _ fun x => μ s, Pi.one_apply, mul_one] #align measure_theory.measure.prod_dirac MeasureTheory.Measure.prod_dirac theorem dirac_prod (x : α) : (dirac x).Prod ν = map (Prod.mk x) ν := by refine' prod_eq fun s t hs ht => _ simp_rw [map_apply measurable_prod_mk_left (hs.prod ht), mk_preimage_prod_right_eq_if, measure_if, dirac_apply' _ hs, ← indicator_mul_left _ _ fun x => ν t, Pi.one_apply, one_mul] #align measure_theory.measure.dirac_prod MeasureTheory.Measure.dirac_prod theorem dirac_prod_dirac {x : α} {y : β} : (dirac x).Prod (dirac y) = dirac (x, y) := by rw [prod_dirac, map_dirac measurable_prod_mk_right] #align measure_theory.measure.dirac_prod_dirac MeasureTheory.Measure.dirac_prod_dirac theorem prod_sum {ι : Type _} [Finite ι] (ν : ι → Measure β) [∀ i, SigmaFinite (ν i)] : μ.Prod (sum ν) = sum fun i => μ.Prod (ν i) := by refine' prod_eq fun s t hs ht => _ simp_rw [sum_apply _ (hs.prod ht), sum_apply _ ht, prod_prod, ENNReal.tsum_mul_left] #align measure_theory.measure.prod_sum MeasureTheory.Measure.prod_sum theorem sum_prod {ι : Type _} [Finite ι] (μ : ι → Measure α) [∀ i, SigmaFinite (μ i)] : (sum μ).Prod ν = sum fun i => (μ i).Prod ν := by refine' prod_eq fun s t hs ht => _ simp_rw [sum_apply _ (hs.prod ht), sum_apply _ hs, prod_prod, ENNReal.tsum_mul_right] #align measure_theory.measure.sum_prod MeasureTheory.Measure.sum_prod theorem prod_add (ν' : Measure β) [SigmaFinite ν'] : μ.Prod (ν + ν') = μ.Prod ν + μ.Prod ν' := by refine' prod_eq fun s t hs ht => _ simp_rw [add_apply, prod_prod, left_distrib] #align measure_theory.measure.prod_add MeasureTheory.Measure.prod_add theorem add_prod (μ' : Measure α) [SigmaFinite μ'] : (μ + μ').Prod ν = μ.Prod ν + μ'.Prod ν := by refine' prod_eq fun s t hs ht => _ simp_rw [add_apply, prod_prod, right_distrib] #align measure_theory.measure.add_prod MeasureTheory.Measure.add_prod @[simp] theorem zero_prod (ν : Measure β) : (0 : Measure α).Prod ν = 0 := by rw [measure.prod] exact bind_zero_left _ #align measure_theory.measure.zero_prod MeasureTheory.Measure.zero_prod @[simp] theorem prod_zero (μ : Measure α) : μ.Prod (0 : Measure β) = 0 := by simp [measure.prod] #align measure_theory.measure.prod_zero MeasureTheory.Measure.prod_zero theorem map_prod_map {δ} [MeasurableSpace δ] {f : α → β} {g : γ → δ} {μa : Measure α} {μc : Measure γ} (hfa : SigmaFinite (map f μa)) (hgc : SigmaFinite (map g μc)) (hf : Measurable f) (hg : Measurable g) : (map f μa).Prod (map g μc) = map (Prod.map f g) (μa.Prod μc) := by haveI := hgc.of_map μc hg.ae_measurable refine' prod_eq fun s t hs ht => _ rw [map_apply (hf.prod_map hg) (hs.prod ht), map_apply hf hs, map_apply hg ht] exact prod_prod (f ⁻¹' s) (g ⁻¹' t) #align measure_theory.measure.map_prod_map MeasureTheory.Measure.map_prod_map end Measure open Measure namespace MeasurePreserving variable {δ : Type _} [MeasurableSpace δ] {μa : Measure α} {μb : Measure β} {μc : Measure γ} {μd : Measure δ} /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ theorem skewProduct [SigmaFinite μb] [SigmaFinite μd] {f : α → β} (hf : MeasurePreserving f μa μb) {g : α → γ → δ} (hgm : Measurable (uncurry g)) (hg : ∀ᵐ x ∂μa, map (g x) μc = μd) : MeasurePreserving (fun p : α × γ => (f p.1, g p.1 p.2)) (μa.Prod μc) (μb.Prod μd) := by classical have : Measurable fun p : α × γ => (f p.1, g p.1 p.2) := (hf.1.comp measurable_fst).prod_mk hgm /- if `μa = 0`, then the lemma is trivial, otherwise we can use `hg` to deduce `sigma_finite μc`. -/ rcases eq_or_ne μa 0 with (rfl | ha) · rw [← hf.map_eq, zero_prod, measure.map_zero, zero_prod] exact ⟨this, by simp only [measure.map_zero]⟩ have : sigma_finite μc := by rcases(ae_ne_bot.2 ha).nonempty_of_mem hg with ⟨x, hx : map (g x) μc = μd⟩ exact sigma_finite.of_map _ hgm.of_uncurry_left.ae_measurable (by rwa [hx]) -- Thus we can apply `measure.prod_eq` to prove equality of measures. refine' ⟨this, (prod_eq fun s t hs ht => _).symm⟩ rw [map_apply this (hs.prod ht)] refine' (prod_apply (this <| hs.prod ht)).trans _ have : ∀ᵐ x ∂μa, μc ((fun y => (f x, g x y)) ⁻¹' s ×ˢ t) = indicator (f ⁻¹' s) (fun y => μd t) x := by refine' hg.mono fun x hx => _ subst hx simp only [mk_preimage_prod_right_fn_eq_if, indicator_apply, mem_preimage] split_ifs exacts[(map_apply hgm.of_uncurry_left ht).symm, measure_empty] simp only [preimage_preimage] rw [lintegral_congr_ae this, lintegral_indicator _ (hf.1 hs), set_lintegral_const, hf.measure_preimage hs, mul_comm] #align measure_theory.measure_preserving.skew_product MeasureTheory.MeasurePreserving.skewProduct /-- If `f : α → β` sends the measure `μa` to `μb` and `g : γ → δ` sends the measure `μc` to `μd`, then `prod.map f g` sends `μa.prod μc` to `μb.prod μd`. -/ protected theorem prod [SigmaFinite μb] [SigmaFinite μd] {f : α → β} {g : γ → δ} (hf : MeasurePreserving f μa μb) (hg : MeasurePreserving g μc μd) : MeasurePreserving (Prod.map f g) (μa.Prod μc) (μb.Prod μd) := have : Measurable (uncurry fun _ : α => g) := hg.1.comp measurable_snd hf.skewProduct this <| Filter.eventually_of_forall fun _ => hg.map_eq #align measure_theory.measure_preserving.prod MeasureTheory.MeasurePreserving.prod end MeasurePreserving namespace QuasiMeasurePreserving theorem prodOfRight {f : α × β → γ} {μ : Measure α} {ν : Measure β} {τ : Measure γ} (hf : Measurable f) [SigmaFinite ν] (h2f : ∀ᵐ x ∂μ, QuasiMeasurePreserving (fun y => f (x, y)) ν τ) : QuasiMeasurePreserving f (μ.Prod ν) τ := by refine' ⟨hf, _⟩ refine' absolutely_continuous.mk fun s hs h2s => _ simp_rw [map_apply hf hs, prod_apply (hf hs), preimage_preimage, lintegral_congr_ae (h2f.mono fun x hx => hx.preimage_null h2s), lintegral_zero] #align measure_theory.quasi_measure_preserving.prod_of_right MeasureTheory.QuasiMeasurePreserving.prodOfRight theorem prodOfLeft {α β γ} [MeasurableSpace α] [MeasurableSpace β] [MeasurableSpace γ] {f : α × β → γ} {μ : Measure α} {ν : Measure β} {τ : Measure γ} (hf : Measurable f) [SigmaFinite μ] [SigmaFinite ν] (h2f : ∀ᵐ y ∂ν, QuasiMeasurePreserving (fun x => f (x, y)) μ τ) : QuasiMeasurePreserving f (μ.Prod ν) τ := by rw [← prod_swap] convert(quasi_measure_preserving.prod_of_right (hf.comp measurable_swap) h2f).comp ((measurable_swap.measure_preserving (ν.prod μ)).symm MeasurableEquiv.prodComm).QuasiMeasurePreserving ext ⟨x, y⟩; rfl #align measure_theory.quasi_measure_preserving.prod_of_left MeasureTheory.QuasiMeasurePreserving.prodOfLeft end QuasiMeasurePreserving end MeasureTheory open MeasureTheory.Measure section theorem AeMeasurable.prodSwap [SigmaFinite μ] [SigmaFinite ν] {f : β × α → γ} (hf : AeMeasurable f (ν.Prod μ)) : AeMeasurable (fun z : α × β => f z.symm) (μ.Prod ν) := by rw [← prod_swap] at hf exact hf.comp_measurable measurable_swap #align ae_measurable.prod_swap AeMeasurable.prodSwap theorem MeasureTheory.AeStronglyMeasurable.prodSwap {γ : Type _} [TopologicalSpace γ] [SigmaFinite μ] [SigmaFinite ν] {f : β × α → γ} (hf : AeStronglyMeasurable f (ν.Prod μ)) : AeStronglyMeasurable (fun z : α × β => f z.symm) (μ.Prod ν) := by rw [← prod_swap] at hf exact hf.comp_measurable measurable_swap #align measure_theory.ae_strongly_measurable.prod_swap MeasureTheory.AeStronglyMeasurable.prodSwap theorem AeMeasurable.fst [SigmaFinite ν] {f : α → γ} (hf : AeMeasurable f μ) : AeMeasurable (fun z : α × β => f z.1) (μ.Prod ν) := hf.compQuasiMeasurePreserving quasiMeasurePreservingFst #align ae_measurable.fst AeMeasurable.fst theorem AeMeasurable.snd [SigmaFinite ν] {f : β → γ} (hf : AeMeasurable f ν) : AeMeasurable (fun z : α × β => f z.2) (μ.Prod ν) := hf.compQuasiMeasurePreserving quasiMeasurePreservingSnd #align ae_measurable.snd AeMeasurable.snd theorem MeasureTheory.AeStronglyMeasurable.fst {γ} [TopologicalSpace γ] [SigmaFinite ν] {f : α → γ} (hf : AeStronglyMeasurable f μ) : AeStronglyMeasurable (fun z : α × β => f z.1) (μ.Prod ν) := hf.compQuasiMeasurePreserving quasiMeasurePreservingFst #align measure_theory.ae_strongly_measurable.fst MeasureTheory.AeStronglyMeasurable.fst theorem MeasureTheory.AeStronglyMeasurable.snd {γ} [TopologicalSpace γ] [SigmaFinite ν] {f : β → γ} (hf : AeStronglyMeasurable f ν) : AeStronglyMeasurable (fun z : α × β => f z.2) (μ.Prod ν) := hf.compQuasiMeasurePreserving quasiMeasurePreservingSnd #align measure_theory.ae_strongly_measurable.snd MeasureTheory.AeStronglyMeasurable.snd /-- The Bochner integral is a.e.-measurable. This shows that the integrand of (the right-hand-side of) Fubini's theorem is a.e.-measurable. -/ theorem MeasureTheory.AeStronglyMeasurable.integralProdRight' [SigmaFinite ν] [NormedSpace ℝ E] [CompleteSpace E] ⦃f : α × β → E⦄ (hf : AeStronglyMeasurable f (μ.Prod ν)) : AeStronglyMeasurable (fun x => ∫ y, f (x, y) ∂ν) μ := ⟨fun x => ∫ y, hf.mk f (x, y) ∂ν, hf.stronglyMeasurable_mk.integral_prod_right', by filter_upwards [ae_ae_of_ae_prod hf.ae_eq_mk]with _ hx using integral_congr_ae hx⟩ #align measure_theory.ae_strongly_measurable.integral_prod_right' MeasureTheory.AeStronglyMeasurable.integralProdRight' theorem MeasureTheory.AeStronglyMeasurable.prod_mk_left {γ : Type _} [SigmaFinite ν] [TopologicalSpace γ] {f : α × β → γ} (hf : AeStronglyMeasurable f (μ.Prod ν)) : ∀ᵐ x ∂μ, AeStronglyMeasurable (fun y => f (x, y)) ν := by filter_upwards [ae_ae_of_ae_prod hf.ae_eq_mk]with x hx exact ⟨fun y => hf.mk f (x, y), hf.strongly_measurable_mk.comp_measurable measurable_prod_mk_left, hx⟩ #align measure_theory.ae_strongly_measurable.prod_mk_left MeasureTheory.AeStronglyMeasurable.prod_mk_left end namespace MeasureTheory /-! ### The Lebesgue integral on a product -/ variable [SigmaFinite ν] theorem lintegral_prod_swap [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : AeMeasurable f (μ.Prod ν)) : (∫⁻ z, f z.symm ∂ν.Prod μ) = ∫⁻ z, f z ∂μ.Prod ν := by rw [← prod_swap] at hf rw [← lintegral_map' hf measurable_swap.ae_measurable, prod_swap] #align measure_theory.lintegral_prod_swap MeasureTheory.lintegral_prod_swap /-- **Tonelli's Theorem**: For `ℝ≥0∞`-valued measurable functions on `α × β`, the integral of `f` is equal to the iterated integral. -/ theorem lintegral_prod_of_measurable : ∀ (f : α × β → ℝ≥0∞) (hf : Measurable f), (∫⁻ z, f z ∂μ.Prod ν) = ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ := by have m := @measurable_prod_mk_left refine' Measurable.eNNReal_induction _ _ _ · intro c s hs simp only [← indicator_comp_right] simp [lintegral_indicator, m hs, hs, lintegral_const_mul, measurable_measure_prod_mk_left hs, prod_apply] · rintro f g - hf hg h2f h2g simp [lintegral_add_left, Measurable.lintegral_prod_right', hf.comp m, hf, h2f, h2g] · intro f hf h2f h3f have kf : ∀ x n, Measurable fun y => f n (x, y) := fun x n => (hf n).comp m have k2f : ∀ x, Monotone fun n y => f n (x, y) := fun x i j hij y => h2f hij (x, y) have lf : ∀ n, Measurable fun x => ∫⁻ y, f n (x, y) ∂ν := fun n => (hf n).lintegral_prod_right' have l2f : Monotone fun n x => ∫⁻ y, f n (x, y) ∂ν := fun i j hij x => lintegral_mono (k2f x hij) simp only [lintegral_supr hf h2f, lintegral_supr (kf _), k2f, lintegral_supr lf l2f, h3f] #align measure_theory.lintegral_prod_of_measurable MeasureTheory.lintegral_prod_of_measurable /-- **Tonelli's Theorem**: For `ℝ≥0∞`-valued almost everywhere measurable functions on `α × β`, the integral of `f` is equal to the iterated integral. -/ theorem lintegral_prod (f : α × β → ℝ≥0∞) (hf : AeMeasurable f (μ.Prod ν)) : (∫⁻ z, f z ∂μ.Prod ν) = ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ := by have A : (∫⁻ z, f z ∂μ.prod ν) = ∫⁻ z, hf.mk f z ∂μ.prod ν := lintegral_congr_ae hf.ae_eq_mk have B : (∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ) = ∫⁻ x, ∫⁻ y, hf.mk f (x, y) ∂ν ∂μ := by apply lintegral_congr_ae filter_upwards [ae_ae_of_ae_prod hf.ae_eq_mk]with _ ha using lintegral_congr_ae ha rw [A, B, lintegral_prod_of_measurable _ hf.measurable_mk] infer_instance #align measure_theory.lintegral_prod MeasureTheory.lintegral_prod /-- The symmetric verion of Tonelli's Theorem: For `ℝ≥0∞`-valued almost everywhere measurable functions on `α × β`, the integral of `f` is equal to the iterated integral, in reverse order. -/ theorem lintegral_prod_symm [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : AeMeasurable f (μ.Prod ν)) : (∫⁻ z, f z ∂μ.Prod ν) = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν := by simp_rw [← lintegral_prod_swap f hf] exact lintegral_prod _ hf.prod_swap #align measure_theory.lintegral_prod_symm MeasureTheory.lintegral_prod_symm /-- The symmetric verion of Tonelli's Theorem: For `ℝ≥0∞`-valued measurable functions on `α × β`, the integral of `f` is equal to the iterated integral, in reverse order. -/ theorem lintegral_prod_symm' [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : Measurable f) : (∫⁻ z, f z ∂μ.Prod ν) = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν := lintegral_prod_symm f hf.AeMeasurable #align measure_theory.lintegral_prod_symm' MeasureTheory.lintegral_prod_symm' /-- The reversed version of **Tonelli's Theorem**. In this version `f` is in curried form, which makes it easier for the elaborator to figure out `f` automatically. -/ theorem lintegral_lintegral ⦃f : α → β → ℝ≥0∞⦄ (hf : AeMeasurable (uncurry f) (μ.Prod ν)) : (∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ) = ∫⁻ z, f z.1 z.2 ∂μ.Prod ν := (lintegral_prod _ hf).symm #align measure_theory.lintegral_lintegral MeasureTheory.lintegral_lintegral /-- The reversed version of **Tonelli's Theorem** (symmetric version). In this version `f` is in curried form, which makes it easier for the elaborator to figure out `f` automatically. -/ theorem lintegral_lintegral_symm [SigmaFinite μ] ⦃f : α → β → ℝ≥0∞⦄ (hf : AeMeasurable (uncurry f) (μ.Prod ν)) : (∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ) = ∫⁻ z, f z.2 z.1 ∂ν.Prod μ := (lintegral_prod_symm _ hf.prod_swap).symm #align measure_theory.lintegral_lintegral_symm MeasureTheory.lintegral_lintegral_symm /-- Change the order of Lebesgue integration. -/ theorem lintegral_lintegral_swap [SigmaFinite μ] ⦃f : α → β → ℝ≥0∞⦄ (hf : AeMeasurable (uncurry f) (μ.Prod ν)) : (∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ) = ∫⁻ y, ∫⁻ x, f x y ∂μ ∂ν := (lintegral_lintegral hf).trans (lintegral_prod_symm _ hf) #align measure_theory.lintegral_lintegral_swap MeasureTheory.lintegral_lintegral_swap theorem lintegral_prod_mul {f : α → ℝ≥0∞} {g : β → ℝ≥0∞} (hf : AeMeasurable f μ) (hg : AeMeasurable g ν) : (∫⁻ z, f z.1 * g z.2 ∂μ.Prod ν) = (∫⁻ x, f x ∂μ) * ∫⁻ y, g y ∂ν := by simp [lintegral_prod _ (hf.fst.mul hg.snd), lintegral_lintegral_mul hf hg] #align measure_theory.lintegral_prod_mul MeasureTheory.lintegral_prod_mul /-! ### Integrability on a product -/ section theorem Integrable.swap [SigmaFinite μ] ⦃f : α × β → E⦄ (hf : Integrable f (μ.Prod ν)) : Integrable (f ∘ Prod.swap) (ν.Prod μ) := ⟨hf.AeStronglyMeasurable.prod_swap, (lintegral_prod_swap _ hf.AeStronglyMeasurable.ennnorm : _).le.trans_lt hf.HasFiniteIntegral⟩ #align measure_theory.integrable.swap MeasureTheory.Integrable.swap theorem integrable_swap_iff [SigmaFinite μ] ⦃f : α × β → E⦄ : Integrable (f ∘ Prod.swap) (ν.Prod μ) ↔ Integrable f (μ.Prod ν) := ⟨fun hf => by convert hf.swap ext ⟨x, y⟩ rfl, fun hf => hf.symm⟩ #align measure_theory.integrable_swap_iff MeasureTheory.integrable_swap_iff theorem hasFiniteIntegral_prod_iff ⦃f : α × β → E⦄ (h1f : StronglyMeasurable f) : HasFiniteIntegral f (μ.Prod ν) ↔ (∀ᵐ x ∂μ, HasFiniteIntegral (fun y => f (x, y)) ν) ∧ HasFiniteIntegral (fun x => ∫ y, ‖f (x, y)‖ ∂ν) μ := by simp only [has_finite_integral, lintegral_prod_of_measurable _ h1f.ennnorm] have : ∀ x, ∀ᵐ y ∂ν, 0 ≤ ‖f (x, y)‖ := fun x => eventually_of_forall fun y => norm_nonneg _ simp_rw [integral_eq_lintegral_of_nonneg_ae (this _) (h1f.norm.comp_measurable measurable_prod_mk_left).AeStronglyMeasurable, ennnorm_eq_of_real to_real_nonneg, ofReal_norm_eq_coe_nnnorm] -- this fact is probably too specialized to be its own lemma have : ∀ {p q r : Prop} (h1 : r → p), (r ↔ p ∧ q) ↔ p → (r ↔ q) := fun p q r h1 => by rw [← and_congr_right_iff, and_iff_right_of_imp h1] rw [this] · intro h2f rw [lintegral_congr_ae] refine' h2f.mp _ apply eventually_of_forall intro x hx dsimp only rw [of_real_to_real] rw [← lt_top_iff_ne_top] exact hx · intro h2f refine' ae_lt_top _ h2f.ne exact h1f.ennnorm.lintegral_prod_right' #align measure_theory.has_finite_integral_prod_iff MeasureTheory.hasFiniteIntegral_prod_iff theorem hasFiniteIntegral_prod_iff' ⦃f : α × β → E⦄ (h1f : AeStronglyMeasurable f (μ.Prod ν)) : HasFiniteIntegral f (μ.Prod ν) ↔ (∀ᵐ x ∂μ, HasFiniteIntegral (fun y => f (x, y)) ν) ∧ HasFiniteIntegral (fun x => ∫ y, ‖f (x, y)‖ ∂ν) μ := by rw [has_finite_integral_congr h1f.ae_eq_mk, has_finite_integral_prod_iff h1f.strongly_measurable_mk] apply and_congr · apply eventually_congr filter_upwards [ae_ae_of_ae_prod h1f.ae_eq_mk.symm] intro x hx exact has_finite_integral_congr hx · apply has_finite_integral_congr filter_upwards [ae_ae_of_ae_prod h1f.ae_eq_mk.symm]with _ hx using integral_congr_ae (eventually_eq.fun_comp hx _) · infer_instance #align measure_theory.has_finite_integral_prod_iff' MeasureTheory.hasFiniteIntegral_prod_iff' /-- A binary function is integrable if the function `y ↦ f (x, y)` is integrable for almost every `x` and the function `x ↦ ∫ ‖f (x, y)‖ dy` is integrable. -/ theorem integrable_prod_iff ⦃f : α × β → E⦄ (h1f : AeStronglyMeasurable f (μ.Prod ν)) : Integrable f (μ.Prod ν) ↔ (∀ᵐ x ∂μ, Integrable (fun y => f (x, y)) ν) ∧ Integrable (fun x => ∫ y, ‖f (x, y)‖ ∂ν) μ := by simp [integrable, h1f, has_finite_integral_prod_iff', h1f.norm.integral_prod_right', h1f.prod_mk_left] #align measure_theory.integrable_prod_iff MeasureTheory.integrable_prod_iff /-- A binary function is integrable if the function `x ↦ f (x, y)` is integrable for almost every `y` and the function `y ↦ ∫ ‖f (x, y)‖ dx` is integrable. -/ theorem integrable_prod_iff' [SigmaFinite μ] ⦃f : α × β → E⦄ (h1f : AeStronglyMeasurable f (μ.Prod ν)) : Integrable f (μ.Prod ν) ↔ (∀ᵐ y ∂ν, Integrable (fun x => f (x, y)) μ) ∧ Integrable (fun y => ∫ x, ‖f (x, y)‖ ∂μ) ν := by convert integrable_prod_iff h1f.prod_swap using 1 rw [integrable_swap_iff] #align measure_theory.integrable_prod_iff' MeasureTheory.integrable_prod_iff' theorem Integrable.prod_left_ae [SigmaFinite μ] ⦃f : α × β → E⦄ (hf : Integrable f (μ.Prod ν)) : ∀ᵐ y ∂ν, Integrable (fun x => f (x, y)) μ := ((integrable_prod_iff' hf.AeStronglyMeasurable).mp hf).1 #align measure_theory.integrable.prod_left_ae MeasureTheory.Integrable.prod_left_ae theorem Integrable.prod_right_ae [SigmaFinite μ] ⦃f : α × β → E⦄ (hf : Integrable f (μ.Prod ν)) : ∀ᵐ x ∂μ, Integrable (fun y => f (x, y)) ν := hf.symm.prod_left_ae #align measure_theory.integrable.prod_right_ae MeasureTheory.Integrable.prod_right_ae theorem Integrable.integralNormProdLeft ⦃f : α × β → E⦄ (hf : Integrable f (μ.Prod ν)) : Integrable (fun x => ∫ y, ‖f (x, y)‖ ∂ν) μ := ((integrable_prod_iff hf.AeStronglyMeasurable).mp hf).2 #align measure_theory.integrable.integral_norm_prod_left MeasureTheory.Integrable.integralNormProdLeft theorem Integrable.integralNormProdRight [SigmaFinite μ] ⦃f : α × β → E⦄ (hf : Integrable f (μ.Prod ν)) : Integrable (fun y => ∫ x, ‖f (x, y)‖ ∂μ) ν := hf.symm.integralNormProdLeft #align measure_theory.integrable.integral_norm_prod_right MeasureTheory.Integrable.integralNormProdRight theorem integrableProdMul {L : Type _} [IsROrC L] {f : α → L} {g : β → L} (hf : Integrable f μ) (hg : Integrable g ν) : Integrable (fun z : α × β => f z.1 * g z.2) (μ.Prod ν) := by refine' (integrable_prod_iff _).2 ⟨_, _⟩ · exact hf.1.fst.mul hg.1.snd · exact eventually_of_forall fun x => hg.const_mul (f x) · simpa only [norm_mul, integral_mul_left] using hf.norm.mul_const _ #align measure_theory.integrable_prod_mul MeasureTheory.integrableProdMul end variable [NormedSpace ℝ E] [CompleteSpace E] theorem Integrable.integralProdLeft ⦃f : α × β → E⦄ (hf : Integrable f (μ.Prod ν)) : Integrable (fun x => ∫ y, f (x, y) ∂ν) μ := Integrable.mono hf.integralNormProdLeft hf.AeStronglyMeasurable.integral_prod_right' <| eventually_of_forall fun x => (norm_integral_le_integral_norm _).trans_eq <| (norm_of_nonneg <| integral_nonneg_of_ae <| eventually_of_forall fun y => (norm_nonneg (f (x, y)) : _)).symm #align measure_theory.integrable.integral_prod_left MeasureTheory.Integrable.integralProdLeft theorem Integrable.integralProdRight [SigmaFinite μ] ⦃f : α × β → E⦄ (hf : Integrable f (μ.Prod ν)) : Integrable (fun y => ∫ x, f (x, y) ∂μ) ν := hf.symm.integral_prod_left #align measure_theory.integrable.integral_prod_right MeasureTheory.Integrable.integralProdRight /-! ### The Bochner integral on a product -/ variable [SigmaFinite μ] theorem integral_prod_swap (f : α × β → E) (hf : AeStronglyMeasurable f (μ.Prod ν)) : (∫ z, f z.symm ∂ν.Prod μ) = ∫ z, f z ∂μ.Prod ν := by rw [← prod_swap] at hf rw [← integral_map measurable_swap.ae_measurable hf, prod_swap] #align measure_theory.integral_prod_swap MeasureTheory.integral_prod_swap variable {E' : Type _} [NormedAddCommGroup E'] [CompleteSpace E'] [NormedSpace ℝ E'] /-! Some rules about the sum/difference of double integrals. They follow from `integral_add`, but we separate them out as separate lemmas, because they involve quite some steps. -/ /-- Integrals commute with addition inside another integral. `F` can be any function. -/ theorem integral_fn_integral_add ⦃f g : α × β → E⦄ (F : E → E') (hf : Integrable f (μ.Prod ν)) (hg : Integrable g (μ.Prod ν)) : (∫ x, F (∫ y, f (x, y) + g (x, y) ∂ν) ∂μ) = ∫ x, F ((∫ y, f (x, y) ∂ν) + ∫ y, g (x, y) ∂ν) ∂μ := by refine' integral_congr_ae _ filter_upwards [hf.prod_right_ae, hg.prod_right_ae]with _ h2f h2g simp [integral_add h2f h2g] #align measure_theory.integral_fn_integral_add MeasureTheory.integral_fn_integral_add /-- Integrals commute with subtraction inside another integral. `F` can be any measurable function. -/ theorem integral_fn_integral_sub ⦃f g : α × β → E⦄ (F : E → E') (hf : Integrable f (μ.Prod ν)) (hg : Integrable g (μ.Prod ν)) : (∫ x, F (∫ y, f (x, y) - g (x, y) ∂ν) ∂μ) = ∫ x, F ((∫ y, f (x, y) ∂ν) - ∫ y, g (x, y) ∂ν) ∂μ := by refine' integral_congr_ae _ filter_upwards [hf.prod_right_ae, hg.prod_right_ae]with _ h2f h2g simp [integral_sub h2f h2g] #align measure_theory.integral_fn_integral_sub MeasureTheory.integral_fn_integral_sub /-- Integrals commute with subtraction inside a lower Lebesgue integral. `F` can be any function. -/ theorem lintegral_fn_integral_sub ⦃f g : α × β → E⦄ (F : E → ℝ≥0∞) (hf : Integrable f (μ.Prod ν)) (hg : Integrable g (μ.Prod ν)) : (∫⁻ x, F (∫ y, f (x, y) - g (x, y) ∂ν) ∂μ) = ∫⁻ x, F ((∫ y, f (x, y) ∂ν) - ∫ y, g (x, y) ∂ν) ∂μ := by refine' lintegral_congr_ae _ filter_upwards [hf.prod_right_ae, hg.prod_right_ae]with _ h2f h2g simp [integral_sub h2f h2g] #align measure_theory.lintegral_fn_integral_sub MeasureTheory.lintegral_fn_integral_sub /-- Double integrals commute with addition. -/ theorem integral_integral_add ⦃f g : α × β → E⦄ (hf : Integrable f (μ.Prod ν)) (hg : Integrable g (μ.Prod ν)) : (∫ x, ∫ y, f (x, y) + g (x, y) ∂ν ∂μ) = (∫ x, ∫ y, f (x, y) ∂ν ∂μ) + ∫ x, ∫ y, g (x, y) ∂ν ∂μ := (integral_fn_integral_add id hf hg).trans <| integral_add hf.integral_prod_left hg.integral_prod_left #align measure_theory.integral_integral_add MeasureTheory.integral_integral_add /-- Double integrals commute with addition. This is the version with `(f + g) (x, y)` (instead of `f (x, y) + g (x, y)`) in the LHS. -/ theorem integral_integral_add' ⦃f g : α × β → E⦄ (hf : Integrable f (μ.Prod ν)) (hg : Integrable g (μ.Prod ν)) : (∫ x, ∫ y, (f + g) (x, y) ∂ν ∂μ) = (∫ x, ∫ y, f (x, y) ∂ν ∂μ) + ∫ x, ∫ y, g (x, y) ∂ν ∂μ := integral_integral_add hf hg #align measure_theory.integral_integral_add' MeasureTheory.integral_integral_add' /-- Double integrals commute with subtraction. -/ theorem integral_integral_sub ⦃f g : α × β → E⦄ (hf : Integrable f (μ.Prod ν)) (hg : Integrable g (μ.Prod ν)) : (∫ x, ∫ y, f (x, y) - g (x, y) ∂ν ∂μ) = (∫ x, ∫ y, f (x, y) ∂ν ∂μ) - ∫ x, ∫ y, g (x, y) ∂ν ∂μ := (integral_fn_integral_sub id hf hg).trans <| integral_sub hf.integral_prod_left hg.integral_prod_left #align measure_theory.integral_integral_sub MeasureTheory.integral_integral_sub /-- Double integrals commute with subtraction. This is the version with `(f - g) (x, y)` (instead of `f (x, y) - g (x, y)`) in the LHS. -/ theorem integral_integral_sub' ⦃f g : α × β → E⦄ (hf : Integrable f (μ.Prod ν)) (hg : Integrable g (μ.Prod ν)) : (∫ x, ∫ y, (f - g) (x, y) ∂ν ∂μ) = (∫ x, ∫ y, f (x, y) ∂ν ∂μ) - ∫ x, ∫ y, g (x, y) ∂ν ∂μ := integral_integral_sub hf hg #align measure_theory.integral_integral_sub' MeasureTheory.integral_integral_sub' /-- The map that sends an L¹-function `f : α × β → E` to `∫∫f` is continuous. -/ theorem continuous_integral_integral : Continuous fun f : α × β →₁[μ.Prod ν] E => ∫ x, ∫ y, f (x, y) ∂ν ∂μ := by rw [continuous_iff_continuousAt]; intro g refine' tendsto_integral_of_L1 _ (L1.integrable_coe_fn g).integral_prod_left (eventually_of_forall fun h => (L1.integrable_coe_fn h).integral_prod_left) _ simp_rw [← lintegral_fn_integral_sub (fun x => (‖x‖₊ : ℝ≥0∞)) (L1.integrable_coe_fn _) (L1.integrable_coe_fn g)] refine' tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_const_nhds _ (fun i => zero_le _) _ · exact fun i => ∫⁻ x, ∫⁻ y, ‖i (x, y) - g (x, y)‖₊ ∂ν ∂μ swap; · exact fun i => lintegral_mono fun x => ennnorm_integral_le_lintegral_ennnorm _ show tendsto (fun i : α × β →₁[μ.prod ν] E => ∫⁻ x, ∫⁻ y : β, ‖i (x, y) - g (x, y)‖₊ ∂ν ∂μ) (𝓝 g) (𝓝 0) have : ∀ i : α × β →₁[μ.prod ν] E, Measurable fun z => (‖i z - g z‖₊ : ℝ≥0∞) := fun i => ((Lp.strongly_measurable i).sub (Lp.strongly_measurable g)).ennnorm simp_rw [← lintegral_prod_of_measurable _ (this _), ← L1.of_real_norm_sub_eq_lintegral, ← of_real_zero] refine' (continuous_of_real.tendsto 0).comp _ rw [← tendsto_iff_norm_tendsto_zero]; exact tendsto_id #align measure_theory.continuous_integral_integral MeasureTheory.continuous_integral_integral /-- **Fubini's Theorem**: For integrable functions on `α × β`, the Bochner integral of `f` is equal to the iterated Bochner integral. `integrable_prod_iff` can be useful to show that the function in question in integrable. `measure_theory.integrable.integral_prod_right` is useful to show that the inner integral of the right-hand side is integrable. -/ theorem integral_prod : ∀ (f : α × β → E) (hf : Integrable f (μ.Prod ν)), (∫ z, f z ∂μ.Prod ν) = ∫ x, ∫ y, f (x, y) ∂ν ∂μ := by apply integrable.induction · intro c s hs h2s simp_rw [integral_indicator hs, ← indicator_comp_right, Function.comp, integral_indicator (measurable_prod_mk_left hs), set_integral_const, integral_smul_const, integral_to_real (measurable_measure_prod_mk_left hs).AeMeasurable (ae_measure_lt_top hs h2s.ne), prod_apply hs] · intro f g hfg i_f i_g hf hg simp_rw [integral_add' i_f i_g, integral_integral_add' i_f i_g, hf, hg] · exact isClosed_eq continuous_integral continuous_integral_integral · intro f g hfg i_f hf convert hf using 1 · exact integral_congr_ae hfg.symm · refine' integral_congr_ae _ refine' (ae_ae_of_ae_prod hfg).mp _ apply eventually_of_forall intro x hfgx exact integral_congr_ae (ae_eq_symm hfgx) #align measure_theory.integral_prod MeasureTheory.integral_prod /-- Symmetric version of **Fubini's Theorem**: For integrable functions on `α × β`, the Bochner integral of `f` is equal to the iterated Bochner integral. This version has the integrals on the right-hand side in the other order. -/ theorem integral_prod_symm (f : α × β → E) (hf : Integrable f (μ.Prod ν)) : (∫ z, f z ∂μ.Prod ν) = ∫ y, ∫ x, f (x, y) ∂μ ∂ν := by simp_rw [← integral_prod_swap f hf.ae_strongly_measurable] exact integral_prod _ hf.swap #align measure_theory.integral_prod_symm MeasureTheory.integral_prod_symm /-- Reversed version of **Fubini's Theorem**. -/ theorem integral_integral {f : α → β → E} (hf : Integrable (uncurry f) (μ.Prod ν)) : (∫ x, ∫ y, f x y ∂ν ∂μ) = ∫ z, f z.1 z.2 ∂μ.Prod ν := (integral_prod _ hf).symm #align measure_theory.integral_integral MeasureTheory.integral_integral /-- Reversed version of **Fubini's Theorem** (symmetric version). -/ theorem integral_integral_symm {f : α → β → E} (hf : Integrable (uncurry f) (μ.Prod ν)) : (∫ x, ∫ y, f x y ∂ν ∂μ) = ∫ z, f z.2 z.1 ∂ν.Prod μ := (integral_prod_symm _ hf.symm).symm #align measure_theory.integral_integral_symm MeasureTheory.integral_integral_symm /-- Change the order of Bochner integration. -/ theorem integral_integral_swap ⦃f : α → β → E⦄ (hf : Integrable (uncurry f) (μ.Prod ν)) : (∫ x, ∫ y, f x y ∂ν ∂μ) = ∫ y, ∫ x, f x y ∂μ ∂ν := (integral_integral hf).trans (integral_prod_symm _ hf) #align measure_theory.integral_integral_swap MeasureTheory.integral_integral_swap /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ /-- **Fubini's Theorem** for set integrals. -/ theorem set_integral_prod (f : α × β → E) {s : Set α} {t : Set β} (hf : IntegrableOn f (s ×ˢ t) (μ.Prod ν)) : (∫ z in s ×ˢ t, f z ∂μ.Prod ν) = ∫ x in s, ∫ y in t, f (x, y) ∂ν ∂μ := by simp only [← measure.prod_restrict s t, integrable_on] at hf⊢ exact integral_prod f hf #align measure_theory.set_integral_prod MeasureTheory.set_integral_prod theorem integral_prod_mul {L : Type _} [IsROrC L] (f : α → L) (g : β → L) : (∫ z, f z.1 * g z.2 ∂μ.Prod ν) = (∫ x, f x ∂μ) * ∫ y, g y ∂ν := by by_cases h : integrable (fun z : α × β => f z.1 * g z.2) (μ.prod ν) · rw [integral_prod _ h] simp_rw [integral_mul_left, integral_mul_right] have H : ¬integrable f μ ∨ ¬integrable g ν := by contrapose! h exact integrable_prod_mul h.1 h.2 cases H <;> simp [integral_undef h, integral_undef H] #align measure_theory.integral_prod_mul MeasureTheory.integral_prod_mul /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ theorem set_integral_prod_mul {L : Type _} [IsROrC L] (f : α → L) (g : β → L) (s : Set α) (t : Set β) : (∫ z in s ×ˢ t, f z.1 * g z.2 ∂μ.Prod ν) = (∫ x in s, f x ∂μ) * ∫ y in t, g y ∂ν := by simp only [← measure.prod_restrict s t, integrable_on, integral_prod_mul] #align measure_theory.set_integral_prod_mul MeasureTheory.set_integral_prod_mul end MeasureTheory
State Before: x y z : ℝ hx : 0 < x hy : 0 < y ⊢ x < y ^ z ↔ log x < z * log y State After: no goals Tactic: rw [← Real.log_lt_log_iff hx (Real.rpow_pos_of_pos hy z), Real.log_rpow hy]
module Issue2880 where app : {A : Set} → (A → A) → (A → A) app f x = f x {-# COMPILE GHC app = \ A f x -> f (app A f x) #-} mutual id : {A : Set} → A → A id x = x {-# COMPILE GHC id = id' #-} id' : {A : Set} → A → A id' x = x {-# COMPILE GHC id' = id #-}
import Lean4Axiomatic.AbstractAlgebra import Lean4Axiomatic.Rational.Addition /-! # Rational numbers: multiplication -/ namespace Lean4Axiomatic.Rational /-! ## Axioms -/ /-- Operations pertaining to rational number multiplication. -/ class Multiplication.Ops (ℚ : Type) := /-- Multiplication of rational numbers. -/ mul : ℚ → ℚ → ℚ export Multiplication.Ops (mul) /-- Enables the use of the `· * ·` operator for multiplication. -/ instance mul_op_inst {ℚ : Type} [Multiplication.Ops ℚ] : Mul ℚ := { mul := mul } /-- Properties of rational number multiplication. -/ class Multiplication.Props {ℕ ℤ : outParam Type} [Natural ℕ] [Integer (ℕ := ℕ) ℤ] (ℚ : Type) [Core (ℤ := ℤ) ℚ] [Addition ℚ] [Ops ℚ] := /-- Multiplication respects equivalence over its left operand. -/ mul_substL {p₁ p₂ q : ℚ} : p₁ ≃ p₂ → p₁ * q ≃ p₂ * q /-- Multiplication respects equivalence over its right operand. -/ mul_substR {p₁ p₂ q : ℚ} : p₁ ≃ p₂ → q * p₁ ≃ q * p₂ /-- Multiplication is consistent with its integer equivalent. -/ mul_compat_from_integer {a b : ℤ} : ((a * b : ℤ) : ℚ) ≃ (a : ℚ) * (b : ℚ) /-- Multiplication is commutative. -/ mul_comm {p q : ℚ} : p * q ≃ q * p /-- Multiplication is associative. -/ mul_assoc {p q r : ℚ} : (p * q) * r ≃ p * (q * r) /-- One is a left multiplicative identity. -/ mul_identL {p : ℚ} : 1 * p ≃ p /-- One is a right multiplicative identity. -/ mul_identR {p : ℚ} : p * 1 ≃ p /-- Multiplication on the left distributes over addition. -/ mul_distribL {p q r : ℚ} : p * (q + r) ≃ p * q + p * r /-- Multiplication on the right distributes over addition. -/ mul_distribR {p q r : ℚ} : (q + r) * p ≃ q * p + r * p export Multiplication.Props ( mul_assoc mul_comm mul_compat_from_integer mul_distribL mul_distribR mul_identL mul_identR mul_substL mul_substR ) /-- All axioms of multiplication for rational numbers. -/ class Multiplication {ℕ ℤ : outParam Type} [Natural ℕ] [Integer (ℕ := ℕ) ℤ] (ℚ : Type) [Core (ℤ := ℤ) ℚ] [Addition ℚ] := toOps : Multiplication.Ops ℚ toProps : Multiplication.Props ℚ attribute [instance] Multiplication.toOps attribute [instance] Multiplication.toProps /-! ## Derived properties -/ variable {ℕ ℤ : Type} [Natural ℕ] [Integer (ℕ := ℕ) ℤ] variable {ℚ : Type} [Core (ℤ := ℤ) ℚ] [Addition ℚ] [Multiplication ℚ] /-- Enables the use of `AA.substL`, `AA.substR`, etc. for multiplication. -/ instance mul_subst_inst : AA.Substitutive₂ (α := ℚ) (· * ·) AA.tc (· ≃ ·) (· ≃ ·) := { substitutiveL := { subst₂ := λ (_ : True) => mul_substL } substitutiveR := { subst₂ := λ (_ : True) => mul_substR } } /-- Enables the use of `AA.comm` for commutativity of multiplication. -/ instance mul_comm_inst : AA.Commutative (α := ℚ) (· * ·) := { comm := mul_comm } /-- Enables the use of `AA.assoc` for associativity of multiplication. -/ instance mul_assoc_inst : AA.Associative (α := ℚ) (· * ·) := { assoc := mul_assoc } /-- Holds for the rational numbers that are square roots of unity, i.e. that result in `1` when squared. See `Integer.Sqrt1` for details on why this is a useful predicate. -/ class inductive Sqrt1 (p : ℚ) : Prop := | /-- Create `Sqrt1` for the rational equivalent of an integer square root of unity. -/ from_integer_intro (a : ℤ) (sqrt1 : Integer.Sqrt1 a) (eqv : p ≃ (a : ℚ)) /-- Alternative to `Sqrt1.from_integer_intro` that infers more arguments. -/ def Sqrt1.from_integer {a : ℤ} {p : ℚ} [Integer.Sqrt1 a] : p ≃ (a : ℚ) → Sqrt1 p := from_integer_intro a ‹Integer.Sqrt1 a› /-- The defining property of square roots of unity. **Proof intuition**: Expand the definition of `Sqrt1` to obtain the underlying integer. Then show the property is preserved by conversion to rational numbers. -/ theorem Sqrt1.elim {p : ℚ} : Sqrt1 p → p * p ≃ 1 := by intro (_ : Sqrt1 p) show p * p ≃ 1 have (Sqrt1.from_integer_intro (a : ℤ) (_ : Integer.Sqrt1 a) eqv) := ‹Sqrt1 p› have : p ≃ (a : ℚ) := eqv have : p * p ≃ 1 := calc p * p ≃ _ := mul_substL ‹p ≃ (a : ℚ)› (a : ℚ) * p ≃ _ := mul_substR ‹p ≃ (a : ℚ)› (a : ℚ) * (a : ℚ) ≃ _ := eqv_symm mul_compat_from_integer ((a * a : ℤ) : ℚ) ≃ _ := from_integer_subst ‹Integer.Sqrt1 a›.elim (1 : ℚ) ≃ _ := eqv_refl 1 ≃ _ := eqv_refl exact this /-- The `Sqrt1` predicate respects equivalence of rational numbers. **Property intuition**: This must hold for `Sqrt1` to be a valid predicate. **Proof intuition**: Expand the definition of `Sqrt1`; the result follows by substitution on the underlying equivalence. -/ theorem sqrt1_subst {p₁ p₂ : ℚ} : p₁ ≃ p₂ → Sqrt1 p₁ → Sqrt1 p₂ := by intro (_ : p₁ ≃ p₂) (_ : Sqrt1 p₁) show Sqrt1 p₂ have (Sqrt1.from_integer_intro (a : ℤ) (_ : Integer.Sqrt1 a) eqv) := ‹Sqrt1 p₁› have : p₁ ≃ (a : ℚ) := eqv have : p₂ ≃ (a : ℚ) := AA.substLFn ‹p₁ ≃ p₂› this have : Sqrt1 p₂ := Sqrt1.from_integer_intro a ‹Integer.Sqrt1 a› this exact this /-- An integer square root of unity keeps that designation when converted to a rational number. **Property intuition**: Multiplication is preserved by integer conversion, and the square root of unity property is defined in terms of multiplication, so we expect it to be preserved as well. **Proof intuition**: `Sqrt1` for rationals already delegates to the definition for integers; expand it and use that connection. -/ theorem from_integer_preserves_sqrt1 {a : ℤ} : Sqrt1 (a : ℚ) ↔ Integer.Sqrt1 a := by apply Iff.intro case mp => intro (_ : Sqrt1 (a : ℚ)) show Integer.Sqrt1 a have (Sqrt1.from_integer_intro (b : ℤ) (_ : Integer.Sqrt1 b) eqv) := ‹Sqrt1 (a : ℚ)› have : (b : ℚ) ≃ (a : ℚ) := eqv_symm eqv have : b ≃ a := from_integer_inject this have : Integer.Sqrt1 a := Integer.sqrt1_subst this ‹Integer.Sqrt1 b› exact this case mpr => intro (_ : Integer.Sqrt1 a) show Sqrt1 (a : ℚ) exact Sqrt1.from_integer eqv_refl /-- The rational number `1` is a square root of unity. **Property and proof intuition**: This is a trivial corollary of the proof that integer square roots of unity are also rational square roots of unity. -/ instance sqrt1_one : Sqrt1 (1 : ℚ) := from_integer_preserves_sqrt1.mpr Integer.sqrt1_one end Lean4Axiomatic.Rational
<!DOCTYPE HTML PUBLIC //W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd> <html> <head> <script typetext/javascript>var authentication_url http://wikispot.org/?actionuserform&login_check1&backto_wikidavis&backto_pagehttp%3A//daviswiki.org/Wiki_Settings/General&qsaction%3Draw;</script><meta httpequivContentType contenttext/html; charsetutf8> <meta namerobots contentnoindex,nofollow> <link relshortcut icon href/Wiki_Settings/Images?sendfiletrue&amp;filetinylogo.png typeimage/png><link relicon href/Wiki_Settings/Images?sendfiletrue&amp;filetinylogo.png typeimage/png><script typetext/javascript>var urlPrefix /wiki; var curTimestamp 1408666435.87; var action /Wiki_Settings/General; var may_inline_edit false; var onLoadStuff new Array();</script><script src/wiki/utils.js?tm1190515399 typetext/javascript charsetutf8></script> <link relalternate typeapplication/rss+xml href/Wiki_Settings/General?actionrss_rc titleRecent Changes RSS Feed for Wiki Settings/General> <title>Wiki Settings/General Davis Wiki</title> <script> (function(i,s,o,g,r,a,m){iGoogleAnalyticsObjectr;irir||function(){ (ir.qir.q||).push(arguments)},ir.l1new Date();as.createElement(o), ms.getElementsByTagName(o)0;a.async1;a.srcg;m.parentNode.insertBefore(a,m) })(window,document,script,//www.googleanalytics.com/analytics.js,ga); ga(create, UA254654767, daviswiki.org); ga(send, pageview); </script> <link relstylesheet typetext/css charsetutf8 mediaall href/Wiki_Settings/CSS?sendfiletrue&amp;filecommon.css&amp;ts284171358.36963> <link relstylesheet typetext/css charsetutf8 mediaall href/Wiki_Settings/CSS?sendfiletrue&amp;filelayout.css&amp;ts184048305.14910> <link relstylesheet typetext/css charsetutf8 mediaall href/Wiki_Settings/CSS?sendfiletrue&amp;filestyle.css&amp;ts387858310.518348> <style typetext/css>#title td { paddingright: 1pt; }</style> </head> <body langen dirltr onloaddoOnLoadStuff();> <div idbanner> <table classlogo> <tr> <td classlogo_banner> <a classnostyle href/Front_Page><img alignmiddle src/Wiki_Settings/Images?sendfiletrue&amp;filelogo.png&amp;ts363292579.27 altwiki logo stylebehavior: url(/wiki/pngbehavior.htc); height50 width240></a> </td> <td classuser_banner alignright valigntop> <form actionhttps://wikispot.org/User_Settings methodPOST onsubmitif (!canSetCookies()) { alert(You need cookies enabled to log in.); return false;}><input typehidden nameaction valueuserform><div classlogin_area><table><tr><td width50% alignright nowrap>User name:</td><td colspan2 alignleft nowrap><input classformfields size22 nameusername typetext></td> </tr> <tr><td alignright>Password:</td><td colspan2 alignleft nowrap> <input classformfields size22 typepassword namepassword> <input typehidden namelogin valueLogin><input typehidden namebackto_wiki valuedavis><input typehidden namebackto_page valuehttp%3A//daviswiki.org/Wiki_Settings/General><input typehidden nameqs valueaction%3Draw></td></tr><tr><td></td><td alignleft nowrap>(<a hrefhttp://wikispot.org/User_Settings?new_user1&amp;from_wikidavis>new user</a>)</td><td alignright><input typesubmit namelogin valueLogin altlogin></td></tr></table></div></form> </td> </tr> </table> <div classtabArea><a href/Front_Page classtab>Front Page</a><a href/People classtab>People</a><a href/Recent_Changes classtab>Recent Changes</a><a href/Wiki_Settings/General classtab activeTab>Wiki Settings/General</a></div> </div> <div idtitle> <table idtitle_area_table> <tr> <td> <table idtitle_table> <tr idiconRow> <td idtitle_text><h1><a titleWiki Settings href/Wiki_Settings>Wiki Settings</a>/<a titleWiki Settings/General classcurrentChild href/Wiki_Settings/General>General</a></h1></td> <td classpageIcon><span idinfoIcon><a styletextdecoration: none; href/Wiki_Settings/General?actioninfo><img classborderless src/Wiki_Settings/Images?sendfiletrue&amp;fileinfoicon.png&amp;ts175610370.280139 altInfo stylebehavior: url(/wiki/pngbehavior.htc); height24 width24/><span>Info</span></a></span></td> </tr></table> </td> <td idsearch_form> <form methodGET action/Wiki_Settings/General> <input typehidden nameaction valuesearch> Search: <input classformfields typetext nameinline_string value size15 maxlength101>&nbsp;<input typeimage srchttp://wikispot.org/wiki/eggheadbeta/img/search.png alt?>&nbsp;&nbsp; </form> </td> </tr></table></div> <div idcontent classcontent wikipage langen dirltr> <strong>You are not allowed to view this page.</strong><br><div styleclear: both;></div></div> <script languageJavaScript typetext/javascript> var donate2new Image();donate2.src/wiki/eggheadbeta/img/donate2.png;var donatenew Image();donate.src/wiki/eggheadbeta/img/donate.png;</script><div idfooter><table width100% border0 cellspacing0 cellpadding0><tr><td alignleft width20%><td aligncenter valignmiddle><div classlicense><! Creative Commons License >Except where otherwise noted, this content is licensed under a <a rellicense hrefhttp://creativecommons.org/licenses/by/3.0/>Creative Commons Attribution License</a>. See <a href/Copyrights>Copyrights</a>.<! /Creative Commons License ><! <rdf:RDF xmlnshttp://web.resource.org/cc/ xmlns:dchttp://purl.org/dc/elements/1.1/ xmlns:rdfhttp://www.w3.org/1999/02/22rdfsyntaxns#> <Work rdf:about><dc:type rdf:resourcehttp://purl.org/dc/dcmitype/Text /><license rdf:resourcehttp://creativecommons.org/licenses/by/3.0/ /> </Work> <License rdf:abouthttp://creativecommons.org/licenses/by/3.0/> <permits rdf:resourcehttp://web.resource.org/cc/Reproduction /> <permits rdf:resourcehttp://web.resource.org/cc/Distribution /> <requires rdf:resourcehttp://web.resource.org/cc/Notice /> <requires rdf:resourcehttp://web.resource.org/cc/Attribution /> <permits rdf:resourcehttp://web.resource.org/cc/DerivativeWorks /> </License> </rdf:RDF> ></div></td><td alignright valignmiddle width200px stylepaddingright: 5px;><a hrefhttp://creativecommons.org/licenses/by/3.0/><img altCreative Commons License border0 src/wiki/eggheadbeta/img/cc.png /></a> <a hrefhttp://daviswiki.org/donate><img src/wiki/eggheadbeta/img/donate.png border0 altdonate /></a></td></tr></table></div><div classwikiGlobalFooter aligncenter><div classwikiSpotFooter>This is a <a hrefhttp://wikispot.org/>Wiki Spot</a> wiki. Wiki Spot is a 501(c)3 nonprofit organization that helps communities collaborate via wikis.</div></div>
State Before: U : Type u_1 inst✝ : Quiver U u v u' v' u'' v'' : U p : Path u v hu : u = u' hv : v = v' hu' : u' = u'' hv' : v' = v'' ⊢ cast hu' hv' (cast hu hv p) = cast (_ : u = u'') (_ : v = v'') p State After: U : Type u_1 inst✝ : Quiver U u'' v'' : U p : Path u'' v'' ⊢ cast (_ : u'' = u'') (_ : v'' = v'') (cast (_ : u'' = u'') (_ : v'' = v'') p) = cast (_ : u'' = u'') (_ : v'' = v'') p Tactic: subst_vars State Before: U : Type u_1 inst✝ : Quiver U u'' v'' : U p : Path u'' v'' ⊢ cast (_ : u'' = u'') (_ : v'' = v'') (cast (_ : u'' = u'') (_ : v'' = v'') p) = cast (_ : u'' = u'') (_ : v'' = v'') p State After: no goals Tactic: rfl
// // This is an example of a custom transport implementation // // Explicitly enable Boost futures #define BOOST_THREAD_VERSION 4 // Include auto-generated files. #include "exampletransport_reflection.h" #include "exampletransport_comm.h" #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable: 4100) // boost/thread/future.hpp(410): warning C4100: 'lk' : unreferenced formal parameter #include <boost/thread/future.hpp> #pragma warning(pop) #else #include <boost/thread/future.hpp> #endif // Include preferred transport: ExampleTransport in this case #include "exampletransport.h" using namespace examples::transport; // Implement service using boost futures struct ServiceImpl : Service { void Method(const bond::comm::payload<Param>& input, const std::function<void(const bond::comm::message<Result>&)>& callback) override { Result result; result.v.emplace_back(input.value().Deserialize()); callback(std::move(result)); } }; int main() { bond::comm::SocketAddress loopback("127.0.0.1", TEST_PORT_1); examples::ExampleTransport transport; auto server = transport.Bind(loopback, boost::make_shared<ServiceImpl>()); // Use proxy with std futures Service::Proxy::Using<boost::promise> proxy(transport.Connect(loopback)); Param param; param.n = 13; param.str = "test"; auto future = proxy.Method(param); // pump messages // while (transport.PumpEvent()) {} Result result = future.get().value().Deserialize(); assert(!result.v.empty()); assert(result.v.front() == param); return 0; }
import Kenny.sheaf_on_opens universes v u open topological_space variables {X : Type u} [topological_space X] structure subpresheaf (F : presheaf.{u v} X) : Type (max u v) := (to_set : Π U : opens X, set (F U)) (res_mem_to_set : ∀ {U V : opens X} (HVU : V ⊆ U) {x : F U}, x ∈ to_set U → F.res U V HVU x ∈ to_set V) namespace subpresheaf instance (F : presheaf.{u v} X) : has_coe_to_fun (subpresheaf F) := ⟨_, to_set⟩ instance (F : presheaf.{u v} X) : partial_order (subpresheaf F) := partial_order.lift to_set (λ ⟨x, hx⟩ ⟨y, hy⟩, mk.inj_eq.mpr) infer_instance def to_subsheaf {F : presheaf.{u v} X} (S : subpresheaf F) : subpresheaf F := { to_set := λ U, { x | ∃ OC : covering.{u} U, ∀ i : OC.γ, F.res U (OC.Uis i) (subset_covering i) x ∈ S (OC.Uis i) }, res_mem_to_set := λ U V HVU x ⟨OC, hx⟩, ⟨opens.covering_res U V HVU OC, λ i, have _ ∈ S ((opens.covering_res U V HVU OC).Uis i) := S.res_mem_to_set (set.inter_subset_right _ _) (hx i), by rwa ← presheaf.Hcomp' at this ⊢⟩ } theorem le_to_subsheaf {F : presheaf.{u v} X} (S : subpresheaf F) : S ≤ S.to_subsheaf := λ U x hx, ⟨{ γ := punit, Uis := λ _, U, Hcov := le_antisymm (lattice.supr_le $ λ _, le_refl U) (lattice.le_supr (λ _, U) punit.star) }, λ i, by erw F.Hid'; exact hx⟩ def to_presheaf {F : presheaf.{u v} X} (S : subpresheaf F) : presheaf X := { F := λ U, S U, res := λ U V HVU x, ⟨F.res U V HVU x.1, S.2 HVU x.2⟩, Hid := λ U, funext $ λ x, subtype.eq $ F.Hid' U x.1, Hcomp := λ U V W HWV HVU, funext $ λ x, subtype.eq $ F.Hcomp' U V W HWV HVU x.1 } theorem locality {O : sheaf.{u v} X} (S : subpresheaf O.to_presheaf) : locality S.to_presheaf := λ U OC s t H, subtype.eq $ O.locality OC s.1 t.1 $ λ i, have _ := congr_arg subtype.val (H i), this end subpresheaf class is_subsheaf {F : presheaf.{u v} X} (S : subpresheaf F) : Prop := (mem_of_res_mem : ∀ {U : opens X}, ∀ {x : F U}, ∀ OC : covering.{u} U, (∀ i : OC.γ, F.res U (OC.Uis i) (subset_covering i) x ∈ S (OC.Uis i)) → x ∈ S U) theorem covering.exists {U : opens X} (OC : covering U) {x : X} (hx : x ∈ U) : ∃ i : OC.γ, x ∈ OC.Uis i := let ⟨_, ⟨_, ⟨i, rfl⟩, rfl⟩, hi⟩ := set.mem_sUnion.1 (((set.ext_iff _ _).1 (congr_arg subtype.val OC.Hcov) x).2 hx) in ⟨i, hi⟩ def covering.glue {U : opens X} (OC : covering U) (F : Π i : OC.γ, covering (OC.Uis i)) : covering U := { γ := Σ i : OC.γ, (F i).γ, Uis := λ P, (F P.1).Uis P.2, Hcov := opens.ext $ (set.sUnion_image _ _).trans $ set.subset.antisymm (set.bUnion_subset $ set.range_subset_iff.2 $ λ P, set.subset.trans (subset_covering P.2) (subset_covering P.1)) (λ x hx, let ⟨i, hi⟩ := OC.exists hx, ⟨j, hj⟩ := (F i).exists hi in set.mem_bUnion ⟨⟨i, j⟩, rfl⟩ hj) } theorem is_subsheaf_to_subsheaf {F : presheaf.{u v} X} (S : subpresheaf F) : is_subsheaf S.to_subsheaf := ⟨λ U x OC H, ⟨OC.glue $ λ i, classical.some (H i), λ P, have _ := classical.some_spec (H P.1) P.2, by rw ← F.Hcomp' at this; convert this⟩⟩ theorem is_subsheaf.is_sheaf_to_presheaf {O : sheaf.{u v} X} (S : subpresheaf O.to_presheaf) [is_subsheaf S] : is_sheaf S.to_presheaf := { left := λ U, S.locality, right := λ U OC s H, let ⟨f, hf⟩ := O.gluing OC (λ i, (s i).1) (λ j k, congr_arg subtype.val (H j k)) in ⟨⟨f, is_subsheaf.mem_of_res_mem OC $ λ i, (hf i).symm ▸ (s i).2⟩, λ i, subtype.eq $ hf i⟩ }