Datasets:
AI4M
/

text
stringlengths
0
3.34M
{-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.Algebra.Group where open import Cubical.Algebra.Group.Base public open import Cubical.Algebra.Group.Properties public open import Cubical.Algebra.Group.Morphism public open import Cubical.Algebra.Group.MorphismProperties public open import Cubical.Algebra.Group.Algebra public open import Cubical.Algebra.Group.Action public -- open import Cubical.Algebra.Group.Higher public -- open import Cubical.Algebra.Group.EilenbergMacLane1 public open import Cubical.Algebra.Group.Semidirect public open import Cubical.Algebra.Group.Notation public
If $f_1(x)/g_1(x)$ tends to $a$ as $x$ tends to $x_0$, and $f_2(x)$ and $g_2(x)$ are both small compared to $f_1(x)$ and $g_1(x)$, respectively, then $(f_1(x) + f_2(x))/(g_1(x) + g_2(x))$ tends to $a$ as $x$ tends to $x_0$.
This editor can edit this entry and tell us a bit about themselves by clicking the Edit icon. 20100501 21:19:37 nbsp Hi, and welcome to the wiki! I noticed you deleted some content from some pages. Its great to have new editors dive in and make changes, but it wasnt clear why you deleted what you did, and so various editors (including me) restored what you deleted. It seemed to me that the parts you deleted added important content to the entries. One was for a departed business thank you for marking that business as departed, but usually we keep the content around too, for historical reasons. Its interesting to see what businesses used to be in Davis and what they were like. But maybe if you said more why you deleted what you did others would come to see things your way (or maybe not). Wiki editing is very much a collaborative process where we try to come to agreement if we can. Anyway, let us know if you have any questions. I hope you stick around to make other edits. Users/CovertProfessor
Formal statement is: lemma enum_n_top: "a \<in> s \<Longrightarrow> a = enum n \<longleftrightarrow> (\<forall>a'\<in>s. a' \<le> a)" Informal statement is: If $a$ is an element of a set $s$, then $a$ is the $n$th element of $s$ if and only if $a$ is greater than or equal to every other element of $s$.
Formal statement is: lemma sequence_unique_limpt: fixes f :: "nat \<Rightarrow> 'a::t2_space" assumes "(f \<longlongrightarrow> l) sequentially" and "l' islimpt (range f)" shows "l' = l" Informal statement is: If a sequence converges to a limit $l$, then $l$ is the only limit point of the sequence.
import ..prooflab import lectures.lec18_nat_trans import tactic.basic --open PROOFS open PROOFS.STR open category_str --Q1 --Let's do this for additive groups. multiplicative groups are basically the same --We have defined the type of additve groups #check additive_Group universe u --we need to define the morphism between additive groups --let's define it like we did for additive_monoid @[ext] class additive_monoid.morphism (M : Type u) (N : Type u) [additive_monoid_str M] [additive_monoid_str N] := (to_fun : M → N) -- f : M → N -- the underlying function of morphism (resp_zero : to_fun 0 = 0) -- f (1_M ) = 1_N (resp_add : ∀ x y : M, to_fun (x + y) = to_fun x + to_fun y) -- f(x *_M y) = (f x) *_N (f y) @[ext] class additive_group.morphism (M : Type u) (N : Type u) [additive_group_str M] [additive_group_str N] := (to_fun : M → N) -- f : M → N -- the underlying function of morphism (resp_zero : to_fun 0 = 0) -- f (1_M ) = 1_N (resp_add : ∀ x y : M, to_fun (x + y) = to_fun x + to_fun y) -- f(x *_M y) = (f x) *_N (f y) --let's also define identity def additive_group.morphism.id {M : Type}[additive_group_str M] : additive_group.morphism M M := { to_fun := id, --just identity resp_zero := by {simp}, --simplify by previous lemmas resp_add := by {simp}, --same here } --we also need composition @[simp] def additive_group.morphism.comp {L M N : Type} [additive_group_str L] [additive_group_str M] [additive_group_str N] (g : additive_group.morphism M N) (f : additive_group.morphism L M) : additive_group.morphism L N := { to_fun := g.to_fun ∘ f.to_fun, --compose the to_funs resp_zero := by { dsimp, --simplify by definition rw f.resp_zero, --use the individual properties of the morphisms to get to the goal rw g.resp_zero, }, resp_add := by { intros x y, --introduction for ∀ dsimp, --simplfy by definition rw f.resp_add, --again, rewrite using individual properties rw g.resp_add, }, } --let's prove id_comp comp_id, and comp_assoc --id_comp @[simp] lemma additive_group.morphism.id_comp {L M : Type} [additive_group_str L] [additive_group_str M] (f : additive_group.morphism L M) : additive_group.morphism.comp additive_group.morphism.id f = f := begin ext, --apply extensionality refl, --lhs is exactly rhs end --comp_id @[simp] lemma additive_group.morphism.comp_id {L M : Type} [additive_group_str L] [additive_group_str M] (f : additive_group.morphism L M) : additive_group.morphism.comp f additive_group.morphism.id = f := begin ext, --apply extensionality refl, --lhs is exactly rhs end --comp_assoc @[simp] def additive_group.morphism.comp_assoc {K L M N: Type} [additive_group_str K] [additive_group_str L] [additive_group_str M] [additive_group_str N] (f : additive_group.morphism K L) (g : additive_group.morphism L M) (h : additive_group.morphism M N) : additive_group.morphism.comp (additive_group.morphism.comp h g) f = additive_group.morphism.comp h (additive_group.morphism.comp g f) := begin refl, --after simplifcation lhs is exactly rhs end instance cat_of_additive_groups : large_category_str (additive_Group) := { hom := λ X Y, additive_group.morphism X.carrier Y.carrier, --morphisms are additive_group.morphisms id := λ X, additive_group.morphism.id, --identiy is identity comp := λ X Y Z f g, additive_group.morphism.comp g f, --composition is defined above id_comp' := by {intros X Y f, apply additive_group.morphism.id_comp}, --proved above comp_id' := by {intros X Y f, apply additive_group.morphism.comp_id}, --proved above comp_assoc' := by {intros X Y Z W f g h, apply additive_group.morphism.comp_assoc}, --again, proved above } --Q2 @[ext] class mult_monoid_action (M A : Type) [mult_monoid_str M] := (smul : M → A → A) -- the scalar multiplication of `M` on `A`. (one_smul' : ∀ (x : A), smul (1 : M) x = x) (mul_smul' : ∀ (r s : M) (x : A), smul (r * s) x = smul r (smul s x)) --Show that a monoid action gives rise to a functor from the delooping category of the monoid to the category of types. You can show that by filling in for the sorry placeholder in below. set_option trace.simp_lemmas true def delooping_monoid_action (A : Type) [M : mult_Monoid] [mult_monoid_action M.carrier A] : (delooping_cat M).carrier ⥤ Type* := { obj := λ Y, A, --element of delooping monoid to element of type mor := λ X Y (m : M.carrier), λ a, mult_monoid_action.smul m a, --map unit morphism to function in A. use the scalar multiplication above to send a : A to the action of m on a (still A) resp_id' := by { intro X, --introduction for ∀ cases X, --extract the properties of X funext, --function extensionality apply mult_monoid_action.one_smul', --this is one_mul of the monoid action }, resp_comp' := by { intros X Y Z f g, --introduction for ∀ cases X, --extract the properties of X Y Z cases Y, cases Z, simp only [precategory_str.comp], --simplify by how we defined composition funext, --function extensionality dsimp, --simplify by definition rw ← mult_monoid_action.mul_smul', --rw the rhs as defined in mult_monoid_action.mul_smul' sorry, }, } --Q3 Yoneda open nat_trans local notation f ` ⊚ `:80 g:80 := precategory_str.comp g f -- type as \oo universes v₁ v₂ v₃ v₄ u₁ u₂ u₃ u₄ variables {𝓒 : Type u₁} [category_str.{v₁} 𝓒] {𝓓 : Type u₂} [category_str.{v₂} 𝓓] def Yoneda (X Y : 𝓒) (α : category_str.equiv (ℍom.obj X) (ℍom.obj Y)) : category_str.equiv X Y := { to_mor := α.to_mor.cmpt (op X) (𝟙 X), inv_mor := α.inv_mor.cmpt (op Y) (𝟙 Y), left_inv := by { have h₁, from α.inv_mor.naturality (α.to_mor.cmpt (op X) (𝟙 X)), simp at h₁, cases α, cases α_to_mor, cases α_inv_mor, simp at *, sorry, }, right_inv := by { sorry, }, } --Q4 /-! ## The Arrow Category : Given a category 𝓒 we want to construct a new category whose objects are morphisms of 𝓒 and whose morphisms are commutative squares in 𝓒. -/ -- @[ext] -- structure arrow_type (𝓒 : Type*) [small_category_str 𝓒] := -- (dom : 𝓒) -- (cod : 𝓒) -- (arrow : dom ⟶ cod) -- #check arrow_type local notation `𝔸𝕣` : 10 := arrow_type -- @[ext] -- structure arrow_type_hom {𝓒 : Type*}[small_category_str 𝓒] (α β : 𝔸𝕣 𝓒 ) := -- (top : α.dom ⟶ β.dom) -- (bot : α.cod ⟶ β.cod) -- (eq : β.arrow ⊚ top = bot ⊚ α.arrow) -- #check arrow_type_hom /- Show that we can equip `𝓒[→]` with the structure of a category where morphisms of 𝓒 and whose morphisms are commutative squares in 𝓒. -/ --added extensionality to functor and arrow structures. instance arrow_cat (𝓒 : Type*)[small_category_str 𝓒] : small_category_str (𝔸𝕣 𝓒) := { hom := λ α, λ β, arrow_type_hom α β , id := λ α, ⟨𝟙 α.dom, 𝟙 α.cod, by {simp,}⟩ , comp := by { intros X Y Z, --introduce X, Y, Z for for all intros f g, --introduce f, g for the implication cases f, --extract f components cases g, --extract g components exact ⟨ g_top ⊚ f_top, --composed top is the composition of the top components g_bot ⊚ f_bot, --composed bot is the composition of the bottom components by { simp, --simplify by how we defined compostion rw ←category_str.comp_assoc, --rewrite with the associativity of composition rw g_eq, --rewrite using g_eq rw category_str.comp_assoc, --use composition associativity again rw f_eq, --we can use f_eq to get the rhs to be the same as the lhs } ⟩, --done }, id_comp' := by { intros X Y f, --introduction for ∀ cases f, --extract f components simp, --simplify by previous definitions and lemmas } , comp_id' := by { intros X Y f, --introduction for ∀ cases f, --extract f components simp, --simplify by previous definitions and lemmas }, comp_assoc' := by { intros W X Y Z f g h, --introduction for ∀ cases f, --extract f,g,h components cases g, cases h, dsimp, --simplify by definition ext, --use extensionality of arrow_type_hom to prove equality {--top part dsimp, --simplify by definition apply category_str.comp_assoc, --this is composition associativity }, {--bottom part dsimp, --simplify by definition apply category_str.comp_assoc, --again, composition associativity }, }, } #check category_str.comp_assoc /- We shall define two functors form `𝔸𝕣 𝓒` to `𝓒`: `Dom` and `Cod`. `Dom` takes an arrow `f : X ⟶ Y` to its domain `X` and `Cod` takes `f` to `Y`. -/ def Dom (𝓒 : Type*)[small_category_str 𝓒] : (𝔸𝕣 𝓒) ⥤ 𝓒 := { obj := λ α, α.dom, mor := λ α β f, f.top, --just the top morphism resp_id' := by { intro X, --introduction for ∀ cases X, --extract X components dsimp, --simplify by definition refl, --reflexivity after simplification. the left identiy is the same as the right identity (both X_dom after stuff in lhs ().top) }, resp_comp' := by { intros X Y Z f g, --introduction for ∀ cases f, --extract f,g components cases g, dsimp, --simplify by definition refl, --reflexivity after simplification. .top lhs gives you the composition on the rhs } ,} def Cod (𝓒 : Type*)[small_category_str 𝓒] : (𝔸𝕣 𝓒) ⥤ 𝓒 := { obj := λ α, α.cod, mor := λ α β f, f.bot, --similar to Dom, but we use the bottom morphism this time resp_id' := by {--the proof will be similar to the proof for Dom intro X, --introduction for ∀ cases X, --extract X components dsimp, --simplify by definition refl, --reflexivity after simplification. the left identiy is the same as the right identity after taking .bot }, resp_comp' := by { intros X Y Z f g, --introduction for ∀ cases f, --extract f,g components cases g, dsimp, --simplify by definition refl, --reflexivity after simplification. .bot lhs gives you the composition on the rhs } ,} /- Theorem: For functors `F G : 𝓒 ⥤ 𝓓`, the type of natural transformations `F ⟶ G` is equivalent to the type of functors `𝓒 ⥤ 𝔸𝕣 𝓓` whose composition with `Dom` and `Cod` are equal to `F` and `G` respectively. Therefore, the arrow category classifies natural transformations. -/ local notation F ` ⊚⊚ `:80 G:80 := category_str.functor.comp G F def arrow_cat_classifies_nat_trans {𝓒 𝓓 : Type*}[small_category_str 𝓒] [small_category_str 𝓓] (F G : 𝓒 ⥤ 𝓓) : fun_equiv (F ⟶ G) ({ H : 𝓒 ⥤ 𝔸𝕣 𝓓 // ( (Dom 𝓓) ⊚⊚ H = F ) ∧ ((Cod 𝓓) ⊚⊚ H = G) }) := { to_fun := λ X, { val := { obj := λ α, { dom := F.obj α, cod := G.obj α, arrow := by { cases X, --extract X components exact X_cmpt α, --use the object map on α }, }, mor := by { intros α β f, --introduction for ∀ cases X, --extract X components cases F, --extract F components cases G, --extract G components dsimp at *, --simplify by definitions have h1 := F_mor f, --use the F morphism map on f have h2 := G_mor f, --use the G morphism map on f sorry, }, resp_id' := _, resp_comp' := _ }, property :=_, }, {val := { obj := λ α, { dom := F.obj α, cod := G.obj α, arrow := --object morphisms on α by { cases X, --extract X components exact X_cmpt α, --use the object map on α },}, mor := λ α β f, { top := F.map f, bot := G.map f,} --morphisms on f resp_id' := _, resp_comp' := _ } , inv_fun := _, left_inv := _, right_inv := _ } , inv_fun := _, left_inv := _, right_inv := _ }
[STATEMENT] lemma K_pmf_rel: defines "f \<equiv> \<lambda> (l, u). (l, [u]\<^sub>\<R>)" shows "rel_pmf (\<lambda> (l, u) st. (l, [u]\<^sub>\<R>) = st) \<mu> (map_pmf f \<mu>)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. rel_pmf (\<lambda>(l, u). (=) (l, [u]\<^sub>\<R>)) \<mu> (map_pmf f \<mu>) [PROOF STEP] unfolding f_def [PROOF STATE] proof (prove) goal (1 subgoal): 1. rel_pmf (\<lambda>(l, u). (=) (l, [u]\<^sub>\<R>)) \<mu> (map_pmf (\<lambda>(l, u). (l, [u]\<^sub>\<R>)) \<mu>) [PROOF STEP] by (subst pmf.rel_map(2)) (rule rel_pmf_reflI, auto)
import Data.Vect myReverse : Vect n el -> Vect n el myReverse [] = [] myReverse (x :: xs) = reverseProof (myReverse xs ++ [x]) where reverseProof : Vect (k + 1) el -> Vect (S k) el reverseProof {k} result = rewrite plusCommutative 1 k in result appendNil : Vect m elem -> Vect (plus m 0) elem appendNil {m} xs = rewrite plusZeroRightNeutral m in xs appendXs : Vect (S (m + k)) elem -> Vect (plus m (S k)) elem appendXs {m} {k} xs = rewrite sym (plusSuccRightSucc m k) in xs myAppend : Vect n elem -> Vect m elem -> Vect (m + n) elem myAppend [] ys = appendNil ys myAppend (x :: xs) ys = appendXs (x :: myAppend xs ys) myPlusCommutes : (n : Nat) -> (m : Nat) -> n + m = m + n myPlusCommutes Z m = sym (plusZeroRightNeutral m) myPlusCommutes (S k) m = rewrite myPlusCommutes k m in plusSuccRightSucc m k reverseProofXs : Vect ((S n) + len) el -> Vect (plus n (S len)) el reverseProofXs {n} {len} result = rewrite sym (plusSuccRightSucc n len) in result myReverse' : Vect n el -> Vect n el myReverse' xs = reverse' [] xs where reverse' : Vect n el -> Vect m el -> Vect (n + m) el reverse' {n} acc [] = rewrite plusZeroRightNeutral n in acc reverse' acc (x :: xs) = reverseProofXs (reverse' (x :: acc) xs)
/- Copyright (c) 2020 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 dynamics.fixed_points.basic ! leanprover-community/mathlib commit b86832321b586c6ac23ef8cdef6a7a27e42b13bd ! Please do not edit these lines, except to modify the commit id ! if you have ported upstream changes. -/ import Mathbin.Data.Set.Function import Mathbin.Logic.Function.Iterate import Mathbin.GroupTheory.Perm.Basic /-! # Fixed points of a self-map > THIS FILE IS SYNCHRONIZED WITH MATHLIB4. > Any changes to this file require a corresponding PR to mathlib4. In this file we define * the predicate `is_fixed_pt f x := f x = x`; * the set `fixed_points f` of fixed points of a self-map `f`. We also prove some simple lemmas about `is_fixed_pt` and `∘`, `iterate`, and `semiconj`. ## Tags fixed point -/ open Equiv universe u v variable {α : Type u} {β : Type v} {f fa g : α → α} {x y : α} {fb : β → β} {m n k : ℕ} {e : Perm α} namespace Function #print Function.IsFixedPt /- /-- A point `x` is a fixed point of `f : α → α` if `f x = x`. -/ def IsFixedPt (f : α → α) (x : α) := f x = x #align function.is_fixed_pt Function.IsFixedPt -/ #print Function.isFixedPt_id /- /-- Every point is a fixed point of `id`. -/ theorem isFixedPt_id (x : α) : IsFixedPt id x := (rfl : _) #align function.is_fixed_pt_id Function.isFixedPt_id -/ namespace IsFixedPt instance [h : DecidableEq α] {f : α → α} {x : α} : Decidable (IsFixedPt f x) := h (f x) x #print Function.IsFixedPt.eq /- /-- If `x` is a fixed point of `f`, then `f x = x`. This is useful, e.g., for `rw` or `simp`.-/ protected theorem eq (hf : IsFixedPt f x) : f x = x := hf #align function.is_fixed_pt.eq Function.IsFixedPt.eq -/ #print Function.IsFixedPt.comp /- /-- If `x` is a fixed point of `f` and `g`, then it is a fixed point of `f ∘ g`. -/ protected theorem comp (hf : IsFixedPt f x) (hg : IsFixedPt g x) : IsFixedPt (f ∘ g) x := calc f (g x) = f x := congr_arg f hg _ = x := hf #align function.is_fixed_pt.comp Function.IsFixedPt.comp -/ #print Function.IsFixedPt.iterate /- /-- If `x` is a fixed point of `f`, then it is a fixed point of `f^[n]`. -/ protected theorem iterate (hf : IsFixedPt f x) (n : ℕ) : IsFixedPt (f^[n]) x := iterate_fixed hf n #align function.is_fixed_pt.iterate Function.IsFixedPt.iterate -/ #print Function.IsFixedPt.left_of_comp /- /-- If `x` is a fixed point of `f ∘ g` and `g`, then it is a fixed point of `f`. -/ theorem left_of_comp (hfg : IsFixedPt (f ∘ g) x) (hg : IsFixedPt g x) : IsFixedPt f x := calc f x = f (g x) := congr_arg f hg.symm _ = x := hfg #align function.is_fixed_pt.left_of_comp Function.IsFixedPt.left_of_comp -/ #print Function.IsFixedPt.to_leftInverse /- /-- If `x` is a fixed point of `f` and `g` is a left inverse of `f`, then `x` is a fixed point of `g`. -/ theorem to_leftInverse (hf : IsFixedPt f x) (h : LeftInverse g f) : IsFixedPt g x := calc g x = g (f x) := congr_arg g hf.symm _ = x := h x #align function.is_fixed_pt.to_left_inverse Function.IsFixedPt.to_leftInverse -/ #print Function.IsFixedPt.map /- /-- If `g` (semi)conjugates `fa` to `fb`, then it sends fixed points of `fa` to fixed points of `fb`. -/ protected theorem map {x : α} (hx : IsFixedPt fa x) {g : α → β} (h : Semiconj g fa fb) : IsFixedPt fb (g x) := calc fb (g x) = g (fa x) := (h.Eq x).symm _ = g x := congr_arg g hx #align function.is_fixed_pt.map Function.IsFixedPt.map -/ #print Function.IsFixedPt.apply /- protected theorem apply {x : α} (hx : IsFixedPt f x) : IsFixedPt f (f x) := by convert hx #align function.is_fixed_pt.apply Function.IsFixedPt.apply -/ #print Function.IsFixedPt.preimage_iterate /- theorem preimage_iterate {s : Set α} (h : IsFixedPt (Set.preimage f) s) (n : ℕ) : IsFixedPt (Set.preimage (f^[n])) s := by rw [Set.preimage_iterate_eq] exact h.iterate n #align function.is_fixed_pt.preimage_iterate Function.IsFixedPt.preimage_iterate -/ #print Function.IsFixedPt.equiv_symm /- protected theorem equiv_symm (h : IsFixedPt e x) : IsFixedPt e.symm x := h.to_leftInverse e.leftInverse_symm #align function.is_fixed_pt.equiv_symm Function.IsFixedPt.equiv_symm -/ #print Function.IsFixedPt.perm_inv /- protected theorem perm_inv (h : IsFixedPt e x) : IsFixedPt (⇑e⁻¹) x := h.equiv_symm #align function.is_fixed_pt.perm_inv Function.IsFixedPt.perm_inv -/ #print Function.IsFixedPt.perm_pow /- protected theorem perm_pow (h : IsFixedPt e x) (n : ℕ) : IsFixedPt (⇑(e ^ n)) x := by rw [Equiv.Perm.coe_pow] exact h.iterate _ #align function.is_fixed_pt.perm_pow Function.IsFixedPt.perm_pow -/ #print Function.IsFixedPt.perm_zpow /- protected theorem perm_zpow (h : IsFixedPt e x) : ∀ n : ℤ, IsFixedPt (⇑(e ^ n)) x | Int.ofNat n => h.perm_pow _ | Int.negSucc n => (h.perm_pow <| n + 1).perm_inv #align function.is_fixed_pt.perm_zpow Function.IsFixedPt.perm_zpow -/ end IsFixedPt #print Function.Injective.isFixedPt_apply_iff /- @[simp] theorem Injective.isFixedPt_apply_iff (hf : Injective f) {x : α} : IsFixedPt f (f x) ↔ IsFixedPt f x := ⟨fun h => hf h.Eq, IsFixedPt.apply⟩ #align function.injective.is_fixed_pt_apply_iff Function.Injective.isFixedPt_apply_iff -/ #print Function.fixedPoints /- /-- The set of fixed points of a map `f : α → α`. -/ def fixedPoints (f : α → α) : Set α := { x : α | IsFixedPt f x } #align function.fixed_points Function.fixedPoints -/ #print Function.fixedPoints.decidable /- instance fixedPoints.decidable [DecidableEq α] (f : α → α) (x : α) : Decidable (x ∈ fixedPoints f) := IsFixedPt.decidable #align function.fixed_points.decidable Function.fixedPoints.decidable -/ #print Function.mem_fixedPoints /- @[simp] theorem mem_fixedPoints : x ∈ fixedPoints f ↔ IsFixedPt f x := Iff.rfl #align function.mem_fixed_points Function.mem_fixedPoints -/ #print Function.mem_fixedPoints_iff /- theorem mem_fixedPoints_iff {α : Type _} {f : α → α} {x : α} : x ∈ fixedPoints f ↔ f x = x := by rfl #align function.mem_fixed_points_iff Function.mem_fixedPoints_iff -/ #print Function.fixedPoints_id /- @[simp] theorem fixedPoints_id : fixedPoints (@id α) = Set.univ := Set.ext fun _ => by simpa using is_fixed_pt_id _ #align function.fixed_points_id Function.fixedPoints_id -/ #print Function.fixedPoints_subset_range /- theorem fixedPoints_subset_range : fixedPoints f ⊆ Set.range f := fun x hx => ⟨x, hx⟩ #align function.fixed_points_subset_range Function.fixedPoints_subset_range -/ #print Function.Semiconj.mapsTo_fixedPoints /- /-- If `g` semiconjugates `fa` to `fb`, then it sends fixed points of `fa` to fixed points of `fb`. -/ theorem Semiconj.mapsTo_fixedPoints {g : α → β} (h : Semiconj g fa fb) : Set.MapsTo g (fixedPoints fa) (fixedPoints fb) := fun x hx => hx.map h #align function.semiconj.maps_to_fixed_pts Function.Semiconj.mapsTo_fixedPoints -/ #print Function.invOn_fixedPoints_comp /- /-- Any two maps `f : α → β` and `g : β → α` are inverse of each other on the sets of fixed points of `f ∘ g` and `g ∘ f`, respectively. -/ theorem invOn_fixedPoints_comp (f : α → β) (g : β → α) : Set.InvOn f g (fixedPoints <| f ∘ g) (fixedPoints <| g ∘ f) := ⟨fun x => id, fun x => id⟩ #align function.inv_on_fixed_pts_comp Function.invOn_fixedPoints_comp -/ #print Function.mapsTo_fixedPoints_comp /- /-- Any map `f` sends fixed points of `g ∘ f` to fixed points of `f ∘ g`. -/ theorem mapsTo_fixedPoints_comp (f : α → β) (g : β → α) : Set.MapsTo f (fixedPoints <| g ∘ f) (fixedPoints <| f ∘ g) := fun x hx => hx.map fun x => rfl #align function.maps_to_fixed_pts_comp Function.mapsTo_fixedPoints_comp -/ #print Function.bijOn_fixedPoints_comp /- /-- Given two maps `f : α → β` and `g : β → α`, `g` is a bijective map between the fixed points of `f ∘ g` and the fixed points of `g ∘ f`. The inverse map is `f`, see `inv_on_fixed_pts_comp`. -/ theorem bijOn_fixedPoints_comp (f : α → β) (g : β → α) : Set.BijOn g (fixedPoints <| f ∘ g) (fixedPoints <| g ∘ f) := (invOn_fixedPoints_comp f g).BijOn (mapsTo_fixedPoints_comp g f) (mapsTo_fixedPoints_comp f g) #align function.bij_on_fixed_pts_comp Function.bijOn_fixedPoints_comp -/ #print Function.Commute.invOn_fixedPoints_comp /- /-- If self-maps `f` and `g` commute, then they are inverse of each other on the set of fixed points of `f ∘ g`. This is a particular case of `function.inv_on_fixed_pts_comp`. -/ theorem Commute.invOn_fixedPoints_comp (h : Commute f g) : Set.InvOn f g (fixedPoints <| f ∘ g) (fixedPoints <| f ∘ g) := by simpa only [h.comp_eq] using inv_on_fixed_pts_comp f g #align function.commute.inv_on_fixed_pts_comp Function.Commute.invOn_fixedPoints_comp -/ #print Function.Commute.left_bijOn_fixedPoints_comp /- /-- If self-maps `f` and `g` commute, then `f` is bijective on the set of fixed points of `f ∘ g`. This is a particular case of `function.bij_on_fixed_pts_comp`. -/ theorem Commute.left_bijOn_fixedPoints_comp (h : Commute f g) : Set.BijOn f (fixedPoints <| f ∘ g) (fixedPoints <| f ∘ g) := by simpa only [h.comp_eq] using bij_on_fixed_pts_comp g f #align function.commute.left_bij_on_fixed_pts_comp Function.Commute.left_bijOn_fixedPoints_comp -/ #print Function.Commute.right_bijOn_fixedPoints_comp /- /-- If self-maps `f` and `g` commute, then `g` is bijective on the set of fixed points of `f ∘ g`. This is a particular case of `function.bij_on_fixed_pts_comp`. -/ theorem Commute.right_bijOn_fixedPoints_comp (h : Commute f g) : Set.BijOn g (fixedPoints <| f ∘ g) (fixedPoints <| f ∘ g) := by simpa only [h.comp_eq] using bij_on_fixed_pts_comp f g #align function.commute.right_bij_on_fixed_pts_comp Function.Commute.right_bijOn_fixedPoints_comp -/ end Function
(* Title: HOL/Auth/n_flash_lemma_on_inv__110.thy Author: Yongjian Li and Kaiqiang Duan, State Key Lab of Computer Science, Institute of Software, Chinese Academy of Sciences Copyright 2016 State Key Lab of Computer Science, Institute of Software, Chinese Academy of Sciences *) header{*The n_flash Protocol Case Study*} theory n_flash_lemma_on_inv__110 imports n_flash_base begin section{*All lemmas on causal relation between inv__110 and some rule r*} lemma n_PI_Remote_GetVsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_PI_Remote_Get src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_PI_Remote_Get src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_PI_Remote_GetXVsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_PI_Remote_GetX src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_PI_Remote_GetX src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_PI_Remote_PutXVsinv__110: assumes a1: "(\<exists> dst. dst\<le>N\<and>r=n_PI_Remote_PutX dst)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain dst where a1:"dst\<le>N\<and>r=n_PI_Remote_PutX dst" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(dst=p__Inv4)\<or>(dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(dst=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(dst~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_PI_Remote_ReplaceVsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_PI_Remote_Replace src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_PI_Remote_Replace src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_NakVsinv__110: assumes a1: "(\<exists> dst. dst\<le>N\<and>r=n_NI_Nak dst)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain dst where a1:"dst\<le>N\<and>r=n_NI_Nak dst" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(dst=p__Inv4)\<or>(dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(dst=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(dst~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_Get_Nak__part__0Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Nak__part__0 src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Nak__part__0 src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_Get_Nak__part__1Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Nak__part__1 src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Nak__part__1 src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_Get_Nak__part__2Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Nak__part__2 src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Nak__part__2 src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_Get_Get__part__0Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Get__part__0 src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Get__part__0 src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_Get_Get__part__1Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Get__part__1 src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Get__part__1 src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_Get_Put_HeadVsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Put_Head N src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Put_Head N src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_Get_PutVsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Put src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Put src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_Get_Put_DirtyVsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Put_Dirty src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Put_Dirty src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Remote_Get_NakVsinv__110: assumes a1: "(\<exists> src dst. src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_Get_Nak src dst)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src dst where a1:"src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_Get_Nak src dst" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4\<and>dst~=p__Inv4)\<or>(src~=p__Inv4\<and>dst=p__Inv4)\<or>(src~=p__Inv4\<and>dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4\<and>dst~=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4\<and>dst=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4\<and>dst~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Remote_Get_PutVsinv__110: assumes a1: "(\<exists> src dst. src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_Get_Put src dst)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src dst where a1:"src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_Get_Put src dst" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4\<and>dst~=p__Inv4)\<or>(src~=p__Inv4\<and>dst=p__Inv4)\<or>(src~=p__Inv4\<and>dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4\<and>dst~=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4\<and>dst=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4\<and>dst~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Remote_Get_Put_HomeVsinv__110: assumes a1: "(\<exists> dst. dst\<le>N\<and>r=n_NI_Remote_Get_Put_Home dst)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain dst where a1:"dst\<le>N\<and>r=n_NI_Remote_Get_Put_Home dst" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(dst=p__Inv4)\<or>(dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(dst=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(dst~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_Nak__part__0Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_Nak__part__0 src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_Nak__part__0 src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_Nak__part__1Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_Nak__part__1 src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_Nak__part__1 src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_Nak__part__2Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_Nak__part__2 src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_Nak__part__2 src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_GetX__part__0Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_GetX__part__0 src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_GetX__part__0 src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P3 s" apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Para (Field (Ident ''Sta'') ''Proc'') p__Inv4) ''CacheState'')) (Const CACHE_E)) (eqn (IVar (Field (Field (Ident ''Sta'') ''Dir'') ''HomeHeadPtr'')) (Const true))))" in exI, auto) done then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_GetX__part__1Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_GetX__part__1 src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_GetX__part__1 src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P3 s" apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Para (Field (Ident ''Sta'') ''UniMsg'') p__Inv4) ''Cmd'')) (Const UNI_GetX)) (eqn (IVar (Field (Para (Field (Ident ''Sta'') ''Proc'') p__Inv4) ''CacheState'')) (Const CACHE_E))))" in exI, auto) done then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_PutX_1Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_1 N src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_1 N src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_PutX_2Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_2 N src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_2 N src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_PutX_3Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_3 N src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_3 N src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_PutX_4Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_4 N src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_4 N src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_PutX_5Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_5 N src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_5 N src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_PutX_6Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_6 N src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_6 N src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_PutX_7__part__0Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_7__part__0 N src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_7__part__0 N src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_PutX_7__part__1Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_7__part__1 N src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_7__part__1 N src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_PutX_7_NODE_Get__part__0Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_7_NODE_Get__part__0 N src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_7_NODE_Get__part__0 N src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_PutX_7_NODE_Get__part__1Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_7_NODE_Get__part__1 N src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_7_NODE_Get__part__1 N src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_PutX_8_HomeVsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_8_Home N src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_8_Home N src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_PutX_8_Home_NODE_GetVsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_8_Home_NODE_Get N src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_8_Home_NODE_Get N src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_PutX_8Vsinv__110: assumes a1: "(\<exists> src pp. src\<le>N\<and>pp\<le>N\<and>src~=pp\<and>r=n_NI_Local_GetX_PutX_8 N src pp)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src pp where a1:"src\<le>N\<and>pp\<le>N\<and>src~=pp\<and>r=n_NI_Local_GetX_PutX_8 N src pp" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4\<and>pp~=p__Inv4)\<or>(src~=p__Inv4\<and>pp=p__Inv4)\<or>(src~=p__Inv4\<and>pp~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4\<and>pp~=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4\<and>pp=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4\<and>pp~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_PutX_8_NODE_GetVsinv__110: assumes a1: "(\<exists> src pp. src\<le>N\<and>pp\<le>N\<and>src~=pp\<and>r=n_NI_Local_GetX_PutX_8_NODE_Get N src pp)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src pp where a1:"src\<le>N\<and>pp\<le>N\<and>src~=pp\<and>r=n_NI_Local_GetX_PutX_8_NODE_Get N src pp" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4\<and>pp~=p__Inv4)\<or>(src~=p__Inv4\<and>pp=p__Inv4)\<or>(src~=p__Inv4\<and>pp~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4\<and>pp~=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4\<and>pp=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4\<and>pp~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_PutX_9__part__0Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_9__part__0 N src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_9__part__0 N src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_PutX_9__part__1Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_9__part__1 N src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_9__part__1 N src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_PutX_10_HomeVsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_10_Home N src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_10_Home N src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_PutX_10Vsinv__110: assumes a1: "(\<exists> src pp. src\<le>N\<and>pp\<le>N\<and>src~=pp\<and>r=n_NI_Local_GetX_PutX_10 N src pp)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src pp where a1:"src\<le>N\<and>pp\<le>N\<and>src~=pp\<and>r=n_NI_Local_GetX_PutX_10 N src pp" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4\<and>pp~=p__Inv4)\<or>(src~=p__Inv4\<and>pp=p__Inv4)\<or>(src~=p__Inv4\<and>pp~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4\<and>pp~=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4\<and>pp=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4\<and>pp~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Local_GetX_PutX_11Vsinv__110: assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_11 N src)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_11 N src" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Remote_GetX_NakVsinv__110: assumes a1: "(\<exists> src dst. src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_GetX_Nak src dst)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src dst where a1:"src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_GetX_Nak src dst" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4\<and>dst~=p__Inv4)\<or>(src~=p__Inv4\<and>dst=p__Inv4)\<or>(src~=p__Inv4\<and>dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4\<and>dst~=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4\<and>dst=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4\<and>dst~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Remote_GetX_PutXVsinv__110: assumes a1: "(\<exists> src dst. src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_GetX_PutX src dst)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain src dst where a1:"src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_GetX_PutX src dst" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(src=p__Inv4\<and>dst~=p__Inv4)\<or>(src~=p__Inv4\<and>dst=p__Inv4)\<or>(src~=p__Inv4\<and>dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(src=p__Inv4\<and>dst~=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4\<and>dst=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(src~=p__Inv4\<and>dst~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Remote_GetX_PutX_HomeVsinv__110: assumes a1: "(\<exists> dst. dst\<le>N\<and>r=n_NI_Remote_GetX_PutX_Home dst)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain dst where a1:"dst\<le>N\<and>r=n_NI_Remote_GetX_PutX_Home dst" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(dst=p__Inv4)\<or>(dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(dst=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(dst~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Remote_PutVsinv__110: assumes a1: "(\<exists> dst. dst\<le>N\<and>r=n_NI_Remote_Put dst)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain dst where a1:"dst\<le>N\<and>r=n_NI_Remote_Put dst" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(dst=p__Inv4)\<or>(dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(dst=p__Inv4)" have "((formEval (eqn (IVar (Field (Para (Field (Ident ''Sta'') ''Proc'') p__Inv4) ''InvMarked'')) (Const true)) s))\<or>((formEval (neg (eqn (IVar (Field (Para (Field (Ident ''Sta'') ''Proc'') p__Inv4) ''InvMarked'')) (Const true))) s))" by auto moreover { assume c1: "((formEval (eqn (IVar (Field (Para (Field (Ident ''Sta'') ''Proc'') p__Inv4) ''InvMarked'')) (Const true)) s))" have "?P1 s" proof(cut_tac a1 a2 b1 c1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume c1: "((formEval (neg (eqn (IVar (Field (Para (Field (Ident ''Sta'') ''Proc'') p__Inv4) ''InvMarked'')) (Const true))) s))" have "?P1 s" proof(cut_tac a1 a2 b1 c1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately have "invHoldForRule s f r (invariants N)" by satx } moreover { assume b1: "(dst~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_Remote_PutXVsinv__110: assumes a1: "(\<exists> dst. dst\<le>N\<and>r=n_NI_Remote_PutX dst)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain dst where a1:"dst\<le>N\<and>r=n_NI_Remote_PutX dst" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(dst=p__Inv4)\<or>(dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(dst=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(dst~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_NI_InvVsinv__110: assumes a1: "(\<exists> dst. dst\<le>N\<and>r=n_NI_Inv dst)" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain dst where a1:"dst\<le>N\<and>r=n_NI_Inv dst" apply fastforce done from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__110 p__Inv4" apply fastforce done have "(dst=p__Inv4)\<or>(dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(dst=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(dst~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_PI_Local_GetX_PutX__part__0Vsinv__110: assumes a1: "r=n_PI_Local_GetX_PutX__part__0 " and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_NI_WbVsinv__110: assumes a1: "r=n_NI_Wb " and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_StoreVsinv__110: assumes a1: "\<exists> src data. src\<le>N\<and>data\<le>N\<and>r=n_Store src data" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_NI_InvAck_3Vsinv__110: assumes a1: "\<exists> src. src\<le>N\<and>r=n_NI_InvAck_3 N src" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_NI_InvAck_1Vsinv__110: assumes a1: "\<exists> src. src\<le>N\<and>r=n_NI_InvAck_1 N src" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_PI_Local_GetX_GetX__part__1Vsinv__110: assumes a1: "r=n_PI_Local_GetX_GetX__part__1 " and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_PI_Local_GetX_GetX__part__0Vsinv__110: assumes a1: "r=n_PI_Local_GetX_GetX__part__0 " and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_Store_HomeVsinv__110: assumes a1: "\<exists> data. data\<le>N\<and>r=n_Store_Home data" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_PI_Local_ReplaceVsinv__110: assumes a1: "r=n_PI_Local_Replace " and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_NI_InvAck_existsVsinv__110: assumes a1: "\<exists> src pp. src\<le>N\<and>pp\<le>N\<and>src~=pp\<and>r=n_NI_InvAck_exists src pp" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_PI_Local_PutXVsinv__110: assumes a1: "r=n_PI_Local_PutX " and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_PI_Local_Get_PutVsinv__110: assumes a1: "r=n_PI_Local_Get_Put " and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_NI_ShWbVsinv__110: assumes a1: "r=n_NI_ShWb N " and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_PI_Local_GetX_PutX_HeadVld__part__0Vsinv__110: assumes a1: "r=n_PI_Local_GetX_PutX_HeadVld__part__0 N " and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_NI_ReplaceVsinv__110: assumes a1: "\<exists> src. src\<le>N\<and>r=n_NI_Replace src" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_NI_Remote_GetX_Nak_HomeVsinv__110: assumes a1: "\<exists> dst. dst\<le>N\<and>r=n_NI_Remote_GetX_Nak_Home dst" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_NI_Local_PutXAcksDoneVsinv__110: assumes a1: "r=n_NI_Local_PutXAcksDone " and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_PI_Local_GetX_PutX__part__1Vsinv__110: assumes a1: "r=n_PI_Local_GetX_PutX__part__1 " and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_NI_Remote_Get_Nak_HomeVsinv__110: assumes a1: "\<exists> dst. dst\<le>N\<and>r=n_NI_Remote_Get_Nak_Home dst" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_NI_InvAck_exists_HomeVsinv__110: assumes a1: "\<exists> src. src\<le>N\<and>r=n_NI_InvAck_exists_Home src" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_NI_Replace_HomeVsinv__110: assumes a1: "r=n_NI_Replace_Home " and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_NI_Local_PutVsinv__110: assumes a1: "r=n_NI_Local_Put " and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_NI_Nak_ClearVsinv__110: assumes a1: "r=n_NI_Nak_Clear " and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_PI_Local_Get_GetVsinv__110: assumes a1: "r=n_PI_Local_Get_Get " and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_NI_Nak_HomeVsinv__110: assumes a1: "r=n_NI_Nak_Home " and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_NI_InvAck_2Vsinv__110: assumes a1: "\<exists> src. src\<le>N\<and>r=n_NI_InvAck_2 N src" and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_PI_Local_GetX_PutX_HeadVld__part__1Vsinv__110: assumes a1: "r=n_PI_Local_GetX_PutX_HeadVld__part__1 N " and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_NI_FAckVsinv__110: assumes a1: "r=n_NI_FAck " and a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__110 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done end
[STATEMENT] lemma graph_antimono: "antimono (graph A w)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. monotone (\<le>) (\<lambda>x y. y \<subseteq> x) (graph A w) [PROOF STEP] using alternate_antimono clean_decreasing prune_decreasing [PROOF STATE] proof (prove) using this: \<lbrakk>\<And>x. ?f x \<le> x; \<And>x. ?g x \<le> x\<rbrakk> \<Longrightarrow> decseq (alternate ?f ?g) clean ?A ?w ?V \<subseteq> ?V prune ?A ?w ?V \<subseteq> ?V goal (1 subgoal): 1. monotone (\<le>) (\<lambda>x y. y \<subseteq> x) (graph A w) [PROOF STEP] unfolding monotone_def le_fun_def graph_def [PROOF STATE] proof (prove) using this: \<lbrakk>\<And>x. ?f x \<le> x; \<And>x. ?g x \<le> x\<rbrakk> \<Longrightarrow> \<forall>x y. x \<le> y \<longrightarrow> (\<forall>xa. alternate ?f ?g y xa \<le> alternate ?f ?g x xa) clean ?A ?w ?V \<subseteq> ?V prune ?A ?w ?V \<subseteq> ?V goal (1 subgoal): 1. \<forall>x y. x \<le> y \<longrightarrow> alternate (clean A w) (prune A w) y (gunodes A w) \<subseteq> alternate (clean A w) (prune A w) x (gunodes A w) [PROOF STEP] by metis
lemma prime_nat_not_dvd: assumes "prime p" "p > n" "n \<noteq> (1::nat)" shows "\<not>n dvd p"
State Before: α : Type u o n m : ℕ m' : Type uₘ n' : Type uₙ o' : Type uₒ a b : ℕ inst✝¹ : AddCommMonoid α inst✝ : Mul α a₀ a₁ b₀ b₁ : α ⊢ ![a₀, a₁] ⬝ᵥ ![b₀, b₁] = a₀ * b₀ + a₁ * b₁ State After: no goals Tactic: rw [cons_dotProduct_cons, cons_dotProduct_cons, dotProduct_empty, add_zero]
function vbmc_plot(vp_array,stats) if nargin < 2; stats = []; end Nsamples = 1e5; if ~iscell(vp_array) temp{1} = vp_array; vp_array = temp; end if numel(vp_array) == 1 && vbmc_isavp(vp_array{1}) X = vbmc_rnd(vp_array{1},Nsamples); for d = 1:size(X,2); names{d} = ['x_{' num2str(d) '}']; end cornerplot(X,names); else Nbins = 40; Nvps = numel(vp_array); D = vp_array{1}.D; mm = zeros(Nvps,D); cmap = colormap; cmap = cmap(mod((1:27:(1+27*64))-1,64)+1,:); plotmat = [1 1; 1 2; 1 3; 2 2; 2 3; 2 3; 2 4; 2 4; 3 3; 3 4; 3 4; 3 4; 3 5; 3 5; 3 5; 4 4; 4 5; 4 5; 4 5]; nrows = plotmat(D,1); ncols = plotmat(D,2); for i = 1:Nvps if ~isempty(stats) && stats.idx_best == i; best_flag = true; else; best_flag = false; end ltext{i} = ['vp #' num2str(i)]; if best_flag; ltext{i} = [ltext{i} ' (best)']; end X = vbmc_rnd(vp_array{i},Nsamples); mm(i,:) = median(X); for d = 1:D subplot(nrows,ncols,d); if best_flag; lw = 3; else; lw = 1; end hst(i)=histogram(X(:,d),Nbins,'Normalization','probability','Displaystyle','stairs','LineWidth',lw,'EdgeColor',cmap(i,:)); hold on; end end for i = 1:Nvps if ~isempty(stats) && stats.idx_best == i; best_flag = true; else; best_flag = false; end for d = 1:D subplot(nrows,ncols,d); if best_flag; lw = 3; else; lw = 1; end hln(i)=plot(mm(i,d)*[1 1],ylim,'-','LineWidth',lw,'Color',cmap(i,:)); hold on; end end for d = 1:D subplot(nrows,ncols,d); xlabel(['x_{' num2str(d) '}']); set(gca,'TickDir','out'); box off; if d == D hleg = legend(hln,ltext{:}); set(hleg,'box','off','location','best'); end end set(gcf,'Color','w'); end end
Load LFindLoad. From lfind Require Import LFind. From QuickChick Require Import QuickChick. From adtind Require Import goal4. Derive Show for natural. Derive Arbitrary for natural. Instance Dec_Eq_natural : Dec_Eq natural. Proof. dec_eq. Qed. Derive Show for lst. Derive Arbitrary for lst. Instance Dec_Eq_lst : Dec_Eq lst. Proof. dec_eq. Qed. Lemma conj1eqsynthconj1 : forall (lv0 : natural), (@eq natural (lv0) (lv0)). Admitted. QuickChick conj1eqsynthconj1.
[STATEMENT] lemma ni_top: "ni(top) = L" [PROOF STATE] proof (prove) goal (1 subgoal): 1. ni top = L [PROOF STEP] by (simp add: n_top ni_def)
#pragma once #ifndef NN_HPP #define NN_HPP #define EIGEN_NO_DEBUG // c++ libraries #include <iosfwd> // eigen #include <Eigen/Dense> // ann - math #include "src/math/random.hpp" // ann - mem #include "src/mem/serialize.hpp" // ann - typedef #include "src/util/typedef.hpp" namespace NN{ //*********************************************************************** // COMPILER DIRECTIVES //*********************************************************************** #ifndef NN_PRINT_FUNC #define NN_PRINT_FUNC 0 #endif #ifndef NN_PRINT_STATUS #define NN_PRINT_STATUS 0 #endif #ifndef NN_PRINT_DATA #define NN_PRINT_DATA 0 #endif //*********************************************************************** // FORWARD DECLARATIONS //*********************************************************************** class ANN; class ANNInit; class Cost; class DOutDVal; class DOutDP; class D2OutDPDVal; //*********************************************************************** // INITIALIZATION METHOD //*********************************************************************** class Init{ public: //enum enum Type{ UNKNOWN=0, RAND=1, XAVIER=2, HE=3, MEAN=4 }; //constructor Init():t_(Type::UNKNOWN){} Init(Type t):t_(t){} //operators operator Type()const{return t_;} //member functions static Init read(const char* str); static const char* name(const Init& init); private: Type t_; //prevent automatic conversion for other built-in types //template<typename T> operator T() const; }; std::ostream& operator<<(std::ostream& out, const Init& init); //*********************************************************************** // TRANSFER FUNCTIONS //*********************************************************************** class Transfer{ public: //type enum Type{ UNKNOWN=0, LINEAR=1, SIGMOID=2, TANH=3, ISRU=4, ARCTAN=5, SOFTSIGN=6, RELU=7, SOFTPLUS=8, ELU=9, GELU=10, SWISH=11, MISH=12, TANHRE=13 }; //constructor Transfer():t_(Type::UNKNOWN){} Transfer(Type t):t_(t){} //operators operator Type()const{return t_;} //member functions static Transfer read(const char* str); static const char* name(const Transfer& tf); //function static void tf_lin(VecXd& f, VecXd& d); static void tf_sigmoid(VecXd& f, VecXd& d); static void tf_tanh(VecXd& f, VecXd& d); static void tf_isru(VecXd& f, VecXd& d); static void tf_arctan(VecXd& f, VecXd& d); static void tf_softsign(VecXd& f, VecXd& d); static void tf_relu(VecXd& f, VecXd& d); static void tf_softplus(VecXd& f, VecXd& d); static void tf_elu(VecXd& f, VecXd& d); static void tf_gelu(VecXd& f, VecXd& d); static void tf_swish(VecXd& f, VecXd& d); static void tf_mish(VecXd& f, VecXd& d); static void tf_tanhre(VecXd& f, VecXd& d); private: Type t_; //prevent automatic conversion for other built-in types //template<typename T> operator T() const; }; std::ostream& operator<<(std::ostream& out, const Transfer& tf); //*********************************************************************** // ANN //*********************************************************************** /* DEFINITIONS: ensemble - total set of all data (e.g. training "ensemble") element - single datum from ensemble c - "c" donotes the cost function, e.g. the gradient of the cost function w.r.t. the value of a node is dc/da z - "z" is the input to each node, e.g. the gradient of a node w.r.t. to its input is da/dz a - "a" is the value of a node, e.g. the gradient of a node w.r.t. to its input is da/dz o - "o" is the output of the network (i.e. out_), e.g. the gradient of the output w.r.t. the input is do/di i - "i" is the input of the network (i.e. in_), e.g. the gradient of the output w.r.t. the input is do/di PRIVATE: VecXd in_ - raw input data for a single element of the ensemble (e.g. training set) VecXd inw_ - weight used to scale the input data VecXd inb_ - bias used to shift the input data VecXd out_ - raw output data given a single input element VecXd outw_ - weight used to scale the output data VecXd outb_ - bias used to shift the output data int nlayer_ - total number of hidden layers best thought of as the number of "connections" between layers nlayer_ must be greater than zero for an initialized network this is true even for a network with zero "hidden" layers an uninitialized network has nlayer_ = 0 if we have just the input and output: nlayer_ = 1 one set of weights,biases connecting input/output if we have one hidden layer: nlayer_ = 2 two sets of weights,biases connecting input/layer0/output if we have two hidden layers: nlayer_ = 3 three sets of weights,biases connecting input/layer0/layer1/output et cetera std::vector<VecXd> node_ - all nodes, including the input, output, and hidden layers the raw input and output (in_,out_) are separate from "node_" this is because the raw input/output may be shifted/scaled before being used thus, while in_/out_ are the "raw" input/output, the front/back of "node_" can be thought of the "scaled" input/output note that scaling is not necessary, but made optional with the use of in_/out_ has a size of "nlayer_+1", as there are "nlayer_" connections between "nlayer_+1" nodes std::vector<VecXd> bias_ - the bias of each layer, best thought of as the bias "between" layers n,n+1 bias_[n] must have the size node_[n+1] - we add this bias when going from node_[n] to node_[n+1] has a size of "nlayer_", as there are "nlayer_" connections between "nlayer_+1" nodes std::vector<MatXd> edge_ - the weights of each layer, best though of as transforming from layers n to n+1 edge_[n] must have the size (node_[n+1],node_[n]) - matrix multiplying (node_[n]) to get (node_[n+1]) has a size of "nlayer_", as there are "nlayer_" connections between "nlayer_+1" nodes std::vector<VecXd> dadz_ - the gradient of the value of a node (a) w.r.t. the input of the node (z) - da/dz practically, the gradient of the transfer function of each layer best thought of as the gradient associated with function transferring "between" layers n,n+1 thus, dadz_[n] must have the size node_[n+1] has a size of "nlayer_", as there are "nlayer_" connections between "nlayer_+1" nodes tf_ - the type of the transfer function note the transfer function for the last layer is always linear tfp_ - (Transfer Function, Function Derivative, Vector) the transfer function for each layer, operates on entire vector at once computes both function and derivative simultaneously */ class ANN{ private: //typedefs typedef void (*TFP)(VecXd&,VecXd&); //layers int nlayer_;//number of layers (weights,biases) //transfer functions Transfer tf_;//transfer function type std::vector<TFP> tfp_;//transfer function - input for indexed layer (nlayer_) //input/output VecXd in_;//input layer VecXd out_;//output layer VecXd inw_,inb_;//input weight, bias VecXd outw_,outb_;//output weight, bias //gradients - nodes std::vector<VecXd> dadz_;//node derivative - not including input layer (nlayer_) //node weights and biases std::vector<VecXd> node_;//nodes (nlayer_+1) std::vector<VecXd> bias_;//bias (nlayer_) std::vector<MatXd> edge_;//edges (nlayer_) public: //==== constructors/destructors ==== ANN(){defaults();} ~ANN(){} //==== operators ==== friend std::ostream& operator<<(std::ostream& out, const ANN& n); friend FILE* operator<<(FILE* out, const ANN& n); friend VecXd& operator>>(const ANN& nn, VecXd& v); friend ANN& operator<<(ANN& nn, const VecXd& v); //==== access ==== //network dimensions int nlayer()const{return nlayer_;} //nodes VecXd& in(){return in_;} const VecXd& in()const{return in_;} VecXd& out(){return out_;} const VecXd& out()const{return out_;} VecXd& node(int n){return node_[n];} const VecXd& node(int n)const{return node_[n];} int nNodes(int n)const{return node_[n].size();} //scaling VecXd& inw(){return inw_;} const VecXd& inw()const{return inw_;} VecXd& inb(){return inb_;} const VecXd& inb()const{return inb_;} VecXd& outw(){return outw_;} const VecXd& outw()const{return outw_;} VecXd& outb(){return outb_;} const VecXd& outb()const{return outb_;} //bias VecXd& bias(int l){return bias_[l];} const VecXd& bias(int l)const{return bias_[l];} //edge MatXd& edge(int l){return edge_[l];} const MatXd& edge(int l)const{return edge_[l];} //size int nIn()const{return in_.size();} int nOut()const{return out_.size();} //gradients - nodes VecXd& dadz(int n){return dadz_[n];} const VecXd& dadz(int n)const{return dadz_[n];} //transfer functions Transfer& tf(){return tf_;} const Transfer& tf()const{return tf_;} TFP tfp(int l){return tfp_[l];} const TFP tfp(int l)const{return tfp_[l];} //==== member functions ==== //clearing/initialization void defaults(); void clear(); //info int size()const; int nBias()const; int nWeight()const; //resizing void resize(const ANNInit& init, int nInput, int nOutput); void resize(const ANNInit& init, int nInput, const std::vector<int>& nNodes, int nOutput); void resize(const ANNInit& init, const std::vector<int>& nNodes); //error double error_lambda()const; VecXd& grad_lambda(VecXd& grad)const; //execution const VecXd& execute(); const VecXd& execute(const VecXd& in){in_=in;return execute();} //==== static functions ==== static void write(FILE* writer, const ANN& nn); static void write(const char*, const ANN& nn); static void read(FILE* writer, ANN& nn); static void read(const char*, ANN& nn); }; bool operator==(const ANN& n1, const ANN& n2); inline bool operator!=(const ANN& n1, const ANN& n2){return !(n1==n2);} //*********************************************************************** // ANNInit //*********************************************************************** class ANNInit{ private: double bInit_;//initial value - bias double wInit_;//initial value - weight double sigma_;//distribution size parameter rng::dist::Name dist_;//distribution type Init init_;//initialization scheme int seed_;//random seed public: //==== constructors/destructors ==== ANNInit(){defaults();} ~ANNInit(){} //==== operators ==== friend std::ostream& operator<<(std::ostream& out, const ANNInit& init); //==== access ==== double& bInit(){return bInit_;} const double& bInit()const{return bInit_;} double& wInit(){return wInit_;} const double& wInit()const{return wInit_;} double& sigma(){return sigma_;} const double& sigma()const{return sigma_;} rng::dist::Name& dist(){return dist_;} const rng::dist::Name& dist()const{return dist_;} Init& init(){return init_;} const Init& init()const{return init_;} int& seed(){return seed_;} const int& seed()const{return seed_;} //==== member functions ==== void defaults(); void clear(){defaults();} }; //*********************************************************************** // Cost //*********************************************************************** /* dcdz_ - the gradient of the cost function (c) w.r.t. the node inputs (z) - dc/dz */ class Cost{ private: std::vector<VecXd> dcdz_;//derivative of cost function w.r.t. node inputs (nlayer_) VecXd grad_;//gradient of the cost function with respect to each parameter (bias + weight) public: //==== constructors/destructors ==== Cost(){} Cost(const ANN& nn){resize(nn);} ~Cost(){} //==== access ==== std::vector<VecXd>& dcdz(){return dcdz_;} const std::vector<VecXd>& dcdz()const{return dcdz_;} VecXd& grad(){return grad_;} const VecXd& grad()const{return grad_;} //==== member functions ==== void clear(); void resize(const ANN& nn); const VecXd& grad(const ANN& nn, const VecXd& dcdo); }; //*********************************************************************** // DOutDVal //*********************************************************************** /* doda_ - the derivative of the output (o) w.r.t. the value of all nodes (a) has a size of "nlayer_+1" as we need to compute the gradient w.r.t. all nodes thus, doda_[n] must of the size node_[n] this includes the hidden layers as well as the input/ouput layers note these are the scaled inputs/outputs dodi_ - the derivative of the output w.r.t. the raw input this is the first element of doda_ multiplied by the input scaling */ class DOutDVal{ private: MatXd dodi_;//derivative of out_ w.r.t. to in_ (out_.size() x in_.size()) std::vector<MatXd> doda_;//derivative of out_ w.r.t. to the value "a" of all nodes (nlayer_+1) public: //==== constructors/destructors ==== DOutDVal(){} DOutDVal(const ANN& nn){resize(nn);} ~DOutDVal(){} //==== access ==== MatXd& dodi(){return dodi_;} const MatXd& dodi()const{return dodi_;} MatXd& doda(int n){return doda_[n];} const MatXd& doda(int n)const{return doda_[n];} std::vector<MatXd>& doda(){return doda_;} const std::vector<MatXd>& doda()const{return doda_;} //==== member functions ==== void clear(); void resize(const ANN& nn); void grad(const ANN& nn); }; //*********************************************************************** // DOutDP //*********************************************************************** class DOutDP{ private: std::vector<MatXd> dodz_;//derivative of output w.r.t. node inputs (nlayer_) std::vector<std::vector<VecXd> > dodb_;//derivative of output w.r.t. biases std::vector<std::vector<MatXd> > dodw_;//derivative of output w.r.t. weights public: //==== constructors/destructors ==== DOutDP(){} DOutDP(const ANN& nn){resize(nn);} ~DOutDP(){} //==== access ==== MatXd& dodz(int n){return dodz_[n];} const MatXd& dodz(int n)const{return dodz_[n];} std::vector<MatXd>& dodz(){return dodz_;} const std::vector<MatXd>& dodz()const{return dodz_;} MatXd& dodb(int n){return dodz_[n];} const MatXd& dodb(int n)const{return dodz_[n];} std::vector<std::vector<VecXd> >& dodb(){return dodb_;} const std::vector<std::vector<VecXd> >& dodb()const{return dodb_;} std::vector<std::vector<MatXd> >& dodw(){return dodw_;} const std::vector<std::vector<MatXd> >& dodw()const{return dodw_;} //==== member functions ==== void clear(); void resize(const ANN& nn); void grad(const ANN& nn); }; //*********************************************************************** // D2OutDPDVal //*********************************************************************** class D2OutDPDVal{ private: ANN nnc_; DOutDVal dOutDVal_; std::vector<MatXd> d2odpda_; MatXd pt1_,pt2_; public: //==== constructors/destructors ==== D2OutDPDVal(){} D2OutDPDVal(const ANN& nn){resize(nn);} ~D2OutDPDVal(){} //==== access ==== std::vector<MatXd>& d2odpda(){return d2odpda_;} const std::vector<MatXd>& d2odpda()const{return d2odpda_;} MatXd& d2odpda(int i){return d2odpda_[i];} const MatXd& d2odpda(int i)const{return d2odpda_[i];} //==== member functions ==== void clear(); void resize(const ANN& nn); void grad(const ANN& nn); }; } //********************************************** // serialization //********************************************** namespace serialize{ //********************************************** // byte measures //********************************************** template <> int nbytes(const NN::ANNInit& obj); template <> int nbytes(const NN::ANN& obj); //********************************************** // packing //********************************************** template <> int pack(const NN::ANNInit& obj, char* arr); template <> int pack(const NN::ANN& obj, char* arr); //********************************************** // unpacking //********************************************** template <> int unpack(NN::ANNInit& obj, const char* arr); template <> int unpack(NN::ANN& obj, const char* arr); } #endif
We manage your technology while you manage your business. When cutting-edge technology meets elegant design, it’s a match made in heaven. From back office administration platforms to front end-tools that increase customer conversion and retention, we build technology to enhance and simplify your business. Mobilize your business processes and customer communications with dynamic, integrated mobile applications tailored to your enterprise’s structure and needs. Interested in starting a dot com and generating recurring revenue for many years to come? We can help you from concept to full scale production and deployment. A captivating and intuitive user experience is extremely important to the success of any project. We build applications that strike the perfect balance between form and function. We provide turn-key solutions from concept to deployment. “”Liquamedia is efficient, innovative, caring, and extremely supportive in improving our business. “”Liquamedia has the unique ability to take a basic conceptual discussion and create an amazing website design that captures the essence of the project. Online join and renewal and club invoicing systems. Put some bounce in your bash to make it the best birthday ever! Fully responsive website, mortgage calculators and agent lookup. Reach out to us anytime, we’d be happy to talk about your project! Liquamedia is a full service design and development agency. We eat, sleep, and dream about building new technology and solving complex business problems. Drop us a line if you'd like to chat!
bitmap(grid::Grid2D) = Bitmap2D(grid) bitmap(grid::Grid3D) = Bitmap3D(grid) empty(M::Bitmap2D) = Bitmap2D(M.grid) empty(M::Bitmap3D) = Bitmap3D(M.grid) empty(grid::Grid2D) = Bitmap2D(grid) empty(grid::Grid3D) = Bitmap3D(grid) grid(B::AbstractBitmap) = B.grid
header{* Right Complemented Monoid *} theory RightComplementedMonoid imports LeftComplementedMonoid begin class left_pordered_monoid_mult = order + monoid_mult + assumes mult_left_mono: "a \<le> b \<Longrightarrow> c * a \<le> c * b" class integral_left_pordered_monoid_mult = left_pordered_monoid_mult + one_greatest class right_residuated = ord + times + right_imp + assumes right_residual: "(a * x \<le> b) = (x \<le> a r\<rightarrow> b)" class right_residuated_pordered_monoid = integral_left_pordered_monoid_mult + right_residuated class right_inf = inf + times + right_imp + assumes inf_r_def: "(a \<sqinter> b) = a * (a r\<rightarrow> b)" class right_complemented_monoid = right_residuated_pordered_monoid + right_inf + assumes left_divisibility: "(a \<le> b) = (\<exists> c . a = b * c)" sublocale right_complemented_monoid < dual!: left_complemented_monoid "\<lambda> a b . b * a" "op \<sqinter>" "op r\<rightarrow>" 1 "op \<le>" "op <" apply unfold_locales apply (simp_all add: inf_r_def mult.assoc mult_left_mono) apply (simp add: right_residual) by (simp add: left_divisibility) context right_complemented_monoid begin lemma rcm_D: "a r\<rightarrow> a = 1" by (rule dual.lcm_D) subclass semilattice_inf by unfold_locales lemma right_semilattice_inf: "class.semilattice_inf inf op \<le> op <" by unfold_locales lemma right_one_inf [simp]: "1 \<sqinter> a = a" by simp lemma right_one_impl [simp]: "1 r\<rightarrow> a = a" by simp lemma rcm_A: "a * (a r\<rightarrow> b) = b * (b r\<rightarrow> a)" by (rule dual.lcm_A) lemma rcm_B: "((b * a) r\<rightarrow> c) = (a r\<rightarrow> (b r\<rightarrow> c))" by (rule dual.lcm_B) lemma rcm_C: "(a \<le> b) = ((a r\<rightarrow> b) = 1)" by (rule dual.lcm_C) end class right_complemented_monoid_nole_algebra = right_imp + one_times + right_inf + less_def + assumes right_impl_one [simp]: "a r\<rightarrow> a = 1" and right_impl_times: "a * (a r\<rightarrow> b) = b * (b r\<rightarrow> a)" and right_impl_ded: "((a * b) r\<rightarrow> c) = (b r\<rightarrow> (a r\<rightarrow> c))" class right_complemented_monoid_algebra = right_complemented_monoid_nole_algebra + assumes right_lesseq: "(a \<le> b) = ((a r\<rightarrow> b) = 1)" begin end sublocale right_complemented_monoid_algebra < dual_algebra!: left_complemented_monoid_algebra "\<lambda> a b . b * a" inf "op r\<rightarrow>" "op \<le>" "op <" 1 apply (unfold_locales, simp_all) by (rule inf_r_def, rule right_impl_times, rule right_impl_ded, rule right_lesseq) context right_complemented_monoid_algebra begin subclass right_complemented_monoid apply unfold_locales apply simp_all apply (simp add: dual_algebra.mult.assoc) apply (simp add: dual_algebra.mult_right_mono) apply (simp add: dual_algebra.left_residual) by (simp add: dual_algebra.right_divisibility) end lemma (in right_complemented_monoid) right_complemented_monoid: "class.right_complemented_monoid_algebra (op \<le>) (op <) 1 (op *) inf (op r\<rightarrow>)" by (unfold_locales, simp_all add: less_le_not_le rcm_A rcm_B rcm_C rcm_D) (* sublocale right_complemented_monoid < rcm!: right_complemented_monoid_algebra "op \<le>" "op <" 1 "op *" inf "op r\<rightarrow>" by (unfold_locales, simp_all add: less_le_not_le rcm_A rcm_B rcm_C rcm_D) *) end
State Before: C : Type u inst✝¹⁰ : Category C J : GrothendieckTopology C D : Type w₁ inst✝⁹ : Category D E : Type w₂ inst✝⁸ : Category E F✝ : D ⥤ E inst✝⁷ : ∀ (α β : Type (max v u)) (fst snd : β → α), HasLimitsOfShape (WalkingMulticospan fst snd) D inst✝⁶ : ∀ (α β : Type (max v u)) (fst snd : β → α), HasLimitsOfShape (WalkingMulticospan fst snd) E inst✝⁵ : ∀ (X : C), HasColimitsOfShape (Cover J X)ᵒᵖ D inst✝⁴ : ∀ (X : C), HasColimitsOfShape (Cover J X)ᵒᵖ E inst✝³ : (X : C) → PreservesColimitsOfShape (Cover J X)ᵒᵖ F✝ inst✝² : (X : C) → (W : Cover J X) → (P : Cᵒᵖ ⥤ D) → PreservesLimit (MulticospanIndex.multicospan (Cover.index W P)) F✝ P✝ P : Cᵒᵖ ⥤ D F : D ⥤ E inst✝¹ : (F : D ⥤ E) → (X : C) → PreservesColimitsOfShape (Cover J X)ᵒᵖ F inst✝ : (F : D ⥤ E) → (X : C) → (W : Cover J X) → (P : Cᵒᵖ ⥤ D) → PreservesLimit (MulticospanIndex.multicospan (Cover.index W P)) F ⊢ (sheafificationWhiskerLeftIso J P).hom.app F = (sheafifyCompIso J F P).hom State After: C : Type u inst✝¹⁰ : Category C J : GrothendieckTopology C D : Type w₁ inst✝⁹ : Category D E : Type w₂ inst✝⁸ : Category E F✝ : D ⥤ E inst✝⁷ : ∀ (α β : Type (max v u)) (fst snd : β → α), HasLimitsOfShape (WalkingMulticospan fst snd) D inst✝⁶ : ∀ (α β : Type (max v u)) (fst snd : β → α), HasLimitsOfShape (WalkingMulticospan fst snd) E inst✝⁵ : ∀ (X : C), HasColimitsOfShape (Cover J X)ᵒᵖ D inst✝⁴ : ∀ (X : C), HasColimitsOfShape (Cover J X)ᵒᵖ E inst✝³ : (X : C) → PreservesColimitsOfShape (Cover J X)ᵒᵖ F✝ inst✝² : (X : C) → (W : Cover J X) → (P : Cᵒᵖ ⥤ D) → PreservesLimit (MulticospanIndex.multicospan (Cover.index W P)) F✝ P✝ P : Cᵒᵖ ⥤ D F : D ⥤ E inst✝¹ : (F : D ⥤ E) → (X : C) → PreservesColimitsOfShape (Cover J X)ᵒᵖ F inst✝ : (F : D ⥤ E) → (X : C) → (W : Cover J X) → (P : Cᵒᵖ ⥤ D) → PreservesLimit (MulticospanIndex.multicospan (Cover.index W P)) F ⊢ (plusCompIso J F (plusObj J P)).hom ≫ plusMap J (plusCompIso J F P).hom ≫ 𝟙 (plusObj J (plusObj J (P ⋙ F))) = (plusCompIso J F (plusObj J P)).hom ≫ plusMap J (plusCompIso J F P).hom Tactic: dsimp [sheafificationWhiskerLeftIso, sheafifyCompIso] State Before: C : Type u inst✝¹⁰ : Category C J : GrothendieckTopology C D : Type w₁ inst✝⁹ : Category D E : Type w₂ inst✝⁸ : Category E F✝ : D ⥤ E inst✝⁷ : ∀ (α β : Type (max v u)) (fst snd : β → α), HasLimitsOfShape (WalkingMulticospan fst snd) D inst✝⁶ : ∀ (α β : Type (max v u)) (fst snd : β → α), HasLimitsOfShape (WalkingMulticospan fst snd) E inst✝⁵ : ∀ (X : C), HasColimitsOfShape (Cover J X)ᵒᵖ D inst✝⁴ : ∀ (X : C), HasColimitsOfShape (Cover J X)ᵒᵖ E inst✝³ : (X : C) → PreservesColimitsOfShape (Cover J X)ᵒᵖ F✝ inst✝² : (X : C) → (W : Cover J X) → (P : Cᵒᵖ ⥤ D) → PreservesLimit (MulticospanIndex.multicospan (Cover.index W P)) F✝ P✝ P : Cᵒᵖ ⥤ D F : D ⥤ E inst✝¹ : (F : D ⥤ E) → (X : C) → PreservesColimitsOfShape (Cover J X)ᵒᵖ F inst✝ : (F : D ⥤ E) → (X : C) → (W : Cover J X) → (P : Cᵒᵖ ⥤ D) → PreservesLimit (MulticospanIndex.multicospan (Cover.index W P)) F ⊢ (plusCompIso J F (plusObj J P)).hom ≫ plusMap J (plusCompIso J F P).hom ≫ 𝟙 (plusObj J (plusObj J (P ⋙ F))) = (plusCompIso J F (plusObj J P)).hom ≫ plusMap J (plusCompIso J F P).hom State After: no goals Tactic: rw [Category.comp_id]
function expanded_array = expand_complex(complex_array) % Note that if "complex_array" is a column vector, then its real and imaginary % parts are the row vectors of "expanded_array", because the fastest-varying % index (i.e., index in the column direction) is assigned for alternating the % real and imaginary parts. chkarg(istypeof(complex_array, 'complex'), '"complex_array" should be array with complex elements.'); nD = ndims(complex_array); expanded_array = cat(nD+1, real(complex_array), imag(complex_array)); expanded_array = permute(expanded_array, [nD+1, 1:nD]);
Proteins ( / <unk> / or / <unk> / ) are large biomolecules , or macromolecules , consisting of one or more long chains of amino acid residues . Proteins perform a vast array of functions within organisms , including catalysing metabolic reactions , DNA replication , responding to stimuli , and transporting molecules from one location to another . Proteins differ from one another primarily in their sequence of amino acids , which is dictated by the nucleotide sequence of their genes , and which usually results in protein folding into a specific three @-@ dimensional structure that determines its activity .
function [M,S]=rigidbody_transform(X) % function [M]=rigidbody_transform(X) % ------------------------------------------------------------------------ % % Kevin Mattheus Moerman % [email protected] % 22/04/2011 % ------------------------------------------------------------------------ %% Determine translation matrix OR=mean(X,1); %Defining translation matrix T = [1 0 0 OR(1);... 0 1 0 OR(2);... 0 0 1 OR(3);... 0 0 0 1]; %% Determine rotation matrix X=[X(:,1)-OR(1) X(:,2)-OR(2) X(:,3)-OR(3)]; %Centre points around mean [~,S,V]=svd(X,0); %Singular value decomposition %Defining direction cosine matrix if 1-V(3,3)<eps('double') DCM=eye(3,3); else rz=V(:,3); rz=rz./sqrt(sum(rz.^2)); %surface normal r=V(:,2); r=r./sqrt(sum(r.^2)); rx=cross(rz,r);rx=rx./sqrt(sum(rx.^2)); ry=cross(rx,rz);ry=ry./sqrt(sum(ry.^2)); DCM=[rx(:) ry(:) rz(:)]; end % N=-V(:,3)./V(3,3); %Surface normal % rx=[1 0 N(1)]; rx=rx./sqrt(sum(rx.^2)); % ry=[0 1 N(2)]; ry=ry./sqrt(sum(ry.^2)); % rz=cross(rx,ry); rz=rz./sqrt(sum(rz.^2)); % DCM=[rx(:) ry(:) rz(:)]; R = eye(4,4); R(1:3,1:3)=DCM; %% Create translation rotation matrix M = T * R * eye(4,4); end %% % _*GIBBON footer text*_ % % License: <https://github.com/gibbonCode/GIBBON/blob/master/LICENSE> % % GIBBON: The Geometry and Image-based Bioengineering add-On. A toolbox for % image segmentation, image-based modeling, meshing, and finite element % analysis. % % Copyright (C) 2006-2022 Kevin Mattheus Moerman and the GIBBON contributors % % This program 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 program 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 program. If not, see <http://www.gnu.org/licenses/>.
module TTImp.WithClause import Core.Context import Core.Context.Log import Core.Metadata import Core.TT import TTImp.BindImplicits import TTImp.TTImp import TTImp.Elab.Check import Data.List import Data.Maybe %default covering matchFail : FC -> Core a matchFail loc = throw (GenericMsg loc "With clause does not match parent") --- To be used on the lhs of a nested with clause to figure out a tight location --- information to give to the generated LHS getHeadLoc : RawImp -> Core FC getHeadLoc (IVar fc _) = pure fc getHeadLoc (IApp _ f _) = getHeadLoc f getHeadLoc (IAutoApp _ f _) = getHeadLoc f getHeadLoc (INamedApp _ f _ _) = getHeadLoc f getHeadLoc t = throw (InternalError $ "Could not find head of LHS: " ++ show t) addAlias : {auto m : Ref MD Metadata} -> {auto c : Ref Ctxt Defs} -> FC -> FC -> Core () addAlias from to = whenJust (isConcreteFC from) $ \ from => whenJust (isConcreteFC to) $ \ to => do log "ide-mode.highlight.alias" 25 $ "Adding alias: " ++ show from ++ " -> " ++ show to addSemanticAlias from to mutual export getMatch : {auto m : Ref MD Metadata} -> {auto c : Ref Ctxt Defs} -> (lhs : Bool) -> RawImp -> RawImp -> Core (List (String, RawImp)) getMatch lhs (IBindVar to n) tm@(IBindVar from _) = [(n, tm)] <$ addAlias from to getMatch lhs (IBindVar _ n) tm = pure [(n, tm)] getMatch lhs (Implicit _ _) tm = pure [] getMatch lhs (IVar to (NS ns n)) (IVar from (NS ns' n')) = if n == n' && isParentOf ns' ns then [] <$ addAlias from to -- <$ decorateName loc nm else matchFail from getMatch lhs (IVar to (NS ns n)) (IVar from n') = if n == n' then [] <$ addAlias from to -- <$ decorateName loc (NS ns n') else matchFail from getMatch lhs (IVar to n) (IVar from n') = if n == n' then [] <$ addAlias from to -- <$ decorateName loc n' else matchFail from getMatch lhs (IPi _ c p n arg ret) (IPi loc c' p' n' arg' ret') = if c == c' && eqPiInfoBy (\_, _ => True) p p' && n == n' then matchAll lhs [(arg, arg'), (ret, ret')] else matchFail loc -- TODO: Lam, Let, Case, Local, Update getMatch lhs (IApp _ f a) (IApp loc f' a') = matchAll lhs [(f, f'), (a, a')] getMatch lhs (IAutoApp _ f a) (IAutoApp loc f' a') = matchAll lhs [(f, f'), (a, a')] getMatch lhs (INamedApp _ f n a) (INamedApp loc f' n' a') = if n == n' then matchAll lhs [(f, f'), (a, a')] else matchFail loc getMatch lhs (IWithApp _ f a) (IWithApp loc f' a') = matchAll lhs [(f, f'), (a, a')] -- On LHS: If there's an implicit in the parent, but not the clause, add the -- implicit to the clause. This will propagate the implicit through to the -- body getMatch True (INamedApp fc f n a) f' = matchAll True [(f, f'), (a, a)] getMatch True (IAutoApp fc f a) f' = matchAll True [(f, f'), (a, a)] -- On RHS: Rely on unification to fill in the implicit getMatch False (INamedApp fc f n a) f' = getMatch False f f getMatch False (IAutoApp fc f a) f' = getMatch False f f -- Can't have an implicit in the clause if there wasn't a matching -- implicit in the parent getMatch lhs f (INamedApp fc f' n a) = matchFail fc getMatch lhs f (IAutoApp fc f' a) = matchFail fc -- Alternatives are okay as long as the alternatives correspond, and -- one of them is okay getMatch lhs (IAlternative fc _ as) (IAlternative _ _ as') = matchAny fc lhs (zip as as') getMatch lhs (IAs _ _ _ (UN (Basic n)) p) (IAs _ fc _ (UN (Basic n')) p') = do ms <- getMatch lhs p p' mergeMatches lhs ((n, IBindVar fc n') :: ms) getMatch lhs (IAs _ _ _ (UN (Basic n)) p) p' = do ms <- getMatch lhs p p' mergeMatches lhs ((n, p') :: ms) getMatch lhs (IAs _ _ _ _ p) p' = getMatch lhs p p' getMatch lhs p (IAs _ _ _ _ p') = getMatch lhs p p' getMatch lhs (IType _) (IType _) = pure [] getMatch lhs (IPrimVal fc c) (IPrimVal fc' c') = if c == c' then pure [] else matchFail fc getMatch lhs pat spec = matchFail (getFC pat) matchAny : {auto m : Ref MD Metadata} -> {auto c : Ref Ctxt Defs} -> FC -> (lhs : Bool) -> List (RawImp, RawImp) -> Core (List (String, RawImp)) matchAny fc lhs [] = matchFail fc matchAny fc lhs ((x, y) :: ms) = catch (getMatch lhs x y) (\err => matchAny fc lhs ms) matchAll : {auto m : Ref MD Metadata} -> {auto c : Ref Ctxt Defs} -> (lhs : Bool) -> List (RawImp, RawImp) -> Core (List (String, RawImp)) matchAll lhs [] = pure [] matchAll lhs ((x, y) :: ms) = do matches <- matchAll lhs ms mxy <- getMatch lhs x y mergeMatches lhs (mxy ++ matches) mergeMatches : {auto m : Ref MD Metadata} -> {auto c : Ref Ctxt Defs} -> (lhs : Bool) -> List (String, RawImp) -> Core (List (String, RawImp)) mergeMatches lhs [] = pure [] mergeMatches lhs ((n, tm) :: rest) = do rest' <- mergeMatches lhs rest case lookup n rest' of Nothing => pure ((n, tm) :: rest') Just tm' => do ignore $ getMatch lhs tm tm' -- ^ just need to know it succeeds pure rest' -- Get the arguments for the rewritten pattern clause of a with by looking -- up how the argument names matched getArgMatch : FC -> (side : ElabMode) -> (search : Bool) -> (warg : RawImp) -> (matches : List (String, RawImp)) -> (arg : Maybe (PiInfo RawImp, Name)) -> RawImp getArgMatch ploc mode search warg ms Nothing = warg getArgMatch ploc mode True warg ms (Just (AutoImplicit, nm)) = case (isUN nm >>= \ un => isBasic un >>= \ n => lookup n ms) of Just tm => tm Nothing => let arg = ISearch ploc 500 in if isJust (isLHS mode) then IAs ploc ploc UseLeft nm arg else arg getArgMatch ploc mode search warg ms (Just (_, nm)) = case (isUN nm >>= \ un => isBasic un >>= \ n => lookup n ms) of Just tm => tm Nothing => let arg = Implicit ploc True in if isJust (isLHS mode) then IAs ploc ploc UseLeft nm arg else arg export getNewLHS : {auto c : Ref Ctxt Defs} -> {auto m : Ref MD Metadata} -> FC -> (drop : Nat) -> NestedNames vars -> Name -> List (Maybe (PiInfo RawImp, Name)) -> RawImp -> RawImp -> Core RawImp getNewLHS iploc drop nest wname wargnames lhs_raw patlhs = do let vploc = virtualiseFC iploc (mlhs_raw, wrest) <- dropWithArgs drop patlhs autoimp <- isUnboundImplicits setUnboundImplicits True (_, lhs) <- bindNames False lhs_raw (_, mlhs) <- bindNames False mlhs_raw setUnboundImplicits autoimp log "declare.def.clause.with" 20 $ "Parent LHS (with implicits): " ++ show lhs log "declare.def.clause.with" 20 $ "Modified LHS (with implicits): " ++ show mlhs let (warg :: rest) = reverse wrest | _ => throw (GenericMsg iploc "Badly formed 'with' clause") log "declare.def.clause.with" 5 $ show lhs ++ " against " ++ show mlhs ++ " dropping " ++ show (warg :: rest) ms <- getMatch True lhs mlhs log "declare.def.clause.with" 5 $ "Matches: " ++ show ms let params = map (getArgMatch vploc (InLHS top) False warg ms) wargnames log "declare.def.clause.with" 5 $ "Parameters: " ++ show params hdloc <- getHeadLoc patlhs let newlhs = apply (IVar hdloc wname) (params ++ rest) log "declare.def.clause.with" 5 $ "New LHS: " ++ show newlhs pure newlhs where dropWithArgs : Nat -> RawImp -> Core (RawImp, List RawImp) dropWithArgs Z tm = pure (tm, []) dropWithArgs (S k) (IApp _ f arg) = do (tm, rest) <- dropWithArgs k f pure (tm, arg :: rest) -- Shouldn't happen if parsed correctly, but there's no guarantee that -- inputs come from parsed source so throw an error. dropWithArgs _ _ = throw (GenericMsg iploc "Badly formed 'with' clause") -- Find a 'with' application on the RHS and update it export withRHS : {auto c : Ref Ctxt Defs} -> {auto m : Ref MD Metadata} -> FC -> (drop : Nat) -> Name -> List (Maybe (PiInfo RawImp, Name)) -> RawImp -> RawImp -> Core RawImp withRHS fc drop wname wargnames tm toplhs = wrhs tm where withApply : FC -> RawImp -> List RawImp -> RawImp withApply fc f [] = f withApply fc f (a :: as) = withApply fc (IWithApp fc f a) as updateWith : FC -> RawImp -> List RawImp -> Core RawImp updateWith fc (IWithApp _ f a) ws = updateWith fc f (a :: ws) updateWith fc tm [] = throw (GenericMsg fc "Badly formed 'with' application") updateWith fc tm (arg :: args) = do log "declare.def.clause.with" 10 $ "With-app: Matching " ++ show toplhs ++ " against " ++ show tm ms <- getMatch False toplhs tm hdloc <- getHeadLoc tm log "declare.def.clause.with" 10 $ "Result: " ++ show ms let newrhs = apply (IVar hdloc wname) (map (getArgMatch fc InExpr True arg ms) wargnames) log "declare.def.clause.with" 10 $ "With args for RHS: " ++ show wargnames log "declare.def.clause.with" 10 $ "New RHS: " ++ show newrhs pure (withApply fc newrhs args) mutual wrhs : RawImp -> Core RawImp wrhs (IPi fc c p n ty sc) = pure $ IPi fc c p n !(wrhs ty) !(wrhs sc) wrhs (ILam fc c p n ty sc) = pure $ ILam fc c p n !(wrhs ty) !(wrhs sc) wrhs (ILet fc lhsFC c n ty val sc) = pure $ ILet fc lhsFC c n !(wrhs ty) !(wrhs val) !(wrhs sc) wrhs (ICase fc sc ty clauses) = pure $ ICase fc !(wrhs sc) !(wrhs ty) !(traverse wrhsC clauses) wrhs (ILocal fc decls sc) = pure $ ILocal fc decls !(wrhs sc) -- TODO! wrhs (IUpdate fc upds tm) = pure $ IUpdate fc upds !(wrhs tm) -- TODO! wrhs (IApp fc f a) = pure $ IApp fc !(wrhs f) !(wrhs a) wrhs (IAutoApp fc f a) = pure $ IAutoApp fc !(wrhs f) !(wrhs a) wrhs (INamedApp fc f n a) = pure $ INamedApp fc !(wrhs f) n !(wrhs a) wrhs (IWithApp fc f a) = updateWith fc f [a] wrhs (IRewrite fc rule tm) = pure $ IRewrite fc !(wrhs rule) !(wrhs tm) wrhs (IDelayed fc r tm) = pure $ IDelayed fc r !(wrhs tm) wrhs (IDelay fc tm) = pure $ IDelay fc !(wrhs tm) wrhs (IForce fc tm) = pure $ IForce fc !(wrhs tm) wrhs tm = pure tm wrhsC : ImpClause -> Core ImpClause wrhsC (PatClause fc lhs rhs) = pure $ PatClause fc lhs !(wrhs rhs) wrhsC c = pure c
Formal statement is: lemma convex_halfspace_Re_gt: "convex {x. Re x > b}" Informal statement is: The set of complex numbers with real part greater than $b$ is convex.
Formal statement is: lemma Zfun_minus: "Zfun f F \<Longrightarrow> Zfun (\<lambda>x. - f x) F" Informal statement is: If $f$ is a zero function on a field $F$, then $-f$ is also a zero function on $F$.
Formal statement is: lemma distr_cong: "M = K \<Longrightarrow> sets N = sets L \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> f x = g x) \<Longrightarrow> distr M N f = distr K L g" Informal statement is: If two measures are defined on the same space and have the same sets, and if two functions are equal on the space, then the distributions of the functions with respect to the measures are equal.
module AssRecRule import Data.Fin import Data.Vect %default total ||| The recursion function for lists of type `a`. Define this by pattern matching recList : (a : Type) -> (x : Type) -> x -> (a -> List a -> x -> x) -> (List a -> x) recList ty1 ty2 elem fun Nil = elem recList ty1 ty2 elem fun (x :: xs) = (fun x xs (recList ty1 ty2 elem fun xs)) ------------------------------------------------------------------------------------------------------------------- ||| Given a list of type `a` and a function `f: a -> b` get a list of type `b` by applying `f` to each element. ||| Note: Define using `recList` and without pattern matching on lists. mapList : (a : Type) -> (b : Type) -> (f : a -> b) -> List a -> List b mapList ty1 ty2 f = recList ty1 (List ty2) Nil fun where fun : ty1 -> (List ty1) -> (List ty2) -> (List ty2) fun x xs ys = (f x) :: ys -------------------------------------------------------------------------------------------------------------------- ||| Given a list of type `a`, an initial value `init : a` and an operation `op: a -> a -> a`, ||| get an element of `a` by starting with init and repeatedly applying the elements of the list. ||| e.g. fold Nat 1 (*) ([22] :: [3] :: []) = 1 * 22 * 3 ||| Note: Define using `recList` and without pattern matching on lists. foldList : (a : Type) -> (init : a) -> (op : a -> a -> a) -> List a -> a foldList ty init op = recList ty ty init fun where fun : ty -> (List ty) -> ty -> ty fun x xs y = (op x y) -- it can be defined as (op y x) also depending on the need -------------------------------------------------------------------------------------------------------------------- ||| The induction function on the `Fin` indexed type family. ||| Define this by pattern matching. inducFin : (xs : (n: Nat) -> Fin n -> Type) -> (base : (m: Nat) -> xs (S m) FZ) -> (step : (p: Nat) -> (k: Fin p) -> (prev: xs p k) -> (xs (S p) (FS k))) -> (q: Nat) -> (j: Fin q) -> xs q j inducFin xs base step Z k impossible inducFin xs base step (S q) FZ = base q inducFin xs base step (S Z) (FS k) impossible inducFin xs base step (S (S q)) (FS k) = step (S q) k (inducFin xs base step (S q) k) --------------------------------------------------------------------------------------------------------------------- ||| Given a type `a`, a natural number `q`, an element `j : Fin q` and a vector `v` of length q with entries of type `a`, ||| get the element in position `j` of `v`. Note that this is always well defined. ||| Note: Define using `inducFin` and without pattern matching on the `Fin` family. You may pattern match on Vectors. fetchElem : (a: Type) -> (q: Nat) -> (j: Fin q) -> (Vect q a -> a) fetchElem ty q j = inducFin family base step q j where family : (n : Nat) -> (Fin n) -> Type family n k = (Vect n ty) -> ty base : (m : Nat) -> (family (S m) FZ) base m (x :: xs) = x step : (p : Nat) -> (k : Fin p) -> (prev : (family p k)) -> (family (S p) (FS k)) step p k prev (x :: xs) = prev xs
using Documenter, MolecularIntegrals makedocs(sitename="MolecularIntegrals.jl") deploydocs( repo = "github.com/rpmuller/MolecularIntegrals.jl.git", devbranch="main" )
// // Created by kerin on 2019-09-30. // #ifndef BGEN_PROG_RHE_REG_COMPONENT_HPP #define BGEN_PROG_RHE_REG_COMPONENT_HPP #include "genotype_matrix.hpp" #include "file_utils.hpp" #include "parameters.hpp" #include "eigen_utils.hpp" #include "mpi_utils.hpp" #include "data.hpp" #include "eigen_utils.hpp" #include "tools/eigen3.3/Dense" #include <boost/iostreams/filtering_stream.hpp> #include <random> class RHEreg_Component { public: Eigen::MatrixXd _XXtWz; double ytXXty; long n_covar; long n_samples; long n_draws; long n_jacknife_local; long rm_jacknife_block; double n_var_local; parameters params; // Identifiers std::string label; bool is_gxe; bool is_active; bool is_finalised; std::string group; std::string effect_type; long env_var_index; // Storage for jacknife blocks std::vector<Eigen::MatrixXd> _XXtzs; std::vector<double> n_vars_local; std::vector<double> ytXXtys; Eigen::MatrixXd C, CtC_inv; Eigen::MatrixXd zz; Eigen::VectorXd Y; Eigen::VectorXd env_var; RHEreg_Component(const parameters& myparams, const Eigen::VectorXd& myY, const Eigen::MatrixXd& myWzz, const Eigen::MatrixXd& myC, const Eigen::MatrixXd& myCtC_inv, const long& myNJacknifeLocal); RHEreg_Component(const parameters& myparams, const Eigen::VectorXd& myY, const Eigen::MatrixXd& myC, const Eigen::MatrixXd& myCtC_inv, Eigen::MatrixXd XXtWz) : params(myparams), Y(myY), C(myC), CtC_inv(myCtC_inv), _XXtWz(XXtWz){ // For aggregating components after genotypes have been streamed // ie no need for any of the zz data fields. n_jacknife_local = 1; n_draws = XXtWz.cols(); n_samples = XXtWz.rows(); n_covar = C.cols(); ytXXty = 0; n_var_local = 0; label = ""; is_active = true; is_gxe = false; is_finalised = false; rm_jacknife_block = -1; if(params.debug) { std::string ram = mpiUtils::currentUsageRAM(); std::cout << "(" << ram << ")" << std::endl; } } void set_env_var(const Eigen::Ref<const Eigen::VectorXd>& my_env_var); void change_env_var(const Eigen::Ref<const Eigen::VectorXd>& my_env_var); void set_inactive(); void add_to_trace_estimator(Eigen::Ref<Eigen::MatrixXd> X, long jacknife_index = 0); void finalise(); Eigen::MatrixXd getXXtz() const; double get_bb_trace() const; double get_n_var_local() const; double operator*(const RHEreg_Component& other) const; Eigen::MatrixXd project_out_covars(Eigen::Ref<Eigen::MatrixXd> rhs) const; }; void get_GxE_collapsed_component(const std::vector<RHEreg_Component> &vec_of_components, RHEreg_Component &new_comp, const Eigen::Ref<const Eigen::MatrixXd> &E, const Eigen::Ref<const Eigen::VectorXd> &env_weights, const std::vector<Eigen::MatrixXd> &ytEXXtEy, const bool& copy_jacknife_partitions = false); void get_GxE_collapsed_system(const std::vector<RHEreg_Component> &vec_of_components, std::vector<RHEreg_Component> &new_components, const Eigen::Ref<const Eigen::MatrixXd> &E, const Eigen::Ref<const Eigen::VectorXd> &env_weights, const std::vector<Eigen::MatrixXd> &ytEXXtEy, const bool& copy_jacknife_partitions = false); #endif
(* Chapter 3 *) Require Import TLC.LibLN. Require Import Coq.Lists.ListSet. From Coq Require Export Lists.List. Export ListNotations. Require Import Coq.Init.Nat. Inductive trm : Set := | tru : trm | fals : trm | cond : trm -> trm -> trm -> trm | zro : trm | succ : trm -> trm | pred : trm -> trm | iszero : trm -> trm. Lemma eq_dec : forall x y:trm, {x = y} + {x <> y}. Proof. decide equality; auto. Defined. Notation "l1 `union` l2" := (set_union eq_dec l1 l2) (at level 80). Notation "l1 `inter` l2" := (set_inter eq_dec l1 l2) (at level 80). Fixpoint constants (u: trm) : list trm := match u with | tru => [tru] | fals => [fals] | cond t1 t2 t3 => constants t1 `union` constants t2 `union` constants t3 | zro => [zro] | succ t => constants t | pred t => constants t | iszero t => constants t end. Fixpoint size (u: trm) : nat := match u with | tru => 1 | fals => 1 | cond t1 t2 t3 => 1 + size t1 + size t2 + size t3 | zro => 1 | succ t => 1 + size t | pred t => 1 + size t | iszero t => 1 + size t end. Fixpoint depth (u: trm) : nat := match u with | tru => 1 | fals => 1 | cond t1 t2 t3 => max (max (depth t1) (depth t2)) (depth t3) + 1 | zro => 1 | succ t => 1 + depth t | pred t => 1 + depth t | iszero t => 1 + depth t end.
(* Title: HOL/Auth/n_germanSymIndex_lemma_on_inv__12.thy Author: Yongjian Li and Kaiqiang Duan, State Key Lab of Computer Science, Institute of Software, Chinese Academy of Sciences Copyright 2016 State Key Lab of Computer Science, Institute of Software, Chinese Academy of Sciences *) header{*The n_germanSymIndex Protocol Case Study*} theory n_germanSymIndex_lemma_on_inv__12 imports n_germanSymIndex_base begin section{*All lemmas on causal relation between inv__12 and some rule r*} lemma n_SendInv__part__0Vsinv__12: assumes a1: "(\<exists> i. i\<le>N\<and>r=n_SendInv__part__0 i)" and a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__12 p__Inv0 p__Inv2)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain i where a1:"i\<le>N\<and>r=n_SendInv__part__0 i" apply fastforce done from a2 obtain p__Inv0 p__Inv2 where a2:"p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__12 p__Inv0 p__Inv2" apply fastforce done have "(i=p__Inv2)\<or>(i=p__Inv0)\<or>(i~=p__Inv0\<and>i~=p__Inv2)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(i=p__Inv2)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(i=p__Inv0)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(i~=p__Inv0\<and>i~=p__Inv2)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_SendInv__part__1Vsinv__12: assumes a1: "(\<exists> i. i\<le>N\<and>r=n_SendInv__part__1 i)" and a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__12 p__Inv0 p__Inv2)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain i where a1:"i\<le>N\<and>r=n_SendInv__part__1 i" apply fastforce done from a2 obtain p__Inv0 p__Inv2 where a2:"p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__12 p__Inv0 p__Inv2" apply fastforce done have "(i=p__Inv2)\<or>(i=p__Inv0)\<or>(i~=p__Inv0\<and>i~=p__Inv2)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(i=p__Inv2)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(i=p__Inv0)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(i~=p__Inv0\<and>i~=p__Inv2)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_SendInvAckVsinv__12: assumes a1: "(\<exists> i. i\<le>N\<and>r=n_SendInvAck i)" and a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__12 p__Inv0 p__Inv2)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain i where a1:"i\<le>N\<and>r=n_SendInvAck i" apply fastforce done from a2 obtain p__Inv0 p__Inv2 where a2:"p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__12 p__Inv0 p__Inv2" apply fastforce done have "(i=p__Inv2)\<or>(i=p__Inv0)\<or>(i~=p__Inv0\<and>i~=p__Inv2)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(i=p__Inv2)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(i=p__Inv0)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(i~=p__Inv0\<and>i~=p__Inv2)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_SendGntSVsinv__12: assumes a1: "(\<exists> i. i\<le>N\<and>r=n_SendGntS i)" and a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__12 p__Inv0 p__Inv2)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain i where a1:"i\<le>N\<and>r=n_SendGntS i" apply fastforce done from a2 obtain p__Inv0 p__Inv2 where a2:"p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__12 p__Inv0 p__Inv2" apply fastforce done have "(i=p__Inv2)\<or>(i=p__Inv0)\<or>(i~=p__Inv0\<and>i~=p__Inv2)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(i=p__Inv2)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(i=p__Inv0)" have "?P3 s" apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Ident ''ExGntd'')) (Const false)) (eqn (IVar (Field (Para (Ident ''Chan2'') p__Inv2) ''Cmd'')) (Const GntE))))" in exI, auto) done then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(i~=p__Inv0\<and>i~=p__Inv2)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_SendGntEVsinv__12: assumes a1: "(\<exists> i. i\<le>N\<and>r=n_SendGntE N i)" and a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__12 p__Inv0 p__Inv2)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain i where a1:"i\<le>N\<and>r=n_SendGntE N i" apply fastforce done from a2 obtain p__Inv0 p__Inv2 where a2:"p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__12 p__Inv0 p__Inv2" apply fastforce done have "(i=p__Inv2)\<or>(i=p__Inv0)\<or>(i~=p__Inv0\<and>i~=p__Inv2)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(i=p__Inv2)" have "?P3 s" apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Para (Ident ''Chan2'') p__Inv0) ''Cmd'')) (Const GntS)) (eqn (IVar (Para (Ident ''ShrSet'') p__Inv0)) (Const false))))" in exI, auto) done then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(i=p__Inv0)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(i~=p__Inv0\<and>i~=p__Inv2)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_RecvGntSVsinv__12: assumes a1: "(\<exists> i. i\<le>N\<and>r=n_RecvGntS i)" and a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__12 p__Inv0 p__Inv2)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain i where a1:"i\<le>N\<and>r=n_RecvGntS i" apply fastforce done from a2 obtain p__Inv0 p__Inv2 where a2:"p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__12 p__Inv0 p__Inv2" apply fastforce done have "(i=p__Inv2)\<or>(i=p__Inv0)\<or>(i~=p__Inv0\<and>i~=p__Inv2)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(i=p__Inv2)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(i=p__Inv0)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(i~=p__Inv0\<and>i~=p__Inv2)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_RecvGntEVsinv__12: assumes a1: "(\<exists> i. i\<le>N\<and>r=n_RecvGntE i)" and a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__12 p__Inv0 p__Inv2)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain i where a1:"i\<le>N\<and>r=n_RecvGntE i" apply fastforce done from a2 obtain p__Inv0 p__Inv2 where a2:"p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__12 p__Inv0 p__Inv2" apply fastforce done have "(i=p__Inv2)\<or>(i=p__Inv0)\<or>(i~=p__Inv0\<and>i~=p__Inv2)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(i=p__Inv2)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(i=p__Inv0)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(i~=p__Inv0\<and>i~=p__Inv2)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_SendReqE__part__1Vsinv__12: assumes a1: "\<exists> i. i\<le>N\<and>r=n_SendReqE__part__1 i" and a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__12 p__Inv0 p__Inv2)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_StoreVsinv__12: assumes a1: "\<exists> i d. i\<le>N\<and>d\<le>N\<and>r=n_Store i d" and a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__12 p__Inv0 p__Inv2)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_RecvInvAckVsinv__12: assumes a1: "\<exists> i. i\<le>N\<and>r=n_RecvInvAck i" and a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__12 p__Inv0 p__Inv2)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_RecvReqEVsinv__12: assumes a1: "\<exists> i. i\<le>N\<and>r=n_RecvReqE N i" and a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__12 p__Inv0 p__Inv2)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_SendReqE__part__0Vsinv__12: assumes a1: "\<exists> i. i\<le>N\<and>r=n_SendReqE__part__0 i" and a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__12 p__Inv0 p__Inv2)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_SendReqSVsinv__12: assumes a1: "\<exists> i. i\<le>N\<and>r=n_SendReqS i" and a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__12 p__Inv0 p__Inv2)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_RecvReqSVsinv__12: assumes a1: "\<exists> i. i\<le>N\<and>r=n_RecvReqS N i" and a2: "(\<exists> p__Inv0 p__Inv2. p__Inv0\<le>N\<and>p__Inv2\<le>N\<and>p__Inv0~=p__Inv2\<and>f=inv__12 p__Inv0 p__Inv2)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done end
State Before: α : Type u_1 p : α → Bool a : α l : List α ⊢ filter p (a :: l) <+ a :: l State After: α : Type u_1 p : α → Bool a : α l : List α ⊢ (match p a with | true => a :: filter p l | false => filter p l) <+ a :: l Tactic: rw [filter] State Before: α : Type u_1 p : α → Bool a : α l : List α ⊢ (match p a with | true => a :: filter p l | false => filter p l) <+ a :: l State After: no goals Tactic: split <;> simp [Sublist.cons, Sublist.cons₂, filter_sublist l]
module DataStore import Data.Strings import Data.Vect import System.REPL %default total data DataStore : Type where MkData : (size : Nat) -> (items : Vect size String) -> DataStore size : DataStore -> Nat size (MkData size' _) = size' items : (store : DataStore) -> Vect (size store) String items (MkData _ items') = items' addToStore : (store : DataStore) -> String -> DataStore addToStore (MkData size items) newItem = MkData _ (addToData items) where addToData : Vect old String -> Vect (S old) String addToData [] = [newItem] addToData (item :: items) = item :: addToData items data Command = Add String | Get Integer | Quit parseCommand : (cmd : String) -> (args : String) -> Maybe Command parseCommand "add" str = Just (Add str) parseCommand "get" val = case all isDigit (unpack val) of False => Nothing True => Just (Get (cast val)) parseCommand "quit" "" = Just Quit parseCommand _ _ = Nothing parse : (input : String) -> Maybe Command parse input = case span (/= ' ') input of (cmd, args) => parseCommand cmd (ltrim args) getEntry : (store : DataStore) -> (pos : Integer) -> Maybe (String, DataStore) getEntry store pos = case integerToFin pos (size store) of Nothing => Just ("Invalid index: " ++ show pos ++ "\n", store) Just idx => Just (show (index idx (items store)) ++ "\n", store) processCommand : (store : DataStore) -> (cmd : Command) -> Maybe (String, DataStore) processCommand store (Add item) = Just ("ID" ++ show (size store) ++ "\n", addToStore store item) processCommand store (Get idx) = getEntry store idx processCommand store Quit = Nothing processInput : (store : DataStore) -> String -> Maybe (String, DataStore) processInput store inp = case parse inp of Nothing => Just ("Invalid command\n", store) Just cmd => processCommand store cmd partial main : IO () main = replWith (MkData _ []) "Command: " processInput
Require Import init. Require Export mult_ring. (** Alright, I lied, these are just records and not categories. I'll make categories later (maybe). *) Record RngObj := make_rng { rng_U : Type; rng_plus : Plus rng_U; rng_zero : Zero rng_U; rng_neg : Neg rng_U; rng_mult : Mult rng_U; rng_plus_assoc : @PlusAssoc rng_U rng_plus; rng_plus_comm : @PlusComm rng_U rng_plus; rng_plus_lid : @PlusLid rng_U rng_plus rng_zero; rng_plus_linv : @PlusLinv rng_U rng_plus rng_zero rng_neg; rng_mult_assoc : @MultAssoc rng_U rng_mult; rng_ldist : @Ldist rng_U rng_plus rng_mult; rng_rdist : @Rdist rng_U rng_plus rng_mult; }. Record RingObj := make_ring { ring_rng : RngObj; ring_one : One (rng_U ring_rng); ring_mult_lid : @MultLid (rng_U ring_rng) (rng_mult ring_rng) ring_one; ring_mult_rid : @MultRid (rng_U ring_rng) (rng_mult ring_rng) ring_one; }. Definition ring_U R := rng_U (ring_rng R). Definition ring_plus R := rng_plus (ring_rng R). Definition ring_zero R := rng_zero (ring_rng R). Definition ring_neg R := rng_neg (ring_rng R). Definition ring_mult R := rng_mult (ring_rng R). Definition ring_plus_assoc R := rng_plus_assoc (ring_rng R). Definition ring_plus_comm R := rng_plus_comm (ring_rng R). Definition ring_plus_lid R := rng_plus_lid (ring_rng R). Definition ring_plus_linv R := rng_plus_linv (ring_rng R). Definition ring_mult_assoc R := rng_mult_assoc (ring_rng R). Definition ring_ldist R := rng_ldist (ring_rng R). Definition ring_rdist R := rng_rdist (ring_rng R). Record CRingObj := make_cring { cring_ring : RingObj; cring_mult_comm : @MultComm (ring_U cring_ring) (ring_mult cring_ring); }. Definition cring_U R := ring_U (cring_ring R). Definition cring_plus R := ring_plus (cring_ring R). Definition cring_zero R := ring_zero (cring_ring R). Definition cring_neg R := ring_neg (cring_ring R). Definition cring_mult R := ring_mult (cring_ring R). Definition cring_plus_assoc R := ring_plus_assoc (cring_ring R). Definition cring_plus_comm R := ring_plus_comm (cring_ring R). Definition cring_plus_lid R := ring_plus_lid (cring_ring R). Definition cring_plus_linv R := ring_plus_linv (cring_ring R). Definition cring_mult_assoc R := ring_mult_assoc (cring_ring R). Definition cring_ldist R := ring_ldist (cring_ring R). Definition cring_one R := ring_one (cring_ring R). Definition cring_mult_lid R := ring_mult_lid (cring_ring R). Global Existing Instances cring_plus cring_zero cring_neg cring_mult cring_plus_assoc cring_plus_comm cring_plus_lid cring_plus_linv cring_mult_assoc cring_ldist cring_one cring_mult_lid cring_mult_comm.
(* Title: HOL/Auth/n_german_lemma_on_inv__51.thy Author: Yongjian Li and Kaiqiang Duan, State Key Lab of Computer Science, Institute of Software, Chinese Academy of Sciences Copyright 2016 State Key Lab of Computer Science, Institute of Software, Chinese Academy of Sciences *) header{*The n_german Protocol Case Study*} theory n_german_lemma_on_inv__51 imports n_german_base begin section{*All lemmas on causal relation between inv__51 and some rule r*} lemma n_RecvReqVsinv__51: assumes a1: "(\<exists> i. i\<le>N\<and>r=n_RecvReq N i)" and a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__51 p__Inv3 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain i where a1:"i\<le>N\<and>r=n_RecvReq N i" apply fastforce done from a2 obtain p__Inv3 p__Inv4 where a2:"p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__51 p__Inv3 p__Inv4" apply fastforce done have "(i=p__Inv4)\<or>(i=p__Inv3)\<or>(i~=p__Inv3\<and>i~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(i=p__Inv4)" have "?P3 s" apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (andForm (eqn (IVar (Para (Ident ''ShrSet'') p__Inv4)) (Const true)) (eqn (IVar (Ident ''ExGntd'')) (Const true))) (eqn (IVar (Para (Ident ''ShrSet'') p__Inv3)) (Const true))))" in exI, auto) done then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(i=p__Inv3)" have "?P3 s" apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (andForm (eqn (IVar (Para (Ident ''ShrSet'') p__Inv4)) (Const true)) (eqn (IVar (Ident ''ExGntd'')) (Const true))) (eqn (IVar (Para (Ident ''ShrSet'') p__Inv3)) (Const true))))" in exI, auto) done then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(i~=p__Inv3\<and>i~=p__Inv4)" have "?P3 s" apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (andForm (eqn (IVar (Para (Ident ''ShrSet'') p__Inv4)) (Const true)) (eqn (IVar (Ident ''ExGntd'')) (Const true))) (eqn (IVar (Para (Ident ''ShrSet'') p__Inv3)) (Const true))))" in exI, auto) done then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_SendInvEVsinv__51: assumes a1: "(\<exists> i. i\<le>N\<and>r=n_SendInvE i)" and a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__51 p__Inv3 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain i where a1:"i\<le>N\<and>r=n_SendInvE i" apply fastforce done from a2 obtain p__Inv3 p__Inv4 where a2:"p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__51 p__Inv3 p__Inv4" apply fastforce done have "(i=p__Inv4)\<or>(i=p__Inv3)\<or>(i~=p__Inv3\<and>i~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(i=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(i=p__Inv3)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(i~=p__Inv3\<and>i~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_SendInvSVsinv__51: assumes a1: "(\<exists> i. i\<le>N\<and>r=n_SendInvS i)" and a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__51 p__Inv3 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain i where a1:"i\<le>N\<and>r=n_SendInvS i" apply fastforce done from a2 obtain p__Inv3 p__Inv4 where a2:"p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__51 p__Inv3 p__Inv4" apply fastforce done have "(i=p__Inv4)\<or>(i=p__Inv3)\<or>(i~=p__Inv3\<and>i~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(i=p__Inv4)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(i=p__Inv3)" have "?P1 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(i~=p__Inv3\<and>i~=p__Inv4)" have "?P2 s" proof(cut_tac a1 a2 b1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_RecvInvAckVsinv__51: assumes a1: "(\<exists> i. i\<le>N\<and>r=n_RecvInvAck i)" and a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__51 p__Inv3 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain i where a1:"i\<le>N\<and>r=n_RecvInvAck i" apply fastforce done from a2 obtain p__Inv3 p__Inv4 where a2:"p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__51 p__Inv3 p__Inv4" apply fastforce done have "(i=p__Inv4)\<or>(i=p__Inv3)\<or>(i~=p__Inv3\<and>i~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(i=p__Inv4)" have "((formEval (eqn (IVar (Ident ''ExGntd'')) (Const true)) s))\<or>((formEval (neg (eqn (IVar (Ident ''ExGntd'')) (Const true))) s))" by auto moreover { assume c1: "((formEval (eqn (IVar (Ident ''ExGntd'')) (Const true)) s))" have "?P1 s" proof(cut_tac a1 a2 b1 c1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume c1: "((formEval (neg (eqn (IVar (Ident ''ExGntd'')) (Const true))) s))" have "?P2 s" proof(cut_tac a1 a2 b1 c1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately have "invHoldForRule s f r (invariants N)" by satx } moreover { assume b1: "(i=p__Inv3)" have "((formEval (eqn (IVar (Ident ''ExGntd'')) (Const true)) s))\<or>((formEval (neg (eqn (IVar (Ident ''ExGntd'')) (Const true))) s))" by auto moreover { assume c1: "((formEval (eqn (IVar (Ident ''ExGntd'')) (Const true)) s))" have "?P1 s" proof(cut_tac a1 a2 b1 c1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume c1: "((formEval (neg (eqn (IVar (Ident ''ExGntd'')) (Const true))) s))" have "?P2 s" proof(cut_tac a1 a2 b1 c1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately have "invHoldForRule s f r (invariants N)" by satx } moreover { assume b1: "(i~=p__Inv3\<and>i~=p__Inv4)" have "((formEval (eqn (IVar (Ident ''ExGntd'')) (Const true)) s))\<or>((formEval (neg (eqn (IVar (Ident ''ExGntd'')) (Const true))) s))" by auto moreover { assume c1: "((formEval (eqn (IVar (Ident ''ExGntd'')) (Const true)) s))" have "?P1 s" proof(cut_tac a1 a2 b1 c1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume c1: "((formEval (neg (eqn (IVar (Ident ''ExGntd'')) (Const true))) s))" have "?P2 s" proof(cut_tac a1 a2 b1 c1, auto) qed then have "invHoldForRule s f r (invariants N)" by auto } ultimately have "invHoldForRule s f r (invariants N)" by satx } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_SendGntEVsinv__51: assumes a1: "(\<exists> i. i\<le>N\<and>r=n_SendGntE N i)" and a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__51 p__Inv3 p__Inv4)" shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s") proof - from a1 obtain i where a1:"i\<le>N\<and>r=n_SendGntE N i" apply fastforce done from a2 obtain p__Inv3 p__Inv4 where a2:"p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__51 p__Inv3 p__Inv4" apply fastforce done have "(i=p__Inv4)\<or>(i=p__Inv3)\<or>(i~=p__Inv3\<and>i~=p__Inv4)" apply (cut_tac a1 a2, auto) done moreover { assume b1: "(i=p__Inv4)" have "?P3 s" apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Para (Ident ''InvSet'') p__Inv4)) (Const true)) (eqn (IVar (Para (Ident ''ShrSet'') p__Inv4)) (Const false))))" in exI, auto) done then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(i=p__Inv3)" have "?P3 s" apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Para (Ident ''InvSet'') p__Inv4)) (Const true)) (eqn (IVar (Para (Ident ''ShrSet'') p__Inv4)) (Const false))))" in exI, auto) done then have "invHoldForRule s f r (invariants N)" by auto } moreover { assume b1: "(i~=p__Inv3\<and>i~=p__Inv4)" have "?P3 s" apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Para (Ident ''InvSet'') p__Inv4)) (Const true)) (eqn (IVar (Para (Ident ''ShrSet'') p__Inv4)) (Const false))))" in exI, auto) done then have "invHoldForRule s f r (invariants N)" by auto } ultimately show "invHoldForRule s f r (invariants N)" by satx qed lemma n_StoreVsinv__51: assumes a1: "\<exists> i d. i\<le>N\<and>d\<le>N\<and>r=n_Store i d" and a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__51 p__Inv3 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_SendReqESVsinv__51: assumes a1: "\<exists> i. i\<le>N\<and>r=n_SendReqES i" and a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__51 p__Inv3 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_RecvGntSVsinv__51: assumes a1: "\<exists> i. i\<le>N\<and>r=n_RecvGntS i" and a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__51 p__Inv3 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_SendGntSVsinv__51: assumes a1: "\<exists> i. i\<le>N\<and>r=n_SendGntS i" and a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__51 p__Inv3 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_RecvGntEVsinv__51: assumes a1: "\<exists> i. i\<le>N\<and>r=n_RecvGntE i" and a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__51 p__Inv3 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_SendInvAckVsinv__51: assumes a1: "\<exists> i. i\<le>N\<and>r=n_SendInvAck i" and a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__51 p__Inv3 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_SendReqSVsinv__51: assumes a1: "\<exists> j. j\<le>N\<and>r=n_SendReqS j" and a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__51 p__Inv3 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done lemma n_SendReqEIVsinv__51: assumes a1: "\<exists> i. i\<le>N\<and>r=n_SendReqEI i" and a2: "(\<exists> p__Inv3 p__Inv4. p__Inv3\<le>N\<and>p__Inv4\<le>N\<and>p__Inv3~=p__Inv4\<and>f=inv__51 p__Inv3 p__Inv4)" shows "invHoldForRule s f r (invariants N)" apply (rule noEffectOnRule, cut_tac a1 a2, auto) done end
[GOAL] F : Type v' R' : Type u' R : Type u A : Type v B : Type w C : Type w' inst✝⁷ : CommSemiring R inst✝⁶ : NonUnitalNonAssocSemiring A inst✝⁵ : Module R A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : NonUnitalNonAssocSemiring C inst✝¹ : Module R C inst✝ : NonUnitalAlgHomClass F R A B p q : NonUnitalSubalgebra R A h : (fun s => s.carrier) p = (fun s => s.carrier) q ⊢ p = q [PROOFSTEP] cases p [GOAL] case mk F : Type v' R' : Type u' R : Type u A : Type v B : Type w C : Type w' inst✝⁷ : CommSemiring R inst✝⁶ : NonUnitalNonAssocSemiring A inst✝⁵ : Module R A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : NonUnitalNonAssocSemiring C inst✝¹ : Module R C inst✝ : NonUnitalAlgHomClass F R A B q : NonUnitalSubalgebra R A toNonUnitalSubsemiring✝ : NonUnitalSubsemiring A smul_mem'✝ : ∀ (c : R) {x : A}, x ∈ toNonUnitalSubsemiring✝.carrier → c • x ∈ toNonUnitalSubsemiring✝.carrier h : (fun s => s.carrier) { toNonUnitalSubsemiring := toNonUnitalSubsemiring✝, smul_mem' := smul_mem'✝ } = (fun s => s.carrier) q ⊢ { toNonUnitalSubsemiring := toNonUnitalSubsemiring✝, smul_mem' := smul_mem'✝ } = q [PROOFSTEP] cases q [GOAL] case mk.mk F : Type v' R' : Type u' R : Type u A : Type v B : Type w C : Type w' inst✝⁷ : CommSemiring R inst✝⁶ : NonUnitalNonAssocSemiring A inst✝⁵ : Module R A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : NonUnitalNonAssocSemiring C inst✝¹ : Module R C inst✝ : NonUnitalAlgHomClass F R A B toNonUnitalSubsemiring✝¹ : NonUnitalSubsemiring A smul_mem'✝¹ : ∀ (c : R) {x : A}, x ∈ toNonUnitalSubsemiring✝¹.carrier → c • x ∈ toNonUnitalSubsemiring✝¹.carrier toNonUnitalSubsemiring✝ : NonUnitalSubsemiring A smul_mem'✝ : ∀ (c : R) {x : A}, x ∈ toNonUnitalSubsemiring✝.carrier → c • x ∈ toNonUnitalSubsemiring✝.carrier h : (fun s => s.carrier) { toNonUnitalSubsemiring := toNonUnitalSubsemiring✝¹, smul_mem' := smul_mem'✝¹ } = (fun s => s.carrier) { toNonUnitalSubsemiring := toNonUnitalSubsemiring✝, smul_mem' := smul_mem'✝ } ⊢ { toNonUnitalSubsemiring := toNonUnitalSubsemiring✝¹, smul_mem' := smul_mem'✝¹ } = { toNonUnitalSubsemiring := toNonUnitalSubsemiring✝, smul_mem' := smul_mem'✝ } [PROOFSTEP] congr [GOAL] case mk.mk.e_toNonUnitalSubsemiring F : Type v' R' : Type u' R : Type u A : Type v B : Type w C : Type w' inst✝⁷ : CommSemiring R inst✝⁶ : NonUnitalNonAssocSemiring A inst✝⁵ : Module R A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : NonUnitalNonAssocSemiring C inst✝¹ : Module R C inst✝ : NonUnitalAlgHomClass F R A B toNonUnitalSubsemiring✝¹ : NonUnitalSubsemiring A smul_mem'✝¹ : ∀ (c : R) {x : A}, x ∈ toNonUnitalSubsemiring✝¹.carrier → c • x ∈ toNonUnitalSubsemiring✝¹.carrier toNonUnitalSubsemiring✝ : NonUnitalSubsemiring A smul_mem'✝ : ∀ (c : R) {x : A}, x ∈ toNonUnitalSubsemiring✝.carrier → c • x ∈ toNonUnitalSubsemiring✝.carrier h : (fun s => s.carrier) { toNonUnitalSubsemiring := toNonUnitalSubsemiring✝¹, smul_mem' := smul_mem'✝¹ } = (fun s => s.carrier) { toNonUnitalSubsemiring := toNonUnitalSubsemiring✝, smul_mem' := smul_mem'✝ } ⊢ toNonUnitalSubsemiring✝¹ = toNonUnitalSubsemiring✝ [PROOFSTEP] exact SetLike.coe_injective h [GOAL] F : Type v' R' : Type u' R : Type u A : Type v B : Type w C : Type w' inst✝⁷ : CommSemiring R inst✝⁶ : NonUnitalNonAssocSemiring A inst✝⁵ : Module R A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : NonUnitalNonAssocSemiring C inst✝¹ : Module R C inst✝ : NonUnitalAlgHomClass F R A B S T : NonUnitalSubalgebra R A h : S.toNonUnitalSubsemiring = T.toNonUnitalSubsemiring x : A ⊢ x ∈ S ↔ x ∈ T [PROOFSTEP] rw [← mem_toNonUnitalSubsemiring, ← mem_toNonUnitalSubsemiring, h] [GOAL] F : Type v' R' : Type u' R : Type u A : Type v B : Type w C : Type w' inst✝⁷ : CommSemiring R inst✝⁶ : NonUnitalNonAssocSemiring A inst✝⁵ : Module R A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : NonUnitalNonAssocSemiring C inst✝¹ : Module R C inst✝ : NonUnitalAlgHomClass F R A B S T : NonUnitalSubalgebra R A h : toSubmodule S = toSubmodule T x : A ⊢ x ∈ S ↔ x ∈ T [PROOFSTEP] rw [← mem_toSubmodule, ← mem_toSubmodule, h] [GOAL] F : Type v' R' : Type u' R : Type u A : Type v B : Type w C : Type w' inst✝⁷ : CommSemiring R inst✝⁶ : NonUnitalNonAssocSemiring A inst✝⁵ : Module R A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : NonUnitalNonAssocSemiring C inst✝¹ : Module R C inst✝ : NonUnitalAlgHomClass F R A B S : NonUnitalSubalgebra R A s : Set A hs : s = ↑S src✝ : NonUnitalSubsemiring A := NonUnitalSubsemiring.copy S.toNonUnitalSubsemiring s hs r : R a : A ha : a ∈ s ⊢ r • a ∈ { toAddSubmonoid := src✝.toAddSubmonoid, mul_mem' := (_ : ∀ {a b : A}, a ∈ src✝.carrier → b ∈ src✝.carrier → a * b ∈ src✝.carrier) }.toAddSubmonoid.toAddSubsemigroup.carrier [PROOFSTEP] show r • a ∈ s [GOAL] F : Type v' R' : Type u' R : Type u A : Type v B : Type w C : Type w' inst✝⁷ : CommSemiring R inst✝⁶ : NonUnitalNonAssocSemiring A inst✝⁵ : Module R A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : NonUnitalNonAssocSemiring C inst✝¹ : Module R C inst✝ : NonUnitalAlgHomClass F R A B S : NonUnitalSubalgebra R A s : Set A hs : s = ↑S src✝ : NonUnitalSubsemiring A := NonUnitalSubsemiring.copy S.toNonUnitalSubsemiring s hs r : R a : A ha : a ∈ s ⊢ r • a ∈ s [PROOFSTEP] rw [hs] at ha ⊢ [GOAL] F : Type v' R' : Type u' R : Type u A : Type v B : Type w C : Type w' inst✝⁷ : CommSemiring R inst✝⁶ : NonUnitalNonAssocSemiring A inst✝⁵ : Module R A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : NonUnitalNonAssocSemiring C inst✝¹ : Module R C inst✝ : NonUnitalAlgHomClass F R A B S : NonUnitalSubalgebra R A s : Set A hs : s = ↑S src✝ : NonUnitalSubsemiring A := NonUnitalSubsemiring.copy S.toNonUnitalSubsemiring s hs r : R a : A ha : a ∈ ↑S ⊢ r • a ∈ ↑S [PROOFSTEP] exact S.smul_mem' r ha [GOAL] F : Type v' R' : Type u' R✝ : Type u A✝ : Type v B : Type w C : Type w' inst✝¹⁰ : CommSemiring R✝ inst✝⁹ : NonUnitalNonAssocSemiring A✝ inst✝⁸ : Module R✝ A✝ inst✝⁷ : NonUnitalNonAssocSemiring B inst✝⁶ : Module R✝ B inst✝⁵ : NonUnitalNonAssocSemiring C inst✝⁴ : Module R✝ C inst✝³ : NonUnitalAlgHomClass F R✝ A✝ B S✝ : NonUnitalSubalgebra R✝ A✝ R : Type u A : Type v inst✝² : CommRing R inst✝¹ : NonUnitalRing A inst✝ : Module R A S T : NonUnitalSubalgebra R A h : toNonUnitalSubring S = toNonUnitalSubring T x : A ⊢ x ∈ S ↔ x ∈ T [PROOFSTEP] rw [← mem_toNonUnitalSubring, ← mem_toNonUnitalSubring, h] [GOAL] F : Type v' R' : Type u' R : Type u A : Type v B : Type w C : Type w' inst✝⁷ : CommSemiring R inst✝⁶ : NonUnitalNonAssocSemiring A inst✝⁵ : Module R A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : NonUnitalNonAssocSemiring C inst✝¹ : Module R C inst✝ : NonUnitalAlgHomClass F R A B S✝ S T : NonUnitalSubalgebra R A h : (fun S => toSubmodule S) S = (fun S => toSubmodule S) T ⊢ ∀ (x : A), x ∈ S ↔ x ∈ T [PROOFSTEP] apply SetLike.ext_iff.1 h [GOAL] F : Type v' R' : Type u' R : Type u A : Type v B : Type w C : Type w' inst✝⁷ : CommSemiring R inst✝⁶ : NonUnitalNonAssocSemiring A inst✝⁵ : Module R A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : NonUnitalNonAssocSemiring C inst✝¹ : Module R C inst✝ : NonUnitalAlgHomClass F R A B S✝ S T : NonUnitalSubalgebra R A h : (fun S => S.toNonUnitalSubsemiring) S = (fun S => S.toNonUnitalSubsemiring) T ⊢ ∀ (x : A), x ∈ S ↔ x ∈ T [PROOFSTEP] apply SetLike.ext_iff.1 h [GOAL] F : Type v' R' : Type u' R✝ : Type u A✝ : Type v B : Type w C : Type w' inst✝¹⁰ : CommSemiring R✝ inst✝⁹ : NonUnitalNonAssocSemiring A✝ inst✝⁸ : Module R✝ A✝ inst✝⁷ : NonUnitalNonAssocSemiring B inst✝⁶ : Module R✝ B inst✝⁵ : NonUnitalNonAssocSemiring C inst✝⁴ : Module R✝ C inst✝³ : NonUnitalAlgHomClass F R✝ A✝ B S✝ : NonUnitalSubalgebra R✝ A✝ R : Type u A : Type v inst✝² : CommRing R inst✝¹ : NonUnitalRing A inst✝ : Module R A S T : NonUnitalSubalgebra R A h : (fun S => toNonUnitalSubring S) S = (fun S => toNonUnitalSubring S) T ⊢ ∀ (x : A), x ∈ S ↔ x ∈ T [PROOFSTEP] apply SetLike.ext_iff.1 h [GOAL] F : Type v' R' : Type u' R : Type u A : Type v B : Type w C : Type w' inst✝⁷ : CommSemiring R inst✝⁶ : NonUnitalNonAssocSemiring A inst✝⁵ : Module R A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : NonUnitalNonAssocSemiring C inst✝¹ : Module R C inst✝ : NonUnitalAlgHomClass F R A B S✝ : NonUnitalSubalgebra R A f : F S : NonUnitalSubalgebra R A src✝ : NonUnitalSubsemiring B := NonUnitalSubsemiring.map (↑f) S.toNonUnitalSubsemiring r : R b : B hb : b ∈ { toAddSubmonoid := src✝.toAddSubmonoid, mul_mem' := (_ : ∀ {a b : B}, a ∈ src✝.carrier → b ∈ src✝.carrier → a * b ∈ src✝.carrier) }.toAddSubmonoid.toAddSubsemigroup.carrier ⊢ r • b ∈ { toAddSubmonoid := src✝.toAddSubmonoid, mul_mem' := (_ : ∀ {a b : B}, a ∈ src✝.carrier → b ∈ src✝.carrier → a * b ∈ src✝.carrier) }.toAddSubmonoid.toAddSubsemigroup.carrier [PROOFSTEP] rcases hb with ⟨a, ha, rfl⟩ [GOAL] case intro.intro F : Type v' R' : Type u' R : Type u A : Type v B : Type w C : Type w' inst✝⁷ : CommSemiring R inst✝⁶ : NonUnitalNonAssocSemiring A inst✝⁵ : Module R A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : NonUnitalNonAssocSemiring C inst✝¹ : Module R C inst✝ : NonUnitalAlgHomClass F R A B S✝ : NonUnitalSubalgebra R A f : F S : NonUnitalSubalgebra R A src✝ : NonUnitalSubsemiring B := NonUnitalSubsemiring.map (↑f) S.toNonUnitalSubsemiring r : R a : A ha : a ∈ ↑S.toNonUnitalSubsemiring ⊢ r • ↑↑f a ∈ { toAddSubmonoid := src✝.toAddSubmonoid, mul_mem' := (_ : ∀ {a b : B}, a ∈ src✝.carrier → b ∈ src✝.carrier → a * b ∈ src✝.carrier) }.toAddSubmonoid.toAddSubsemigroup.carrier [PROOFSTEP] exact map_smul f r a ▸ Set.mem_image_of_mem f (S.smul_mem' r ha) [GOAL] F : Type v' R' : Type u' R : Type u A : Type v B : Type w C : Type w' inst✝⁷ : CommSemiring R inst✝⁶ : NonUnitalNonAssocSemiring A inst✝⁵ : Module R A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : NonUnitalNonAssocSemiring C inst✝¹ : Module R C inst✝ : NonUnitalAlgHomClass F R A B φ : F r : R a : B ⊢ a ∈ (NonUnitalRingHom.srange ↑φ).toAddSubmonoid.toAddSubsemigroup.carrier → r • a ∈ (NonUnitalRingHom.srange ↑φ).toAddSubmonoid.toAddSubsemigroup.carrier [PROOFSTEP] rintro ⟨a, rfl⟩ [GOAL] case intro F : Type v' R' : Type u' R : Type u A : Type v B : Type w C : Type w' inst✝⁷ : CommSemiring R inst✝⁶ : NonUnitalNonAssocSemiring A inst✝⁵ : Module R A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : NonUnitalNonAssocSemiring C inst✝¹ : Module R C inst✝ : NonUnitalAlgHomClass F R A B φ : F r : R a : A ⊢ r • ↑↑φ a ∈ (NonUnitalRingHom.srange ↑φ).toAddSubmonoid.toAddSubsemigroup.carrier [PROOFSTEP] exact ⟨r • a, map_smul φ r a⟩ [GOAL] F : Type v' R' : Type u' R : Type u A : Type v B : Type w C : Type w' inst✝⁷ : CommSemiring R inst✝⁶ : NonUnitalNonAssocSemiring A inst✝⁵ : Module R A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : NonUnitalNonAssocSemiring C inst✝¹ : Module R C inst✝ : NonUnitalAlgHomClass F R A B φ : F ⊢ ↑(NonUnitalAlgHom.range φ) = Set.range ↑φ [PROOFSTEP] ext [GOAL] case h F : Type v' R' : Type u' R : Type u A : Type v B : Type w C : Type w' inst✝⁷ : CommSemiring R inst✝⁶ : NonUnitalNonAssocSemiring A inst✝⁵ : Module R A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : NonUnitalNonAssocSemiring C inst✝¹ : Module R C inst✝ : NonUnitalAlgHomClass F R A B φ : F x✝ : B ⊢ x✝ ∈ ↑(NonUnitalAlgHom.range φ) ↔ x✝ ∈ Set.range ↑φ [PROOFSTEP] rw [SetLike.mem_coe, mem_range] [GOAL] case h F : Type v' R' : Type u' R : Type u A : Type v B : Type w C : Type w' inst✝⁷ : CommSemiring R inst✝⁶ : NonUnitalNonAssocSemiring A inst✝⁵ : Module R A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : NonUnitalNonAssocSemiring C inst✝¹ : Module R C inst✝ : NonUnitalAlgHomClass F R A B φ : F x✝ : B ⊢ (∃ x, ↑φ x = x✝) ↔ x✝ ∈ Set.range ↑φ [PROOFSTEP] rfl [GOAL] F : Type v' R' : Type u' R : Type u A : Type v B : Type w C : Type w' inst✝⁷ : CommSemiring R inst✝⁶ : NonUnitalNonAssocSemiring A inst✝⁵ : Module R A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : NonUnitalNonAssocSemiring C inst✝¹ : Module R C inst✝ : NonUnitalAlgHomClass F R A B ϕ ψ : F x y : A hx : ↑ϕ x = ↑ψ x hy : ↑ϕ y = ↑ψ y ⊢ x + y ∈ {a | ↑ϕ a = ↑ψ a} [PROOFSTEP] rw [Set.mem_setOf_eq, map_add, map_add, hx, hy] [GOAL] F : Type v' R' : Type u' R : Type u A : Type v B : Type w C : Type w' inst✝⁷ : CommSemiring R inst✝⁶ : NonUnitalNonAssocSemiring A inst✝⁵ : Module R A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : NonUnitalNonAssocSemiring C inst✝¹ : Module R C inst✝ : NonUnitalAlgHomClass F R A B ϕ ψ : F ⊢ 0 ∈ { carrier := {a | ↑ϕ a = ↑ψ a}, add_mem' := (_ : ∀ {x y : A}, ↑ϕ x = ↑ψ x → ↑ϕ y = ↑ψ y → x + y ∈ {a | ↑ϕ a = ↑ψ a}) }.carrier [PROOFSTEP] rw [Set.mem_setOf_eq, map_zero, map_zero] [GOAL] F : Type v' R' : Type u' R : Type u A : Type v B : Type w C : Type w' inst✝⁷ : CommSemiring R inst✝⁶ : NonUnitalNonAssocSemiring A inst✝⁵ : Module R A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : NonUnitalNonAssocSemiring C inst✝¹ : Module R C inst✝ : NonUnitalAlgHomClass F R A B ϕ ψ : F x y : A hx : ↑ϕ x = ↑ψ x hy : ↑ϕ y = ↑ψ y ⊢ x * y ∈ { toAddSubsemigroup := { carrier := {a | ↑ϕ a = ↑ψ a}, add_mem' := (_ : ∀ {x y : A}, ↑ϕ x = ↑ψ x → ↑ϕ y = ↑ψ y → x + y ∈ {a | ↑ϕ a = ↑ψ a}) }, zero_mem' := (_ : 0 ∈ { carrier := {a | ↑ϕ a = ↑ψ a}, add_mem' := (_ : ∀ {x y : A}, ↑ϕ x = ↑ψ x → ↑ϕ y = ↑ψ y → x + y ∈ {a | ↑ϕ a = ↑ψ a}) }.carrier) }.toAddSubsemigroup.carrier [PROOFSTEP] rw [Set.mem_setOf_eq, map_mul, map_mul, hx, hy] [GOAL] F : Type v' R' : Type u' R : Type u A : Type v B : Type w C : Type w' inst✝⁷ : CommSemiring R inst✝⁶ : NonUnitalNonAssocSemiring A inst✝⁵ : Module R A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : NonUnitalNonAssocSemiring C inst✝¹ : Module R C inst✝ : NonUnitalAlgHomClass F R A B ϕ ψ : F r : R x : A hx : ↑ϕ x = ↑ψ x ⊢ r • x ∈ { toAddSubmonoid := { toAddSubsemigroup := { carrier := {a | ↑ϕ a = ↑ψ a}, add_mem' := (_ : ∀ {x y : A}, ↑ϕ x = ↑ψ x → ↑ϕ y = ↑ψ y → x + y ∈ {a | ↑ϕ a = ↑ψ a}) }, zero_mem' := (_ : 0 ∈ { carrier := {a | ↑ϕ a = ↑ψ a}, add_mem' := (_ : ∀ {x y : A}, ↑ϕ x = ↑ψ x → ↑ϕ y = ↑ψ y → x + y ∈ {a | ↑ϕ a = ↑ψ a}) }.carrier) }, mul_mem' := (_ : ∀ {x y : A}, ↑ϕ x = ↑ψ x → ↑ϕ y = ↑ψ y → x * y ∈ { toAddSubsemigroup := { carrier := {a | ↑ϕ a = ↑ψ a}, add_mem' := (_ : ∀ {x y : A}, ↑ϕ x = ↑ψ x → ↑ϕ y = ↑ψ y → x + y ∈ {a | ↑ϕ a = ↑ψ a}) }, zero_mem' := (_ : 0 ∈ { carrier := {a | ↑ϕ a = ↑ψ a}, add_mem' := (_ : ∀ {x y : A}, ↑ϕ x = ↑ψ x → ↑ϕ y = ↑ψ y → x + y ∈ {a | ↑ϕ a = ↑ψ a}) }.carrier) }.toAddSubsemigroup.carrier) }.toAddSubmonoid.toAddSubsemigroup.carrier [PROOFSTEP] rw [Set.mem_setOf_eq, map_smul, map_smul, hx] [GOAL] F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B s : Set A src✝ : Submodule R A := Submodule.span R ↑(NonUnitalSubsemiring.closure s) a b : A ha : a ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) hb : b ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) ⊢ a * b ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) [PROOFSTEP] refine' Submodule.span_induction ha _ _ _ _ [GOAL] case refine'_1 F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B s : Set A src✝ : Submodule R A := Submodule.span R ↑(NonUnitalSubsemiring.closure s) a b : A ha : a ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) hb : b ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) ⊢ ∀ (x : A), x ∈ ↑(NonUnitalSubsemiring.closure s) → x * b ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) [PROOFSTEP] refine' Submodule.span_induction hb _ _ _ _ [GOAL] case refine'_1.refine'_1 F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B s : Set A src✝ : Submodule R A := Submodule.span R ↑(NonUnitalSubsemiring.closure s) a b : A ha : a ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) hb : b ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) ⊢ ∀ (x : A), x ∈ ↑(NonUnitalSubsemiring.closure s) → ∀ (x_1 : A), x_1 ∈ ↑(NonUnitalSubsemiring.closure s) → x_1 * x ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) [PROOFSTEP] exact fun x (hx : x ∈ NonUnitalSubsemiring.closure s) y (hy : y ∈ NonUnitalSubsemiring.closure s) => Submodule.subset_span (mul_mem hy hx) [GOAL] case refine'_1.refine'_2 F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B s : Set A src✝ : Submodule R A := Submodule.span R ↑(NonUnitalSubsemiring.closure s) a b : A ha : a ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) hb : b ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) ⊢ ∀ (x : A), x ∈ ↑(NonUnitalSubsemiring.closure s) → x * 0 ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) [PROOFSTEP] exact fun x _hx => (mul_zero x).symm ▸ Submodule.zero_mem _ [GOAL] case refine'_1.refine'_3 F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B s : Set A src✝ : Submodule R A := Submodule.span R ↑(NonUnitalSubsemiring.closure s) a b : A ha : a ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) hb : b ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) ⊢ ∀ (x y : A), (∀ (x_1 : A), x_1 ∈ ↑(NonUnitalSubsemiring.closure s) → x_1 * x ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s)) → (∀ (x : A), x ∈ ↑(NonUnitalSubsemiring.closure s) → x * y ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s)) → ∀ (x_1 : A), x_1 ∈ ↑(NonUnitalSubsemiring.closure s) → x_1 * (x + y) ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) [PROOFSTEP] exact fun x y hx hy z hz => (mul_add z x y).symm ▸ add_mem (hx z hz) (hy z hz) [GOAL] case refine'_1.refine'_4 F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B s : Set A src✝ : Submodule R A := Submodule.span R ↑(NonUnitalSubsemiring.closure s) a b : A ha : a ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) hb : b ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) ⊢ ∀ (a : R) (x : A), (∀ (x_1 : A), x_1 ∈ ↑(NonUnitalSubsemiring.closure s) → x_1 * x ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s)) → ∀ (x_1 : A), x_1 ∈ ↑(NonUnitalSubsemiring.closure s) → x_1 * a • x ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) [PROOFSTEP] exact fun r x hx y hy => (mul_smul_comm r y x).symm ▸ SMulMemClass.smul_mem r (hx y hy) [GOAL] case refine'_2 F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B s : Set A src✝ : Submodule R A := Submodule.span R ↑(NonUnitalSubsemiring.closure s) a b : A ha : a ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) hb : b ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) ⊢ 0 * b ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) [PROOFSTEP] exact (zero_mul b).symm ▸ Submodule.zero_mem _ [GOAL] case refine'_3 F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B s : Set A src✝ : Submodule R A := Submodule.span R ↑(NonUnitalSubsemiring.closure s) a b : A ha : a ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) hb : b ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) ⊢ ∀ (x y : A), x * b ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) → y * b ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) → (x + y) * b ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) [PROOFSTEP] exact fun x y => (add_mul x y b).symm ▸ add_mem [GOAL] case refine'_4 F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B s : Set A src✝ : Submodule R A := Submodule.span R ↑(NonUnitalSubsemiring.closure s) a b : A ha : a ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) hb : b ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) ⊢ ∀ (a : R) (x : A), x * b ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) → a • x * b ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure s) [PROOFSTEP] exact fun r x hx => (smul_mul_assoc r x b).symm ▸ SMulMemClass.smul_mem r hx [GOAL] F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B s : Set A p : { x // x ∈ adjoin R s } → Prop a : { x // x ∈ adjoin R s } Hs : ∀ (x : A) (h : x ∈ s), p { val := x, property := (_ : x ∈ ↑(adjoin R s)) } Hadd : ∀ (x y : { x // x ∈ adjoin R s }), p x → p y → p (x + y) H0 : p 0 Hmul : ∀ (x y : { x // x ∈ adjoin R s }), p x → p y → p (x * y) Hsmul : ∀ (r : R) (x : { x // x ∈ adjoin R s }), p x → p (r • x) b : A hb : b ∈ adjoin R s ⊢ p { val := b, property := hb } [PROOFSTEP] refine Exists.elim ?_ (fun (hb : b ∈ adjoin R s) (hc : p ⟨b, hb⟩) => hc) [GOAL] F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B s : Set A p : { x // x ∈ adjoin R s } → Prop a : { x // x ∈ adjoin R s } Hs : ∀ (x : A) (h : x ∈ s), p { val := x, property := (_ : x ∈ ↑(adjoin R s)) } Hadd : ∀ (x y : { x // x ∈ adjoin R s }), p x → p y → p (x + y) H0 : p 0 Hmul : ∀ (x y : { x // x ∈ adjoin R s }), p x → p y → p (x * y) Hsmul : ∀ (r : R) (x : { x // x ∈ adjoin R s }), p x → p (r • x) b : A hb : b ∈ adjoin R s ⊢ ∃ x, p { val := b, property := x } [PROOFSTEP] apply adjoin_induction hb [GOAL] case Hs F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B s : Set A p : { x // x ∈ adjoin R s } → Prop a : { x // x ∈ adjoin R s } Hs : ∀ (x : A) (h : x ∈ s), p { val := x, property := (_ : x ∈ ↑(adjoin R s)) } Hadd : ∀ (x y : { x // x ∈ adjoin R s }), p x → p y → p (x + y) H0 : p 0 Hmul : ∀ (x y : { x // x ∈ adjoin R s }), p x → p y → p (x * y) Hsmul : ∀ (r : R) (x : { x // x ∈ adjoin R s }), p x → p (r • x) b : A hb : b ∈ adjoin R s ⊢ ∀ (x : A), x ∈ s → ∃ x_1, p { val := x, property := x_1 } [PROOFSTEP] exact fun x hx => ⟨subset_adjoin R hx, Hs x hx⟩ [GOAL] case Hadd F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B s : Set A p : { x // x ∈ adjoin R s } → Prop a : { x // x ∈ adjoin R s } Hs : ∀ (x : A) (h : x ∈ s), p { val := x, property := (_ : x ∈ ↑(adjoin R s)) } Hadd : ∀ (x y : { x // x ∈ adjoin R s }), p x → p y → p (x + y) H0 : p 0 Hmul : ∀ (x y : { x // x ∈ adjoin R s }), p x → p y → p (x * y) Hsmul : ∀ (r : R) (x : { x // x ∈ adjoin R s }), p x → p (r • x) b : A hb : b ∈ adjoin R s ⊢ ∀ (x y : A), (∃ x_1, p { val := x, property := x_1 }) → (∃ x, p { val := y, property := x }) → ∃ x_1, p { val := x + y, property := x_1 } [PROOFSTEP] exact fun x y hx hy => Exists.elim hx <| fun hx' hx => Exists.elim hy <| fun hy' hy => ⟨add_mem hx' hy', Hadd _ _ hx hy⟩ [GOAL] case H0 F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B s : Set A p : { x // x ∈ adjoin R s } → Prop a : { x // x ∈ adjoin R s } Hs : ∀ (x : A) (h : x ∈ s), p { val := x, property := (_ : x ∈ ↑(adjoin R s)) } Hadd : ∀ (x y : { x // x ∈ adjoin R s }), p x → p y → p (x + y) H0 : p 0 Hmul : ∀ (x y : { x // x ∈ adjoin R s }), p x → p y → p (x * y) Hsmul : ∀ (r : R) (x : { x // x ∈ adjoin R s }), p x → p (r • x) b : A hb : b ∈ adjoin R s ⊢ ∃ x, p { val := 0, property := x } [PROOFSTEP] exact ⟨_, H0⟩ [GOAL] case Hmul F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B s : Set A p : { x // x ∈ adjoin R s } → Prop a : { x // x ∈ adjoin R s } Hs : ∀ (x : A) (h : x ∈ s), p { val := x, property := (_ : x ∈ ↑(adjoin R s)) } Hadd : ∀ (x y : { x // x ∈ adjoin R s }), p x → p y → p (x + y) H0 : p 0 Hmul : ∀ (x y : { x // x ∈ adjoin R s }), p x → p y → p (x * y) Hsmul : ∀ (r : R) (x : { x // x ∈ adjoin R s }), p x → p (r • x) b : A hb : b ∈ adjoin R s ⊢ ∀ (x y : A), (∃ x_1, p { val := x, property := x_1 }) → (∃ x, p { val := y, property := x }) → ∃ x_1, p { val := x * y, property := x_1 } [PROOFSTEP] exact fun x y hx hy => Exists.elim hx <| fun hx' hx => Exists.elim hy <| fun hy' hy => ⟨mul_mem hx' hy', Hmul _ _ hx hy⟩ [GOAL] case Hsmul F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B s : Set A p : { x // x ∈ adjoin R s } → Prop a : { x // x ∈ adjoin R s } Hs : ∀ (x : A) (h : x ∈ s), p { val := x, property := (_ : x ∈ ↑(adjoin R s)) } Hadd : ∀ (x y : { x // x ∈ adjoin R s }), p x → p y → p (x + y) H0 : p 0 Hmul : ∀ (x y : { x // x ∈ adjoin R s }), p x → p y → p (x * y) Hsmul : ∀ (r : R) (x : { x // x ∈ adjoin R s }), p x → p (r • x) b : A hb : b ∈ adjoin R s ⊢ ∀ (r : R) (x : A), (∃ x_1, p { val := x, property := x_1 }) → ∃ x_1, p { val := r • x, property := x_1 } [PROOFSTEP] exact fun r x hx => Exists.elim hx <| fun hx' hx => ⟨SMulMemClass.smul_mem r hx', Hsmul r _ hx⟩ [GOAL] F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B ⊢ adjoin R ⊥ = ⊥ [PROOFSTEP] apply GaloisConnection.l_bot [GOAL] case gc F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B ⊢ GaloisConnection (adjoin R) ?u case u F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B ⊢ NonUnitalSubalgebra R A → Set A [PROOFSTEP] exact NonUnitalAlgebra.gc [GOAL] F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B S T : NonUnitalSubalgebra R A ⊢ ∀ {x : A}, x ∈ S → x ∈ S ⊔ T [PROOFSTEP] rw [← SetLike.le_def] [GOAL] F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B S T : NonUnitalSubalgebra R A ⊢ S ≤ S ⊔ T [PROOFSTEP] exact le_sup_left [GOAL] F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B S T : NonUnitalSubalgebra R A ⊢ ∀ {x : A}, x ∈ T → x ∈ S ⊔ T [PROOFSTEP] rw [← SetLike.le_def] [GOAL] F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B S T : NonUnitalSubalgebra R A ⊢ T ≤ S ⊔ T [PROOFSTEP] exact le_sup_right [GOAL] F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B S : Set (NonUnitalSubalgebra R A) x : A ⊢ x ∈ sInf S ↔ ∀ (p : NonUnitalSubalgebra R A), p ∈ S → x ∈ p [PROOFSTEP] simp only [← SetLike.mem_coe, coe_sInf, Set.mem_iInter₂] [GOAL] F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B S : Set (NonUnitalSubalgebra R A) ⊢ ↑(NonUnitalSubalgebra.toSubmodule (sInf S)) = ↑(sInf (NonUnitalSubalgebra.toSubmodule '' S)) [PROOFSTEP] simp [GOAL] F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B S : Set (NonUnitalSubalgebra R A) ⊢ ↑(sInf S).toNonUnitalSubsemiring = ↑(sInf (NonUnitalSubalgebra.toNonUnitalSubsemiring '' S)) [PROOFSTEP] simp [GOAL] F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B ι : Sort u_2 S : ι → NonUnitalSubalgebra R A ⊢ ↑(⨅ (i : ι), S i) = ⋂ (i : ι), ↑(S i) [PROOFSTEP] simp [iInf] [GOAL] F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B ι : Sort u_2 S : ι → NonUnitalSubalgebra R A x : A ⊢ x ∈ ⨅ (i : ι), S i ↔ ∀ (i : ι), x ∈ S i [PROOFSTEP] simp only [iInf, mem_sInf, Set.forall_range_iff] [GOAL] F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B ι : Sort u_2 S : ι → NonUnitalSubalgebra R A ⊢ ↑(NonUnitalSubalgebra.toSubmodule (⨅ (i : ι), S i)) = ↑(⨅ (i : ι), NonUnitalSubalgebra.toSubmodule (S i)) [PROOFSTEP] simp [GOAL] F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B x : A ⊢ x ∈ Submodule.span R ↑(NonUnitalSubsemiring.closure ∅) ↔ x = 0 [PROOFSTEP] rw [NonUnitalSubsemiring.closure_empty, NonUnitalSubsemiring.coe_bot, Submodule.span_zero_singleton, Submodule.mem_bot] [GOAL] F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B ⊢ NonUnitalSubalgebra.toSubmodule ⊥ = ⊥ [PROOFSTEP] ext [GOAL] case h F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B x✝ : A ⊢ x✝ ∈ NonUnitalSubalgebra.toSubmodule ⊥ ↔ x✝ ∈ ⊥ [PROOFSTEP] simp only [mem_bot, NonUnitalSubalgebra.mem_toSubmodule, Submodule.mem_bot] [GOAL] F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B ⊢ ↑⊥ = {0} [PROOFSTEP] simp [Set.ext_iff, NonUnitalAlgebra.mem_bot] [GOAL] F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B S : NonUnitalSubalgebra R A h : S = ⊤ x : A ⊢ x ∈ S [PROOFSTEP] rw [h] [GOAL] F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B S : NonUnitalSubalgebra R A h : S = ⊤ x : A ⊢ x ∈ ⊤ [PROOFSTEP] exact mem_top [GOAL] F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B S : NonUnitalSubalgebra R A h : ∀ (x : A), x ∈ S ⊢ S = ⊤ [PROOFSTEP] ext x [GOAL] case h F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B S : NonUnitalSubalgebra R A h : ∀ (x : A), x ∈ S x : A ⊢ x ∈ S ↔ x ∈ ⊤ [PROOFSTEP] exact ⟨fun _ => mem_top, fun _ => h x⟩ [GOAL] F : Type u_1 R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B inst✝ : NonUnitalAlgHomClass F R A B f : A →ₙₐ[R] B ⊢ ↑(NonUnitalSubalgebra.map f ⊥) = ↑⊥ [PROOFSTEP] simp [NonUnitalAlgebra.coe_bot, NonUnitalSubalgebra.coe_map] [GOAL] R : Type u A : Type v B✝ : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B✝ inst✝³ : Module R B✝ inst✝² : IsScalarTower R B✝ B✝ inst✝¹ : SMulCommClass R B✝ B✝ S : NonUnitalSubalgebra R A inst✝ : Subsingleton A B C : NonUnitalSubalgebra R A x : A ⊢ x ∈ B ↔ x ∈ C [PROOFSTEP] simp only [Subsingleton.elim x 0, zero_mem B, zero_mem C] [GOAL] R : Type u A : Type v B : Type w inst✝⁸ : CommSemiring R inst✝⁷ : NonUnitalNonAssocSemiring A inst✝⁶ : Module R A inst✝⁵ : IsScalarTower R A A inst✝⁴ : SMulCommClass R A A inst✝³ : NonUnitalNonAssocSemiring B inst✝² : Module R B inst✝¹ : IsScalarTower R B B inst✝ : SMulCommClass R B B S : NonUnitalSubalgebra R A S₁ : NonUnitalSubalgebra R B ⊢ prod ⊤ ⊤ = ⊤ [PROOFSTEP] ext [GOAL] case h R : Type u A : Type v B : Type w inst✝⁸ : CommSemiring R inst✝⁷ : NonUnitalNonAssocSemiring A inst✝⁶ : Module R A inst✝⁵ : IsScalarTower R A A inst✝⁴ : SMulCommClass R A A inst✝³ : NonUnitalNonAssocSemiring B inst✝² : Module R B inst✝¹ : IsScalarTower R B B inst✝ : SMulCommClass R B B S : NonUnitalSubalgebra R A S₁ : NonUnitalSubalgebra R B x✝ : A × B ⊢ x✝ ∈ prod ⊤ ⊤ ↔ x✝ ∈ ⊤ [PROOFSTEP] simp [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) T : NonUnitalSubalgebra R A hT : T = iSup K ⊢ { x // x ∈ T } →ₙₐ[R] B [PROOFSTEP] subst hT [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ { x // x ∈ iSup K } →ₙₐ[R] B [PROOFSTEP] exact { toFun := Set.iUnionLift (fun i => ↑(K i)) (fun i x => f i x) (fun i j x hxi hxj => by let ⟨k, hik, hjk⟩ := dir i j simp only rw [hf i k hik, hf j k hjk] rfl) (↑(iSup K)) (by rw [coe_iSup_of_directed dir]) map_zero' := by dsimp exact Set.iUnionLift_const _ (fun i : ι => (0 : K i)) (fun _ => rfl) _ (by simp) map_mul' := by dsimp apply Set.iUnionLift_binary (coe_iSup_of_directed dir) dir _ (fun _ => (· * ·)) on_goal 3 => rw [coe_iSup_of_directed dir] all_goals simp map_add' := by dsimp apply Set.iUnionLift_binary (coe_iSup_of_directed dir) dir _ (fun _ => (· + ·)) on_goal 3 => rw [coe_iSup_of_directed dir] all_goals simp map_smul' := fun r => by dsimp apply Set.iUnionLift_unary (coe_iSup_of_directed dir) _ (fun _ x => r • x) (fun _ _ => rfl) on_goal 2 => rw [coe_iSup_of_directed dir] all_goals simp } [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) i j : ι x : A hxi : x ∈ (fun i => ↑(K i)) i hxj : x ∈ (fun i => ↑(K i)) j ⊢ (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj } [PROOFSTEP] let ⟨k, hik, hjk⟩ := dir i j [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) i j : ι x : A hxi : x ∈ (fun i => ↑(K i)) i hxj : x ∈ (fun i => ↑(K i)) j k : ι hik : (fun x x_1 => x ≤ x_1) (K i) (K k) hjk : (fun x x_1 => x ≤ x_1) (K j) (K k) ⊢ (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj } [PROOFSTEP] simp only [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) i j : ι x : A hxi : x ∈ (fun i => ↑(K i)) i hxj : x ∈ (fun i => ↑(K i)) j k : ι hik : (fun x x_1 => x ≤ x_1) (K i) (K k) hjk : (fun x x_1 => x ≤ x_1) (K j) (K k) ⊢ ↑(f i) { val := x, property := hxi } = ↑(f j) { val := x, property := hxj } [PROOFSTEP] rw [hf i k hik, hf j k hjk] [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) i j : ι x : A hxi : x ∈ (fun i => ↑(K i)) i hxj : x ∈ (fun i => ↑(K i)) j k : ι hik : (fun x x_1 => x ≤ x_1) (K i) (K k) hjk : (fun x x_1 => x ≤ x_1) (K j) (K k) ⊢ ↑(NonUnitalAlgHom.comp (f k) (inclusion hik)) { val := x, property := hxi } = ↑(NonUnitalAlgHom.comp (f k) (inclusion hjk)) { val := x, property := hxj } [PROOFSTEP] rfl [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i) [PROOFSTEP] rw [coe_iSup_of_directed dir] [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) r : R ⊢ ∀ (x : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (r • x) = r • Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x [PROOFSTEP] dsimp [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) r : R ⊢ ∀ (x : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ ↑(K i)) (hxj : x ∈ ↑(K j)), ↑(f i) { val := x, property := hxi } = ↑(f j) { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (r • x) = r • Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ ↑(K i)) (hxj : x ∈ ↑(K j)), ↑(f i) { val := x, property := hxi } = ↑(f j) { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x [PROOFSTEP] apply Set.iUnionLift_unary (coe_iSup_of_directed dir) _ (fun _ x => r • x) (fun _ _ => rfl) [GOAL] case h R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) r : R ⊢ ∀ (i : ι) (x : ↑↑(K i)), ↑(f i) (r • x) = r • ↑(f i) x R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) r : R ⊢ ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i) [PROOFSTEP] on_goal 2 => rw [coe_iSup_of_directed dir] [GOAL] case h R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) r : R ⊢ ∀ (i : ι) (x : ↑↑(K i)), ↑(f i) (r • x) = r • ↑(f i) x R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) r : R ⊢ ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i) [PROOFSTEP] on_goal 2 => rw [coe_iSup_of_directed dir] [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) r : R ⊢ ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i) [PROOFSTEP] rw [coe_iSup_of_directed dir] [GOAL] case h R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) r : R ⊢ ∀ (i : ι) (x : ↑↑(K i)), ↑(f i) (r • x) = r • ↑(f i) x [PROOFSTEP] all_goals simp [GOAL] case h R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) r : R ⊢ ∀ (i : ι) (x : ↑↑(K i)), ↑(f i) (r • x) = r • ↑(f i) x [PROOFSTEP] simp [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ MulActionHom.toFun { toFun := Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)), map_smul' := (_ : ∀ (r : R) (x : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (r • x) = r • Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x) } 0 = 0 [PROOFSTEP] dsimp [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ ↑(K i)) (hxj : x ∈ ↑(K j)), ↑(f i) { val := x, property := hxi } = ↑(f j) { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) 0 = 0 [PROOFSTEP] exact Set.iUnionLift_const _ (fun i : ι => (0 : K i)) (fun _ => rfl) _ (by simp) [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ∀ (i : ι), ↑(f i) ((fun i => 0) i) = 0 [PROOFSTEP] simp [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ∀ (x y : { x // x ∈ iSup K }), MulActionHom.toFun { toFun := Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)), map_smul' := (_ : ∀ (r : R) (x : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (r • x) = r • Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x) } (x + y) = MulActionHom.toFun { toFun := Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)), map_smul' := (_ : ∀ (r : R) (x : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (r • x) = r • Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x) } x + MulActionHom.toFun { toFun := Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)), map_smul' := (_ : ∀ (r : R) (x : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (r • x) = r • Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x) } y [PROOFSTEP] dsimp [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ∀ (x y : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ ↑(K i)) (hxj : x ∈ ↑(K j)), ↑(f i) { val := x, property := hxi } = ↑(f j) { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (x + y) = Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ ↑(K i)) (hxj : x ∈ ↑(K j)), ↑(f i) { val := x, property := hxi } = ↑(f j) { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x + Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ ↑(K i)) (hxj : x ∈ ↑(K j)), ↑(f i) { val := x, property := hxi } = ↑(f j) { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) y [PROOFSTEP] apply Set.iUnionLift_binary (coe_iSup_of_directed dir) dir _ (fun _ => (· + ·)) [GOAL] case hopi R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ∀ (i : ι) (x y : ↑↑(K i)), Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) (x + y) = Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) x + Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) y case h R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ∀ (i : ι) (x y : ↑↑(K i)), ↑(f i) (x + y) = ↑(f i) x + ↑(f i) y R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i) [PROOFSTEP] on_goal 3 => rw [coe_iSup_of_directed dir] [GOAL] case hopi R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ∀ (i : ι) (x y : ↑↑(K i)), Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) (x + y) = Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) x + Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) y case h R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ∀ (i : ι) (x y : ↑↑(K i)), ↑(f i) (x + y) = ↑(f i) x + ↑(f i) y R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i) [PROOFSTEP] on_goal 3 => rw [coe_iSup_of_directed dir] [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i) [PROOFSTEP] rw [coe_iSup_of_directed dir] [GOAL] case hopi R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ∀ (i : ι) (x y : ↑↑(K i)), Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) (x + y) = Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) x + Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) y case h R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ∀ (i : ι) (x y : ↑↑(K i)), ↑(f i) (x + y) = ↑(f i) x + ↑(f i) y [PROOFSTEP] all_goals simp [GOAL] case hopi R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ∀ (i : ι) (x y : ↑↑(K i)), Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) (x + y) = Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) x + Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) y [PROOFSTEP] simp [GOAL] case h R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ∀ (i : ι) (x y : ↑↑(K i)), ↑(f i) (x + y) = ↑(f i) x + ↑(f i) y [PROOFSTEP] simp [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ∀ (x y : { x // x ∈ iSup K }), MulActionHom.toFun { toMulActionHom := { toFun := Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)), map_smul' := (_ : ∀ (r : R) (x : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (r • x) = r • Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x) }, map_zero' := (_ : MulActionHom.toFun { toFun := Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)), map_smul' := (_ : ∀ (r : R) (x : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (r • x) = r • Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x) } 0 = 0), map_add' := (_ : ∀ (x y : { x // x ∈ iSup K }), MulActionHom.toFun { toFun := Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)), map_smul' := (_ : ∀ (r : R) (x : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (r • x) = r • Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x) } (x + y) = MulActionHom.toFun { toFun := Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)), map_smul' := (_ : ∀ (r : R) (x : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (r • x) = r • Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x) } x + MulActionHom.toFun { toFun := Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)), map_smul' := (_ : ∀ (r : R) (x : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (r • x) = r • Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x) } y) }.toMulActionHom (x * y) = MulActionHom.toFun { toMulActionHom := { toFun := Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)), map_smul' := (_ : ∀ (r : R) (x : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (r • x) = r • Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x) }, map_zero' := (_ : MulActionHom.toFun { toFun := Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)), map_smul' := (_ : ∀ (r : R) (x : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (r • x) = r • Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x) } 0 = 0), map_add' := (_ : ∀ (x y : { x // x ∈ iSup K }), MulActionHom.toFun { toFun := Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)), map_smul' := (_ : ∀ (r : R) (x : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (r • x) = r • Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x) } (x + y) = MulActionHom.toFun { toFun := Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)), map_smul' := (_ : ∀ (r : R) (x : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (r • x) = r • Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x) } x + MulActionHom.toFun { toFun := Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)), map_smul' := (_ : ∀ (r : R) (x : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (r • x) = r • Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x) } y) }.toMulActionHom x * MulActionHom.toFun { toMulActionHom := { toFun := Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)), map_smul' := (_ : ∀ (r : R) (x : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (r • x) = r • Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x) }, map_zero' := (_ : MulActionHom.toFun { toFun := Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)), map_smul' := (_ : ∀ (r : R) (x : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (r • x) = r • Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x) } 0 = 0), map_add' := (_ : ∀ (x y : { x // x ∈ iSup K }), MulActionHom.toFun { toFun := Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)), map_smul' := (_ : ∀ (r : R) (x : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (r • x) = r • Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x) } (x + y) = MulActionHom.toFun { toFun := Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)), map_smul' := (_ : ∀ (r : R) (x : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (r • x) = r • Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x) } x + MulActionHom.toFun { toFun := Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)), map_smul' := (_ : ∀ (r : R) (x : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (r • x) = r • Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x) } y) }.toMulActionHom y [PROOFSTEP] dsimp [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ∀ (x y : { x // x ∈ iSup K }), Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ ↑(K i)) (hxj : x ∈ ↑(K j)), ↑(f i) { val := x, property := hxi } = ↑(f j) { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (x * y) = Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ ↑(K i)) (hxj : x ∈ ↑(K j)), ↑(f i) { val := x, property := hxi } = ↑(f j) { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x * Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ ↑(K i)) (hxj : x ∈ ↑(K j)), ↑(f i) { val := x, property := hxi } = ↑(f j) { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) y [PROOFSTEP] apply Set.iUnionLift_binary (coe_iSup_of_directed dir) dir _ (fun _ => (· * ·)) [GOAL] case hopi R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ∀ (i : ι) (x y : ↑↑(K i)), Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) (x * y) = Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) x * Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) y case h R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ∀ (i : ι) (x y : ↑↑(K i)), ↑(f i) (x * y) = ↑(f i) x * ↑(f i) y R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i) [PROOFSTEP] on_goal 3 => rw [coe_iSup_of_directed dir] [GOAL] case hopi R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ∀ (i : ι) (x y : ↑↑(K i)), Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) (x * y) = Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) x * Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) y case h R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ∀ (i : ι) (x y : ↑↑(K i)), ↑(f i) (x * y) = ↑(f i) x * ↑(f i) y R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i) [PROOFSTEP] on_goal 3 => rw [coe_iSup_of_directed dir] [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i) [PROOFSTEP] rw [coe_iSup_of_directed dir] [GOAL] case hopi R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ∀ (i : ι) (x y : ↑↑(K i)), Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) (x * y) = Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) x * Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) y case h R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ∀ (i : ι) (x y : ↑↑(K i)), ↑(f i) (x * y) = ↑(f i) x * ↑(f i) y [PROOFSTEP] all_goals simp [GOAL] case hopi R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ∀ (i : ι) (x y : ↑↑(K i)), Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) (x * y) = Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) x * Set.inclusion (_ : ↑(K i) ⊆ ↑(iSup K)) y [PROOFSTEP] simp [GOAL] case h R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) ⊢ ∀ (i : ι) (x y : ↑↑(K i)), ↑(f i) (x * y) = ↑(f i) x * ↑(f i) y [PROOFSTEP] simp [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) T : NonUnitalSubalgebra R A hT : T = iSup K i : ι x : { x // x ∈ K i } h : K i ≤ T ⊢ ↑(iSupLift K dir f hf T hT) (↑(inclusion h) x) = ↑(f i) x [PROOFSTEP] subst T [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) i : ι x : { x // x ∈ K i } h : K i ≤ iSup K ⊢ ↑(iSupLift K dir f hf (iSup K) (_ : iSup K = iSup K)) (↑(inclusion h) x) = ↑(f i) x [PROOFSTEP] dsimp [iSupLift] [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) i : ι x : { x // x ∈ K i } h : K i ≤ iSup K ⊢ Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) (↑(inclusion h) x) = ↑(f i) x [PROOFSTEP] apply Set.iUnionLift_inclusion [GOAL] case h R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) i : ι x : { x // x ∈ K i } h : K i ≤ iSup K ⊢ ↑(K i) ⊆ ↑(iSup K) [PROOFSTEP] exact h [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) T : NonUnitalSubalgebra R A hT : T = iSup K i : ι h : K i ≤ T ⊢ NonUnitalAlgHom.comp (iSupLift K dir f hf T hT) (inclusion h) = f i [PROOFSTEP] ext [GOAL] case h R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) T : NonUnitalSubalgebra R A hT : T = iSup K i : ι h : K i ≤ T x✝ : { x // x ∈ K i } ⊢ ↑(NonUnitalAlgHom.comp (iSupLift K dir f hf T hT) (inclusion h)) x✝ = ↑(f i) x✝ [PROOFSTEP] simp [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) T : NonUnitalSubalgebra R A hT : T = iSup K i : ι x : { x // x ∈ K i } hx : ↑x ∈ T ⊢ ↑(iSupLift K dir f hf T hT) { val := ↑x, property := hx } = ↑(f i) x [PROOFSTEP] subst hT [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) i : ι x : { x // x ∈ K i } hx : ↑x ∈ iSup K ⊢ ↑(iSupLift K dir f hf (iSup K) (_ : iSup K = iSup K)) { val := ↑x, property := hx } = ↑(f i) x [PROOFSTEP] dsimp [iSupLift] [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) i : ι x : { x // x ∈ K i } hx : ↑x ∈ iSup K ⊢ Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) { val := ↑x, property := hx } = ↑(f i) x [PROOFSTEP] apply Set.iUnionLift_mk [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) T : NonUnitalSubalgebra R A hT : T = iSup K i : ι x : { x // x ∈ T } hx : ↑x ∈ K i ⊢ ↑(iSupLift K dir f hf T hT) x = ↑(f i) { val := ↑x, property := hx } [PROOFSTEP] subst hT [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) i : ι x : { x // x ∈ iSup K } hx : ↑x ∈ K i ⊢ ↑(iSupLift K dir f hf (iSup K) (_ : iSup K = iSup K)) x = ↑(f i) { val := ↑x, property := hx } [PROOFSTEP] dsimp [iSupLift] [GOAL] R : Type u A : Type v B : Type w inst✝⁹ : CommSemiring R inst✝⁸ : NonUnitalNonAssocSemiring A inst✝⁷ : Module R A inst✝⁶ : IsScalarTower R A A inst✝⁵ : SMulCommClass R A A inst✝⁴ : NonUnitalNonAssocSemiring B inst✝³ : Module R B inst✝² : IsScalarTower R B B inst✝¹ : SMulCommClass R B B S : NonUnitalSubalgebra R A ι : Type u_1 inst✝ : Nonempty ι K : ι → NonUnitalSubalgebra R A dir : Directed (fun x x_1 => x ≤ x_1) K f : (i : ι) → { x // x ∈ K i } →ₙₐ[R] B hf : ∀ (i j : ι) (h : K i ≤ K j), f i = NonUnitalAlgHom.comp (f j) (inclusion h) i : ι x : { x // x ∈ iSup K } hx : ↑x ∈ K i ⊢ Set.iUnionLift (fun i => ↑(K i)) (fun i x => ↑(f i) x) (_ : ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j), (fun i x => ↑(f i) x) i { val := x, property := hxi } = (fun i x => ↑(f i) x) j { val := x, property := hxj }) ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ (i : ι), ↑(K i)) x = ↑(f i) { val := ↑x, property := hx } [PROOFSTEP] apply Set.iUnionLift_of_mem [GOAL] R : Type u_1 A : Type u_2 inst✝⁴ : CommSemiring R inst✝³ : NonUnitalNonAssocSemiring A inst✝² : Module R A inst✝¹ : IsScalarTower R A A inst✝ : SMulCommClass R A A r : R a : A ha : a ∈ Set.center A ⊢ r • a ∈ Set.center A [PROOFSTEP] simp [Set.mem_center_iff, mul_smul_comm, smul_mul_assoc, (Set.mem_center_iff A).mp ha] [GOAL] R : Type u_1 A : Type u_2 inst✝⁴ : CommSemiring R inst✝³ : NonUnitalSemiring A inst✝² : Module R A inst✝¹ : IsScalarTower R A A inst✝ : SMulCommClass R A A s : Set A r : R a : A ha : a ∈ Set.centralizer s x : A hx : x ∈ s ⊢ x * r • a = r • a * x [PROOFSTEP] rw [mul_smul_comm, smul_mul_assoc, ha x hx]
% Demo for Structured Edge Detector (please see readme.txt first). addpath(genpath('../piotr_toolbox')); %% set opts for training (see edgesTrain.m) opts=edgesTrain(); % default options (good settings) opts.modelDir='models/'; % model will be in models/forest opts.modelFnm='modelBsds'; % model name opts.nPos=5e5; opts.nNeg=5e5; % decrease to speedup training opts.useParfor=0; % parallelize if sufficient memory %% train edge detector (~20m/8Gb per tree, proportional to nPos/nNeg) tic, model=edgesTrain(opts); toc; % will load model if already trained %% set detection parameters (can set after training) model.opts.multiscale=0; % for top accuracy set multiscale=1 model.opts.sharpen=2; % for top speed set sharpen=0 model.opts.nTreesEval=4; % for top speed set nTreesEval=1 model.opts.nThreads=4; % max number threads for evaluation model.opts.nms=0; % set to true to enable nms %% evaluate edge detector on BSDS500 (see edgesEval.m) if(0), edgesEval( model, 'show',1, 'name','' ); end %% detect edge and visualize results I = imread('peppers.png'); tic, E=edgesDetect(I,model); toc figure(1); im(I); figure(2); im(1-E);
Formal statement is: lemma real_tendsto_divide_at_top: fixes c::"real" assumes "(f \<longlongrightarrow> c) F" assumes "filterlim g at_top F" shows "((\<lambda>x. f x / g x) \<longlongrightarrow> 0) F" Informal statement is: If $f$ and $g$ are real-valued functions such that $f$ converges to $c$ and $g$ tends to infinity, then $f/g$ tends to zero.
[STATEMENT] lemma valofd_ge_0: "0 \<le> valofd x" [PROOF STATE] proof (prove) goal (1 subgoal): 1. 0 \<le> valofd x [PROOF STEP] unfolding valofd_def [PROOF STATE] proof (prove) goal (1 subgoal): 1. 0 \<le> 2 / 2 ^ bias TYPE(('a, 'b) IEEE.float) * (real (fraction x) / 2 ^ LENGTH('b)) [PROOF STEP] by simp
theorem Radon: assumes "affine_dependent c" obtains m p where "m \<subseteq> c" "p \<subseteq> c" "m \<inter> p = {}" "(convex hull m) \<inter> (convex hull p) \<noteq> {}"
open import Prelude open import core module lemmas-ground where -- not ground types aren't hole to hole ground-arr-not-hole : ∀{τ} → (τ ground → ⊥) → (τ ≠ (⦇-⦈ ==> ⦇-⦈)) ground-arr-not-hole notg refl = notg GHole -- not ground types either have to be hole or an arrow notground : ∀{τ} → (τ ground → ⊥) → (τ == ⦇-⦈) + (Σ[ τ1 ∈ htyp ] Σ[ τ2 ∈ htyp ] (τ == (τ1 ==> τ2))) notground {b} gnd = abort (gnd GBase) notground {⦇-⦈} gnd = Inl refl notground {b ==> b} gnd = Inr (b , b , refl) notground {b ==> ⦇-⦈} gnd = Inr (b , ⦇-⦈ , refl) notground {b ==> τ2 ==> τ3} gnd = Inr (b , τ2 ==> τ3 , refl) notground {⦇-⦈ ==> b} gnd = Inr (⦇-⦈ , b , refl) notground {⦇-⦈ ==> ⦇-⦈} gnd = abort (gnd GHole) notground {⦇-⦈ ==> τ2 ==> τ3} gnd = Inr (⦇-⦈ , τ2 ==> τ3 , refl) notground {(τ1 ==> τ2) ==> b} gnd = Inr (τ1 ==> τ2 , b , refl) notground {(τ1 ==> τ2) ==> ⦇-⦈} gnd = Inr (τ1 ==> τ2 , ⦇-⦈ , refl) notground {(τ1 ==> τ2) ==> τ3 ==> τ4} gnd = Inr (τ1 ==> τ2 , τ3 ==> τ4 , refl)
State Before: α : Type u_2 β : Type u_1 γ : Type ?u.278636 ι : Type ?u.278639 inst✝⁴ : Countable ι m0 : MeasurableSpace α μ : Measure α f g : α → β inst✝³ : TopologicalSpace β inst✝² : Zero β inst✝¹ : SemilatticeSup β inst✝ : ContinuousSup β hf : FinStronglyMeasurable f μ hg : FinStronglyMeasurable g μ ⊢ FinStronglyMeasurable (f ⊔ g) μ State After: α : Type u_2 β : Type u_1 γ : Type ?u.278636 ι : Type ?u.278639 inst✝⁴ : Countable ι m0 : MeasurableSpace α μ : Measure α f g : α → β inst✝³ : TopologicalSpace β inst✝² : Zero β inst✝¹ : SemilatticeSup β inst✝ : ContinuousSup β hf : FinStronglyMeasurable f μ hg : FinStronglyMeasurable g μ n : ℕ ⊢ ↑↑μ (support ↑((fun n => FinStronglyMeasurable.approx hf n ⊔ FinStronglyMeasurable.approx hg n) n)) < ⊤ Tactic: refine' ⟨fun n => hf.approx n ⊔ hg.approx n, fun n => _, fun x => (hf.tendsto_approx x).sup_right_nhds (hg.tendsto_approx x)⟩ State Before: α : Type u_2 β : Type u_1 γ : Type ?u.278636 ι : Type ?u.278639 inst✝⁴ : Countable ι m0 : MeasurableSpace α μ : Measure α f g : α → β inst✝³ : TopologicalSpace β inst✝² : Zero β inst✝¹ : SemilatticeSup β inst✝ : ContinuousSup β hf : FinStronglyMeasurable f μ hg : FinStronglyMeasurable g μ n : ℕ ⊢ ↑↑μ (support ↑((fun n => FinStronglyMeasurable.approx hf n ⊔ FinStronglyMeasurable.approx hg n) n)) < ⊤ State After: α : Type u_2 β : Type u_1 γ : Type ?u.278636 ι : Type ?u.278639 inst✝⁴ : Countable ι m0 : MeasurableSpace α μ : Measure α f g : α → β inst✝³ : TopologicalSpace β inst✝² : Zero β inst✝¹ : SemilatticeSup β inst✝ : ContinuousSup β hf : FinStronglyMeasurable f μ hg : FinStronglyMeasurable g μ n : ℕ ⊢ ↑↑μ ((support fun x => ↑(FinStronglyMeasurable.approx hf n) x) ∪ support fun x => ↑(FinStronglyMeasurable.approx hg n) x) < ⊤ Tactic: refine' (measure_mono (support_sup _ _)).trans_lt _ State Before: α : Type u_2 β : Type u_1 γ : Type ?u.278636 ι : Type ?u.278639 inst✝⁴ : Countable ι m0 : MeasurableSpace α μ : Measure α f g : α → β inst✝³ : TopologicalSpace β inst✝² : Zero β inst✝¹ : SemilatticeSup β inst✝ : ContinuousSup β hf : FinStronglyMeasurable f μ hg : FinStronglyMeasurable g μ n : ℕ ⊢ ↑↑μ ((support fun x => ↑(FinStronglyMeasurable.approx hf n) x) ∪ support fun x => ↑(FinStronglyMeasurable.approx hg n) x) < ⊤ State After: no goals Tactic: exact measure_union_lt_top_iff.mpr ⟨hf.fin_support_approx n, hg.fin_support_approx n⟩
= Jack and Jill ( nursery rhyme ) =
\chapter[Structured Visual Model Learning]{Structured Dictionary Learning and Feature Encoding} \label{ch_groupsparse} \begin{singlespace*} \begin{abstract} \scriptsize{\textbf{Chapter abstract:} Sparse, redundant representations offer a powerful emerging model for signals and images \citep{Mairal2008,Yang2009}. This model approximates a data vector as a linear combination of a subset of basis elements from a learnt over-complete basis set. The combination is a sparse selection of basis elements. Sparsity is induced by adding a regularization constraint to the coefficients in the loss function. The degree of sparsity is typically determined empirically. A $\ell_{0}$ or $\ell_{1}$-norm is used to regularize the coefficients. This effective approach however considers each basis element individually. It does not utilize prior information of structure within the basis set and disregards possible groups of basis elements. In this chapter, sparse coding is augmented with structure learnt from co-clustering in terms of groups of semantically related basis elements. In the first part, a structured multiple manifold dictionary is learnt using co-clustered sub-spaces with Structured Sparse Principal Component Analysis (SSPCA) \citep{Jenatton2009}. It builds upon Sparse-PCA \citep{Zou2004} where the sparse selection of sub-spaces to represent a feature vector is independent of semantic significance of the selected sub-spaces. The second part deals with learning structured feature encoding. Typically, the Lasso which uses $\ell_{1}$-norm regularization is used for sparse selection of dictionary elements. To incorporate a prior structure, the group Lasso which uses $\ell_{2,1}$ mixed norm regularization \citep{zibulevsky2010} is used for sparse selection of groups of semantically related dictionary elements. Both structured sparse visual models are shown to improve performance over their corresponding regular sparse visual models. } \end{abstract} \end{singlespace*} \section[Introduction]{Introduction} \label{ch_groupsparse_sec_introduction} In this chapter, semantically relevant structure that was estimated in previous chapters is incorporated in learning a visual model. The method selected for this is sparse coding. Sparsity inducing algorithms for learning a visual model have enjoyed much success in recent years \citep{Yang2009}. They have the ability of simultaneous feature selection and model learning. One explanation for their notable performance is their ability to deal with intra-category appearance variation. Consider typical training feature data. It contains more elements than is required to represent any instance of any visual category. For example, the estimated intrinsic dimensionality of $128$-dimensional feature vectors is in the neighbourhood of $14$, based on the empirical results in \cref{ch_dictionary_subsec_intrinsicdimensionality}. The methods discussed in previous chapters first compute a single subset of all the sub-spaces. All the elements of this subset are subsequently used to represent every feature descriptor. However, a visual category consists of distinct parts, and each part spans a different subset of the basis set. A single subset can not satisfactorily accommodate the variation in appearance found in a visual category. In other words, regardless of the efficacy of the sub-space embedding technique, a single sub-manifold is inappropriate for all feature descriptors. A conceptual illustration of this is shown in \cref{fig:objectpartsubspace}. Different parts of the visual object `car' are embedded in different sub-manifolds due to their distinct local patch structure. A single sub-manifold can not account for all `car' parts. Sparsity inducing methods on the other hand, do not select a subset of basis elements a priori. A feature descriptor is assigned its own subset of basis elements. Although the cardinality of the subset in both, sparse coding and previously discussed methods may be the same, it is the ability for individual subset selection that makes sparse coding better suited to model intra-category appearance variation. \begin{figure} \centering \includegraphics[width=\textwidth]{./GroupSparse/figures/subspace.png} \caption[Conceptual illustration of relation between object part and descriptor sub-space]{Conceptual illustration of relation between object part and descriptor sub-space. Different parts of a `car' due to the local image structure are embedded in different sub-manifolds in feature space. A single sub-manifold can not satisfactorily model all three `car' parts.} \label{fig:objectpartsubspace} \end{figure} Stated formally, the aim of sparse coding is to find a set of basis vectors $\{ \mathbf{d}_{1}, \ldots, \mathbf{d}_{r} \}$ such that an input image $\mathbf{Z} \in \mathds{R}^{p \times n}$ can be represented as a linear combination of these basis vectors $\mathbf{Z} = \sum_{i=1}^{r} \alpha_{i} \mathbf{d}_{i}$. While techniques such as PCA learn a complete set of basis vectors efficiently, the aim is to learn an over-complete set of basis vectors to represent input images. The elements of an over-complete basis are better able to capture structures and patterns inherent in the input data. However, with an over-complete basis, the coefficients $\alpha_{i}$ are no longer uniquely determined by the input vector $\mathbf{Z}$. Therefore, in sparse coding, the additional criterion of sparsity is utilized to resolve the degeneracy introduced by over-completeness. In the experiments in previous chapters, a `universal' dictionary had been learnt from a corpus of all visual categories in a dataset\footnote{This choice of dictionary is in contrast to learning a `category specific' dictionary}. A universal dictionary is an over-complete dictionary, as it contains elements from multiple visual categories. The data matrix $\mathbf{Z} \in \mathds{R}^{p \times n}$ is factorized to dictionary matrix $\mathbf{D} \in \mathds{R}^{p \times r}$, and coefficient matrix $\mathbf{A} \in \mathds{R}^{p \times n}$, with a sparse regularization constraint $\Omega$ on the columns of the coefficient matrix. Sparse coding methods solve the following regularized problem \begin{equation} \label{eq:losssparsecoding} \min_{\alpha} \frac{1}{n} \sum_{i=1}^{n} L(\mathbf{z}_{i}, \mathbf{d} \alpha_{i}) + \lambda \Omega(\alpha) \end{equation} where $\lambda$ is a regularization parameter. The first term $\frac{1}{n} \sum_{i=1}^{n} L(\mathbf{z}_{i}, \mathbf{d} \alpha_{i})$ is called empirical risk or loss function. It is convex and continuously differentiable \citep{Jenatton2010}. Typical choices for $\Omega$ use the $\ell_{0}$-norm or $\ell_{1}$-norm. The regularized problem using the $\ell_{0}$-norm is \begin{equation} \label{eq:l0normloss} \min_{\alpha} \frac{1}{n} \sum_{i=1}^{n} \parallel \mathbf{z}_{i} - \mathbf{D} \alpha_{i} \parallel^{2} + \lambda \parallel \alpha_{i} \parallel_{0} \end{equation} The use of $\ell_{0}$-norm forces selection of a subset of fixed cardinality. While this is conceptually appealing, efficient regularization methods that use $\ell_{0}$-norm are difficult to implement. The $\ell_{1}$-norm regularization on the other hand has become a popular tool. It profits from efficient algorithms \citep{Efron2004, Lee2007, Yuen2009} and a well developed theory for generalization properties and variable selection consistency \citep{Shen2013, Zhang2009}. The regularization problem using the $\ell_{1}$-norm is \begin{equation} \label{eq:l1normloss} \min_{\alpha} \frac{1}{n} \sum_{i=1}^{n} \parallel \mathbf{z}_{i} - \mathbf{D} \alpha_{i} \parallel^{2} + \lambda \parallel \alpha_{i} \parallel_{1} \end{equation} Notwithstanding their notable performance, sparse coding methods have an issue. When regularizing by the $\ell_{1}$-norm, each variable is considered individually. The position of a variable in the input feature vector is disregarded. This means existing relationships and structures between the variables are ignored. However, using sparsity induction in learning a visual model could benefit from this type of prior knowledge. There are two reasons for including structural a priori information. One is improved predictive performance of the learnt model. The other is improved interpretability of the model. While the $\ell_{1}$-norm regularization succeeds in inducing sparsity, it does so without knowledge of the semantic relevance of the variables selected. Incorporating a priori structure can encourage the selection of variables with regard to their semantic relation to other variables. For example, in the field of face recognition, robustness to occlusions can be increased by incorporating structure. The features are considered as sets of pixels that form small convex regions on the face images \citep{Jenatton2010}. A simple $\ell_{1}$-norm regularization can not encode this specific spatial locality constraint \citep{Jenatton2010}. Another example in the field of computer vision is object and scene recognition, where a goal is the computation of bounding boxes in images \citep{Harzallah2009}. They are detected by modelling the spatial arrangement of the pixels over the images. An unstructured sparsity-inducing regularization that disregards this spatial information is therefore not necessarily able to segment the image with bounding boxes as it may be modelling a mixture of object feature with background contextual features. These examples motivate the need for sparsity-inducing regularization schemes, capable of encoding more sophisticated prior knowledge about the expected sparsity patterns. As mentioned above, the $\ell_{1}$-norm focuses only on cardinality and cannot easily specify information about the patterns of non-zero coefficients induced in the solution, since all non-zero patterns are theoretically possible. Group $\ell_{1}$-norms \citep{Yuan2006, Roth2008, Huang2009} consider a partition of all variables into a certain number of subsets and penalize the sum of the Euclidean norms of each one, leading to the selection of groups rather than individual variables. The consistency of group sparse method has been studied in \citep{Bach2008}. Combining the ideas of sparse models and group structure from co-clustering, is work on structured sparsity induced matrix factorization \citep{Kim2012}. At its heart is a $\ell_{q,1}$-mixed norm where $q \in \{2, \ldots, \infty \}$, where typically $q = 2$ \citep{Liu2008a}. It achieves sparsity at the group level, where data elements within a group are treated equally using the $\ell_{2}$-norm, while sparsity is induced upon entire groups using the $\ell_{1}$-norm. The group Lasso \citep{Bach2008} is the $\ell_{2,1}$-norm regularization equivalent of Lasso \citep{Tibshirani1994} for $\ell_{1}$-norm regularization. During matrix factorization the matrices within each group are orthogonal. In the previous chapter, co-clustering was utilized to estimate groups of sub-spaces and groups of dictionary elements. In this chapter, the estimated groups of sub-spaces are used in conjunction with structured sparse principal component analysis (SSPCA) to learn a group structured multiple-manifold dictionary, in \cref{ch_groupsparse_sec_manifold}. This dictionary is compared to a dictionary computed using regular sparse principal component analysis (SPCA). The empirical evaluation and results are described in \cref{ch_groupsparse_subsec_eval_structuremanifold}. The groups of dictionary elements are used with group Lasso to compute a group structured sparse encoding, in \cref{ch_groupsparse_sec_encoding}. The structured sparse encoding is empirically compared to regular sparse encoding in \cref{ch_groupsparse_subsec_eval_structuredencoding}. \subsection{Contributions} \label{ch_groupsparse_subsec_contributions} The principal contributions in this chapter are: \begin{itemize} \item Groups of sub-spaces estimated to be semantically related by co-clustering are used with SSPCA to learn a dictionary on semantically relevant multiple sub-manifolds. Unlike SPCA, the choice of subspaces is relevant since sparsity is induced on the selection of sub-manifolds rather than individual sub-spaces. This novel approach is empirically shown to provide performance benefits. \item Groups of dictionary elements estimated by co-clustering are used with group Lasso to learn structured encoding of images. The $\ell_{2,1}$ mixed norm regularization is used to induce sparsity in selection of groups of dictionary elements, rather than individual elements. The experiments show a small aggregate performance improvement over regular sparse coding. \end{itemize} \section[Structured Sub-manifold Dictionary]{Structured Sub-manifold Dictionary} \label{ch_groupsparse_sec_manifold} This section discusses learning a structured sub-manifold dictionary. First it describes learning a sparse sub-manifold dictionary using SPCA. Next groups of sub-spaces are used with SSPCA to compute a structured sparse sub-manifold dictionary. \subsection[Sparse Subspace Dictionary]{Sparse Subspace Dictionary} \label{ch_groupsparse_subsec_sparsepca} Classical PCA, which has been discussed in \cref{ch_dictionary_subsubsec_globallinear}, has two interpretations. Typically, it is viewed as a method for computing orthogonal directions maximizing the variance of the Eigenvectors. The Eigenvectors constitute the learnt basis set. This is viewing PCA as a tool for analysis. The other interpretation is to view it as a tool for synthesis, where PCA finds a basis, or orthogonal dictionary, such that the feature vectors admit decompositions with low reconstruction error. The point to note is that these two interpretations recover the same basis of principal components for PCA. Upon computing PCA, the next step is to reduce the basis set. The typical approach is to assign all basis elements below an arbitrary pre-specified threshold to zero. Motivated by the applicability of Lasso \citep{Tibshirani1994} for sparse selection, \citet{Zou2004} formulated PCA as a regression type optimization problem, where Lasso can be utilized as a regression criterion, so that the modified PCA encourages sparse selection. This modified PCA method is called Sparse-PCA (SPCA). Different formulations of SPCA have been proposed in \citep{Jolliffe2002, Zou2003, Aspremont2008}. The analysis and synthesis interpretations of SPCA have different formulations. Of interest here is the synthesis interpretation. It leads to non-convex global formulations which simultaneously estimate all principal components \citep{Mairal2010}. The key element of a sparse subspace dictionary learning technique using matrix factorization is the regularization term on the dictionary elements. For a training set of feature vectors $\{ \mathbf{z}_{1}, \ldots, \mathbf{z}_{n} \}$ in a matrix $\mathbf{Z} \in \mathds{R}^{p \times n}$, the matrix factorization routine for dictionary size $r$ computes a coefficient matrix $\mathbf{A} \in \mathds{R}^{n \times r}$ and dictionary $\mathbf{D} \in \mathds{R}^{p \times r}$. The dictionary matrix has $r$ columns which are the dictionary elements $\{\mathbf{D}^{(1)}, \ldots, \mathbf{D}^{(r)} \}$. The factorization aims to represent the columns of $\mathbf{Z}$ as a combination of the columns of $\mathbf{D}$, with minimum error and with sparse dictionary elements. Note that the regularization is not induced on the coefficient matrix $\mathbf{A}$, which would correspond to a sparse selection of dictionary elements to represent a feature vector $\mathbf{z}$. Regularization applied to $\mathbf{D}$ means that all dictionary elements are used to represent each feature vector, but that each dictionary element is individually encouraged to be sparse. The factorization is formulated as a convex optimization problem with regularization $\Omega_{\mathbf{D}}$ for the dictionary elements as \begin{equation} \min_{\mathbf{D}} \frac{1}{2} \parallel \mathbf{Z} - \mathbf{D} \mathbf{A} \parallel^{2} + \lambda \sum_{j=1}^{r} \Omega_{\mathbf{D}}(\mathbf{D}^{(j)}) \end{equation} The choice of $\Omega_{\mathbf{D}}$, based on \citep{Lee2007}, is the $\ell_{1}$-norm. \subsection[Structured Sparse Subspace Dictionary]{Structured Sparse Subspace Dictionary} \label{ch_groupsparse_subsec_structmultimanifolddict} This section discusses learning a structured sparse sub-manifold dictionary. It uses structured sparse principal component analysis (SSPCA), which is based on the use of structured regularization during selection of subspaces. Whereas classical regularization priors are concerned with cardinality of the selected subspaces, structured regularization incorporates higher level information. A conceptual illustration of this dictionary learning is shown in \cref{fig:sspcaconcept}. A feature vector $\mathbf{z} \in \mathds{R}^{8}$ is projected to a sub-manifold $\mathcal{S}_{PCA} \in \mathds{R}^{6}$ using PCA. The vector $\hat{\mathbf{z}}_{PCA}$ is not the true $\mathbf{z}$, which is embedded in some other sub-manifold of a different dimensionality than $\mathcal{S}_{PCA}$. SPCA is used to represent $\mathbf{z}$ using a $\mathds{R}^{3}$-dimensional sub-manifold in $\mathbf{R}^{6}$. While SPCA, is able to estimate the true dimensionality of $\mathbf{z}$, the sub-spaces that SPCA selects are not semantically relevant. SSPCA computes $\hat{\mathbf{z}}_{SSPCA}$ by representing $\mathbf{z}$ using a semantically relevant sub-manifold $\mathcal{S}_{SSPCA}$. The subspaces that constitute $\mathcal{S}_{SSPCA}$ are sparse and semantically relevant simultaneously. This allows $\hat{\mathbf{z}}_{SSPCA}$ to be the best estimate of the true $\mathbf{z}$. \begin{figure}[ht] \centering \includegraphics[width=\textwidth]{./GroupSparse/figures/sspcaConcept.png} \caption[Conceptual illustration of structure sparse sub-manifold dictionary]{Conceptual illustration of structure sparse sub-manifold dictionary. A feature vector $\mathbf{z} \in \mathds{R}^{8}$ is projected to a sub-manifold $\mathcal{S}_{PCA} \in \mathds{R}^{6}$ using PCA. The vector $\hat{\mathbf{z}}_{PCA}$ is not the true $\mathbf{z}$, which is embedded in some other sub-manifold of a different dimensionality than $\mathcal{S}_{PCA}$. SPCA is used to represent $\mathbf{z}$ using a $\mathds{R}^{3}$-dimensional sub-manifold in $\mathbf{R}^{6}$. While SPCA, is able to estimate the true dimensionality of $\mathbf{z}$, the sub-spaces that SPCA selects are not semantically relevant. Consequently, $\hat{\mathbf{z}}_{SPCA}$ is not the true $\mathbf{z}$. SSPCA computes $\hat{\mathbf{z}}_{SSPCA}$ by representing $\mathbf{z}$ using a semantically relevant sub-manifold $\mathcal{S}_{SSPCA}$. The subspaces that constitute $\mathcal{S}_{SSPCA}$ are sparse and semantically relevant simultaneously. This allows $\hat{\ mathbf{z}}_{SSPCA}$ to be the best estimate of the true $\mathbf{z}$.} \label{fig:sspcaconcept} \end{figure} Similar to the formulation of SPCA, $n$ feature vectors $\mathbf{z} \in \mathds{R}^{p}$ are utilized to compute the dictionary $\mathbf{D}$ of $r$ elements. The feature vectors are in matrix $\mathbf{Z} \in \mathds{R}^{p \times n}$. The empirical risk of a dictionary element $\mathbf{d} \in \mathds{R}^{p}$ for the $n$ feature vectors is $\frac{1}{n} \sum_{i=1}^{n} L(\mathbf{z}_{i}, \mathbf{d} \alpha_{i})$. Co-clustering is utilized to compute groups of subspaces $\mathcal{G}$, which was described in \cref{ch_coclustering_sec_groupingmanifolds}. The groups account for all the subspaces of the descriptor, so $\cup_{G \in \mathcal{G}} G = \{1, \ldots, p \}$. The regularization term $\Omega$ using this group structure, based on \citep{Jenatton2010}, is \begin{equation} \begin{array}{ll} \Omega(\mathbf{d}) &= \sum_{G \in \mathcal{G}} (\sum_{j \in G} (d_{j}^{G})^{2} |\mathbf{d}_{j}|^{2} )^{\frac{1}{2}} \\ &= \sum_{G \in \mathcal{G}} \parallel d^{G} \circ \mathbf{d} \parallel_{2} \end{array} \end{equation} where the term $(d^{G})_{G \in \mathcal{G}}$ serves as a indicator vector; a $|\mathcal{G}|$-tuple $p$-dimensional vector, such that $d_{j}^{G} > 0$ if $j \in G$ and $d_{j}^{G} = 0$ otherwise. The regularization problem is \begin{equation} \min \frac{1}{2} \parallel \mathbf{Z} - \mathbf{D} \mathbf{A} \parallel^{2} + \lambda \sum_{G \in \mathcal{G}} \parallel d^{G} \circ \mathbf{d} \parallel_{2} \end{equation} The regularization term $\Omega(\mathbf{d}) = \sum_{G \in \mathcal{G}} \parallel d^{G} \circ \mathbf{d} \parallel_{2}$ is a mixed $\ell_{2,1}$-norm \citep{Zhao2009}. At the group level, it functions like an $\ell_{1}$-norm and consequently $\Omega(\cdot)$ induces group sparsity. In other words, each $d^{G} \circ \mathbf{d}$ is encouraged to be zero. In contrast, within the groups $G \in \mathcal{G}$, the $\ell_{2}$-norm does not encourage sparsity. Intuitively, for a certain subset of groups $\mathcal{G}' \subseteq \mathcal{G}$, the vectors $\mathbf{d}_{G}$ associated with the groups $G \in \mathcal{G}'$ will be exactly equal to zero, leading to a set of zeros which is the union of these groups $\bigcup_{G \in \mathcal{G}'} G$. The set of allowed zero patterns should be the union-closure of $\mathcal{G}$: $\mathcal{Z} = \{ \cup_{G \in \mathcal{G}'} G \mbox{ ; } \mathcal{G}' \subseteq \mathcal{G} \}$. The complementary non-zero patterns are : $\mathcal{P} = \{ \cap_{G \in \mathcal{G}'} G^{c} \mbox{ ; } \ mathcal{G}' \subseteq \mathcal{G} \}$. \subsection[Evaluating Structured Subspace Dictionary]{Evaluating Structured Sparse Subspace Dictionary} \label{ch_groupsparse_subsec_eval_structuremanifold} In the experiments in this section, the datasets used are VOC-2006, VOC-2007. The image feature descriptor used is dense-SIFT. In the dense sampling, the descriptor patch size was $8 \times 8$ pixels with a step size of $4$ pixels. All the images were converted to grey scale. The implementation of SIFT in \citep{Vedaldi2008} was used. Similar to the experiments in previous chapters, the training and test set were the train and validation set provided for VOC-2006, and VOC-2007 in \citep{pascalvoc2006}, and \citep{pascalvoc2007} respectively. A random sample of size $100000$ feature vectors is collated from the images in the training set. It is used to compute co-clusters using information-theoretic co-clustering and sum-squared residue co-clustering. The number of groups in this experiment is $50$. The estimated groups are utilized as a priori structure for the group regularization term in SSPCA. The dictionary size is $1000$, which is in keeping with previous experiments. The sparse subspace dictionary uses the $\ell_{1}$-norm regularization while the structured sparse subspace dictionary uses the mixed $\ell_{2,1}$-norm regularization. The implementation of SPCA and SSPCA is based on \citep{Jenatton2009}. The optimization routine is run for a maximum of $1000$ iterations. The regularization parameter is $\lambda = 10^{-8}$. The stopping criterion for change in error is empirically determined to be $10^{-12}$. The optimization follows an alternative scheme between the dictionary and the coefficient matrices, optimizing each in turn while the other remains fixed. The number of iterations for each matrix is $5$. Similar to previous experiments, the SVM classifier with RBF kernel is used in this experiment. The graphs show the performance, in terms of mAP of classification for each category in each of the datasets. The results show that the structured sparse sub-manifold dictionary is better than the regular sparse sub-manifold dictionary for a majority, but not all, of the categories in each of the datasets.The results for VOC-2006 using ITCC is reported in \cref{fig:sspca2006i}, where the structured sparse dictionary performs better for $6$ of the $10$ categories. Results using SSRCC is reported in \cref{fig:sspca2006r}, where the structured sparse dictionary performs better for $5$ categories. Similarly, the results for VOC-2007 using ITCC is shown in \cref{fig:sspca2007i}, where structured sparse dictionary is better for $14$ of $20$ categories. In the results using SSRCC is shown in \cref{fig:sspca2007r}, the structured sparse dictionary is better for $10$ categories. The variation in performance between categories is indicative of the inherent difference in difficulty of the categories. In addition, the number of groups of sub-spaces is the same for all categories, which contributes to the performance variation. In view of the inherent difference between categories, the number of groups should be tuned to be specific to each category. \begin{figure} \centering \includegraphics[width=.7\textwidth]{./GroupSparse/figures/sspca5050categoryVOC2006i-crop.pdf} \caption[Comparison of Sparse Subspace and ITCC Structured Sparse Subspace dictionaries using VOC-2006 dataset]{Comparative performance of Sparse Subspace and Structured Sparse Subspace dictionaries, for visual categories of VOC 2006 dataset. The graph shows the classification score measured as mAP for visual categories. The structure here is estimated using ITCC. The number of groups is $50$.} \label{fig:sspca2006i} \end{figure} \begin{figure} \centering \includegraphics[width=.7\textwidth]{./GroupSparse/figures/sspca5050categoryVOC2006r-crop.pdf} \caption[Comparison of Sparse Subspace and SSRCC Structured Sparse dictionaries using VOC-2006 dataset]{Comparative performance of Sparse Subspace and Structured Sparse Sub-manifold dictionaries, for visual categories of VOC 2006 dataset. The graph shows the classification score measured as mAP for visual categories. The structure here is estimated using SSRCC. The number of groups is $50$.} \label{fig:sspca2006r} \end{figure} \begin{figure} \centering \includegraphics[width=.8\textwidth]{./GroupSparse/figures/sspca5050categoryVOC2007i-crop.pdf} \caption[Comparison of Sparse Subspace and ITCC Structured Sparse Subspace dictionaries using VOC-2007 dataset]{Comparative performance of Sparse Subspace and Structured Sparse Sub-manifold dictionaries, for visual categories of VOC 2007 dataset. The graph shows the classification score measured as mAP for visual categories. The structure here is estimated using ITCC. The number of groups is $50$.} \label{fig:sspca2007i} \end{figure} \begin{figure} \centering \includegraphics[width=.8\textwidth]{./GroupSparse/figures/sspca5050categoryVOC2007r-crop.pdf} \caption[Comparison of Sparse Subspace and SSRCC Structured Sparse Subspace dictionaries using VOC-2007 dataset]{Comparative performance of Sparse Subspace and Structured Sparse Subspace dictionaries, for visual categories of VOC 2007 dataset. The graph shows the classification score measured as mAP for visual categories. The structure here is estimated using SSRCC. The number of groups is $50$.} \label{fig:sspca2007r} \end{figure} \subsubsection{Aggregate performance across datasets} To analyse the comparative performance of the sparse and structured sparse sub-manifold dictionaries, the aggregate classification performance across datasets is computed. The aggregate performance of each dataset is the mean of the classification score for all the categories in that dataset. This experimental setup is the same as the previous experiment. The number of groups of subspaces is $50$. The results for the VOC-2006 and VOC-2007 datasets is shown in \cref{tab:sspcaDataset}. The table shows the mean classification performance over all categories in each of VOC2006 and VOC2007 datasets. The results of structured sparse subspace dictionary using both ITCC and SSRCC is reported. The best performance for each dataset is shown in bold text. The structure sparse subspace dictionary provides a better result for both the datasets. However, for VOC2006 ITCC is comparatively better than SSRCC, whereas for VOC2007 the converse is true. The results are interesting first in that they show structure sparse dictionary has succeeded in incorporating semantic structure into the sub-manifolds and performed better than regular sparse subspace dictionary, and second in that the co-clustering method has a different performance for different datasets. This result emphasizes the need to use a semantic structure estimation technique that is tailored to the data distribution characteristic of a dataset. This thesis considered the K-L divergence (ITCC) and Euclidean divergence (SSRCC), but there are several popular divergences in the family of Bregman divergences that could be better alternatives. Further exploration of the family of Bregman divergences and associated co-clustering technique is left for future work. \begin{table}[htbp] \centering \renewcommand{\arraystretch}{1.5} \begin{tabular}{|l|r|c|r|} \hline & \multicolumn{1}{c|}{Sparse Subspace} & \multicolumn{ 2}{c|}{Structured Sparse Subspace} \\ \hline \multicolumn{1}{|c|}{\textit{Data Set}} & \multicolumn{1}{l|}{} & \textit{ITCC} & \multicolumn{1}{c|}{\textit{SSRCC}} \\ \hline VOC2006 & 67.5941 & \multicolumn{1}{r|}{\textbf{70.8295}} & 68.5808 \\ \hline VOC2007 & 67.9971 & \multicolumn{1}{r|}{68.0783} & \textbf{68.3718} \\ \hline \end{tabular} \caption[Aggregate classification performance of Sparse Subspace and Structured Sparse Subspace dictionaries for VOC2006 and VOC2007 datasets.]{Aggregate classification performance of Sparse Subspace and Structured Sparse Subspace dictionaries for VOC2006 and VOC2007 datasets. The table shows the mean classification performance over all categories in each of VOC2006 and VOC2007 datasets. The results of structured sparse subspace dictionary using both ITCC and SSRCC is reported. The best performance for each dataset is shown in bold text.} \label{tab:sspcaDataset} \end{table} \section[Structured Sparse Encoding]{Structured Sparse Encoding} \label{ch_groupsparse_sec_encoding} There are two key insights that motivate the development of structured sparse encoding. The experiments in \cref{ch_coclustering_sec_structdictionary} indicated the existence of structure in the dictionary, in terms of groups of semantically related dictionary elements. The second insight is that feature vector distribution is idiomatic to a visual category. The experiments in \cref{ch_coclustering_subsubsec_evalmssdict} and \cref{ch_coclustering_subsubsec_evalstructdict} indicate that feature vectors associated with a visual category are predominantly located in a group of disjoint regions of feature space. To model such a distribution requires a parsimonious encoding scheme that can learn to represent an image using the appropriate disjoint regions only. Sparse coding methods can potentially achieve this model, provided the number of related disjoint partitions are known a priori and these appropriate partitions are selected. Sparsity is induced by use of a regularization constraint on the learnt coefficients. The choice of regularization scheme is important for the type of sparsity achieved, which is elaborated upon in \cref{ch_groupsparse_subsec_Lasso}. Notwithstanding the success of sparse regularization methods, there is an unresolved issue. Sparse models succeed in selecting the appropriate number of dictionary elements, but minimization of the loss function alone is not sufficient to guarantee selection of the appropriate subset of dictionary elements. In addition, the result of the optimization is unstable, since a small perturbation in the optimization routine could yield a different subset of dictionary elements for the representation of the same image. The reason for this issue is that these methods treat each dictionary element individually, so existing relationships and structures between these dictionary elements is disregarded. In order to reduce the instability in the selection, a potential solution is grouping dictionary elements. An appropriate grouping would consist of semantically related dictionary elements. This encourages the representation of an image using only those dictionary elements that are semantically relevant for that image. The method to achieve this structured selection of dictionary elements is discussed in \cref{ch_groupsparse_groupsparsecoding}, following an overview of regular sparse coding. \subsection[Sparse Coding]{Sparse Coding} \label{ch_groupsparse_subsec_Lasso} Based on \citep{Aharon2006}, for training feature vectors $\mathbf{Z} \in \mathds{R}^{p \times n}$, sparse coding with the $\ell_{1}$-norm solves the problem \begin{equation} \label{eq:l1lossfn} \min_{\alpha \in \mathds{R}^{p}} \parallel \mathbf{Z} - \mathbf{D} \mathbf{A} \parallel^{2} + \lambda \parallel \mathbf{A} \parallel_{1} \end{equation} where $\lambda$ is a regularization parameter. During dictionary learning this is a joint optimization problem with respect to dictionary $\mathbf{D}$ and the sparse coefficients $\mathbf{A} = \{\alpha^{1}, \ldots, \alpha^{r} \} \in \mathds{R}^{p \times r}$. To prevent $\mathbf{D}$ from attaining arbitrarily large values, the columns of $\mathbf{D}$ are constrained to have an $\ell_{2}$-norm less than a specified threshold - typically $\parallel \mathbf{d} \parallel_{2} \leq 1$. The canonical strategy for the joint optimization is to alternate between the two variables; keeping one fixed while minimizing the other. The regularization problem in \cref{eq:l1lossfn} is solved to compute a dictionary matrix $\mathbf{D}$ or coefficient matrix $\mathbf{A}$. When learning a visual model, sparse coding is typically used to first compute a dictionary, where $\mathbf{Z}$ is random sample of training descriptors for the dataset \citep{Rigamonti2011, Donoho2003}. The learnt dictionary is used next to compute encoded representations of an image by computing $\mathbf{A}$, where $\mathbf{Z}$ is set of descriptors from that image \citep{Guillermo2010, Coates2011, Kreutz-Delgado2003a}. $\lambda$ is a non-negative parameter controlling the trade-off between data fitting and regularization \citep{Lee2009}. A typical convex formulation is the $\ell_{1}$-decomposition problem \citep{Donoho2003}, also known as the Lasso \citep{Tibshirani1994}: \begin{equation} min_{\alpha \in \mathds{R}^{p}} \frac{1}{2} \sum_{i=1}^{n} \parallel \mathbf{z}_{i} - \mathbf{D} \alpha \parallel^{2}_{2} + \Omega(\alpha) \end{equation} When the value of $\lambda$ is large, $\alpha$ is known to be sparse, and only a few dictionary elements are involved. Although the use of $\ell_{1}$-norm is predominant, a natural choice would be to take the $\ell_{0}$ pseudo-norm that counts the number of non-zero coefficients in $\alpha$. Conceptually, an image should be represented by a subset of the dictionary elements. In other words, those dictionary elements that do not pertain to a visual category should not be involved in the representation of the coefficient matrix $\mathbf{A}$. However, solving the equation above in this setting is often intractable, such that one has either to look for an approximate solution using a greedy algorithm, or resort to a convex relaxation \citep{Gregor2010}. A method closely related to Lasso was proposed by \citet{Efron2004} called Least Angle Regression Selection (LARS). Both these methods operate in two stages. The first step is to build a solution path indexed by a certain tuning parameter. In the next step the model is selected on the solution path by either cross-validation or use of some criterion. The solution paths for both Lasso and LARS are shown in \citep{Efron2004} to be piecewise linear, which renders them computationally efficient. A comparative analysis of this was provided by \citet{Rosset2007}. \subsection[Group Sparse Coding]{Group Sparse Coding} \label{ch_groupsparse_groupsparsecoding} There are a couple of issues with the Lasso and LARS methods. Although they have excellent performance and computational efficiency, they are designed for selecting individual dictionary elements. They can not be utilized for general factor selection in \cref{eq:l1lossfn}. In other words they are transparent to structure in the dictionary. So, they tend to make selections based on the strength of individual derived dictionary element rather than the strength of groups of dictionary elements (or topics), often resulting in selecting more factors than necessary. Another drawback of using the Lasso and LARS in \cref{eq:l1lossfn} is the dependency of the solution upon how the factors are orthogonalised. This is undesirable since the solution to a factor selection and estimation problem should not depend on how the factors are represented \citep{Yuan2006}. Evidently these methods require an extension that considers the dictionary elements with a pre-defined structure. The group Lasso and group LARS \citep{ Yuan2006, Bach2008} are popular choices for this extension. In a nutshell, the dictionary elements are assumed to be clustered in groups, and instead of summing the absolute values of each individual coefficient, the sum of Euclidean norms of the coefficients in each group is used. Intuitively, this should drive all the coefficients in one group to zero together, and thus lead to group selection \citep{Yuan2006}. In other words, the group Lasso essentially replaces groups of size one by groups of size larger than one. Following from \cref{ch_groupsparse_subsec_Lasso} and based on \citep{Yuan2006}, the loss function for group Lasso augments \cref{eq:l1lossfn} with the additional inclusion of group information of the dictionary elements. The feature vectors $\{\mathbf{z}_{1}, \ldots, \mathbf{z}_{n}\}$ are in matrix $\mathbf{Z} \in \mathds{R}^{p \times n}$. A dictionary $\mathbf{D} \in \mathds{R}^{p \times r}$ for size $r$ has been learnt by one of the techniques discussed in \cref{ch_encoding_sec_dictionarylearning}. The elements of $\mathbf{D}$ are grouped into $k$ groups, using co-clustering as discussed in \cref{ch_coclustering_subsec_approach}. The number of elements in each group are $\{t_{1}, \ldots, t_{k} \}$, where $\sum_{i=1}^{k} t_{i} = r$. As in previous section, the coefficient matrix is $\mathbf{A} \in \mathds{R}^{r \times n}$. Consider positive definite matrices $\{K_{1}, \ldots, K_{k} \}$ corresponding to the $k$ groups in the dictionary. For feature vectors $\mathbf{Z}$, dictionary $\mathbf{D}$, and coefficients $\mathbf{A}$, group Lasso solves the regularization problem \begin{equation} \label{eq:lossgroupLasso} \min \frac{1}{2} \parallel \mathbf{Z} - \sum_{j=1}^{k} \mathbf{D}_{j} \mathbf{A}_{j} \parallel_{2}^{2} + \lambda \sum_{j=1}^{k} \parallel \mathbf{A}_{j} \parallel_{K_{j}} \end{equation} Adopting a similar formulation to \citep{Lin2006}, $\mathbf{D}_{j}$ and $K_{j}$ are chosen respectively to be the group of dictionary elements and the reproducing kernel of the functional space induced by the $j^{th}$ group. Note that \cref{eq:lossgroupLasso} does have a degenerate expression as Lasso in \cref{eq:l1lossfn} when all the groups contain a single dictionary element, so the cardinality of each topic is one, i.e. $t_{j} = 1 \forall j \in \llbracket1 ; k \rrbracket$. The regularization constraint here lies between $\ell_{1}$, corresponding to Lasso, and $\ell_{2}$, corresponding to ridge regression. To visualize this consider \cref{fig:groupLasso}, which shows the geometric representation of the group regularization term $\Omega = \sum_{j=1}^{k} \parallel \mathbf{A}_{j} \parallel_{K_{j}}$. As an illustrative example, consider the case where there are two groups, $k = 2$. The corresponding coefficients are $\mathbf{A}_{1}$ and $\mathbf{A}_{2} = (\mathbf{A}_{11},\mathbf{A}_{12})^{T}$. In \cref{fig:groupLasso} the double pyramid shaped structure in \textit{(a)} corresponds to $\ell_{1}$-norm, so $|\mathbf{A}_{1}| + |\mathbf{A}_{21}|+ |\mathbf{A}_{22}| = 1$, which is the Lasso regression. The sphere shaped structure in \textit{(c)} corresponds to $\ell_{2}$-norm, so $\parallel (\mathbf{A}_{1}, \mathbf{A}_{2}) \parallel = 1$, which is the ridge regression. The bi-cone shaped structure in \textit{(b)} corresponds to $\ell_{2,1}$-norm, so $ |\mathbf{A}_{1}| + \parallel \mathbf{A}_{2} \parallel = 1$, which is the group Lasso. The $\ell_{1}$ considers the coefficients individually and induces sparsity in them separately. The $\ell_{2}$-norm also considers the coefficients equally, but does not encourage sparsity. In contrast to both of these norms, the essence of $\ell_{2,1}$-norm is evident in the bi-conic geometric structure. The coefficients $\mathbf{A}_{21}$ and $\mathbf{A}_{22}$ are treated equally with $\ell_{2}$-norm applied within the group. The $\ell_{1}$-norm is used between the two groups. In other words, sparsity will be induced on $\mathbf{A}_{1}$ or the pair $(\mathbf{A}_{21},\mathbf{A}_{22})$. \begin{figure} \centering \includegraphics[width=\textwidth]{./GroupSparse/figures/grouplasso1.png} \caption[Pictorial representation of sparse regularization]{Pictorial representation of $\Omega = \sum_{j=1}^{k} \parallel \mathbf{A}_{j} \parallel_{K_{j}}$. In this example there are $k = 2$ groups of coefficients $\mathbf{A}_{1}$ and $\mathbf{A}_{2}$. \textit{(a)} $\ell_{1}$-norm and Lasso regression, where $|\mathbf{A}_{1}| + |\mathbf{A}_{21}|+ |\mathbf{A}_{22}| = 1$. \textit{(b)} $\ell_{2,1}$-norm and group Lasso regression, where $ |\mathbf{A}_{1}| + \parallel \mathbf{A}_{2} \parallel = 1$. \textit{(c)} $\ell_{2}$-norm and ridge regression, where $\parallel (\mathbf{A}_{1}, \mathbf{A}_{2}) \parallel = 1$.} \label{fig:groupLasso} \end{figure} \subsection[Evaluating Structured Encoding]{Evaluating Structured Sparse Encoding} \label{ch_groupsparse_subsec_eval_structuredencoding} \begin{figure} \centering \includegraphics[width=0.7\textwidth]{./GroupSparse/figures/grouplasso1l2Scene15i-crop.pdf} \caption[Comparison of sparse and ITCC structured sparse coding using Scene-15 dataset]{Comparative performance of Sparse Encoding and Structured Sparse Encoding, for visual categories of Scene-15 dataset. The graph shows the classification score measured as mAP for visual categories. The structure here is estimated using information theoretic co-clustering. The number of groups is $100$ from a $1000$ element dictionary.} \label{fig:groupLassoScene15i} \end{figure} \begin{figure} \centering \includegraphics[width=0.7\textwidth]{./GroupSparse/figures/grouplasso1l2Scene15r-crop.pdf} \caption[Comparison of sparse and SSRCC structured sparse coding using Scene-15 dataset]{Comparative performance of Sparse Encoding and Structured Sparse Encoding, for visual categories of Scene-15 dataset. The graph shows the classification score measured as mAP for visual categories. The structure here is estimated using sum-squared residue co-clustering. The number of groups is $100$ from a $1000$ element dictionary.} \label{fig:groupLassoScene15r} \end{figure} In this experiment the Scene-15 dataset is used. Dense SIFT feature descriptors are generated following the procedure described in the previous experiment. A random sample of $100000$ feature vectors from all the images in the training set of every visual category for each dataset is used here. It is used to compute a dictionary of size $1000$, using k-means which is run for a maximum of $100$ iterations. In order to compare the sparse and structured sparse encoding schemes the choice of dictionary is based on the objective of not biasing the dictionary towards either of the encoding methods. The information-theoretic and sum-squared residue co-clustering methods are used to estimate topics of size $100$. The procedure for using co-clustering has been described in the experiments in \cref{ch_coclustering}. Sparse encoding uses the Lasso while the structured sparse uses the group Lasso. The choice of regularization parameter is $\lambda = 0.1$, based on preliminary analysis of an appropriate $\lambda$ for the data used in this experiment. The optimization routine is run for a maximum of $200$ iterations for encoding each image in the training and test sets. The choice of iterations here was based on the dual objective of allowing convergences a satisfactory encoded representation and curtailing the total time required to encode thousands of training and test images. The classifier used is a SVM with RBF kernel and the performance is reported as mAP. \begin{figure} \centering \includegraphics[width=0.7\textwidth]{./GroupSparse/figures/grouplasso1l2VOC2006i-crop.pdf} \caption[Comparison of sparse and ITCC structured sparse coding using VOC-2006 dataset]{Comparative performance of Sparse Encoding and Structured Sparse Encoding, for visual categories of VOC-2006 dataset. The graph shows the classification score measured as mAP for visual categories. The structure here is estimated using information theoretic co-clustering. The number of groups is $100$ from a $1000$ element dictionary.} \label{fig:groupLassoVOC2006i} \end{figure} \begin{figure} \centering \includegraphics[width=0.7\textwidth]{./GroupSparse/figures/grouplasso1l2VOC2006r-crop.pdf} \caption[Comparison of sparse and SSRCC structured sparse coding using VOC-2006 dataset]{Comparative performance of Sparse Encoding and Structured Sparse Encoding, for visual categories of VOC-2006 dataset. The graph shows the classification score measured as mAP for visual categories. The structure here is estimated using sum-squared residue co-clustering. The number of groups is $100$ from a $1000$ element dictionary.} \label{fig:groupLassoVOC2006r} \end{figure} \begin{table}[htbp] \centering \renewcommand{\arraystretch}{1.6} \begin{tabular}{|l|r|c|r|} \hline & \multicolumn{1}{c|}{Sparse Encoding} & \multicolumn{ 2}{c|}{Structured Sparse Encoding} \\ \hline \multicolumn{1}{|c|}{\textit{Data Set}} & \multicolumn{1}{l|}{} & \textit{ITCC} & \multicolumn{1}{c|}{\textit{SSRCC}} \\ \hline VOC-2006 & 72.8386 & \multicolumn{1}{r|}{\textbf{73.3977}} & 72.7738 \\ \hline Scene-15 & 68.5737 & \multicolumn{1}{r|}{\textbf{79.8794}} & 72.1155 \\ \hline \end{tabular} \caption[Aggregate classification performance of sparse encoding and structured sparse encoding for the VOC-2006 and Scene-15 datasets]{Aggregate classification performance of sparse encoding and structured sparse encoding for the VOC-2006 and Scene-15 datasets. The best performance for both datasets is shown in bold text. Structured sparse encoding using ITCC topic dictionary has the best comparative performance.} \label{tab:structsparseencoding} \end{table} The results for Scene-15 dataset using information-theoretic co-clustering and sum-squared residue co-clustering are reported in \cref{fig:groupLassoScene15i} and \cref{fig:groupLassoScene15r} respectively. Structured sparse encoding performs better for $14$ of $15$ categories using ITCC and $11$ of $15$ categories using SSRCC. Similarly, the results for VOC-2006 dataset using ITCC and SSRCC are reported in \cref{fig:groupLassoVOC2006i} and \cref{fig:groupLassoVOC2006r} respectively, where ITCC performs better for $6$ of $10$ categories and SSRCC performs better for $6$ of $10$ categories. With regards to the VOC-2006 dataset, structured sparse encoding has a performance comparable to regular sparse encoding. It is better for six of the ten categories in the dataset for both ITCC and SSRCC. For the Scene-15 dataset, the structured sparse encoding method has a better performance in comparison to sparse encoding for almost all of the categories. This is an encouraging result for structured learning. The aggregate performance for all categories in the dataset is reported in \cref{tab:structsparseencoding} to compare between the co-clustering methods. This is a positive result for structured sparse encoding, as the aggregate classification performance using ITCC is the best for both datasets. These results can be interpreted as an encouraging outcome for structured learning algorithms. It should be noted that performance of structured sparse encoding depends upon several factors, including the $\ell_{1,2}$-norm regularization, the quality of the estimated groups of dictionary elements, the clustering algorithm which partitioned feature space. The $\ell_{1,2}$-norm is only one of the family of $\ell_{1,q}$-norm that could be used for enforcing group sparsity. It remains to be found if some value of $q$ other than $2$ may yield a better structured encoding. Another aspect is the dictionary size, which was kept the same across datasets. Since different datasets have different visual content, it is reasonable to expect that the appropriate dictionary size for different datasets would be different. This is one contributing factor for difference between the VOC-2006 and Scene-15 datasets. \section[Summary]{Summary} \label{ch_groupsparse_sec_summary} In this chapter, semantically related groups of basis elements estimated by co-clustering were used to augment sparsity inducing visual models with a priori semantic information. The goal of the structured sparse subspace dictionary was to successfully incorporate the groups of subspaces estimated by the co-clustering methods to produce a dictionary that performs better than a sparse subspace dictionary without a priori structural information. The comparative performance for multiple VOC datasets in the experiments in \cref{ch_groupsparse_subsec_eval_structuremanifold} indicate that the goal has been achieved. There are some visual categories where the performance of SPCA is better. However, this result is expected in view of the significant difference between the categories in terms of inherent complexity and availability of training data to learn these complexities equally for all categories. The aim of structured sparse encoding was to leverage the groups of dictionary elements estimated by co-clustering to encourage sparsity in the encoding of images in terms of semantically relevant topics rather than individual words. It was compared to sparse coding using $\ell_{1}$-norm, which is an excellent performing scheme. In the experiments in \cref{ch_groupsparse_subsec_eval_structuredencoding} the performance of the structured sparse encoding is marginally better than regular sparse coding when considering aggregate performance. Amongst the visual categories the comparative performance is not entirely conclusive. It should be noted that the performance of structured sparse model depends upon: the size of the dictionary and its ability to appropriately partition feature space; the presence of semantically distinct groups; and the efficacy of the co-clustering approach in estimating these groups. The presence of distinct groups is a weak hypothesis in view of the available weakly labelled data and relatively small training data. Therefore the results of the experiments on group structured dictionary should be considered as indicative, rather than conclusive evidence for this approach. In the results, the performance of each category is different from other categories regardless of the method used. This suggests an inherent difference in complexity associated with each category. Of course this is not an unexpected result. One contributing factor is the tradition in the community to use the same number of training images for all categories. It is reasonable to assume that categories with a comparatively higher degree of complexity will require more training images. The number of training images has a strong bearing on the performance that can be expected from a method designed to estimate semantically relevant structure. There should be sufficient training images that span the variation in appearance in a category to allow a learning method that opportunity to learn the semantic structure. Therefore the margin of improvement of structured sparse visual model over regular sparse visual model could be attributed to lack of sufficient training data. This possibility does not itself qualify structured learning. Nevertheless the results of the experiments in \cref{ch_coclustering} and in \cref{ch_groupsparse} demonstrate that the methods here have succeeded in estimating semantic structure.
\section{Parameters Summary}\label{app:parameters} All the parameters used in this manuscript alongside their explanation are given by Table~\ref{table:parameters_summary}. \begin{table}[!htbp] \begin{center} \resizebox{.7\textwidth}{!}{ \begin{tabular}{ll} \toprule Feature & Explanation \\ \midrule SSE & A measure of how far a strategy is from extortionate behaviour defined in~\cite{Knight2019}. \\ $C_{\text{max}}$ & The biggest cooperating rate in the tournament. \\ $C_{\text{min}}$ & The smallest cooperating rate in the tournament. \\ $C_{\text{median}}$ & The median cooperating rate in the tournament. \\ $C_{\text{mean}}$ & The mean cooperating rate in the tournament. \\ $C_r$ / $C_{\text{max}}$ & A strategy's cooperating rate divided by the maximum cooperating rate in the tournament. \\ $C_{\text{min}}$ / $C_r$ & The minimum in the tournament divided by a strategy's cooperating rate. \\ $C_r$ / $C_{\text{median}}$ & A strategy's cooperating rate divided by the median cooperating rate in the tournament. \\ $C_r$ / $C_{\text{mean}}$ & A strategy's cooperating rate divided by the mean cooperating rate in the tournament. \\ $C_r$ & The cooperating rate of a strategy. \\ $CC$ to $C$ rate & The probability a strategy will cooperate after a mutual cooperation. \\ $CD$ to $C$ rate & The probability a strategy will cooperate after being betrayed by the opponent. \\ $DC$ to $C$ rate & The probability a strategy will cooperate after betraying the opponent. \\ $DD$ to $C$ rate & The probability a strategy will cooperate after a mutual defection. \\ $p_n$ & The probability of a player's action being flipped at each interaction. \\ $n$ & The number of turns in a match. \\ $p_e$ & The probability of a match ending in the next turn. \\ $N$ & The number of strategies in the tournament. \\ $k$ & The number that a given tournament is repeated. \\ \bottomrule \end{tabular}} \end{center} \caption{The features which are included in the performance evaluation analysis.}\label{table:parameters_summary} \end{table}
= BRIX11 environment command == Collection common == Usage brix11 environment [options] === options -A, --all Specifies to print all environment variables. Default: print only BRIX11 specific environment -f, --file=FILE Specifies filename to write environment settings to. Default: print to console --force Force all tasks to run even if their dependencies do not require them to. Default: off -v, --verbose Run with increased verbosity level. Repeat to increase more. Default: 0 -h, --help Show this help message. == Description Prints the (additionally) required environment settings needed to run the development tools for X11 development. This command will only output those settings that were added by BRIX11 to the existing environment in which BRIX11 is executed. The settings are printed in command form such that the command output can be used to update the environment to be able to run X11 development tools outside BRIX11. This is useful for advanced users that need to go beyond the offered functionality of BRIX11. The output is (OS) platform specific. == Example $ brix11 env Prints the required environment settings to the console. $ brix11 env > myenv Writes the required environment settings to the file ./myenv. $ `brix11 env` In a Unix shell performs command expansion and executes the printed environment setting commands thereby updating the settings of the current shell. Alternatively the form '$(brix11 env)' could be used.
Load LFindLoad. From lfind Require Import LFind. From QuickChick Require Import QuickChick. From adtind Require Import goal33. Derive Show for natural. Derive Arbitrary for natural. Instance Dec_Eq_natural : Dec_Eq natural. Proof. dec_eq. Qed. Lemma conj19eqsynthconj4 : forall (lv0 : natural) (lv1 : natural) (lv2 : natural), (@eq natural (plus lv0 (mult lv1 lv2)) (plus lv0 (mult lv2 lv1))). Admitted. QuickChick conj19eqsynthconj4.
% % %CopyrightBegin% % % Copyright Ericsson AB 2017. All Rights Reserved. % % 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. % % %CopyrightEnd% % \chapter{Types and terms} \label{chapter:types-terms} \section{Types in \Erlang} \Erlang\ is a \emph{dynamically typed} language, which means that the type of a variable or expression generally cannot be determined at compile time. The dynamic typing offers a high degree of flexibility in that a variable can take on, for example, an integer in one invocation but a list in another invocation. This corresponds to having union types in a statically typed language. Some of the advantages of polymorphic static typing can be achieved also for well-structured \Erlang\ programs by adding type declarations and type analysis \cite{erltc}. Every \Erlang\ term belongs to exactly one of the types below. The types in \Erlang\ can be divided into \emph{elementary types} and \emph{compound types}. A term of an elementary type never properly contains an arbitrary \Erlang\ term and is said to be an \emph{elementary term}. A term of a compound type is said to be a \emph{compound term} and has a number of \emph{immediate subterms}\index{subterm!immediate}. \index{type!elementary|(} \index{term!elementary|(} The elementary types in \Erlang\ are: %\S\ref{section:new-records} \begin{itemize} \item Atoms (\S\ref{section:atoms}). \ifStd \item Characters (\S\ref{section:chars}). \fi \item Numbers (integers and floats) (\S\ref{section:numbers}). \item Refs (\S\ref{section:refs}). \item Binaries (\S\ref{section:binaries}). \ifStd \item Functions (\S\ref{section:functions}). \fi \item Process identifiers (\S\ref{section:pids}). \item Ports (\S\ref{section:ports}). \end{itemize} \index{type!elementary|)} \index{term!elementary|)} \index{type!compound|(} \index{term!compound|(} The compound types in \Erlang\ are: \begin{itemize} \item Tuples (\S\ref{section:tuples}). \item Lists and conses (\S\ref{section:lists}). \ifstruct \item Structs (\S\ref{section:structs}). \fi \end{itemize} \index{type!compound|)} \index{term!compound|)} The BIFs for recognizing terms of a certain type are described in \S\S\ref{section:recognizer-bifs}. \section{Atoms} \label{section:atoms} \index{atom!Erlang type@\Erlang\ type|(} The only distinguishing property of an atom is its \emph{printname}\index{atom!printname} (cf.~\S\ref{section:atom-literals}). Two atoms are equal\index{atom!equality} if and only if they have the same printname. \index{maxatomlength@\I{maxatomlength}|(} The printname of an atom must have at most \I{maxatomlength} characters. \ifOld In \OldErlang, \I{maxatomlength} is 255. \fi \ifStd For any implementation of \StdErlang, \I{maxatomlength} must be at least $2^8-1 = 255$ and at most $2^{16}-1 = 65\,535$. (The reason for the upper limit is a restriction in the external term format, cf.~\S\ref{chapter:external-format}.) This parameter is available through the BIF \T{atom:max_length/0} (\S\ref{section:atom:maxlength0}). \fi \index{maxatomlength@\I{maxatomlength}|)} The atoms \T{true}\index{true@\T{true}} and \T{false}\index{false@\T{false}} are called \emph{Boolean}\index{atom!Boolean}. Thus, when we say that an expression is Boolean, we mean that its value is a Boolean atom. The Boolean atoms are distinguished in that \Erlang\ provides four operators acting only on them: \begin{itemize} \item The logical complement operator \T{not} (\S\ref{section:booleannot}). \item The logical operators \T{and} (\S\ref{section:booleanand}), \T{or} (\S\ref{section:booleanor}) and \T{xor} (\S\ref{section:booleanxor}). \end{itemize} Boolean atoms are also distinguished \ifStd in \T{cond}, \T{all_true} and \T{some_true} expressions (\S\ref{section:alltrue-exprs}, \S\ref{section:sometrue-exprs}, \S\ref{section:cond-expr}), and \fi in the filters of list comprehensions (\S\ref{section:list-comprehensions}). \ifStd Comparison for equality between two atoms should be $O(1)$, i.e, it cannot be implemented by comparing the printnames. (This can be accomplished by ``interning''\index{atom!interning}, i.e., making sure that each occurrence of an atom is represented internally by the same value, for example through a hashtable that maps printnames to atoms and is used each time an atom is to be obtained from its printname. Because such a table grows each time a new atom is created, many consider it bad programming style to write programs that may add new atoms at runtime, e.g., through the BIFs \T{list:to_atom/1} and \T{binary:to_term/1}. Strings\index{string!use instead of atom} [\S\ref{section:strings}] can often be used instead when the $O(1)$ comparison for equality is not needed.) \else Comparison for equality between two atoms is $O(1)$. This is accomplished by ``interning''\index{atom!interning}, i.e., making sure that each occurrence of an atom is represented internally by the same value through a hashtable that maps printnames to atoms and is used each time an atom is to be obtained from its printname. Because such a table grows each time a new atom is created, many consider it bad programming style to write programs that may add new atoms at runtime, e.g., through the BIFs \T{list_to_atom/1} and \T{binary_to_term/1}. Strings\index{string!use instead of atom} [\S\ref{section:strings}] can often be used instead when the $O(1)$ comparison for equality is not needed. \fi Atoms are recognized by the BIF \ifStd \T{is_atom/1} \else \T{atom/1} \fi (\S\ref{section:recognizer-bifs}). There are no operators acting specifically on atoms (but note the Boolean operators above). Atom literals are described in \S\ref{section:atom-literals}. \Erlang\ BIFs relating to atoms are described in \S\ref{section:atom-bifs}. %The memory areas holding the already interned atoms are typically %garbage collected much less frequently than other areas. \index{atom!Erlang type@\Erlang\ type|)} \ifStd \section{Characters} \label{section:chars} \index{character!Erlang type@\Erlang\ type|(} The character type of \StdErlang\ corresponds to the Unicode character set \cite{unicode}. That is, the invertible mapping between the characters and the character codes, which is the integer range $[0,2^{16}-1]$, i.e., $[0,65535]$, is the Unicode character encoding. Characters are recognized by the BIF \T{is_char/1} (\S\ref{section:recognizer-bifs}). There are no operators acting specifically on characters. Character literals are described in \S\ref{section:char-literals}. \Erlang\ BIFs relating to characters are described in \S\ref{section:char-module}. \index{character!may be integer|(} It is permitted (but discouraged) for an implementation to make characters indistinguishable from the integers with the corresponding character codes except that the recognizer BIF \T{is_char/1} must only be true of characters and \T{is_integer/1} must only be true of integers (\S\ref{section:recognizer-bifs}).\footnote{The purpose of this relaxation is to allow implementations that can run legacy \OldErlang\ applications. There was no character type in \OldErlang\ --- integers were used to represent characters --- but the BIFs \T{is_char/1} and \T{is_integer/1} did not exist either so characters and integers will be completely indistinguishable in such applications.} Some consequences of this would be: \begin{itemize} \item The BIF \T{integer} recognizes characters (\S\ref{section:recognizer-bifs}). \item Any value (e.g., an operand or a BIF argument) which should be a number may instead be a character and its arithmetic value will be the character code. (The resulting integer value may be further coerced to a float.) \item Any value (e.g., an operand or a BIF argument) which should be a character may instead be an integer and its character will be the one having the integer as its code. If an integer is used that is not the code of any character, the result is not defined. \item An integer \TZ{I} and a character with code \TZ{I} must be (exactly) equal (\S\ref{section:equality}). The characters thus do not precede the numbers in the term order (\S\ref{section:term-order}), instead they are ordered together with the numbers according to their character codes. \end{itemize} \index{character!may be integer|)} \index{character!Erlang type@\Erlang\ type|)} \fi \section{Numbers} \label{section:numbers} \label{section:integers} \label{section:floats} \index{number!is integer or float|(} \index{integer!Erlang type@\Erlang\ type|(} \index{float!Erlang type@\Erlang\ type|(} \Erlang\ has two numeric types: \emph{integers} and \emph{floats}. The arithmetic operations permit arbitrary combinations of integer and float op\-er\-ands, when meaningful. We therefore describe both types together. \Erlang\ integers and floats are described in detail in \S\ref{section:integer-type} and \S\ref{section:float-type}, respectively. Integer literals are described in \S\ref{section:integer-literals}. Float literals are described in \S\ref{section:float-literals}. Numbers, integers and floats are recognized by the BIFs \ifStd \T{is_number/1}, \T{is_integer/1} and \T{is_float/1} \else \T{number/1}, \T{integer/1} and \T{float/1} \fi, respectively (\S\ref{section:recognizer-bifs}). \Erlang\ provides the following operators acting on numeric terms: \begin{itemize} \item The unary plus and minus operators \T{+}, \T{-} (\S\ref{section:unaryplus}, \S\ref{section:unaryminus}). \item The multiplicative operators \T{*} (\S\ref{section:multiplication}), \T{/} (\S\ref{section:floatdiv}), \ifStd \T{//} (\S\ref{section:intdiv-f}), \fi \T{div} (\S\ref{section:intdiv})\ifOld\ \fi \ifStd, \T{mod} (\S\ref{section:intmod}) \fi and \T{rem} (\S\ref{section:intrem})\ifOld.\fi \item The addition operators \T{+} and \T{-} (\S\ref{section:additionops}) \item The signed shift operators \T{bsl} and \T{bsr} (\S\ref{section:shift}). \item The unary bitwise complement operator \T{bnot} (\S\ref{section:bitwisecomp}). \item The integer bitwise operators \T{band} (\S\ref{section:bitwiseand}), \T{bor} (\S\ref{section:bitwiseor}) and \T{bxor} (\S\ref{section:bitwiseor}). \end{itemize} \Erlang\ BIFs relating to numbers are described in \ifOld\S\ref{section:number-bifs}\fi \ifStd\S\ref{section:number-module}\fi. \index{number!is integer or float|)} \index{float!Erlang type@\Erlang\ type|)} % JoB 0.7 Took it out again. \iffalse \subsection{Bytes} \index{byte!subset of integer|(} A byte is an integer having a value in the range $[0,255]$. There are no operators acting specifically on bytes. There are no BIFs relating particularly to bytes, although various BIFs expect arguments to be bytes or list of bytes, or return such values. The byte literals are simply a subset of the integer literals \ifOld (but note that octal character escapes can be useful for denoting bytes). \fi \index{byte!subset of integer|)} \fi \ifOld \subsection{Characters} \label{section:chars} \index{character!subset of integer|(} A character is an integer having a value in the range $[0,255]$ and is thus a byte. There are no operators acting specifically on characters. The characters literals are a subset of the integer literals\footnote{It is possible, but \emph{not} recommended, to use an integer literal to denote a character.}, plus the character literals described in \S\ref{section:char-literals}. \index{character!subset of integer|)} \fi \index{integer!Erlang type@\Erlang\ type|)} \section{Refs} \label{section:refs} \index{ref!Erlang type@\Erlang\ type|(} Refs are terms for which the only meaningful operations are obtaining a new ref and comparing two refs for equality. When we describe operations (such as transformation to the external term format, cf.~\S\ref{chapter:external-format}) we shall assume that the internal representation of a ref \TZ{R} consists of three parts: \begin{itemize} \item \T{node[\Z{R}]}, which is the node on which \TZ{R} was created, represented by an atom; \item \T{creation[\Z{R}]}, a nonnegative integer that is the value of \T{creation[\Z{N}]} for the node \TZ{N} on which \TZ{R} was created; \item \T{ID[\Z{R}]}, a nonnegative integer which is a ``serial number'' for \TZ{R} on the node on which it was created. \end{itemize} Two refs are equal if all these parts are equal. \ifOld In \OldErlang\ \T{ID[\Z{R}]} is limited to XXX. Thus the BIF \T{make_ref/0} may eventually produce duplicate values. \fi \ifStd If in an implementation there is an upper limit to \T{ID[\Z{R}]}, then the number of possible refs created on a node is bounded and the BIF \T{make_ref/0} may eventually produce duplicate values. If this is the case, then \I{refs\_bounded} is \B{true} for that implementation, otherwise \I{refs\_bounded} is \B{false}. If \I{refs\_bounded} is \B{true}, then \I{numrefs} is the number of distinct values that \T{ID[\Z{R}]} can have. The values of \I{refs\_bounded} and \I{maxrefs} (if applicable) are available through the BIFs \T{ref:bounded/0} and \T{ref:max/0}. \fi There are no ref literals. Refs are recognized by the BIF \ifOld \T{reference/1} \fi \ifStd \T{is_ref/1} \fi (\S\ref{section:recognizer-bifs}). There are no operators acting specifically on refs. \Erlang\ BIFs relating to refs are described in \ifOld \S\ref{section:misc-bifs}.\fi \ifStd \S\ref{section:ref-module}.\fi \index{ref!Erlang type@\Erlang\ type|)} \section{Binaries} \label{section:binaries} \index{binary!Erlang type@\Erlang\ type|(} A \emph{binary} is a sequence of bytes\index{byte}, i.e., a sequence of integers between 0 and 255. \iffalse It's \emph{raison d'\^{e}tre} is communication between processes, where low-level communication takes place through sequences of bytes and terms are to be communicated. There are thus BIFs for translating from arbitrary terms to binaries and vice versa. An arbitrary term $t$ can be sent from a process $p$ to a process $q$ as follows: \begin{enumerate} \item process $p$ obtains the binary $b$ representing $t$; \item the binary $b$ is sent via a port connecting $p$ and $q$; \item process $q$ retrieves the original term $t$ from $b$. \end{enumerate} The internal representation of terms may allow \emph{sharing} of structure between identical subterms. If so, sharing in $p$'s representation of $t$ and sharing in $q$'s representation of $t$ are totally independent of each other and so are the memory requirements for representing $t$ in $p$ and in $q$. \fi There are no binary literals. Binaries are recognized by the BIF \ifStd\T{is_binary/1}\else\T{binary/1}\fi (\S\ref{section:recognizer-bifs}). There are no operators acting specifically on binaries. \Erlang\ BIFs relating to binaries are described in \S\ref{section:binary-bifs}. \ifOld \NOTE The \OldErlang\ implementation has disjoint address spaces for its processes and thus copy terms sent as messages (\S\ref{section:messages}). However, in typical applications binaries may be very large and copying them would therefore be expensive. Therefore the \OldErlang\ implementation has a single memory area for all binaries residing on a node and uses indirect addressing. That is, a binary would be represented in the memory of a process by a pointer into the common binary area together with information about length. When sending a binary in a message, only the local information is copied, not the elements of the binary. This also implies that a binary can be split (cf.~the BIF \T{split_binary/2}, \S\ref{section:splitbinary2}) in constant time as no copying of the elements is necessary. Of course this arrangement complicates memory management\index{memory management}, as the binary area must be maintained separately. \fi \index{binary!Erlang type@\Erlang\ type|)} \ifStd \section{Functions} \label{section:functions} \index{function!Erlang type@\Erlang\ type|(} A \emph{function} of arity $n$ is a term that can be \emph{applied} to a sequence of $n$ terms. Evaluating the application may cause certain effects and may either never complete, complete abruptly with some associated reason or complete normally with a result. There are no function literals. However, \T{fun} expressions, having functions as their values, are described in \S\ref{section:fun-exprs}. Function declarations, described in \S\ref{section:program-forms}, associate a function name with a function in a certain module. \iffalse % Per talked me out of this. An \Erlang\ system may represent functions transparently through some other type, e.g., as tuples, in which case the recognizer BIF for that type will be true also for tuples. It is therefore not portable to assume that functions are distinct from all other types\index{function!possibly not distinct type}. If an implementation uses another type to represent functions, this should be documented. \fi Functions are recognized by the BIF \T{is_function/1} (\S\ref{section:recognizer-bifs}). There are no operators acting specifically on functions. \Erlang\ BIFs relating to functions are described in \S\ref{section:process-bifs}. \index{function!Erlang type@\Erlang\ type|)} \fi \section{Process identifiers} \label{section:pids} \index{PID!Erlang type@\Erlang\ type|(} \index{process|(} An \Erlang\ \emph{process} is an entity that carries out the evaluation of an application. That particular evaluation is identified by a distinct \emph{process identifier}, usually called simply a \emph{PID}. The PID must be used in order to send messages to the process and when manipulating it (e.g., linking with it or attempting to kill it). PIDs are elementary terms and a PID can be created only by spawning a process. Spawning a process always yields a PID that is distinct from all accessible PIDs. (PIDs and refs are obviously similar and an inefficient implementation of refs could indeed be obtained by letting \T{make_ref/0} spawn a new process and use its PID.) When a process completes, its PID is still a PID but it no longer refers to a process so BIFs cannot use it. The result or effect when a BIF is given the PID of a completed process varies, cf.~Section\ref{section:process-bifs}. Processes are further described in Chapter~\ref{chapter:processes}. When we describe operations (such as transformation to the external term format, cf.~\S\ref{chapter:external-format}) we shall assume that the internal representation of a PID \TZ{P} consists of three parts: \begin{itemize} \item \T{node[\Z{P}]}, which is the node on which \TZ{P} was spawned, represented by an atom; \item \T{creation[\Z{P}]}, a nonnegative integer that is the value of \T{creation[\Z{N}]} for the node \TZ{N} on which \TZ{P} was spawned; \item \T{ID[\Z{P}]}, a nonnegative integer which is a ``serial number'' for \TZ{P} on the node on which it was spawned. \end{itemize} Two PIDs are equal if all these parts are equal. \ifOld In \OldErlang\ \T{ID[\Z{P}]} is limited to XXX. Thus the BIFs \T{spawn/3}, etc., may eventually produce duplicate values. \fi \ifStd If in an implementation there is an upper limit to \T{ID[\Z{P}]}, then the number of possible PIDs created on a node is bounded and the BIFs \T{spawn/3}, etc., may eventually produce duplicate values. If this is the case, then \I{pids\_bounded} is \B{true} for that implementation, otherwise \I{pids\_bounded} is \B{false}. If \I{pids\_bounded} is \B{true}, then \I{numpids} is the number of distinct values that \T{ID[\Z{P}]} can have. The values of \I{pids\_bounded} and \I{maxpids} (if applicable) are available through the BIFs \T{proc:bounded/0} and \T{proc:max/0}. \fi There are no PID literals. PIDs are recognized by the BIF \ifStd\T{is_pid/1}\else\T{pid/1}\fi (\S\ref{section:recognizer-bifs}). There are no operators acting specifically on processes or PIDs. \Erlang\ BIFs relating to processes are described in \S\ref{section:process-bifs}. \index{PID!Erlang type@\Erlang\ type|)} \index{process|)} \section{Ports} \label{section:ports} \index{port!Erlang type@\Erlang\ type|(} An \Erlang\ node\index{node!communication} communicates with resources in the outside world (including the rest of the computer on which it resides) through \emph{ports}. Examples of such external resources are files and non-\Erlang\ programs running on the same host. An external resource behaves much like an \Erlang\ process, although interaction with it causes or is caused by events in the outside world. Each external resource is identified by an \Erlang\ term that is referred to as a port. When a port is created, it is connected externally to an entity, which is either \begin{itemize} \item a recently spawned external process or recently opened driver (\S\ref{section:drivers}); \item a file. \end{itemize} Internally the port is connected to a process, which is originally the process that opened the port. A process communicates with an external resource through messages sent to a port. Any process can send messages to an external resource. The process connected with a port will receive messages from the resource. When the external resource is depleted (i.e., the end of the file has been reached, the external process has completed or the driver is closed), the port is closed, corresponding to the termination of a process. A process can be linked to a port and it will then be notified when the port is closed. Ports are obviously similar to PIDs but do not allow all operations that PIDs allow. Ports are further described in \S\ref{chapter:more-about-ports}. When we describe operations (such as transformation to the external term format, cf.~\S\ref{chapter:external-format}) we shall assume that the internal representation of a port \TZ{Q} consists of three parts: \begin{itemize} \item \T{node[\Z{Q}]}, which is the node on which \TZ{Q} was opened, represented by an atom; \item \T{creation[\Z{Q}]}, a nonnegative integer that is the value of \T{creation[\Z{N}]} for the node \TZ{N} on which \TZ{Q} was opened; \item \T{ID[\Z{Q}]}, a nonnegative integer which is a ``serial number'' for \TZ{Q} on the node on which it was opened. \end{itemize} Two ports are equal if all these parts are equal. \ifOld In \OldErlang\ \T{ID[\Z{Q}]} is limited to 256. Thus the BIF \T{open_port/2} may eventually produce duplicate values. However, \T{open_port/2} will never return a duplicate open port and the number of simultaneously open ports is limited to 256. \fi \ifStd If in an implementation there is an upper limit to \T{ID[\Z{Q}]}, then the number of possible PIDs created on a node is bounded and the BIF \T{port:open/2}, etc., may eventually produce duplicate values. If this is the case, then \I{ports\_bounded} is \B{true} for that implementation, otherwise \I{ports\_bounded} is \B{false}. If \I{ports\_bounded} is \B{true}, then \I{numports} is the number of distinct values that \T{ID[\Z{Q}]} can have. The values of \I{ports\_bounded} and \I{maxports} (if applicable) are available through the BIFs \T{port:bounded/0} and \T{port:max/0}. \fi There are no port literals. Ports are recognized by the BIF \ifStd\T{is_port/1}\else\T{port/1}\fi (\S\ref{section:recognizer-bifs}). There are no operators acting specifically on ports. \Erlang\ BIFs relating to ports are described in \S\ref{section:port-bifs}. \index{port!Erlang type@\Erlang\ type|)} \section{Tuples} \label{section:tuples} \index{tuple!Erlang type@\Erlang\ type|(} A $k$-tuple, where $k\geq0$, is a mapping from the integers $1$, \ldots, $k$ to \Erlang\ terms, which are its immediate subterms\index{subterm!immediate}, or elements. (There is exactly one $0$-tuple, which is a void mapping.) We say that the \emph{size} of such a tuple is $k$. The types of the $k$ terms are independent. A $k$-tuple can be used as a sequence of $k$ terms where each term can be accessed through its index. \index{maxtuplesize@\I{maxtuplesize}|(} A tuple must have at most \I{maxtuplesize} elements. \ifOld In \OldErlang, \I{maxtuplesize} is 65535. % 65535? % 2^27? % 2^28? \fi \ifStd For any implementation of \StdErlang, \I{maxtuplesize} must be at least $2^{16}-1 = 65\,535$ and at most $2^{32}-1 = 4\,294\,967\,296$. (The reason for the upper limit is a restriction in the packed term format, cf.~\S\ref{chapter:external-format}.) This parameters is available through the BIF \T{tuple:max_size/0} (\S\ref{section:tuple:maxsize0}). \fi \index{maxtuplesize@\I{maxtuplesize}|)} Tuple skeletons are described in \S\ref{section:tuple-skeletons}. \index{tuple!literal|(} A tuple literal is a tuple skeleton where all subexpressions are themselves literals. \index{tuple!literal|)} The time for accessing a tuple element given the tuple and an index (i.e., what is computed by the BIF \T{element/2}\index{element/2 BIF@\T{element/2} BIF}) \ifStd should be \else is \fi $O(1)$, i.e., a constant-time operation. The element update operation --- obtaining a tuple that differs from a given one in exactly one element (i.e., what is computed by the BIF \T{setelement/3}\index{setelement/3 BIF@\T{setelement/3} BIF}) --- \ifStd should be \else is \fi $O(n)$, where $n$ is the number of elements of the tuple. \ifOld (A future version of \Erlang\ may have a different trade-off between element access and element update. \fi \ifStd (Implementations are not discouraged to explore internal representations of tuples that make element update more efficient. \fi For example, reducing the time for element update to $O(\log n)$ may justify increasing the time for element access to $O(\log n)$.) Tuples are recognized by the BIF \ifStd\T{is_tuple/1}\else\T{tuple/1}\fi (\S\ref{section:recognizer-bifs}). There are no operators acting specifically on tuples. \Erlang\ BIFs relating to tuples are described in \S\ref{section:tuple-bifs}. \subsection{Records} \label{section:records} \index{record!Erlang type@\Erlang\ type|(} A record type \TZ{R} has a number of \emph{field names}\index{record!field name}. A term of record type \TZ{R} has a value for each of these fields. A term of record type \TZ{R} is a tuple\index{record!is a tuple} which has one more element than the number of fields of \TZ{R} and having the atom \TZ{R} as its first element. Terms of a record type \TZ{R} are recognized by record guard tests (\S\ref{section:record-guards}). There are no operators acting specifically on records. Record declarations are described in \S\ref{section:record-declarations} and record expressions are described in \S\ref{section:record-exprs}. \index{record!Erlang type@\Erlang\ type|)} \ifOld \subsection{Functions} \label{section:functions} \index{function!Erlang type@\Erlang\ type|(} A \emph{function} of arity $n$ is a term that can be \emph{applied} to a sequence of $n$ terms. Evaluating the application may cause certain effects and may either never complete, complete abruptly with some associated reason or complete normally with a result. There are no function literals. However, \T{fun} expressions, having functions as their values, are described in \S\ref{section:fun-exprs}. Function declarations, described in \S\ref{section:program-forms}, associate a function name with a function in a certain module. \index{function!not a distinct type|(} In \OldErlang\ a function (i.e., the value of a \T{fun} expression) is represented by a tuple, hence the recognizer \T{tuple/1} returns \T{true} for a function. It is not recommended to exploit this representation. \index{function!not a distinct type|)} \Erlang\ BIFs relating to functions are described in \S\ref{section:process-bifs}. \index{function!Erlang type@\Erlang\ type|)} \fi \index{tuple!Erlang type@\Erlang\ type|)} \section{Lists and conses} \label{section:lists} \index{list|(} \index{nil!Erlang type@\Erlang\ type|(} \index{cons!Erlang type@\Erlang\ type|(} \Erlang\ has a constant \T{[]}, which is called \emph{nil}. \Erlang\ also has a term-forming binary operator \T{[$\cdots$|$\cdots$]} called \emph{cons}. The operands of cons are usually referred to as the \emph{head} and the \emph{tail} of the resulting term and are its immediate subterms\index{subterm!immediate}. The arguments of cons can be any terms but the intended use of cons is for forming \emph{lists}. (In any use of cons as a general pairing operator, a 2-tuple [\S\ref{section:tuples}] could be used instead.) Let us define which terms are \emph{lists}. \begin{itemize} \item Nil is an \emph{empty list} (thus having zero elements). \item Cons applied to an arbitrary term and a list (with $k$ elements) is a list (with $k+1$ elements). \item There are no other lists than those constructed by a finite number of applications of the two preceding rules. \end{itemize} A list thus represents a finite sequence. As suggested by the use of the cons operator, the properties of a linked representation should be assumed. Computing the cons operator takes $O(1)$ time and so does obtaining the head and/or the tail of a consed term. However, obtaining an element at an arbitrary position of a list \ifStd (e.g., through the BIF \T{list:nth/2} [\S\ref{section:list:nth2}]) \fi takes $O(n)$ time, where $n$ is the index of the element to retrieve. %(This is because a linked representation is expected.) In addition to the nil constant and the cons operator, there are additional list skeletons, described in \S\ref{section:list-skeletons}, although for every list skeleton, there is an equal term that is a composition of cons operators and nil constants. \index{list!literal|(} A list literal is a list skeleton in which all subexpressions are themselves literals. \index{list!literal|)} \ifOld Nil and conses are both recognized by the BIF \T{list/1} (\S\ref{section:recognizer-bifs}), although the name is highly misleading. \fi \ifStd Nil, conses and lists are recognized by the BIFs \T{is_null/1}, \T{is_cons/1} and \T{is_list/1}, respectively (\S\ref{section:recognizer-bifs}). \fi \Erlang\ provides the following operators acting on lists and conses: \begin{itemize} \item The list addition operator \T{++} (\S\ref{section:list-addition}). \item The list subtraction operator \T{--} (\S\ref{section:list-subtraction}). \end{itemize} \Erlang\ BIFs relating to lists and conses are described in \S\ref{section:list-bifs}. \index{nil!Erlang type@\Erlang\ type|)} \index{cons!Erlang type@\Erlang\ type|)} \subsection{Strings} \label{section:strings} \index{string|(} A \emph{string} is a list of characters\index{character} (\S\ref{section:chars}) and can be seen as representing a text. Note that a list is a string only if all its elements are characters. It follows that a cons is a string only if its head is a character and its tail is a string. String literals are described in \S\ref{section:string-literals} (but note that list literals with character literals also denote strings). \ifStd Strings are recognized by the BIF \T{is_string/1} (\S\ref{section:recognizer-bifs}). \fi There are no operators acting specifically on strings (but note the list operators above). \ifOld \Erlang\ BIFs converting from and to strings are described in various sections of \S\ref{chapter:bifs}. \fi \ifStd \Erlang\ BIFs relating to strings are described in \S\ref{section:str-module}. \fi As strings are lists\index{string!is a list}, note that a string can be used anywhere a list is expected (for example, as operand of a list operator or as argument of a list BIF). \index{string|)} \subsection{Association lists} \label{section:assocationlists} \index{list!association|(} An \emph{association list} is a list of 2-tuples. For each 2-tuple we say that the first element is the key\index{key!in an association list} and the second element is the value\index{value!in an association list}. Let \TZ{lst} be an association list \begin{alltt} [\{\(\Z{k}\sb{1}\),\(\Z{v}\sb{1}\)\},\{\(\Z{k}\sb{2}\),\(\Z{T}\sb{v}\)\},\tdots,\{\(\Z{k}\sb{n}\),\(\Z{v}\sb{n}\)\}] \end{alltt} and let $K$ be the set of keys in \TZ{lst}. \TZ{lst} represents a mapping which for each key $\TZ{k}\in K$ contains a pair $(\TZ{k},\TZ{v}_j)$ such that $\TZ{k}=\TZ{k}_j$ and for all $i$, $1\leq i<j$, $\TZ{k}\neq\TZ{k}_i$. When we write that a BIF returns an association list, the first element of each 2-tuple in the returned list is always distinct. \index{list!association|)} \index{list|)} \section{Relational and equality operators on terms} \Erlang\ provides the following relational and equality operators, acting on a pair of terms, each of any type. \begin{itemize} \item The comparison operators \T{<}, \T{=<}, \T{>} and \T{>=} (\S\ref{section:relationalops}). \item The (exact) equality operators \T{=:=} and \T{=/=} (\S\ref{section:exactequationalops}). \item The arithmetic equality operators \T{==} and \T{/=} (\S\ref{section:coercingequationalops}). \end{itemize} \subsection{Coercion} \label{section:coercion} \index{coercion!to float|(} \index{conversion!arithmetic|(} Coercion is applied when computing some arithmetic operators (including the arithmetic equality operators). \index{coerce@$\mathit{toFloat}$|(} The function $\I{toFloat}$ maps a number to a float as follows: \iftrue \begin{alignat*}{2} \mathit{toFloat}(a) &= a && \qquad\text{if $a$ is a float;} \\ &= \mathit{cvt}_{\mathtt{integer}\rightarrow\mathtt{float}}(a) && \qquad\text{if $a$ is an integer.} \end{alignat*} \else \[\I{toFloat}(a)=\begin{cases} a & \text{if $a$ is a float;} \\ \I{cvt}_{\mathtt{integer}\rightarrow\mathtt{float}}(a) & \text{if $a$ is an integer.} \end{cases}\] \fi (${cvt}_{\mathtt{integer}\rightarrow\mathtt{float}}$ is as defined in LIA-1 \cite{lia-1}.) \index{coerce@$\mathit{toFloat}$|)} \index{coerce@$\mathit{coerce}$|(} The function $\I{coerce}$ maps a pair of terms to a pair of terms as follows: \iftrue \begin{alignat*}{2} \mathit{coerce}(a,b) &= (a,b) && \qquad\text{if $a$ or $b$ is not a number;} \\ &= (\I{toFloat}(a),\I{toFloat}(b)) && \qquad\text{if $a$ or $b$ is a float;} \\ &= (a,b) && \qquad\text{otherwise.} \end{alignat*} \else \[\I{coerce}(a,b)=\begin{cases} (a,b) & \text{if $a$ or $b$ is not a number;} \\ (\I{toFloat}(a),\I{toFloat}(b)) & \text{if $a$ or $b$ is a float;} \\ (a,b) & \text{otherwise.} \end{cases}\] \fi \index{coerce@$\mathit{coerce}$|)} \index{coercion!to float|)} \index{conversion!arithmetic|)} \section{Size of data structures} \index{term!size|(} \index{size@$\mathit{size}$|(} The function $\mathit{size}$ gives a measure of the size of an \Erlang\ term \TZ{T} as an integer. \ifStd It is expected that the memory needed for representing \TZ{T} in an implementation \fi \ifOld The memory needed for representing \TZ{T} in \OldErlang\ \fi is $O(\mathit{size}(\TZ{T}))$ (this excludes shared information such as the printname of an atom). The measure is also used in this document for expressing the rate of growth of operations such as comparisons. \begin{itemize} \item If \TZ{T} is an atom, a fixnum (\S\ref{section:integer-type}), a float, a ref, a PID or a port, then \[\I{size}(\TZ{T}) = O(1).\] \item If \TZ{T} is a bignum (\S\ref{section:integer-type}), then \[\I{size}(\TZ{T}) = O(\log \Er[\TZ{T}]).\] \item If \TZ{T} is a binary of $k$ bytes, then \[\I{size}(\TZ{T}) = O(k).\] \item If \TZ{T} is a cons with head $\TZ{T}_h$ and tail $\TZ{T}_t$, then \[\I{size}(\TZ{T}) = O(1)+\mathit{size}(\TZ{T}_h)+\mathit{size}(\TZ{T}_h).\] \item If \TZ{T} is a tuple with elements $\TZ{T}_1$, \ldots, $\TZ{T}_k$, or a function with values $\TZ{T}_1$, \ldots, $\TZ{T}_k$ for the free variables, then \[\I{size}(\TZ{T}) = O(1)+O(k)+\sum_{i=1}^k\mathit{size}(\TZ{T}_i).\] \item If \TZ{T} is a function with values $\TZ{T}_1$, \ldots, $\TZ{T}_k$ for free variables, then \[\I{size}(\TZ{T}) = O(1)+O(k)+\sum_{i=1}^k\mathit{size}(\TZ{T}_i).\] \end{itemize} We will allow ourselves to apply $\mathit{size}$ also to sets of terms and sets of pairs of terms. \begin{itemize} \item If $t$ is a set of items $t_1$, \ldots, $t_k$, then \[\I{size}(t) = O(1)+O(k)+\sum_{i=1}^k\mathit{size}(t_i).\] \item If $t$ is a pair of items $a$ and $b$, then \[\I{size}(t) = O(1)+\mathit{size}(a)+\mathit{size}(b).\] \end{itemize} \index{term!size|)} \index{size@$\mathit{size}$|)} \subsection{Equality between terms} \label{section:equality} \index{equality!exact|(} (Exact) equality between \Erlang\ terms $a$ and $b$ is defined as follows: \begin{itemize} \item If $a$ and $b$ were the result of the same evaluation of an expression, then they are equal. \item Otherwise, if $a$ and $b$ are of different type, then they are not equal. \item Otherwise, equality of $a$ and $b$ depends on the type of $a$ and $b$: \begin{itemize} \item \B{Atom}: $a$ and $b$ are equal if and only if they have the same printname. \ifStd \item \B{Character}: $a$ and $b$ are equal if and only if they are identical. \fi \item \B{Integer}: $a$ and $b$ are equal if and only if $\Er[a]=\Er[b]$. \item \B{Float}: $a$ and $b$ are equal if and only if $\Er[a]=\Er[b]$. (As in all programming languages, it is unwise to trust equality for floats, as imprecision due to rounding may lead to unexpected inequalities.) \item \B{Ref}: $a$ and $b$ are not equal. \item \B{Binary}: $a$ and $b$ are equal if and only if they consist of identical sequences of bytes. \ifStd \item \B{Function}: if $a$ and $b$ were the results of (different occurrences of) identical expressions, then equality is not defined; otherwise they are not equal. \fi \item \B{PID}: $a$ and $b$ are not equal. \item \B{Port}: $a$ and $b$ are not equal. \item \B{Cons}: \begin{itemize} \item If $a$ and $b$ are both empty, then they are equal. \item Otherwise, if $a$ and $b$ are both nonempty, then they are equal if and only if the heads of $a$ and $b$ are equal and the tails of $a$ and $b$ are equal. \item Otherwise, $a$ and $b$ are not equal. \end{itemize} \item \B{Tuple}: \begin{itemize} \item If $a$ and $b$ have different size, then they are not equal. \item Otherwise, if all corresponding elements of $a$ and $b$ are pairwise equal, then $a$ and $b$ are equal. \item Otherwise, $a$ and $b$ are not equal. \end{itemize} It follows that two records are equal if, and only if, they are of the same type and all corresponding elements are pairwise equal. \ifOld For tuples that represent functions the representation is such that if $a$ and $b$ were the results of (different occurrences of) identical expressions, then equality is not defined; otherwise they are not equal. \fi % \item \B{Struct} \end{itemize} \end{itemize} \index{equality!exact|)} \ifStd As there is no portable way to represent functions in the external term format (\S\ref{chapter:external-format}), equality is not at all defined for functions that have been transformed to the external format and back again or sent as messages. \fi Due to how the representation of floats in the external term format\ifStd\else\ (\S\ref{chapter:external-format})\fi, equality is not at all defined for floats that have been transformed to the external format and back again, or have been sent as messages. The time required for determining exact equality of two terms $\TZ{T}_1$ and $\TZ{T}_2$ should be $\min(\mathit{size}(\TZ{T}_1),\mathit{size}(\TZ{T}_2))$. \index{equality!arithmetic|(} Arithmetic equality between \Erlang\ terms $a$ and $b$ is defined as follows: \begin{itemize} \item If $a$ and $b$ are numbers, then they are arithmetically equal if and only if $a'$ is (exactly) equal to $b'$, where $(a',b')=\I{coerce}(a,b)$ (\S\ref{section:coercion}). \item Otherwise, if $a$ and $b$ are both of elementary types, then they are arithmetically equal if and only if they are (exactly) equal. \item Otherwise, if $a$ and $b$ are both lists, then: \begin{itemize} \item If $a$ and $b$ are both empty, then they are arithmetically equal. \item Otherwise, if $a$ and $b$ are both nonempty, then they are arithmetically equal if and only if the heads of $a$ and $b$ are arithmetically equal and the tails of $a$ and $b$ are arithmetically equal. \item Otherwise, $a$ and $b$ are not arithmetically equal. \end{itemize} \item Otherwise, if $a$ and $b$ are both tuples of the same size, then $a$ and $b$ are arithmetically equal if and only if all corresponding elements of $a$ and $b$ are pairwise arithmetically equal. \item Otherwise $a$ and $b$ are not arithmetically equal. \end{itemize} \index{equality!arithmetic|)} \subsection{The term order} \label{section:term-order} \index{term!comparison|(} The \emph{term order} of \Erlang\ terms, which we will write here as \T{<}, is a order relation that \ifStd must satisfy \fi \ifOld satisfies \fi the following criteria: \begin{itemize} \item It is transitive, i.e., if \T{$\Z{t}_1$ < $\Z{t}_2$} and \T{$\Z{t}_2$ < $\Z{t}_3$}, then it must be the case that \T{$\Z{t}_1$ < $\Z{t}_3$}. %\item It is irreflexive, i.e., there can be no term \TZ{t} such that %\T{\Z{t} < \Z{t}}. \item It is asymmetric, i.e., there can be no terms $\TZ{t}_1$ and $\TZ{t}_2$ such that \mbox{\T{$\Z{t}_1$ < $\Z{t}_2$}} and \mbox{\T{\Z{t}$_2$ < \Z{t}$_1$}}. (This implies that it is irreflexive, i.e., that there can be no term \TZ{t} such that \T{\Z{t} < \Z{t}}.) \item \ifStd With the exception of functions, it \fi \ifOld It \fi is an arithmetic total order relation, i.e., if $\TZ{t}_1$ is not arithmetically equal to $\TZ{t}_2$, then exactly one of \T{$\Z{t}_1$ < $\Z{t}_2$} and \T{$\Z{t}_2$ < $\Z{t}_1$} holds, unless $\TZ{t}_1$ and $\TZ{t}_2$ are functions. \item The terms are primarily ordered according to their type, in the following order: numbers \T{<} \ifStd characters \T{<} \fi atoms \T{<} refs \T{<} \ifStd functions \T{<} \fi ports \T{<} PIDs \T{<} tuples \T{<} empty list \T{<} conses \T{<} binaries. \item Numbers are ordered arithmetically (so there is no distinction between integers and floats in this ordering). For example, \T{4.5 < 5 < 5.3}. \ifStd \item Characters are ordered according to their character codes. For example, \T{\char`\$5 < \char`\$@ < \char`\$J < \char`\$b}. \fi \item Atoms are ordered lexicographically according to the codes of the characters in the printnames. For example, \T{'' < a < aaa < ab < b}. \item If $\TZ{t}_1$ and $\TZ{t}_2$ are both refs, both PIDs or both ports, then $\TZ{t}_1$ precedes $\TZ{t}_2$ if and only if either \begin{itemize} \item \T{node($\Z{t}_1$)} precedes \T{node($\Z{t}_2$)}, or \item \T{node($\Z{t}_1$)} equals \T{node($\Z{t}_2$)} and $\TZ{t}_1$ was created before $\TZ{t}_2$. \end{itemize} \ifStd \item Functions are not ordered, except for equality as described above. \fi \item Tuples are ordered first by their size, then according to their elements lexicographically. For example, \T{\{\} < \{a\} < \{aaa\} < \{xxx\} < \{aaa,xxx\} < \{xxx,aaa\}}. (It follows that records are ordered first by their number of elements, then according to their type, then according to their elements with fields compared in the order given by $\mathit{record\_field}_{\TZm{R}}^{-1}$, where \TZ{R} is the record type.) \ifOld Functions are not ordered, except for equality as described above. \fi \item An empty list precedes a cons (and thus a nonempty list) and conses are ordered first by their heads, then by their tails. (Thus a longer list may precede a shorter list even though a shorter tuple always precedes a longer tuple.) For example, \T{[] < [a|2] < [a|b] < [a] < [a,a] < [b]}. \item Binaries are ordered first by their size, then according to their elements lexicographically. (That is, the same as the order between tuples of integers.) \end{itemize} \index{term!comparison|)} \section{Lifetime of data structures} \label{section:life-time} \index{term!life time of|(} \index{term!identity|(} We say that a term \emph{has identity} if it is \begin{itemize} \item a ref, \ifStd\item a function,\fi \item a PID, \item a port, or \item a compound term (i.e., a tuple or a list) in which some immediate subterm has identity. \end{itemize} An elementary term with identity is created by evaluating an expression on a certain form. (For example, a ref is created by evaluating an application of the BIF \T{make_ref/0}). In this case, each evaluation of such an expression creates a new term that can be distinguished from all other such terms. If an elementary term with identity is embedded in a compound term, that compound term also has identity. \ifStd An implementation is not permitted to \fi \ifOld \OldErlang\ will not \fi share or copy terms with identity except when such sharing or copying is implied by the language semantics. For a term with identity there is thus a definite moment of creation. There is, however, no corresponding moment of destruction: the lifetime of a term with identity is unbounded. \index{term!identity|)} \index{term!generic|(} A term that does not have identity is said to be \emph{generic}. For generic terms, the concept of lifetime is not meaningful at all as there is no way in which two equal specimen of a generic term could be distinguished. If the value of an expression is a generic term, it would be impossible to tell from two such terms whether they were the result of the same evaluation or two separate evaluations. (Evaluation of the expression might have side effects that would be different for one or more evaluations but that is not the point here.) An implementation is permitted to share or copy generic terms. For example, when a literal \T{\{1,2,3\}} is evaluated more than once, an implementation may let all evaluations return references to the same (generic) tuple or let each evaluation return a new specimen of such a term. \index{term!generic|)} \index{term!life time of|)} \section{Memory management} \label{section:memory-management} \index{memory management|(} In the previous section we noted that for generic terms, there is no concept of lifetime and for terms with identity, the lifetime is unbounded. However, \ifStd an implementation must \fi \ifOld \OldErlang\ will \fi keep track of all references to terms (both generic terms and terms with identity) and when no references to a specimen of a term remain, the memory occupied by the specimen must eventually be reused. There \ifStd must be \fi \ifOld are \fi no ``memory leaks,'' i.e., memory that is not part of the representation of terms that can be referenced but is never reclaimed. Reclamation of memory in a process (garbage collection) could occur incrementally or in batches but \ifStd must \fi \ifOld will \fi not cause violation of the scheduling policies described in \S\ref{section:scheduling}. \index{memory management|)}
# Kentel Python3 - Grafikoù ## Dispenn an izotopoù radioaktivel Gant ar fonksionoù ankivil [aléatoires] (pe kentoc'h damankivil [pseudo-aléatoire]) hag ar fed gallout ober kalz a jedadennoù buan tre eo an urzhiataerioù ostilhoù dispar evit ober darvanoù [simulations] luziet. Klasket e vo darvanañ digresk eksponantel ur c'hementad a rannigoù radioaktivel e kerz an amzer.<br> Kroget e vo da tresañ grafik fonksion matematikel an digresk eksponantel evit gwelet he stumm ha pleustriñ gant ar grafikoù.<br> Kendalc'het e vo gant un darvan eeunek ha difetiz a-walc'h (met reiz memes tra).<br> Echuet e vo gant un darvan tostoc'h d'ar gwirion (ar pezh a fell deomp). Gouzout a reomp un digresk eksponantel a zo eus ar stumm<br> $\begin{equation} N(t) = N_0 \times e^{-\lambda t} \end{equation}$<br><br> Gant :<br> $N_0$ Niver a rannigoù radioaktivel da gentañ (en amzer $t_0$)<br> $\lambda$ Ar c'honstantenn digresk<br> $t$ an amzer ## Grafikoù gant ar module `matplotlib` Tu vefe termeniñ ur fonksion `N(t)` gant Python met `matplotlib` ne oar ket tresañ fonksionoù evel-se. Implijet e vez **listennoù roadennoù niverel** nemetken evit tresañ grafikoù. ```python # Enframmet e vez ar module evit tresañ grafikoù import matplotlib.pyplot as plt # Ar ger 'as' a servij d'ober un alias etre matplotlib.pyplot ha plt # Berroc'h ha kevatal e vo skrivañ 'plt' eget 'matplotlib.pyplot' ``` ```python # Ur skouer simpl roadennou = [1, 2.2, 4, 8.9, 6, 5, 3, 1, 1.5, 0.2] plt.plot(roadennou) # Tresañ ar grafik (e memor an urzhiataer) plt.show() # Diskouez ar grafik war ar skramm ``` ```python # Tresomp an digresk eksponantel bremañ # Kavet e vez ar fonksion eksponantel e-barzh ar module 'math' from math import exp kde = 0.1 # Konstantenn digresk eksponantel n0 = 1000 roadennou = [] # Jedet e vez 100 talvoud da-heul for t in range(100): roadennou.append(n0*exp(-kde*t)) plt.plot(roadennou) plt.show() ``` ## Un darvan difetiz Pep rannig radioaktivel eus ar memes sort en eus ar memes probablentez bezañ dispennet e pad ur c'houlzad bennak.<br> Ma vez lavaret, da skouer, ez eo 1% ar probablentez evit ur rannig bezañ dispennet e-kerzh ur c'houlzad e dalvez ivez e vo dispennet 1% eus kementad ar rannigoù e-kerzh ar c'houlzad. ```python prob_dispenn = 0.1 n0 = 1000 # Lakaet e vez talvoud n0 el listenn roadennou = [n0] for i in range(100): # Kemeret e vez an talvoud diwezhañ el listenn # Lemet e vez an niver a rannigoù dispennet e-kerzh ar c'houlzad # ouzhpennet e vez an talvoud nevez e fin al listenn roadennou.append(roadennou[i] - roadennou[i]*prob_dispenn) plt.plot(roadennou) plt.show() ``` ## Un darvan tostoc'h eus ar gwirionnez Ar skouerioù a-us a heulie formulennoù matematikel anavezet en araok. Ar formulennoù matematikel a zo dedennus evit diskriv ar fenomenoù naturel a-bell, a geidenn hag en un doare parfed met ar fenomenoù naturel ne heuliont ket formulennoù matematikel dre ret pa vezont sellet a-dost. Setup perak ne oant ket darvanoù da vat.<br> Evit kaout un darvan gwir e vez roet perzhioù ar sistem nemetken hag an diskoulm a vez dianavezet en araok. Pep gwech ma vez peurgaset an darvan e c'heller kavout un diskoulm disheñvel. ```python # Enframmañ ar module evit implij fonksionoù ankivil import random ``` ```python # Cheñchit talvoud ar roadennoù-se hervez o c'hoantoù prob_dispenn = 0.1 rannigou = 1000 # El listenn 'mañ e vo miret ar roadennou net jedet roadennou = [rannigou] while rannigou>0: # Evit pep rannig a chom e vez tennet un niverenn d'ar sort for i in range(rannigou): # Ma 'vez tennet un niverenn bihanoc'h eget ar probablentez dibabet # e vez dispennet ur rannig if random.random() < prob_dispenn: rannigou -= 1 # E fin ar roll e vez stoked a niver a rannigoù a chom en omp listennad data roadennou.append(rannigou) ``` Bremañ ne chom nemet da dresañ an data bet jedet war ur grafik brav gant ar stadamantoù da-heul. ```python # Cheñch ment ar grafik plt.rcParams["figure.figsize"] = [12, 8] # Tresañ ar grafik plt.plot(roadennou) # Dibab un titl (dirediet) plt.title("Dispenn an izotopoù radioaktivel") # Dibab anvioù evit an axoù (dirediet) plt.xlabel("Red an amzer (koulzadoù)") plt.ylabel("Niver a rannigoù") # Diskouez ar grafik plt.show() ```
{-# OPTIONS --universe-polymorphism #-} module Issue248 where open import Common.Level data ⊥ : Set where -- This type checks: Foo : ⊥ → (l : Level) → Set Foo x l with x Foo x l | () -- This didn't (but now it does): Bar : ⊥ → (l : Level) → Set l → Set Bar x l A with x Bar x l A | () -- Bug.agda:25,1-15 -- ⊥ !=< Level of type Set -- when checking that the expression w has type Level
(* Property from Case-Analysis for Rippling and Inductive Proof, Moa Johansson, Lucas Dixon and Alan Bundy, ITP 2010. This Isabelle theory is produced using the TIP tool offered at the following website: https://github.com/tip-org/tools This file was originally provided as part of TIP benchmark at the following website: https://github.com/tip-org/benchmarks Yutaka Nagashima at CIIRC, CTU changed the TIP output theory file slightly to make it compatible with Isabelle2017. Some proofs were added by Yutaka Nagashima.*) theory TIP_prop_27 imports "../../Test_Base" begin datatype 'a list = nil2 | cons2 "'a" "'a list" datatype Nat = Z | S "Nat" fun y :: "'a list => 'a list => 'a list" where "y (nil2) y2 = y2" | "y (cons2 z2 xs) y2 = cons2 z2 (y xs y2)" fun x :: "Nat => Nat => bool" where "x (Z) (Z) = True" | "x (Z) (S z2) = False" | "x (S x2) (Z) = False" | "x (S x2) (S y22) = x x2 y22" fun elem :: "Nat => Nat list => bool" where "elem z (nil2) = False" | "elem z (cons2 z2 xs) = (if x z z2 then True else elem z xs)" theorem property0 : "((elem z ys) ==> (elem z (y xs ys)))"(*This problem is very similar to TIP_prop_26.thy*) find_proof DInd apply (induct arbitrary: ys rule: TIP_prop_27.elem.induct) apply auto done end
function area=hypersphereArea(r,numDim) %%HYPERSPHEREAREA Determine the surface area of a hypersphere of a given % radius in a given number of dimensions. % %INPUTS: r The radius of the hypersphere. r>0. % numDim The number of dimensions of the hypersphere. numDim>=1. One % dimensions is a line, two a circle, three a sphere, etc. % %OUTPUTS: area The area of the hypersphere. % %The surface area of a hypersphere is given in terms of the gamma function %in [1]. % %REFERENCES: %[1] S. Li, "Concise formulas for the area and volume of a hyperspherical % cap," Asian Journal of Mathematics and Statistics, vol. 4, no. 1, pp. % 66-70, 2011. % %October 2016 David F. Crouse, Naval Research Laboratory, Washington D.C. %(UNCLASSIFIED) DISTRIBUTION STATEMENT A. Approved for public release. area=2*pi^(numDim/2)/gamma(numDim/2)*r^(numDim-1); end %LICENSE: % %The source code is in the public domain and not licensed or under %copyright. The information and software may be used freely by the public. %As required by 17 U.S.C. 403, third parties producing copyrighted works %consisting predominantly of the material produced by U.S. government %agencies must provide notice with such work(s) identifying the U.S. %Government material incorporated and stating that such material is not %subject to copyright protection. % %Derived works shall not identify themselves in a manner that implies an %endorsement by or an affiliation with the Naval Research Laboratory. % %RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF THE %SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY THE NAVAL %RESEARCH LABORATORY FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE ACTIONS %OF RECIPIENT IN THE USE OF THE SOFTWARE.
(** [TypeTheory.CwF_TypeCat.CwF_SplitTypeCat_Maps] Part of the [TypeTheory] library (Ahrens, Lumsdaine, Voevodsky, 2015–present). Main contents: - definition of _compatibility_ between term-structures and _q_-morphism structures [iscompatible_term_qq] - construction, from any term-structure, of a compatible _q_-morphism structure [compatible_qq_from_term] - construction, from any _q_-morphism structure, of a compatible term-structure [compatible_term_from_qq] *) Require Import UniMath.Foundations.All. Require Import UniMath.MoreFoundations.All. Require Import TypeTheory.Auxiliary.CategoryTheoryImports. Require Import TypeTheory.Auxiliary.Auxiliary. Require Import TypeTheory.Auxiliary.CategoryTheory. Require Import TypeTheory.Auxiliary.Pullbacks. Require Import TypeTheory.Auxiliary.SetsAndPresheaves. Require Import TypeTheory.CwF_TypeCat.CwF_SplitTypeCat_Defs. Section Fix_Base_Category. Context {C : category} {X : obj_ext_structure C}. Local Notation "Γ ◂ A" := (comp_ext _ Γ A) (at level 30). Local Notation "'Ty'" := (fun X Γ => TY X $p Γ) (at level 10). Local Notation "A [ f ]" := (#p (TY X) f A) (at level 4). Local Notation "'Tm'" := (fun Y Γ => TM Y $p Γ) (at level 10). Local Notation Δ := comp_ext_compare. (** * Compatibility between term-structures and q-morphism structures We define _compatibility_ between a term-structure and a _q_-morphism structure, as a commutativity condition between the _q_-morphisms and the maps _Q_ of the term-structure. *) Section Compatible_Structures. (** ** Definitions *) Definition iscompatible_term_qq (Y : term_fun_structure C X) (Z : qq_morphism_structure X) : UU := ∏ Γ Γ' A (f : C⟦Γ', Γ⟧), te Y A[f] = #p (TM _) (qq Z f A) (te Y A). Lemma isaprop_iscompatible_term_qq (Y : term_fun_structure C X) (Z : qq_morphism_structure X) : isaprop (iscompatible_term_qq Y Z). Proof. do 4 (apply impred; intro). apply setproperty. Qed. Definition compatible_term_structure (Z : qq_morphism_structure X) : UU := ∑ Y : term_fun_structure _ X, iscompatible_term_qq Y Z. Coercion term_structure_of_compatible {Z : qq_morphism_structure X} : compatible_term_structure Z -> term_fun_structure _ X := pr1. Definition compatible_qq_morphism_structure (Y : term_fun_structure _ X) : UU := ∑ Z : qq_morphism_structure X, iscompatible_term_qq Y Z. Coercion qq_morphism_structure_of_compatible {Y : term_fun_structure _ X} : compatible_qq_morphism_structure Y -> qq_morphism_structure X := pr1. Definition iscompatible'_term_qq (Y : term_fun_structure C X) (Z : qq_morphism_structure X) : UU := ∏ Γ Γ' A (f : C⟦Γ', Γ⟧) , Q Y A[f] = #Yo (qq Z f A) ;; Q Y A. (** ** Misc lemmas on compatibility *) (* TODO: try to eliminate older [iscompatible'] entirely, and remove both it and this lemma. *) Definition iscompatible_iscompatible' (Y : term_fun_structure C X) (Z : qq_morphism_structure X) : iscompatible_term_qq Y Z <-> iscompatible'_term_qq Y Z. Proof. unfold iscompatible_term_qq, iscompatible'_term_qq. split; intros H Γ Γ' A f; specialize (H Γ Γ' A f). - apply nat_trans_eq. { apply homset_property. } intros Γ''. cbn. unfold yoneda_objects_ob, yoneda_morphisms_data. apply funextsec; intros g. etrans. apply maponpaths, H. apply pathsinv0, functor_comp_pshf. - assert (H' := nat_trans_eq_pointwise H); clear H. assert (H'' := toforallpaths (H' _) (identity _)); clear H'. cbn in H''; unfold yoneda_morphisms_data in H''. refine (_ @ H'' @ _). + apply pathsinv0, functor_id_pshf. + apply maponpaths_2, id_left. Qed. End Compatible_Structures. (* TODO: find more natural home for this *) Lemma map_from_term_recover {Y} {Z} (W : iscompatible_term_qq Y Z) {Γ' Γ : C} {A : Ty X Γ} (f : Γ' --> Γ ◂ A) {e : (pp Y) $nt (Q Y A $nt f) = A [ f ;; π A ]} : pr1 (term_to_section (Q Y A $nt f)) ;; Δ e ;; qq Z (f ;; π A) A = f. Proof. assert (W' : iscompatible'_term_qq Y Z). apply iscompatible_iscompatible'; assumption. unfold iscompatible'_term_qq in W'. apply (Q_pp_Pb_unique Y). - unfold yoneda_morphisms_data; cbn. etrans. apply @pathsinv0, assoc. etrans. apply maponpaths, qq_π. etrans. apply @pathsinv0, assoc. etrans. apply maponpaths. etrans. apply assoc. apply maponpaths_2, comp_ext_compare_π. etrans. apply assoc. etrans. 2: { apply id_left. } apply maponpaths_2. exact (pr2 (term_to_section _)). - etrans. refine (!toforallpaths (nat_trans_eq_pointwise (W' _ _ _ _) _) _). etrans. apply Q_comp_ext_compare. apply term_to_section_recover. Qed. (** * Term-structures from _q_-morphism structures Given a _q_-morphism structure, we construct from it a (compatible) term structure: its terms are just the _sections_ of the projection maps, and its _Q_-maps are constructed from the _q_-morphisms. Key definitions: [term_from_qq], [iscompatible_term_from_qq] *) Section compatible_term_structure_from_qq. Variable Z : qq_morphism_structure X. (** ** Definition of the presheaf of terms *) (* TODO: abstract second half out as “sections”, with pr1 an access function + a coercion. *) Definition tm_from_qq_carrier (Γ : C) : UU := ∑ A : Ty X Γ, ∑ s : C⟦Γ, Γ ◂ A⟧, s ;; π _ = identity _ . Lemma isaset_tm_from_qq Γ : isaset (tm_from_qq_carrier Γ). Proof. apply (isofhleveltotal2 2). - apply setproperty. - intro. apply (isofhleveltotal2 2). + apply homset_property. + intro. apply isasetaprop. apply homset_property. Qed. Definition tm_from_qq_functor_ob Γ : hSet := make_hSet _ (isaset_tm_from_qq Γ). Definition tm_from_qq_functor_mor Γ Γ' (f : C⟦Γ',Γ⟧) : tm_from_qq_carrier Γ → tm_from_qq_carrier Γ'. Proof. intro Ase. exists ((pr1 Ase) [f]). eapply pb_of_section. - apply (qq_π_Pb Z). - apply (pr2 (pr2 Ase)). Defined. Definition tm_from_qq_functor_data : functor_data C^op HSET. Proof. exists tm_from_qq_functor_ob. exact tm_from_qq_functor_mor. Defined. Lemma section_eq_from_tm_from_qq_eq {Γ} {t t' : (tm_from_qq_functor_data Γ : hSet)} (e : t = t') : pr1 (pr2 t) ;; Δ (maponpaths pr1 e) = pr1 (pr2 t'). Proof. destruct e; simpl. etrans. apply maponpaths, comp_ext_compare_id_general. apply id_right. Qed. Lemma tm_from_qq_eq {Γ} (t t' : (tm_from_qq_functor_data Γ : hSet)) (eA : pr1 t = pr1 t') (es : (pr1 (pr2 t)) ;; Δ eA = (pr1 (pr2 t'))) : t = t'. Proof. destruct t as [A [s e]], t' as [A' [s' e']]; simpl in *. use total2_paths_f; simpl. apply eA. apply subtypePath. intro; apply homset_property. simpl. eapply pathscomp0. use (pr1_transportf (Ty X Γ)). simpl. eapply pathscomp0. apply functtransportf. eapply pathscomp0. eapply pathsinv0. apply idtoiso_postcompose. exact es. Qed. (* A useful more specialised case of equality on terms. *) Lemma tm_from_qq_eq' {Γ : C} (A : Ty X Γ) {Γ'} {f f' : Γ' --> Γ} (e_ff' : f = f') {s : Γ' --> Γ' ◂ A[f]} (es : s ;; π _ = identity _) {s' : Γ' --> Γ' ◂ A[f']} (es' : s' ;; π _ = identity _) (e_ss' : s' = s ;; Δ (maponpaths (fun f => A[f]) e_ff')) : (( A[f] ,, (s,, es)) : tm_from_qq_functor_data Γ' : hSet) = (A[f'] ,, (s',, es')). Proof. destruct e_ff'; simpl in *. apply maponpaths. rewrite id_right in e_ss'. destruct e_ss'. apply maponpaths. apply homset_property. Qed. Lemma is_functor_tm_from_qq : is_functor tm_from_qq_functor_data. Proof. split; [unfold functor_idax | unfold functor_compax]. - intro Γ; apply funextsec; intro t. destruct t as [A [s e]]; cbn. use tm_from_qq_eq; simpl. + apply functor_id_pshf. + etrans. apply maponpaths, @pathsinv0, qq_id. etrans. apply (PullbackArrow_PullbackPr2 (make_Pullback _ _)). apply id_left. - intros Γ Γ' Γ'' f g; apply funextsec; intro t. destruct t as [A [s e]]; cbn in *. use tm_from_qq_eq; simpl. + apply functor_comp_pshf. + { apply PullbackArrowUnique; cbn. - rewrite <- assoc. etrans. { apply maponpaths, comp_ext_compare_π. } apply (PullbackArrow_PullbackPr1 (make_Pullback _ _)). - apply (MorphismsIntoPullbackEqual (qq_π_Pb Z _ _)). + etrans. 2: { apply assoc. } etrans. 2: { apply maponpaths, @pathsinv0. apply (PullbackArrow_PullbackPr1 (make_Pullback _ _)). } etrans. 2: { apply @pathsinv0, id_right. } etrans. apply @pathsinv0, assoc. etrans. eapply maponpaths, qq_π. etrans. apply assoc. etrans. 2: { apply id_left. } apply maponpaths_2. etrans. apply @pathsinv0, assoc. etrans. { apply maponpaths, comp_ext_compare_π. } apply (PullbackArrow_PullbackPr1 (make_Pullback _ _)). + repeat rewrite <- assoc. etrans. apply maponpaths. rewrite assoc. apply @pathsinv0, qq_comp_general. etrans. apply (PullbackArrow_PullbackPr2 (make_Pullback _ _)). etrans. apply @pathsinv0, assoc. apply maponpaths. apply @pathsinv0. apply (PullbackArrow_PullbackPr2 (make_Pullback _ _)). } Qed. Definition tm_from_qq : functor _ _ := tpair _ _ is_functor_tm_from_qq. Arguments tm_from_qq : simpl never. (* TODO: search for uses of [tm_from_qq_eq] to see where this can be used (should save a good few lines of code). *) Lemma tm_from_qq_eq_reindex {Γ Γ' : C} (f : Γ' --> Γ) (Ase : tm_from_qq Γ : hSet) (Ase' : tm_from_qq Γ' : hSet) (eA : pr1 Ase' = #p (TY X) f (pr1 Ase)) (es : pr1 (pr2 Ase') ;; Δ eA ;; qq Z f _ = f ;; pr1 (pr2 Ase)) : Ase' = # tm_from_qq f Ase. Proof. use tm_from_qq_eq. - exact eA. - cbn. apply PullbackArrowUnique; cbn. + etrans. apply @pathsinv0, assoc. etrans. apply maponpaths, comp_ext_compare_π. apply (pr2 (pr2 Ase')). + apply es. Qed. Lemma pr2_tm_from_qq_paths {Γ : C} {t t' : tm_from_qq Γ : hSet} (e : t = t') : pr1 (pr2 t) = pr1 (pr2 t') ;; (Δ (maponpaths pr1 (!e))) . Proof. destruct e. apply pathsinv0, id_right. Qed. Definition pp_from_qq_data (Γ : C^op) : tm_from_qq Γ --> Ty X Γ. Proof. exact pr1. Defined. Lemma is_nat_trans_pp_from_qq : is_nat_trans _ _ pp_from_qq_data. Proof. intros Γ Γ' f. apply idpath. Defined. Definition pp_from_qq : preShv C ⟦tm_from_qq, TY X⟧ := tpair _ _ is_nat_trans_pp_from_qq. Arguments pp_from_qq : simpl never. Definition te_from_qq {Γ:C} (A : Ty X Γ) : tm_from_qq $p (Γ ◂ A). Proof. exists A [π A]. apply (section_from_diagonal _ (qq_π_Pb Z _ _)). exists (identity _). apply id_left. Defined. Definition term_from_qq_data : term_fun_structure_data C X. Proof. exists tm_from_qq. exists pp_from_qq. intros; apply te_from_qq. Defined. (** ** Typing of te, and pullback property *) Section Tm_fun_axioms_from_qq. Variable Γ : C. Variable A : Ty X Γ. Definition Q_from_qq : Yo (Γ ◂ A) --> tm_from_qq. Proof. simpl in A. apply yy, te_from_qq. Defined. Definition pp_te_from_qq : pp_from_qq $nt (te_from_qq A) = A [ π A ]. Proof. apply idpath. Qed. Definition Q_pp_from_qq : # Yo (π _) ;; yy A = Q_from_qq ;; pp_from_qq. Proof. apply (@term_fun_str_square_comm _ _ term_from_qq_data). apply pp_te_from_qq. Qed. Definition section_qq_π (Γ' : C) (f : C⟦ Γ', Γ⟧) (s : C ⟦ Γ', Γ' ◂ A[f] ⟧) (e : s ;; π (A[f]) = identity Γ') : s ;; qq Z f A ;; π A = f. Proof. etrans. apply @pathsinv0, assoc. etrans. apply @maponpaths, qq_π. etrans. apply assoc. etrans. apply maponpaths_2. exact e. apply id_left. Qed. Lemma Q_from_qq_reconstruction {Γ' : C} ( ft : C ⟦ Γ', Γ ◂ A ⟧ ) : ft = pr1 (pr2 (Q_from_qq $nt ft)) ;; qq Z ft _ ;; qq Z _ A. Proof. cbn. apply pathsinv0. etrans. { apply maponpaths_2. apply (PullbackArrow_PullbackPr2 (make_Pullback _ _)). } use (_ @ id_right _). etrans. apply @pathsinv0, assoc. apply maponpaths. apply (PullbackArrow_PullbackPr2 (make_Pullback _ _)). Qed. (* TODO: try to speed this up! *) Lemma isPullback_Q_pp_from_qq : isPullback Q_pp_from_qq. Proof. apply pb_if_pointwise_pb. intros Γ'. apply isPullback_HSET. intros f [A' [s e]] e_A_A'; simpl in e_A_A'. destruct e_A_A'. use tpair. - exists (s ;; qq Z f A). simpl; unfold yoneda_morphisms_data. split. { apply (section_qq_π _ _ _ e). } use tm_from_qq_eq. cbn. + etrans. apply @pathsinv0, functor_comp_pshf. apply maponpaths_2. cbn. etrans. apply @pathsinv0, assoc. etrans. apply maponpaths, qq_π. etrans. apply assoc. etrans. apply maponpaths_2, e. apply id_left. + use (map_into_Pb_unique (qq_π_Pb Z _ _ )). * cbn. use (_ @ !e). etrans. apply @pathsinv0, assoc. etrans. apply @maponpaths, comp_ext_compare_π. apply (PullbackArrow_PullbackPr1 (make_Pullback _ _)). * etrans. apply @pathsinv0, assoc. use (maponpaths _ _ @ _). { use (qq Z _ _ ;; qq Z _ _). } -- etrans. 2: { eapply z_iso_inv_on_right. etrans. 2: { apply @pathsinv0, assoc. } apply qq_comp. } apply @pathsinv0, z_iso_inv_on_right. apply @pathsinv0. etrans. apply assoc. etrans. apply maponpaths_2, @pathsinv0, comp_ext_compare_comp. apply comp_ext_compare_qq_general. apply (section_qq_π _ _ _ e). -- etrans. { apply assoc. } etrans. { apply maponpaths_2, (PullbackArrow_PullbackPr2 (make_Pullback _ _)). } etrans. { apply @pathsinv0, assoc. } etrans. 2: { apply id_right. } apply maponpaths, (PullbackArrow_PullbackPr2 (make_Pullback _ _)). - intros ft. apply subtypePath. { intro. apply isapropdirprod. + apply homset_property. + apply setproperty. } cbn. destruct ft as [ ft [ e1 e2 ] ]. cbn; cbn in e1. unfold yoneda_morphisms_data in e1. etrans. apply Q_from_qq_reconstruction. etrans. apply maponpaths_2, maponpaths_2, (pr2_tm_from_qq_paths e2). cbn. etrans. apply @pathsinv0, assoc. etrans. apply @pathsinv0, assoc. apply maponpaths. etrans. apply maponpaths. apply @pathsinv0, z_iso_inv_on_right. use (_ @ !assoc _ _ _). apply qq_comp. etrans. 2: { exact (comp_ext_compare_qq Z (!e1) _). } etrans. apply assoc. apply maponpaths_2. etrans. apply maponpaths, @pathsinv0, comp_ext_compare_inv. apply pathsinv0, comp_ext_compare_comp_general. Time Qed. End Tm_fun_axioms_from_qq. Arguments Q_from_qq { _ } _ : simpl never. Arguments tm_from_qq : simpl never. Arguments pp_from_qq : simpl never. (** ** Assembly into a compatible term-structure *) Definition term_from_qq : term_fun_structure C X. Proof. exists term_from_qq_data. intros ? ?. exists (pp_te_from_qq _ _). apply isPullback_Q_pp_from_qq. Defined. Definition iscompatible_term_from_qq : iscompatible_term_qq term_from_qq Z. Proof. intros ? ? ? ?. (* TODO: use [tm_from_qq_eq'] here *) use tm_from_qq_eq; simpl. - etrans. apply pathsinv0, functor_comp_pshf. etrans. 2: { apply functor_comp_pshf. } apply maponpaths_2; cbn. apply @pathsinv0, qq_π. - apply PullbackArrowUnique. + cbn. etrans. apply @pathsinv0, assoc. etrans. apply maponpaths, comp_ext_compare_π. apply (PullbackArrow_PullbackPr1 (make_Pullback _ _)). + apply (map_into_Pb_unique (qq_π_Pb Z _ _)). * cbn. etrans. apply @pathsinv0, assoc. etrans. apply maponpaths, qq_π. etrans. apply assoc. etrans. apply maponpaths_2. etrans. apply @pathsinv0, assoc. etrans. apply maponpaths, comp_ext_compare_π. apply (PullbackArrow_PullbackPr1 (make_Pullback _ _)). etrans. apply id_left. apply pathsinv0. etrans. apply @pathsinv0, assoc. etrans. apply maponpaths. apply (PullbackArrow_PullbackPr1 (make_Pullback _ _)). apply id_right. * cbn. etrans. apply @pathsinv0, assoc. etrans. apply @pathsinv0, assoc. etrans. apply maponpaths. etrans. apply maponpaths_2. etrans. apply comp_ext_compare_comp. etrans. apply maponpaths, comp_ext_compare_comp. apply assoc. etrans. apply @pathsinv0, assoc. etrans. apply maponpaths. etrans. apply assoc. apply @pathsinv0. apply qq_comp_general. etrans. apply @pathsinv0, assoc. etrans. apply maponpaths, comp_ext_compare_qq. etrans. apply maponpaths, qq_comp. apply assoc. etrans. apply assoc. etrans. apply maponpaths_2. etrans. apply maponpaths. etrans. apply assoc. etrans. apply maponpaths_2. etrans. apply @pathsinv0, comp_ext_compare_comp. apply comp_ext_compare_id_general. apply id_left. apply (PullbackArrow_PullbackPr2 (make_Pullback _ _)). etrans. apply id_left. apply pathsinv0. etrans. apply @pathsinv0, assoc. etrans. apply maponpaths. apply (PullbackArrow_PullbackPr2 (make_Pullback _ _)). apply id_right. Time Qed. Definition compatible_term_from_qq : compatible_term_structure Z := (term_from_qq,, iscompatible_term_from_qq). End compatible_term_structure_from_qq. Arguments tm_from_qq : simpl never. Arguments tm_from_qq_functor_mor : simpl never. Arguments pp_from_qq : simpl never. Arguments te_from_qq : simpl never. Arguments Q_from_qq _ {_} _ : simpl never. (** * Defining a (compatible) _q_-morphism structure, given a term structure Key definitions: [qq_from_term], [iscompatible_qq_from_term] *) (* TODO: see if this section can be simplified to construct the q-morphisms more directly. *) Section compatible_comp_structure_from_term. Variable Y : term_fun_structure C X. Section qq_from_term. Variables Γ Γ' : C. Variable f : C⟦Γ', Γ⟧. Variable A : Ty X Γ. Let Xk := make_Pullback _ (isPullback_Q_pp Y A). (** ** Groundwork in presheaves We first construct maps of presheaves that will be the image of the _q_-morphisms under the Yoneda embedding. *) Definition Yo_of_qq : _ ⟦Yo (Γ' ◂ A[f]), Yo (Γ ◂ A) ⟧. Proof. use (PullbackArrow Xk). - apply (#Yo (π _) ;; #Yo f ). - apply (Q Y). - abstract ( clear Xk; assert (XT := Q_pp Y A[f]); eapply pathscomp0; try apply XT; clear XT; rewrite <- assoc; apply maponpaths; apply pathsinv0, yy_natural ). Defined. Lemma Yo_of_qq_commutes_1 : # Yo (π _ ) ;; # Yo f = Yo_of_qq ;; # Yo (π _ ) . Proof. apply pathsinv0. apply (PullbackArrow_PullbackPr1 Xk). Qed. Lemma Yo_of_qq_commutes_2 : Yo_of_qq ;; Q _ A = Q Y _ . Proof. apply (PullbackArrow_PullbackPr2 Xk). Qed. Lemma isPullback_Yo_of_qq : isPullback Yo_of_qq_commutes_1. Proof. simple refine (isPullback_two_pullback _ _ _ _ _ _ _ _ _ ). - apply (TY X). - apply (TM Y). - apply (yy A). - apply pp. - apply Q. - apply Q_pp. - apply isPullback_Q_pp. - match goal with [|- isPullback ?HH ] => generalize HH end. rewrite <- (@yy_natural C). rewrite Yo_of_qq_commutes_2. intro. apply isPullback_Q_pp. Qed. (** ** Construction of the _q_-morphisms *) Definition qq_term : _ ⟦Γ' ◂ A[f] , Γ ◂ A⟧. Proof. apply (invweq (make_weq _ (yoneda_fully_faithful _ _ _ ))). apply Yo_of_qq. Defined. Lemma Yo_qq_term_Yo_of_qq : # Yo qq_term = Yo_of_qq. Proof. unfold qq_term. assert (XT := homotweqinvweq (make_weq _ (yoneda_fully_faithful _ (Γ'◂ A[f]) (Γ ◂ A)))). apply XT. Qed. Lemma qq_commutes_1 : qq_term ;; π _ = π _ ;; f. Proof. assert (XT:= Yo_of_qq_commutes_1). rewrite <- Yo_qq_term_Yo_of_qq in XT. do 2 rewrite <- functor_comp in XT. apply (invmaponpathsweq (make_weq _ (yoneda_fully_faithful _ _ _ ))). apply @pathsinv0, XT. Qed. Definition isPullback_qq : isPullback (!qq_commutes_1). Proof. use (isPullback_preimage_square _ _ Yo). - apply yoneda_fully_faithful. - assert (XT:= isPullback_Yo_of_qq). match goal with |[|- isPullback ?HHH] => generalize HHH end. rewrite Yo_qq_term_Yo_of_qq. intro. assumption. Qed. End qq_from_term. (** ** Assembly into a compatible _q_-morphism structure. *) Definition qq_from_term_data : qq_morphism_data X. Proof. use tpair. - intros. apply qq_term. - cbn. intros. simpl. exists (qq_commutes_1 _ _ _ _ ). apply isPullback_qq. Defined. Lemma is_split_qq_from_term : qq_morphism_axioms qq_from_term_data. Proof. split. - intros Γ A. simpl. apply (invmaponpathsweq (make_weq _ (yoneda_fully_faithful _ _ _ ))). etrans; [ apply (homotweqinvweq (make_weq _ (yoneda_fully_faithful _ _ _ ))) | idtac ]. apply pathsinv0. unfold Yo_of_qq. apply PullbackArrowUnique. + etrans. apply maponpaths. cbn. apply idpath. rewrite <- functor_comp. etrans. eapply pathsinv0. use (functor_comp Yo). apply maponpaths. etrans. { apply comp_ext_compare_π. } apply pathsinv0, id_right. + etrans. apply maponpaths. cbn. apply idpath. apply comp_ext_compare_Q. - intros. apply (invmaponpathsweq (make_weq _ (yoneda_fully_faithful _ _ _ ))). etrans; [ apply (homotweqinvweq (make_weq _ (yoneda_fully_faithful _ _ _ ))) | idtac ]. sym. apply PullbackArrowUnique. + etrans. apply maponpaths. cbn. apply idpath. rewrite <- functor_comp. etrans. eapply pathsinv0. use (functor_comp Yo). apply maponpaths. rewrite <- assoc. rewrite qq_commutes_1 . repeat rewrite assoc. rewrite assoc4. etrans. apply maponpaths_2. apply maponpaths. eapply qq_commutes_1 . apply maponpaths_2. repeat rewrite assoc. apply maponpaths_2. apply comp_ext_compare_π. + etrans. apply maponpaths. cbn. apply idpath. etrans. apply maponpaths_2. apply functor_comp. rewrite <- assoc. rewrite Yo_qq_term_Yo_of_qq. rewrite Yo_of_qq_commutes_2 . etrans. apply maponpaths_2. apply functor_comp. rewrite <- assoc. etrans. apply maponpaths. apply maponpaths_2. apply Yo_qq_term_Yo_of_qq. etrans. apply maponpaths. apply Yo_of_qq_commutes_2 . apply comp_ext_compare_Q. Qed. Definition qq_from_term : qq_morphism_structure X. Proof. exists qq_from_term_data. apply is_split_qq_from_term. Defined. Lemma iscompatible'_qq_from_term : iscompatible'_term_qq Y qq_from_term. Proof. intros Γ Γ' A f. assert (XR:= Yo_of_qq_commutes_2). apply pathsinv0. rewrite Yo_qq_term_Yo_of_qq. apply XR. Qed. Lemma iscompatible_qq_from_term : iscompatible_term_qq Y qq_from_term. Proof. apply (pr2 (iscompatible_iscompatible' _ _)). apply iscompatible'_qq_from_term. Qed. Definition compatible_qq_from_term : compatible_qq_morphism_structure Y := (qq_from_term,, iscompatible_qq_from_term). End compatible_comp_structure_from_term. End Fix_Base_Category.
theory IMPExpMult imports Main begin type_synonym vname = string datatype aexp = N int | V vname | Plus aexp aexp type_synonym val = int type_synonym state = "vname \<Rightarrow> val" fun aval :: "aexp \<Rightarrow> state \<Rightarrow> val" where "aval (N n) s = n" | "aval (V x) s = s x" | "aval (Plus a1 a2) s = aval a1 s + aval a2 s" definition exp :: "aexp" where "exp = (Plus (N 5) (V ''x''))" value "aval exp ((\<lambda> x. 0)(''x'' := 1))" fun asimp_const :: "aexp \<Rightarrow> aexp" where "asimp_const (N n) = N n" | "asimp_const (V x) = V x" | "asimp_const (Plus a1 a2) = (case (asimp_const a1, asimp_const a2) of (N n1, N n2) \<Rightarrow> N(n1 + n2) | (b1, b2) \<Rightarrow> Plus b1 b2)" lemma "aval (asimp_const a) s = aval a s" apply(induction a) apply(auto split: aexp.split) done fun plus :: "aexp \<Rightarrow> aexp \<Rightarrow> aexp" where "plus (N i1) (N i2) = N(i1 + i2)" | "plus (N i) a = (if i=0 then a else Plus (N i) a)" | "plus a (N i) = (if i=0 then a else Plus a (N i))" | "plus a1 a2 = Plus a1 a2" lemma aval_plus: "aval (plus a1 a2) s = aval a1 s + aval a2 s" apply(induction rule: plus.induct) apply(auto) done fun asimp :: "aexp \<Rightarrow> aexp" where "asimp (N n) = N n" | "asimp (V x) = V x" | "asimp (Plus a1 a2) = plus (asimp a1) (asimp a2)" lemma "aval (asimp a) s = aval a s" apply(induction a) apply(auto simp add: aval_plus) done fun optimal_plus :: "aexp \<Rightarrow> aexp \<Rightarrow> bool" where "optimal_plus (N _) (N _) = False" | "optimal_plus a1 a2 = True" fun optimal :: "aexp \<Rightarrow> bool" where "optimal (N _) = True" | "optimal (V _) = True" | "optimal (Plus a1 a2) = ((optimal a1) \<and> (optimal a2) \<and> (optimal_plus a1 a2))" theorem "optimal(asimp_const a)" apply(induction a) apply(auto split: aexp.split) done fun full_plus :: "aexp \<Rightarrow> aexp \<Rightarrow> aexp" where "full_plus (N n1) (N n2) = N (n1 + n2)" | "full_plus (N n1) (Plus a (N n2)) = (Plus a (N (n1 + n2)))" | "full_plus (Plus a (N n1)) (N n2) = (Plus a (N (n1 + n2)))" | "full_plus a1 a2 = (Plus a1 a2)" lemma full_plus_aval: "aval (full_plus a1 a2) s = aval a1 s + aval a2 s" apply(induction rule: full_plus.induct) apply(auto) done fun full_asimp :: "aexp \<Rightarrow> aexp" where "full_asimp (N n) = N n" | "full_asimp (V x) = V x" | "full_asimp (Plus a1 a2) = full_plus (full_asimp a1) (full_asimp a2)" value "full_asimp (Plus (N 1) (Plus (V ''x'') (N 2)))" theorem "aval (full_asimp a) s = aval a s" apply(induction a arbitrary: s) apply(auto simp add: full_plus_aval) done fun subst :: "vname \<Rightarrow> aexp \<Rightarrow> aexp \<Rightarrow> aexp" where "subst v e (V x) = (if v = x then e else (V x))" | "subst v e (Plus a1 a2) = (Plus (subst v e a1) (subst v e a2))" | "subst v e a = a" value "subst ''x'' (N 2) (Plus (V ''x'') (N 1))" lemma subst_preserves_semantics: "aval (subst x a e) s = aval e (s(x := aval a s))" apply(induction e) apply(auto) done theorem "aval a1 s = aval a2 s \<Longrightarrow> aval (subst x a1 e) s = aval (subst x a2 e) s" apply(simp add: subst_preserves_semantics) done end
% mainfile: ../../../../master.tex \subsection{Creating a New Build (Conditional Compilation)} \label{task:20140324_jkn0} \tags{development, building} \authors{jkn} \files{newBuild.py} %\persons{} As described in the user guide in task~\ref{task:20140315_jkn0}, it should be possible to compile the diary only for specific tags and dates. The Python script {\tt newBuild.py} should handle this by doing the following. \begin{enumerate} \item The input parameters must be validated and default values for the non-specified parameters must be set. \begin{itemize} \item If no parameters are given, the default build of all tasks within the last 90 days should be selected. \item If only tags are given, tasks labelled with these tags from all time should be selected. \item If only dates are selected, all tags and tasks from these dates should be selected. \end{itemize} \item Scan all files in the entries directory satisfying the selected dates. Create a list of those tasks which are labelled with the selected tags and/or task labels. Moreover, retrieve all other tags as well. \item From the list of extracted tags, create the tag dictionary in the {\tt buildFiles} folder. \item From the list of selected tasks, create the task list file in the {\tt buildFiles} folder. In addition to including the filenames of the paths, the task list file must also format years, months, and days as parts, chapters, and sections. \end{enumerate}
#ifndef CLIPPER_LIB_PERSISTENT_STATE_HPP #define CLIPPER_LIB_PERSISTENT_STATE_HPP #include <atomic> #include <functional> #include <shared_mutex> #include <tuple> #include <unordered_map> #include <boost/optional.hpp> #include <redox.hpp> #include "constants.hpp" #include "datatypes.hpp" namespace clipper { // The entries in the key are query_label, user_id, model_hash using StateKey = std::tuple<std::string, long, long>; size_t state_key_hash(const StateKey& key); // Threadsafe, non-copyable state storage class StateDB { public: StateDB(); ~StateDB(); // Disallow copies because of the mutex StateDB(const StateDB&) = delete; StateDB& operator=(const StateDB&) = delete; StateDB(StateDB&&) = default; StateDB& operator=(StateDB&&) = default; /** * Get the value associated with the key if present * in the DB. * * @return Returns boost::none if the key is not found. */ boost::optional<std::string> get(const StateKey& key); /** * Puts the key-value pair into the DB. If the key already * exists in the DB, the new value will blindly overwrite the old * value. * * @return Logs an error and returns false if there was an unexpected * error with the put. */ bool put(StateKey key, std::string value); /** * Removes the entry associated with the key from the DB if present. * If the key is not present in the DB, this method has no effect. * * @return Logs an error and returns false if there was an unexpected * error with the removal. */ bool remove(StateKey key); /** * Returns the total number of keys in the DB. */ int num_entries(); private: redox::Redox redis_connection_; }; } // namespace clipper #endif // CLIPPER_LIB_PERSISTENT_STATE_HPP
[GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) ⊢ MeasurableSet {x | Integrable (f x)} [PROOFSTEP] simp_rw [Integrable, hf.of_uncurry_left.aestronglyMeasurable, true_and_iff] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) ⊢ MeasurableSet {x | HasFiniteIntegral (f x)} [PROOFSTEP] exact measurableSet_lt (Measurable.lintegral_prod_right hf.ennnorm) measurable_const [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) ⊢ StronglyMeasurable fun x => ∫ (y : β), f x y ∂ν [PROOFSTEP] borelize E [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E ⊢ StronglyMeasurable fun x => ∫ (y : β), f x y ∂ν [PROOFSTEP] haveI : SeparableSpace (range (uncurry f) ∪ {0} : Set E) := hf.separableSpace_range_union_singleton [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) ⊢ StronglyMeasurable fun x => ∫ (y : β), f x y ∂ν [PROOFSTEP] let s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn _ hf.measurable (range (uncurry f) ∪ {0}) 0 (by simp) [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) ⊢ 0 ∈ range (uncurry f) ∪ {0} [PROOFSTEP] simp [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) ⊢ StronglyMeasurable fun x => ∫ (y : β), f x y ∂ν [PROOFSTEP] let s' : ℕ → α → SimpleFunc β E := fun n x => (s n).comp (Prod.mk x) measurable_prod_mk_left [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) ⊢ StronglyMeasurable fun x => ∫ (y : β), f x y ∂ν [PROOFSTEP] let f' : ℕ → α → E := fun n => {x | Integrable (f x) ν}.indicator fun x => (s' n x).integral ν [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) ⊢ StronglyMeasurable fun x => ∫ (y : β), f x y ∂ν [PROOFSTEP] have hf' : ∀ n, StronglyMeasurable (f' n) := by intro n; refine' StronglyMeasurable.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 [SimpleFunc.mem_range]; rintro ⟨z, rfl⟩; exact ⟨(x, z), rfl⟩ simp only [SimpleFunc.integral_eq_sum_of_subset (this _)] refine' Finset.stronglyMeasurable_sum _ fun x _ => _ refine' (Measurable.ennreal_toReal _).stronglyMeasurable.smul_const _ simp (config := { singlePass := true }) only [SimpleFunc.coe_comp, preimage_comp] apply measurable_measure_prod_mk_left exact (s n).measurableSet_fiber x [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) ⊢ ∀ (n : ℕ), StronglyMeasurable (f' n) [PROOFSTEP] intro n [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) n : ℕ ⊢ StronglyMeasurable (f' n) [PROOFSTEP] refine' StronglyMeasurable.indicator _ (measurableSet_integrable hf) [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) n : ℕ ⊢ StronglyMeasurable fun x => SimpleFunc.integral ν (s' n x) [PROOFSTEP] 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 [SimpleFunc.mem_range]; rintro ⟨z, rfl⟩; exact ⟨(x, z), rfl⟩ [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) n : ℕ ⊢ ∀ (x : α), Finset.filter (fun x => x ≠ 0) (SimpleFunc.range (s' n x)) ⊆ SimpleFunc.range (s n) [PROOFSTEP] intro x [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) n : ℕ x : α ⊢ Finset.filter (fun x => x ≠ 0) (SimpleFunc.range (s' n x)) ⊆ SimpleFunc.range (s n) [PROOFSTEP] refine' Finset.Subset.trans (Finset.filter_subset _ _) _ [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) n : ℕ x : α ⊢ SimpleFunc.range (s' n x) ⊆ SimpleFunc.range (s n) [PROOFSTEP] intro y [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) n : ℕ x : α y : E ⊢ y ∈ SimpleFunc.range (s' n x) → y ∈ SimpleFunc.range (s n) [PROOFSTEP] simp_rw [SimpleFunc.mem_range] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) n : ℕ x : α y : E ⊢ y ∈ range ↑(SimpleFunc.comp (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) n) (Prod.mk x) (_ : Measurable (Prod.mk x))) → y ∈ range ↑(SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) n) [PROOFSTEP] rintro ⟨z, rfl⟩ [GOAL] case intro α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) n : ℕ x : α z : β ⊢ ↑(SimpleFunc.comp (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) n) (Prod.mk x) (_ : Measurable (Prod.mk x))) z ∈ range ↑(SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) n) [PROOFSTEP] exact ⟨(x, z), rfl⟩ [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝² : MeasurableSpace E := borel E this✝¹ : BorelSpace E this✝ : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) n : ℕ this : ∀ (x : α), Finset.filter (fun x => x ≠ 0) (SimpleFunc.range (s' n x)) ⊆ SimpleFunc.range (s n) ⊢ StronglyMeasurable fun x => SimpleFunc.integral ν (s' n x) [PROOFSTEP] simp only [SimpleFunc.integral_eq_sum_of_subset (this _)] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝² : MeasurableSpace E := borel E this✝¹ : BorelSpace E this✝ : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) n : ℕ this : ∀ (x : α), Finset.filter (fun x => x ≠ 0) (SimpleFunc.range (s' n x)) ⊆ SimpleFunc.range (s n) ⊢ StronglyMeasurable fun x => Finset.sum (SimpleFunc.range (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) n)) fun x_1 => ENNReal.toReal (↑↑ν (↑(SimpleFunc.comp (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) n) (Prod.mk x) (_ : Measurable (Prod.mk x))) ⁻¹' {x_1})) • x_1 [PROOFSTEP] refine' Finset.stronglyMeasurable_sum _ fun x _ => _ [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝² : MeasurableSpace E := borel E this✝¹ : BorelSpace E this✝ : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) n : ℕ this : ∀ (x : α), Finset.filter (fun x => x ≠ 0) (SimpleFunc.range (s' n x)) ⊆ SimpleFunc.range (s n) x : E x✝ : x ∈ SimpleFunc.range (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) n) ⊢ StronglyMeasurable fun x_1 => ENNReal.toReal (↑↑ν (↑(SimpleFunc.comp (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) n) (Prod.mk x_1) (_ : Measurable (Prod.mk x_1))) ⁻¹' {x})) • x [PROOFSTEP] refine' (Measurable.ennreal_toReal _).stronglyMeasurable.smul_const _ [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝² : MeasurableSpace E := borel E this✝¹ : BorelSpace E this✝ : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) n : ℕ this : ∀ (x : α), Finset.filter (fun x => x ≠ 0) (SimpleFunc.range (s' n x)) ⊆ SimpleFunc.range (s n) x : E x✝ : x ∈ SimpleFunc.range (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) n) ⊢ Measurable fun x_1 => ↑↑ν (↑(SimpleFunc.comp (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) n) (Prod.mk x_1) (_ : Measurable (Prod.mk x_1))) ⁻¹' {x}) [PROOFSTEP] simp (config := { singlePass := true }) only [SimpleFunc.coe_comp, preimage_comp] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝² : MeasurableSpace E := borel E this✝¹ : BorelSpace E this✝ : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) n : ℕ this : ∀ (x : α), Finset.filter (fun x => x ≠ 0) (SimpleFunc.range (s' n x)) ⊆ SimpleFunc.range (s n) x : E x✝ : x ∈ SimpleFunc.range (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) n) ⊢ Measurable fun x_1 => ↑↑ν (Prod.mk x_1 ⁻¹' (↑(SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) n) ⁻¹' {x})) [PROOFSTEP] apply measurable_measure_prod_mk_left [GOAL] case hs α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝² : MeasurableSpace E := borel E this✝¹ : BorelSpace E this✝ : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) n : ℕ this : ∀ (x : α), Finset.filter (fun x => x ≠ 0) (SimpleFunc.range (s' n x)) ⊆ SimpleFunc.range (s n) x : E x✝ : x ∈ SimpleFunc.range (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) n) ⊢ MeasurableSet (↑(SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) n) ⁻¹' {x}) [PROOFSTEP] exact (s n).measurableSet_fiber x [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) ⊢ StronglyMeasurable fun x => ∫ (y : β), f x y ∂ν [PROOFSTEP] have h2f' : Tendsto f' atTop (𝓝 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 [SimpleFunc.coe_comp]; exact SimpleFunc.norm_approxOn_zero_le _ _ (x, y) n simp only [hfx, SimpleFunc.integral_eq_integral _ (this _), indicator_of_mem, mem_setOf_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) _ _ · refine' fun n => eventually_of_forall fun y => SimpleFunc.norm_approxOn_zero_le _ _ (x, y) n · exact hf.measurable · simp · refine' eventually_of_forall fun y => SimpleFunc.tendsto_approxOn _ _ _ -- Porting note: Lean 3 solved the following two subgoals on its own · exact hf.measurable.of_uncurry_left · simp apply subset_closure simp [-uncurry_apply_pair] · simp [hfx, integral_undef] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) ⊢ Tendsto f' atTop (𝓝 fun x => ∫ (y : β), f x y ∂ν) [PROOFSTEP] rw [tendsto_pi_nhds] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) ⊢ ∀ (x : α), Tendsto (fun i => f' i x) atTop (𝓝 (∫ (y : β), f x y ∂ν)) [PROOFSTEP] intro x [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) x : α ⊢ Tendsto (fun i => f' i x) atTop (𝓝 (∫ (y : β), f x y ∂ν)) [PROOFSTEP] by_cases hfx : Integrable (f x) ν [GOAL] case pos α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) x : α hfx : Integrable (f x) ⊢ Tendsto (fun i => f' i x) atTop (𝓝 (∫ (y : β), f x y ∂ν)) [PROOFSTEP] 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 [SimpleFunc.coe_comp]; exact SimpleFunc.norm_approxOn_zero_le _ _ (x, y) n [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) x : α hfx : Integrable (f x) ⊢ ∀ (n : ℕ), Integrable ↑(s' n x) [PROOFSTEP] intro n [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) x : α hfx : Integrable (f x) n : ℕ ⊢ Integrable ↑(s' n x) [PROOFSTEP] apply (hfx.norm.add hfx.norm).mono' (s' n x).aestronglyMeasurable [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) x : α hfx : Integrable (f x) n : ℕ ⊢ ∀ᵐ (a : β) ∂ν, ‖↑(s' n x) a‖ ≤ ((fun a => ‖f x a‖) + fun a => ‖f x a‖) a [PROOFSTEP] apply eventually_of_forall [GOAL] case hp α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) x : α hfx : Integrable (f x) n : ℕ ⊢ ∀ (x_1 : β), ‖↑(s' n x) x_1‖ ≤ ((fun a => ‖f x a‖) + fun a => ‖f x a‖) x_1 [PROOFSTEP] intro y [GOAL] case hp α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) x : α hfx : Integrable (f x) n : ℕ y : β ⊢ ‖↑(s' n x) y‖ ≤ ((fun a => ‖f x a‖) + fun a => ‖f x a‖) y [PROOFSTEP] simp_rw [SimpleFunc.coe_comp] [GOAL] case hp α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) x : α hfx : Integrable (f x) n : ℕ y : β ⊢ ‖(↑(SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) n) ∘ Prod.mk x) y‖ ≤ ((fun a => ‖f x a‖) + fun a => ‖f x a‖) y [PROOFSTEP] exact SimpleFunc.norm_approxOn_zero_le _ _ (x, y) n [GOAL] case pos α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝² : MeasurableSpace E := borel E this✝¹ : BorelSpace E this✝ : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) x : α hfx : Integrable (f x) this : ∀ (n : ℕ), Integrable ↑(s' n x) ⊢ Tendsto (fun i => f' i x) atTop (𝓝 (∫ (y : β), f x y ∂ν)) [PROOFSTEP] simp only [hfx, SimpleFunc.integral_eq_integral _ (this _), indicator_of_mem, mem_setOf_eq] [GOAL] case pos α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝² : MeasurableSpace E := borel E this✝¹ : BorelSpace E this✝ : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) x : α hfx : Integrable (f x) this : ∀ (n : ℕ), Integrable ↑(s' n x) ⊢ Tendsto (fun i => ∫ (x_1 : β), ↑(SimpleFunc.comp (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) i) (Prod.mk x) (_ : Measurable (Prod.mk x))) x_1 ∂ν) atTop (𝓝 (∫ (y : β), f x y ∂ν)) [PROOFSTEP] 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) _ _ [GOAL] case pos.refine'_1 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝² : MeasurableSpace E := borel E this✝¹ : BorelSpace E this✝ : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) x : α hfx : Integrable (f x) this : ∀ (n : ℕ), Integrable ↑(s' n x) ⊢ ∀ (n : ℕ), ∀ᵐ (a : β) ∂ν, ‖↑(SimpleFunc.comp (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) n) (Prod.mk x) (_ : Measurable (Prod.mk x))) a‖ ≤ (fun y => ‖f x y‖ + ‖f x y‖) a [PROOFSTEP] refine' fun n => eventually_of_forall fun y => SimpleFunc.norm_approxOn_zero_le _ _ (x, y) n [GOAL] case pos.refine'_1.refine'_1 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝² : MeasurableSpace E := borel E this✝¹ : BorelSpace E this✝ : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) x : α hfx : Integrable (f x) this : ∀ (n : ℕ), Integrable ↑(s' n x) n : ℕ y : β ⊢ Measurable (uncurry f) [PROOFSTEP] exact hf.measurable [GOAL] case pos.refine'_1.refine'_2 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝² : MeasurableSpace E := borel E this✝¹ : BorelSpace E this✝ : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) x : α hfx : Integrable (f x) this : ∀ (n : ℕ), Integrable ↑(s' n x) n : ℕ y : β ⊢ 0 ∈ range (uncurry f) ∪ {0} [PROOFSTEP] simp [GOAL] case pos.refine'_2 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝² : MeasurableSpace E := borel E this✝¹ : BorelSpace E this✝ : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) x : α hfx : Integrable (f x) this : ∀ (n : ℕ), Integrable ↑(s' n x) ⊢ ∀ᵐ (a : β) ∂ν, Tendsto (fun n => ↑(SimpleFunc.comp (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) n) (Prod.mk x) (_ : Measurable (Prod.mk x))) a) atTop (𝓝 (f x a)) [PROOFSTEP] refine' eventually_of_forall fun y => SimpleFunc.tendsto_approxOn _ _ _ -- Porting note: Lean 3 solved the following two subgoals on its own [GOAL] case pos.refine'_2.refine'_1 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝² : MeasurableSpace E := borel E this✝¹ : BorelSpace E this✝ : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) x : α hfx : Integrable (f x) this : ∀ (n : ℕ), Integrable ↑(s' n x) y : β ⊢ Measurable fun x_1 => uncurry f (x, x_1) [PROOFSTEP] exact hf.measurable.of_uncurry_left [GOAL] case pos.refine'_2.refine'_2 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝² : MeasurableSpace E := borel E this✝¹ : BorelSpace E this✝ : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) x : α hfx : Integrable (f x) this : ∀ (n : ℕ), Integrable ↑(s' n x) y : β ⊢ 0 ∈ range (uncurry f) ∪ {0} [PROOFSTEP] simp [GOAL] case pos.refine'_2.refine'_3 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝² : MeasurableSpace E := borel E this✝¹ : BorelSpace E this✝ : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) x : α hfx : Integrable (f x) this : ∀ (n : ℕ), Integrable ↑(s' n x) y : β ⊢ uncurry f (x, y) ∈ closure (range (uncurry f) ∪ {0}) [PROOFSTEP] apply subset_closure [GOAL] case pos.refine'_2.refine'_3.a α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝² : MeasurableSpace E := borel E this✝¹ : BorelSpace E this✝ : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) x : α hfx : Integrable (f x) this : ∀ (n : ℕ), Integrable ↑(s' n x) y : β ⊢ uncurry f (x, y) ∈ range (uncurry f) ∪ {0} [PROOFSTEP] simp [-uncurry_apply_pair] [GOAL] case neg α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) x : α hfx : ¬Integrable (f x) ⊢ Tendsto (fun i => f' i x) atTop (𝓝 (∫ (y : β), f x y ∂ν)) [PROOFSTEP] simp [hfx, integral_undef] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α → β → E hf : StronglyMeasurable (uncurry f) this✝¹ : MeasurableSpace E := borel E this✝ : BorelSpace E this : SeparableSpace ↑(range (uncurry f) ∪ {0}) s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0 (_ : 0 ∈ range (uncurry f) ∪ {0}) s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x)) f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral ν (s' n x) hf' : ∀ (n : ℕ), StronglyMeasurable (f' n) h2f' : Tendsto f' atTop (𝓝 fun x => ∫ (y : β), f x y ∂ν) ⊢ StronglyMeasurable fun x => ∫ (y : β), f x y ∂ν [PROOFSTEP] exact stronglyMeasurable_of_tendsto _ hf' h2f' [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α × β → E hf : StronglyMeasurable f ⊢ StronglyMeasurable fun x => ∫ (y : β), f (x, y) ∂ν [PROOFSTEP] rw [← uncurry_curry f] at hf [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite ν f : α × β → E hf : StronglyMeasurable (uncurry (curry f)) ⊢ StronglyMeasurable fun x => ∫ (y : β), f (x, y) ∂ν [PROOFSTEP] exact hf.integral_prod_right [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν s : Set (α × β) hs : MeasurableSet s h2s : ↑↑(Measure.prod μ ν) s ≠ ⊤ ⊢ Integrable fun x => ENNReal.toReal (↑↑ν (Prod.mk x ⁻¹' s)) [PROOFSTEP] refine' ⟨(measurable_measure_prod_mk_left hs).ennreal_toReal.aemeasurable.aestronglyMeasurable, _⟩ [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν s : Set (α × β) hs : MeasurableSet s h2s : ↑↑(Measure.prod μ ν) s ≠ ⊤ ⊢ HasFiniteIntegral fun x => ENNReal.toReal (↑↑ν (Prod.mk x ⁻¹' s)) [PROOFSTEP] simp_rw [HasFiniteIntegral, ennnorm_eq_ofReal toReal_nonneg] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν s : Set (α × β) hs : MeasurableSet s h2s : ↑↑(Measure.prod μ ν) s ≠ ⊤ ⊢ ∫⁻ (a : α), ENNReal.ofReal (ENNReal.toReal (↑↑ν (Prod.mk a ⁻¹' s))) ∂μ < ⊤ [PROOFSTEP] convert h2s.lt_top using 1 -- Porting note: was `simp_rw` [GOAL] case h.e'_3 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν s : Set (α × β) hs : MeasurableSet s h2s : ↑↑(Measure.prod μ ν) s ≠ ⊤ ⊢ ∫⁻ (a : α), ENNReal.ofReal (ENNReal.toReal (↑↑ν (Prod.mk a ⁻¹' s))) ∂μ = ↑↑(Measure.prod μ ν) s [PROOFSTEP] rw [prod_apply hs] [GOAL] case h.e'_3 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν s : Set (α × β) hs : MeasurableSet s h2s : ↑↑(Measure.prod μ ν) s ≠ ⊤ ⊢ ∫⁻ (a : α), ENNReal.ofReal (ENNReal.toReal (↑↑ν (Prod.mk a ⁻¹' s))) ∂μ = ∫⁻ (x : α), ↑↑ν (Prod.mk x ⁻¹' s) ∂μ [PROOFSTEP] apply lintegral_congr_ae [GOAL] case h.e'_3.h α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν s : Set (α × β) hs : MeasurableSet s h2s : ↑↑(Measure.prod μ ν) s ≠ ⊤ ⊢ (fun a => ENNReal.ofReal (ENNReal.toReal (↑↑ν (Prod.mk a ⁻¹' s)))) =ᶠ[ae μ] fun a => ↑↑ν (Prod.mk a ⁻¹' s) [PROOFSTEP] refine' (ae_measure_lt_top hs h2s).mp _ [GOAL] case h.e'_3.h α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν s : Set (α × β) hs : MeasurableSet s h2s : ↑↑(Measure.prod μ ν) s ≠ ⊤ ⊢ ∀ᵐ (x : α) ∂μ, ↑↑ν (Prod.mk x ⁻¹' s) < ⊤ → (fun a => ENNReal.ofReal (ENNReal.toReal (↑↑ν (Prod.mk a ⁻¹' s)))) x = (fun a => ↑↑ν (Prod.mk a ⁻¹' s)) x [PROOFSTEP] apply eventually_of_forall [GOAL] case h.e'_3.h.hp α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν s : Set (α × β) hs : MeasurableSet s h2s : ↑↑(Measure.prod μ ν) s ≠ ⊤ ⊢ ∀ (x : α), ↑↑ν (Prod.mk x ⁻¹' s) < ⊤ → (fun a => ENNReal.ofReal (ENNReal.toReal (↑↑ν (Prod.mk a ⁻¹' s)))) x = (fun a => ↑↑ν (Prod.mk a ⁻¹' s)) x [PROOFSTEP] intro x hx [GOAL] case h.e'_3.h.hp α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν s : Set (α × β) hs : MeasurableSet s h2s : ↑↑(Measure.prod μ ν) s ≠ ⊤ x : α hx : ↑↑ν (Prod.mk x ⁻¹' s) < ⊤ ⊢ (fun a => ENNReal.ofReal (ENNReal.toReal (↑↑ν (Prod.mk a ⁻¹' s)))) x = (fun a => ↑↑ν (Prod.mk a ⁻¹' s)) x [PROOFSTEP] rw [lt_top_iff_ne_top] at hx [GOAL] case h.e'_3.h.hp α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν s : Set (α × β) hs : MeasurableSet s h2s : ↑↑(Measure.prod μ ν) s ≠ ⊤ x : α hx : ↑↑ν (Prod.mk x ⁻¹' s) ≠ ⊤ ⊢ (fun a => ENNReal.ofReal (ENNReal.toReal (↑↑ν (Prod.mk a ⁻¹' s)))) x = (fun a => ↑↑ν (Prod.mk a ⁻¹' s)) x [PROOFSTEP] simp [ofReal_toReal, hx] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ✝ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ✝ μ μ' : Measure α ν ν' : Measure β τ : Measure γ✝ inst✝³ : NormedAddCommGroup E γ : Type u_7 inst✝² : TopologicalSpace γ inst✝¹ : SigmaFinite μ inst✝ : SigmaFinite ν f : β × α → γ hf : AEStronglyMeasurable f (Measure.prod ν μ) ⊢ AEStronglyMeasurable (fun z => f (Prod.swap z)) (Measure.prod μ ν) [PROOFSTEP] rw [← prod_swap] at hf [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ✝ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ✝ μ μ' : Measure α ν ν' : Measure β τ : Measure γ✝ inst✝³ : NormedAddCommGroup E γ : Type u_7 inst✝² : TopologicalSpace γ inst✝¹ : SigmaFinite μ inst✝ : SigmaFinite ν f : β × α → γ hf : AEStronglyMeasurable f (map Prod.swap (Measure.prod μ ν)) ⊢ AEStronglyMeasurable (fun z => f (Prod.swap z)) (Measure.prod μ ν) [PROOFSTEP] exact hf.comp_measurable measurable_swap [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁸ : MeasurableSpace α inst✝⁷ : MeasurableSpace α' inst✝⁶ : MeasurableSpace β inst✝⁵ : MeasurableSpace β' inst✝⁴ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝³ : NormedAddCommGroup E inst✝² : SigmaFinite ν inst✝¹ : NormedSpace ℝ E inst✝ : CompleteSpace E f : α × β → E hf : AEStronglyMeasurable f (Measure.prod μ ν) ⊢ (fun x => ∫ (y : β), f (x, y) ∂ν) =ᶠ[ae μ] fun x => ∫ (y : β), AEStronglyMeasurable.mk f hf (x, y) ∂ν [PROOFSTEP] filter_upwards [ae_ae_of_ae_prod hf.ae_eq_mk] with _ hx using integral_congr_ae hx [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ✝ : Type u_5 E : Type u_6 inst✝⁷ : MeasurableSpace α inst✝⁶ : MeasurableSpace α' inst✝⁵ : MeasurableSpace β inst✝⁴ : MeasurableSpace β' inst✝³ : MeasurableSpace γ✝ μ μ' : Measure α ν ν' : Measure β τ : Measure γ✝ inst✝² : NormedAddCommGroup E γ : Type u_7 inst✝¹ : SigmaFinite ν inst✝ : TopologicalSpace γ f : α × β → γ hf : AEStronglyMeasurable f (Measure.prod μ ν) ⊢ ∀ᵐ (x : α) ∂μ, AEStronglyMeasurable (fun y => f (x, y)) ν [PROOFSTEP] filter_upwards [ae_ae_of_ae_prod hf.ae_eq_mk] with x hx [GOAL] case h α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ✝ : Type u_5 E : Type u_6 inst✝⁷ : MeasurableSpace α inst✝⁶ : MeasurableSpace α' inst✝⁵ : MeasurableSpace β inst✝⁴ : MeasurableSpace β' inst✝³ : MeasurableSpace γ✝ μ μ' : Measure α ν ν' : Measure β τ : Measure γ✝ inst✝² : NormedAddCommGroup E γ : Type u_7 inst✝¹ : SigmaFinite ν inst✝ : TopologicalSpace γ f : α × β → γ hf : AEStronglyMeasurable f (Measure.prod μ ν) x : α hx : ∀ᵐ (y : β) ∂ν, f (x, y) = AEStronglyMeasurable.mk f hf (x, y) ⊢ AEStronglyMeasurable (fun y => f (x, y)) ν [PROOFSTEP] exact ⟨fun y => hf.mk f (x, y), hf.stronglyMeasurable_mk.comp_measurable measurable_prod_mk_left, hx⟩ [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : StronglyMeasurable f ⊢ HasFiniteIntegral f ↔ (∀ᵐ (x : α) ∂μ, HasFiniteIntegral fun y => f (x, y)) ∧ HasFiniteIntegral fun x => ∫ (y : β), ‖f (x, y)‖ ∂ν [PROOFSTEP] simp only [HasFiniteIntegral] -- Porting note: was `simp` [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : StronglyMeasurable f ⊢ ∫⁻ (a : α × β), ↑‖f a‖₊ ∂Measure.prod μ ν < ⊤ ↔ (∀ᵐ (x : α) ∂μ, ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤) ∧ ∫⁻ (a : α), ↑‖∫ (y : β), ‖f (a, y)‖ ∂ν‖₊ ∂μ < ⊤ [PROOFSTEP] rw [lintegral_prod_of_measurable _ h1f.ennnorm] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : StronglyMeasurable f ⊢ ∫⁻ (x : α), ∫⁻ (y : β), ↑‖f (x, y)‖₊ ∂ν ∂μ < ⊤ ↔ (∀ᵐ (x : α) ∂μ, ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤) ∧ ∫⁻ (a : α), ↑‖∫ (y : β), ‖f (a, y)‖ ∂ν‖₊ ∂μ < ⊤ [PROOFSTEP] have : ∀ x, ∀ᵐ y ∂ν, 0 ≤ ‖f (x, y)‖ := fun x => eventually_of_forall fun y => norm_nonneg _ [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : StronglyMeasurable f this : ∀ (x : α), ∀ᵐ (y : β) ∂ν, 0 ≤ ‖f (x, y)‖ ⊢ ∫⁻ (x : α), ∫⁻ (y : β), ↑‖f (x, y)‖₊ ∂ν ∂μ < ⊤ ↔ (∀ᵐ (x : α) ∂μ, ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤) ∧ ∫⁻ (a : α), ↑‖∫ (y : β), ‖f (a, y)‖ ∂ν‖₊ ∂μ < ⊤ [PROOFSTEP] simp_rw [integral_eq_lintegral_of_nonneg_ae (this _) (h1f.norm.comp_measurable measurable_prod_mk_left).aestronglyMeasurable, ennnorm_eq_ofReal toReal_nonneg, ofReal_norm_eq_coe_nnnorm] -- this fact is probably too specialized to be its own lemma [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : StronglyMeasurable f this : ∀ (x : α), ∀ᵐ (y : β) ∂ν, 0 ≤ ‖f (x, y)‖ ⊢ ∫⁻ (x : α), ∫⁻ (y : β), ↑‖f (x, y)‖₊ ∂ν ∂μ < ⊤ ↔ (∀ᵐ (x : α) ∂μ, ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤) ∧ ∫⁻ (a : α), ENNReal.ofReal (ENNReal.toReal (∫⁻ (a_1 : β), ↑‖f (a, a_1)‖₊ ∂ν)) ∂μ < ⊤ [PROOFSTEP] have : ∀ {p q r : Prop} (_ : 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] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : StronglyMeasurable f this : ∀ (x : α), ∀ᵐ (y : β) ∂ν, 0 ≤ ‖f (x, y)‖ p q r : Prop h1 : r → p ⊢ (r ↔ p ∧ q) ↔ p → (r ↔ q) [PROOFSTEP] rw [← and_congr_right_iff, and_iff_right_of_imp h1] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : StronglyMeasurable f this✝ : ∀ (x : α), ∀ᵐ (y : β) ∂ν, 0 ≤ ‖f (x, y)‖ this : ∀ {p q r : Prop}, (r → p) → ((r ↔ p ∧ q) ↔ p → (r ↔ q)) ⊢ ∫⁻ (x : α), ∫⁻ (y : β), ↑‖f (x, y)‖₊ ∂ν ∂μ < ⊤ ↔ (∀ᵐ (x : α) ∂μ, ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤) ∧ ∫⁻ (a : α), ENNReal.ofReal (ENNReal.toReal (∫⁻ (a_1 : β), ↑‖f (a, a_1)‖₊ ∂ν)) ∂μ < ⊤ [PROOFSTEP] rw [this] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : StronglyMeasurable f this✝ : ∀ (x : α), ∀ᵐ (y : β) ∂ν, 0 ≤ ‖f (x, y)‖ this : ∀ {p q r : Prop}, (r → p) → ((r ↔ p ∧ q) ↔ p → (r ↔ q)) ⊢ (∀ᵐ (x : α) ∂μ, ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤) → (∫⁻ (x : α), ∫⁻ (y : β), ↑‖f (x, y)‖₊ ∂ν ∂μ < ⊤ ↔ ∫⁻ (a : α), ENNReal.ofReal (ENNReal.toReal (∫⁻ (a_1 : β), ↑‖f (a, a_1)‖₊ ∂ν)) ∂μ < ⊤) [PROOFSTEP] intro h2f [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : StronglyMeasurable f this✝ : ∀ (x : α), ∀ᵐ (y : β) ∂ν, 0 ≤ ‖f (x, y)‖ this : ∀ {p q r : Prop}, (r → p) → ((r ↔ p ∧ q) ↔ p → (r ↔ q)) h2f : ∀ᵐ (x : α) ∂μ, ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤ ⊢ ∫⁻ (x : α), ∫⁻ (y : β), ↑‖f (x, y)‖₊ ∂ν ∂μ < ⊤ ↔ ∫⁻ (a : α), ENNReal.ofReal (ENNReal.toReal (∫⁻ (a_1 : β), ↑‖f (a, a_1)‖₊ ∂ν)) ∂μ < ⊤ [PROOFSTEP] rw [lintegral_congr_ae] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : StronglyMeasurable f this✝ : ∀ (x : α), ∀ᵐ (y : β) ∂ν, 0 ≤ ‖f (x, y)‖ this : ∀ {p q r : Prop}, (r → p) → ((r ↔ p ∧ q) ↔ p → (r ↔ q)) h2f : ∀ᵐ (x : α) ∂μ, ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤ ⊢ (fun x => ∫⁻ (y : β), ↑‖f (x, y)‖₊ ∂ν) =ᶠ[ae μ] fun a => ENNReal.ofReal (ENNReal.toReal (∫⁻ (a_1 : β), ↑‖f (a, a_1)‖₊ ∂ν)) [PROOFSTEP] refine' h2f.mp _ [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : StronglyMeasurable f this✝ : ∀ (x : α), ∀ᵐ (y : β) ∂ν, 0 ≤ ‖f (x, y)‖ this : ∀ {p q r : Prop}, (r → p) → ((r ↔ p ∧ q) ↔ p → (r ↔ q)) h2f : ∀ᵐ (x : α) ∂μ, ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤ ⊢ ∀ᵐ (x : α) ∂μ, ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤ → (fun x => ∫⁻ (y : β), ↑‖f (x, y)‖₊ ∂ν) x = (fun a => ENNReal.ofReal (ENNReal.toReal (∫⁻ (a_1 : β), ↑‖f (a, a_1)‖₊ ∂ν))) x [PROOFSTEP] apply eventually_of_forall [GOAL] case hp α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : StronglyMeasurable f this✝ : ∀ (x : α), ∀ᵐ (y : β) ∂ν, 0 ≤ ‖f (x, y)‖ this : ∀ {p q r : Prop}, (r → p) → ((r ↔ p ∧ q) ↔ p → (r ↔ q)) h2f : ∀ᵐ (x : α) ∂μ, ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤ ⊢ ∀ (x : α), ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤ → (fun x => ∫⁻ (y : β), ↑‖f (x, y)‖₊ ∂ν) x = (fun a => ENNReal.ofReal (ENNReal.toReal (∫⁻ (a_1 : β), ↑‖f (a, a_1)‖₊ ∂ν))) x [PROOFSTEP] intro x hx [GOAL] case hp α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : StronglyMeasurable f this✝ : ∀ (x : α), ∀ᵐ (y : β) ∂ν, 0 ≤ ‖f (x, y)‖ this : ∀ {p q r : Prop}, (r → p) → ((r ↔ p ∧ q) ↔ p → (r ↔ q)) h2f : ∀ᵐ (x : α) ∂μ, ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤ x : α hx : ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤ ⊢ (fun x => ∫⁻ (y : β), ↑‖f (x, y)‖₊ ∂ν) x = (fun a => ENNReal.ofReal (ENNReal.toReal (∫⁻ (a_1 : β), ↑‖f (a, a_1)‖₊ ∂ν))) x [PROOFSTEP] dsimp only [GOAL] case hp α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : StronglyMeasurable f this✝ : ∀ (x : α), ∀ᵐ (y : β) ∂ν, 0 ≤ ‖f (x, y)‖ this : ∀ {p q r : Prop}, (r → p) → ((r ↔ p ∧ q) ↔ p → (r ↔ q)) h2f : ∀ᵐ (x : α) ∂μ, ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤ x : α hx : ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤ ⊢ ∫⁻ (y : β), ↑‖f (x, y)‖₊ ∂ν = ENNReal.ofReal (ENNReal.toReal (∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν)) [PROOFSTEP] rw [ofReal_toReal] [GOAL] case hp α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : StronglyMeasurable f this✝ : ∀ (x : α), ∀ᵐ (y : β) ∂ν, 0 ≤ ‖f (x, y)‖ this : ∀ {p q r : Prop}, (r → p) → ((r ↔ p ∧ q) ↔ p → (r ↔ q)) h2f : ∀ᵐ (x : α) ∂μ, ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤ x : α hx : ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤ ⊢ ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν ≠ ⊤ [PROOFSTEP] rw [← lt_top_iff_ne_top] [GOAL] case hp α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : StronglyMeasurable f this✝ : ∀ (x : α), ∀ᵐ (y : β) ∂ν, 0 ≤ ‖f (x, y)‖ this : ∀ {p q r : Prop}, (r → p) → ((r ↔ p ∧ q) ↔ p → (r ↔ q)) h2f : ∀ᵐ (x : α) ∂μ, ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤ x : α hx : ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤ ⊢ ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤ [PROOFSTEP] exact hx [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : StronglyMeasurable f this✝ : ∀ (x : α), ∀ᵐ (y : β) ∂ν, 0 ≤ ‖f (x, y)‖ this : ∀ {p q r : Prop}, (r → p) → ((r ↔ p ∧ q) ↔ p → (r ↔ q)) ⊢ ∫⁻ (x : α), ∫⁻ (y : β), ↑‖f (x, y)‖₊ ∂ν ∂μ < ⊤ → ∀ᵐ (x : α) ∂μ, ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤ [PROOFSTEP] intro h2f [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : StronglyMeasurable f this✝ : ∀ (x : α), ∀ᵐ (y : β) ∂ν, 0 ≤ ‖f (x, y)‖ this : ∀ {p q r : Prop}, (r → p) → ((r ↔ p ∧ q) ↔ p → (r ↔ q)) h2f : ∫⁻ (x : α), ∫⁻ (y : β), ↑‖f (x, y)‖₊ ∂ν ∂μ < ⊤ ⊢ ∀ᵐ (x : α) ∂μ, ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν < ⊤ [PROOFSTEP] refine' ae_lt_top _ h2f.ne [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : StronglyMeasurable f this✝ : ∀ (x : α), ∀ᵐ (y : β) ∂ν, 0 ≤ ‖f (x, y)‖ this : ∀ {p q r : Prop}, (r → p) → ((r ↔ p ∧ q) ↔ p → (r ↔ q)) h2f : ∫⁻ (x : α), ∫⁻ (y : β), ↑‖f (x, y)‖₊ ∂ν ∂μ < ⊤ ⊢ Measurable fun x => ∫⁻ (a : β), ↑‖f (x, a)‖₊ ∂ν [PROOFSTEP] exact h1f.ennnorm.lintegral_prod_right' [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : AEStronglyMeasurable f (Measure.prod μ ν) ⊢ HasFiniteIntegral f ↔ (∀ᵐ (x : α) ∂μ, HasFiniteIntegral fun y => f (x, y)) ∧ HasFiniteIntegral fun x => ∫ (y : β), ‖f (x, y)‖ ∂ν [PROOFSTEP] rw [hasFiniteIntegral_congr h1f.ae_eq_mk, hasFiniteIntegral_prod_iff h1f.stronglyMeasurable_mk] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : AEStronglyMeasurable f (Measure.prod μ ν) ⊢ ((∀ᵐ (x : α) ∂μ, HasFiniteIntegral fun y => AEStronglyMeasurable.mk f h1f (x, y)) ∧ HasFiniteIntegral fun x => ∫ (y : β), ‖AEStronglyMeasurable.mk f h1f (x, y)‖ ∂ν) ↔ (∀ᵐ (x : α) ∂μ, HasFiniteIntegral fun y => f (x, y)) ∧ HasFiniteIntegral fun x => ∫ (y : β), ‖f (x, y)‖ ∂ν [PROOFSTEP] apply and_congr [GOAL] case h₁ α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : AEStronglyMeasurable f (Measure.prod μ ν) ⊢ (∀ᵐ (x : α) ∂μ, HasFiniteIntegral fun y => AEStronglyMeasurable.mk f h1f (x, y)) ↔ ∀ᵐ (x : α) ∂μ, HasFiniteIntegral fun y => f (x, y) [PROOFSTEP] apply eventually_congr [GOAL] case h₁.h α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : AEStronglyMeasurable f (Measure.prod μ ν) ⊢ ∀ᵐ (x : α) ∂μ, (HasFiniteIntegral fun y => AEStronglyMeasurable.mk f h1f (x, y)) ↔ HasFiniteIntegral fun y => f (x, y) [PROOFSTEP] filter_upwards [ae_ae_of_ae_prod h1f.ae_eq_mk.symm] [GOAL] case h α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : AEStronglyMeasurable f (Measure.prod μ ν) ⊢ ∀ (a : α), (∀ᵐ (y : β) ∂ν, AEStronglyMeasurable.mk f h1f (a, y) = f (a, y)) → ((HasFiniteIntegral fun y => AEStronglyMeasurable.mk f h1f (a, y)) ↔ HasFiniteIntegral fun y => f (a, y)) [PROOFSTEP] intro x hx [GOAL] case h α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : AEStronglyMeasurable f (Measure.prod μ ν) x : α hx : ∀ᵐ (y : β) ∂ν, AEStronglyMeasurable.mk f h1f (x, y) = f (x, y) ⊢ (HasFiniteIntegral fun y => AEStronglyMeasurable.mk f h1f (x, y)) ↔ HasFiniteIntegral fun y => f (x, y) [PROOFSTEP] exact hasFiniteIntegral_congr hx [GOAL] case h₂ α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : AEStronglyMeasurable f (Measure.prod μ ν) ⊢ (HasFiniteIntegral fun x => ∫ (y : β), ‖AEStronglyMeasurable.mk f h1f (x, y)‖ ∂ν) ↔ HasFiniteIntegral fun x => ∫ (y : β), ‖f (x, y)‖ ∂ν [PROOFSTEP] apply hasFiniteIntegral_congr [GOAL] case h₂.h α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : AEStronglyMeasurable f (Measure.prod μ ν) ⊢ (fun x => ∫ (y : β), ‖AEStronglyMeasurable.mk f h1f (x, y)‖ ∂ν) =ᶠ[ae μ] fun x => ∫ (y : β), ‖f (x, y)‖ ∂ν [PROOFSTEP] filter_upwards [ae_ae_of_ae_prod h1f.ae_eq_mk.symm] with _ hx using integral_congr_ae (EventuallyEq.fun_comp hx _) [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁶ : MeasurableSpace α inst✝⁵ : MeasurableSpace α' inst✝⁴ : MeasurableSpace β inst✝³ : MeasurableSpace β' inst✝² : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝¹ : NormedAddCommGroup E inst✝ : SigmaFinite ν f : α × β → E h1f : AEStronglyMeasurable f (Measure.prod μ ν) ⊢ Integrable f ↔ (∀ᵐ (x : α) ∂μ, Integrable fun y => f (x, y)) ∧ Integrable fun x => ∫ (y : β), ‖f (x, y)‖ ∂ν [PROOFSTEP] simp [Integrable, h1f, hasFiniteIntegral_prod_iff', h1f.norm.integral_prod_right', h1f.prod_mk_left] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁷ : MeasurableSpace α inst✝⁶ : MeasurableSpace α' inst✝⁵ : MeasurableSpace β inst✝⁴ : MeasurableSpace β' inst✝³ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝² : NormedAddCommGroup E inst✝¹ : SigmaFinite ν inst✝ : SigmaFinite μ f : α × β → E h1f : AEStronglyMeasurable f (Measure.prod μ ν) ⊢ Integrable f ↔ (∀ᵐ (y : β) ∂ν, Integrable fun x => f (x, y)) ∧ Integrable fun y => ∫ (x : α), ‖f (x, y)‖ ∂μ [PROOFSTEP] convert integrable_prod_iff h1f.prod_swap using 1 [GOAL] case h.e'_1.a α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁷ : MeasurableSpace α inst✝⁶ : MeasurableSpace α' inst✝⁵ : MeasurableSpace β inst✝⁴ : MeasurableSpace β' inst✝³ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝² : NormedAddCommGroup E inst✝¹ : SigmaFinite ν inst✝ : SigmaFinite μ f : α × β → E h1f : AEStronglyMeasurable f (Measure.prod μ ν) ⊢ Integrable f ↔ Integrable fun z => f (Prod.swap z) [PROOFSTEP] rw [funext fun _ => Function.comp_apply.symm, integrable_swap_iff] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁷ : MeasurableSpace α inst✝⁶ : MeasurableSpace α' inst✝⁵ : MeasurableSpace β inst✝⁴ : MeasurableSpace β' inst✝³ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝² : NormedAddCommGroup E inst✝¹ : SigmaFinite ν L : Type u_7 inst✝ : IsROrC L f : α → L g : β → L hf : Integrable f hg : Integrable g ⊢ Integrable fun z => f z.fst * g z.snd [PROOFSTEP] refine' (integrable_prod_iff _).2 ⟨_, _⟩ [GOAL] case refine'_1 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁷ : MeasurableSpace α inst✝⁶ : MeasurableSpace α' inst✝⁵ : MeasurableSpace β inst✝⁴ : MeasurableSpace β' inst✝³ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝² : NormedAddCommGroup E inst✝¹ : SigmaFinite ν L : Type u_7 inst✝ : IsROrC L f : α → L g : β → L hf : Integrable f hg : Integrable g ⊢ AEStronglyMeasurable (fun z => f z.fst * g z.snd) (Measure.prod μ ν) [PROOFSTEP] exact hf.1.fst.mul hg.1.snd [GOAL] case refine'_2 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁷ : MeasurableSpace α inst✝⁶ : MeasurableSpace α' inst✝⁵ : MeasurableSpace β inst✝⁴ : MeasurableSpace β' inst✝³ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝² : NormedAddCommGroup E inst✝¹ : SigmaFinite ν L : Type u_7 inst✝ : IsROrC L f : α → L g : β → L hf : Integrable f hg : Integrable g ⊢ ∀ᵐ (x : α) ∂μ, Integrable fun y => f (x, y).fst * g (x, y).snd [PROOFSTEP] exact eventually_of_forall fun x => hg.const_mul (f x) [GOAL] case refine'_3 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁷ : MeasurableSpace α inst✝⁶ : MeasurableSpace α' inst✝⁵ : MeasurableSpace β inst✝⁴ : MeasurableSpace β' inst✝³ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝² : NormedAddCommGroup E inst✝¹ : SigmaFinite ν L : Type u_7 inst✝ : IsROrC L f : α → L g : β → L hf : Integrable f hg : Integrable g ⊢ Integrable fun x => ∫ (y : β), ‖f (x, y).fst * g (x, y).snd‖ ∂ν [PROOFSTEP] simpa only [norm_mul, integral_mul_left] using hf.norm.mul_const _ [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁹ : MeasurableSpace α inst✝⁸ : MeasurableSpace α' inst✝⁷ : MeasurableSpace β inst✝⁶ : MeasurableSpace β' inst✝⁵ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁴ : NormedAddCommGroup E inst✝³ : SigmaFinite ν inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite μ f : α × β → E hf : AEStronglyMeasurable f (Measure.prod μ ν) ⊢ ∫ (z : β × α), f (Prod.swap z) ∂Measure.prod ν μ = ∫ (z : α × β), f z ∂Measure.prod μ ν [PROOFSTEP] rw [← prod_swap] at hf [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝⁹ : MeasurableSpace α inst✝⁸ : MeasurableSpace α' inst✝⁷ : MeasurableSpace β inst✝⁶ : MeasurableSpace β' inst✝⁵ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁴ : NormedAddCommGroup E inst✝³ : SigmaFinite ν inst✝² : NormedSpace ℝ E inst✝¹ : CompleteSpace E inst✝ : SigmaFinite μ f : α × β → E hf : AEStronglyMeasurable f (map Prod.swap (Measure.prod ν μ)) ⊢ ∫ (z : β × α), f (Prod.swap z) ∂Measure.prod ν μ = ∫ (z : α × β), f z ∂Measure.prod μ ν [PROOFSTEP] rw [← integral_map measurable_swap.aemeasurable hf, prod_swap] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' f g : α × β → E F : E → E' hf : Integrable f hg : Integrable g ⊢ ∫ (x : α), F (∫ (y : β), f (x, y) + g (x, y) ∂ν) ∂μ = ∫ (x : α), F (∫ (y : β), f (x, y) ∂ν + ∫ (y : β), g (x, y) ∂ν) ∂μ [PROOFSTEP] refine' integral_congr_ae _ [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' f g : α × β → E F : E → E' hf : Integrable f hg : Integrable g ⊢ (fun x => F (∫ (y : β), f (x, y) + g (x, y) ∂ν)) =ᶠ[ae μ] fun x => F (∫ (y : β), f (x, y) ∂ν + ∫ (y : β), g (x, y) ∂ν) [PROOFSTEP] filter_upwards [hf.prod_right_ae, hg.prod_right_ae] with _ h2f h2g [GOAL] case h α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' f g : α × β → E F : E → E' hf : Integrable f hg : Integrable g a✝ : α h2f : Integrable fun y => f (a✝, y) h2g : Integrable fun y => g (a✝, y) ⊢ F (∫ (y : β), f (a✝, y) + g (a✝, y) ∂ν) = F (∫ (y : β), f (a✝, y) ∂ν + ∫ (y : β), g (a✝, y) ∂ν) [PROOFSTEP] simp [integral_add h2f h2g] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' f g : α × β → E F : E → E' hf : Integrable f hg : Integrable g ⊢ ∫ (x : α), F (∫ (y : β), f (x, y) - g (x, y) ∂ν) ∂μ = ∫ (x : α), F (∫ (y : β), f (x, y) ∂ν - ∫ (y : β), g (x, y) ∂ν) ∂μ [PROOFSTEP] refine' integral_congr_ae _ [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' f g : α × β → E F : E → E' hf : Integrable f hg : Integrable g ⊢ (fun x => F (∫ (y : β), f (x, y) - g (x, y) ∂ν)) =ᶠ[ae μ] fun x => F (∫ (y : β), f (x, y) ∂ν - ∫ (y : β), g (x, y) ∂ν) [PROOFSTEP] filter_upwards [hf.prod_right_ae, hg.prod_right_ae] with _ h2f h2g [GOAL] case h α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' f g : α × β → E F : E → E' hf : Integrable f hg : Integrable g a✝ : α h2f : Integrable fun y => f (a✝, y) h2g : Integrable fun y => g (a✝, y) ⊢ F (∫ (y : β), f (a✝, y) - g (a✝, y) ∂ν) = F (∫ (y : β), f (a✝, y) ∂ν - ∫ (y : β), g (a✝, y) ∂ν) [PROOFSTEP] simp [integral_sub h2f h2g] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' f g : α × β → E F : E → ℝ≥0∞ hf : Integrable f hg : Integrable g ⊢ ∫⁻ (x : α), F (∫ (y : β), f (x, y) - g (x, y) ∂ν) ∂μ = ∫⁻ (x : α), F (∫ (y : β), f (x, y) ∂ν - ∫ (y : β), g (x, y) ∂ν) ∂μ [PROOFSTEP] refine' lintegral_congr_ae _ [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' f g : α × β → E F : E → ℝ≥0∞ hf : Integrable f hg : Integrable g ⊢ (fun x => F (∫ (y : β), f (x, y) - g (x, y) ∂ν)) =ᶠ[ae μ] fun x => F (∫ (y : β), f (x, y) ∂ν - ∫ (y : β), g (x, y) ∂ν) [PROOFSTEP] filter_upwards [hf.prod_right_ae, hg.prod_right_ae] with _ h2f h2g [GOAL] case h α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' f g : α × β → E F : E → ℝ≥0∞ hf : Integrable f hg : Integrable g a✝ : α h2f : Integrable fun y => f (a✝, y) h2g : Integrable fun y => g (a✝, y) ⊢ F (∫ (y : β), f (a✝, y) - g (a✝, y) ∂ν) = F (∫ (y : β), f (a✝, y) ∂ν - ∫ (y : β), g (a✝, y) ∂ν) [PROOFSTEP] simp [integral_sub h2f h2g] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' ⊢ Continuous fun f => ∫ (x : α), ∫ (y : β), ↑↑f (x, y) ∂ν ∂μ [PROOFSTEP] rw [continuous_iff_continuousAt] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' ⊢ ∀ (x : { x // x ∈ Lp E 1 }), ContinuousAt (fun f => ∫ (x : α), ∫ (y : β), ↑↑f (x, y) ∂ν ∂μ) x [PROOFSTEP] intro g [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } ⊢ ContinuousAt (fun f => ∫ (x : α), ∫ (y : β), ↑↑f (x, y) ∂ν ∂μ) g [PROOFSTEP] refine' tendsto_integral_of_L1 _ (L1.integrable_coeFn g).integral_prod_left (eventually_of_forall fun h => (L1.integrable_coeFn h).integral_prod_left) _ [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } ⊢ Tendsto (fun i => ∫⁻ (x : α), ↑‖∫ (y : β), ↑↑i (x, y) ∂ν - ∫ (y : β), ↑↑g (x, y) ∂ν‖₊ ∂μ) (𝓝 g) (𝓝 0) [PROOFSTEP] simp_rw [← lintegral_fn_integral_sub (fun x => (‖x‖₊ : ℝ≥0∞)) (L1.integrable_coeFn _) (L1.integrable_coeFn g)] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } ⊢ Tendsto (fun i => ∫⁻ (x : α), ↑‖∫ (y : β), ↑↑i (x, y) - ↑↑g (x, y) ∂ν‖₊ ∂μ) (𝓝 g) (𝓝 0) [PROOFSTEP] refine' tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_const_nhds _ (fun i => zero_le _) _ [GOAL] case refine'_1 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } ⊢ { x // x ∈ Lp E 1 } → ℝ≥0∞ [PROOFSTEP] exact fun i => ∫⁻ x, ∫⁻ y, ‖i (x, y) - g (x, y)‖₊ ∂ν ∂μ [GOAL] case refine'_2 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } ⊢ Tendsto (fun i => ∫⁻ (x : α), ∫⁻ (y : β), ↑‖↑↑i (x, y) - ↑↑g (x, y)‖₊ ∂ν ∂μ) (𝓝 g) (𝓝 0) case refine'_3 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } ⊢ (fun i => ∫⁻ (x : α), ↑‖∫ (y : β), ↑↑i (x, y) - ↑↑g (x, y) ∂ν‖₊ ∂μ) ≤ fun i => ∫⁻ (x : α), ∫⁻ (y : β), ↑‖↑↑i (x, y) - ↑↑g (x, y)‖₊ ∂ν ∂μ [PROOFSTEP] swap [GOAL] case refine'_3 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } ⊢ (fun i => ∫⁻ (x : α), ↑‖∫ (y : β), ↑↑i (x, y) - ↑↑g (x, y) ∂ν‖₊ ∂μ) ≤ fun i => ∫⁻ (x : α), ∫⁻ (y : β), ↑‖↑↑i (x, y) - ↑↑g (x, y)‖₊ ∂ν ∂μ [PROOFSTEP] exact fun i => lintegral_mono fun x => ennnorm_integral_le_lintegral_ennnorm _ [GOAL] case refine'_2 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } ⊢ Tendsto (fun i => ∫⁻ (x : α), ∫⁻ (y : β), ↑‖↑↑i (x, y) - ↑↑g (x, y)‖₊ ∂ν ∂μ) (𝓝 g) (𝓝 0) [PROOFSTEP] show Tendsto (fun i : α × β →₁[μ.prod ν] E => ∫⁻ x, ∫⁻ y : β, ‖i (x, y) - g (x, y)‖₊ ∂ν ∂μ) (𝓝 g) (𝓝 0) [GOAL] case refine'_2 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } ⊢ Tendsto (fun i => ∫⁻ (x : α), ∫⁻ (y : β), ↑‖↑↑i (x, y) - ↑↑g (x, y)‖₊ ∂ν ∂μ) (𝓝 g) (𝓝 0) [PROOFSTEP] have : ∀ i : α × β →₁[μ.prod ν] E, Measurable fun z => (‖i z - g z‖₊ : ℝ≥0∞) := fun i => ((Lp.stronglyMeasurable i).sub (Lp.stronglyMeasurable g)).ennnorm [GOAL] case refine'_2 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } this : ∀ (i : { x // x ∈ Lp E 1 }), Measurable fun z => ↑‖↑↑i z - ↑↑g z‖₊ ⊢ Tendsto (fun i => ∫⁻ (x : α), ∫⁻ (y : β), ↑‖↑↑i (x, y) - ↑↑g (x, y)‖₊ ∂ν ∂μ) (𝓝 g) (𝓝 0) [PROOFSTEP] conv => congr ext rw [← lintegral_prod_of_measurable _ (this _), ← L1.ofReal_norm_sub_eq_lintegral] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } this : ∀ (i : { x // x ∈ Lp E 1 }), Measurable fun z => ↑‖↑↑i z - ↑↑g z‖₊ | Tendsto (fun i => ∫⁻ (x : α), ∫⁻ (y : β), ↑‖↑↑i (x, y) - ↑↑g (x, y)‖₊ ∂ν ∂μ) (𝓝 g) (𝓝 0) [PROOFSTEP] congr ext rw [← lintegral_prod_of_measurable _ (this _), ← L1.ofReal_norm_sub_eq_lintegral] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } this : ∀ (i : { x // x ∈ Lp E 1 }), Measurable fun z => ↑‖↑↑i z - ↑↑g z‖₊ | Tendsto (fun i => ∫⁻ (x : α), ∫⁻ (y : β), ↑‖↑↑i (x, y) - ↑↑g (x, y)‖₊ ∂ν ∂μ) (𝓝 g) (𝓝 0) [PROOFSTEP] congr ext rw [← lintegral_prod_of_measurable _ (this _), ← L1.ofReal_norm_sub_eq_lintegral] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } this : ∀ (i : { x // x ∈ Lp E 1 }), Measurable fun z => ↑‖↑↑i z - ↑↑g z‖₊ | Tendsto (fun i => ∫⁻ (x : α), ∫⁻ (y : β), ↑‖↑↑i (x, y) - ↑↑g (x, y)‖₊ ∂ν ∂μ) (𝓝 g) (𝓝 0) [PROOFSTEP] congr [GOAL] case f α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } this : ∀ (i : { x // x ∈ Lp E 1 }), Measurable fun z => ↑‖↑↑i z - ↑↑g z‖₊ | fun i => ∫⁻ (x : α), ∫⁻ (y : β), ↑‖↑↑i (x, y) - ↑↑g (x, y)‖₊ ∂ν ∂μ case l₁ α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } this : ∀ (i : { x // x ∈ Lp E 1 }), Measurable fun z => ↑‖↑↑i z - ↑↑g z‖₊ | 𝓝 g case l₂ α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } this : ∀ (i : { x // x ∈ Lp E 1 }), Measurable fun z => ↑‖↑↑i z - ↑↑g z‖₊ | 𝓝 0 [PROOFSTEP] ext [GOAL] case f.h α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } this : ∀ (i : { x // x ∈ Lp E 1 }), Measurable fun z => ↑‖↑↑i z - ↑↑g z‖₊ x✝ : { x // x ∈ Lp E 1 } | ∫⁻ (x : α), ∫⁻ (y : β), ↑‖↑↑x✝ (x, y) - ↑↑g (x, y)‖₊ ∂ν ∂μ case l₁ α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } this : ∀ (i : { x // x ∈ Lp E 1 }), Measurable fun z => ↑‖↑↑i z - ↑↑g z‖₊ | 𝓝 g case l₂ α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } this : ∀ (i : { x // x ∈ Lp E 1 }), Measurable fun z => ↑‖↑↑i z - ↑↑g z‖₊ | 𝓝 0 [PROOFSTEP] rw [← lintegral_prod_of_measurable _ (this _), ← L1.ofReal_norm_sub_eq_lintegral] [GOAL] case refine'_2 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } this : ∀ (i : { x // x ∈ Lp E 1 }), Measurable fun z => ↑‖↑↑i z - ↑↑g z‖₊ ⊢ Tendsto (fun x => ENNReal.ofReal ‖x - g‖) (𝓝 g) (𝓝 0) [PROOFSTEP] rw [← ofReal_zero] [GOAL] case refine'_2 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } this : ∀ (i : { x // x ∈ Lp E 1 }), Measurable fun z => ↑‖↑↑i z - ↑↑g z‖₊ ⊢ Tendsto (fun x => ENNReal.ofReal ‖x - g‖) (𝓝 g) (𝓝 (ENNReal.ofReal 0)) [PROOFSTEP] refine' (continuous_ofReal.tendsto 0).comp _ [GOAL] case refine'_2 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } this : ∀ (i : { x // x ∈ Lp E 1 }), Measurable fun z => ↑‖↑↑i z - ↑↑g z‖₊ ⊢ Tendsto (fun x => ‖x - g‖) (𝓝 g) (𝓝 0) [PROOFSTEP] rw [← tendsto_iff_norm_tendsto_zero] [GOAL] case refine'_2 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' g : { x // x ∈ Lp E 1 } this : ∀ (i : { x // x ∈ Lp E 1 }), Measurable fun z => ↑‖↑↑i z - ↑↑g z‖₊ ⊢ Tendsto (fun x => x) (𝓝 g) (𝓝 g) [PROOFSTEP] exact tendsto_id [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' ⊢ ∀ (f : α × β → E), Integrable f → ∫ (z : α × β), f z ∂Measure.prod μ ν = ∫ (x : α), ∫ (y : β), f (x, y) ∂ν ∂μ [PROOFSTEP] apply Integrable.induction [GOAL] case h_ind α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' ⊢ ∀ (c : E) ⦃s : Set (α × β)⦄, MeasurableSet s → ↑↑(Measure.prod μ ν) s < ⊤ → ∫ (z : α × β), indicator s (fun x => c) z ∂Measure.prod μ ν = ∫ (x : α), ∫ (y : β), indicator s (fun x => c) (x, y) ∂ν ∂μ [PROOFSTEP] intro c s hs h2s [GOAL] case h_ind α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' c : E s : Set (α × β) hs : MeasurableSet s h2s : ↑↑(Measure.prod μ ν) s < ⊤ ⊢ ∫ (z : α × β), indicator s (fun x => c) z ∂Measure.prod μ ν = ∫ (x : α), ∫ (y : β), indicator s (fun x => c) (x, y) ∂ν ∂μ [PROOFSTEP] simp_rw [integral_indicator hs, ← indicator_comp_right, Function.comp, integral_indicator (measurable_prod_mk_left hs), set_integral_const, integral_smul_const, integral_toReal (measurable_measure_prod_mk_left hs).aemeasurable (ae_measure_lt_top hs h2s.ne)] -- Porting note: was `simp_rw` [GOAL] case h_ind α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' c : E s : Set (α × β) hs : MeasurableSet s h2s : ↑↑(Measure.prod μ ν) s < ⊤ ⊢ ENNReal.toReal (↑↑(Measure.prod μ ν) s) • c = ENNReal.toReal (∫⁻ (a : α), ↑↑ν (Prod.mk a ⁻¹' s) ∂μ) • c [PROOFSTEP] rw [prod_apply hs] [GOAL] case h_add α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' ⊢ ∀ ⦃f g : α × β → E⦄, Disjoint (support f) (support g) → Integrable f → Integrable g → ∫ (z : α × β), f z ∂Measure.prod μ ν = ∫ (x : α), ∫ (y : β), f (x, y) ∂ν ∂μ → ∫ (z : α × β), g z ∂Measure.prod μ ν = ∫ (x : α), ∫ (y : β), g (x, y) ∂ν ∂μ → ∫ (z : α × β), (f + g) z ∂Measure.prod μ ν = ∫ (x : α), ∫ (y : β), (f + g) (x, y) ∂ν ∂μ [PROOFSTEP] rintro f g - i_f i_g hf hg [GOAL] case h_add α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' f g : α × β → E i_f : Integrable f i_g : Integrable g hf : ∫ (z : α × β), f z ∂Measure.prod μ ν = ∫ (x : α), ∫ (y : β), f (x, y) ∂ν ∂μ hg : ∫ (z : α × β), g z ∂Measure.prod μ ν = ∫ (x : α), ∫ (y : β), g (x, y) ∂ν ∂μ ⊢ ∫ (z : α × β), (f + g) z ∂Measure.prod μ ν = ∫ (x : α), ∫ (y : β), (f + g) (x, y) ∂ν ∂μ [PROOFSTEP] simp_rw [integral_add' i_f i_g, integral_integral_add' i_f i_g, hf, hg] [GOAL] case h_closed α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' ⊢ IsClosed {f | ∫ (z : α × β), ↑↑f z ∂Measure.prod μ ν = ∫ (x : α), ∫ (y : β), ↑↑f (x, y) ∂ν ∂μ} [PROOFSTEP] exact isClosed_eq continuous_integral continuous_integral_integral [GOAL] case h_ae α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' ⊢ ∀ ⦃f g : α × β → E⦄, f =ᶠ[ae (Measure.prod μ ν)] g → Integrable f → ∫ (z : α × β), f z ∂Measure.prod μ ν = ∫ (x : α), ∫ (y : β), f (x, y) ∂ν ∂μ → ∫ (z : α × β), g z ∂Measure.prod μ ν = ∫ (x : α), ∫ (y : β), g (x, y) ∂ν ∂μ [PROOFSTEP] rintro f g hfg - hf [GOAL] case h_ae α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' f g : α × β → E hfg : f =ᶠ[ae (Measure.prod μ ν)] g hf : ∫ (z : α × β), f z ∂Measure.prod μ ν = ∫ (x : α), ∫ (y : β), f (x, y) ∂ν ∂μ ⊢ ∫ (z : α × β), g z ∂Measure.prod μ ν = ∫ (x : α), ∫ (y : β), g (x, y) ∂ν ∂μ [PROOFSTEP] convert hf using 1 [GOAL] case h.e'_2 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' f g : α × β → E hfg : f =ᶠ[ae (Measure.prod μ ν)] g hf : ∫ (z : α × β), f z ∂Measure.prod μ ν = ∫ (x : α), ∫ (y : β), f (x, y) ∂ν ∂μ ⊢ ∫ (z : α × β), g z ∂Measure.prod μ ν = ∫ (z : α × β), f z ∂Measure.prod μ ν [PROOFSTEP] exact integral_congr_ae hfg.symm [GOAL] case h.e'_3 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' f g : α × β → E hfg : f =ᶠ[ae (Measure.prod μ ν)] g hf : ∫ (z : α × β), f z ∂Measure.prod μ ν = ∫ (x : α), ∫ (y : β), f (x, y) ∂ν ∂μ ⊢ ∫ (x : α), ∫ (y : β), g (x, y) ∂ν ∂μ = ∫ (x : α), ∫ (y : β), f (x, y) ∂ν ∂μ [PROOFSTEP] refine' integral_congr_ae _ [GOAL] case h.e'_3 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' f g : α × β → E hfg : f =ᶠ[ae (Measure.prod μ ν)] g hf : ∫ (z : α × β), f z ∂Measure.prod μ ν = ∫ (x : α), ∫ (y : β), f (x, y) ∂ν ∂μ ⊢ (fun x => ∫ (y : β), g (x, y) ∂ν) =ᶠ[ae μ] fun x => ∫ (y : β), f (x, y) ∂ν [PROOFSTEP] refine' (ae_ae_of_ae_prod hfg).mp _ [GOAL] case h.e'_3 α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' f g : α × β → E hfg : f =ᶠ[ae (Measure.prod μ ν)] g hf : ∫ (z : α × β), f z ∂Measure.prod μ ν = ∫ (x : α), ∫ (y : β), f (x, y) ∂ν ∂μ ⊢ ∀ᵐ (x : α) ∂μ, (∀ᵐ (y : β) ∂ν, f (x, y) = g (x, y)) → (fun x => ∫ (y : β), g (x, y) ∂ν) x = (fun x => ∫ (y : β), f (x, y) ∂ν) x [PROOFSTEP] apply eventually_of_forall [GOAL] case h.e'_3.hp α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' f g : α × β → E hfg : f =ᶠ[ae (Measure.prod μ ν)] g hf : ∫ (z : α × β), f z ∂Measure.prod μ ν = ∫ (x : α), ∫ (y : β), f (x, y) ∂ν ∂μ ⊢ ∀ (x : α), (∀ᵐ (y : β) ∂ν, f (x, y) = g (x, y)) → (fun x => ∫ (y : β), g (x, y) ∂ν) x = (fun x => ∫ (y : β), f (x, y) ∂ν) x [PROOFSTEP] intro x hfgx [GOAL] case h.e'_3.hp α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' f g : α × β → E hfg : f =ᶠ[ae (Measure.prod μ ν)] g hf : ∫ (z : α × β), f z ∂Measure.prod μ ν = ∫ (x : α), ∫ (y : β), f (x, y) ∂ν ∂μ x : α hfgx : ∀ᵐ (y : β) ∂ν, f (x, y) = g (x, y) ⊢ (fun x => ∫ (y : β), g (x, y) ∂ν) x = (fun x => ∫ (y : β), f (x, y) ∂ν) x [PROOFSTEP] exact integral_congr_ae (ae_eq_symm hfgx) [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' f : α × β → E hf : Integrable f ⊢ ∫ (z : α × β), f z ∂Measure.prod μ ν = ∫ (y : β), ∫ (x : α), f (x, y) ∂μ ∂ν [PROOFSTEP] simp_rw [← integral_prod_swap f hf.aestronglyMeasurable] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' f : α × β → E hf : Integrable f ⊢ ∫ (z : β × α), f (Prod.swap z) ∂Measure.prod ν μ = ∫ (y : β), ∫ (x : α), f (x, y) ∂μ ∂ν [PROOFSTEP] exact integral_prod _ hf.swap [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' f : α × β → E s : Set α t : Set β hf : IntegrableOn f (s ×ˢ t) ⊢ ∫ (z : α × β) in s ×ˢ t, f z ∂Measure.prod μ ν = ∫ (x : α) in s, ∫ (y : β) in t, f (x, y) ∂ν ∂μ [PROOFSTEP] simp only [← Measure.prod_restrict s t, IntegrableOn] at hf ⊢ [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹² : MeasurableSpace α inst✝¹¹ : MeasurableSpace α' inst✝¹⁰ : MeasurableSpace β inst✝⁹ : MeasurableSpace β' inst✝⁸ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁷ : NormedAddCommGroup E inst✝⁶ : SigmaFinite ν inst✝⁵ : NormedSpace ℝ E inst✝⁴ : CompleteSpace E inst✝³ : SigmaFinite μ E' : Type u_7 inst✝² : NormedAddCommGroup E' inst✝¹ : CompleteSpace E' inst✝ : NormedSpace ℝ E' f : α × β → E s : Set α t : Set β hf : Integrable f ⊢ ∫ (z : α × β), f z ∂Measure.prod (Measure.restrict μ s) (Measure.restrict ν t) = ∫ (x : α) in s, ∫ (y : β) in t, f (x, y) ∂ν ∂μ [PROOFSTEP] exact integral_prod f hf [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹³ : MeasurableSpace α inst✝¹² : MeasurableSpace α' inst✝¹¹ : MeasurableSpace β inst✝¹⁰ : MeasurableSpace β' inst✝⁹ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁸ : NormedAddCommGroup E inst✝⁷ : SigmaFinite ν inst✝⁶ : NormedSpace ℝ E inst✝⁵ : CompleteSpace E inst✝⁴ : SigmaFinite μ E' : Type u_7 inst✝³ : NormedAddCommGroup E' inst✝² : CompleteSpace E' inst✝¹ : NormedSpace ℝ E' L : Type u_8 inst✝ : IsROrC L f : α → L g : β → L ⊢ ∫ (z : α × β), f z.fst * g z.snd ∂Measure.prod μ ν = (∫ (x : α), f x ∂μ) * ∫ (y : β), g y ∂ν [PROOFSTEP] by_cases h : Integrable (fun z : α × β => f z.1 * g z.2) (μ.prod ν) [GOAL] case pos α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹³ : MeasurableSpace α inst✝¹² : MeasurableSpace α' inst✝¹¹ : MeasurableSpace β inst✝¹⁰ : MeasurableSpace β' inst✝⁹ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁸ : NormedAddCommGroup E inst✝⁷ : SigmaFinite ν inst✝⁶ : NormedSpace ℝ E inst✝⁵ : CompleteSpace E inst✝⁴ : SigmaFinite μ E' : Type u_7 inst✝³ : NormedAddCommGroup E' inst✝² : CompleteSpace E' inst✝¹ : NormedSpace ℝ E' L : Type u_8 inst✝ : IsROrC L f : α → L g : β → L h : Integrable fun z => f z.fst * g z.snd ⊢ ∫ (z : α × β), f z.fst * g z.snd ∂Measure.prod μ ν = (∫ (x : α), f x ∂μ) * ∫ (y : β), g y ∂ν [PROOFSTEP] rw [integral_prod _ h] [GOAL] case pos α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹³ : MeasurableSpace α inst✝¹² : MeasurableSpace α' inst✝¹¹ : MeasurableSpace β inst✝¹⁰ : MeasurableSpace β' inst✝⁹ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁸ : NormedAddCommGroup E inst✝⁷ : SigmaFinite ν inst✝⁶ : NormedSpace ℝ E inst✝⁵ : CompleteSpace E inst✝⁴ : SigmaFinite μ E' : Type u_7 inst✝³ : NormedAddCommGroup E' inst✝² : CompleteSpace E' inst✝¹ : NormedSpace ℝ E' L : Type u_8 inst✝ : IsROrC L f : α → L g : β → L h : Integrable fun z => f z.fst * g z.snd ⊢ ∫ (x : α), ∫ (y : β), f (x, y).fst * g (x, y).snd ∂ν ∂μ = (∫ (x : α), f x ∂μ) * ∫ (y : β), g y ∂ν [PROOFSTEP] simp_rw [integral_mul_left, integral_mul_right] [GOAL] case neg α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹³ : MeasurableSpace α inst✝¹² : MeasurableSpace α' inst✝¹¹ : MeasurableSpace β inst✝¹⁰ : MeasurableSpace β' inst✝⁹ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁸ : NormedAddCommGroup E inst✝⁷ : SigmaFinite ν inst✝⁶ : NormedSpace ℝ E inst✝⁵ : CompleteSpace E inst✝⁴ : SigmaFinite μ E' : Type u_7 inst✝³ : NormedAddCommGroup E' inst✝² : CompleteSpace E' inst✝¹ : NormedSpace ℝ E' L : Type u_8 inst✝ : IsROrC L f : α → L g : β → L h : ¬Integrable fun z => f z.fst * g z.snd ⊢ ∫ (z : α × β), f z.fst * g z.snd ∂Measure.prod μ ν = (∫ (x : α), f x ∂μ) * ∫ (y : β), g y ∂ν [PROOFSTEP] have H : ¬Integrable f μ ∨ ¬Integrable g ν := by contrapose! h exact integrable_prod_mul h.1 h.2 [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹³ : MeasurableSpace α inst✝¹² : MeasurableSpace α' inst✝¹¹ : MeasurableSpace β inst✝¹⁰ : MeasurableSpace β' inst✝⁹ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁸ : NormedAddCommGroup E inst✝⁷ : SigmaFinite ν inst✝⁶ : NormedSpace ℝ E inst✝⁵ : CompleteSpace E inst✝⁴ : SigmaFinite μ E' : Type u_7 inst✝³ : NormedAddCommGroup E' inst✝² : CompleteSpace E' inst✝¹ : NormedSpace ℝ E' L : Type u_8 inst✝ : IsROrC L f : α → L g : β → L h : ¬Integrable fun z => f z.fst * g z.snd ⊢ ¬Integrable f ∨ ¬Integrable g [PROOFSTEP] contrapose! h [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹³ : MeasurableSpace α inst✝¹² : MeasurableSpace α' inst✝¹¹ : MeasurableSpace β inst✝¹⁰ : MeasurableSpace β' inst✝⁹ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁸ : NormedAddCommGroup E inst✝⁷ : SigmaFinite ν inst✝⁶ : NormedSpace ℝ E inst✝⁵ : CompleteSpace E inst✝⁴ : SigmaFinite μ E' : Type u_7 inst✝³ : NormedAddCommGroup E' inst✝² : CompleteSpace E' inst✝¹ : NormedSpace ℝ E' L : Type u_8 inst✝ : IsROrC L f : α → L g : β → L h : Integrable f ∧ Integrable g ⊢ Integrable fun z => f z.fst * g z.snd [PROOFSTEP] exact integrable_prod_mul h.1 h.2 [GOAL] case neg α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹³ : MeasurableSpace α inst✝¹² : MeasurableSpace α' inst✝¹¹ : MeasurableSpace β inst✝¹⁰ : MeasurableSpace β' inst✝⁹ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁸ : NormedAddCommGroup E inst✝⁷ : SigmaFinite ν inst✝⁶ : NormedSpace ℝ E inst✝⁵ : CompleteSpace E inst✝⁴ : SigmaFinite μ E' : Type u_7 inst✝³ : NormedAddCommGroup E' inst✝² : CompleteSpace E' inst✝¹ : NormedSpace ℝ E' L : Type u_8 inst✝ : IsROrC L f : α → L g : β → L h : ¬Integrable fun z => f z.fst * g z.snd H : ¬Integrable f ∨ ¬Integrable g ⊢ ∫ (z : α × β), f z.fst * g z.snd ∂Measure.prod μ ν = (∫ (x : α), f x ∂μ) * ∫ (y : β), g y ∂ν [PROOFSTEP] cases' H with H H [GOAL] case neg.inl α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹³ : MeasurableSpace α inst✝¹² : MeasurableSpace α' inst✝¹¹ : MeasurableSpace β inst✝¹⁰ : MeasurableSpace β' inst✝⁹ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁸ : NormedAddCommGroup E inst✝⁷ : SigmaFinite ν inst✝⁶ : NormedSpace ℝ E inst✝⁵ : CompleteSpace E inst✝⁴ : SigmaFinite μ E' : Type u_7 inst✝³ : NormedAddCommGroup E' inst✝² : CompleteSpace E' inst✝¹ : NormedSpace ℝ E' L : Type u_8 inst✝ : IsROrC L f : α → L g : β → L h : ¬Integrable fun z => f z.fst * g z.snd H : ¬Integrable f ⊢ ∫ (z : α × β), f z.fst * g z.snd ∂Measure.prod μ ν = (∫ (x : α), f x ∂μ) * ∫ (y : β), g y ∂ν [PROOFSTEP] simp [integral_undef h, integral_undef H] [GOAL] case neg.inr α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹³ : MeasurableSpace α inst✝¹² : MeasurableSpace α' inst✝¹¹ : MeasurableSpace β inst✝¹⁰ : MeasurableSpace β' inst✝⁹ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁸ : NormedAddCommGroup E inst✝⁷ : SigmaFinite ν inst✝⁶ : NormedSpace ℝ E inst✝⁵ : CompleteSpace E inst✝⁴ : SigmaFinite μ E' : Type u_7 inst✝³ : NormedAddCommGroup E' inst✝² : CompleteSpace E' inst✝¹ : NormedSpace ℝ E' L : Type u_8 inst✝ : IsROrC L f : α → L g : β → L h : ¬Integrable fun z => f z.fst * g z.snd H : ¬Integrable g ⊢ ∫ (z : α × β), f z.fst * g z.snd ∂Measure.prod μ ν = (∫ (x : α), f x ∂μ) * ∫ (y : β), g y ∂ν [PROOFSTEP] simp [integral_undef h, integral_undef H] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹³ : MeasurableSpace α inst✝¹² : MeasurableSpace α' inst✝¹¹ : MeasurableSpace β inst✝¹⁰ : MeasurableSpace β' inst✝⁹ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁸ : NormedAddCommGroup E inst✝⁷ : SigmaFinite ν inst✝⁶ : NormedSpace ℝ E inst✝⁵ : CompleteSpace E inst✝⁴ : SigmaFinite μ E' : Type u_7 inst✝³ : NormedAddCommGroup E' inst✝² : CompleteSpace E' inst✝¹ : NormedSpace ℝ E' L : Type u_8 inst✝ : IsROrC L f : α → L g : β → L s : Set α t : Set β ⊢ ∫ (z : α × β) in s ×ˢ t, f z.fst * g z.snd ∂Measure.prod μ ν = (∫ (x : α) in s, f x ∂μ) * ∫ (y : β) in t, g y ∂ν [PROOFSTEP] rw [← Measure.prod_restrict s t] [GOAL] α : Type u_1 α' : Type u_2 β : Type u_3 β' : Type u_4 γ : Type u_5 E : Type u_6 inst✝¹³ : MeasurableSpace α inst✝¹² : MeasurableSpace α' inst✝¹¹ : MeasurableSpace β inst✝¹⁰ : MeasurableSpace β' inst✝⁹ : MeasurableSpace γ μ μ' : Measure α ν ν' : Measure β τ : Measure γ inst✝⁸ : NormedAddCommGroup E inst✝⁷ : SigmaFinite ν inst✝⁶ : NormedSpace ℝ E inst✝⁵ : CompleteSpace E inst✝⁴ : SigmaFinite μ E' : Type u_7 inst✝³ : NormedAddCommGroup E' inst✝² : CompleteSpace E' inst✝¹ : NormedSpace ℝ E' L : Type u_8 inst✝ : IsROrC L f : α → L g : β → L s : Set α t : Set β ⊢ ∫ (z : α × β), f z.fst * g z.snd ∂Measure.prod (Measure.restrict μ s) (Measure.restrict ν t) = (∫ (x : α) in s, f x ∂μ) * ∫ (y : β) in t, g y ∂ν [PROOFSTEP] simp only [← Measure.prod_restrict s t, IntegrableOn, integral_prod_mul]
lemma bilinear_continuous_on_compose: fixes h :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::real_normed_vector" and f :: "'d::t2_space \<Rightarrow> 'a" assumes "continuous_on S f" "continuous_on S g" "bilinear h" shows "continuous_on S (\<lambda>x. h (f x) (g x))"
data Vect: Nat -> Type -> Type where Nil : Vect Z a Cons : a -> Vect x a -> Vect (S x) a insert : a -> Vect x a -> Vect (S x) a insert = Cons
theory Example2 imports Trace begin (* Some lemmas sorried out where proven in other files *) datatype state = State nat nat nat nat datatype variable = IA | FA | IB | FB datatype expr = Var variable | BinOp "nat \<Rightarrow> nat \<Rightarrow> nat" expr expr | UnOp "nat \<Rightarrow> nat" expr | Val nat primrec vars :: "expr \<Rightarrow> variable set" where "vars (Var n) = {n}" | "vars (BinOp f e1 e2) = vars e1 \<union> vars e2" | "vars (UnOp f e) = vars e" | "vars (Val n) = {}" fun lookup :: "state \<Rightarrow> variable \<Rightarrow> nat" where "lookup (State ia fa ib fb) IA = ia" | "lookup (State ia fa ib fb) FA = fa" | "lookup (State ia fa ib fb) IB = ib" | "lookup (State ia fa ib fb) FB = fb" primrec eval :: "state \<Rightarrow> expr \<Rightarrow> nat" where "eval \<sigma> (Var v) = lookup \<sigma> v" | "eval \<sigma> (BinOp f e1 e2) = f (eval \<sigma> e1) (eval \<sigma> e2)" | "eval \<sigma> (UnOp f e) = f (eval \<sigma> e)" | "eval \<sigma> (Val n) = n" lift_definition ends :: "'a set \<Rightarrow> 'a trace" is "\<lambda>P. {t. lfinite t \<and> t \<noteq> LNil \<and> snd (llast t) \<in> P}" by simp lemma atomic_iso: "X \<le> Y \<Longrightarrow> \<langle>X\<rangle> \<le> \<langle>Y\<rangle>" by transfer auto lemma ends_test: "ends P \<cdot> test Q \<le>\<^sub>\<pi> ends (P \<inter> Q)" apply (simp add: proj_leq_def test_def proj_def) apply transfer apply simp apply (rule Mumble_iso) apply (subst fin_l_prod) apply (simp add: FIN_def) apply (metis (lifting) Collect_mono) apply auto apply (simp add: atomic_def image_def) apply auto apply (simp add: atomic_def image_def) apply (erule bexE) apply simp apply (smt Con_def Id_onD' lappend_code(2) lappend_consistent lfinite.simps llast_LCons llast_lappend_LCons mem_Collect_eq) apply (simp add: atomic_def image_def) apply (erule bexE) apply simp by (metis Id_onD' Id_on_fst lappend_code(2) lfinite_LCons llast_lappend llast_singleton llist.distinct(1)) lemma test_ends: "test P \<le> ends P" apply (simp add: test_def) apply transfer apply (simp add: atomic_def) apply (rule Mumble_iso) by (auto simp add: image_def) lemma Mumble_empty: "{}\<^sup>\<dagger> = {}" by (auto simp add: Mumble_def) fun update :: "variable \<Rightarrow> nat \<Rightarrow> state \<Rightarrow> state" where "update IA ia' (State ia fa ib fb) = (State ia' fa ib fb)" | "update FA fa' (State ia fa ib fb) = (State ia fa' ib fb)" | "update IB ib' (State ia fa ib fb) = (State ia fa ib' fb)" | "update FB fb' (State ia fa ib fb) = (State ia fa ib fb')" abbreviation assigns_notation :: "state set \<Rightarrow> variable \<Rightarrow> expr \<Rightarrow> state set" ("_\<lbrakk>_ := _\<rbrakk>" [100,100,100] 101) where "P\<lbrakk>x := e\<rbrakk> \<equiv> (\<lambda>\<sigma>. update x (eval \<sigma> e) \<sigma>) ` P" definition preserves :: "'a set \<Rightarrow> 'a trace" where "preserves P = \<langle>{(\<sigma>, \<sigma>'). \<sigma> \<in> P \<longrightarrow> \<sigma>' \<in> P}\<rangle>\<^sup>\<star>" lemma preserves_RG [simp,intro!]: "preserves X \<in> RG" by (simp add: preserves_def, transfer, auto) definition unchanged :: "variable set \<Rightarrow> state trace" where "unchanged Vars \<equiv> \<langle>{(\<sigma>, \<sigma>'). \<forall>v\<in>Vars. lookup \<sigma> v = lookup \<sigma>' v}\<rangle>\<^sup>\<star>" lemma unchanged_RG [intro!]: "unchanged X \<in> RG" by (simp add: unchanged_def, transfer, auto) definition decreasing :: "variable set \<Rightarrow> state trace" where "decreasing Vars \<equiv> \<langle>{(\<sigma>, \<sigma>'). \<forall>v\<in>Vars. lookup \<sigma> v \<le> lookup \<sigma>' v}\<rangle>\<^sup>\<star>" lemma atomic_shuffle [simp]: "\<langle>R\<rangle>\<^sup>\<star> \<parallel> \<langle>S\<rangle> = \<langle>R\<rangle>\<^sup>\<star> \<cdot> \<langle>S\<rangle> \<cdot> \<langle>R\<rangle>\<^sup>\<star>" sorry lift_definition atomic_fn :: "(state \<Rightarrow> state) \<Rightarrow> state trace" is "\<lambda>f. {LCons (x, f x) LNil |x. True}" by simp definition assign_value :: "variable \<Rightarrow> nat \<Rightarrow> state trace" (infix "\<leftharpoondown>" 110) where "x \<leftharpoondown> v = atomic_fn (update x v)" definition assign :: "variable \<Rightarrow> expr \<Rightarrow> state trace" (infix ":=" 110) where "x := e = (\<Squnion>v. test {\<sigma>. eval \<sigma> e = v} \<cdot> x \<leftharpoondown> v)" lemma assignment: assumes "(x := e) \<le> g" shows "(unchanged (vars e) \<sqinter> preserves P \<sqinter> preserves (P\<lbrakk>x := e\<rbrakk>)), g \<turnstile> \<lbrace>ends P\<rbrace> x := e \<lbrace>ends (P\<lbrakk>x := e\<rbrakk>)\<rbrace>" sorry notation times (infixr ";//" 63) no_notation par (infixl "\<parallel>" 69) notation par (infixr "//\<parallel>" 62) definition while_inv :: "'a set \<Rightarrow> 'a set \<Rightarrow> 'a trace \<Rightarrow> 'a trace" ("WHILE _ //INVARIANT _ //DO _ //WEND" [64,64,64] 63) where "WHILE b INVARIANT i DO p WEND = (test b ; p)\<^sup>\<star> ; test (- b)" definition if_then_else :: "'a set \<Rightarrow> 'a trace \<Rightarrow> 'a trace \<Rightarrow> 'a trace" ("IF _ //THEN _ //ELSE _" [64,64,64] 64) where "IF b THEN p ELSE q = test b \<cdot> p + test b \<cdot> q" definition LEN :: "nat" where "LEN = 10" definition array :: "nat \<Rightarrow> nat" where "array n = n" definition loop1_inv :: "(nat \<Rightarrow> bool) \<Rightarrow> state set" where "loop1_inv p = {\<sigma>. (\<forall>v. even v \<and> v < lookup \<sigma> IA \<longrightarrow> \<not> p (array v)) \<and> even (lookup \<sigma> IA) \<and> ((p (array (lookup \<sigma> FA)) \<and> lookup \<sigma> FA \<le> LEN) \<or> lookup \<sigma> FA = LEN)}" definition loop2_inv :: "(nat \<Rightarrow> bool) \<Rightarrow> state set" where "loop2_inv p = {\<sigma>. (\<forall>v. odd v \<and> v < lookup \<sigma> IB \<longrightarrow> \<not> p (array v)) \<and> odd (lookup \<sigma> IB) \<and> ((p (array (lookup \<sigma> FB)) \<and> lookup \<sigma> FB \<le> LEN) \<or> lookup \<sigma> FB = LEN)}" definition FIND :: "(nat \<Rightarrow> bool) \<Rightarrow> state trace" where "FIND p \<equiv> FA := Val LEN; FB := Val LEN; ( IA := Val 0; WHILE {\<sigma>. lookup \<sigma> IA < lookup \<sigma> FA \<and> lookup \<sigma> IA < lookup \<sigma> FB} INVARIANT loop1_inv p DO IF {\<sigma>. p (array (lookup \<sigma> IA))} THEN FA := Var IA ELSE IA := BinOp op + (Var IA) (Val 2) WEND \<parallel> IB := Val 1; WHILE {\<sigma>. lookup \<sigma> IB < lookup \<sigma> FA \<and> lookup \<sigma> IB < lookup \<sigma> FB} INVARIANT loop2_inv p DO IF {\<sigma>. p (array (lookup \<sigma> IB))} THEN FB := Var IB ELSE IB := BinOp op + (Var IB) (Val 2) WEND)" lemma sequential: "r, g \<turnstile> \<lbrace>p\<rbrace> c1 \<lbrace>x\<rbrace> \<Longrightarrow> r, g \<turnstile> \<lbrace>x\<rbrace> c2 \<lbrace>q\<rbrace> \<Longrightarrow> r, g \<turnstile> \<lbrace>p\<rbrace> c1 \<cdot> c2 \<lbrace>q\<rbrace>" by (metis sequential) lemma while: assumes "ends p \<le> ends i" and "ends (-b \<inter> i) \<le> ends q" and "r, g \<turnstile> \<lbrace>ends (i \<inter> b)\<rbrace> c \<lbrace>ends i\<rbrace>" shows "r, g \<turnstile> \<lbrace>ends p\<rbrace> WHILE b INVARIANT i DO c WEND \<lbrace>ends q\<rbrace>" sorry lemma if_then_else: assumes "r, g \<turnstile> \<lbrace>ends (p \<inter> b)\<rbrace> c1 \<lbrace>ends q\<rbrace>" and "r, g \<turnstile> \<lbrace>ends (p \<inter> - b)\<rbrace> c2 \<lbrace>ends q\<rbrace>" shows "r, g \<turnstile> \<lbrace>ends p\<rbrace> IF b THEN c1 ELSE c2 \<lbrace>ends q\<rbrace>" sorry lemma preserves_inter_leq: "x \<le> preserves X \<Longrightarrow> x \<le> preserves Y \<Longrightarrow> x \<le> preserves (X \<inter> Y)" sorry lemma lookup_update [simp]: "lookup (update v x n) v = x" by (induct v) (induct n, simp)+ lemma [intro]: "1 \<le> unchanged V" apply (simp add: unchanged_def) by (smt star_ref) lemma [intro]: "1 \<le> preserves X" apply (simp add: preserves_def) by (smt star_ref) lemma [intro]: "1 \<le> decreasing X" apply (simp add: decreasing_def) by (smt star_ref) find_theorems "op \<in>" "op `" lemma [intro]: "\<langle>X\<rangle>\<^sup>\<star> \<in> RG" apply transfer apply simp apply (intro Set.imageI) by auto lemma [intro]: "decreasing V \<in> RG" by (auto simp add: decreasing_def) lemma [intro]: "1 \<in> RG" by (metis rg_unit) (* This example only considers finite traces *) lemma [intro]: "x \<le> \<langle>UNIV\<rangle>\<^sup>\<star>" sorry lemma assignment_var: assumes "P\<lbrakk>x := e\<rbrakk> \<le> Q" and "r \<le> unchanged (vars e) \<sqinter> preserves P \<sqinter> preserves (P\<lbrakk>x := e\<rbrakk>)" and "r \<in> RG" and "x := e \<le> g" and "g \<in> RG" shows "r, g \<turnstile> \<lbrace>ends P\<rbrace> x := e \<lbrace>ends Q\<rbrace>" sorry lemma strengthen_guar: "x \<le> g \<Longrightarrow> g \<in> RG \<Longrightarrow> r, x \<turnstile> \<lbrace>p\<rbrace> c \<lbrace>q\<rbrace> \<Longrightarrow> r, g \<turnstile> \<lbrace>p\<rbrace> c \<lbrace>q\<rbrace>" by (auto simp add: quintuple_def proj_leq_def) lemma weaken_rely: "r \<le> x \<Longrightarrow> r \<in> RG \<Longrightarrow> x, g \<turnstile> \<lbrace>p\<rbrace> c \<lbrace>q\<rbrace> \<Longrightarrow> r, g \<turnstile> \<lbrace>p\<rbrace> c \<lbrace>q\<rbrace>" apply (auto simp add: quintuple_def proj_leq_def) by (metis mult_isol par_comm par_isor proj_leq_def proj_leq_trans2) lemma weaken_precondition: "p \<le> x \<Longrightarrow> r, g \<turnstile> \<lbrace>x\<rbrace> c \<lbrace>q\<rbrace> \<Longrightarrow> r, g \<turnstile> \<lbrace>p\<rbrace> c \<lbrace>q\<rbrace>" apply (auto simp add: quintuple_def proj_leq_def) by (metis mult_isor proj_leq_def proj_leq_trans2) lemma strengthen_postcondition_proj: "x \<le>\<^sub>\<pi> q \<Longrightarrow> r, g \<turnstile> \<lbrace>p\<rbrace> c \<lbrace>x\<rbrace> \<Longrightarrow> r, g \<turnstile> \<lbrace>p\<rbrace> c \<lbrace>q\<rbrace>" by (auto simp add: quintuple_def proj_leq_def) lemma strengthen_postcondition: "x \<le> q \<Longrightarrow> r, g \<turnstile> \<lbrace>p\<rbrace> c \<lbrace>x\<rbrace> \<Longrightarrow> r, g \<turnstile> \<lbrace>p\<rbrace> c \<lbrace>q\<rbrace>" apply (auto simp add: quintuple_def proj_leq_def) by (metis order.trans proj_iso) lemma mumble_LCons_not_LNil: "ys \<in> mumble (LCons (\<sigma>, \<sigma>') xs) \<Longrightarrow> ys \<noteq> LNil" by (induct rule: mumble.induct) auto lemma mumble_llast: "ys \<in> mumble (LCons (\<sigma>, \<sigma>') xs) \<Longrightarrow> snd (llast (LCons (\<sigma>, \<sigma>') xs)) \<in> P \<Longrightarrow> snd (llast ys) \<in> P" apply (induct rule: mumble.induct) apply auto by (metis llast_LCons llast_lappend llist.distinct(1) snd_conv) lemma ends_inter [simp]: "ends P \<sqinter> ends Q = ends (P \<inter> Q)" apply transfer apply (auto simp add: Mumble_def) apply (rule_tac x = "mumble xs" in exI) apply auto apply (rule_tac x = xs in exI) apply auto by (metis mumble_llast)+ lemma ends_mono: "P \<subseteq> Q \<Longrightarrow> ends P \<le> ends Q" by transfer (auto simp add: Mumble_def) lemma [intro]: "x \<in> RG \<Longrightarrow> y \<in> RG \<Longrightarrow> x \<sqinter> y \<in> RG" by (metis rg_meet_closed) lemma [simp]: "unchanged {} = \<langle>UNIV\<rangle>\<^sup>\<star>" apply (simp add: unchanged_def) apply (rule arg_cong) back back by auto lemma rg_mono: "X \<le> Y \<Longrightarrow> \<langle>X\<rangle>\<^sup>\<star> \<le> \<langle>Y\<rangle>\<^sup>\<star>" by (intro star_iso[rule_format] atomic_iso) assumption lemma helper_var_lem: "x \<notin> V \<Longrightarrow> va \<in> V \<Longrightarrow> lookup xb va = lookup (update x v xb) va" apply (induct xb) apply (induct va) apply (induct x) apply simp_all apply (induct x) apply simp_all apply (induct x) apply simp_all apply (induct x) by simp_all lemma atomic_assign_unchanged: "x \<notin> V \<Longrightarrow> x \<leftharpoondown> v \<le> unchanged V" apply (simp add: unchanged_def assign_value_def) apply transfer apply simp apply (rule Mumble_iso) apply auto apply (intro atomic_star_elemI) apply auto by (metis helper_var_lem) lemma [intro]: "x \<notin> V \<Longrightarrow> x := v \<le> unchanged V" apply (simp add: unchanged_def assign_def) apply (simp only: SUP_def) apply (rule Sup_least) apply auto apply (simp add: test_def assign_value_def) apply transfer apply simp apply (rule Mumble_iso) apply (subst fin_l_prod) apply (simp add: atomic_def image_def FIN_def) apply force apply (simp add: image_def) apply auto apply (intro atomic_star_elemI) apply (simp_all add: image_def atomic_def) apply (erule bexE) apply simp apply (erule bexE) apply safe apply force by (metis helper_var_lem lmember_code(1) lmember_code(2) lset_lmember prod.inject) lemma [intro]: "X \<le> unchanged {x} \<Longrightarrow> X \<le> decreasing {x}" apply (subgoal_tac "unchanged {x} \<le> decreasing {x}") apply auto apply (simp add: unchanged_def decreasing_def) apply (rule rg_mono) by auto lemma preserves_empty [simp]: "preserves {} = \<langle>UNIV\<rangle>\<^sup>\<star>" by (auto intro: arg_cong simp add: preserves_def) lemma rg_inter: "trans X \<Longrightarrow> trans Y \<Longrightarrow> \<langle>X\<rangle>\<^sup>\<star> \<sqinter> \<langle>Y\<rangle>\<^sup>\<star> = \<langle>X \<inter> Y\<rangle>\<^sup>\<star>" by transfer (metis Mumble_atomic Mumble_atomic_star rely_inter trancl_id) lemma findp_correctness: assumes "FA := Var IA \<le> decreasing {FA}" (* We need an atomic command that combine's a test with an assignment (a guarded assignment *) and "FB := Var IB \<le> decreasing {FB}" shows "1, \<langle>UNIV\<rangle>\<^sup>\<star> \<turnstile> \<lbrace>ends UNIV\<rbrace> FIND P \<lbrace>ends {\<sigma>. P (array (min (lookup \<sigma> FA) (lookup \<sigma> FB))) \<or> (lookup \<sigma> FA = LEN \<and> lookup \<sigma> FB = LEN)}\<rbrace>" apply (simp add: FIND_def) (* First two assignments *) apply (rule_tac x = "ends {\<sigma>. lookup \<sigma> FA = LEN}" in sequential) apply (rule assignment_var) apply (auto simp add: image_def) apply (rule_tac x = "ends {\<sigma>. lookup \<sigma> FA = LEN \<and> lookup \<sigma> FB = LEN}" in sequential) apply (rule assignment_var) apply (auto simp add: image_def) apply (metis lookup.simps(2) state.exhaust update.simps(4)) (* Weakening and strengthening to apply parallel *) apply (rule_tac x = "decreasing {FA} \<sqinter> unchanged {IB, FB} \<parallel> decreasing {FB} \<sqinter> unchanged {IA, FA}" in strengthen_guar) apply auto apply (rule_tac x = "(decreasing {FB} \<sqinter> unchanged {IA, FA}) \<sqinter> (decreasing {FA} \<sqinter> unchanged {IB, FB})" in weaken_rely) apply auto apply (rule_tac x = "ends {\<sigma>. lookup \<sigma> FA = LEN} \<sqinter> ends {\<sigma>. lookup \<sigma> FB = LEN}" in weaken_precondition) apply (force intro: ends_mono) apply (rule_tac x = "ends (loop1_inv P \<inter> - {\<sigma>. lookup \<sigma> IA < lookup \<sigma> FA \<and> lookup \<sigma> IA < lookup \<sigma> FB}) \<sqinter> ends (loop2_inv P \<inter> - {\<sigma>. lookup \<sigma> IB < lookup \<sigma> FA \<and> lookup \<sigma> IB < lookup \<sigma> FB})" in strengthen_postcondition) apply (subst ends_inter) apply (rule ends_mono) apply (simp add: loop1_inv_def loop2_inv_def) apply clarify apply (metis min_def min_max.inf_absorb2) (* Ready to apply parallel *) apply (rule parallel) (* First loop *) apply (rule_tac x = "ends {\<sigma>. lookup \<sigma> FA = LEN \<and> lookup \<sigma> IA = 0}" in sequential) apply (rule assignment_var) apply (simp add: image_def) apply clarify apply (metis lookup.simps(2) lookup_update state.exhaust update.simps(1)) apply (rule le_infI2) apply simp apply (intro conjI) apply force apply (simp add: unchanged_def preserves_def) apply (rule rg_mono) apply force apply (simp add: unchanged_def preserves_def) apply (rule rg_mono) apply (simp add: image_def) apply clarify apply (metis lookup.simps(1) lookup.simps(2) state.exhaust update.simps(1)) apply force apply simp apply (intro conjI) apply force apply force apply force apply (rule while) apply (rule ends_mono) apply (simp add: loop1_inv_def) apply clarify apply (metis even_zero_nat less_nat_zero_code) apply (rule ends_mono) apply (simp add: loop1_inv_def) apply (rule if_then_else) apply (rule assignment_var) apply (simp add: loop1_inv_def image_def) apply clarify apply (rule_tac y = xa in state.exhaust) apply simp apply (metis dual_order.strict_trans not_less) apply (simp add: decreasing_def unchanged_def) apply (intro conjI) apply (subst rg_inter) apply (simp add: trans_def) apply (simp add: trans_def) apply (rule rg_mono) apply blast apply (simp add: preserves_def) apply (subst rg_inter) apply (simp add: trans_def) apply (simp add: trans_def) apply (rule rg_mono) apply clarify apply (simp add: loop1_inv_def) apply (simp add: preserves_def) apply (subst rg_inter) apply (simp add: trans_def) apply (simp add: trans_def) apply (rule rg_mono) apply safe apply (simp add: loop1_inv_def image_def) apply clarify apply (rule_tac y = b in state.exhaust) apply (rule_tac y = \<sigma> in state.exhaust) apply simp apply (rule_tac x = "State nat2 nat2a nat3 nat4" in bexI) apply simp apply simp apply blast defer apply blast apply (rule assignment_var) apply (simp add: loop1_inv_def image_def) apply clarify apply (rule_tac y = xa in state.exhaust) apply simp apply clarify apply (metis dual_order.order_iff_strict even_Suc le_less_linear not_less_eq) apply simp apply (intro conjI) apply (simp add: unchanged_def decreasing_def) apply (subst rg_inter) apply (simp add: trans_def) apply (simp add: trans_def) apply (rule rg_mono) apply blast apply (simp add: unchanged_def decreasing_def preserves_def) apply (subst rg_inter) apply (simp add: trans_def) apply (simp add: trans_def) apply (rule rg_mono) apply (simp add: loop1_inv_def) apply clarify apply (metis dual_order.strict_trans1) apply (simp add: unchanged_def decreasing_def preserves_def) apply (subst rg_inter) apply (simp add: trans_def) apply (simp add: trans_def) apply (rule rg_mono) apply (simp add: loop1_inv_def) apply clarify apply (rule_tac y = a in state.exhaust) apply (rule_tac y = b in state.exhaust) apply (rule_tac y = \<sigma> in state.exhaust) apply (simp add: image_def) apply (erule_tac x = "State nat1b nat2a nat3a nat4a" in ballE) apply clarsimp apply simp apply blast defer apply blast (* Second loop *) apply (rule_tac x = "ends {\<sigma>. lookup \<sigma> FB = LEN \<and> lookup \<sigma> IB = 1}" in sequential) apply (rule assignment_var) apply (simp add: image_def) apply clarify apply (metis lookup.simps(4) lookup_update state.exhaust update.simps(3)) apply (rule le_infI2) apply simp apply (intro conjI) apply force apply (simp add: unchanged_def preserves_def) apply (rule rg_mono) apply force apply (simp add: unchanged_def preserves_def) apply (rule rg_mono) apply (simp add: image_def) apply clarify apply (metis lookup.simps(3) lookup.simps(4) state.exhaust update.simps(3)) apply force apply simp apply (intro conjI) apply force apply force apply force apply (rule while) apply (rule ends_mono) apply (simp add: loop2_inv_def) apply clarify apply (metis even_Suc even_zero_nat less_Suc0) apply (rule ends_mono) apply (simp add: loop1_inv_def) apply (rule if_then_else) apply (rule assignment_var) apply (simp add: loop2_inv_def image_def) apply clarify apply (rule_tac y = xa in state.exhaust) apply simp apply (metis dual_order.strict_trans1 linear) apply (simp add: decreasing_def unchanged_def) apply (intro conjI) apply (subst rg_inter) apply (simp add: trans_def) apply (simp add: trans_def) apply (rule rg_mono) apply blast apply (simp add: preserves_def) apply (subst rg_inter) apply (simp add: trans_def) apply (simp add: trans_def) apply (rule rg_mono) apply clarify apply (simp add: loop2_inv_def) apply (simp add: preserves_def) apply (subst rg_inter) apply (simp add: trans_def) apply (simp add: trans_def) apply (rule rg_mono) apply safe apply (simp add: loop2_inv_def image_def) apply clarify apply (rule_tac y = b in state.exhaust) apply (rule_tac y = \<sigma> in state.exhaust) apply simp apply (rule_tac x = "State nat1 nat2 nat3 nat4a" in bexI) apply simp_all apply blast defer apply blast apply (rule assignment_var) apply (simp add: loop2_inv_def image_def) apply clarify apply (rule_tac y = xa in state.exhaust) apply simp apply clarify apply (metis dual_order.order_iff_strict even_Suc le_less_linear not_less_eq) apply simp apply (intro conjI) apply (simp add: unchanged_def decreasing_def) apply (subst rg_inter) apply (simp add: trans_def) apply (simp add: trans_def) apply (rule rg_mono) apply blast apply (simp add: unchanged_def decreasing_def preserves_def) apply (subst rg_inter) apply (simp add: trans_def) apply (simp add: trans_def) apply (rule rg_mono) apply (simp add: loop2_inv_def) apply clarify apply (metis dual_order.strict_trans1) apply (simp add: unchanged_def decreasing_def preserves_def) apply (subst rg_inter) apply (simp add: trans_def) apply (simp add: trans_def) apply (rule rg_mono) apply (simp add: loop2_inv_def) apply clarify apply (rule_tac y = a in state.exhaust) apply (rule_tac y = b in state.exhaust) apply (rule_tac y = \<sigma> in state.exhaust) apply (simp add: image_def) apply (erule_tac x = "State nat1a nat2a nat3b nat4a" in ballE) apply clarsimp apply simp apply blast defer apply blast (* Simple atomic goals *) apply safe apply auto apply (metis assms(1)) by (metis assms(2))
In early 2007 , the DePaul Political Science Department voted nine to three , and the College of Liberal Arts and Sciences Personnel Committee five to zero , in favor of giving Finkelstein tenure . The three opposing faculty members subsequently filed a minority report opposing tenure , supported by the Dean of the College , Chuck Suchar . Suchar stated he opposed tenure because Finkelstein 's " personal and reputation demeaning attacks on Dershowitz , Benny Morris , and the holocaust authors Elie Wiesel and Jerzy Kosinski " were inconsistent with DePaul 's " Vincentian " values ; as examples of the latter , Suchar argued that Finkelstein lacked respect for " the dignity of the individual " and for " the rights of others to hold and express different intellectual positions " . Amidst considerable public debate , Dershowitz actively campaigned to block Finkelstein 's tenure bid . In June 2007 , a 4 – 3 vote by DePaul University 's Board on Promotion and Tenure ( a faculty board ) , affirmed by the university 's president , the Rev. Dennis <unk> , denied Finkelstein tenure .
module Web.URI.Scheme where open import Web.URI.Scheme.Primitive public using ( Scheme? ; http: ; https: ; ε )
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.PrePort import Mathlib.Lean3Lib.init.default import Mathlib.algebra.category.Module.basic import Mathlib.algebra.category.Group.limits import Mathlib.algebra.direct_limit import Mathlib.PostPort universes u v u_1 namespace Mathlib /-! # The category of R-modules has all limits Further, these limits are preserved by the forgetful functor --- that is, the underlying types are just the limits in the category of types. -/ namespace Module protected instance add_comm_group_obj {R : Type u} [ring R] {J : Type v} [category_theory.small_category J] (F : J ⥤ Module R) (j : J) : add_comm_group (category_theory.functor.obj (F ⋙ category_theory.forget (Module R)) j) := id (is_add_comm_group (category_theory.functor.obj F j)) protected instance module_obj {R : Type u} [ring R] {J : Type v} [category_theory.small_category J] (F : J ⥤ Module R) (j : J) : module R (category_theory.functor.obj (F ⋙ category_theory.forget (Module R)) j) := id (is_module (category_theory.functor.obj F j)) /-- The flat sections of a functor into `Module R` form a submodule of all sections. -/ def sections_submodule {R : Type u} [ring R] {J : Type v} [category_theory.small_category J] (F : J ⥤ Module R) : submodule R ((j : J) → ↥(category_theory.functor.obj F j)) := submodule.mk (category_theory.functor.sections (F ⋙ category_theory.forget (Module R))) sorry sorry sorry protected instance limit_add_comm_group {R : Type u} [ring R] {J : Type v} [category_theory.small_category J] (F : J ⥤ Module R) : add_comm_group (category_theory.limits.cone.X (category_theory.limits.types.limit_cone (F ⋙ category_theory.forget (Module R)))) := id (submodule.add_comm_group (sections_submodule F)) protected instance limit_module {R : Type u} [ring R] {J : Type v} [category_theory.small_category J] (F : J ⥤ Module R) : module R (category_theory.limits.cone.X (category_theory.limits.types.limit_cone (F ⋙ category_theory.forget (Module R)))) := id (submodule.semimodule (sections_submodule F)) /-- `limit.π (F ⋙ forget Ring) j` as a `ring_hom`. -/ def limit_π_linear_map {R : Type u} [ring R] {J : Type v} [category_theory.small_category J] (F : J ⥤ Module R) (j : J) : linear_map R (category_theory.limits.cone.X (category_theory.limits.types.limit_cone (F ⋙ category_theory.forget (Module R)))) (category_theory.functor.obj (F ⋙ category_theory.forget (Module R)) j) := linear_map.mk (category_theory.nat_trans.app (category_theory.limits.cone.π (category_theory.limits.types.limit_cone (F ⋙ category_theory.forget (Module R)))) j) sorry sorry namespace has_limits -- The next two definitions are used in the construction of `has_limits (Module R)`. -- After that, the limits should be constructed using the generic limits API, -- e.g. `limit F`, `limit.cone F`, and `limit.is_limit F`. /-- Construction of a limit cone in `Module R`. (Internal use only; use the limits API.) -/ def limit_cone {R : Type u} [ring R] {J : Type v} [category_theory.small_category J] (F : J ⥤ Module R) : category_theory.limits.cone F := category_theory.limits.cone.mk (of R (category_theory.limits.cone.X (category_theory.limits.types.limit_cone (F ⋙ category_theory.forget (Module R))))) (category_theory.nat_trans.mk (limit_π_linear_map F)) /-- Witness that the limit cone in `Module R` is a limit cone. (Internal use only; use the limits API.) -/ def limit_cone_is_limit {R : Type u} [ring R] {J : Type v} [category_theory.small_category J] (F : J ⥤ Module R) : category_theory.limits.is_limit (limit_cone F) := category_theory.limits.is_limit.of_faithful (category_theory.forget (Module R)) (category_theory.limits.types.limit_cone_is_limit (F ⋙ category_theory.forget (Module R))) (fun (s : category_theory.limits.cone F) => linear_map.mk (fun (v : category_theory.limits.cone.X (category_theory.functor.map_cone (category_theory.forget (Module R)) s)) => { val := fun (j : J) => category_theory.nat_trans.app (category_theory.limits.cone.π (category_theory.functor.map_cone (category_theory.forget (Module R)) s)) j v, property := sorry }) sorry sorry) sorry end has_limits /-- The category of R-modules has all limits. -/ protected instance has_limits {R : Type u} [ring R] : category_theory.limits.has_limits (Module R) := category_theory.limits.has_limits.mk fun (J : Type v) (𝒥 : category_theory.small_category J) => category_theory.limits.has_limits_of_shape.mk fun (F : J ⥤ Module R) => category_theory.limits.has_limit.mk (category_theory.limits.limit_cone.mk sorry sorry) /-- An auxiliary declaration to speed up typechecking. -/ def forget₂_AddCommGroup_preserves_limits_aux {R : Type u} [ring R] {J : Type v} [category_theory.small_category J] (F : J ⥤ Module R) : category_theory.limits.is_limit (category_theory.functor.map_cone (category_theory.forget₂ (Module R) AddCommGroup) (has_limits.limit_cone F)) := AddCommGroup.limit_cone_is_limit (F ⋙ category_theory.forget₂ (Module R) AddCommGroup) /-- The forgetful functor from R-modules to abelian groups preserves all limits. -/ protected instance forget₂_AddCommGroup_preserves_limits {R : Type u} [ring R] : category_theory.limits.preserves_limits (category_theory.forget₂ (Module R) AddCommGroup) := category_theory.limits.preserves_limits.mk fun (J : Type v) (𝒥 : category_theory.small_category J) => category_theory.limits.preserves_limits_of_shape.mk fun (F : J ⥤ Module R) => category_theory.limits.preserves_limit_of_preserves_limit_cone (has_limits.limit_cone_is_limit F) (forget₂_AddCommGroup_preserves_limits_aux F) /-- The forgetful functor from R-modules to types preserves all limits. -/ protected instance forget_preserves_limits {R : Type u} [ring R] : category_theory.limits.preserves_limits (category_theory.forget (Module R)) := category_theory.limits.preserves_limits.mk fun (J : Type u_1) (𝒥 : category_theory.small_category J) => category_theory.limits.preserves_limits_of_shape.mk fun (F : J ⥤ Module R) => category_theory.limits.preserves_limit_of_preserves_limit_cone (has_limits.limit_cone_is_limit F) (category_theory.limits.types.limit_cone_is_limit (F ⋙ category_theory.forget (Module R))) /-- The diagram (in the sense of `category_theory`) of an unbundled `direct_limit` of modules. -/ @[simp] theorem direct_limit_diagram_map {R : Type u} [ring R] {ι : Type v} [directed_order ι] (G : ι → Type v) [(i : ι) → add_comm_group (G i)] [(i : ι) → module R (G i)] (f : (i j : ι) → i ≤ j → linear_map R (G i) (G j)) [module.directed_system G f] (i : ι) (j : ι) (hij : i ⟶ j) : category_theory.functor.map (direct_limit_diagram G f) hij = f i j (direct_limit_diagram._proof_1 i j hij) := Eq.refl (category_theory.functor.map (direct_limit_diagram G f) hij) /-- The `cocone` on `direct_limit_diagram` corresponding to the unbundled `direct_limit` of modules. In `direct_limit_is_colimit` we show that it is a colimit cocone. -/ @[simp] theorem direct_limit_cocone_ι_app {R : Type u} [ring R] {ι : Type v} [directed_order ι] (G : ι → Type v) [(i : ι) → add_comm_group (G i)] [(i : ι) → module R (G i)] (f : (i j : ι) → i ≤ j → linear_map R (G i) (G j)) [module.directed_system G f] [DecidableEq ι] (i : ι) : category_theory.nat_trans.app (category_theory.limits.cocone.ι (direct_limit_cocone G f)) i = module.direct_limit.of R ι G f i := Eq.refl (category_theory.nat_trans.app (category_theory.limits.cocone.ι (direct_limit_cocone G f)) i) /-- The unbundled `direct_limit` of modules is a colimit in the sense of `category_theory`. -/ def direct_limit_is_colimit {R : Type u} [ring R] {ι : Type v} [directed_order ι] (G : ι → Type v) [(i : ι) → add_comm_group (G i)] [(i : ι) → module R (G i)] (f : (i j : ι) → i ≤ j → linear_map R (G i) (G j)) [module.directed_system G f] [DecidableEq ι] [Nonempty ι] : category_theory.limits.is_colimit (direct_limit_cocone G f) := category_theory.limits.is_colimit.mk fun (s : category_theory.limits.cocone (direct_limit_diagram G f)) => module.direct_limit.lift R ι G f (category_theory.nat_trans.app (category_theory.limits.cocone.ι s)) sorry end Mathlib
/- Copyright (c) 2021 Oliver Nash. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Oliver Nash -/ import algebra.hom.non_unital_alg import algebra.lie.basic /-! # Lie algebras as non-unital, non-associative algebras > THIS FILE IS SYNCHRONIZED WITH MATHLIB4. > Any changes to this file require a corresponding PR to mathlib4. The definition of Lie algebras uses the `has_bracket` typeclass for multiplication whereas we have a separate `has_mul` typeclass used for general algebras. It is useful to have a special typeclass for Lie algebras because: * it enables us to use the traditional notation `⁅x, y⁆` for the Lie multiplication, * associative algebras carry a natural Lie algebra structure via the ring commutator and so we need them to carry both `has_mul` and `has_bracket` simultaneously, * more generally, Poisson algebras (not yet defined) need both typeclasses. However there are times when it is convenient to be able to regard a Lie algebra as a general algebra and we provide some basic definitions for doing so here. ## Main definitions * `commutator_ring` turns a Lie ring into a `non_unital_non_assoc_semiring` by turning its `has_bracket` (denoted `⁅, ⁆`) into a `has_mul` (denoted `*`). * `lie_hom.to_non_unital_alg_hom` ## Tags lie algebra, non-unital, non-associative -/ universes u v w variables (R : Type u) (L : Type v) [comm_ring R] [lie_ring L] [lie_algebra R L] /-- Type synonym for turning a `lie_ring` into a `non_unital_non_assoc_semiring`. A `lie_ring` can be regarded as a `non_unital_non_assoc_semiring` by turning its `has_bracket` (denoted `⁅, ⁆`) into a `has_mul` (denoted `*`). -/ def commutator_ring (L : Type v) : Type v := L /-- A `lie_ring` can be regarded as a `non_unital_non_assoc_semiring` by turning its `has_bracket` (denoted `⁅, ⁆`) into a `has_mul` (denoted `*`). -/ instance : non_unital_non_assoc_semiring (commutator_ring L) := show non_unital_non_assoc_semiring L, from { mul := has_bracket.bracket, left_distrib := lie_add, right_distrib := add_lie, zero_mul := zero_lie, mul_zero := lie_zero, .. (infer_instance : add_comm_monoid L) } namespace lie_algebra instance (L : Type v) [nonempty L] : nonempty (commutator_ring L) := ‹nonempty L› instance (L : Type v) [inhabited L] : inhabited (commutator_ring L) := ‹inhabited L› instance : lie_ring (commutator_ring L) := show lie_ring L, by apply_instance instance : lie_algebra R (commutator_ring L) := show lie_algebra R L, by apply_instance /-- Regarding the `lie_ring` of a `lie_algebra` as a `non_unital_non_assoc_semiring`, we can reinterpret the `smul_lie` law as an `is_scalar_tower`. -/ instance is_scalar_tower : is_scalar_tower R (commutator_ring L) (commutator_ring L) := ⟨smul_lie⟩ /-- Regarding the `lie_ring` of a `lie_algebra` as a `non_unital_non_assoc_semiring`, we can reinterpret the `lie_smul` law as an `smul_comm_class`. -/ instance smul_comm_class : smul_comm_class R (commutator_ring L) (commutator_ring L) := ⟨λ t x y, (lie_smul t x y).symm⟩ end lie_algebra namespace lie_hom variables {R L} {L₂ : Type w} [lie_ring L₂] [lie_algebra R L₂] /-- Regarding the `lie_ring` of a `lie_algebra` as a `non_unital_non_assoc_semiring`, we can regard a `lie_hom` as a `non_unital_alg_hom`. -/ @[simps] def to_non_unital_alg_hom (f : L →ₗ⁅R⁆ L₂) : commutator_ring L →ₙₐ[R] commutator_ring L₂ := { to_fun := f, map_zero' := f.map_zero, map_mul' := f.map_lie, ..f } lemma to_non_unital_alg_hom_injective : function.injective (to_non_unital_alg_hom : _ → (commutator_ring L →ₙₐ[R] commutator_ring L₂)) := λ f g h, ext $ non_unital_alg_hom.congr_fun h end lie_hom
// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * * Copyright (C) 1999-2011, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: utf.h * encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * * created on: 1999sep09 * created by: Markus W. Scherer */ /** * \file * \brief C API: Code point macros * * This file defines macros for checking whether a code point is * a surrogate or a non-character etc. * * If U_NO_DEFAULT_INCLUDE_UTF_HEADERS is 0 then utf.h is included by utypes.h * and itself includes utf8.h and utf16.h after some * common definitions. * If U_NO_DEFAULT_INCLUDE_UTF_HEADERS is 1 then each of these headers must be * included explicitly if their definitions are used. * * utf8.h and utf16.h define macros for efficiently getting code points * in and out of UTF-8/16 strings. * utf16.h macros have "u16_" prefixes. * utf8.h defines similar macros with "U8_" prefixes for UTF-8 string handling. * * ICU mostly processes 16-bit Unicode strings. * Most of the time, such strings are well-formed UTF-16. * Single, unpaired surrogates must be handled as well, and are treated in ICU * like regular code points where possible. * (Pairs of surrogate code points are indistinguishable from supplementary * code points encoded as pairs of supplementary code units.) * * In fact, almost all Unicode code points in normal text (>99%) * are on the BMP (<=U+ffff) and even <=U+d7ff. * ICU functions handle supplementary code points (U+10000..U+10ffff) * but are optimized for the much more frequently occurring BMP code points. * * umachine.h defines UChar to be an unsigned 16-bit integer. * Since ICU 59, ICU uses char16_t in C++, UChar only in C, * and defines UChar=char16_t by default. See the UChar API docs for details. * * UChar32 is defined to be a signed 32-bit integer (int32_t), large enough for * a 21-bit Unicode code point (Unicode scalar value, 0..0x10ffff) and * U_SENTINEL (-1). Before ICU 2.4, the definition of UChar32 was similarly * platform-dependent as the definition of UChar. For details see the * documentation for UChar32 itself. * * utf.h defines a small number of C macros for single Unicode code points. * These are simple checks for surrogates and non-characters. * For actual Unicode character properties see uchar.h. * * By default, string operations must be done with error checking in case * a string is not well-formed UTF-16 or UTF-8. * * The u16_ macros detect if a surrogate code unit is unpaired * (lead unit without trail unit or vice versa) and just return the unit itself * as the code point. * * The U8_ macros detect illegal byte sequences and return a negative value. * Starting with ICU 60, the observable length of a single illegal byte sequence * skipped by one of these macros follows the Unicode 6+ recommendation * which is consistent with the W3C Encoding Standard. * * There are ..._OR_FFFD versions of both u16_ and u8_ macros * that return U+FFFD for illegal code unit sequences. * * The regular "safe" macros require that the initial, passed-in string index * is within bounds. They only check the index when they read more than one * code unit. This is usually done with code similar to the following loop: * <pre>while(i<length) { * u16_next(s, i, length, c); * // use c * }</pre> * * When it is safe to assume that text is well-formed UTF-16 * (does not contain single, unpaired surrogates), then one can use * u16_..._UNSAFE macros. * These do not check for proper code unit sequences or truncated text and may * yield wrong results or even cause a crash if they are used with "malformed" * text. * In practice, u16_..._UNSAFE macros will produce slightly less code but * should not be faster because the processing is only different when a * surrogate code unit is detected, which will be rare. * * Similarly for UTF-8, there are "safe" macros without a suffix, * and U8_..._UNSAFE versions. * The performance differences are much larger here because UTF-8 provides so * many opportunities for malformed sequences. * The unsafe UTF-8 macros are entirely implemented inside the macro definitions * and are fast, while the safe UTF-8 macros call functions for some complicated * cases. * * Unlike with UTF-16, malformed sequences cannot be expressed with distinct * code point values (0..U+10ffff). They are indicated with negative values * instead. * * For more information see the ICU User Guide Strings chapter * (http://userguide.icu-project.org/strings). * * <em>Usage:</em> * ICU coding guidelines for if() statements should be followed when using these * macros. Compound statements (curly braces {}) must be used for * if-else-while... bodies and all macro statements should be terminated with * semicolon. * * @stable ICU 2.4 */ #ifndef UTF_H_ #define UTF_H_ #include <boost/text/detail/icu/machine.hpp> /* single-code point definitions -------------------------------------------- */ namespace boost { namespace text { inline namespace v1 { namespace detail { namespace icu { /** * Is this code point a Unicode noncharacter? * @param c 32-bit code point * @return true or false * @stable ICU 2.4 */ inline bool u_is_unicode_nonchar(UChar32 c) { return ( (c) >= 0xfdd0 && ((c) <= 0xfdef || ((c)&0xfffe) == 0xfffe) && (c) <= 0x10ffff); } /** * Is c a Unicode code point value (0..U+10ffff) * that can be assigned a character? * * Code points that are not characters include: * - single surrogate code points (U+d800..U+dfff, 2048 code points) * - the last two code points on each plane (U+fffe and U+ffff, 34 code * points) * - U+fdd0..U+fdef (new with Unicode 3.1, 32 code points) * - the highest Unicode code point value is U+10ffff * * This means that all code points below U+d800 are character code points, * and that boundary is tested first for performance. * * @param c 32-bit code point * @return true or false * @stable ICU 2.4 */ inline bool u_is_unicode_char(UChar32 c) { return ( (uint32_t)(c) < 0xd800 || (0xdfff < (c) && (c) <= 0x10ffff && !detail::icu::u_is_unicode_nonchar(c))); } /** * Is this code point a BMP code point (U+0000..U+ffff)? * @param c 32-bit code point * @return true or false * @stable ICU 2.8 */ inline bool u_is_bmp(UChar32 c) { return ((uint32_t)(c) <= 0xffff); } /** * Is this code point a supplementary code point (U+10000..U+10ffff)? * @param c 32-bit code point * @return true or false * @stable ICU 2.8 */ inline bool u_is_supplementary(UChar32 c) { return ((uint32_t)((c)-0x10000) <= 0xfffff); } /** * Is this code point a lead surrogate (U+d800..U+dbff)? * @param c 32-bit code point * @return true or false * @stable ICU 2.4 */ inline bool u_is_lead(UChar32 c) { return (((c)&0xfffffc00) == 0xd800); } /** * Is this code point a trail surrogate (U+dc00..U+dfff)? * @param c 32-bit code point * @return true or false * @stable ICU 2.4 */ inline bool u_is_trail(UChar32 c) { return (((c)&0xfffffc00) == 0xdc00); } /** * Is this code point a surrogate (U+d800..U+dfff)? * @param c 32-bit code point * @return true or false * @stable ICU 2.4 */ inline bool u_is_surrogate(UChar32 c) { return (((c)&0xfffff800) == 0xd800); } /** * Assuming c is a surrogate code point (u_is_surrogate(c)), * is it a lead surrogate? * @param c 32-bit code point * @return true or false * @stable ICU 2.4 */ inline bool u_is_surrogate_lead(UChar32 c) { return (((c)&0x400) == 0); } /** * Assuming c is a surrogate code point (u_is_surrogate(c)), * is it a trail surrogate? * @param c 32-bit code point * @return true or false * @stable ICU 4.2 */ inline bool u_is_surrogate_trail(UChar32 c) { return (((c)&0x400) != 0); } }}}}} #endif
lemma lim_zero_infinity: fixes l :: "'a::{real_normed_field,field}" shows "((\<lambda>x. f(1 / x)) \<longlongrightarrow> l) (at (0::'a)) \<Longrightarrow> (f \<longlongrightarrow> l) at_infinity"
/- Copyright (c) 2022 Yaël Dillies, Bhavik Mehta. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Bhavik Mehta -/ import data.set.equitable import order.partition.finpartition /-! # Finite equipartitions > THIS FILE IS SYNCHRONIZED WITH MATHLIB4. > Any changes to this file require a corresponding PR to mathlib4. This file defines finite equipartitions, the partitions whose parts all are the same size up to a difference of `1`. ## Main declarations * `finpartition.is_equipartition`: Predicate for a `finpartition` to be an equipartition. -/ open finset fintype namespace finpartition variables {α : Type*} [decidable_eq α] {s t : finset α} (P : finpartition s) /-- An equipartition is a partition whose parts are all the same size, up to a difference of `1`. -/ def is_equipartition : Prop := (P.parts : set (finset α)).equitable_on card lemma is_equipartition_iff_card_parts_eq_average : P.is_equipartition ↔ ∀ a : finset α, a ∈ P.parts → a.card = s.card/P.parts.card ∨ a.card = s.card/P.parts.card + 1 := by simp_rw [is_equipartition, finset.equitable_on_iff, P.sum_card_parts] variables {P} lemma _root_.set.subsingleton.is_equipartition (h : (P.parts : set (finset α)).subsingleton) : P.is_equipartition := h.equitable_on _ lemma is_equipartition.card_parts_eq_average (hP : P.is_equipartition) (ht : t ∈ P.parts) : t.card = s.card / P.parts.card ∨ t.card = s.card / P.parts.card + 1 := P.is_equipartition_iff_card_parts_eq_average.1 hP _ ht lemma is_equipartition.card_part_le_average_add_one (hP : P.is_equipartition) (ht : t ∈ P.parts) : t.card ≤ s.card / P.parts.card + 1 := by { rw ←P.sum_card_parts, exact equitable_on.le_add_one hP ht } /-! ### Discrete and indiscrete finpartition -/ variables (s) lemma bot_is_equipartition : (⊥ : finpartition s).is_equipartition := set.equitable_on_iff_exists_eq_eq_add_one.2 ⟨1, by simp⟩ lemma top_is_equipartition : (⊤ : finpartition s).is_equipartition := (parts_top_subsingleton _).is_equipartition lemma indiscrete_is_equipartition {hs : s ≠ ∅} : (indiscrete hs).is_equipartition := by { rw [is_equipartition, indiscrete_parts, coe_singleton], exact set.equitable_on_singleton s _ } end finpartition
""" RegistryCompatTools makes it easier to discover packages that need [compat] updates. - `held_back_by("SomePkg")` - which packages are holding back SomePkg? - `held_back_packages()["SomePkg"]` - which packages does SomePkg hold back? - `find_julia_packages_github()` - discover which packages I can push to """ module RegistryCompatTools using UUIDs using Pkg using Crayons: Box import GitHub using RegistryTools export held_back_packages, held_back_by, print_held_back, find_julia_packages_github struct Package name::String path::String max_version::VersionNumber end """ HeldBack A struct for a package being held back. Contains the fields: - `name`, name of the package - `last_version`, the last version of the pacakge - `compat`, the compat info of the package holding it back """ struct HeldBack name::String last_version::VersionNumber compat::Pkg.Types.VersionSpec end Base.show(io::IO, hb::HeldBack) = print(io, hb.name, "@", hb.last_version, " {", hb.compat, "}") Base.print(io::IO, hb::HeldBack) = show(io, hb) Base.show(io::IO, ::MIME"text/plain", hb::HeldBack) = print(io, hb.name, "@", Box.LIGHT_GREEN_FG(string(hb.last_version)), " ", Box.LIGHT_RED_FG(string(hb.compat))) function load_versions(path::String) toml = Pkg.Types.parse_toml(joinpath(path, "Versions.toml"); fakeit=true) versions = Dict{VersionNumber, Base.SHA1}( VersionNumber(ver) => Base.SHA1(info["git-tree-sha1"]) for (ver, info) in toml if !get(info, "yanked", false)) return versions end get_newversion(d::Dict{String}, uuid, name, default) = get(d, name, default) get_newversion(d::Dict{UUID}, uuid, name, default) = get(d, uuid, default) """ held_back_packages(; newversions = Dict()) Returns a vector of pairs with the first entry as package names and the values as lists of `HeldBack` objects. Every package in the list is upper bounded to not its last version by the package in the key. See the docs for `HeldBack` for what data it contains. The `newversions` keyword can be used to supply unregistered version numbers for specific packages; this can allow you to prospectively identify packages whose `[compat]` may need to be bumped if you release the specified package version(s). The keys of `newversions` can be `UUID` or `String`; the values should be `VersionNumber`s. """ function held_back_packages(; newversions=Dict{UUID,VersionNumber}()) stdlibs = readdir(Sys.STDLIB) packages = Dict{UUID, Package}() for regspec in Pkg.Types.collect_registries() regpath = regspec.path reg = Pkg.TOML.parsefile(joinpath(regpath, "Registry.toml")) for (uuid, data) in reg["packages"] pkgpath = joinpath(regpath, data["path"]) name = data["name"] versions = load_versions(pkgpath) nv = get_newversion(newversions, uuid, name, nothing) if nv !== nothing versions[nv] = Base.SHA1(fill(0x00, 20)) end max_version = maximum(keys(versions)) packages[UUID(uuid)] = Package(name, pkgpath, max_version) end end packages_holding_back = Dict{String, Vector{HeldBack}}() for (uuid, pkg) in packages pkgpath = pkg.path compatfile = joinpath(pkgpath, "Compat.toml") depfile = joinpath(pkgpath, "Deps.toml") compat_max_version = nothing if isfile(compatfile) compats = RegistryTools.Compress.load(joinpath(pkgpath, "Compat.toml")) compat_max_version = if !haskey(compats, pkg.max_version) nothing else compats[pkg.max_version] end end deps_max_version = nothing if isfile(depfile) deps = RegistryTools.Compress.load(joinpath(pkgpath, "Deps.toml")) deps_max_version = get(deps, pkg.max_version, nothing) if deps_max_version === nothing # No deps at all continue end end if compat_max_version !== nothing && deps_max_version !== nothing packages_being_held_back = HeldBack[] for (dep_name, dep_uuid) in deps_max_version dep_uuid = UUID(dep_uuid) if dep_name in stdlibs continue end compat = get(compat_max_version, dep_name, nothing) # No compat at all declared if compat === nothing continue end compat = Pkg.Types.VersionSpec(compat) dep_pkg = packages[dep_uuid].max_version dep_max_version = packages[dep_uuid].max_version if !(dep_max_version in compat) push!(packages_being_held_back, HeldBack(dep_name, dep_max_version, compat)) end end if !isempty(packages_being_held_back) packages_holding_back[pkg.name] = packages_being_held_back end end end return packages_holding_back end """ held_back_by(pkgname::AbstractString, version::VersionNumber) Return a list of packages would hold back the given not-yet-registered `version` of `pkgname`. """ held_back_by(name::String, version::VersionNumber) = held_back_by(name, held_back_packages(; newversions=Dict(name=>version))) """ held_back_by(pkgname::AbstractString, d=held_back_packages()) Return a list of packages that are holding back `pkgname`. `d` can be obtained from [`held_back_packages`](@ref). """ function held_back_by(name::String, d::AbstractDict=held_back_packages()) heldby = Set{String}() for (k, v) in d for hb in v hb.name == name && push!(heldby, k) end end return sort(collect(heldby)) end held_back_by(name::AbstractString, args...; kwargs...) = held_back_by(String(name), args...; kwargs...) function print_held_back(io::IO=stdout, pkgs=held_back_packages()) color = get(io, :color, false) pad = maximum(textwidth, keys(pkgs)) pkgs = collect(pkgs) sort!(pkgs, by=x->x.first) for (pkg, held_back) in pkgs # This is not how you are supposed to do it... strs = if color sprint.((io, x) -> show(io, MIME("text/plain"), x), held_back) else sprint.(print, held_back) end println(io, rpad(pkg, pad, '-'), "=>[", join(strs, ", "), "]") end end """ find_julia_packages_github()::Set{String} Returns a set of packages that are likely to be Julia packages that you have commit access to. Requries a github token being stored as a `GITHUB_AUTH` env variable. """ function find_julia_packages_github() auth = GitHub.authenticate(ENV["GITHUB_AUTH"]) repos = available_repos(auth) filter!(repos) do repo repo.fork && return false endswith(repo.name, ".jl") || return false end return Set(split(repo.name, ".jl")[1] for repo in repos) end function available_repos(auth) myparams = Dict("per_page" => 100); repos = [] page = 1 while true myparams["page"] = page results = GitHub.gh_get_json(GitHub.DEFAULT_API, "/user/repos"; auth, params = myparams) isempty(results) && break page += 1 repos_page = map(GitHub.Repo, results) append!(repos, repos_page) end return repos end end # module
Formal statement is: lemma LIMSEQ_inverse_zero: assumes "\<And>r::real. \<exists>N. \<forall>n\<ge>N. r < X n" shows "(\<lambda>n. inverse (X n)) \<longlonglongrightarrow> 0" Informal statement is: If $X_n$ is a sequence of positive real numbers such that $X_n > r$ for all $n$ sufficiently large, then $\frac{1}{X_n}$ converges to $0$.
library(ggplot2) library(sitools) mac2name = function(data) { data$mac = as.character(data$mac) data$mac[data$mac == '01:00:5e:7f:ff:fa'] = 'Multicast' data$mac[data$mac == '00:17:88:29:55:4d'] = 'Hue Bridge' data$mac[data$mac == '88:4a:ea:dd:b4:7c'] = 'Neato Robot Vac' data$mac[data$mac == '48:74:6e:6a:fb:47'] = 'iPhone 5s' data$mac[data$mac == 'd0:03:4b:50:75:44'] = 'Apple TV' data$mac[data$mac == '78:4F:43:6E:F4:b1'] = 'MacBook Pro' data$mac[data$mac == '44:65:0d:b4:b2:f5'] = 'Amazon Echo' data$mac[data$mac == 'f8:f0:05:f7:70:21'] = 'WINC-70-21' data$mac[data$mac == '78:4f:43:6e:f4:b1'] = 'James\' iPad'# (1)' data$mac[data$mac == '18:65:90:43:0c:58'] = 'James\' iPad'# (2)' data$mac[data$mac == 'b0:70:2d:e4:1e:82'] = 'James\' iPad'# (3)' data$mac[data$mac == '88:30:8a:77:5f:cc'] = 'James\' iPad'# (4)' data$mac[data$mac == '78:7e:61:90:e4:c0'] = 'James\' iPad'# (5)' data$mac[data$mac == '70:ee:50:12:84:aa'] = 'James\' iPad'# (6)' data$mac[data$mac == '84:89:ad:3e:33:66'] = 'James\' iPad'# (7)' data$mac[data$mac == '6c:19:c0:81:a9:cb'] = 'James\' iPad'# (8)' data$mac[data$mac == 'f0:9f:c2:30:7f:59'] = 'Ubiquiti Access Point' data$mac[data$mac == 'ff:ff:ff:ff:ff:ff'] = 'Broadcast' data$mac[data$mac == '3c:46:d8:bc:9b:f4'] = 'TP Link MR6400' data$mac[data$mac == '08:02:8e:97:da:3d'] = 'DLink Switch' data$mac[data$mac == '50:c7:bf:0b:0a:71'] = '2x TP Link HS110'# (1)' data$mac[data$mac == '50:c7:bf:0b:08:2e'] = '2x TP Link HS110'# (2)' data$mac[data$mac == 'd0:52:a8:45:41:f6'] = 'SmartThings Hub' data$mac[data$mac == 'f0:fe:6b:28:ca:e2'] = 'Foobot' data = data[data$mac != 'TP Link MR6400',] return(data) } data = mac2name(read.csv('mac-service-bytes.csv')) data$service = as.character(data$service) data$service[data$service == '-'] = 'other' ggplot(data, aes(mac)) + labs(x = "Originating Device", y = "Transmitted (bytes)") + geom_bar(aes(weight = bytes, fill = service), las = 2) + #geom_bar(aes(reorder(mac, -bytes), bytes, fill = service), las = 2, stat='identity') + scale_y_continuous(labels=f2si) + theme_bw(base_size=14) + #scale_fill_brewer(palette = 'Set2') + theme( #panel.grid.major = element_line(colour = "white"), #panel.grid.minor = element_line(colour = "white"), axis.text = element_text(size = 16), axis.text.x = element_text(angle=90,hjust=1,vjust=0.5), #axis.title = element_text(size = 20, face="bold") axis.title = element_text(size = 18), legend.text=element_text(size=14) ) ggsave('mac-service-bytes.pdf') data = mac2name(read.csv('mac-protocol-bytes.csv')) ggplot(data, aes(mac)) + labs(x = "Originating Device", y = "Transmitted (bytes)") + geom_bar(aes(weight = bytes, fill = protocol), las = 2) + scale_y_continuous(labels=f2si) + theme_bw(base_size=14) + #scale_fill_brewer(palette = 'Set2') + theme( #panel.grid.major = element_line(colour = "white"), #panel.grid.minor = element_line(colour = "white"), axis.text = element_text(size = 16), axis.text.x = element_text(angle=90,hjust=1,vjust=0.5), #axis.title = element_text(size = 20, face="bold") axis.title = element_text(size = 18), legend.text=element_text(size=14) ) ggsave('mac-protocol-bytes.pdf') #data = mac2name(read.csv('mac-service-bytes-resp.csv')) #ggplot(data, aes(mac)) + # labs(x = "Responding Device", y = "Transmitted (bytes)") + # geom_bar(aes(weight = bytes, fill = service), las = 2) + # scale_y_continuous(labels=f2si) + # theme_bw(base_size=14) + # theme( # #panel.grid.major = element_line(colour = "white"), # #panel.grid.minor = element_line(colour = "white"), # axis.text = element_text(size = 16), # axis.text.x = element_text(angle=90,hjust=1,vjust=0.5), # #axis.title = element_text(size = 20, face="bold") # ) #ggsave('mac-service-bytes-resp.pdf') data0 = mac2name(read.csv('orig-resp-bytes-extern.csv')) data0$type = rep('external', nrow(data0)) data1 = mac2name(read.csv('orig-resp-bytes-intern.csv')) data1$type = rep('internal', nrow(data1)) data = rbind(data0, data1) ggplot(data, aes(mac)) + labs(x = "Device", y = "Traffic (bytes)") + geom_bar(aes(weight = bytes, fill = type), las = 2) + scale_y_continuous(labels=f2si) + theme_bw(base_size=14) + #scale_fill_brewer(palette = 'Set2') + theme( #panel.grid.major = element_line(colour = "white"), #panel.grid.minor = element_line(colour = "white"), axis.text = element_text(size = 16), axis.text.x = element_text(angle=90,hjust=1,vjust=0.5), #axis.title = element_text(size = 20, face="bold") axis.title = element_text(size = 18), legend.text=element_text(size=14) ) ggsave('mac-type-bytes.pdf')
function [facecolor, linestyle, marker] = getFaceColorForSRMethod(srMethodName) srMethods = {'nn', 'bicubic', 'ebsr', 'scsr', 'nbsrf', 'aplus', 'srcnn', 'drcn', 'vdsr', 'sesr', 'nuisr', 'wnuisr', 'hysr', 'dbrsr', 'l1btv', 'bepsr', 'irwsr', 'bvsr', 'srb', 'vsrnet'}; % Get face color for the SR method. colorMap = jet(30); facecolor = [colorMap(1:10,:); colorMap(21:30,:)]; facecolor = facecolor( strcmp(srMethodName, srMethods), :); if nargout > 1 % Get line style for the SR method. linestyle = cellstr(char('-', ':', '-.', '--', '-', ':', '-.', '--', '-', ':', '-.', '--', '-', ':', '-.', '--', '-', ':', '-.', '--')); linestyle = linestyle{ strcmp(srMethodName, srMethods) }; end if nargout > 2 % Get marker for the SR method. marker = ['o', 'x', '+', '*', 's', 'd', 'v', '^', '<', '>', 'o', 'x', '+', '*', 's', 'd', 'v', '^', '<', '>']; marker = marker(strcmp(srMethodName, srMethods)); end
[STATEMENT] lemma path_component_of_mono: "\<lbrakk>path_component_of (subtopology X S) x y; S \<subseteq> T\<rbrakk> \<Longrightarrow> path_component_of (subtopology X T) x y" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>path_component_of (subtopology X S) x y; S \<subseteq> T\<rbrakk> \<Longrightarrow> path_component_of (subtopology X T) x y [PROOF STEP] unfolding path_component_of_def [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>\<exists>g. pathin (subtopology X S) g \<and> g 0 = x \<and> g 1 = y; S \<subseteq> T\<rbrakk> \<Longrightarrow> \<exists>g. pathin (subtopology X T) g \<and> g 0 = x \<and> g 1 = y [PROOF STEP] by (metis subsetD pathin_subtopology)
If $l$ is a limit point of the range of $f$, then there exists a subsequence of $f$ that converges to $l$.
[GOAL] α : Type u inst✝ : DecidableEq α a : α l : List α h : a ∈ dedup l ⊢ ¬∀ (b : α), b ∈ pwFilter (fun x x_1 => x ≠ x_1) l → a ≠ b [PROOFSTEP] simpa only [forall_mem_ne, not_not] using h [GOAL] α : Type u inst✝ : DecidableEq α a : α l : List α h : ¬a ∈ dedup l ⊢ ∀ (b : α), b ∈ pwFilter (fun x x_1 => x ≠ x_1) l → a ≠ b [PROOFSTEP] simpa only [forall_mem_ne] using h [GOAL] α : Type u inst✝ : DecidableEq α a : α l : List α ⊢ a ∈ dedup l ↔ a ∈ l [PROOFSTEP] have := not_congr (@forall_mem_pwFilter α (· ≠ ·) _ ?_ a l) [GOAL] case refine_2 α : Type u inst✝ : DecidableEq α a : α l : List α this : (¬∀ (b : α), b ∈ pwFilter (fun x x_1 => x ≠ x_1) l → a ≠ b) ↔ ¬∀ (b : α), b ∈ l → a ≠ b ⊢ a ∈ dedup l ↔ a ∈ l case refine_1 α : Type u inst✝ : DecidableEq α a : α l : List α ⊢ ∀ {x y z : α}, (fun x x_1 => x ≠ x_1) x z → (fun x x_1 => x ≠ x_1) x y ∨ (fun x x_1 => x ≠ x_1) y z [PROOFSTEP] simpa only [dedup, forall_mem_ne, not_not] using this [GOAL] case refine_1 α : Type u inst✝ : DecidableEq α a : α l : List α ⊢ ∀ {x y z : α}, (fun x x_1 => x ≠ x_1) x z → (fun x x_1 => x ≠ x_1) x y ∨ (fun x x_1 => x ≠ x_1) y z [PROOFSTEP] intros x y z xz [GOAL] case refine_1 α : Type u inst✝ : DecidableEq α a : α l : List α x y z : α xz : x ≠ z ⊢ (fun x x_1 => x ≠ x_1) x y ∨ (fun x x_1 => x ≠ x_1) y z [PROOFSTEP] exact not_and_or.1 <| mt (fun h ↦ h.1.trans h.2) xz [GOAL] α : Type u inst✝¹ : DecidableEq α inst✝ : Inhabited α l✝ : List α a : α l : List α ⊢ headI (dedup (a :: l)) = if headI (a :: l) ∈ tail (a :: l) then headI (dedup (tail (a :: l))) else headI (a :: l) [PROOFSTEP] by_cases ha : a ∈ l [GOAL] case pos α : Type u inst✝¹ : DecidableEq α inst✝ : Inhabited α l✝ : List α a : α l : List α ha : a ∈ l ⊢ headI (dedup (a :: l)) = if headI (a :: l) ∈ tail (a :: l) then headI (dedup (tail (a :: l))) else headI (a :: l) [PROOFSTEP] simp [ha, List.dedup_cons_of_mem] [GOAL] case neg α : Type u inst✝¹ : DecidableEq α inst✝ : Inhabited α l✝ : List α a : α l : List α ha : ¬a ∈ l ⊢ headI (dedup (a :: l)) = if headI (a :: l) ∈ tail (a :: l) then headI (dedup (tail (a :: l))) else headI (a :: l) [PROOFSTEP] simp [ha, List.dedup_cons_of_mem] [GOAL] α : Type u inst✝¹ : DecidableEq α inst✝ : Inhabited α l✝ : List α a : α l : List α ⊢ tail (dedup (a :: l)) = if headI (a :: l) ∈ tail (a :: l) then tail (dedup (tail (a :: l))) else dedup (tail (a :: l)) [PROOFSTEP] by_cases ha : a ∈ l [GOAL] case pos α : Type u inst✝¹ : DecidableEq α inst✝ : Inhabited α l✝ : List α a : α l : List α ha : a ∈ l ⊢ tail (dedup (a :: l)) = if headI (a :: l) ∈ tail (a :: l) then tail (dedup (tail (a :: l))) else dedup (tail (a :: l)) [PROOFSTEP] simp [ha, List.dedup_cons_of_mem] [GOAL] case neg α : Type u inst✝¹ : DecidableEq α inst✝ : Inhabited α l✝ : List α a : α l : List α ha : ¬a ∈ l ⊢ tail (dedup (a :: l)) = if headI (a :: l) ∈ tail (a :: l) then tail (dedup (tail (a :: l))) else dedup (tail (a :: l)) [PROOFSTEP] simp [ha, List.dedup_cons_of_mem] [GOAL] α : Type u inst✝ : DecidableEq α l : List α a : α l' : List α ⊢ dedup l = a :: l' ↔ a ∈ l ∧ ¬a ∈ l' ∧ tail (dedup l) = l' [PROOFSTEP] refine' ⟨fun h => _, fun h => _⟩ [GOAL] case refine'_1 α : Type u inst✝ : DecidableEq α l : List α a : α l' : List α h : dedup l = a :: l' ⊢ a ∈ l ∧ ¬a ∈ l' ∧ tail (dedup l) = l' [PROOFSTEP] refine' ⟨mem_dedup.1 (h.symm ▸ mem_cons_self _ _), fun ha => _, by rw [h, tail_cons]⟩ [GOAL] α : Type u inst✝ : DecidableEq α l : List α a : α l' : List α h : dedup l = a :: l' ⊢ tail (dedup l) = l' [PROOFSTEP] rw [h, tail_cons] [GOAL] case refine'_1 α : Type u inst✝ : DecidableEq α l : List α a : α l' : List α h : dedup l = a :: l' ha : a ∈ l' ⊢ False [PROOFSTEP] have : count a l.dedup ≤ 1 := nodup_iff_count_le_one.1 (nodup_dedup l) a [GOAL] case refine'_1 α : Type u inst✝ : DecidableEq α l : List α a : α l' : List α h : dedup l = a :: l' ha : a ∈ l' this : count a (dedup l) ≤ 1 ⊢ False [PROOFSTEP] rw [h, count_cons_self, add_le_iff_nonpos_left] at this [GOAL] case refine'_1 α : Type u inst✝ : DecidableEq α l : List α a : α l' : List α h : dedup l = a :: l' ha : a ∈ l' this : count a l' ≤ 0 ⊢ False [PROOFSTEP] exact not_le_of_lt (count_pos.2 ha) this [GOAL] case refine'_2 α : Type u inst✝ : DecidableEq α l : List α a : α l' : List α h : a ∈ l ∧ ¬a ∈ l' ∧ tail (dedup l) = l' ⊢ dedup l = a :: l' [PROOFSTEP] have := @List.cons_head!_tail α ⟨a⟩ _ (ne_nil_of_mem (mem_dedup.2 h.1)) [GOAL] case refine'_2 α : Type u inst✝ : DecidableEq α l : List α a : α l' : List α h : a ∈ l ∧ ¬a ∈ l' ∧ tail (dedup l) = l' this : head! (dedup l) :: tail (dedup l) = dedup l ⊢ dedup l = a :: l' [PROOFSTEP] have hal : a ∈ l.dedup := mem_dedup.2 h.1 [GOAL] case refine'_2 α : Type u inst✝ : DecidableEq α l : List α a : α l' : List α h : a ∈ l ∧ ¬a ∈ l' ∧ tail (dedup l) = l' this : head! (dedup l) :: tail (dedup l) = dedup l hal : a ∈ dedup l ⊢ dedup l = a :: l' [PROOFSTEP] rw [← this, mem_cons, or_iff_not_imp_right] at hal [GOAL] case refine'_2 α : Type u inst✝ : DecidableEq α l : List α a : α l' : List α h : a ∈ l ∧ ¬a ∈ l' ∧ tail (dedup l) = l' this : head! (dedup l) :: tail (dedup l) = dedup l hal : ¬a ∈ tail (dedup l) → a = head! (dedup l) ⊢ dedup l = a :: l' [PROOFSTEP] exact this ▸ h.2.2.symm ▸ cons_eq_cons.2 ⟨(hal (h.2.2.symm ▸ h.2.1)).symm, rfl⟩ [GOAL] α : Type u inst✝ : DecidableEq α l : List α ⊢ dedup l = [] ↔ l = [] [PROOFSTEP] induction' l with a l hl [GOAL] case nil α : Type u inst✝ : DecidableEq α ⊢ dedup [] = [] ↔ [] = [] [PROOFSTEP] exact Iff.rfl [GOAL] case cons α : Type u inst✝ : DecidableEq α a : α l : List α hl : dedup l = [] ↔ l = [] ⊢ dedup (a :: l) = [] ↔ a :: l = [] [PROOFSTEP] by_cases h : a ∈ l [GOAL] case pos α : Type u inst✝ : DecidableEq α a : α l : List α hl : dedup l = [] ↔ l = [] h : a ∈ l ⊢ dedup (a :: l) = [] ↔ a :: l = [] [PROOFSTEP] simp only [List.dedup_cons_of_mem h, hl, List.ne_nil_of_mem h] [GOAL] case neg α : Type u inst✝ : DecidableEq α a : α l : List α hl : dedup l = [] ↔ l = [] h : ¬a ∈ l ⊢ dedup (a :: l) = [] ↔ a :: l = [] [PROOFSTEP] simp only [List.dedup_cons_of_not_mem h, List.cons_ne_nil] [GOAL] α : Type u inst✝ : DecidableEq α l₁ l₂ : List α ⊢ dedup (l₁ ++ l₂) = l₁ ∪ dedup l₂ [PROOFSTEP] induction' l₁ with a l₁ IH [GOAL] case nil α : Type u inst✝ : DecidableEq α l₂ : List α ⊢ dedup ([] ++ l₂) = [] ∪ dedup l₂ [PROOFSTEP] rfl [GOAL] case cons α : Type u inst✝ : DecidableEq α l₂ : List α a : α l₁ : List α IH : dedup (l₁ ++ l₂) = l₁ ∪ dedup l₂ ⊢ dedup (a :: l₁ ++ l₂) = a :: l₁ ∪ dedup l₂ [PROOFSTEP] simp only [cons_union] at * [GOAL] case cons α : Type u inst✝ : DecidableEq α l₂ : List α a : α l₁ : List α IH : dedup (l₁ ++ l₂) = l₁ ∪ dedup l₂ ⊢ dedup (a :: l₁ ++ l₂) = List.insert a (l₁ ∪ dedup l₂) [PROOFSTEP] rw [← IH, cons_append] [GOAL] case cons α : Type u inst✝ : DecidableEq α l₂ : List α a : α l₁ : List α IH : dedup (l₁ ++ l₂) = l₁ ∪ dedup l₂ ⊢ dedup (a :: (l₁ ++ l₂)) = List.insert a (dedup (l₁ ++ l₂)) [PROOFSTEP] by_cases h : a ∈ dedup (l₁ ++ l₂) [GOAL] case pos α : Type u inst✝ : DecidableEq α l₂ : List α a : α l₁ : List α IH : dedup (l₁ ++ l₂) = l₁ ∪ dedup l₂ h : a ∈ dedup (l₁ ++ l₂) ⊢ dedup (a :: (l₁ ++ l₂)) = List.insert a (dedup (l₁ ++ l₂)) [PROOFSTEP] rw [dedup_cons_of_mem' h, insert_of_mem h] [GOAL] case neg α : Type u inst✝ : DecidableEq α l₂ : List α a : α l₁ : List α IH : dedup (l₁ ++ l₂) = l₁ ∪ dedup l₂ h : ¬a ∈ dedup (l₁ ++ l₂) ⊢ dedup (a :: (l₁ ++ l₂)) = List.insert a (dedup (l₁ ++ l₂)) [PROOFSTEP] rw [dedup_cons_of_not_mem' h, insert_of_not_mem h] [GOAL] α : Type u inst✝ : DecidableEq α x : α n : ℕ x✝ : n + 2 ≠ 0 ⊢ dedup (replicate (n + 2) x) = [x] [PROOFSTEP] rw [replicate_succ, dedup_cons_of_mem (mem_replicate.2 ⟨n.succ_ne_zero, rfl⟩), replicate_dedup n.succ_ne_zero] [GOAL] α : Type u inst✝ : DecidableEq α l : List α a : α ⊢ count a (dedup l) = if a ∈ l then 1 else 0 [PROOFSTEP] simp_rw [count_eq_of_nodup <| nodup_dedup l, mem_dedup] [GOAL] α : Type u inst✝ : DecidableEq α p : α → Bool l : List α ⊢ sum (map (fun x => count x l) (filter p (dedup l))) = countp p l [PROOFSTEP] induction' l with a as h [GOAL] case nil α : Type u inst✝ : DecidableEq α p : α → Bool ⊢ sum (map (fun x => count x []) (filter p (dedup []))) = countp p [] [PROOFSTEP] simp [GOAL] case cons α : Type u inst✝ : DecidableEq α p : α → Bool a : α as : List α h : sum (map (fun x => count x as) (filter p (dedup as))) = countp p as ⊢ sum (map (fun x => count x (a :: as)) (filter p (dedup (a :: as)))) = countp p (a :: as) [PROOFSTEP] simp_rw [List.countp_cons, List.count_cons', List.sum_map_add] [GOAL] case cons α : Type u inst✝ : DecidableEq α p : α → Bool a : α as : List α h : sum (map (fun x => count x as) (filter p (dedup as))) = countp p as ⊢ sum (map (fun i => count i as) (filter p (dedup (a :: as)))) + sum (map (fun i => if i = a then 1 else 0) (filter p (dedup (a :: as)))) = countp p as + if p a = true then 1 else 0 [PROOFSTEP] congr 1 [GOAL] case cons.e_a α : Type u inst✝ : DecidableEq α p : α → Bool a : α as : List α h : sum (map (fun x => count x as) (filter p (dedup as))) = countp p as ⊢ sum (map (fun i => count i as) (filter p (dedup (a :: as)))) = countp p as [PROOFSTEP] refine' _root_.trans _ h [GOAL] case cons.e_a α : Type u inst✝ : DecidableEq α p : α → Bool a : α as : List α h : sum (map (fun x => count x as) (filter p (dedup as))) = countp p as ⊢ sum (map (fun i => count i as) (filter p (dedup (a :: as)))) = sum (map (fun x => count x as) (filter p (dedup as))) [PROOFSTEP] by_cases ha : a ∈ as [GOAL] case pos α : Type u inst✝ : DecidableEq α p : α → Bool a : α as : List α h : sum (map (fun x => count x as) (filter p (dedup as))) = countp p as ha : a ∈ as ⊢ sum (map (fun i => count i as) (filter p (dedup (a :: as)))) = sum (map (fun x => count x as) (filter p (dedup as))) [PROOFSTEP] simp [dedup_cons_of_mem ha] [GOAL] case neg α : Type u inst✝ : DecidableEq α p : α → Bool a : α as : List α h : sum (map (fun x => count x as) (filter p (dedup as))) = countp p as ha : ¬a ∈ as ⊢ sum (map (fun i => count i as) (filter p (dedup (a :: as)))) = sum (map (fun x => count x as) (filter p (dedup as))) [PROOFSTEP] simp only [dedup_cons_of_not_mem ha, List.filter] [GOAL] case neg α : Type u inst✝ : DecidableEq α p : α → Bool a : α as : List α h : sum (map (fun x => count x as) (filter p (dedup as))) = countp p as ha : ¬a ∈ as ⊢ sum (map (fun i => count i as) (match p a with | true => a :: filter p (dedup as) | false => filter p (dedup as))) = sum (map (fun i => count i as) (filter p (dedup as))) [PROOFSTEP] match p a with | true => simp only [List.map_cons, List.sum_cons, List.count_eq_zero.2 ha, zero_add] | false => simp only [GOAL] α : Type u inst✝ : DecidableEq α p : α → Bool a : α as : List α h : sum (map (fun x => count x as) (filter p (dedup as))) = countp p as ha : ¬a ∈ as ⊢ sum (map (fun i => count i as) (match true with | true => a :: filter p (dedup as) | false => filter p (dedup as))) = sum (map (fun i => count i as) (filter p (dedup as))) [PROOFSTEP] simp only [List.map_cons, List.sum_cons, List.count_eq_zero.2 ha, zero_add] [GOAL] α : Type u inst✝ : DecidableEq α p : α → Bool a : α as : List α h : sum (map (fun x => count x as) (filter p (dedup as))) = countp p as ha : ¬a ∈ as ⊢ sum (map (fun i => count i as) (match false with | true => a :: filter p (dedup as) | false => filter p (dedup as))) = sum (map (fun i => count i as) (filter p (dedup as))) [PROOFSTEP] simp only [GOAL] case cons.e_a α : Type u inst✝ : DecidableEq α p : α → Bool a : α as : List α h : sum (map (fun x => count x as) (filter p (dedup as))) = countp p as ⊢ sum (map (fun i => if i = a then 1 else 0) (filter p (dedup (a :: as)))) = if p a = true then 1 else 0 [PROOFSTEP] by_cases hp : p a [GOAL] case pos α : Type u inst✝ : DecidableEq α p : α → Bool a : α as : List α h : sum (map (fun x => count x as) (filter p (dedup as))) = countp p as hp : p a = true ⊢ sum (map (fun i => if i = a then 1 else 0) (filter p (dedup (a :: as)))) = if p a = true then 1 else 0 [PROOFSTEP] refine' _root_.trans (sum_map_eq_nsmul_single a _ fun _ h _ => by simp [h]) _ [GOAL] α : Type u inst✝ : DecidableEq α p : α → Bool a : α as : List α h✝ : sum (map (fun x => count x as) (filter p (dedup as))) = countp p as hp : p a = true x✝¹ : α h : x✝¹ ≠ a x✝ : x✝¹ ∈ filter p (dedup (a :: as)) ⊢ (if x✝¹ = a then 1 else 0) = 0 [PROOFSTEP] simp [h] [GOAL] case pos α : Type u inst✝ : DecidableEq α p : α → Bool a : α as : List α h : sum (map (fun x => count x as) (filter p (dedup as))) = countp p as hp : p a = true ⊢ (count a (filter p (dedup (a :: as))) • if a = a then 1 else 0) = if p a = true then 1 else 0 [PROOFSTEP] simp [hp, count_dedup] [GOAL] case neg α : Type u inst✝ : DecidableEq α p : α → Bool a : α as : List α h : sum (map (fun x => count x as) (filter p (dedup as))) = countp p as hp : ¬p a = true ⊢ sum (map (fun i => if i = a then 1 else 0) (filter p (dedup (a :: as)))) = if p a = true then 1 else 0 [PROOFSTEP] refine' _root_.trans (List.sum_eq_zero fun n hn => _) (by simp [hp]) [GOAL] α : Type u inst✝ : DecidableEq α p : α → Bool a : α as : List α h : sum (map (fun x => count x as) (filter p (dedup as))) = countp p as hp : ¬p a = true ⊢ 0 = if p a = true then 1 else 0 [PROOFSTEP] simp [hp] [GOAL] case neg α : Type u inst✝ : DecidableEq α p : α → Bool a : α as : List α h : sum (map (fun x => count x as) (filter p (dedup as))) = countp p as hp : ¬p a = true n : ℕ hn : n ∈ map (fun i => if i = a then 1 else 0) (filter p (dedup (a :: as))) ⊢ n = 0 [PROOFSTEP] obtain ⟨a', ha'⟩ := List.mem_map.1 hn [GOAL] case neg.intro α : Type u inst✝ : DecidableEq α p : α → Bool a : α as : List α h : sum (map (fun x => count x as) (filter p (dedup as))) = countp p as hp : ¬p a = true n : ℕ hn : n ∈ map (fun i => if i = a then 1 else 0) (filter p (dedup (a :: as))) a' : α ha' : a' ∈ filter p (dedup (a :: as)) ∧ (if a' = a then 1 else 0) = n ⊢ n = 0 [PROOFSTEP] split_ifs at ha' with ha [GOAL] case pos α : Type u inst✝ : DecidableEq α p : α → Bool a : α as : List α h : sum (map (fun x => count x as) (filter p (dedup as))) = countp p as hp : ¬p a = true n : ℕ hn : n ∈ map (fun i => if i = a then 1 else 0) (filter p (dedup (a :: as))) a' : α ha : a' = a ha' : a' ∈ filter p (dedup (a :: as)) ∧ 1 = n ⊢ n = 0 [PROOFSTEP] simp only [ha, mem_filter, mem_dedup, find?, mem_cons, true_or, hp, and_false, false_and] at ha' [GOAL] case neg α : Type u inst✝ : DecidableEq α p : α → Bool a : α as : List α h : sum (map (fun x => count x as) (filter p (dedup as))) = countp p as hp : ¬p a = true n : ℕ hn : n ∈ map (fun i => if i = a then 1 else 0) (filter p (dedup (a :: as))) a' : α ha : ¬a' = a ha' : a' ∈ filter p (dedup (a :: as)) ∧ 0 = n ⊢ n = 0 [PROOFSTEP] exact ha'.2.symm [GOAL] α : Type u inst✝ : DecidableEq α l : List α ⊢ sum (map (fun x => count x l) (dedup l)) = length l [PROOFSTEP] simpa using sum_map_count_dedup_filter_eq_countp (fun _ => True) l
[STATEMENT] lemma branchStops: "branch subs Gamma f ==> terminal subs (f n) ==> f (Suc n) = f n" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>branch subs Gamma f; terminal subs (f n)\<rbrakk> \<Longrightarrow> f (Suc n) = f n [PROOF STEP] by (simp add: branch_def)
Progressive Labs Acetyl-L-Carnitine 500mg 60c, the acetyl ester and biologically active form of L-Carnitine, is an effective delivery form for both L-Carnitine and acetyl groups. Essential for normal mitochondrial function in all cells, L-Carnitine's primary function is to transport long chain fatty acids into the mitochondria where they are oxidized to produce energy. Acetyl-L-Carnitine is unique in that it can cross the blood-brain barrier where it facilitates energy production in brain cells. The acetyl group it carries contribute to production of the important neurotransmitter, acetylcholine. Research shows Acetyl-L-Carnitine is critical to youthful cellular function in the brain, heart, liver, peripheral nerves and immune system, which makes it extremely important for anti-aging. One (1) to six (6) capsules daily.
-- examples for termination with tupled arguments module Tuple where data Nat : Set where zero : Nat succ : Nat -> Nat data Pair (A : Set) (B : Set) : Set where pair : A -> B -> Pair A B -- uncurried addition add : Pair Nat Nat -> Nat add (pair x (succ y)) = succ (add (pair x y)) add (pair x zero) = x data T (A : Set) (B : Set) : Set where c1 : A -> B -> T A B c2 : A -> B -> T A B {- -- constructor names do not matter add' : T Nat Nat -> Nat add' (c1 x (succ y)) = succ (add' (c2 x y)) add' (c2 x (succ y)) = succ (add' (c1 x y)) add' (c1 x zero) = x add' (c2 x zero) = x -- additionally: permutation of arguments add'' : T Nat Nat -> Nat add'' (c1 x (succ y)) = succ (add'' (c2 y x)) add'' (c2 (succ y) x) = succ (add'' (c1 x y)) add'' (c1 x zero) = x add'' (c2 zero x) = x -}
{-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.Data.SumFin.Properties where open import Cubical.Foundations.Equiv open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Prelude open import Cubical.Foundations.Univalence open import Cubical.Data.Empty as ⊥ import Cubical.Data.Fin as Fin open import Cubical.Data.Nat open import Cubical.Data.SumFin.Base as SumFin private variable ℓ : Level k : ℕ SumFin→Fin : Fin k → Fin.Fin k SumFin→Fin = SumFin.elim (λ {k} _ → Fin.Fin k) Fin.fzero Fin.fsuc Fin→SumFin : Fin.Fin k → Fin k Fin→SumFin = Fin.elim (λ {k} _ → Fin k) fzero fsuc Fin→SumFin-fsuc : (fk : Fin.Fin k) → Fin→SumFin (Fin.fsuc fk) ≡ fsuc (Fin→SumFin fk) Fin→SumFin-fsuc = Fin.elim-fsuc (λ {k} _ → Fin k) fzero fsuc SumFin→Fin→SumFin : (fk : Fin k) → Fin→SumFin (SumFin→Fin fk) ≡ fk SumFin→Fin→SumFin = SumFin.elim (λ fk → Fin→SumFin (SumFin→Fin fk) ≡ fk) refl λ {k} {fk} eq → Fin→SumFin (Fin.fsuc (SumFin→Fin fk)) ≡⟨ Fin→SumFin-fsuc (SumFin→Fin fk) ⟩ fsuc (Fin→SumFin (SumFin→Fin fk)) ≡⟨ cong fsuc eq ⟩ fsuc fk ∎ Fin→SumFin→Fin : (fk : Fin.Fin k) → SumFin→Fin (Fin→SumFin fk) ≡ fk Fin→SumFin→Fin = Fin.elim (λ fk → SumFin→Fin (Fin→SumFin fk) ≡ fk) refl λ {k} {fk} eq → SumFin→Fin (Fin→SumFin (Fin.fsuc fk)) ≡⟨ cong SumFin→Fin (Fin→SumFin-fsuc fk) ⟩ Fin.fsuc (SumFin→Fin (Fin→SumFin fk)) ≡⟨ cong Fin.fsuc eq ⟩ Fin.fsuc fk ∎ SumFin≃Fin : ∀ k → Fin k ≃ Fin.Fin k SumFin≃Fin _ = isoToEquiv (iso SumFin→Fin Fin→SumFin Fin→SumFin→Fin SumFin→Fin→SumFin) SumFin≡Fin : ∀ k → Fin k ≡ Fin.Fin k SumFin≡Fin k = ua (SumFin≃Fin k)
Section exper1. Check (0 <: nat). Context (a:nat). Check (a :> ). Fail Definition g y := fun x:nat => (y <: nat). Definition g:=(0 <: nat). Print g. Compute g. End exper1. Print Grammar constr. Print Grammar operconstr. Module ModParam. Parameter (A:Prop). End ModParam. Section exper2. Hypothesis (A:Prop). (* Set is predicative sort. CIC *) (* BUT IT MAY BE AN IMPREDICATIVE! (with special parameter) *) (*Hypothesis (A:Prop).*) Check 0. Local Definition SDF : Prop := (A->A). Reserved Notation "( a '???' b )" . Notation "( a '???' b )" := (a=b) (at level 0, no associativity) : my_scope. Delimit Scope my_scope with my_dlmtr. Check ( 0 ??? 1 ) %my_dlmtr. Undelimit Scope my_scope. Open Scope my_scope. Print Visibility. Theorem Q (a:SDF):Type. Proof. unfold SDF in a. Abort. Locate sumbool. Close Scope my_scope. Local Open Scope my_scope. Local Close Scope my_scope. Global Open Scope my_scope. Global Close Scope my_scope. Parameter U:Set. Notation "(- a -)" := (a) (at level 0, no associativity, only parsing) : my_scope2. Bind Scope my_scope2 with U. Definition def2 (a b:U) : U := (- a -). End exper2. Fail Check A. Section TreeForest. Local Axiom (A B:Set). Theorem lll (a:A): True. assert (a' := a). Abort. Inductive tree : Set := node : A -> forest -> tree with forest : Set := leaf : B -> forest | cons : tree -> forest -> forest. End TreeForest. Fail Fail Fail Fail Check A. (** Todo: **) Fixpoint thm (A:nat):bool. exact (thm A). Fail Qed. Abort. Let SDF2 : Prop := (A->A). Context (A:Prop). Context (B:Set). Definition Def1 Check (Prop). (* Prop : Type@{Set+1} *) Check (Set). (* Set : Type@{Set+1} *) Check "Top". (* Set : Type@{Top.5} *) (* {Top.5} |= Set < Top.5 *) Check (Prop:>Type@{Set+1}). Check LEFTA.
Any compact space is countably compact.
Require Import RelationClasses. Axiom R : Prop -> Prop -> Prop. Declare Instance : Reflexive R. Class bar := { x : False }. Record foo := { a : Prop ; b : bar }. Definition default_foo (a0 : Prop) `{b : bar} : foo := {| a := a0 ; b := b |}. Goal exists k, R k True. Proof. eexists. evar (b : bar). let e := match goal with |- R ?e _ => constr:(e) end in unify e (a (default_foo True)). subst b. reflexivity.
Introducing Allsportsblok, a new line of skincare products by Arizona Sun. Discover a brand new way to protect your skin against the sun by the people who know the sun. Our SPF45 Sunscreen Spray dries in seconds and provides a quick and even coverage, and is a great barrier against a broad spectrum of UVA/UVB and rays that cause both skin aging and burning. Our SPF15 Lip balm protects your lips and keep them moist while enjoying your favorite activity. Allsportsblok is made in the US and available at all major retailers as well as online.
{- A parameterized family of structures S can be combined into a single structure: X ↦ (a : A) → S a X -} {-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.Structures.Relational.Parameterized where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Equiv open import Cubical.Foundations.HLevels open import Cubical.Foundations.Structure open import Cubical.Foundations.RelationalStructure open import Cubical.Functions.FunExtEquiv open import Cubical.Data.Sigma open import Cubical.HITs.PropositionalTruncation open import Cubical.HITs.SetQuotients open import Cubical.Structures.Parameterized private variable ℓ ℓ₀ ℓ₁ ℓ₁' ℓ₁'' : Level -- Structured relations module _ (A : Type ℓ₀) where ParamRelStr : {S : A → Type ℓ → Type ℓ₁} → (∀ a → StrRel (S a) ℓ₁') → StrRel (ParamStructure A S) (ℓ-max ℓ₀ ℓ₁') ParamRelStr ρ R s t = (a : A) → ρ a R (s a) (t a) paramSuitableRel : {S : A → Type ℓ → Type ℓ₁} {ρ : ∀ a → StrRel (S a) ℓ₁'} → (∀ a → SuitableStrRel (S a) (ρ a)) → SuitableStrRel (ParamStructure A S) (ParamRelStr ρ) paramSuitableRel {ρ = ρ} θ .quo (X , f) R r .fst .fst a = θ a .quo (X , f a) R (r a) .fst .fst paramSuitableRel {ρ = ρ} θ .quo (X , f) R r .fst .snd a = θ a .quo (X , f a) R (r a) .fst .snd paramSuitableRel {ρ = ρ} θ .quo (X , f) R r .snd (q , c) i .fst a = θ a .quo (X , f a) R (r a) .snd (q a , c a) i .fst paramSuitableRel {ρ = ρ} θ .quo (X , f) R r .snd (q , c) i .snd a = θ a .quo (X , f a) R (r a) .snd (q a , c a) i .snd paramSuitableRel {ρ = ρ} θ .symmetric R r a = θ a .symmetric R (r a) paramSuitableRel {ρ = ρ} θ .transitive R R' r r' a = θ a .transitive R R' (r a) (r' a) paramSuitableRel {ρ = ρ} θ .set setX = isSetΠ λ a → θ a .set setX paramSuitableRel {ρ = ρ} θ .prop propR s t = isPropΠ λ a → θ a .prop propR (s a) (t a) paramRelMatchesEquiv : {S : A → Type ℓ → Type ℓ₁} (ρ : ∀ a → StrRel (S a) ℓ₁') {ι : ∀ a → StrEquiv (S a) ℓ₁''} → (∀ a → StrRelMatchesEquiv (ρ a) (ι a)) → StrRelMatchesEquiv (ParamRelStr ρ) (ParamEquivStr A ι) paramRelMatchesEquiv ρ μ _ _ e = equivΠCod λ a → μ a _ _ e paramRelAction : {S : A → Type ℓ → Type ℓ₁} {ρ : ∀ a → StrRel (S a) ℓ₁'} → (∀ a → StrRelAction (ρ a)) → StrRelAction (ParamRelStr ρ) paramRelAction α .actStr f s a = α a .actStr f (s a) paramRelAction α .actStrId s = funExt λ a → α a .actStrId (s a) paramRelAction α .actRel h _ _ r a = α a .actRel h _ _ (r a) -- Detransitivity of ParamRelStr would depend on choice in general, so -- we don't get positivity
\section{Random Walks} \begin{definition} A random (or stochastic) process is a sequence of random variables. \end{definition} \begin{definition} A random walk is a stochastic process $(X_n)_{n\in\mathbb N}$ such that $X_0=x,X_n=x+Y_1+\cdots +Y_n$ where $x\in\mathbb R$ and $Y_i$ are i.i.d. random variables. \end{definition} Now we focus on the case where $Y_i$ is $1$ with probability $p$ and $-1$ with probability $1-p$ and $x$ is an integer. We think of $X_n$ as the fortune of a gambler, and he gets it go up by $1$ with probability $p$ and lose with probability $q=1-p$. His objective is to get to $a\in\mathbb Z$ before he get to $0$. We say this is the event $A$. Let $h_x=\mathbb P(A|X_0=x)$, then $h_x=ph_{x+1}+(1-p)h_{x-1},p_a=1,p_0=0$. For $p=1/2=1-p$, we get $h_x=x/a$ which is perhaps not surprising.\\ For general $p$, by trying solutions of the form $\lambda^x$, we get $p\lambda^2-\lambda+q=0$, which has solutions $\lambda=1,q/p$, and plugging in the boundary conditions yield $$h_x=\frac{(q/p)^x-1}{(q/p)^a-1}$$ Now we want to estimate the expected time to absorption, that is the smallest $T$ with $X_T\in\{0,a\}$. We write $\tau_x$ for such $T$ with $X_0=x$. we have $\tau_x=1+p\tau_{x+1}+q\tau_{x-1},0<x<a,\tau_0=\tau_a=0$. For $p=1/2=1-p$, we get the solution $\tau_x=x(a-x)$. For general $p$, we get the solution $$\tau_x=\frac{1}{q-p}x-\frac{a}{q-p}\frac{(q/p)^x-1}{(q/p)^a-1}$$
-- Pruebas de A ∈ 𝒫 (A ∪ B) -- ======================== import data.set open set variable {U : Type} variables (A B : set U) #reduce powerset A #reduce B ∈ powerset A #reduce 𝒫 A #reduce B ∈ 𝒫 A -- ?ª demostración example : A ∈ 𝒫 (A ∪ B) := begin intros x h, simp, left, exact h, end -- ?ª demostración example : A ∈ 𝒫 (A ∪ B) := begin intros x h, exact or.inl h, end -- ?ª demostración example : A ∈ 𝒫 (A ∪ B) := λ x, or.inl -- ?ª demostración example : A ∈ 𝒫 (A ∪ B) := assume x, assume : x ∈ A, show x ∈ A ∪ B, from or.inl ‹x ∈ A›
Formal statement is: lemma image_affinity_cbox: fixes m::real fixes a b c :: "'a::euclidean_space" shows "(\<lambda>x. m *\<^sub>R x + c) ` cbox a b = (if cbox a b = {} then {} else (if 0 \<le> m then cbox (m *\<^sub>R a + c) (m *\<^sub>R b + c) else cbox (m *\<^sub>R b + c) (m *\<^sub>R a + c)))" Informal statement is: The image of a box under an affine map is a box.
#' widgetframe: A package for wrapping htmlwidgets in responsive iframes. #' #' This package provides two functions \code{\link{frameableWidget}}, and \code{\link{frameWidget}}. #' The \code{\link{frameableWidget}} is used to add extra code to a htmlwidget which #' allows is to be rendered correctly inside a responsive iframe. #' The \code{\link{frameWidget}} is a htmlwidget which displays content of another #' htmlwidget inside a responsive iframe. #' #' @importFrom magrittr %>% #' #' @name widgetframe #' @docType package NULL
SUBROUTINE W3FA03V(PRESS,HEIGHT,TEMP,THETA,N) C$$$ SUBPROGRAM DOCUMENTATION BLOCK C . . . . C SUBPROGRAM: W3FA03V COMPUTE STANDARD HEIGHT, TEMP, AND POT TEMP C PRGMMR: KEYSER ORG: W/NMC22 DATE: 92-06-29 C C ABSTRACT: COMPUTES THE STANDARD HEIGHT, TEMPERATURE, AND POTENTIAL C TEMPERATURE GIVEN THE PRESSURE IN MILLIBARS ( > 8.68 MB ). FOR C HEIGHT AND TEMPERATURE THE RESULTS DUPLICATE THE VALUES IN THE C U.S. STANDARD ATMOSPHERE (L962), WHICH IS THE ICAO STANDARD C ATMOSPHERE TO 54.7487 MB (20 KM) AND THE PROPOSED EXTENSION TO C 8.68 MB (32 KM). FOR POTENTIAL TEMPERATURE A VALUE OF 2/7 IS C USED FOR RD/CP. C C PROGRAM HISTORY LOG: C 74-06-01 J. MCDONELL W345 -- ORIGINAL AUTHOR C 84-06-01 R.E.JONES W342 -- CHANGE TO IBM VS FORTRAN C 92-06-29 D. A. KEYSER W/NMC22 -- CONVERT TO CRAY CFT77 FORTRAN C 94-09-13 R.E.JONES -- VECTORIZED VERSION TO DO ARRAY C INSTEAD OF ONE WORD C C USAGE: CALL W3FA03V(PRESS,HEIGHT,TEMP,THETA,N) C INPUT ARGUMENT LIST: C PRESS - PRESSURE ARRAY IN MILLIBARS C C OUTPUT ARGUMENT LIST: C HEIGHT - HEIGHT ARRAY IN METERS C TEMP - TEMPERATURE ARRAY IN DEGREES KELVIN C THETA - POTENTIAL TEMPERATURE ARRAY IN DEGREES KELVIN C N - NUMBER OF POINTS IN ARRAY PRESS C C SUBPROGRAMS CALLED: C LIBRARY: C CRAY - ALOG C C REMARKS: NOT VALID FOR PRESSURES LESS THAN 8.68 MILLIBARS, DECLARE C ALL PARAMETERS AS TYPE REAL. C C WARNING: HEIGHT, TEMP, THETA ARE NOW ALL ARRAYS, YOU MUST C HAVE ARRAYS OF SIZE N OR YOU WILL WIPE OUT MEMORY. C C ATTRIBUTES: C LANGUAGE: CRAY CFT77 FORTRAN C MACHINE: CRAY C916/128, Y-MP8/864, Y-MP EL92/256 C C$$$ C REAL M0 REAL HEIGHT(*) REAL PRESS(*) REAL TEMP(*) REAL THETA(*) C SAVE C DATA G/9.80665/,RSTAR/8314.32/,M0/28.9644/,PISO/54.7487/, $ ZISO/20000./,SALP/-.0010/,PZERO/1013.25/,T0/288.15/,ALP/.0065/, $ PTROP/226.321/,TSTR/216.65/ C ROVCP = 2.0/7.0 R = RSTAR/M0 ROVG = R/G FKT = ROVG * TSTR AR = ALP * ROVG PP0 = PZERO**AR AR1 = SALP * ROVG PP01 = PISO**AR1 C DO J = 1,N IF (PRESS(J).LT.PISO) THEN C C COMPUTE LAPSE RATE = -.0010 CASES C HEIGHT(J) = ((TSTR/(PP01 * SALP )) * (PP01-(PRESS(J) ** AR1))) & + ZISO TEMP(J) = TSTR - ((HEIGHT(J) - ZISO) * SALP) C ELSE IF (PRESS(J).GT.PTROP) THEN C HEIGHT(J) = (T0/(PP0 * ALP)) * (PP0 - (PRESS(J) ** AR)) TEMP(J) = T0 - (HEIGHT(J) * ALP) C ELSE C C COMPUTE ISOTHERMAL CASES C HEIGHT(J) = 11000.0 + (FKT * ALOG(PTROP/PRESS(J))) TEMP(J) = TSTR C END IF THETA(J) = TEMP(J) * ((1000./PRESS(J))**ROVCP) END DO C RETURN END
And Jill came tumbling after .
# Spectral Estimation of Random Signals *This jupyter/Python notebook is part of a [collection of notebooks](../index.ipynb) in the masters module [Digital Signal Processing](http://www.int.uni-rostock.de/Digitale-Signalverarbeitung.48.0.html), Comunications Engineering, Universität Rostock. Please direct questions and suggestions to <mailto:[email protected]>.* ## Parametric Methods ### Motivation Non-parametric methods for the estimation of the power spectral density (PSD), like the [periodogram](periodogram.ipynb) or [Welch's method](welch_method.ipynb), don't rely on a-priori information about the process generating the random signal. Often some a-priori information is available that can be used to formulate a parametric model of the random process. The goal is then to estimate these parameters in order to characterize the random signal. Such techniques are known as *[parametric methods](https://en.wikipedia.org/wiki/Spectral_density_estimation#Parametric_estimation)* or *model-based methods*. The incorporation of a-priori knowledge can improve the estimation of the PSD significantly, as long as the underlying model is a valid description of the random process. The parametric model of the random process can also be used to generate random signals with a desired PSD. ### Process Models For the remainder we assume wide-sense stationary real-valued random processes. For many applications the process can be modeled by a linear-time invariant (LTI) system where $n[k]$ is [white noise](../random_signals/white_noise.ipynb) and $H(\mathrm{e}^{\,\mathrm{j}\,\Omega})$ denotes the transfer function of the system. In general, the random signal $x[k]$ will be correlated as a result of the processing of the uncorrelated input signal $n[k]$ by the system $H(\mathrm{e}^{\,\mathrm{j}\,\Omega})$. Due to the white noise assumption $\Phi_{nn}(\mathrm{e}^{\,\mathrm{j}\,\Omega}) = N_0$, the PSD of the random process is given as \begin{equation} \Phi_{xx}(\mathrm{e}^{\,\mathrm{j}\,\Omega}) = N_0 \cdot | H(\mathrm{e}^{\,\mathrm{j}\,\Omega}) |^2 \end{equation} Parametric methods model the system $H(\mathrm{e}^{\,\mathrm{j}\,\Omega})$ by a limited number of parameters. These parameters are then estimated from $x[k]$, providing an estimate $\hat{H}(\mathrm{e}^{\,\mathrm{j}\,\Omega})$ of the transfer function. This estimate is then used to calculate the desired estimate $\hat{\Phi}_{xx}(\mathrm{e}^{\,\mathrm{j}\,\Omega})$ of the PSD. #### Autoregressive model The [autoregressive](https://en.wikipedia.org/wiki/Autoregressive_model) (AR) model assumes a recursive system with a direct path. Its output relation is given as \begin{equation} x[k] = \sum_{n=1}^{N} a_n \cdot x[k-n] + n[k] \end{equation} where $a_n$ denote the coefficients of the recursive path and $N$ the order of the model. Its system function $H(z)$ is derived by $z$-transformation of the output relation \begin{equation} H(z) = \frac{1}{1 - \sum_{n=1}^{N} a_n z^{-n}} \end{equation} Hence, the AR model is a pole-only model of the system. #### Moving average model The [moving average](https://en.wikipedia.org/wiki/Moving-average_model) (MA) model assumes a non-recursive system. The output relation is given as \begin{equation} x[k] = \sum_{m=0}^{M-1} b_m \cdot n[k-m] = h[k] * n[k] \end{equation} with the impulse response of the system $h[k] = [ b_0, b_1, \dots, b_{M-1} ]$. The MA model is a finite impulse response (FIR) model of the random process. Its system function is given as \begin{equation} H(z) = \mathcal{Z} \{ h[k] \} = \sum_{m=0}^{M-1} b_m \; z^{-m} \end{equation} #### Autoregressive moving average model The [autoregressive moving average](https://en.wikipedia.org/wiki/Autoregressive%E2%80%93moving-average_model) (ARMA) model is a combination of the AR and MA model. It constitutes a general linear process model. Its output relation is given as \begin{equation} x[k] = \sum_{n=1}^{N} a_n \cdot x[k-n] + \sum_{m=0}^{M-1} b_m \cdot n[k-m] \end{equation} Its system function reads \begin{equation} H(z) = \frac{\sum_{m=0}^{M-1} b_m \; z^{-m}}{1 - \sum_{n=1}^{N} a_n z^{-n}} \end{equation} ### Parametric Spectral Estimation The models above describe the synthesis of the samples $x[k]$ from the white noise $n[k]$. For spectral estimation only the random signal $x[k]$ is known and we are aiming at estimating the parameters of the model. This can be achieved by determining an analyzing system $G(\mathrm{e}^{\,\mathrm{j}\,\Omega})$ such to decorrelate the signal $x[k]$ where $e[k]$ should be white noise. Due to its desired operation, the filter $G(\mathrm{e}^{\,\mathrm{j}\,\Omega})$ is also denoted as *whitening filter*. The optimal filter $G(\mathrm{e}^{\,\mathrm{j}\,\Omega})$ is given by the inverse system $\frac{1}{H(\mathrm{e}^{\,\mathrm{j}\,\Omega})}$. However, $H(\mathrm{e}^{\,\mathrm{j}\,\Omega})$ is in general not known. But this nevertheless implies that our linear process model of $H(\mathrm{e}^{\,\mathrm{j}\,\Omega})$ also applies to $G(\mathrm{e}^{\,\mathrm{j}\,\Omega})$. Various techniques have been developed to estimate the parameters of the filter $G(\mathrm{e}^{\,\mathrm{j}\,\Omega})$ such that $e[k]$ becomes decorrelated. For instance, by expressing the auto-correlation function (ACF) $\varphi_{xx}[\kappa]$ in terms of the model parameters and solving with respect to these. The underlying set of equations are known as [Yule-Walker equations](https://en.wikipedia.org/wiki/Autoregressive_model#Yule-Walker_equations). Once the model parameters have been estimated, these can be used to calculate an estimate $\hat{G}(\mathrm{e}^{\,\mathrm{j}\,\Omega})$ of the analysis system. The desired estimate of the PSD is then given as \begin{equation} \hat{\Phi}_{xx}(\mathrm{e}^{\,\mathrm{j}\,\Omega}) = \frac{\Phi_{ee}(\mathrm{e}^{\,\mathrm{j}\,\Omega})}{|\hat{G}(\mathrm{e}^{\,\mathrm{j}\,\Omega})|^2} \end{equation} where if $e[k]$ is white noise, $\Phi_{ee}(\mathrm{e}^{\,\mathrm{j}\,\Omega}) = N_0$. ### Example In the follwing example $n[k]$ is drawn from normal distributed white noise with $N_0 = 1$. The Yule-Walker equations are used to estimate the parameters of an AR model of $H(\mathrm{e}^{\,\mathrm{j}\,\Omega})$. The implementation provided by `statsmodels.api.regression.yule_walker` returns the estimated AR coefficients of the system $H(\mathrm{e}^{\,\mathrm{j}\,\Omega})$. These parameters are then used to numerically evaluate the estimated transfer function, resulting in $\hat{\Phi}_{xx}(\mathrm{e}^{\,\mathrm{j}\,\Omega}) = 1 \cdot | \hat{H}(\mathrm{e}^{\,\mathrm{j}\,\Omega}) |^2 $. ```python %matplotlib inline import numpy as np import matplotlib.pyplot as plt import statsmodels.api as sm import scipy.signal as sig K = 4096 # length of random signal N = 3 # order of AR model a = np.array((1, -1, .5)) # coefficients of AR model # generate random signal n[k] np.random.seed(2) n = np.random.normal(size=K) # AR model for random signal x[k] x = np.zeros(K) for k in np.arange(3, K): x[k] = a[0]*x[k-1] + a[1]*x[k-2] + a[2]*x[k-3] + n[k] # estimate AR parameters by Yule-Walker method rho, sigma = sm.regression.yule_walker(x, order=N, method='mle') # compute true and estimated transfer function Om, H = sig.freqz(1, np.insert(-a, 0, 1)) Om, He = sig.freqz(1, np.insert(-rho, 0, 1)) # compute PSD by Welch method Om2, Pxx = sig.welch(x, return_onesided=True) # plot PSDs plt.figure(figsize=(10,5)) plt.plot(Om, np.abs(H)**2, label=r'$\Phi_{xx}(e^{j\Omega})$') plt.plot(Om2*2*np.pi, .5*np.abs(Pxx), 'k-', alpha=.5 , label=r'$\hat{\Phi}_{xx}(e^{j\Omega})$ (Welch)') plt.plot(Om, np.abs(He)**2, label=r'$\hat{\Phi}_{xx}(e^{j\Omega})$ (parametric)') plt.xlabel(r'$\Omega$') plt.axis([0, np.pi, 0, 20]) plt.legend() plt.grid() ``` **Exercise** * Change the order `N` of the AR model used for estimation by the Yule-Walker equations. What happens if the order is smaller or higher than the order of the true system? Why? * Change the number of samples `K`. Is the estimator consistent? Solution: Choosing the order of the estimated AR model differently from the true process results in a mismatch of the model with the consequence of potentially large deviations between the estimated PSD and true PSD. These deviations are typically larger when choosing the order smaller since the model does definitely not fit to the true process. However, choosing the order larger is typically not that problematic since some of the AR coefficients are estimated as approximately zero due to the lower order of the process generating the random signal. Increasing the number of samples seems to lower the bias and variance of the estimated PSD, the estimator can therefore be assumed to be consistent. **Copyright** This notebook is provided as [Open Educational Resource](https://en.wikipedia.org/wiki/Open_educational_resources). Feel free to use the notebook for your own purposes. The text is licensed under [Creative Commons Attribution 4.0](https://creativecommons.org/licenses/by/4.0/), the code of the IPython examples under the [MIT license](https://opensource.org/licenses/MIT). Please attribute the work as follows: *Sascha Spors, Digital Signal Processing - Lecture notes featuring computational examples, 2016-2018*.
function x=usasi(n,fs) %USASI generates N samples of USASI noise at sample frequency FS X=(N,FS) % This routine is based on the USASI noise defined in [1] which was later % reissued as [2]. USASI noise is intended to simulate the long-term average % of typical audio program material. The routine does not currently implement % the pulsation at 2.5Hz 12.5% duty cycle that is recommended by the standard. % Also it should probably be scaled to a well-defined power. % % [1] NRSC AM Reemphasis, Deemphasize, and Broadcast Audio Transmission Bandwidth Specifications, % EIA-549 Standard, Electronics Industries Association , July 1988. % [2] NRSC AM Reemphasis, Deemphasize, and Broadcast Audio Transmission Bandwidth Specifications, % NRSC-1-A Standard, Sept 2007, Online: http://www.nrscstandards.org/SG/NRSC-1-A.pdf % Copyright (C) Mike Brookes 1997 % Version: $Id: usasi.m,v 1.6 2008/05/27 08:38:05 dmb Exp $ % % VOICEBOX is a MATLAB toolbox for speech processing. % Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This program 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 2 of the License, or % (at your option) any later version. % % This program 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 can obtain a copy of the GNU General Public License from % http://www.gnu.org/copyleft/gpl.html or by writing to % Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if nargin<2 fs=8000; end b=[1 0 -1]; a=poly(exp(-[100 320]*2*pi/fs)); x=randfilt(b,a,n);
\begin{document} \section{Grabbing Replays} \subsection{Replay Downloading} We need to look at $replays$ as a mean to find out how well the player does (in other words, $difficulty$ of the map) \paragraph{osu!API GET replay} The API provides us with the replay file itself. Not going into detail, we are able to extract all key taps (including releases) of the player during the play. These files are not saved, instead they are instantly decoded into the following format. \subsection{Replay Decoding} The format we get from running the python code goes as follows $$ action_{replay} := \lbrace(offset_1, action_1), (offset_2, action_2), ... , (offset_n, action_n)\rbrace $$ Whereby, $$n \in \lbrace-9, -8, ... , -2, -1, 1, 2, ... , 8, 9\rbrace$$ $offset$ is when the $action$ happens. For $action$, $-n$ means the key \textbf{n} is released, $n$ means the key \textbf{n} is pressed. We will save this data in a file with $<beatmap\_id>.acr$ extension. \end{document}
State Before: α : Type u_1 β : Type ?u.210763 inst✝¹ : LinearOrder α inst✝ : LinearOrder β f : α → β a a₁ a₂ b b₁ b₂ c d : α ⊢ Ioc a b \ Iic c = Ioc (max a c) b State After: no goals Tactic: rw [diff_eq, compl_Iic, Ioc_inter_Ioi, sup_eq_max]
// Copyright 2011 Dean Michael Berris &lt;[email protected]&gt;. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #define BOOST_TEST_MODULE HTTP 1.1 Get Streaming Test #include <boost/network/include/http/client.hpp> #include <boost/test/unit_test.hpp> #include <iostream> #include "client_types.hpp" namespace net = boost::network; namespace http = boost::network::http; struct body_handler { explicit body_handler(std::string & body) : body(body) {} BOOST_NETWORK_HTTP_BODY_CALLBACK(operator(), range, error) { body.append(boost::begin(range), boost::end(range)); } std::string & body; }; BOOST_AUTO_TEST_CASE_TEMPLATE(http_client_get_streaming_test, client, async_only_client_types) { typename client::request request("http://www.boost.org"); typename client::response response; typename client::string_type body_string; typename client::string_type dummy_body; body_handler handler_instance(body_string); { client client_; BOOST_CHECK_NO_THROW( response = client_.get(request, handler_instance) ); typename net::headers_range<typename client::response>::type range = headers(response)["Content-Type"]; BOOST_CHECK ( !boost::empty(range) ); BOOST_CHECK_EQUAL ( body(response).size(), 0u ); BOOST_CHECK_EQUAL ( response.version().substr(0, 7), std::string("HTTP/1.") ); BOOST_CHECK_EQUAL ( response.status(), 200u ); BOOST_CHECK_EQUAL ( response.status_message(), std::string("OK") ); dummy_body = body(response); } BOOST_CHECK ( dummy_body == typename client::string_type() ); }
# -*- coding: utf-8 -*- """ Created on Tue Jan 22 10:22:47 2019 @author: hejme """ from skimage.segmentation import slic from skimage.segmentation import mark_boundaries from skimage.util import img_as_float from skimage import io import matplotlib.pyplot as plt import torch import time import numpy as np ### Testing a preprocessed segmentation #image = img_as_float(io.imread('2007_002099.jpg')) #segments = torch.load('2007_002099.pt').numpy() ## show the output of SLIC #fig = plt.figure("Superpixels -- segments") #ax = fig.add_subplot(1, 1, 1) #ax.imshow(mark_boundaries(image, segments)) #plt.axis("off") #plt.show() for numSegments in np.linspace(300, 2000): ## Pre processing step t = time.time() # load the image and convert it to a floating point data type image = img_as_float(io.imread('2007_002107.jpg')) # Perform SLIC segmentation segments = slic(image, n_segments = numSegments, sigma = 5) # show the output of SLIC print(numSegments) fig = plt.figure("Superpixels -- %d segments" % (numSegments)) ax = fig.add_subplot(1, 1, 1) ax.imshow(mark_boundaries(image, segments)) plt.axis("off") plt.show() # Convery to torch and save for later segments = torch.from_numpy(segments) torch.save(segments, '2007_000039.pt') print("\nSingle image pre-processing time: {}\n".format(time.time()-t)) exit ## Loss function # Delete tensors to ensure they are being created correctly in loss del image del segments ############################################################################### ## Generating scores and target which would be input to loss function input = torch.rand(1, 21, 375, 500, dtype=torch.float) target = torch.from_numpy( io.imread('2007_000039_encoded.png') ).unsqueeze_(0).long() #target = torch.cat((target,target)) names = ('2007_000039',) ############################################################################### t = time.time() # Extract size data from input and target n, c, h, w = input.size() nt, ht, wt = target.size() # Load the pre-processed segmentation segments = torch.zeros(n,h,w) segments_u = 0 for idx in range(n): segments[idx,:,:] = torch.load('{}.pt'.format(names[idx])) segments_u += segments[idx,:,:].unique().numel() print("Total segments: {}".format(segments_u)) # Initialise superpixel tensors input_s = torch.zeros(segments_u,c) target_s = torch.zeros(segments_u) classes = torch.arange(c) # Some prints for sanity checks print("Input shape: {}\nTarget shape: {}".format(input.shape, target.shape)) print("Input super-pixel shape: {}\nTarget super-pixel shape: {}".format(input_s.shape, target_s.shape)) print("Segments shape: {}".format(segments.shape)) # Iterate through all the images for img in range(n): # Define variable for number of unique segments for current image img_superpixels = segments[img,:,:].unique().numel() img_offset = img*img_superpixels # Iterate through all the clusters for idx in range(img_superpixels): # Define mask for cluster idx mask = segments[img,:,:]==idx # First take slices to select image, then apply mask, then 2D mode for majority class target_s[img_offset+idx] = target[img,:,:][mask].mode()[0].mode()[0] # Iterate through all the classes # Same process as before but also iterating through classes and taking mean because these are scores input_s[img_offset+idx,classes] = input[img,classes,:,:][:,mask].mean() print("\nInput target super-pixeling time: {}\n".format(time.time()-t)) t = time.time() # Calculate the score for the superpixels both being and not being in the class score_not_class = input_s[:,torch.arange(0,c)[torch.arange(0,c)!=max(target_s).long()]].exp().sum(1).log() score_class = input_s[:,max(target_s).long()] theta = score_class - score_not_class print("Theta: {}".format(score_class)) # Zehan's algorithm h=torch.zeros(1) # Sort all scores that are supposed to be background and sum them cumulatively theta_tilde = theta[target_s==0].sort(descending=True)[0] theta_hat = theta_tilde.cumsum(0) # Iterate through all possible values of U from the min U to all the super-pixels for U in torch.arange((target_s!=0).sum(),target_s.numel()).float(): print("U: {}".format(U)) # Reset I and sigma for the currenc U I=0 sigma=0 # For all the superpixels that are the class in the ground truth for j in target_s.nonzero(): # If including the jth super=pixel will increase the max{S+delta}, include it if theta[j] >= 1/U: # Add the score and increase the intersection sigma += theta[j] I += 1 print("I: {}".format(I)) sigma += theta_hat[U.int()-(target_s!=0).sum().int()] print("Theta_hat[U-|y|]: {}".format(theta_hat[U.int()-(target_s!=0).sum().int()])) sigma -= I/U print("Sigma: {}, h: {}".format(sigma, h)) if sigma >= h: h = sigma print("Ground truth score: {}".format(theta[target_s!=0])) h += 1 - theta[target_s!=0].sum() print("Loss:{}".format(h)) #print("Input super-pixels:\n{}\nTarget super-pixels:\n{}".format(input_s, target_s)) print("\nLoss eval time for super-pixels: {}\n".format(time.time()-t))
The interior of a closed ball is the open ball of the same radius.
/- Copyright (c) 2022 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov, Heather Macbeth -/ import analysis.normed.group.basic /-! # Negation on spheres and balls > THIS FILE IS SYNCHRONIZED WITH MATHLIB4. > Any changes to this file require a corresponding PR to mathlib4. In this file we define `has_involutive_neg` instances for spheres, open balls, and closed balls in a semi normed group. -/ open metric set variables {E : Type*} [seminormed_add_comm_group E] {r : ℝ} /-- We equip the sphere, in a seminormed group, with a formal operation of negation, namely the antipodal map. -/ instance : has_involutive_neg (sphere (0 : E) r) := { neg := subtype.map has_neg.neg $ λ w, by simp, neg_neg := λ x, subtype.ext $ neg_neg x } @[simp] lemma coe_neg_sphere {r : ℝ} (v : sphere (0 : E) r) : ↑(-v) = (-v : E) := rfl instance : has_continuous_neg (sphere (0 : E) r) := ⟨continuous_neg.subtype_map _⟩ /-- We equip the ball, in a seminormed group, with a formal operation of negation, namely the antipodal map. -/ instance {r : ℝ} : has_involutive_neg (ball (0 : E) r) := { neg := subtype.map has_neg.neg $ λ w, by simp, neg_neg := λ x, subtype.ext $ neg_neg x } @[simp] lemma coe_neg_ball {r : ℝ} (v : ball (0 : E) r) : ↑(-v) = (-v : E) := rfl instance : has_continuous_neg (ball (0 : E) r) := ⟨continuous_neg.subtype_map _⟩ /-- We equip the closed ball, in a seminormed group, with a formal operation of negation, namely the antipodal map. -/ instance {r : ℝ} : has_involutive_neg (closed_ball (0 : E) r) := { neg := subtype.map has_neg.neg $ λ w, by simp, neg_neg := λ x, subtype.ext $ neg_neg x } @[simp] lemma coe_neg_closed_ball {r : ℝ} (v : closed_ball (0 : E) r) : ↑(-v) = (-v : E) := rfl instance : has_continuous_neg (closed_ball (0 : E) r) := ⟨continuous_neg.subtype_map _⟩
# Cold atom workflow demonstration In cold atoms, we do not necessarily work with qubits. As an example, we implemented here the operation on a single qudit as it is implemented in Heidelberg University. In this notebook we present the communication with our API. The communication with the backend happens through the four url 1. '.../shots/get_config/' 2. '.../shots/post_job/' 3. '.../shots/get_job_status/' 4. '.../shots/get_job_result/' # get config Getting the description of the simulator/backend as a json file * user login at '.../get_config' * json file with simulator/backend description ```python import requests import json from pprint import pprint ``` This imports the `credentials.py` file you received from us. ```python #from heroku_credentials import username, password from credentials import username, password ``` ```python #url_prefix="http://qsimsim.synqs.org/shots/" # the cloud back-end url_prefix = 'http://localhost:8000/shots/' # the back-end for local testing ``` ```python url= url_prefix + "get_config/" print(url) r = requests.get(url,params={'username': username,'password':password}) pprint(r.text) ``` http://localhost:8000/shots/get_config/ ('{"backend_name": "synqs_single_qudit_simulator", "cold_atom_type": "spin", ' '"backend_version": "0.0.2", "n_qubits": 1, "atomic_species": ["na"], ' '"basis_gates": ["rLx", "rLz", "rLz2"], "gates": [{"name": "rLz", ' '"parameters": ["delta"], "qasm_def": "gate rLz(delta) {}", "coupling_map": ' '[[0], [1], [2], [3], [4]], "description": "Evolution under the Z gate"}, ' '{"name": "rLz2", "parameters": ["chi"], "qasm_def": "gate rLz2(chi) {}", ' '"coupling_map": [[0], [1], [2], [3], [4]], "description": "Evolution under ' 'Lz2"}, {"name": "rLx", "parameters": ["omega"], "qasm_def": "gate rx(omega) ' '{}", "coupling_map": [[0], [1], [2], [3], [4]], "description": "Evolution ' 'under Lx"}], "supported_instructions": ["rLx", "rLz", "rLz2", "measure", ' '"barrier", "load"], "local": false, "simulator": true, "conditional": false, ' '"open_pulse": false, "memory": true, "max_shots": 1000, "coupling_map": ' '[[]], "max_experiments": 15, "description": "Setup of a cold atomic gas ' 'experiment with qudits.", "url": "https://qsimsim.synqs.org/shots/", ' '"credits_required": false, "display_name": "SingleQudit"}') # The single qudit backend The single qudit Hilbert space is $|l, m\rangle$ with $l = 2$ and $m = -2, -1, 0, 1, ,2$ being an eigenstate of the total angular momentum operator and the z-component \begin{align} L^2 |l,m\rangle &= l (l+1) |l,m \rangle \notag \\ L_z |l, m\rangle &= m |l, m\rangle \notag \end{align} The Hamiltonian which controls the qudit is \begin{align} H = \chi L_z^2 + \Delta L_z + \Omega L_x \end{align} where the coupling constants $\chi$, $\Delta$ and $\Omega$ can be switched on and off individually. We us the above Hamiltonian to generate the following three gates * Rotation around the z-axis \begin{align} rLz = \exp\{ i (\Delta t) L_z \} \end{align} * Rotation around the x-axis \begin{align} rLx = \exp\{ i (\Omega t) L_x \} \end{align} * Squeezing operation \begin{align} rLz2 = \exp\{ i (\chi t) L^2_z \} \end{align} ## x rotation This rotates the qudit around the x axis to put it into a superposition of z states. We start with a $\pi$ rotation i.e \begin{align} rLx = \exp\{ i \pi L_x \} \end{align} ```python import numpy as np import matplotlib.pyplot as plt ``` ```python job_payload = { 'experiment_0': { 'instructions': [ ('rLx', [0], [np.pi]), ('measure', [0], []), ], 'num_wires': 1, 'shots': 4, 'seed': 12345 }, } ``` Send the job to the server ```python url= url_prefix + "post_job/" job_response = requests.post(url, data={'json':json.dumps(job_payload),'username': username,'password':password}) job_id = (job_response.json())['job_id'] print(job_response.text) ``` {"job_id": 56, "status": "INITIALIZING", "detail": "Got your json."} Test for completion ```python status_payload = {'job_id': job_id} url= url_prefix + "get_job_status/" status_response = requests.get(url, params={'json':json.dumps(status_payload),'username': username,'password':password}) print(status_response.text) ``` {"job_id": 56, "status": "DONE", "detail": "Got your json.; Passed json sanity check; Compilation done. Shots sent to solver"} Obtaining results ```python result_payload = {'job_id': job_id} url= url_prefix + "get_job_result/" result_response = requests.get(url, params={'json':json.dumps(result_payload),'username': username,'password':password}) print(result_response.text) ``` {"backend_name": "synqs_single_qudit_simulator", "backend_version": "0.0.2", "job_id": 56, "qobj_id": null, "success": true, "status": "finished", "header": {}, "results": [{"header": {"name": "SingleQudit", "extra metadata": "None"}, "shots": 4, "success": true, "data": {"memory": ["1", "1", "1", "1"]}}]} the result of the calculation is then ```python res_dict = json.loads(result_response.text) measurements = res_dict["results"][0]['data']['memory'] print(measurements) ``` ['1', '1', '1', '1'] # Barrier gate ```python job_payload = { 'experiment_0': { 'instructions': [ ('rLx', [0], [np.pi]), ('barrier', [], []), ('measure', [0], []), ], 'num_wires': 1, 'shots': 4 }, } ``` Send the job to the server ```python url= url_prefix + "post_job/" job_response = requests.post(url, data={'json':json.dumps(job_payload),'username': username,'password':password}) job_id = (job_response.json())['job_id'] print(job_response.text) ``` {"job_id": 57, "status": "INITIALIZING", "detail": "Got your json."} Test for completion ```python status_payload = {'job_id': job_id} url= url_prefix + "get_job_status/" status_response = requests.get(url, params={'json':json.dumps(status_payload),'username': username,'password':password}) print(status_response.text) ``` {"job_id": 57, "status": "DONE", "detail": "Got your json.; Passed json sanity check; Compilation done. Shots sent to solver"} Obtaining results ```python result_payload = {'job_id': job_id} url= url_prefix + "get_job_result/" result_response = requests.get(url, params={'json':json.dumps(result_payload),'username': username,'password':password}) print(result_response.text) ``` {"backend_name": "synqs_single_qudit_simulator", "backend_version": "0.0.2", "job_id": 57, "qobj_id": null, "success": true, "status": "finished", "header": {}, "results": [{"header": {"name": "SingleQudit", "extra metadata": "None"}, "shots": 4, "success": true, "data": {"memory": ["1", "1", "1", "1"]}}]} the result of the calculation is then ```python res_dict = json.loads(result_response.text) measurements = res_dict["results"][0]['data']['memory'] print(measurements) ``` ['1', '1', '1', '1'] ## Rabi oscillation The following section creates a Rabi-oscillation Create several jobs determined by the phase ```python n_phases = 11 # number of phases we would like to investigate phases = np.linspace(0,2*np.pi,n_phases) #array of phases job_payload = {} for ii in range(n_phases): exp_str = 'experiment_' + str(ii) dummy_exp = { 'instructions': [ ('rLx', [0], [phases[ii]]), ('measure', [0], []), ], 'num_wires': 1, 'shots': 4 } job_payload[exp_str] = dummy_exp pprint(job_payload) ``` {'experiment_0': {'instructions': [('rLx', [0], [0.0]), ('measure', [0], [])], 'num_wires': 1, 'shots': 4}, 'experiment_1': {'instructions': [('rLx', [0], [0.6283185307179586]), ('measure', [0], [])], 'num_wires': 1, 'shots': 4}, 'experiment_10': {'instructions': [('rLx', [0], [6.283185307179586]), ('measure', [0], [])], 'num_wires': 1, 'shots': 4}, 'experiment_2': {'instructions': [('rLx', [0], [1.2566370614359172]), ('measure', [0], [])], 'num_wires': 1, 'shots': 4}, 'experiment_3': {'instructions': [('rLx', [0], [1.8849555921538759]), ('measure', [0], [])], 'num_wires': 1, 'shots': 4}, 'experiment_4': {'instructions': [('rLx', [0], [2.5132741228718345]), ('measure', [0], [])], 'num_wires': 1, 'shots': 4}, 'experiment_5': {'instructions': [('rLx', [0], [3.141592653589793]), ('measure', [0], [])], 'num_wires': 1, 'shots': 4}, 'experiment_6': {'instructions': [('rLx', [0], [3.7699111843077517]), ('measure', [0], [])], 'num_wires': 1, 'shots': 4}, 'experiment_7': {'instructions': [('rLx', [0], [4.39822971502571]), ('measure', [0], [])], 'num_wires': 1, 'shots': 4}, 'experiment_8': {'instructions': [('rLx', [0], [5.026548245743669]), ('measure', [0], [])], 'num_wires': 1, 'shots': 4}, 'experiment_9': {'instructions': [('rLx', [0], [5.654866776461628]), ('measure', [0], [])], 'num_wires': 1, 'shots': 4}} Send the job to the server via request.post(...) ```python url= url_prefix + "post_job/" job_response = requests.post(url, data={'json':json.dumps(job_payload),'username': username,'password':password}) job_id = (job_response.json())['job_id'] print(job_response.text) ``` {"job_id": 58, "status": "INITIALIZING", "detail": "Got your json."} Test if the job is completed ```python status_payload = {'job_id': job_id} url= url_prefix + "get_job_status/" status_response = requests.get(url, params={'json':json.dumps(status_payload),'username': username,'password':password}) print(status_response.text) ``` {"job_id": 58, "status": "DONE", "detail": "Got your json.; Passed json sanity check; Compilation done. Shots sent to solver"} and obtain the results via requests.get(...) ```python result_payload = {'job_id': job_id} url= url_prefix + "get_job_result/" result_response = requests.get(url, params={'json':json.dumps(result_payload),'username': username,'password':password}) results_dict = json.loads(result_response.text) pprint(results_dict) ``` {'backend_name': 'synqs_single_qudit_simulator', 'backend_version': '0.0.2', 'header': {}, 'job_id': 58, 'qobj_id': None, 'results': [{'data': {'memory': ['0', '0', '0', '0']}, 'header': {'extra metadata': 'None', 'name': 'SingleQudit'}, 'shots': 4, 'success': True}, {'data': {'memory': ['0', '0', '0', '0']}, 'header': {'extra metadata': 'None', 'name': 'SingleQudit'}, 'shots': 4, 'success': True}, {'data': {'memory': ['1', '1', '1', '1']}, 'header': {'extra metadata': 'None', 'name': 'SingleQudit'}, 'shots': 4, 'success': True}, {'data': {'memory': ['1', '1', '1', '0']}, 'header': {'extra metadata': 'None', 'name': 'SingleQudit'}, 'shots': 4, 'success': True}, {'data': {'memory': ['1', '1', '1', '1']}, 'header': {'extra metadata': 'None', 'name': 'SingleQudit'}, 'shots': 4, 'success': True}, {'data': {'memory': ['1', '1', '1', '1']}, 'header': {'extra metadata': 'None', 'name': 'SingleQudit'}, 'shots': 4, 'success': True}, {'data': {'memory': ['1', '0', '1', '1']}, 'header': {'extra metadata': 'None', 'name': 'SingleQudit'}, 'shots': 4, 'success': True}, {'data': {'memory': ['1', '0', '1', '1']}, 'header': {'extra metadata': 'None', 'name': 'SingleQudit'}, 'shots': 4, 'success': True}, {'data': {'memory': ['1', '0', '1', '0']}, 'header': {'extra metadata': 'None', 'name': 'SingleQudit'}, 'shots': 4, 'success': True}, {'data': {'memory': ['0', '0', '0', '0']}, 'header': {'extra metadata': 'None', 'name': 'SingleQudit'}, 'shots': 4, 'success': True}, {'data': {'memory': ['0', '0', '0', '0']}, 'header': {'extra metadata': 'None', 'name': 'SingleQudit'}, 'shots': 4, 'success': True}], 'status': 'finished', 'success': True} The result of the calculation ```python measurements = [] for res in results_dict["results"]: shots = np.array(res['data']['memory']) shots = [shot.split(' ') for shot in shots] #print(shots.shape) for ii, el in enumerate(shots): shots[ii] = [int(meas) for meas in el][0] measurements.append(shots) measurements = np.array(measurements) ``` ```python f, ax = plt.subplots() ax.plot(phases, measurements, 'ro', alpha = 0.3) ax.plot(phases, 2*(1-np.cos(phases)), 'r-', lw = 3) ax.set_ylabel(r'$L_z + l$') ax.set_xlabel(r'$\phi_z$') ``` ## Ramsey cycle The gate sequence for the Ramsey cycle is $e^{i (\pi/2) L_x} e^{i \varphi L_z} e^{i (\pi/2) L_x}$ ```python n_phases = 11 # number of phases we would like to investigate phases = np.linspace(0,2*np.pi,n_phases) job_payload = {} for ii in range(n_phases): exp_str = 'experiment_' + str(ii) dummy_exp = { 'instructions': [ ('rLx', [0], [np.pi/2]), ('rLz', [0], [phases[ii]]), ('rLx', [0], [np.pi/2]), ('measure', [0], []), ], 'num_wires': 1, 'shots': 5 } job_payload[exp_str] = dummy_exp print(job_payload) ``` {'experiment_0': {'instructions': [('rLx', [0], [1.5707963267948966]), ('rLz', [0], [0.0]), ('rLx', [0], [1.5707963267948966]), ('measure', [0], [])], 'num_wires': 1, 'shots': 5}, 'experiment_1': {'instructions': [('rLx', [0], [1.5707963267948966]), ('rLz', [0], [0.6283185307179586]), ('rLx', [0], [1.5707963267948966]), ('measure', [0], [])], 'num_wires': 1, 'shots': 5}, 'experiment_2': {'instructions': [('rLx', [0], [1.5707963267948966]), ('rLz', [0], [1.2566370614359172]), ('rLx', [0], [1.5707963267948966]), ('measure', [0], [])], 'num_wires': 1, 'shots': 5}, 'experiment_3': {'instructions': [('rLx', [0], [1.5707963267948966]), ('rLz', [0], [1.8849555921538759]), ('rLx', [0], [1.5707963267948966]), ('measure', [0], [])], 'num_wires': 1, 'shots': 5}, 'experiment_4': {'instructions': [('rLx', [0], [1.5707963267948966]), ('rLz', [0], [2.5132741228718345]), ('rLx', [0], [1.5707963267948966]), ('measure', [0], [])], 'num_wires': 1, 'shots': 5}, 'experiment_5': {'instructions': [('rLx', [0], [1.5707963267948966]), ('rLz', [0], [3.141592653589793]), ('rLx', [0], [1.5707963267948966]), ('measure', [0], [])], 'num_wires': 1, 'shots': 5}, 'experiment_6': {'instructions': [('rLx', [0], [1.5707963267948966]), ('rLz', [0], [3.7699111843077517]), ('rLx', [0], [1.5707963267948966]), ('measure', [0], [])], 'num_wires': 1, 'shots': 5}, 'experiment_7': {'instructions': [('rLx', [0], [1.5707963267948966]), ('rLz', [0], [4.39822971502571]), ('rLx', [0], [1.5707963267948966]), ('measure', [0], [])], 'num_wires': 1, 'shots': 5}, 'experiment_8': {'instructions': [('rLx', [0], [1.5707963267948966]), ('rLz', [0], [5.026548245743669]), ('rLx', [0], [1.5707963267948966]), ('measure', [0], [])], 'num_wires': 1, 'shots': 5}, 'experiment_9': {'instructions': [('rLx', [0], [1.5707963267948966]), ('rLz', [0], [5.654866776461628]), ('rLx', [0], [1.5707963267948966]), ('measure', [0], [])], 'num_wires': 1, 'shots': 5}, 'experiment_10': {'instructions': [('rLx', [0], [1.5707963267948966]), ('rLz', [0], [6.283185307179586]), ('rLx', [0], [1.5707963267948966]), ('measure', [0], [])], 'num_wires': 1, 'shots': 5}} we first send the job to the server ```python url= url_prefix + "post_job/" job_response = requests.post(url, data={'json':json.dumps(job_payload),'username': username,'password':password}) job_id = (job_response.json())['job_id'] print(job_response.text) ``` {"job_id": 59, "status": "INITIALIZING", "detail": "Got your json."} Test for completion. ```python status_payload = {'job_id': job_id} url= url_prefix + "get_job_status/" status_response = requests.get(url, params={'json':json.dumps(status_payload),'username': username,'password':password}) print(status_response.text) ``` {"job_id": 59, "status": "DONE", "detail": "Got your json.; Passed json sanity check; Compilation done. Shots sent to solver"} Obtaining results ```python result_payload = {'job_id': job_id} url= url_prefix + "get_job_result/" result_response = requests.get(url, params={'json':json.dumps(result_payload),'username': username,'password':password}) results_dict = json.loads(result_response.text) print(result_response.text) ``` {"backend_name": "synqs_single_qudit_simulator", "backend_version": "0.0.2", "job_id": 59, "qobj_id": null, "success": true, "status": "finished", "header": {}, "results": [{"header": {"name": "SingleQudit", "extra metadata": "None"}, "shots": 5, "success": true, "data": {"memory": ["1", "1", "1", "1", "1"]}}, {"header": {"name": "SingleQudit", "extra metadata": "None"}, "shots": 5, "success": true, "data": {"memory": ["1", "1", "1", "1", "1"]}}, {"header": {"name": "SingleQudit", "extra metadata": "None"}, "shots": 5, "success": true, "data": {"memory": ["1", "0", "0", "1", "1"]}}, {"header": {"name": "SingleQudit", "extra metadata": "None"}, "shots": 5, "success": true, "data": {"memory": ["0", "1", "0", "1", "0"]}}, {"header": {"name": "SingleQudit", "extra metadata": "None"}, "shots": 5, "success": true, "data": {"memory": ["0", "0", "0", "0", "0"]}}, {"header": {"name": "SingleQudit", "extra metadata": "None"}, "shots": 5, "success": true, "data": {"memory": ["0", "0", "0", "0", "0"]}}, {"header": {"name": "SingleQudit", "extra metadata": "None"}, "shots": 5, "success": true, "data": {"memory": ["0", "0", "0", "0", "0"]}}, {"header": {"name": "SingleQudit", "extra metadata": "None"}, "shots": 5, "success": true, "data": {"memory": ["0", "0", "0", "1", "1"]}}, {"header": {"name": "SingleQudit", "extra metadata": "None"}, "shots": 5, "success": true, "data": {"memory": ["1", "1", "0", "1", "0"]}}, {"header": {"name": "SingleQudit", "extra metadata": "None"}, "shots": 5, "success": true, "data": {"memory": ["1", "1", "0", "1", "1"]}}, {"header": {"name": "SingleQudit", "extra metadata": "None"}, "shots": 5, "success": true, "data": {"memory": ["1", "1", "1", "1", "1"]}}]} The result of the Ramsey cycle is ```python measurements = [] for res in results_dict["results"]: shots = np.array(res['data']['memory']) shots = [shot.split(' ') for shot in shots] #print(shots.shape) for ii, el in enumerate(shots): shots[ii] = [int(meas) for meas in el][0] measurements.append(shots) measurements = np.array(measurements) ``` ```python f, ax = plt.subplots() ax.plot(phases, measurements, 'ro', alpha = 0.3) ax.plot(phases, 2*(1+np.cos(phases)), 'r-', lw = 3) ax.set_ylabel(r'$L_z + l$') ax.set_xlabel(r'$\phi_z$') ``` # Load gate we need to make it possible to change the length of the spin. So we will introduce the load gate. The second parameter describes the number of atoms loaded onto the wire. ```python job_payload = { 'experiment_0': { 'instructions': [ ('load', [0], [50]), ('rLx', [0], [np.pi]), ('measure', [0], []), ], 'num_wires': 1, 'shots': 4 }, } ``` ```python url= url_prefix + "post_job/" job_response = requests.post(url, data={'json':json.dumps(job_payload),'username': username,'password':password}) job_id = (job_response.json())['job_id'] print(job_response.text) ``` {"job_id": 60, "status": "INITIALIZING", "detail": "Got your json."} ```python result_payload = {'job_id': job_id} url= url_prefix + "get_job_result/" result_response = requests.get(url, params={'json':json.dumps(result_payload),'username': username,'password':password}) print(result_response.text) ``` {"backend_name": "synqs_single_qudit_simulator", "backend_version": "0.0.2", "job_id": 60, "qobj_id": null, "success": true, "status": "finished", "header": {}, "results": [{"header": {"name": "SingleQudit", "extra metadata": "None"}, "shots": 4, "success": true, "data": {"memory": ["50", "50", "50", "50"]}}]} # Test the seed ```python job_payload = { 'experiment_0': { 'instructions': [ ('load', [0], [50]), ('rLx', [0], [np.pi/2]), ('measure', [0], []), ], 'num_wires': 1, 'shots': 3, 'seed': 12345 }, 'experiment_1': { 'instructions': [ ('load', [0], [50]), ('rLx', [0], [np.pi/2]), ('measure', [0], []), ], 'num_wires': 1, 'shots': 3, 'seed': 12345 }, } ``` ```python url= url_prefix + "post_job/" job_response = requests.post(url, data={'json':json.dumps(job_payload),'username': username,'password':password}) job_id = (job_response.json())['job_id'] print(job_response.text) ``` {"job_id": 64, "status": "INITIALIZING", "detail": "Got your json."} ```python result_payload = {'job_id': job_id} url= url_prefix + "get_job_result/" result_response = requests.get(url, params={'json':json.dumps(result_payload),'username': username,'password':password}) results_dict = json.loads(result_response.text) pprint(results_dict) ``` {'backend_name': 'synqs_single_qudit_simulator', 'backend_version': '0.0.2', 'header': {}, 'job_id': 64, 'qobj_id': None, 'results': [{'data': {'memory': ['30', '23', '22']}, 'header': {'extra metadata': 'None', 'name': 'SingleQudit'}, 'shots': 3, 'success': True}, {'data': {'memory': ['30', '23', '22']}, 'header': {'extra metadata': 'None', 'name': 'SingleQudit'}, 'shots': 3, 'success': True}], 'status': 'finished', 'success': True} ```python ```